User:Monster Domosed/common.js: Difference between revisions

Jump to navigation Jump to search
testing
No edit summary
Line 1: Line 1:
/*mw.loader.load('https://deadlock.wiki/index.php?title=User:Monster_Domosed/Wiki_Redesign.js&action=raw&ctype=text/javascript');*/
/*mw.loader.load('https://deadlock.wiki/index.php?title=User:Monster_Domosed/Wiki_Redesign.js&action=raw&ctype=text/javascript');*/


(function() {
    const widthCheck = localStorage.getItem("fixedWidth");
    if (widthCheck === "true") {
        document.documentElement.classList.add("fixed-width-mode");
    }
})();


mw.hook('wikipage.content').add(function() {
mw.hook('wikipage.content').add(function() {
Line 17: Line 23:


     toggleWidth.addEventListener("click", function() {
     toggleWidth.addEventListener("click", function() {
         document.body.classList.toggle("fixed-width-mode");
         document.documentElement.classList.toggle("fixed-width-mode");
         const isActive = document.body.classList.contains("fixed-width-mode");
         const isActive = document.documentElement.classList.contains("fixed-width-mode");
         localStorage.setItem("fixedWidth", isActive);
         localStorage.setItem("fixedWidth", isActive);
     });
     });
    const widthCheck = localStorage.getItem("fixedWidth");
    if (widthCheck === "true") {
        document.body.classList.add("fixed-width-mode");
    }


     personal.prepend(toggleWidth);
     personal.prepend(toggleWidth);