mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-16 20:30:53 +08:00
feat: Support typewriter effect speed options of Subtitle in _config.yml
This commit is contained in:
27
layout/includes/third-party/subtitle.pug
vendored
27
layout/includes/third-party/subtitle.pug
vendored
@@ -1,4 +1,7 @@
|
||||
- const { effect,loop,source,sub } = theme.subtitle
|
||||
- const startDelay = theme.subtitle.startDelay ?? 300
|
||||
- const typeSpeed = theme.subtitle.typeSpeed ?? 150
|
||||
- const backSpeed = theme.subtitle.backSpeed ?? 50
|
||||
- let subContent = sub || new Array()
|
||||
|
||||
case source
|
||||
@@ -14,10 +17,10 @@ case source
|
||||
sub.unshift(data.hitokoto, from)
|
||||
window.typed = new Typed('#subtitle', {
|
||||
strings: sub,
|
||||
startDelay: 300,
|
||||
typeSpeed: 150,
|
||||
startDelay: !{startDelay},
|
||||
typeSpeed: !{typeSpeed},
|
||||
loop: !{loop},
|
||||
backSpeed: 50,
|
||||
backSpeed: !{backSpeed},
|
||||
})
|
||||
} else {
|
||||
document.getElementById('subtitle').innerHTML = data.hitokoto
|
||||
@@ -46,10 +49,10 @@ case source
|
||||
sub.unshift(con, from)
|
||||
window.typed = new Typed('#subtitle', {
|
||||
strings: sub,
|
||||
startDelay: 300,
|
||||
typeSpeed: 150,
|
||||
startDelay: !{startDelay},
|
||||
typeSpeed: !{typeSpeed},
|
||||
loop: !{loop},
|
||||
backSpeed: 50,
|
||||
backSpeed: !{backSpeed},
|
||||
})
|
||||
} else {
|
||||
document.getElementById('subtitle').innerHTML = con
|
||||
@@ -78,10 +81,10 @@ case source
|
||||
sub.unshift(content)
|
||||
window.typed = new Typed('#subtitle', {
|
||||
strings: sub,
|
||||
startDelay: 300,
|
||||
typeSpeed: 150,
|
||||
startDelay: !{startDelay},
|
||||
typeSpeed: !{typeSpeed},
|
||||
loop: !{loop},
|
||||
backSpeed: 50,
|
||||
backSpeed: !{backSpeed},
|
||||
})
|
||||
} else {
|
||||
document.getElementById('subtitle').innerHTML = result.data.content
|
||||
@@ -107,10 +110,10 @@ case source
|
||||
if (!{effect}) {
|
||||
window.typed = new Typed("#subtitle", {
|
||||
strings: !{JSON.stringify(subContent)},
|
||||
startDelay: 300,
|
||||
typeSpeed: 150,
|
||||
startDelay: !{startDelay},
|
||||
typeSpeed: !{typeSpeed},
|
||||
loop: !{loop},
|
||||
backSpeed: 50
|
||||
backSpeed: !{backSpeed}
|
||||
})
|
||||
} else {
|
||||
document.getElementById("subtitle").innerHTML = '!{subContent[0]}'
|
||||
|
||||
Reference in New Issue
Block a user