Skip to content

Commit 71ece3f

Browse files
authored
fix: remove duplicated js file (doocs#1703)
1 parent 9c592b1 commit 71ece3f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

index.html

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-darklight-theme@latest/dist/index.min.js"></script>
5454
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-contributors@latest/dist/index.min.js"></script>
5555
<script src="https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-katex@latest/dist/docsify-katex.js"></script>
56-
<script src='https://cdn-doocs.oss-cn-shenzhen.aliyuncs.com/npm/docsify-giscus@1.0.0/dist/docsify-giscus.min.js'></script>
5756
</body>
5857

5958
<!--

main.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const getLang = () => (isEn() ? 'en' : 'zh-CN');
1515
const giscusTheme = () =>
1616
localStorage.getItem('DARK_LIGHT_THEME') === 'light' ? 'light' : 'noborder_dark';
1717

18-
const term = () => decodeURI(location.hash.slice(1, location.hash.lastIndexOf('/')) || '/index');
18+
const getTerm = () => decodeURI(location.hash.slice(1, location.hash.lastIndexOf('/')) || '/index');
1919

2020
window.addEventListener('hashchange', () => {
2121
window.$docsify.loadSidebar = sidebar();
@@ -34,7 +34,7 @@ window.$docsify = {
3434
category: 'Announcements',
3535
categoryId: 'DIC_kwDOCOGUlc4CZmhe',
3636
mapping: 'specific',
37-
term: term(),
37+
term: getTerm(),
3838
reactionsEnabled: '0',
3939
strict: '1',
4040
emitMetadata: '0',
@@ -145,6 +145,8 @@ window.$docsify = {
145145
return html + footer;
146146
});
147147
hook.doneEach(() => {
148+
const term = getTerm();
149+
const lang = getLang();
148150
var giscusScript = document.createElement('script');
149151
const {
150152
repo,
@@ -176,8 +178,8 @@ window.$docsify = {
176178
giscusScript.setAttribute('data-loading', loading);
177179
giscusScript.setAttribute('data-theme', theme);
178180

179-
giscusScript.setAttribute('data-term', term());
180-
giscusScript.setAttribute('data-lang', getLang());
181+
giscusScript.setAttribute('data-term', term);
182+
giscusScript.setAttribute('data-lang', lang);
181183

182184
document
183185
.getElementById('main')

0 commit comments

Comments
 (0)