User:Sannse/monobook.js

From WikiFur, the furry encyclopedia.
Jump to: navigation, search

Note: After saving, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Clear the cache in Tools → Preferences
function checklink() {
    if(!document.title.indexOf("User contributions") == 0) return;
 
    if(document.getElementById("contentSub").getElementsByTagName("a")[0].innerHTML == "Talk") {
        var link = document.getElementById("contentSub").getElementsByTagName("a")[3];
        checkhref = "subip=OK&ip=" + document.getElementById("contentSub").innerHTML.substring(4,document.getElementById("contentSub").innerHTML.indexOf("(")-1);
    } else {
        var link = document.getElementById("contentSub").getElementsByTagName("a")[4];
        checkhref = "subuser=OK&user=" + document.getElementById("contentSub").getElementsByTagName("a")[0].innerHTML;
    }
    var chLink = document.createElement("a");
    chLink.href = "\/wiki\/Special:CheckUser?" + checkhref;
    chLink.textContent = "Checkuser";
    var space = insertAfter(link.parentNode, document.createTextNode(" | "), link);
    insertAfter(link.parentNode, chLink, space);
}
addOnloadHook(checklink);
ta['ca-checkuser'] = ['', 'CheckUser this person'];
 
// insertAfter by Volte
function insertAfter(parent, node, referenceNode) {
    if(referenceNode.nextSibling) {
        return parent.insertBefore(node, referenceNode.nextSibling);
    } else {
        return parent.appendChild(node);
    }
}