mediawiki-skins-Citizen/resources/skins.citizen.scripts.theme/inline.js

25 lines
585 B
JavaScript
Raw Normal View History

/* eslint-disable */
2021-01-11 17:13:59 +00:00
/*
* Citizen - Inline script used in SkinCitizen.php
*
* https://starcitizen.tools
*/
window.switchTheme = () => {
2021-01-11 17:13:59 +00:00
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) {
}
}
(() => {
window.switchTheme()
2021-01-11 17:13:59 +00:00
})();