Feat: add loop paramter for typeit and update typeit from 8.7.0 to 8.7.1

This commit is contained in:
Cell
2023-03-09 12:42:12 +08:00
parent 9ca9a6e284
commit 433c631110
12 changed files with 19 additions and 11 deletions
+2
View File
@@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file.
- :sparkles: Feat: add instant page (@Mejituu [#279](https://github.com/hugo-fixit/FixIt/pull/279))
- :sparkles: Feat: add `force` option value to `params.page.lightgallery`
- :sparkles: Feat: add loop paramter for typeit ([#303](https://github.com/hugo-fixit/FixIt/pull/303))
- :bug: Fix: donate images without lazy loading (@Mejituu [#279](https://github.com/hugo-fixit/FixIt/pull/279))
- :bug: Fix: discordinvite typo (@mathieu-gilloots [#282](https://github.com/hugo-fixit/FixIt/pull/282))
- :bug: Fix: missing parameter `requiredFields` for Valine
@@ -28,6 +29,7 @@ All notable changes to this project will be documented in this file.
- :wrench: Chore: change the theme minimum supported Hugo versions above **0.89.0**
- :arrow_up: Chore(libs):
- Update Update @waline/client from 2.10.0 to 2.14.7 (@Mejituu [#279](https://github.com/hugo-fixit/FixIt/pull/279))
- Update typeit from 8.7.0 to 8.7.1
- **Full Changelog:** @Lruihao [`v0.2.16...v0.2.17`](https://github.com/hugo-fixit/FixIt/compare/v0.2.16...v0.2.17)
## v0.2.17 [2023.1.29]
+2 -2
View File
@@ -74,8 +74,8 @@ libFiles:
twemojiJS: twemoji@14.0.2/dist/twemoji.min.js
# twikoo@1.6.8 https://github.com/imaegoo/twikoo
twikooJS: twikoo@1.6.8/dist/twikoo.all.min.js
# typeit@8.7.0 https://github.com/alexmacarthur/typeit
typeitJS: typeit@8.7.0/dist/index.umd.js
# typeit@8.7.1 https://github.com/alexmacarthur/typeit
typeitJS: typeit@8.7.1/dist/index.umd.js
# valine@1.5.1 https://github.com/xCss/Valine
valineJS: valine@1.5.1/dist/Valine.min.js
# vconsole@3.14.6 https://github.com/Tencent/vConsole
+2 -2
View File
@@ -74,8 +74,8 @@ libFiles:
twemojiJS: twemoji@14.0.2/dist/twemoji.min.js
# twikoo@1.6.8 https://github.com/imaegoo/twikoo
twikooJS: twikoo@1.6.8/dist/twikoo.all.min.js
# typeit@8.7.0 https://github.com/alexmacarthur/typeit
typeitJS: typeit@8.7.0/dist/index.umd.js
# typeit@8.7.1 https://github.com/alexmacarthur/typeit
typeitJS: typeit@8.7.1/dist/index.umd.js
# valine@1.5.1 https://github.com/xCss/Valine
valineJS: valine@1.5.1/dist/Valine.min.js
# vconsole@3.14.6 https://github.com/Tencent/vConsole
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -26,7 +26,7 @@ sharer.js@0.5.1 https://github.com/ellisonleao/sharer.js
simple-icons@7.12.0 https://github.com/simple-icons/simple-icons
twemoji@14.0.2 https://github.com/twitter/twemoji
twikoo@1.6.8 https://github.com/imaegoo/twikoo
typeit@8.7.0 https://github.com/alexmacarthur/typeit
typeit@8.7.1 https://github.com/alexmacarthur/typeit
valine@1.5.1 https://github.com/xCss/Valine
vconsole@3.14.6 https://github.com/Tencent/vConsole
waline@2.14.7 https://github.com/walinejs/waline
File diff suppressed because one or more lines are too long
+2
View File
@@ -650,6 +650,8 @@
cursorChar = "|"
# cursor duration after typing finishing (measured in milliseconds, "-1" means unlimited)
duration = -1
# FixIt 0.2.18 | NEW whether your strings will continuously loop after completing
loop = false
# FixIt 0.2.15 | NEW Mermaid config
[params.mermaid]
+1 -1
Submodule docs updated: de06dd7acc...e0614a8f6d
+1 -1
View File
@@ -88,7 +88,7 @@
{{- $typeit := $.Site.Params.typeit -}}
{{- $source := $cdn.typeitJS | default "lib/typeit/index.umd.js" -}}
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Scratch" $.Scratch "Data" | partial "scratch/script.html" -}}
{{- $config = dict "speed" $typeit.speed "cursorSpeed" $typeit.cursorSpeed "cursorChar" $typeit.cursorChar "duration" $typeit.duration "data" . | dict "typeit" | merge $config -}}
{{- $config = dict "speed" $typeit.speed "cursorSpeed" $typeit.cursorSpeed "cursorChar" $typeit.cursorChar "duration" $typeit.duration "loop" $typeit.loop "data" . | dict "typeit" | merge $config -}}
{{- end -}}
{{- /* KaTeX */ -}}
+2 -1
View File
@@ -4,6 +4,7 @@
{{- $classList = $classList | append . -}}
{{- end -}}
{{- $tag := .Get "tag" | default "div" -}}
{{- $loop := cond (ne (.Get "group") "") false (.Get "loop") -}}
{{- if .Get "code" -}}
{{- /* highlight code content without line number */ -}}
@@ -34,5 +35,5 @@
{{- $attrs = delimit $classList " " | printf `%v class="%v"` $attrs -}}
{{- end -}}
<div class="typeit">{{ printf `<%v %v></%v>` $tag $attrs $tag | safeHTML }}</div>
<div class="typeit"{{ if ne $loop "" }} data-loop="{{ $loop }}"{{ end }}>{{ printf `<%v %v></%v>` $tag $attrs $tag | safeHTML }}</div>
{{- /* EOF */ -}}
+3
View File
@@ -804,9 +804,11 @@ class FixIt {
const speed = typeitConfig.speed || 100;
const cursorSpeed = typeitConfig.cursorSpeed || 1000;
const cursorChar = typeitConfig.cursorChar || '|';
const loop = typeitConfig.loop ?? false;
Object.values(typeitConfig.data).forEach((group) => {
const typeone = (i) => {
const id = group[i];
const shortcodeLoop = document.querySelector(`#${id}`).parentElement.dataset.loop;
const instance = new TypeIt(`#${id}`, {
strings: this.data[id],
speed: speed,
@@ -814,6 +816,7 @@ class FixIt {
cursorSpeed: cursorSpeed,
cursorChar: cursorChar,
waitUntilVisible: true,
loop: shortcodeLoop ? JSON.parse(shortcodeLoop) : loop,
afterComplete: () => {
if (i === group.length - 1) {
if (typeitConfig.duration >= 0) {