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,11 +1,4 @@
script.
function addGitalkSource () {
const ele = document.createElement('link')
ele.rel = 'stylesheet'
ele.href= '!{url_for(theme.asset.gitalk_css)}'
document.getElementsByTagName('head')[0].appendChild(ele)
}
function loadGitalk () {
function initGitalk () {
var gitalk = new Gitalk(Object.assign({
@@ -23,7 +16,7 @@ script.
if (typeof Gitalk === 'function') initGitalk()
else {
addGitalkSource()
getCSS('!{url_for(theme.asset.gitalk_css)}')
getScript('!{url_for(theme.asset.gitalk)}').then(initGitalk)
}
}