MediaWiki:Common.js

From Ghost Theory Wiki
Revision as of 19:56, 15 December 2025 by PerilM (talk | contribs)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
mw.loader.using(['jquery'], function () {
    $(function () {
        // Insert the sidebar toggle button next to the site title
        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');
        });
    });
});