Community Central
Community Central
No edit summary
(disable redirect links)
Line 12: Line 12:
 
// because spelling is important
 
// because spelling is important
 
$('a[data-name="customize"]').html('Customise');
 
$('a[data-name="customize"]').html('Customise');
  +
  +
// disable redirect links
  +
$('.mw-redirect, .allpagesredirect a').each(function() {
  +
if (this.href.indexOf('?') === -1) {
  +
$(this).attr('href', this.href + '?redirect=no');
  +
} else if (this.href.indexOf('redirect=no') === -1) {
  +
$(this).attr('href', this.href + '&redirect=no');
  +
}
  +
});
   
 
// add 'used templates' link in wide-mode edit panel
 
// add 'used templates' link in wide-mode edit panel

Revision as of 17:38, 22 October 2014

importArticles({
  type: 'script',
  articles: [
    'u:dev:CacheCheck/code.js',
    'u:dev:NullEditButton/code.js',
    'u:dev:RevealAnonIP/usercode.js',
    'u:dev:NoImageLightbox/code.js'
  ]
});

// because spelling is important
$('a[data-name="customize"]').html('Customise');

// disable redirect links
$('.mw-redirect, .allpagesredirect a').each(function() {
  if (this.href.indexOf('?') === -1) {
    $(this).attr('href', this.href + '?redirect=no');
  } else if (this.href.indexOf('redirect=no') === -1) {
    $(this).attr('href', this.href + '&redirect=no');
  }
});

// add 'used templates' link in wide-mode edit panel
$('<ul class="text-links" style="display: none;"><li class="tmpl_listused"><a onclick="WikiaEditor.callFunction(5)">Used templates</a></li></ul>').appendTo('.checkboxes');

// link to S:RC in 'Recent Wiki Activity' rail module
$('.WikiaRail').on('afterLoad.rail', function () {
  $('#WikiaRecentActivity .more').html('Wiki Activity &gt;').after('<br/><a href="' +  mw.util.getUrl('Special:RecentChanges') + '" class="more">Recent Changes &gt;</a>');
});

// quick prefix search w/ namespace
function getPrefixLI($ns, $nsname) {
  return '<li class="overflow"><a href="' +  mw.util.getUrl('Special:PrefixIndex', {prefix: mw.config.get('wgTitle'), namespace: $ns}) + '">Prefix search (' + ($nsname || $ns) + ')</a></li>';
}
if (mw.config.get('wgNamespaceNumber') !== -1)
  $(getPrefixLI('0', 'Main') + getPrefixLI('220', 'Gracenote') + getPrefixLI('222', 'LyricFind')).appendTo('.tools-menu');

// ----- derived from c:dev:AdvancedOasisUI -----
// add 'contributions' and 'watchlist' to accountnav
$('#AccountNavigation > li > ul.subnav > li:has(a[data-id="preferences"])').after('<li><a href="' +  mw.util.getUrl('Special:Watchlist') + '">My watchlist</a></li><li><a href="' +  mw.util.getUrl('Special:Contributions/' + mw.config.get('wgUserName')) + '">My contributions</a></li>');

// ----- derived from c:dev:DisplayTimer -----
// UTC time on right of oasis toolbar w/ purge option
jQuery(function($) {
  var $parent = $('<li id="displayTimer" style="float: right; border: 0; margin-right: 10px;"/>'),
      $node = $('<a title="Purge current page cache" href="' + mw.util.getUrl(mw.config.get('wgPageName'), {action: 'purge'}) + '"/>').appendTo($parent);

  function updateDate() {
    $node.text(new Date().toUTCString().replace('GMT', 'UTC').slice(5));
  }

  $parent.appendTo('.tools');
  updateDate();
  window.setInterval(updateDate, 1000);
  $parent = null;
});