User:SitX/vector-2022.js: Difference between revisions
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) {..." |
No edit summary |
||
Line 3: | Line 3: | ||
document.body.classList.add('is-menu-expanded'); | document.body.classList.add('is-menu-expanded'); | ||
localStorage.setItem("vector-sidebar-visible", "true"); | localStorage.setItem("vector-sidebar-visible", "true"); | ||
} | |||
function forceSidebarForAnonymous() { | |||
if (mw.config.get("wgUserName") === null) { // User is anonymous | |||
expandSidebar(); | |||
} | |||
} | } | ||
if (document.readyState === "complete") { | if (document.readyState === "complete") { | ||
expandSidebar(); | expandSidebar(); | ||
forceSidebarForAnonymous(); | |||
} else { | } else { | ||
window.addEventListener("load", expandSidebar); | window.addEventListener("load", function() { | ||
expandSidebar(); | |||
forceSidebarForAnonymous(); | |||
}); | |||
} | } | ||
Line 16: | Line 26: | ||
if (!document.body.classList.contains('is-menu-expanded')) { | if (!document.body.classList.contains('is-menu-expanded')) { | ||
expandSidebar(); | expandSidebar(); | ||
forceSidebarForAnonymous(); | |||
} | } | ||
} | } |