MediaWiki:Common.js: Difference between revisions

From Kintara
Jump to navigation Jump to search
Created page with "mw.loader.using('mediawiki.util').then(function () { if (mw.config.get('wgPageName') !== 'Main_Page') { return; } document.querySelectorAll( '.kin-promo.discord .pbody a, .kin-promo.xbox .pbody a' ).forEach(function (link) { link.setAttribute('target', '_blank'); link.setAttribute('rel', 'nofollow noopener noreferrer'); }); });"
 
No edit summary
Tag: Reverted
Line 1: Line 1:
mw.loader.using('mediawiki.util').then(function () {
mw.loader.using('mediawiki.util').then(function () {
   if (mw.config.get('wgPageName') !== 'Main_Page') {
   // Open Discord sidebar/button links in a new tab everywhere.
    return;
   document.querySelectorAll('a[href*="discord.gg/kintara"]').forEach(function (link) {
  }
 
   document.querySelectorAll(
    '.kin-promo.discord .pbody a, .kin-promo.xbox .pbody a'
  ).forEach(function (link) {
     link.setAttribute('target', '_blank');
     link.setAttribute('target', '_blank');
     link.setAttribute('rel', 'nofollow noopener noreferrer');
     link.setAttribute('rel', 'nofollow noopener noreferrer');
   });
   });
  // Main Page social cards: open the card links in a new tab.
  if (mw.config.get('wgPageName') === 'Main_Page') {
    document.querySelectorAll(
      '.kin-promo.discord .pbody a, .kin-promo.xbox .pbody a'
    ).forEach(function (link) {
      link.setAttribute('target', '_blank');
      link.setAttribute('rel', 'nofollow noopener noreferrer');
    });
  }
});
});

Revision as of 13:43, 20 June 2026

mw.loader.using('mediawiki.util').then(function () {
  // Open Discord sidebar/button links in a new tab everywhere.
  document.querySelectorAll('a[href*="discord.gg/kintara"]').forEach(function (link) {
    link.setAttribute('target', '_blank');
    link.setAttribute('rel', 'nofollow noopener noreferrer');
  });

  // Main Page social cards: open the card links in a new tab.
  if (mw.config.get('wgPageName') === 'Main_Page') {
    document.querySelectorAll(
      '.kin-promo.discord .pbody a, .kin-promo.xbox .pbody a'
    ).forEach(function (link) {
      link.setAttribute('target', '_blank');
      link.setAttribute('rel', 'nofollow noopener noreferrer');
    });
  }
});