Jump to content

User:Beetstra/Gadget-Contribslog.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.
/**
 * Support for better display of log entries at en.wikipedia.
 * Tested only in Chrome.
 *
 * Author: [[:User:Beetstra]], October 2020
 * License: Quadruple licensed GFDL, GPL, LGPL and Creative Commons Attribution 3.0 (CC-BY-3.0)
 *
 * Version history:
 *
 * - start version on handling spamblacklistlog - 20201029
*/
/*jshint unused:true, eqnull:true, browser:true, white:true, indent:4 */
/*global mw, $ */
// <nowiki>
(function () {
    // Guard against double inclusions
    if (typeof window.BLLogHandler !== 'undefined') {
        return;
    }
    var conf = mw.config.get([
        'wgUserGroups',
        'wgPageName',
        'wgServer',
        'wgScriptPath',
        'wgUserName'
    ]);

    function makeRawLink(name, url, target) {
        var link = document.createElement('a');
        link.setAttribute('href', url);
        if (target) {
            link.setAttribute('target', target);
        }
        link.appendChild(document.createTextNode(name));
        return link;
    }
    function addRequestLinks(name, href, before, parent) {
        parent.insertBefore(document.createTextNode('- '), before);
        parent.insertBefore(makeRawLink(name, href), before);
        parent.insertBefore(document.createTextNode(' '), before);
    }

    if ((conf.wgPageName.substr(0, 21) == 'Special:Contributions')) {
        return;
    }
}());
// </nowiki>
// [[Category:Wikipedia scripts|Contribslog.js]]