File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 7575 }
7676
7777 let refreshVintage = isVintage => {
78- document . documentElement . classList . toggle ( "vintage" , isVintage ) ;
78+ document . documentElement . classList . toggle ( "vintage" , isVintage === true ) ;
7979 if ( browser . browserAction ) {
8080 browser . browserAction . setIcon ( { path : { 64 : `/img${ isVintage ? "/vintage/" : "/" } ui-maybe64.png` } } ) ;
8181 }
8282 updateFavIcon ( isVintage ) ;
8383 }
8484
85+ const THEMES = [ "dark" , "light" , "auto" ] ;
8586 var Themes = {
8687 setup ( theme = null ) {
8788 if ( theme ) {
9495 } else {
9596 if ( localStorage ) {
9697 theme = localStorage . getItem ( "theme" ) ;
98+ if ( ! THEMES . includes ( theme ) ) theme = null ;
9799 }
98100 if ( ! theme && browser && browser . storage ) {
99101 if ( document . readyState === "loading" ) {
102104 return browser . storage . local . get ( [ "theme" ] ) . then ( ( { theme} ) => {
103105 update ( theme ) ;
104106 document . documentElement . style . visibility = "" ;
105- if ( localStorage ) localStorage . setItem ( "theme" , theme )
106- return theme ;
107+ if ( localStorage && theme ) localStorage . setItem ( "theme" , theme )
108+ return theme || "auto" ;
107109 } ) ;
108110 }
109111 }
Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ document.querySelector("#version").textContent = _("Version",
147147
148148 UI . wireChoice ( "theme" , o => Themes . setup ( o && o . value ) ) ;
149149
150- opt ( "vintageTheme" , o => o ? Themes . setVintage ( o . checked ) : Themes . isVintage ( ) ) ;
150+ opt ( "vintageTheme" , async o => await ( o ? Themes . setVintage ( o . checked ) : Themes . isVintage ( ) ) ) ;
151151
152152 // PRESET CUSTOMIZER
153153 {
You can’t perform that action at this time.
0 commit comments