Jump to content

MediaWiki:Common.js

From Aquinas Archive
Revision as of 18:59, 23 August 2025 by CriminalElements (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.load("/images/assets/image-selector.js");
/* mw.loader.load("/images/assets/nav.js"); */
mw.loader.load("/images/assets/variant.js");
mw.loader.load("/images/assets/hovercard.js");
mw.loader.load("/images/assets/wikinav.js");
mw.loader.load("https://dxgalaxy.org/js/nav.js");

$(document).ready(function() {
    function fixTOC() {
        var $toc = $('.vector-toc');
        if ($toc.length) {
            // Remove toggle button if it exists
            $toc.find('.vector-toc-toggle-button').remove();

            // Make sure TOC is always expanded
            $toc.removeClass('collapsed').css({
                display: 'block',
                height: 'auto'
            });
        } else {
            // Retry if TOC not yet loaded
            setTimeout(fixTOC, 100);
        }
    }

    fixTOC();

    // Observe changes to the TOC in case Vector recreates it
    var target = document.querySelector('.vector-toc-container');
    if (target) {
        var observer = new MutationObserver(function(mutations) {
            mutations.forEach(function() {
                fixTOC();
            });
        });
        observer.observe(target, { childList: true, subtree: true });
    }
});