Serve every page under a hash-based Content-Security-Policy, and update KaTeX to 0.16.47
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
fd9f665ef8
commit
fdd4dcf841
16 files changed
+207
-23
No files matched your search
@@ -0,0 +1,28 @@
|
||||
// What the pages did in inline handlers, which the Content-Security-Policy
|
||||
// does not run: a form sent when a choice changes, a confirmation before a
|
||||
// removal, a field filled from the option chosen, and the live parts of the
|
||||
// cluster and node pages refreshed only while the tab is in view.
|
||||
(function () {
|
||||
document.addEventListener('change', function (e) {
|
||||
var t = e.target;
|
||||
if (t.matches && t.matches('[data-autosubmit]') && t.form) {
|
||||
t.form.submit();
|
||||
}
|
||||
if (t.matches && t.matches('[data-suggest-into]') && t.form) {
|
||||
var f = t.form.elements[t.getAttribute('data-suggest-into')];
|
||||
var o = t.selectedOptions[0];
|
||||
if (f && o) { f.value = o.dataset.suggest || ''; }
|
||||
}
|
||||
});
|
||||
document.addEventListener('submit', function (e) {
|
||||
var msg = e.target.getAttribute && e.target.getAttribute('data-confirm');
|
||||
if (msg && !window.confirm(msg)) { e.preventDefault(); }
|
||||
});
|
||||
// htmx's trigger filters are evaluated JavaScript; this is the same
|
||||
// "only while visible" without them.
|
||||
document.addEventListener('htmx:beforeRequest', function (e) {
|
||||
if (document.visibilityState !== 'visible' && e.detail.elt.hasAttribute('data-visible-only')) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
})();
|
||||
Reference in new issue
Block a user