User:Equazcion/monobook.js

From Wikipedia, the free encyclopedia

If a message on your talk page led you here, please be wary of who left it. The code below could contain malicious content capable of compromising your account; if your account appears to be compromised, it will be blocked. If you are unsure whether the code is safe, you can ask at the appropriate village pump.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
importScript('User:AzaToth/twinkle.js');
TwinkleConfig = {
        revertMaxRevisions              :       50,
        userTalkPageMode                :       'window',
        showSharedIPNotice              :       true,
        openTalkPage                    :       [ 'agf', 'norm', 'vand' ],
        openTalkPageOnAutoRevert        :       false,
        openAOLAnonTalkPage             :       false,
        summaryAd                       :       "",
        deletionSummaryAd               :       "",
        protectionSummaryAd             :       "",
        watchSpeedyPages                :       [ 'g3', 'g5', 'g10', 'g11', 'g12' ],
        watchProdPages                  :       true,
        openUserTalkPageOnSpeedyDelete  :       [ 'g1', 'g2', 'g10', 'g11', 'g12', 'a1', 'a7', 'i3', 'i4', 'i5', 'i6', 'i7', 'u3', 't1' ],
        watchRevertedPages              :       [ 'agf', 'norm', 'vand', 'torev' ],
        markRevertedPagesAsMinor        :       [ 'agf', 'norm', 'vand', 'torev' ]
};
 
importScript('User:AzaToth/morebits.js');
importScript('User:AzaToth/twinklefluff.js');
importScript('User:AzaToth/twinkleprod.js');
 
//Section Zero 
addOnloadHook(function () {
var x;
if (!(x = document.getElementById('ca-edit') )) return;
var url;
if (!(url = x.getElementsByTagName('a')[0] )) return;
if (!(url = url.href )) return;
var y = addPortletLink('p-cactions', url+"&section=0", '0', 'ca-edit-0',
'Edit the lead section of this page', '0', x.nextSibling);
 
y.className = x.className;  // steal classes from the the edit tab...
<nowiki>x.className = 'istalk';     // ...and make the edit tab have no right margin</nowiki>
 
// exception: don't steal the "selected" class unless actually editing section 0:
if (/(^| )selected( |$)/.test(y.className)) {
if (!document.editform || !document.editform.wpSection
|| document.editform.wpSection.value != "0") {
y.className = y.className.replace(/(^| )selected( |$)/g, "$1");
x.className += ' selected';
}
}
});
//End Section Zero
 
//Six tabs ///
if (wgNamespaceNumber >= 0)
addOnloadHook(function(){
 var pCactions = document.getElementById('p-cactions');
 if (!pCactions) return;
 var caMain = pCactions.getElementsByTagName('li')[0];
 var caTalk = document.getElementById('ca-talk');
 var caEdit = document.getElementById('ca-edit');
 if (!caEdit) caEdit = document.getElementById('ca-viewsource');
 var caHistory = document.getElementById('ca-history');
 if (!caMain || !caTalk || !caEdit || !caHistory) return;
 var el_move, el_create, id2;
 if (wgNamespaceNumber % 2) { //talk space
   el_move = caTalk; el_create = caMain; id2 = '';
 } else {
   el_move = caMain; el_create = caTalk; id2 = 'discussion';
 }
 caEdit.firstChild.innerHTML = 'edit';
 caHistory.firstChild.innerHTML = 'hist';
 el_move.parentNode.insertBefore(caHistory, el_move.nextSibling);
 el_move.parentNode.insertBefore(caEdit, el_move.nextSibling);
 var href = el_create.firstChild.getAttribute('href', 2);
 if (el_create.className.indexOf('new') < 0){
   addPortletLink('p-cactions', href + '?action=history', 'hist',
     'ca-history-'+id2, id2+' history', '', el_create.nextSibling);
   addPortletLink('p-cactions', href + '?action=edit', 'edit',
     'ca-edit-'+id2, 'Edit '+id2, '', el_create.nextSibling);
 } 
  caMain.style.marginRight = '0.3em'; 
  caTalk.style.marginRight = '0.3em'; 
  caTalk.style.marginLeft  = '1.6em'; 
})
 
// install [[User:Cacycle/wikEdDiff]] enhanced diff view using ajax
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEdDiff.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
//
 
 
 
//adds "contibs" tab to user and user talk pages
if (wgNamespaceNumber == 2 || wgNamespaceNumber == 3) {
    var uname = wgPageName.match(/[^:]*:([^\/]*)/);
    if (uname.length > 1)
        addOnloadHook(function() {
            addPortletLink("p-cactions",
                           "http://en.wikipedia.org/wiki/Special:Contributions/" + uname[1],                        
                           "contribs",
                           "ca-contribs",
                           "Contributions",
                           undefined,
                           document.getElementById("ca-move") || document.getElementById("ca-watch"));
        });
}
 
