User:Euphoria/common.js: Difference between revisions

From Test Wiki
Content deleted Content added
No edit summary
No edit summary
Line 9: Line 9:
// Extract username from the contributions page using a different method
// Extract username from the contributions page using a different method
var userNamespaceIndex = pageTitle.indexOf(':');
var userNamespaceIndex = pageTitle.indexOf(':');
if (userNamespaceIndex !== -1) {
if (userNamespaceIndex !== -1 && userNamespaceIndex < pageTitle.length - 1) {
username = pageTitle.substring(userNamespaceIndex + 1);
username = pageTitle.substring(userNamespaceIndex + 1);
}
}
Line 22: Line 22:
var isContributionsPage = mw.config.get('wgCanonicalSpecialPageName') === 'Contributions';
var isContributionsPage = mw.config.get('wgCanonicalSpecialPageName') === 'Contributions';


if (isUserPage || isTalkPage || isContributionsPage) {
if ((isUserPage || isTalkPage || isContributionsPage) && username) {
var sulLink = mw.util.addPortletLink(
var sulLink = mw.util.addPortletLink(
'p-cactions',
'p-cactions',