MediaWiki:Common.js

Revision as of 22:43, 16 March 2026 by LennLeaf (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.
/* Universal KH Theme & Mobile Scale Fix */
(function() {
    // 1. Load Google Fonts
    $('head').append('<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css2?family=Cinzel:wght@700&family=Crimson+Pro:wght@400;700&display=swap">');

    // 2. Force Desktop Scale for Mobile Browsers
    var forceDesktopScale = function() {
        var viewport = document.querySelector("meta[name=viewport]");
        var content = "width=1200, initial-scale=0.3, maximum-scale=1.0, user-scalable=yes";
        if (viewport) {
            viewport.setAttribute('content', content);
        } else {
            $('head').append('<meta name="viewport" content="' + content + '">');
        }
    };

    // Run scaling logic immediately
    forceDesktopScale();

    $(document).ready(function() {
        console.log("KH Leaf Theme Initialized on " + mw.config.get('skin'));
        
        // Hide default 'Actions' label in Cosmos to make room for the leaf
        if (mw.config.get('skin') === 'cosmos') {
            $('#p-cactions h3 span').hide();
        }
    });
})();