|
|
| (3 intermediate revisions by the same user not shown) |
| Line 1: |
Line 1: |
| /**
| | $(document).ready(function() { |
| * Winds of Valen Wiki — Common JS
| | $('#ca-nstab-main a').text('Article'); |
| */
| | $('#ca-history a').text('History'); |
| | | $('#ca-view a').text('Read'); |
| /* 1. Force light color scheme immediately (before paint) */
| |
| (function () {
| |
| document.documentElement.style.colorScheme = 'light';
| |
| }());
| |
| | |
| /* 2. Fix Vector 2022 sidebar: switch pinned-disabled → pinned-enabled */
| |
| (function () { | |
| var h = document.documentElement; | |
| h.className = h.className
| |
| .replace('vector-feature-main-menu-pinned-disabled', 'vector-feature-main-menu-pinned-enabled');
| |
| }());
| |
| | |
| /* 3. Load Cinzel + Inter fonts */
| |
| (function () {
| |
| if (!document.getElementById('wov-fonts')) {
| |
| var l = document.createElement('link');
| |
| l.id = 'wov-fonts';
| |
| l.rel = 'stylesheet';
| |
| l.href = 'https://fonts.googleapis.com/css2?family=Cinzel:wght@700&family=PT+Serif:ital,wght@0,400;0,700;1,400&family=Inter:wght@400;600&display=swap';
| |
| document.head.appendChild(l);
| |
| }
| |
| }());
| |
| | |
| document.addEventListener('DOMContentLoaded', function () {
| |
| | |
| /* 4. Move main menu from hamburger dropdown into pinned sidebar slot */
| |
| 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);
| |
| }
| |
| }
| |
| | |
| /* 5. Hide hamburger button since sidebar is now always visible */
| |
| var ham = document.getElementById('vector-main-menu-dropdown');
| |
| if (ham) ham.style.display = 'none';
| |
| | |
| /* 6. Inject Logo banner + Discord button at top of sidebar */
| |
| var sidebarEl = pinned || document.getElementById('vector-main-menu');
| |
| if (sidebarEl) { | |
| var logoImg = document.querySelector('#p-logo img, #p-logo .mw-logo-icon');
| |
| var logoSrc = logoImg ? logoImg.src : '';
| |
| | |
| /* Logo Banner */
| |
| var logoDiv = document.createElement('div');
| |
| logoDiv.className = 'wov-sidebar-logo';
| |
| logoDiv.innerHTML =
| |
| '<a href="/wiki/Main_Page">' +
| |
| (logoSrc ? '<img src="' + logoSrc + '" alt="Winds of Valen Wiki" />' : '') +
| |
| '<div class="wov-sidebar-logo-title">Winds of Valen</div>' +
| |
| '<div class="wov-sidebar-logo-sub">Wiki</div>' +
| |
| '</a>';
| |
| sidebarEl.insertBefore(logoDiv, sidebarEl.firstChild);
| |
| | |
| /* Simple HTML Discord Button */
| |
| var discordDiv = document.createElement('div');
| |
| discordDiv.style.padding = "10px";
| |
| discordDiv.innerHTML = '<a href="https://discord.gg/xxzDqg9xWc" class="wov-discord-btn-link" target="_blank" rel="noopener">Chat on Discord</a>';
| |
| sidebarEl.insertBefore(discordDiv, sidebarEl.children[1]);
| |
| }
| |
| | |
| /* 7. Hide "Main Page" h1 on the Main Page only */
| |
| if (mw && mw.config && mw.config.get('wgPageName') === 'Main_Page') {
| |
| var h1 = document.getElementById('firstHeading');
| |
| if (h1) h1.style.display = 'none';
| |
| var mh = document.querySelector('.mw-first-heading');
| |
| if (mh) mh.style.display = 'none';
| |
| }
| |
| | |
| /* 8. Make .wov-popular-btn spans behave as full-block links */
| |
| document.querySelectorAll('.wov-popular-grid a').forEach(function (a) { | |
| a.style.display = 'block';
| |
| a.style.textDecoration = 'none';
| |
| var span = a.querySelector('.wov-popular-btn');
| |
| if (span) {
| |
| span.style.display = 'block';
| |
| }
| |
| });
| |
| | |
| }); | | }); |