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

+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)
}
+1 -8
View File
@@ -2,13 +2,6 @@
script.
function loadDisqusjs () {
function addDisqusjsCSS () {
const ele = document.createElement('link')
ele.rel = 'stylesheet'
ele.href= '!{url_for(theme.asset.disqusjs_css)}'
document.getElementsByTagName('head')[0].appendChild(ele)
}
function initDisqusjs () {
window.disqusjs = null
disqusjs = new DisqusJS(Object.assign({
@@ -34,7 +27,7 @@ script.
if (window.disqusJsLoad) initDisqusjs()
else {
addDisqusjsCSS()
getCSS('!{url_for(theme.asset.disqusjs_css)}')
getScript('!{url_for(theme.asset.disqusjs)}').then(initDisqusjs)
window.disqusJsLoad = true
}
Loaded 3 of 12 files, more files were not shown because too many files have changed in this diff. Show more