// 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(); } }); })();