User:SitX/vector-2022.js

From Realm Of Thrones
Revision as of 01:04, 25 March 2025 by SitX (talk | contribs) (Created page with "mw.loader.using('mediawiki.util').then(function() { function expandSidebar() { document.body.classList.add('is-menu-expanded'); localStorage.setItem("vector-sidebar-visible", "true"); } if (document.readyState === "complete") { expandSidebar(); } else { window.addEventListener("load", expandSidebar); } const observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) {...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
mw.loader.using('mediawiki.util').then(function() {
    function expandSidebar() {
        document.body.classList.add('is-menu-expanded');
        localStorage.setItem("vector-sidebar-visible", "true");
    }

    if (document.readyState === "complete") {
        expandSidebar();
    } else {
        window.addEventListener("load", expandSidebar);
    }

    const observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            if (mutation.attributeName === "class") {
                if (!document.body.classList.contains('is-menu-expanded')) {
                    expandSidebar();
                }
            }
        });
    });

    observer.observe(document.body, { attributes: true });
});