Last active
April 29, 2022 15:24
-
-
Save tsuzu/9b422d53847bec506e5190b388cb0e2b to your computer and use it in GitHub Desktop.
Set the anime title as the page title for danime store
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name danime store title | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://animestore.docomo.ne.jp/animestore/sc_d_pc* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const updateTitle = () => { | |
document.title = document.querySelector(".pauseInfoTxt1").innerText + " " + document.querySelector(".pauseInfoTxt2").innerText + " " + document.querySelector(".pauseInfoTxt3").innerText | |
}; | |
const initializer = () => { | |
const target = document.querySelector(".pauseInfoIn"); | |
console.log(target); | |
if(!target) { | |
setTimeout(initializer, 1000); | |
} | |
updateTitle(); | |
const observer = new MutationObserver((mutations) => { | |
updateTitle(); | |
}); | |
const config = { attributes: true, subtree: true, childList: true, characterData: true }; | |
observer.observe(target, config); | |
} | |
setTimeout(initializer, 1000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment