mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-10-04 06:22:00 +08:00
fix: 修復 pjax 下, waline js 會重複加載的 bug
This commit is contained in:
1 parent
9a3b41912a
commit
929a5608d3
12 files changed
+58
-44
No files matched your search
+2
-1
@@ -634,7 +634,8 @@ subtitle:
|
|||||||
# source 調用第三方服務
|
# source 調用第三方服務
|
||||||
# source: false 關閉調用
|
# source: false 關閉調用
|
||||||
# source: 1 調用一言網的一句話(簡體) https://hitokoto.cn/
|
# 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 的內容
|
# subtitle 會先顯示 source , 再顯示 sub 的內容
|
||||||
source: false
|
source: false
|
||||||
# 如果關閉打字效果,subtitle 只會顯示 sub 的第一行文字
|
# 如果關閉打字效果,subtitle 只會顯示 sub 的第一行文字
|
||||||
|
|||||||
+1
-1
@@ -10,7 +10,7 @@ script.
|
|||||||
const waline = Waline.init(initData)
|
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)
|
else getScript('!{url_for(theme.asset.waline_js)}').then(initWaline)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-8
@@ -1,13 +1,6 @@
|
|||||||
- const { server, site, option } = theme.artalk
|
- const { server, site, option } = theme.artalk
|
||||||
|
|
||||||
script.
|
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 loadArtalk () {
|
||||||
function initArtalk () {
|
function initArtalk () {
|
||||||
window.artalkItem = new Artalk(Object.assign({
|
window.artalkItem = new Artalk(Object.assign({
|
||||||
@@ -22,7 +15,7 @@ script.
|
|||||||
|
|
||||||
if (typeof window.artalkItem === 'object') setTimeout(()=>{initArtalk()},200)
|
if (typeof window.artalkItem === 'object') setTimeout(()=>{initArtalk()},200)
|
||||||
else {
|
else {
|
||||||
addArtalkSource()
|
getCSS('!{theme.asset.artalk_css}')
|
||||||
typeof Artalk !== 'function' ? getScript('!{theme.asset.artalk_js}').then(initArtalk)
|
typeof Artalk !== 'function' ? getScript('!{theme.asset.artalk_js}').then(initArtalk)
|
||||||
: setTimeout(()=>{initArtalk()},200)
|
: setTimeout(()=>{initArtalk()},200)
|
||||||
}
|
}
|
||||||
|
|||||||
Loaded 3 of 12 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user