User:Euphoria/common.js: Difference between revisions

From Test Wiki
Content deleted Content added
No edit summary
No edit summary
Line 2: Line 2:
.then(function () {
.then(function () {
// Extract the username from the current page title
// Extract the username from the current page title
var pageTitle = mw.config.get('wgTitle');
var pageTitle = mw.config.get('wgRelevantPageName');
var username;
var username;


// Check if the current page is a user contributions page
// Check if the current page is a user contributions page
if (mw.config.get('wgCanonicalSpecialPageName') === 'Contributions') {
if (mw.config.get('wgCanonicalSpecialPageName') === 'Contributions') {
// Extract username from the contributions page using a different method
// Extract username from the contributions page using the relevant page name
var userNamespaceIndex = pageTitle.indexOf(':');
var userNamespaceIndex = pageTitle.indexOf(':');
if (userNamespaceIndex !== -1 && userNamespaceIndex < pageTitle.length - 1) {
if (userNamespaceIndex !== -1 && userNamespaceIndex < pageTitle.length - 1) {