User:LordofMoonSpawn/Pageviews.js

/* This script adds a "Page views" link under "Tools" in the sidebar. The link goes to the external tool https://tools.wmflabs.org/pageviews. To use the script, add the following line to Special:MyPage/common.js: importScript('User:Naushaad Gasieta/Pageviews.js'); // Linkback: User:Naushaad Gasieta/Pageviews.js

mw.loader.using(['mediawiki.util'], function {  mw.util.addPortletLink( 'p-tb', 'https://tools.wmflabs.org/pageviews?pages=' + encodeURIComponent(mw.config.get( 'wgPageName' )) + '&project=en.wikipedia.org', 'Page views', 'pt-pageviews', 'Show page views for this page', null, '#t-info' ); });