MediaWiki:Common.js: Difference between revisions

From Ghost Theory Wiki
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
mw.loader.using(['jquery'], function () {
// Disable Timeless section collapsing
    $(function () {
mw.hook('wikipage.content').add(function ($content) {
        // Insert the sidebar toggle button next to the site title
    $content.find('.mw-collapsible').removeClass('mw-collapsible');
        var banner = $('#p-banner');
 
        if (banner.length && !document.getElementById('mw-sidebar-button')) {
            banner.after(
                '<button id="mw-sidebar-button" class="mw-ui-icon mw-ui-icon-element mw-ui-icon-menu" style="margin-left:10px;"><span>Menu</span></button>'
            );
        }
 
        // Toggle sidebar on desktop
        $(document).on('click', '#mw-sidebar-button', function () {
            $('body').toggleClass('sidebar-open');
        });
    });
});
});