var path = $( 'ul' );
function addPtLink(pID, nextnode, path){
var listStyle = mw.util.addPortletLink(
'p-' + pID,
'#',
'(list style)',
'pt-liststyle',
'Switch list style between bullet and numbered ',
'`',
'#pt-' + nextnode
);
$( 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' ){
// ]
path = $( 'ul#mw-whatlinkshere-list' );
addPtLink('personal', 'userpage', path);
} else if ( specialPageName == 'Contributions' ){
// ]
path = $('a.mw-changeslist-date').parents('ul');
addPtLink( 'personal', 'logout', path );
}
} else if ( nsNumber != 14){
// var pageNameList = mw.config.get( 'wgPageName' );
} else {
// ]
path = $( 'div.mw-content-ltr' ).find( 'ul' );
addPtLink( 'personal', 'userpage', path);
}
} else {
// &action=history
path = $( 'ul#pagehistory' );
addPtLink( 'personal', 'userpage', path );
}