User:Chaotic Enby/TooManyPortlets.js

if ( mw.config.get( 'wgNamespaceNumber' ) === 2 || mw.config.get( 'wgNamespaceNumber' ) === 3 ) { var username = mw.config.get( 'wgRelevantUserName' ); var contribsLink = 'https://en.wikipedia.org/wiki/Special:Contribs/' + username; mw.util.addPortletLink( 'p-namespaces', contribsLink, 'Contributions' ); }

if ( mw.config.get( 'wgNamespaceNumber' ) === -1 && mw.config.get( 'wgTitle' ).split('/')[0] === "Homepage" ) { var username = mw.config.get( 'wgUserName' ); var contribsLink = 'https://en.wikipedia.org/wiki/Special:Contribs/' + username; mw.util.addPortletLink( 'p-namespaces', contribsLink, 'Contributions' ); }

if ( mw.config.get( 'wgNamespaceNumber' ) === -1 && mw.config.get( 'wgTitle' ).split('/')[0] === "Contributions" ) { var username = mw.config.get( 'wgTitle' ).split('/')[1].split('User:') username = username[username.length - 1]; if ( username == mw.config.get( 'wgUserName' ) ) { var homepageLink = 'https://en.wikipedia.org/w/index.php?title=Special:Homepage'; mw.util.addPortletLink( 'p-namespaces', homepageLink, 'Homepage', 'ca-homepage', "", null, '#ca-nstab-special' ); }   var userpageLink = 'https://en.wikipedia.org/wiki/User:' + username; mw.util.addPortletLink( 'p-namespaces', userpageLink, 'User page', 'ca-user', "", null, '#ca-nstab-special' ); var talkpageLink = 'https://en.wikipedia.org/wiki/User talk:' + username; mw.util.addPortletLink( 'p-namespaces', talkpageLink, 'Talk', 'ca-talk', "", null, '#ca-nstab-special' ); $('#ca-nstab-special').find("span").html('Contributions'); }