2020-01-31 15:53:04 +01:00
|
|
|
{{- if .Get "date" -}}
|
|
|
|
{{- $date := .Get "date" -}}
|
|
|
|
{{- $id := delimit (split (md5 $date) "" | shuffle) "" | printf "countdown-%s" -}}
|
|
|
|
{{- $defaultPattern := printf "%%D %s %%H %s %%M %s %%S %s" (T "day") (T "hour") (T "minute") (T "second") -}}
|
|
|
|
{{- $new := dict $id (dict "date" $date "pattern" (.Get "pattern" | default $defaultPattern)) -}}
|
|
|
|
{{- with .Page.Scratch.Get "countdownMap" -}}
|
|
|
|
{{- .Page.Scratch.Set "countdownMap" (merge . $new) -}}
|
|
|
|
{{- else -}}
|
|
|
|
{{- .Page.Scratch.Set "countdownMap" $new -}}
|
|
|
|
{{- end -}}
|
2020-01-29 17:54:03 +01:00
|
|
|
<div id="{{ $id }}" style={{ .Get "style" | safeCSS }}></div>
|
2020-02-06 17:10:00 +01:00
|
|
|
{{- end -}}
|