@@ -9,7 +9,7 @@ class Theme {
99 var theme = localStorage . getItem ( STORAGE_KEY ) ;
1010
1111 if ( ! theme || ! THEMES . has ( theme ) ) {
12- theme = window . matchMedia && window . matchMedia ( "(prefers-color-scheme: dark)" ) . matches
12+ theme = globalThis . matchMedia && globalThis . matchMedia ( "(prefers-color-scheme: dark)" ) . matches
1313 ? "dark"
1414 : "light" ;
1515 }
@@ -22,11 +22,11 @@ class Theme {
2222 // set gotoTop click handler
2323 document . querySelectorAll ( `a[href="#gotoTop"]` ) . forEach ( el => ( el . onclick = this . #gotoTop. bind ( this ) ) ) ;
2424
25- window . $docsify . plugins ||= [ ] ;
26- window . $docsify . plugins . push ( this . #docsifyHook. bind ( this ) ) ;
25+ globalThis . $docsify . plugins ||= [ ] ;
26+ globalThis . $docsify . plugins . push ( this . #docsifyHook. bind ( this ) ) ;
2727
2828 // listen for system dark mode change
29- window . matchMedia ( "(prefers-color-scheme: dark)" ) . addEventListener ( "change" , e => {
29+ globalThis . matchMedia ( "(prefers-color-scheme: dark)" ) . addEventListener ( "change" , e => {
3030 this . #setTheme( e . matches
3131 ? "dark"
3232 : "light" ) ;
@@ -35,7 +35,7 @@ class Theme {
3535
3636 // private
3737 #gotoTop ( e ) {
38- const oldUrl = window . location . href ,
38+ const oldUrl = globalThis . location . href ,
3939 newUrl = oldUrl . replace ( / \? .* / , "" ) ;
4040
4141 if ( oldUrl !== newUrl ) history . pushState ( { } , null , newUrl ) ;
@@ -100,7 +100,7 @@ class Theme {
100100 }
101101
102102 #linkifyTypes ( markdown ) {
103- const types = window . $docsify . types ;
103+ const types = globalThis . $docsify . types ;
104104
105105 if ( ! types ) return markdown ;
106106
@@ -143,7 +143,7 @@ class Theme {
143143 }
144144
145145 #styleTypes ( ) {
146- const types = window . $docsify . types ;
146+ const types = globalThis . $docsify . types ;
147147
148148 if ( ! types ) return ;
149149
0 commit comments