diff options
Diffstat (limited to 'web/static')
-rw-r--r-- | web/static/dartboat.js | 11 |
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()); |