mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-18 03:41:50 +00:00
20 lines
510 B
JavaScript
20 lines
510 B
JavaScript
|
/*
|
||
|
* Citizen - Inline script used in SkinCitizen.php
|
||
|
*
|
||
|
* https://starcitizen.tools
|
||
|
*/
|
||
|
(() => {
|
||
|
try {
|
||
|
const cookieTheme = document.cookie.match(/skin-citizen-theme=(dark|light|auto)/);
|
||
|
const theme = cookieTheme !== null ? cookieTheme.pop() : null;
|
||
|
|
||
|
if (theme !== null) {
|
||
|
document.documentElement.classList.remove(...['auto', 'dark', 'light'].map(theme => {
|
||
|
return 'skin-citizen-' + theme;
|
||
|
}));
|
||
|
document.documentElement.classList.add('skin-citizen-' + theme);
|
||
|
}
|
||
|
} catch (e) {
|
||
|
}
|
||
|
})();
|