MediaWiki:Common.js

From Realm Of Thrones
Revision as of 02:50, 25 March 2025 by SitX (talk | contribs)
Jump to navigation Jump to search

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.
document.addEventListener("DOMContentLoaded", function () {
    setTimeout(function () { 
        var toc = document.querySelector("#mw-content-text #toc"); 
        if (!toc) return; 

        var floatingToc = document.createElement("div");
        floatingToc.id = "floating-toc";

        toc.parentNode.removeChild(toc); 
        floatingToc.appendChild(toc);
        document.body.appendChild(floatingToc);

        floatingToc.addEventListener("click", function () {
            floatingToc.classList.toggle("collapsed");
        });

    }, 500); 
});