addOnloadHook(function () {
    if (!wgCanonicalSpecialPageName || wgCanonicalSpecialPageName != "Watchlist") return;
    if (!document.forms[0] || !document.forms[0].namespace) return;
 
    var link = document.createElement('a');
    link.id = 'listSince';
    link.href = '#listSince';  // must have a href to show as link!
 
    var then = +(new Date());
    var fixLinkHref = function () {
        var url = window.location.href.split('#')[0];
        var days = (( +(new Date()) - then ) + (60 * 1000)) / (1000 * 3600 * 24);
        if (url.match(/[?&]days=/))
            this.href = url.replace(/([?&]days=)[^&]*/, '$1'+days);
        else
            this.href = url + (url.indexOf('?') < 0 ? '?':'&') + 'days=' + days;
        return true;
    };
    link.onclick = fixLinkHref;
    link.onmousedown = fixLinkHref;  // react to middle clicks too
 
    var frag = document.createDocumentFragment();
    frag.appendChild(document.createTextNode(' | '));
    frag.appendChild(link);
    link.appendChild(document.createTextNode('Changes'));
    frag.appendChild(document.createTextNode(' since last load.'));
 
    // just one little ID attribute would be _so_ nice...
    var nsSelectForm = document.getElementsByTagName('form')[0];
    nsSelectForm.parentNode.insertBefore(frag, nsSelectForm);
});
 
//
 
addOnloadHook(function () {
    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;
    }
 
    content = document.getElementById("content");    // Find the content div
    content.parentNode.insertBefore(tabs, content.nextSibling);    // Place tab list right after content div
});
 
//"Changes since my last edit" tab
 
//From http://en.wikipedia.org/w/index.php?title=User:JesseW/monobook.js&oldid=20755510
function addSinceTab() {
    if (window.location.href.indexOf("&action=history&gotosince=true")!=-1) {
       do_since_I_last_edited()
    }
    else if (wgCanonicalNamespace != "Special") {
       addPortletLink("p-cactions", "/w/index.php?title="+wgPageName+"&action=history&gotosince=true", 'since', '', "since");
    }
}
function do_since_I_last_edited() {
        var csub=document.getElementById("contentSub");
        var msg=document.createElement("p");
        msg.appendChild(document.createTextNode
                        ("Parsing history... please wait..."));
        msg.className="error";
        csub.insertBefore(msg, csub.firstChild)
 
        var username=document.getElementById("pt-userpage").textContent;
        var hists=document.getElementById("pagehistory").getElementsByTagName('li');
        for (n=0;n<hists.length;n++) {
            if (hists[n].getElementsByTagName("span")[0].getElementsByTagName('a')[0].textContent==username) {
                document.location=hists[n].childNodes[1].href; 
                return;
            }
        }
 
        msg.replaceChild(document.createTextNode
                         ("You have not edited this page! (recently)"),
                         msg.firstChild);
}
addOnloadHook(addSinceTab);
//
 
//Add AJAX unwatch links
if (wgCanonicalSpecialPageName && wgCanonicalSpecialPageName=='Watchlist' && wgAction=='view') 
addOnloadHook(function () {
 var frm = document.getElementsByTagName('form')[0];
 frm.parentNode.insertBefore(document.createTextNode(' | '), frm);
 var lnk = document.createElement('a');
 lnk.appendChild(document.createTextNode('Unwatch…'));
 lnk.href = 'javascript:importScript("User:Alex_Smotrov/wlunwatch.js")';
 frm.parentNode.insertBefore(lnk, frm);
})
 
//custom add section tab
addOnloadHook(function() {
    var tab = document.getElementById('ca-addsection');
    if(!tab) return;
    var tablink = tab.getElementsByTagName('a')[0];
    if(!tablink) return;
    tablink.firstChild.nodeValue = '+new section';
    tablink.style.paddingLeft = ".4em";
    tablink.style.paddingRight = ".4em";
 
});
 
importScript('User:Cameltrader/Advisor.js');
 
importScript('User:Tra/userwatchlist.js'); //[[User:Tra/userwatchlist.js]]
 
importScript('User:Ais523/votesymbols.js');
 
importScript('User:Ais523 non-admin/adminrights.js');
 
importScript('User:Dr_pda/prosesize.js');
 
importScript('User:Dr_pda/generatestats.js');
 
importScript('User:Dr pda/editrefs.js');