Jump to content

User:ScudLee/monobook.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
function moreLinks () {
    var tabs = document.getElementById('p-cactions').cloneNode(true);
    tabs.id = 'mytabs';
    var listitems = tabs.getElementsByTagName('LI');
    for (i=0;i<listitems.length;i++) {
        if(listitems[i].id) listitems[i].id = 'mytabs-' + listitems[i].id;
    }
    document.getElementById('column-content').appendChild(tabs);
}

if (window.addEventListener) window.addEventListener("load",moreLinks,false);
    else if (window.attachEvent) window.attachEvent("onload",moreLinks);

function moveCatLinks () {
    var cats = document.getElementById('catlinks');
    if (cats) {
        cats.className = 'portlet';
        var cathead = document.createElement('H5');
        cats.insertBefore(cathead, cats.firstChild);
        var catsA = cats.getElementsByTagName('A');    
        cathead.appendChild(catsA[0]);
        var catsdiv = document.createElement('DIV');
        var catsP = cats.getElementsByTagName('P')[0];
        cats.insertBefore(catsdiv, catsP);
        catsdiv.className = 'pBody';
        var catsul = document.createElement('UL');
        catsdiv.appendChild(catsul);
        for (i=1;i<catsA.length;i++) { 
            var catsli = document.createElement('LI');
            catsul.appendChild(catsli);
            catsli.appendChild(catsA[i]);
        }
        catsP.parentNode.removeChild(catsP);      
        var sidebar = document.getElementById('column-one');
        var lang = document.getElementById('p-lang');
        if (lang) sidebar.insertBefore(cats, lang);
            else sidebar.appendChild(cats);
    }
}

if (window.addEventListener) window.addEventListener("load",moveCatLinks,false);
    else if (window.attachEvent) window.attachEvent("onload",moveCatLinks);