let page = mw.config.get('wgPageName');
if (page.slice(0,5)=="User:"&&!page.includes("/")){
$.when( mw.loader.using('mediawiki.util'), $.ready ).then( function() {
mw.util.addPortletLink( 'p-namespaces', 'https://en.wikipedia.org/wiki/Special:Contributions/'+page.slice(5), 'Contributions');
} );
} else if (page.slice(0,10)=="User_talk:"&&!page.includes("/")){
$.when( mw.loader.using('mediawiki.util'), $.ready ).then( function() {
mw.util.addPortletLink( 'p-namespaces', 'https://en.wikipedia.org/wiki/Special:Contributions/'+page.slice(10), 'Contributions');
} );
} else if (page.slice(0,22)=="Special:Contributions/"){
$.when( mw.loader.using('mediawiki.util'), $.ready ).then( function() {
mw.util.addPortletLink( 'p-namespaces', 'https://en.wikipedia.org/wiki/User:'+page.slice(22), 'User page');
} );
$.when( mw.loader.using('mediawiki.util'), $.ready ).then( function() {
mw.util.addPortletLink( 'p-namespaces', 'https://en.wikipedia.org/wiki/User_talk:'+page.slice(22), 'Talk');
} );
}