Jump to content

User:PrimeHunter/Pageviews.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by PrimeHunter (talk | contribs) at 14:32, 25 October 2016 (Created page with '/* 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 sc...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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 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:PrimeHunter/Pageviews.js'); // Linkback: [[User:PrimeHunter/Pageviews.js]]

*/
 
$( document ).ready( 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'
  );
});