Jump to content

User:RogueScholar/userbox.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.
$.when( mw.loader.using('mediawiki.util'), $.ready ).then( function() {
  mw.util.addPortletLink( 'p-personal', mw.util.getUrl( 'Special:PrefixIndex/User_talk:' ) + mw.config.get( 'wgUserName' ) + '/',
    'My talk subpages', 'pt-mytalksubs', 'Show your Usertalk-space subpages', null, '#pt-preferences' );

  mw.util.addPortletLink( 'p-personal', mw.util.getUrl( 'Special:PrefixIndex/User:' ) + mw.config.get( 'wgUserName' ) + '/',
    'My subpages', 'pt-mysubpages', 'Show your User-space subpages', null, '#pt-mytalksubs' );

  mw.util.addPortletLink( 'p-navigation', 'https://tools.wmflabs.org/scholia/',
    'Scholia', 'p-scholia', 'Scientometrics tool', null, null );

  mw.util.addPortletLink( 'p-navigation', 'http://weekly.hatnote.com/archive/en/index.html',
    'Weeklypedia', 'p-weeklypedia', 'Top edited articles', null, '#p-scholia' );

  mw.util.addPortletLink( 'p-navigation', mw.util.getUrl( 'Special:Nearby' ),
    'Nearby', 'p-nearby', 'Articles near your current location', null, '#p-weeklypedia' );
} );

$.when( mw.loader.using('mediawiki.util'), $.done ).then( function () {
  $("#p-tb").append("<div id='p-labsbox' class='mw-portlet' role='navigation', aria-labelledby='p-labsbox-label'><h3 id='p-userbox-label'>XTools</h3><div class='body'><ul></ul></div></div>");

  mw.util.addPortletLink( 'p-labsbox',
    'https://tools.wmflabs.org/topviews/?project=wiki.riteme.site&platform=all-access&date=last-month&excludes=', 'Top views', 'p-topviews', 'Most viewed articles in the last month-to-date', null, null );

  mw.util.addPortletLink( 'p-labsbox',
    'https://xtools.wmflabs.org/topedits/wiki.riteme.site/' + mw.config.get('wgUserName'), 'Top edits', 'p-topedits', 'Most edited pages by namespace', null, '#p-topviews' );

  mw.util.addPortletLink( 'p-labsbox',
    'https://tools.wmflabs.org/supercount/index.php?project=wiki.riteme.site&user=' + mw.config.get('wgUserName'), 'Supercount', 'p-supercount', 'Global MediaWiki account statistics', null, '#p-topedits' );

  mw.util.addPortletLink( 'p-labsbox',
    'https://tools.wmflabs.org/xtools/pages/?user=' + mw.config.get('wgUserName') + '&project=wiki.riteme.site&namespace=0&redirects=noredirects', 'Created pages', 'p-createdpages', 'Pages added to Wikipedia', null, '#p-supercount' );

  mw.util.addPortletLink( 'p-labsbox',
    'https://tools.wmflabs.org/userviews/?project=wiki.riteme.site&platform=all-access&agent=user&namespace=all&redirects=2&range=all-time&sort=views&direction=1&view=list&user=' + mw.config.get('wgUserName'), 'All-time Userviews', 'p-userviews', 'All-time hits for all pages created', null, '#p-createdpages' );
} );