Bruger:Masz/vector.js

Fra Wikipedia, den frie encyklopædi
// BEGIN PATROLLINK
function linkPatrol() {
     if (document.getElementById("n-patrol")) return;
     var li_current = document.getElementById("n-recentchanges");
     if (!li_current) return;
     var li_next = li_current.nextSibling;
     var ul_node = li_current.parentNode;
     var li = document.createElement("li");
     li.setAttribute("id", "n-patrol");
     li.setAttribute("title", "Se ikke-patruljerede ændringer");
     li.appendChild(document.createElement("a"));
     li.firstChild.setAttribute("href","/w/index.php?title=Speciel:Seneste_%C3%A6ndringer&hidepatrolled=1");
     li.firstChild.appendChild(document.createTextNode("Patruljér"));
     ul_node.insertBefore(li, li_next);
}
$(linkPatrol);

/** Autoreturn after marking changes as patrolled ****************************************************** 
 *
 *  Description: If the current page is the final page in the patrol loop, then autoreturn to
 *               recent changes, and filter it for more unpatrolled changes
 *               Only Monobook of the skins are supported, and only Firefox of the various browsers are tested.
 *  Maintainers: [[User:Jeblad]]
 */
 
// the actual action to take
function mpAutoreturnTimer () {
    history.go(-2);
    //document.location = mw.config.get('wgServer') + mw.config.get('wgScript') + '?title=Special:RecentChanges&hidepatrolled=0';
}
 
// test for correct page, and then prepare for autoreturn to recent changes
if (/\b(action=markpatrolled)\b/.test(document.location) && /\b(rcid)\b/.test(document.location)) {
 
//    addOnloadHook( function () {
        try {
            // we have patrolled a contribution, we wait for a few seconds and then leap back
            //setTimeout("mpAutoreturnTimer()", 100);
            history.go(-2);
        }
        catch (e) {
            // just go away without notice 
        }
//    });
 
}