mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
+8
-7
@@ -738,7 +738,7 @@ class FixIt {
|
||||
Object.values(groupMap).forEach((group) => {
|
||||
const typeone = (i) => {
|
||||
const typeitElement = group[i];
|
||||
const singleLoop = typeitElement.dataset.loop;
|
||||
const singleData = typeitElement.dataset;
|
||||
stagingDOM.stage(typeitElement.querySelector('template').content.cloneNode(true));
|
||||
// for shortcodes usage
|
||||
let targetEle = typeitElement.firstElementChild
|
||||
@@ -750,18 +750,19 @@ class FixIt {
|
||||
// create a new instance of TypeIt for each element
|
||||
const instance = new TypeIt(targetEle, {
|
||||
strings: stagingDOM.$el.querySelector('pre')?.innerHTML || stagingDOM.contentAsHtml(),
|
||||
speed: speed,
|
||||
speed: Number(singleData.speed) >= 0 ? Number(singleData.speed) : speed,
|
||||
lifeLike: true,
|
||||
cursorSpeed: cursorSpeed,
|
||||
cursorChar: cursorChar,
|
||||
cursorSpeed: Number(singleData.cursorSpeed) >= 0 ? Number(singleData.cursorSpeed) : cursorSpeed,
|
||||
cursorChar: singleData.cursorChar || cursorChar,
|
||||
waitUntilVisible: true,
|
||||
loop: singleLoop ? JSON.parse(singleLoop) : loop,
|
||||
loop: singleData.loop ? singleData.loop === 'true' : loop,
|
||||
afterComplete: () => {
|
||||
const duration = Number(singleData.duration ?? vtypeitConfig.duration);
|
||||
if (i === group.length - 1) {
|
||||
if (typeitConfig.duration >= 0) {
|
||||
if (duration >= 0) {
|
||||
window.setTimeout(() => {
|
||||
instance.destroy();
|
||||
}, typeitConfig.duration);
|
||||
}, duration);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
{{- end -}}
|
||||
{{- $related := $posts.Related . | first ($params.related.count | default 5) -}}
|
||||
{{- with $related -}}
|
||||
<hr class="awesome-hr" />
|
||||
<h2 id="see-also">{{ T "single.relatedContent" }}</h2>
|
||||
<ul>
|
||||
{{- range $i, $p := . -}}
|
||||
|
||||
@@ -25,6 +25,18 @@
|
||||
{{- with (.Get "group" | string) -}}
|
||||
{{- $wrapperAttrs = printf `%v data-group="%v"` $wrapperAttrs . -}}
|
||||
{{- end -}}
|
||||
{{- with .Get "speed" -}}
|
||||
{{- $wrapperAttrs = printf `%v data-speed="%v"` $wrapperAttrs . -}}
|
||||
{{- end -}}
|
||||
{{- with .Get "cursorSpeed" -}}
|
||||
{{- $wrapperAttrs = printf `%v data-cursor-speed="%v"` $wrapperAttrs . -}}
|
||||
{{- end -}}
|
||||
{{- with .Get "cursorChar" -}}
|
||||
{{- $wrapperAttrs = printf `%v data-cursor-char="%v"` $wrapperAttrs . -}}
|
||||
{{- end -}}
|
||||
{{- with .Get "duration" -}}
|
||||
{{- $wrapperAttrs = printf `%v data-duration="%v"` $wrapperAttrs . -}}
|
||||
{{- end -}}
|
||||
{{- with $loop -}}
|
||||
{{- $wrapperAttrs = printf `%v data-loop="true"` $wrapperAttrs -}}
|
||||
{{- end -}}
|
||||
|
||||
Reference in New Issue
Block a user