home
·
contact
·
privacy
projects
/
ledgplom
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
11bb6a8
)
On taint, also prevent user from closing/reloading window without confirmation.
author
Christian Heller
<c.heller@plomlompom.de>
Sun, 27 Apr 2025 16:21:26 +0000
(18:21 +0200)
committer
Christian Heller
<c.heller@plomlompom.de>
Sun, 27 Apr 2025 16:21:26 +0000
(18:21 +0200)
src/templates/_macros.tmpl
patch
|
blob
|
history
diff --git
a/src/templates/_macros.tmpl
b/src/templates/_macros.tmpl
index dc25e0b80eb57995e73bf1bb9f18edccaa6aea57..05dc359775b55f9a4aee1439ea24bd3341a8605d 100644
(file)
--- a/
src/templates/_macros.tmpl
+++ b/
src/templates/_macros.tmpl
@@
-128,6
+128,11
@@
function taint() {
Array.from(document.getElementsByClassName('disable_on_change')).forEach((el) => {
recursive_span_disable(el);
});
+ // try to catch user closing or reloading window
+ window.addEventListener('beforeunload', function(e) {
+ e.preventDefault();
+ e.returnValue = true; }
+ );
// remove oninput handlers no longer needed (since we only ever go one way)
Array.from(document.querySelectorAll('*')
).filter(el => (el.oninput !== null)