User:Bubamara/monobook.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
 if (mwCustomEditButtons) {
mwCustomEditButtons[mwCustomEditButtons.length] = {
    "imageFile": "http://sk.wikipedia.org/skins-1.5/common/images/button_image.png",
    "speedTip": "LOC-image",
    "tagOpen": "{{LOC-image|id=",
    "tagClose": "}}",
    "sampleText": ""};
};

function addPurge(){
    ta['ca-purge'] = new Array('g', 'Purge the internal cache for this page');
    if(!document.getElementById) return;
    var x = document.getElementById('ca-history');
    var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
    if(!x) return;
    if(x.children) x = x.children[0];
    else x = x.childNodes[0];
    addlilink(tabs, x.href.replace(/=history/, "=purge"), 'purge', 'ca-purge');
}

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

if (window.addEventListener)
window.addEventListener("load",myLoadFuncs,false);
else if (window.attachEvent)
window.attachEvent("onload",myLoadFuncs);
else {
    window._old_ABCD_onload = window.onload;
    window.onload = function(){
        window._old_ABCD_onload();
        myLoadFuncs();
    }
}        
function myLoadFuncs(){
    addPurge();
}