|
Tags: Manual revert Mobile edit Mobile web edit Advanced mobile edit |
| Line 51: |
Line 51: |
| } | | } |
| }); | | }); |
|
| |
| 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
| |
|
| |
| // Check if the current page is 'Discord'
| |
| if (currentPage === 'Discord') {
| |
| // Directly select the Discord tab
| |
| $('#ca-nstab-main').removeClass('selected'); // Remove the 'selected' class from the "Page" tab
| |
| $('#ca-my_namespace').addClass('selected'); // Add the 'selected' class to the "Discord" tab
| |
|
| |
| // Update the "Page" tab (ca-nstab-main) link to go back to the previous page (or the main page)
| |
| $('#ca-nstab-main').show().find('a').attr('href', previousPage || '/wiki/Main_Page'); // Default to main page if no previous page
| |
|
| |
| // Disable the click on the Discord tab to avoid repeating the action and breaking the referrer history
| |
| $('#ca-my_namespace a').on('click', function(event) {
| |
| event.preventDefault(); // Prevent the default action (i.e., reloading the current page)
| |
| });
| |
| } else {
| |
| // If not on the Discord page, reset the tabs to their normal state
| |
| $('#ca-my_namespace').removeClass('selected'); // Remove 'selected' from the "Discord" tab
| |
| $('#ca-nstab-main').addClass('selected'); // Ensure the "Page" tab is selected by default
| |
| }
| |
| });
| |
| }
| |