Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/vjeantet/hugo-theme-docport.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvjeantet <valere.jeantet@gmail.com>2020-09-25 11:01:01 +0300
committervjeantet <valere.jeantet@gmail.com>2020-09-25 11:01:01 +0300
commite2fd5749ff2086b88e51a7954c99580275b058df (patch)
treecff4a1e9da0d0e09b51629a6439209b329a631b2 /layouts
parenta97ab9a9a71d02dd6a04ca04b4a0bdff611e84c7 (diff)
checklist: condition are an DOM element attribute
Diffstat (limited to 'layouts')
-rw-r--r--layouts/shortcodes/c/show.html8
1 files changed, 3 insertions, 5 deletions
diff --git a/layouts/shortcodes/c/show.html b/layouts/shortcodes/c/show.html
index 637f430..830c784 100644
--- a/layouts/shortcodes/c/show.html
+++ b/layouts/shortcodes/c/show.html
@@ -1,17 +1,15 @@
-{{ $formID := "6d2ab01b-fad4-4e70-83a8-b910ca848fec" }}
-{{ $random := delimit (shuffle (split (md5 $formID) "" )) "" }}
+{{ $random := delimit (shuffle (split (md5 .Page.File.UniqueID) "" )) "" }}
{{ $id := printf "dp-show-%s" $random}}
{{ $condition := trim (.Get 0) " "}}
-{{ $regFormValue := printf "formValue('%s','$1')" $formID}}
+{{ $regFormValue := printf "formValue('$1')"}}
{{ $conditionFix := replaceRE `{(\w+)}` $regFormValue $condition }}
{{ $conditionFix = replace $conditionFix ` and ` ` && ` }}
{{ $conditionFix = replace $conditionFix ` or ` ` || ` }}
{{ $conditionFix = replaceRE `[^)]+has\s+('\w+')` ".includes($1)" $conditionFix }}
-<div id="{{$id}}" class="baz" style="display:none">
+<div id="{{$id}}" class="baz" style="display:none" cond="{{$conditionFix | safeHTMLAttr}}">
{{with .Get 1}}
<input type="hidden" value="true" name="{{.}}">
{{end}}
{{.Inner | markdownify}}</div>
-<script type="text/javascript">$(registerShowIf('{{$id}}','{{$conditionFix}}'))</script>