Jump to content

MediaWiki:Common.js

From The Shivo Library
Revision as of 07:44, 28 January 2025 by Coobr (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.
/* Any JavaScript here will be loaded for all users on every page load. */
mw.loader.using('mediawiki.util').then(function () {
    var appearanceSection = document.querySelector('#p-appearance');
    if (appearanceSection && appearanceSection.classList.contains('collapsed')) {
        appearanceSection.classList.remove('collapsed');
    }
});

(function() {
    // Ensure the script runs after the DOM is fully loaded
    document.addEventListener('DOMContentLoaded', function() {
        // Add classes to enforce dark mode
        document.documentElement.classList.add('vector-feature-night-mode-enabled', 'skin-theme-clientpref-night');

        // Optionally, remove any existing light mode classes if present
        document.documentElement.classList.remove('skin-theme-clientpref-day');
    });
})();