User:Ilmari Karonen/rblcheck.js

From Wikipedia, the free encyclopedia

Note: After saving, you have to bypass your browser's cache to see the changes. Firefox/Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.

// RBL CHECK LINK: <pre><nowiki>

addOnloadHook(function () {
    var addr;
    if (wgCanonicalNamespace == "Special" && wgCanonicalSpecialPageName == "Contributions")
        addr = document.forms[0].target.value;
    else if (wgCanonicalNamespace == "User" || wgCanonicalNamespace == "User_talk")
        addr = wgTitle;

    if (!/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/.test(addr)) return;  // not an IP

    addPortletLink('p-tb', 'http://www.robtex.com/rbls/'+addr+'.html',
                   'RBL check', 't-rblcheck', 'Multi-RBL check');
});

// </nowiki></pre>