M ui/base.tmpl => ui/base.tmpl +8 -6
@@ 86,14 86,16 @@
{{template "main" .}}
</body>
<script nonce="{{.CSPNonce}}">
-const growers = document.querySelectorAll(".grow-wrap");
+const updater = document.querySelector("#update");
+updater.style.display = "none";
-growers.forEach((grower) => {
- const textarea = grower.querySelector("textarea");
+const grower = document.querySelector(".grow-wrap");
+const textarea = grower.querySelector("textarea");
+grower.dataset.replicatedValue = textarea.value;
+
+textarea.addEventListener("input", () => {
grower.dataset.replicatedValue = textarea.value;
- textarea.addEventListener("input", () => {
- grower.dataset.replicatedValue = textarea.value;
- });
+ updater.style.display = "unset";
});
</script>
</html>
M ui/pages/list.tmpl => ui/pages/list.tmpl +4 -1
@@ 8,7 8,10 @@
autocomplete="off"
rows=12>{{ .Body }}</textarea>
</div>
- <button class="input" type="submit">Update {{ .Name }}</button>
+ <button
+ id="update"
+ class="input"
+ type="submit">Update {{ .Name }}</button>
</form>
</main>
{{end}}