File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ window.addEventListener("load", () => {
49
49
const anchor = child . getElementsByTagName ( "a" ) [ 0 ] ;
50
50
anchor . text = Theme . unicodeIcon ;
51
51
child . addEventListener ( "click" , ( ) => {
52
- anchor . text = Theme . fromExisting ( ) . reverse ( sessionStorage , ( theme ) => {
52
+ anchor . text = Theme . fromExisting ( ) . reverse ( localStorage , ( theme ) => {
53
53
if ( typeof themeCssMap === "undefined" ) return ;
54
54
removeFileFromHead ( themeCssMap [ theme . opposite . theme ] ) ;
55
55
addCssFile ( themeCssMap [ theme . theme ] ) ;
Original file line number Diff line number Diff line change @@ -533,8 +533,11 @@ class Theme {
533
533
* @returns {"dark" | "light" }
534
534
*/
535
535
static #fromExisting = ( storagePriorty = null ) => {
536
- const pStore = storagePriorty || sessionStorage || localStorage ;
537
- const secStore = pStore === sessionStorage ? localStorage : sessionStorage ;
536
+ const pStore = storagePriorty || localStorage || sessionStorage ;
537
+ const secStore =
538
+ JSON . stringify ( pStore ) === JSON . stringify ( sessionStorage )
539
+ ? localStorage
540
+ : sessionStorage ;
538
541
return (
539
542
document . documentElement . dataset . mode ||
540
543
pStore . getItem ( this . THEME_STORAGE_KEY ) ||
You can’t perform that action at this time.
0 commit comments