[mobile] fix bug 55103
This commit is contained in:
parent
ad011826f8
commit
c043d0c858
|
@ -1,10 +1,9 @@
|
||||||
|
|
||||||
let obj = !localStorage ? {id: 'theme-light', type: 'light'} : JSON.parse(localStorage.getItem("ui-theme"));
|
let obj = !localStorage ? {id: 'theme-light', type: 'light'} : JSON.parse(localStorage.getItem("ui-theme"));
|
||||||
if ( !obj ) {
|
if ( !obj ) {
|
||||||
if ( window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ) {
|
obj = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ?
|
||||||
obj = {id: 'theme-dark', type: 'dark'};
|
{id: 'theme-dark', type: 'dark'} : {id: 'theme-light', type: 'light'};
|
||||||
localStorage && localStorage.setItem("ui-theme", JSON.stringify(obj));
|
localStorage && localStorage.setItem("ui-theme", JSON.stringify(obj));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
document.body.classList.add(`theme-type-${obj.type}`);
|
document.body.classList.add(`theme-type-${obj.type}`);
|
||||||
|
|
Loading…
Reference in a new issue