MediaWiki:Common.js
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.
/**
* Winds of Valen Wiki - Common JS
* 1. Force the main nav sidebar to appear pinned (like OSRS wiki)
* 2. Prevent dark mode extensions from inverting the color scheme
*/
// --- Force light color scheme ---
(function () {
var m = document.createElement('meta');
m.name = 'color-scheme';
m.content = 'light only';
document.head.insertBefore(m, document.head.firstChild);
document.documentElement.style.colorScheme = 'light';
}());
// --- Fix the html class: switch pinned-disabled to pinned-enabled ---
(function () {
var html = document.documentElement;
html.className = html.className
.replace('vector-feature-main-menu-pinned-disabled', 'vector-feature-main-menu-pinned-enabled');
}());
// --- Move the main menu DOM from the dropdown into the pinned sidebar slot ---
document.addEventListener('DOMContentLoaded', function () {
var pinned = document.getElementById('vector-main-menu-pinned-container');
var unpinned = document.getElementById('vector-main-menu-unpinned-container');
if (pinned && unpinned && unpinned.children.length > 0 && pinned.children.length === 0) {
while (unpinned.firstChild) {
pinned.appendChild(unpinned.firstChild);
}
}
// Also hide the hamburger dropdown button since sidebar is now visible
var hamburger = document.getElementById('vector-main-menu-dropdown');
if (hamburger) hamburger.style.display = 'none';
});