User:Animum/monobook.js - Wikipedia


Article Images

Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump.
This code will be executed when previewing this page.

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.

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//    |——————————————————————————————————————————————————————————————————————————————————————————————————————————|    //
//    |-| I feel I am not too shabby at JavaScript programming, so feel free to ask me questions about any     |-|    //
//    |-| scripts on this page. Please note that most of these scripts are tested in and developed for Mozilla |-|    //
//    |-| Firefox.                                                                                             |-|    //
//    |——————————————————————————————————————————————————————————————————————————————————————————————————————————|    //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//--------------------------------
// Stuff for everyone
//---------------------------------

//Alphabetized
importScript('User:Ais523/votesymbols.js');
importScript('User:Animum/ais523editcount.js');
importScript('User:Animum/count.js');
importScript('User:Animum/headers.js');
importScript('User:Animum/liveclock.js');
importScript('User:Animum/moveRV.js');
importScript('User:Animum/reset.js');
importScript('User:Animum/revdelete.js');
importScript('User:Animum/rfavote.js'); //Joke script for laughs.  Don't take it seriously.
importScript('User:Animum/usergroups.js');
importScript('User:Animum/watchlistUpdate.js');
TwinkleConfig = {
    deletionSummaryAd               :       "",
    protectionSummaryAd             :       "",
    summaryAd                       :       "",
    showSharedIPNotice              :       false,
    orphanBacklinksOnSpeedyDelete   :       false
};
importScript('User:Gracenotes/amelvand.js');
//Popups enabled in Prefs
    popupHideDelay=0.1;
    popupDelay=0.7;
    popupAdminLinks=true;
    popupsFixDabs=true;
importScript('User:Lupin/recent2.js');
importScript('User:Steel359/protection.js');
importScript('User:Tra/sidebartranslate.js');
importScript('User:Voice of All/Addtabs/monobook.js');
importScript('User:Voice of All/replacetxt.js');
importScript('User:Voice of All/Google/monobook.js');
importScript('User:Voice of All/History/monobook.js');
importScript('User:Voice of All/Adminwarnings/monobook.js');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add LI menu'); 
importScript('Wikipedia:WikiProject User scripts/Scripts/Add tab');
importScript('Wikipedia:WikiProject User scripts/Scripts/Add toolbox link');
importStylesheet('Wikipedia:WikiProject User scripts/Scripts/Add LI menu/css');

addOnloadHook(function () { //Status changer by Misza13
    var subpage = "/Status";
    var scheme = "/StatusTemplate";
    var subpagelink = wgServer + "/wiki/User:" + wgUserName + subpage;
    var logout = document.getElementById( 'pt-logout' );
    //Add the links
    addPortletLink("p-personal", subpagelink + "?action=edit&newstatus=in", "in", "pt-status-in", "I'm in!", "", logout);
    addPortletLink("p-personal", subpagelink + "?action=edit&newstatus=busy", "busy", "pt-status-busy", "I'm busy!", "", logout);
    addPortletLink("p-personal", subpagelink + "?action=edit&newstatus=out", "out", "pt-status-out", "I'm out!", "", logout);
    if (location.href.indexOf("?action=edit&newstatus=") == -1) return; //Are we here to auto-edit the status?
    //Get new status
    var statusRegExp = /\?action=edit&newstatus=(.*)/;
    var status = statusRegExp.exec(location.href)[1];
    //Modify the form
    document.getElementById('wpTextbox1').value = "\{\{User:"+wgUserName+scheme+"|"+status+"\}\}";
    document.getElementById('wpSummary').value = "Status: "+status;
    document.getElementById('wpMinoredit').checked = 'checked';
    //Submit it!
    document.getElementById('editform').submit();
});
 
