Skip to content

Commit

Permalink
improve form
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Hardman <daniel.hardman@gmail.com>
  • Loading branch information
dhh1128 committed Sep 6, 2024
1 parent 2d3d480 commit 09377cc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ <h1><a href="{{ "/" | absolute_url }}">{{ site.title | default: site.github.repo
</section>
<footer>
Content copyrighted with a <a href="https://creativecommons.org/licenses/by/4.0/deed.en">CC BY 4.0 license</a>.
Code samples are distributed under an [Apache 2 license](https://github.com/dhh1128/canonical-quoted-text/blob/main/LICENSE).
Code samples are distributed under an <a href="https://github.com/dhh1128/canonical-quoted-text/blob/main/LICENSE">Apache 2 license</a>.
A version history for each item is maintained in <a href="https://github.com/dhh1128/canonical-quoted-text">GitHub</a>.
<a href="https://github.com/dhh1128/canonical-quoted-text/issues/new">Reports of errata</a> are welcome.
</footer>
Expand Down
17 changes: 12 additions & 5 deletions form.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@

<script src="cqt.js"></script>
<script type="module">
import * as blake3 from 'https://cdn.jsdelivr.net/npm/blake3@latest/dist/blake3.min.js';
let blake3;

// Load the module once
(async function() {
const blake3Module = await import('https://cdn.jsdelivr.net/npm/blake3@latest/dist/browser.js');
blake3 = blake3Module.default;
})();

function el(id) {
return document.getElementById(id);
}
Expand All @@ -28,13 +35,13 @@
el('blake3').value = hex_hash(blake3);
}
</script>
<label>Input</label>
<label>Input</label><br>
<textarea id="input" rows="12" cols="80" placeholder="Enter text to canonicalize" maxlength="16384" onchange="reset()"></textarea><br>
<button onclick="cqt()">Canonicalize</button><br>
<label>Output</label>
<label>Output</label><br>
<textarea id="output" rows="12" cols="80" placeholder="Canonicalized text will appear here" readonly></textarea>
<label>Blake3 (hex)</label>
<label>Blake3 (hex)</label><br>
<textarea id="blake3" rows="1" cols="80" placeholder="Blake3 hash will appear here" readonly></textarea>
<label>SHA256 (hex)</label>
<label>SHA256 (hex)</label><br>
<textarea id="sha256" rows="1" cols="80" placeholder="SHA256 hash will appear here" readonly></textarea>

0 comments on commit 09377cc

Please sign in to comment.