Better javascript

This commit is contained in:
Luc Didry 2015-10-03 01:25:32 +02:00
parent ae8934c1d9
commit c7a2265e5f
2 changed files with 4 additions and 4 deletions

View File

@ -71,7 +71,7 @@ function spawnWebsocket() {
pbd.innerHTML = '<a href="'+URL.createObjectURL(blob)+'" class="btn btn-primary" download="'+data.name+'">'+i18n.download+'</a>';
ws.send('{"ended":true}');
window.onbeforeunload = null;
window.removeEventListener('onbeforeunload', confirmExit);
} else {
if (ws.readyState === 3) {
ws = spawnWebsocket();
@ -93,5 +93,5 @@ document.addEventListener('DOMContentLoaded', function() {
ws = spawnWebsocket();
// Prevent exiting page before full download
window.onbeforeunload = confirmExit;
window.addEventListener('onbeforeunload', confirmExit);
});

View File

@ -96,7 +96,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.onbeforeunload = confirmExit;
window.addEventListener('onbeforeunload', confirmExit);
// Create a random key, different for all files
var randomkey = sjcl.codec.base64.fromBits(sjcl.random.randomWords(8, 0), 0);
@ -233,7 +233,7 @@ function updateProgressBar(data) {
uploadFile(i, delay, del_at_first_view);
} else {
// We have finished
document.onbeforeunload = null;
window.removeEventListener('onbeforeunload', confirmExit);
document.getElementById('delete-day').removeAttribute('disabled');
document.getElementById('first-view').removeAttribute('disabled');
}