Jump to content

User:Vacation9/userlinks.js

From Wikipedia, the free encyclopedia
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.
$(function () {
    var title = mw.config.get('wgTitle');
    title = title.replace(/\/.*/, "");  // subpage name only
    if (mw.config.get('wgCanonicalNamespace') == "Special")
        return;  // no links for special
    mw.util.addPortletLink('p-tb', '//en.wikipedia.org/w/index.php?title=Special%3ALog&type=delete&page='+mw.config.get('wgTitle'), 'Deletion log', 't-dellog', 'Deletion log for "'+mw.config.get('wgTitle')+'"', 'Y');
    if (mw.config.get('wgCanonicalNamespace') != "User" && mw.config.get('wgCanonicalNamespace') != "User_talk")
        return;  // links only for User+User talk namespaces
 
    mw.util.addPortletLink('p-tb', '//en.wikipedia.org/w/index.php?title=Special%3ALog&type=block&page=User:'+title, 'Block log', 't-blocklog', 'Block log for "'+title+'"', 'Y');
    mw.util.addPortletLink('p-tb', '//en.wikipedia.org/w/index.php?title=Special%3ALog&type=rights&page=User:'+title, 'Rights log', 't-rightlog', 'User rights log for "'+title+'"', 'Y');
});