Jump to content

MediaWiki:Common.js: Difference between revisions

From The Final Nights
No edit summary
No edit summary
Line 1: Line 1:
// Wait for jQuery and document ready state
mw.loader.using( 'jquery' ).then( function () {
mw.loader.using( 'jquery' ).then( function () {
   $( function() { // Document ready shorthand
   $( function() { // Document ready shorthand

Revision as of 00:09, 16 April 2025

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' );
  } );
} );