Jump to content

User:Fox/tabnames.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.
// Tab name fixer (copied from User:Anomie/fix-tab-text.js, target content modified)
/* A simple javascript function to change the text in various tabs at the top of the
 * page. Only tested with the monobook skin.
 */
$(function(){
    var fix=function(id, text){
        var el=document.getElementById(id);
        if(!el) return;
        for(el=el.firstChild; el && el.nodeName!='A'; el=el.nextSibling);
        if(!el) return;
        while(el.firstChild) el.removeChild(el.firstChild);
        el.appendChild(document.createTextNode(text));
    }
 
    /* Add lines as necessary. Use the Firefox DOM inspector or some such to determine
     * the appropriate IDs.
     */
    fix('ca-nstab-user', 'user');
    fix('ca-watch', 'watch');
    fix('ca-unwatch', 'unwatch');
    fix('ca-protect', 'prot');
    fix('ca-move', 'move');
    fix('ca-history', 'hist');
    fix('ca-talk', 'talk');
    fix('ca-edit', 'edit');
    fix('ca-addsection', '+')
    fix('pt-preferences', 'prefs');
    fix('pt-watchlist', 'watchlist');
    fix('pt-mytalk', 'talk');
    fix('pt-mycontris', 'contribs');
    fix('ca-delete', 'nuke');
});
//end tab name fixer