MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 729: Line 729:
     // Add the button to the page content
     // Add the button to the page content
     $('#bodyContent').append(downloadButton);
     $('#bodyContent').append(downloadButton);
});
$(document).ready(function() {
    // Get the page title
    var pageTitle = mw.config.get('wgTitle');
   
    // Check if the page title contains a forward slash (indicating a subpage)
    if (pageTitle.indexOf('/') === -1) {
        // It's a top-level page, show the download button
        $('a[href*="/find_epub.php"]').show();
    } else {
        // It's a subpage, hide the download button
        $('a[href*="/find_epub.php"]').hide();
    }
});
});

Navigation menu