This commit is contained in:
paw committed 2025-07-04 20:57:04 +08:00
1 parent d13cb091d4
commit 7d00554135
79 files changed
+3057 -422

No files matched your search

+10 -24
View File
@@ -1,31 +1,17 @@
{{- $text := .Get "text" | default "Hello World" -}}
{{- $speed := .Get "speed" | default "30" -}}
{{- $speed := .Get "speed" | default "10" -}}
{{- $loop := .Get "loop" | default "true" -}}
{{- $breakLines := .Get "breakLines" | default "false" -}}
<script src="https://cdn.jsdelivr.net/npm/typeit@8.7.1/dist/index.umd.js"></script>
<div id="typeit-{{ .Ordinal }}"></div>
{{- if eq .Ordinal 1 -}}
<script src="https://cdn.jsdelivr.net/npm/typeit@8.7.1/dist/index.umd.js"></script>
{{- end -}}
<div id="typed-{{ .Ordinal }}"></div>
<script>
document.addEventListener("DOMContentLoaded", function () {
new TypeIt("#typeit-{{ .Ordinal }}", {
strings: {{- if hasPrefix $text "[" -}} {{ $text | safeJS }} {{- else -}} "{{ $text }}" {{- end -}},
speed: {{ $speed }},
loop: {{ $loop }},
breakLines: {{ $breakLines }},
waitUntilVisible: true,
lifeLike: true,
})
{ { - if eq $loop "false" } }
.exec(() => {
instance.destroy();
})
{ { - end } }
.go();
});
new Typed("#typed-{{ .Ordinal }}", {
strings: {{ if hasPrefix $text "[" }}{{ $text | safeJS }}{{ else }}["{{ $text }}"]{{ end }},
typeSpeed: {{ $speed }},
loop: {{ if eq $loop "true" }}true{{ else }}false{{ end }},
showCursor: false,
smartBackspace: true
});
});
</script>