Skip to content

Instantly share code, notes, and snippets.

@tsuzu
Last active April 29, 2022 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsuzu/9b422d53847bec506e5190b388cb0e2b to your computer and use it in GitHub Desktop.
Save tsuzu/9b422d53847bec506e5190b388cb0e2b to your computer and use it in GitHub Desktop.
Set the anime title as the page title for danime store
// ==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