User:DodoMan/subpages.js

From Test Wiki
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
$(document).ready(function () {
  var NSWithoutSubpages = [-1, 6, 8, 14, 104, 105, 113];
  if (document.getElementById('p-tb') && NSWithoutSubpages.indexOf(mw.config.get('wgNamespaceNumber')) == -1)
    {
    var lienSouspages = '/wiki/Special:Index/';
    if (mw.config.get('wgCanonicalNamespace') === 'Index') {
        lienSouspages += 'Page:' + mw.config.get('wgTitle');
    } else {
        lienSouspages += mw.config.get('wgPageName');
    }
    mw.loader.using('mediawiki.util', function() {
      mw.util.addPortletLink('p-tb', lienSouspages + '/', 'Sous-pages', 't-subpages', 'Sous-pages de cette page');	
    });
    }
});