Jump to content

User:Nx/vector.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Nx (talk | contribs) at 19:52, 19 July 2010 (future-proofing). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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.
nx_hfn_strict = true;

importScript('User:Nx/HideFakeNotice.js');
importScript('MediaWiki:Gadget-vectorskin-thunks.js');

function addSinceTab() {

    // Default number of revisions to check. Set to 0 to use your usual default for a history page.
    // Sensible options might be 300, 500 or 750. Values up to 5000 are valid, but will be quite slow.

    if (!window.defaultdiffs) defaultdiffs=0;

    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" + ((defaultdiffs <= 0) ? "" : "&limit=" + defaultdiffs ), 'since', '', "all changes since your last edit");
    }
}
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 hists=document.getElementById("pagehistory").getElementsByTagName('li');
        for (n=1;n<hists.length;n++) {
            if (getElementsByClassName(hists[n],'*','mw-userlink')[0].innerHTML==wgUserName)
                document.location=getElementsByClassName(hists[n],'*','mw-history-histlinks')[0].getElementsByTagName("a")[0].href;
                return;
            }
        }

        msg.replaceChild(document.createTextNode
                         ("You have not edited this page! (recently).  Look at more edits? "),
                         msg.firstChild);

        var lookharderA = document.createElement("A");
        lookharderA.href = wgServer + '/w/index.php?title='+wgPageName+'&action=history&gotosince=true&limit=1000';
        lookharderA.innerHTML = '1000';

        msg.appendChild(lookharderA);

        msg.appendChild(document.createTextNode
                         (" "));

        lookharderA = document.createElement("A");
        lookharderA.href = wgServer + '/w/index.php?title='+wgPageName+'&action=history&gotosince=true&limit=2500';
        lookharderA.innerHTML = '2500';

        msg.appendChild(lookharderA);

        msg.appendChild(document.createTextNode
                         (" "));

        lookharderA = document.createElement("A");
        lookharderA.href = wgServer + '/w/index.php?title='+wgPageName+'&action=history&gotosince=true&limit=5000';
        lookharderA.innerHTML = '5000';

        msg.appendChild(lookharderA);

}

addOnloadHook(addSinceTab);