fix: 修復 pjax 下, waline js 會重複加載的 bug

This commit is contained in:
Jerry committed 2023-01-15 01:39:16 +08:00
1 parent 9a3b41912a
commit 929a5608d3
12 files changed
+59 -45

No files matched your search

+2 -1
View File
@@ -634,7 +634,8 @@ subtitle:
# source 調用第三方服務
# source: false 關閉調用
# source: 1 調用一言網的一句話(簡體) https://hitokoto.cn/
# source: 2 調用今日詩詞(簡體) https://www.jinrishici.com/
# source: 2 調用一句網(簡體) https://yijuzhan.com/
# source: 3 調用今日詩詞(簡體) https://www.jinrishici.com/
# subtitle 會先顯示 source , 再顯示 sub 的內容
source: false
# 如果關閉打字效果,subtitle 只會顯示 sub 的第一行文字
+1 -1
View File
@@ -10,7 +10,7 @@ script.
const waline = Waline.init(initData)
}
if (typeof Waline === 'function') initWaline()
if (typeof Waline === 'object') initWaline()
else getScript('!{url_for(theme.asset.waline_js)}').then(initWaline)
}
+1 -8
View File
@@ -1,13 +1,6 @@
- const { server, site, option } = theme.artalk
script.
function addArtalkSource () {
const ele = document.createElement('link')
ele.rel = 'stylesheet'
ele.href= '!{theme.asset.artalk_css}'
document.getElementsByTagName('head')[0].appendChild(ele)
}
function loadArtalk () {
function initArtalk () {
window.artalkItem = new Artalk(Object.assign({
@@ -22,7 +15,7 @@ script.
if (typeof window.artalkItem === 'object') setTimeout(()=>{initArtalk()},200)
else {
addArtalkSource()
getCSS('!{theme.asset.artalk_css}')
typeof Artalk !== 'function' ? getScript('!{theme.asset.artalk_js}').then(initArtalk)
: setTimeout(()=>{initArtalk()},200)
}
Loaded 3 of 12 files, more files were not shown because too many files have changed in this diff. Show more