Jump to content

User:Mike Dillon/Scripts/toolboxTool2Link.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.
// Requires: [[User:Mike Dillon/Scripts/i18n.js]], [[User:Mike Dillon/Scripts/username.js]]

/* <pre><nowiki> */

/* Messages */
wfAddMsg("en", "toolboxTool2LinkLabel", "User edit count");
wfAddMsg("es", "toolboxTool2LinkLabel", "Cuenta de edicions");
wfAddMsg("en", "toolboxTool2LinkTitle", "View this user's edit count");
wfAddMsg("es", "toolboxTool2LinkTitle", "Ver la cuenta de ediciones de este usuario");

if (typeof(generate_input_form) != typeof(function () {})) {
    importScript('User:Interiot/Tool2/code.js');
}

// Add a link to User:Interiot/Tool2/code.js to the p-tb bar.
$(function () {
    // Skip non-user pages
    if (document.getElementById("t-contributions") == null &&
        wgCanonicalSpecialPageName != "Contributions") {
        return;
    }

    // Skip subpages
    if (wgTitle.indexOf("/") != -1) return;

    // Skip if the username can't be deteremined
    var username = getUsernameForCurrentPage();
    if (!username) return;

    var url = wgArticlePath.replace(/\$1/, 'User:Interiot/Tool2/code.js');
    url += "?username=" + encodeURIComponent(username);

    mw.util.addPortletLink('p-tb', url, wfMsg("toolboxTool2LinkLabel"), 't-editcount',
        wfMsg("toolboxTool2LinkTitle"), null,
        document.getElementById('t-emailuser') || document.getElementById('t-upload'));
});

/* </nowiki></pre> */