User:Euphoria/common.js: Difference between revisions

From Test Wiki
Content deleted Content added
No edit summary
Cleanup
Tag: Blanked
 
(101 intermediate revisions by the same user not shown)
Line 1: Line 1:
// Load necessary module asynchronously
mw.loader.using(['mediawiki.util'])
.then(function () {
// Check if the current page is associated with the user
var isUserRelatedPage = mw.config.get('wgCanonicalSpecialPageName') === 'CentralAuth' ||
mw.config.get('wgCanonicalSpecialPageName') === 'Log' ||
mw.config.get('wgCanonicalSpecialPageName') === 'Contributions' ||
mw.config.get('wgNamespaceNumber') === 2 || // User namespace
mw.config.get('wgNamespaceNumber') === 3; // User talk namespace

// If the current page is associated with the user, add the "SUL" link
if (isUserRelatedPage) {
var sulLink = mw.util.addPortletLink(
'p-cactions',
mw.util.getUrl('Special:CentralAuth/' + mw.user.getName()),
'SUL',
'ca-sul',
'SUL',
null,
'#ca-sul'
);
}
});