MediaWiki:RCLink.js

/** * @Name           RCLink * @Version        v1.0 * @Author(s)      TheGoldenPatrik1 * @Description    Replaces the Explore WikiActivity link with an RC Link. */ (function {   // Double-Load Protection    if (window.RCLinkLoaded) {        return;    }    window.RCLinkLoaded = true;    // Get Config    config = mw.config.get([ 'wgFormattedNamespaces', 'wgUserLanguage' ]);   // Main Function    function init(text) {        // Add RC Link        $('a[data-tracking="explore-activity"]').parent.parent.prepend( $('').append(               $('', { href: new mw.Uri(                       mw.util.getUrl(config.wgFormattedNamespaces[-1]+':RecentChanges')                    ).extend({                        'limit': window.RCLinkLimit                    }).toString, 'data-tracking': 'explore-rc', text: text })           )        );        // Remove Activity Link        if (!window.KeepActivityLink) {            $('a[data-tracking="explore-activity"]').remove;        }    }    // Get MW Messages    mw.loader.using('mediawiki.api').then(function { new mw.Api.get({           action: 'query',            meta: 'allmessages',            ammessages: 'recentchanges',            amlang: config.wgUserLanguage        }).done(function(d) {            if (!d.error) {                init(d.query.allmessages[0]['*']);            }        }); }); });