Jump to content

User:PrimeHunter/External links.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.
/* This script adds "External links" below "What links here" in the sidebar.
   It shows a list of up to 500 external links in the current page.
   To use the script, add the following line to [[Special:MyPage/common.js]]:
 
importScript('User:PrimeHunter/External links.js'); // Linkback: [[User:PrimeHunter/External links.js]]

*/

mw.loader.using(['mediawiki.util'], function () {
  mw.util.addPortletLink(
    'p-tb',
    'https://en.wikipedia.org/w/api.php?action=query&prop=extlinks&ellimit=500&format=json&titles=' +
      encodeURIComponent(mw.config.get( 'wgPageName' )),
    'External links',
    'pt-externallinks',
    'List external links (max 500) in this page',
    null,
    '#t-recentchangeslinked'
  );
});