Skip to content

Commit a698fbb

Browse files
committed
update template
1 parent d6dad1b commit a698fbb

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

documentation/decrypt-form.tpl.html

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ <h1>{{ summary }}</h1>
55
{% if encryption_info_message %}<p>{{ encryption_info_message }}</p>{% endif %}
66
<div class="w3-row-padding" style="padding-left: 0px;">
77
{%- if obfuscate %}
8-
<input type="hidden" id="mkdocs-content-password" value="{{ obfuscate_password }}" />
8+
<input type="hidden" id="mkdocs-content-password" value="{{ obfuscate_password }}">
99
{%- else %}
1010
{%- if uname %}
1111
<div class="w3-third">
12-
<input{% if input_class %} class="{{ input_class }}"{% endif %} type="text" id="mkdocs-content-user" placeholder="{{ placeholder_user }}" />
12+
<input{% if input_class %} class="{{ input_class }}"{% endif %} type="text" id="mkdocs-content-user" placeholder="{{ placeholder_user }}">
1313
</div>
1414
{%- endif %}
1515
<div class="w3-third">
16-
<input{% if input_class %} class="{{ input_class }}"{% endif %} type="password" id="mkdocs-content-password" placeholder="{{ placeholder }}" />
16+
<input{% if input_class %} class="{{ input_class }}"{% endif %} type="password" id="mkdocs-content-password" placeholder="{{ placeholder }}">
1717
</div>
1818
{%- endif %}
1919
{%- if password_button %}
@@ -35,10 +35,27 @@ <h1>{{ summary }}</h1>
3535
{% if inject_something %}var inject_something = {{ inject_something }};{% endif -%}
3636
{% if delete_something %}var delete_something = "{{ delete_something }}";{%- endif %}
3737
</script>
38-
{% for library in js_libraries %}
38+
{%- if esm %}
39+
<script type="module">
40+
if (!window.hasOwnProperty("init_decryptor")) {
41+
{%- if not webcrypto %}
42+
import("{{ js_libraries[0] }}").then((module) => {
43+
window["CryptoJS"] = module.default;
44+
{%- endif %}
45+
import("{{ base_path }}assets/javascripts/decrypt-contents.js");
46+
{%- if not webcrypto %}
47+
});
48+
{%- endif %}
49+
} else {
50+
init_decryptor();
51+
}
52+
</script>
53+
{%- else %}
54+
{%- for library in js_libraries %}
3955
<script type="text/javascript" src="{{ library }}"></script>
40-
{%- endfor %}
56+
{%- endfor %}
4157
<script type="text/javascript" src="{{ base_path }}assets/javascripts/decrypt-contents.js" defer></script>
58+
{%- endif %}
4259
<script>
4360
var encryptcontent_info = document.getElementById('encryptcontent-info');
4461
encryptcontent_info.innerHTML = '<b>keystore length:</b> '+ encryptcontent_keystore.length + '<br>encryptcontent id:<b>:</b> ' + encryptcontent_id;

documentation/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ plugins:
140140
sharelinks_incomplete: true
141141
#kdf_pow: 4
142142
webcrypto: true
143+
esm: true
143144
sign_files: 'encryptcontent-plugin.json'
144145
cache_file: 'encryptcontent.cache'
145146
sharelinks_output: 'sharelinks.txt'

0 commit comments

Comments
 (0)