mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-17 04:40: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 { 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()
|
- let subContent = sub || new Array()
|
||||||
|
|
||||||
case source
|
case source
|
||||||
@@ -14,10 +17,10 @@ case source
|
|||||||
sub.unshift(data.hitokoto, from)
|
sub.unshift(data.hitokoto, from)
|
||||||
window.typed = new Typed('#subtitle', {
|
window.typed = new Typed('#subtitle', {
|
||||||
strings: sub,
|
strings: sub,
|
||||||
startDelay: 300,
|
startDelay: !{startDelay},
|
||||||
typeSpeed: 150,
|
typeSpeed: !{typeSpeed},
|
||||||
loop: !{loop},
|
loop: !{loop},
|
||||||
backSpeed: 50,
|
backSpeed: !{backSpeed},
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('subtitle').innerHTML = data.hitokoto
|
document.getElementById('subtitle').innerHTML = data.hitokoto
|
||||||
@@ -46,10 +49,10 @@ case source
|
|||||||
sub.unshift(con, from)
|
sub.unshift(con, from)
|
||||||
window.typed = new Typed('#subtitle', {
|
window.typed = new Typed('#subtitle', {
|
||||||
strings: sub,
|
strings: sub,
|
||||||
startDelay: 300,
|
startDelay: !{startDelay},
|
||||||
typeSpeed: 150,
|
typeSpeed: !{typeSpeed},
|
||||||
loop: !{loop},
|
loop: !{loop},
|
||||||
backSpeed: 50,
|
backSpeed: !{backSpeed},
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('subtitle').innerHTML = con
|
document.getElementById('subtitle').innerHTML = con
|
||||||
@@ -78,10 +81,10 @@ case source
|
|||||||
sub.unshift(content)
|
sub.unshift(content)
|
||||||
window.typed = new Typed('#subtitle', {
|
window.typed = new Typed('#subtitle', {
|
||||||
strings: sub,
|
strings: sub,
|
||||||
startDelay: 300,
|
startDelay: !{startDelay},
|
||||||
typeSpeed: 150,
|
typeSpeed: !{typeSpeed},
|
||||||
loop: !{loop},
|
loop: !{loop},
|
||||||
backSpeed: 50,
|
backSpeed: !{backSpeed},
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
document.getElementById('subtitle').innerHTML = result.data.content
|
document.getElementById('subtitle').innerHTML = result.data.content
|
||||||
@@ -107,10 +110,10 @@ case source
|
|||||||
if (!{effect}) {
|
if (!{effect}) {
|
||||||
window.typed = new Typed("#subtitle", {
|
window.typed = new Typed("#subtitle", {
|
||||||
strings: !{JSON.stringify(subContent)},
|
strings: !{JSON.stringify(subContent)},
|
||||||
startDelay: 300,
|
startDelay: !{startDelay},
|
||||||
typeSpeed: 150,
|
typeSpeed: !{typeSpeed},
|
||||||
loop: !{loop},
|
loop: !{loop},
|
||||||
backSpeed: 50
|
backSpeed: !{backSpeed}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
document.getElementById("subtitle").innerHTML = '!{subContent[0]}'
|
document.getElementById("subtitle").innerHTML = '!{subContent[0]}'
|
||||||
|
|||||||
Reference in New Issue
Block a user