summaryrefslogtreecommitdiff
path: root/web/static/dartboat.js
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-10 16:56:15 -0700
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2022-05-10 16:56:15 -0700
commit29d471c8eea0bcf5d23b9e63180e9f1b7089850c (patch)
tree876e7ee19b520240ff0a578818200903fda9464d /web/static/dartboat.js
parent99e7a11c25e704851cfbbaed64594acbbd752038 (diff)
downloaddartboat-29d471c8eea0bcf5d23b9e63180e9f1b7089850c.tar.gz
dartboat-29d471c8eea0bcf5d23b9e63180e9f1b7089850c.tar.xz
web: add exit dialogue while match is active
Diffstat (limited to 'web/static/dartboat.js')
-rw-r--r--web/static/dartboat.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/web/static/dartboat.js b/web/static/dartboat.js
index aacb1bc..b2b8481 100644
--- a/web/static/dartboat.js
+++ b/web/static/dartboat.js
@@ -123,6 +123,17 @@ function storeOpt(opt, val) {
localStorage.setItem(UTF8ToString(opt), UTF8ToString(val));
}
+function prevDef(e) {
+ e.preventDefault();
+}
+
+function enableExitDialogue(enable) {
+ if (enable)
+ window.addEventListener('beforeunload', prevDef);
+ else
+ window.removeEventListener('beforeunload', prevDef);
+}
+
function boatAfloat() {
if (document.readyState === 'loading')
document.addEventListener('DOMContentLoaded', () => _init());