mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-12 14:07:06 +08:00
fix: 修復 pjax 下, waline js 會重複加載的 bug
This commit is contained in:
32
layout/includes/third-party/subtitle.pug
vendored
32
layout/includes/third-party/subtitle.pug
vendored
@@ -36,6 +36,38 @@ case source
|
||||
}
|
||||
|
||||
when 2
|
||||
script.
|
||||
function subtitleType () {
|
||||
getScript('https://yijuzhan.com/api/word.php?m=js').then(() => {
|
||||
const con = str[0]
|
||||
if (!{effect}) {
|
||||
const from = '出自 ' + str[1]
|
||||
const sub = !{JSON.stringify(subContent)}
|
||||
sub.unshift(con, from)
|
||||
window.typed = new Typed('#subtitle', {
|
||||
strings: sub,
|
||||
startDelay: !{startDelay},
|
||||
typeSpeed: !{typeSpeed},
|
||||
loop: !{loop},
|
||||
backSpeed: !{backSpeed},
|
||||
})
|
||||
} else {
|
||||
document.getElementById('subtitle').innerHTML = con
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (!{effect}) {
|
||||
if (typeof Typed === 'function') {
|
||||
subtitleType()
|
||||
} else {
|
||||
getScript('!{url_for(theme.asset.typed)}').then(subtitleType)
|
||||
}
|
||||
} else {
|
||||
subtitleType()
|
||||
}
|
||||
|
||||
when 3
|
||||
script.
|
||||
function subtitleType () {
|
||||
getScript('https://sdk.jinrishici.com/v2/browser/jinrishici.js').then(() => {
|
||||
|
||||
Reference in New Issue
Block a user