Jump to content

MediaWiki:Common.js

From The Final Nights
Revision as of 00:08, 16 April 2025 by Buffy (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.
// Wait for jQuery and document ready state
mw.loader.using( 'jquery' ).then( function () {
  $( function() { // Document ready shorthand
      var classList = document.documentElement.classList;

      // Add the desired dark theme class
      classList.add( 'vector-theme-dark' );

      // Remove potentially conflicting classes added by the skin
      classList.remove( 'vector-feature-night-mode-disabled' );
      classList.remove( 'skin-theme-clientpref-day' );
      // Just in case, also remove the opposite preference class if present
      classList.remove( 'skin-theme-clientpref-night' );


      console.log( 'Applied dark theme and removed conflicting classes via Common.js' );
  } );
} );