Jump to content

User:Dlrohrer2003/randab.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.
/* Random Disambig Link
 * =============================================================================
 * Description: 
 *   Add a link to the navigation portlet that loads a random disabiguation page
 *
 * Author:
 *   [[User:Dlrohrer2003]]
 */

mw.loader.using( [ 'mediawiki.util' ], function() {

	mw.util.addPortletLink(
		'p-navigation',
		'/wiki/Special:RandomInCategory/All_disambiguation_pages',
		'Random disambig',
		'n-random-disambig',
		'Load a random disambiguation page'
	);

	document
		.querySelector( '#n-random-disambig a' )
		.classList.add( 'mw-disambig' );
});