From 6eb504047c1f25bee2cbc206aa9e7fc03e69681e Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Sun, 4 Oct 2015 04:14:33 +0200 Subject: [PATCH] Revert "Better javascript" (breaks #1 fix) This reverts commit c7a2265e5fa197570c2e548404a082bb3543c7a7. --- public/js/lufi-down.js | 4 ++-- public/js/lufi-up.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/js/lufi-down.js b/public/js/lufi-down.js index 142c9e1..af98a41 100644 --- a/public/js/lufi-down.js +++ b/public/js/lufi-down.js @@ -71,7 +71,7 @@ function spawnWebsocket() { pbd.innerHTML = ''+i18n.download+''; ws.send('{"ended":true}'); - window.removeEventListener('onbeforeunload', confirmExit); + window.onbeforeunload = null; } else { if (ws.readyState === 3) { ws = spawnWebsocket(); @@ -93,5 +93,5 @@ document.addEventListener('DOMContentLoaded', function() { ws = spawnWebsocket(); // Prevent exiting page before full download - window.addEventListener('onbeforeunload', confirmExit); + window.onbeforeunload = confirmExit; }); diff --git a/public/js/lufi-up.js b/public/js/lufi-up.js index 0e73f36..75ff963 100644 --- a/public/js/lufi-up.js +++ b/public/js/lufi-up.js @@ -130,7 +130,7 @@ function handleFiles(f) { // Create progress bar and call slicing and uploading function function uploadFile(i, delay, del_at_first_view) { // Prevent exiting page before full upload - window.addEventListener('onbeforeunload', confirmExit); + window.onbeforeunload = confirmExit; // Create a random key, different for all files var randomkey = sjcl.codec.base64.fromBits(sjcl.random.randomWords(8, 0), 0); @@ -301,7 +301,7 @@ function updateProgressBar(data) { uploadFile(i, sent_delay, del_at_first_view); } else { // We have finished - window.removeEventListener('onbeforeunload', confirmExit); + document.onbeforeunload = null; document.getElementById('delete-day').removeAttribute('disabled'); document.getElementById('first-view').removeAttribute('disabled'); }