CC-2290:Clicking on another tab whilst uploading track kills

- note that change in queue will trigger the alert(on unload),
not the actual upload process
This commit is contained in:
james 2011-05-31 11:23:48 -04:00
parent 0014c3718e
commit 1f02ba813d
1 changed files with 19 additions and 0 deletions

View File

@ -25,5 +25,24 @@ $(document).ready(function() {
$("#plupload_error").find("table").append(row);
}
});
var uploadProgress = false;
uploader.bind('QueueChanged', function(){
uploadProgress = true;
});
uploader.bind('UploadComplete', function(){
uploadProgress = false;
});
$(window).bind('beforeunload', function(){
if(uploadProgress){
if(!confirm("Are you sure you want to navigate away from the page?\nNavigating away from the page will cancel all the upload process.")){
return false;
}
}
});
});