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

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

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)
}