MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 731: Line 731:
});
});
$(document).ready(function() {
$(document).ready(function() {
     // Get the page title
     // Get the page title from the MediaWiki configuration
     var pageTitle = mw.config.get('wgTitle');
     var pageTitle = mw.config.get('wgTitle');
   
 
     // Check if the page title contains a forward slash (indicating a subpage)
     // Determine if the page is a subpage (contains a forward slash)
     if (pageTitle.indexOf('/') === -1) {
     if (pageTitle.indexOf('/') === -1) {
         // It's a top-level page, show the download button
         // Show the download button if it's a top-level page
         $('a[href*="/find_epub.php"]').show();
         $('a[href*="/find_epub.php"]').show();
     } else {
     } else {
         // It's a subpage, hide the download button
         // Hide the download button if it's a subpage
         $('a[href*="/find_epub.php"]').hide();
         $('a[href*="/find_epub.php"]').hide();
     }
     }
});
});

Navigation menu