aboutsummaryrefslogtreecommitdiffstats
path: root/browser/templates/base.html.j2
diff options
context:
space:
mode:
Diffstat (limited to 'browser/templates/base.html.j2')
-rw-r--r--browser/templates/base.html.j221
1 files changed, 18 insertions, 3 deletions
diff --git a/browser/templates/base.html.j2 b/browser/templates/base.html.j2
index a8a6cf7..8b41a85 100644
--- a/browser/templates/base.html.j2
+++ b/browser/templates/base.html.j2
@@ -9,12 +9,27 @@
<title>Database browser</title>
<meta name="description" content="Database browser for log_db">
{% endblock %}
-
- <!-- -- https://leanrada.com/htmz/ -->
- <iframe hidden name=htmz onload="setTimeout(()=>document.querySelector(contentWindow.location.hash||null)?.replaceWith(...contentDocument.body.childNodes))"></iframe>
</head>
<body>
<h1><a href="/">Database browser</a></h1>
{% block content %}{% endblock %}
+
+ <!-- https://leanrada.com/htmz/ -->
+ <iframe hidden name=htmz onload="setTimeout(()=>document.querySelector(contentWindow.location.hash||null)?.replaceWith(...contentDocument.body.childNodes))"></iframe>
+ <!-- Enable progressive enhancement for htmz -->
+ <script>
+ document.querySelectorAll("form[htmz]").forEach(function (element) {
+ const input = document.createElement("input");
+ input.type = "hidden";
+ input.name = "htmz";
+ input.value = element.attributes.replace.value;
+ element.appendChild(input);
+
+ const action = new URL(element.action);
+ action.hash = element.attributes.replace.value;
+ element.action = action.toString();
+ element.target = "htmz";
+ });
+ </script>
</body>
</html>