MediaWiki:Gadget-listStyles.js

var path = $( 'ul' ); function addPtLink( path ){ var listStyle = mw.util.addPortletLink(		'p-personal',		'#',		'(list style)',		'pt-liststyle',		'Switch list style between bullet and numbered [alt-shift-`]',		'`',		'#pt-userpage'	); $( listStyle ).click( function ( e ) {		e.preventDefault;		path.css( 'list-style-image', 'none' );		path.css( 'list-style-type', function (i, val) { return val === "decimal" ? "disc" : "decimal"; });	}); } var pageAction = mw.config.get( 'wgAction' ); if ( pageAction != 'history' ){ var nsNumber = mw.config.get( 'wgNamespaceNumber' ); if ( nsNumber === -1 ){ // Special: pages var specialPageName = mw.config.get( 'wgCanonicalSpecialPageName' ); if ( specialPageName == 'Whatlinkshere' ){ // Special:WhatLinksHere path = $( 'ul#mw-whatlinkshere-list' ); addPtLink( path ); } 	else if ( specialPageName == 'Contributions' ){ // Special:Contributions path = $('span.mw-revdelundel-link').parents('ul'); addPtLink( path ); } 	else if ( specialPageName == 'Activeusers' ){ // Special:ActiveUsers path = $('a.mw-userlink').parents('ul'); addPtLink( path ); }	} else if ( nsNumber != 14){ var pageName = mw.config.get( 'wgPageName' ); } else { // [[Category:]] path = $( 'div.mw-content-ltr' ).find( 'ul' ); addPtLink( path ); } } else { // &action=history path = $( 'ul#pagehistory' ); addPtLink( path ); }