MediaWiki:Vector-2022.js
Appearance
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.
/* UVLists: pin the main menu for public visitors. */
(function () {
if (mw.config.get('wgUserName')) {
return;
}
var root = document.documentElement;
function pinMainMenu() {
if (!root.classList.contains('vector-animations-ready')) {
return false;
}
var button = document.querySelector(
'[data-event-name="pinnable-header.vector-main-menu.pin"]'
);
if (!button) {
return false;
}
button.click();
return true;
}
if (pinMainMenu()) {
return;
}
var observer = new MutationObserver(function () {
if (pinMainMenu()) {
observer.disconnect();
}
});
observer.observe(root, {
attributes: true,
attributeFilter: ['class']
});
// Stop watching if the expected controls never become available.
window.setTimeout(function () {
observer.disconnect();
}, 15000);
}());