MediaWiki:Gadget-runerealm.js

From RuneRealm Wiki
Jump to navigation Jump to search

After saving, you may need to bypass your browser's cache to see the changes. For further information, see Wikipedia:Bypass your cache.

  • In most Windows and Linux browsers: Hold down Ctrl and press F5.
  • In Safari: Hold down ⇧ Shift and click the Reload button.
  • In Chrome and Firefox for Mac: Hold down both ⌘ Cmd+⇧ Shift and press R.
(function ($, mw) {
  addLink('play', 'Play now and join the fun', 'https://www.runerealm.org/download');
  addLink('discord', 'Join our Discord to talk about wiki content or becoming an editor', 'https://www.runerealm.org/discord');
  //addDiscordLink();

  function addLink(icon, title, url) {
    var link = mw.util.addPortletLink('p-namespaces', url, '',
    // no text - use background-image instead
    'gadget-external-' + icon,
    // button id
    title // title text shown on hover
    );

    // for styling all links at once - addPortletLink only sets an id
    $(link).addClass('gadget-external-icon');
  }
  
  function addDiscordLink(page) {
    var url = 'https://www.runerealm.org/discord';
    var title = 'Join our Discord to talk about wiki content or becoming an editor';

    var link = mw.util.addPortletLink('p-namespaces', url, '',
    // no text - use background-image instead
    'gadget-external-discord',
    // button id
    title // title text shown on hover
    );

    // for styling all links at once - addPortletLink only sets an id
    $(link).addClass('gadget-external-icon');
  }
})(jQuery, mediaWiki);