Toggle menu
10
18
30
244
SOURCE DCS WIKI
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Citizen.js: Difference between revisions

MediaWiki interface page
Niknam3 (talk | contribs)
 
Niknam3 (talk | contribs)
Blanked the page
 
Line 1: Line 1:
/* All JavaScript here will be loaded for users of the Citizen skin */
/**
* MediaWiki:Citizen.js
*
* Forces the Citizen skin to always render in the light
* (SOURCEDCS warm off-white) palette regardless of the
* user's OS preference or any previously stored dark-mode
* choice.
*
* This runs as early as possible (before the skin's own JS)
* to prevent a flash of dark content (FODC).
*/
( function () {
'use strict';


var PREF_KEY    = 'skin-citizen-color-scheme';
var COLOR_SCHEME = 'light';
var ATTR_NAME    = 'data-mw-skin-color-scheme';
/* 1. Set the DOM attribute immediately so CSS token overrides
      in Citizen.css take effect before any paint. */
document.documentElement.setAttribute( ATTR_NAME, COLOR_SCHEME );
/* 2. Persist the preference so the skin's own init code
      does not switch back to dark on subsequent loads. */
try {
localStorage.setItem( PREF_KEY, COLOR_SCHEME );
} catch ( e ) {
/* localStorage unavailable – safe to ignore */
}
/* 3. Once MediaWiki has loaded, update via the official
      storage API too (belt-and-suspenders). */
mw.loader.using( 'mediawiki.storage' ).done( function () {
mw.storage.set( PREF_KEY, COLOR_SCHEME );
/* Re-apply the attribute in case the skin JS ran
  between step 1 and now and changed it. */
document.documentElement.setAttribute( ATTR_NAME, COLOR_SCHEME );
} );
}() );

Latest revision as of 19:16, 4 March 2026