MediaWiki:Gadget-listStyles.js
Jump to navigation
Jump to search
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// <nowiki>
//( function ( $, mw ) {
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' ){
// [[S:WhatLinksHere]]
path = $( 'ul#mw-whatlinkshere-list' );
addPtLink( path );
} else if ( specialPageName == 'Contributions' ) {
// [[S:Contributions]]
path = $( 'a.mw-contributions-title' ).parents( 'ul' );
addPtLink( path );
} else if ( specialPageName == 'Activeusers' ){
// [[S: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 );
}
//} )( mediaWiki, jQuery );
// </nowiki> [[Category:Gadgets]]