MediaWiki:Common.js: Difference between revisions
Appearance
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 | ||
// Add the class | var classList = document.documentElement.classList; | ||
// | // Add the desired dark theme class | ||
console.log( ' | 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' ); | |||
} ); | } ); | ||
} ); | } ); |
Revision as of 00:08, 16 April 2025
// 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' ); } ); } );