MediaWiki:Gadget-runerealm.js: Difference between revisions

From RuneRealm Wiki
Jump to navigation Jump to search
Content added Content deleted
No edit summary
No edit summary
 
Line 1: Line 1:
(function ($, mw) {
(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');
addLink('discord', 'Join our Discord to talk about wiki content or becoming an editor', 'https://www.runerealm.org/discord');
//addDiscordLink();
//addDiscordLink();

Latest revision as of 12:51, 20 October 2024

(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);