Jump to content

User:Teknic/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.
/* some of this code based on User:ABCD/monobook.js */

if (window.addEventListener) window.addEventListener("load",init,false);
    else if (window.attachEvent) window.attachEvent("onload",init);
    else{
        window.oldonload = window.onload;
        window.onload = function(){
            window.oldonload();
            init();
    }
}

function init(){
    var toolBar = document.getElementById('toolbar');
    var button = toolBar.getElementsByTagName('a')[0];
    var a = button;
    toolBar.appendChild(a);
    var toolBoxList = document.getElementById('p-tb').getElementsByTagName('ul')[0];
    addlink(toolBoxList , '/wiki/Special:Newpages', 'New pages', '');
    addlink(toolBoxList , '/wiki/Special:Shortpages', 'Short pages', '');
}

function addlink(list, url, name, id){
    var a = document.createElement('a');
    a.href = url;
    a.id = id;
    a.appendChild(document.createTextNode(name));
    var li = document.createElement('li');
    li.appendChild(a);
    list.appendChild(li);
    return li;
}