Jump to content

User:PrimeHunter/ExpandTemplates.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/* Add "Expand templates" link under Tools to load the current page in [[Special:ExpandTemplates]].
   Install with this in your [[Special:MyPage/common.js]]:

   importScript('User:PrimeHunter/ExpandTemplates.js'); // Linkback: [[User:PrimeHunter/ExpandTemplates.js]]
*/

$( document ).ready( function() {
  mw.util.addPortletLink(
    'p-tb',
    mw.util.getUrl( 'Special:ExpandTemplates' ) + '?wpInput={{:' +
      encodeURIComponent(mw.config.get( 'wgPageName' )) + '}}&wpContextTitle=' +
      encodeURIComponent(mw.config.get( 'wgPageName' )),
    'Expand templates',
    't-expand',
    'Load this page in Special:ExpandTemplates',
    null,
    '#t-info'
  );
});