Jump to content

MediaWiki:Common.js: Difference between revisions

From Once Human Guide
No edit summary
No edit summary
Line 17: Line 17:
         }
         }


         // Add Road Map tab
         // Add Road Map tab with matching tab classes
         const tabList = document.querySelector('#p-associated-pages .vector-menu-content-list, #p-namespaces .vector-menu-content-list');
         const tabList = document.querySelector('#p-associated-pages .vector-menu-content-list, #p-namespaces .vector-menu-content-list');
        const existingTab = document.querySelector('#ca-talk, #ca-view');


         if (tabList && !document.getElementById('ca-roadmap')) {
         if (tabList && !document.getElementById('ca-roadmap')) {
             const li = document.createElement('li');
             const li = document.createElement('li');
             li.id = 'ca-roadmap';
             li.id = 'ca-roadmap';
             li.className = 'mw-list-item';
 
             if (existingTab) {
                li.className = existingTab.className;
                li.removeAttribute('class');
                li.className = existingTab.className.replace(/\bselected\b|\bactive\b/g, '').trim();
            } else {
                li.className = 'mw-list-item';
            }


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


            const span = document.createElement('span');
            span.textContent = 'Road Map';
            a.appendChild(span);
             li.appendChild(a);
             li.appendChild(a);
             tabList.appendChild(li);
             tabList.appendChild(li);

Revision as of 20:06, 8 April 2026

mw.loader.using('mediawiki.util').then(function () {
    $(function () {

        // Change Discussion tab to Discord
        const talkTab = document.querySelector('#ca-talk a');

        if (talkTab) {
            talkTab.textContent = 'Discord';
            talkTab.href = 'https://discord.gg/FZtkXeGeUA';
            talkTab.target = '_blank';
            talkTab.rel = 'noopener noreferrer';

            talkTab.addEventListener('click', function (e) {
                e.preventDefault();
                window.open('https://discord.gg/FZtkXeGeUA', '_blank');
            });
        }

        // Add Road Map tab with matching tab classes
        const tabList = document.querySelector('#p-associated-pages .vector-menu-content-list, #p-namespaces .vector-menu-content-list');
        const existingTab = document.querySelector('#ca-talk, #ca-view');

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

            if (existingTab) {
                li.className = existingTab.className;
                li.removeAttribute('class');
                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);
            tabList.appendChild(li);
        }

    });
});