User:Bequw/SubPages.js

From Wiktionary, the free dictionary
Jump to navigation Jump to search

Note: You may have to bypass your browser’s cache to see the changes. In addition, after saving a sitewide CSS file such as MediaWiki:Common.css, it will take 5-10 minutes before the changes take effect, even if you clear your cache.

  • Mozilla / Firefox / Safari: hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (Command-R on a Macintosh);
  • Konqueror and Chrome: click Reload or press F5;
  • Opera: clear the cache in Tools → Preferences;
  • Internet Explorer: hold Ctrl while clicking Refresh, or press Ctrl-F5.

//IE <=8 doesn't have array.IndexOf()
/*if (!Array.indexOf) {
  Array.prototype.indexOf = function (obj, start) {
    var len = this.length;
    var i = (start || 0);
    if (i < 0)
      i += len;

    for (; i < len; i++) {
      if (this[i] == obj)
        return i;
    }
    return -1;
  }
}*/

/** subpages **/
$(function () {
  var NSWithoutSubpages = new Array(-1, 6, 8, 12, 13, 14, 15, 104, 105);
  if (document.getElementById('p-tb') && NSWithoutSubpages.indexOf(wgNamespaceNumber) == -1)
    {
    var linkSubpages = '/wiki/Special:PrefixIndex/' + wgPageName + '/';
    mw.util.addPortletLink('p-tb', linkSubpages, 'Subpages', 't-subpages', 'Subpages of this page');
    }
});