Jump to content

User:Equazcion/SidebarHistoryTools.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.
if (mw.config.get( 'wgNamespaceNumber' ) !== -1) {  // Serves no purpose on Special pages

	// Create our History tools group by cloning the sidebar's existing Toolbox, insert the clone after Toolbox. 
	// Then add new 'histtools' class for referencing, remove cloned ID, and set its title.
	$('#p-tb').clone(true).insertAfter($('#p-tb')).addClass('histtools').removeAttr('id').find('h3').text('History tools');
 
	// Clear all links cloned with the Toolbox
	$('.histtools li').remove();

	// Create new links
	$('.histtools .body ul').append('<li><a class="histTool1"></a></li>');
	$('.histtools .body ul').append('<li><a class="histTool2"></a></li>');
	$('.histtools .body ul').append('<li><a class="histTool3"></a></li>');
	$('.histtools .body ul').append('<li><a class="histTool4"></a></li>');
	$('.histtools .body ul').append('<li><a class="histTool5"></a></li>');
	$('.histtools .body ul').append('<li><a class="histTool6"></a></li>');
	$('.histtools .body ul').append('<li><a class="histTool7"></a></li>');

	// Set each new link's text and url
	// On 20190825 Tools 1/2/3/5 updated on this abandoned scrript
	//$('.histTool1').text('Page logs').attr('href', 'http://en.wikipedia.org/w/index.php?title=Special:Log&page=' + mw.config.get( 'wgPageName' ) );
	//$('.histTool2').text('Contributors').attr('href', 'http://toolserver.org/~daniel/WikiSense/Contributors.php?wikilang=en&wikifam=.wikipedia.org&grouped=on&page=' + mw.config.get( 'wgPageName' ));
	//$('.histTool3').text('User edits').attr('href', 'http://toolserver.org/~snottywong/usersearch.html?page=' + mw.config.get( 'wgPageName' ));
    //$('.histTool5').text('Page view stats').attr('href', 'http://stats.grok.se/en/latest/' + mw.config.get( 'wgPageName' ));
	$('.histTool1').text('Page logs').attr('href', 'https://en.wikipedia.org/w/index.php?title=Special:Log&page=' + mw.config.get( 'wgPageName' ) );
	$('.histTool2').text('Contributors').attr('href', 'https://xtools.wmflabs.org/articleinfo/en.wikipedia.org/' + mw.config.get( 'wgPageName' ));
	$('.histTool3').text('User edits').attr('href', 'https://tools.wmflabs.org/jackbot/snottywong/usersearch.html?page=' + mw.config.get( 'wgPageName' ));
	$('.histTool4').text('Watchers').attr('href', 'http://toolserver.org/~dispenser/cgi-bin/watcher.py?page=' + mw.config.get( 'wgPageName' ));
	$('.histTool5').text('Page view stats').attr('href', ' https://tools.wmflabs.org/pageviews/?project=en.wikipedia.org&range=latest-200&pages=' + mw.config.get( 'wgPageName' ));
	$('.histTool6').text('History stats').attr('href', 'https://tools.wmflabs.org/xtools/articleinfo/index.php?article=' + mw.config.get( 'wgPageName' ) + '&lang=en&wiki=wikipedia');
	$('.histTool7').text('History search').attr('href', 'http://wikipedia.ramselehof.de/wikiblame.php?lang=en&article=' + mw.config.get( 'wgPageName' ));
}