Jump to content

User:Polygnotus/Scripts/ExtraToolsLinks.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.
mw.loader.using(['mediawiki.util', 'mediawiki.base']).then(function () {

    function addCustomLinks() {
        var portletId = 'p-tb'; // This is the ID for the "Tools" section

        mw.util.addPortletLink(portletId, 'https://toolhub.wikimedia.org/search?ordering=-modified_date&page=1&page_size=50', 'Toolforge', 'toolforge-link');
        mw.util.addPortletLink(portletId, 'https://en.wikipedia.org/wiki/Wikipedia:User_scripts/List', 'Userscripts', 'userscripts-link');
    }

    mw.hook('wikipage.content').add(function () {
        addCustomLinks();
    });
});