Files
FixIt/layouts/shortcodes/fixit-encryptor.html
T
2024-08-26 11:22:45 +08:00

33 lines
1.2 KiB
HTML

{{- $password := "" -}}
{{- $message := "" -}}
{{- if .IsNamedParams -}}
{{- $password = .Get "password" | default "" -}}
{{- $message = .Get "message" | default (T "single.encryptedMessage") -}}
{{- else -}}
{{- $password = .Get 0 | default "" -}}
{{- $message = .Get 1 | default (T "single.encryptedMessage") -}}
{{- end -}}
{{- if $password -}}
{{- /* Content */ -}}
{{- $content := .Inner | .Page.RenderString -}}
{{- /* Content Encryption */ -}}
{{- $content = dict "Content" $content "Password" $password | partial "function/content-encryption.html" | safeHTML -}}
<fixit-encryptor class="fixit-encryptor-shortcode">
<div class="fixit-decryptor-container">
<label title='{{ T "single.password" }}'>
<input type="password" class="fixit-decryptor-input" placeholder="🔑 {{ $message }}" />
</label>
<button class="fixit-decryptor-btn">
{{- dict "Class" "fa-solid fa-unlock" | partial "plugin/icon.html" }} {{ T "single.enterBtn" -}}
</button>
</div>
<div data-password="{{ xxhash $password }}" data-content="{{ $content }}"></div>
</fixit-encryptor>
{{- .Page.Scratch.SetInMap "this" "encryptPartial" true -}}
{{- else -}}
{{- .Inner -}}
{{- end -}}