Jump to content

MediaWiki:Common.js

From Once Human Guide
Revision as of 20:07, 8 April 2026 by Bones (talk | contribs)

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.
// Add Road Map tab BEFORE Discord
const tabList = document.querySelector('#p-associated-pages .vector-menu-content-list, #p-namespaces .vector-menu-content-list');
const talkItem = document.querySelector('#ca-talk'); // Discord tab

if (tabList && !document.getElementById('ca-roadmap')) {
    const li = document.createElement('li');
    li.id = 'ca-roadmap';

    const existingTab = talkItem || document.querySelector('#ca-view');

    if (existingTab) {
        li.className = existingTab.className.replace(/\bselected\b|\bactive\b/g, '').trim();
    } else {
        li.className = 'mw-list-item';
    }

    const a = document.createElement('a');
    a.href = 'https://ohwikiguide.com/index.php/Road_Map';
    a.title = 'Road Map';

    const span = document.createElement('span');
    span.textContent = 'Road Map';

    a.appendChild(span);
    li.appendChild(a);

    // 🔥 THIS is the important change
    if (talkItem) {
        tabList.insertBefore(li, talkItem); // puts Road Map BEFORE Discord
    } else {
        tabList.appendChild(li);
    }
}