@@ -15,7 +15,7 @@ const getLang = () => (isEn() ? 'en' : 'zh-CN');
15
15
const giscusTheme = ( ) =>
16
16
localStorage . getItem ( 'DARK_LIGHT_THEME' ) === 'light' ? 'light' : 'noborder_dark' ;
17
17
18
- const term = ( ) => decodeURI ( location . hash . slice ( 1 , location . hash . lastIndexOf ( '/' ) ) || '/index' ) ;
18
+ const getTerm = ( ) => decodeURI ( location . hash . slice ( 1 , location . hash . lastIndexOf ( '/' ) ) || '/index' ) ;
19
19
20
20
window . addEventListener ( 'hashchange' , ( ) => {
21
21
window . $docsify . loadSidebar = sidebar ( ) ;
@@ -34,7 +34,7 @@ window.$docsify = {
34
34
category : 'Announcements' ,
35
35
categoryId : 'DIC_kwDOCOGUlc4CZmhe' ,
36
36
mapping : 'specific' ,
37
- term : term ( ) ,
37
+ term : getTerm ( ) ,
38
38
reactionsEnabled : '0' ,
39
39
strict : '1' ,
40
40
emitMetadata : '0' ,
@@ -145,6 +145,8 @@ window.$docsify = {
145
145
return html + footer ;
146
146
} ) ;
147
147
hook . doneEach ( ( ) => {
148
+ const term = getTerm ( ) ;
149
+ const lang = getLang ( ) ;
148
150
var giscusScript = document . createElement ( 'script' ) ;
149
151
const {
150
152
repo,
@@ -176,8 +178,8 @@ window.$docsify = {
176
178
giscusScript . setAttribute ( 'data-loading' , loading ) ;
177
179
giscusScript . setAttribute ( 'data-theme' , theme ) ;
178
180
179
- giscusScript . setAttribute ( 'data-term' , term ( ) ) ;
180
- giscusScript . setAttribute ( 'data-lang' , getLang ( ) ) ;
181
+ giscusScript . setAttribute ( 'data-term' , term ) ;
182
+ giscusScript . setAttribute ( 'data-lang' , lang ) ;
181
183
182
184
document
183
185
. getElementById ( 'main' )
0 commit comments