addOnloadHook(function() {
    var subpagename = wgPageName.split('/')[1];
    addToolboxLink('http://en.wikipedia.org/w/index.php?title=' + wgPageName + '&action=purge', "Purge this page", '', '', '', "Purge the cache for this page.");
    if(!subpagename) {
        if(wgNamespaceNumber != 0) {
            addToolboxLink(wgServer + wgScript + "?title=Special:Prefixindex/" + wgPageName + "/", "Subpages", '', '', '', 'View the subpages of this page');
        }
        if(wgNamespaceNumber == 3 || wgNamespaceNumber == 2) {
            addToolboxLink("http://en.wikipedia.org/w/index.php?title=Special:DeletedContributions&target=" + wgTitle, 'Deleted contributions');
        }
    }
    if(wgCanonicalNamespace == "Template" && document.getElementById("doc_editlinks")) {
        var editsection = document.getElementById("doc_editlinks");
        editsection.innerHTML = '[<a href="' + wgServer + '/wiki/' + wgPageName + '/doc">view</a>]' + "&nbsp;" + '[<a href="'+ wgServer + wgScript + '?title=' + wgPageName + '/doc&action=edit" title="Edit the template documentation for this page">edit</a>]';
    }
});

function PortletMenu(id) { //Taken from [[User:KnowledgeOfSelf/monobook.js]] 
    this.menu = document.getElementById(id);
    this.list = this.menu.getElementsByTagName('ul')[0]; // bypass "<h5>Views</h5>", etc.
    var LIs = this.list.getElementsByTagName('li');
    for (var i=0; i<LIs.length; i++) {
        this[LIs[i].id] = LIs[i];
    }
    this.newItem = function(id, txt, url) { 
        var li = document.createElement('li');
        li.id = id;
        var a = document.createElement('a');
        a.href = url;
        a.appendChild(document.createTextNode(txt));
        li.appendChild(a);
        this[id] = li;
        return li;
    }
    this.append = function(id, txt, url) {
        this.list.appendChild(this.newItem(id, txt, url));
    }
    this.insertBefore = function(old, id, txt, url) {
        this.list.insertBefore(this.newItem(id, txt, url), this[old]);
    }
    this.getText = function(id) { 
        return this[id].getElementsByTagName('a')[0].firstChild.data;
    }
    this.setText = function(id, txt) {
        this[id].getElementsByTagName('a')[0].firstChild.data = txt;
    }
    this.getHref = function(id) {
        return this[id].getElementsByTagName('a')[0].href;
    }
    this.setHref = function(id, url) {
        this[id].getElementsByTagName('a')[0].href = url;
    }
}
 
addOnloadHook(function() {
    var usermenu = new PortletMenu('p-personal');
    document.getElementById('p-personal').getElementsByTagName('ul')[0].style.textTransform = 'none';
    usermenu.setText('pt-mytalk', 'talk');
    usermenu.setText('pt-preferences', 'preferences');
    usermenu.setText('pt-watchlist', 'watchlist');
    usermenu.setText('pt-mycontris', 'contribs');
    usermenu.setText('pt-logout', 'logout');
    if(document.getElementById('ca-edit')) document.getElementById('ca-edit').firstChild.innerHTML = 'edit';
    if(document.getElementById('ca-talk')) document.getElementById('ca-talk').firstChild.innerHTML = 'talk';
});
 

//--------------------------------
// Sysop-only stuff
//--------------------------------

if(wgUserGroups.indexOf("sysop") != -1) {
    importScript('User:Animum/easyblock.js'); //[[User:Animum/easyblock.js]] 
    ebPrefs = {
        displayStatus : false
    };
    importScript('User:Animum/easyblock.js/parseUsers.js');
    importScript('User:Animum/massdelete.js');
    importScript('User:Animum/userrights.js');
    var showTab = false;
    importScript('User:Animum/twinkledelimages.js');
    if(wgNamespaceNumber == 14) importScript('User:AzaToth/twinklebatchdelete.js'); 
    importScript('User:Voice of All/Deletion/monobook.js');
    importScript('User:Voice of All/Protection/monobook.js');
    importScript('User:Voice of All/Sleeper/monobook.js');
    importScript('User:Voice of All/Specialadmin/monobook.js');
    Mvaluejs_class = '';
    Rvaluejs_class = '';
    Uvaluejs_class = '';
    importScript('User:Mr.Z-man/closeAFD.js');
}


//--------------------------------
// Section for experimentation
//--------------------------------