diff --git a/_config.yml b/_config.yml index dcafa69..a5ffaba 100644 --- a/_config.yml +++ b/_config.yml @@ -619,6 +619,10 @@ subtitle: enable: false # Typewriter Effect (打字效果) effect: true + # Effect Speed Options (打字效果速度參數) + startDelay: 300 # time before typing starts in milliseconds + typeSpeed: 150 # type speed in milliseconds + backSpeed: 50 # backspacing speed in milliseconds # loop (循環打字) loop: true # source 調用第三方服務 @@ -631,6 +635,7 @@ subtitle: # 如果關閉打字效果,subtitle 只會顯示 sub 的第一行文字 sub: + # Loading Animation (加載動畫) preloader: false diff --git a/layout/includes/third-party/subtitle.pug b/layout/includes/third-party/subtitle.pug index 63915ec..9236757 100644 --- a/layout/includes/third-party/subtitle.pug +++ b/layout/includes/third-party/subtitle.pug @@ -1,4 +1,4 @@ -- const { effect,loop,source,sub } = theme.subtitle +- const { effect,loop,source,sub,startDelay,typeSpeed,backSpeed } = theme.subtitle - let subContent = sub || new Array() case source @@ -14,10 +14,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 +46,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 +78,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 +107,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]}'