MediaWiki:Common.js: Difference between revisions
No edit summary Tag: Reverted |
No edit summary Tag: Reverted |
||
| Line 53: | Line 53: | ||
if ( mw.config.get( 'wgPageName' ) === 'Discord' ) { | if ( mw.config.get( 'wgPageName' ) === 'Discord' ) { | ||
$(document).ready(function() { | |||
// Get the current page title | |||
var currentPage = mw.config.get('wgTitle'); | |||
var previousPage = document.referrer; // Get the URL of the previous page | |||
} else { | // Check if the current page is 'Discord' | ||
if (currentPage === 'Discord') { | |||
// Make the "Discord" tab active (remove 'selected' from ca-nstab-main and add it to ca-my_namespace) | |||
$('#ca-nstab-main').removeClass('selected'); // Remove 'selected' from "Page" tab | |||
$('#ca-my_namespace').addClass('selected'); // Add 'selected' to the "Discord" tab | |||
// Make the "Page" tab (ca-nstab-main) link to the previous page (i.e., 'Go Back') | |||
$('#ca-nstab-main').show().find('a').attr('href', previousPage).text('Go Back'); // Update link to go to the previous page | |||
} else { | |||
// If not on the Discord page, reset the "Page" tab link back to Main Page | |||
$('#ca-my_namespace').removeClass('selected'); // Remove 'selected' from "Discord" tab | |||
$('#ca-nstab-main').show().find('a').attr('href', '/wiki/Main_Page').text('Main'); // Reset link to the Main page | |||
} | |||
}); | |||
} | } | ||