diff options
Diffstat (limited to 'layouts/shortcodes/c/show.html')
-rw-r--r-- | layouts/shortcodes/c/show.html | 8 |
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> |