From eadb894effffcec7224f6bd960602e0b7c3f5f60 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Mon, 20 Aug 2012 17:04:57 +0200 Subject: [PATCH] Fix deletion for browser that do not support onBeforeUnload, fixes oc-1534 --- apps/files/js/filelist.js | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 3645258f98..c3eb906f39 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -166,23 +166,15 @@ FileList={ }, do_delete:function(files){ if(FileList.deleteFiles || !FileList.useUndo){//finish any ongoing deletes first + if(!FileList.deleteFiles) { + FileList.prepareDeletion(files); + } FileList.finishDelete(function(){ FileList.do_delete(files); }); return; } - if(files.substr){ - files=[files]; - } - $.each(files,function(index,file){ - var files = $('tr').filterAttr('data-file',file); - files.hide(); - files.find('input[type="checkbox"]').removeAttr('checked'); - files.removeClass('selected'); - }); - procesSelection(); - FileList.deleteCanceled=false; - FileList.deleteFiles=files; + FileList.prepareDeletion(files); $('#notification').text(t('files','undo deletion')); $('#notification').data('deletefile',true); $('#notification').fadeIn(); @@ -209,6 +201,20 @@ FileList={ } }); } + }, + prepareDeletion:function(files){ + if(files.substr){ + files=[files]; + } + $.each(files,function(index,file){ + var files = $('tr').filterAttr('data-file',file); + files.hide(); + files.find('input[type="checkbox"]').removeAttr('checked'); + files.removeClass('selected'); + }); + procesSelection(); + FileList.deleteCanceled=false; + FileList.deleteFiles=files; } }