From ef3eebfd3e46276aa58d722e4e8986946872439c Mon Sep 17 00:00:00 2001 From: Arthur Schiwon <blizzz@owncloud.com> Date: Mon, 20 Aug 2012 17:24:10 +0200 Subject: [PATCH] Fix deletion for browser that do not support onBeforeUnload, fixes oc-1534. --- apps/files/js/filelist.js | 41 +++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index a414c5f830..6ba3f3555e 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -151,7 +151,7 @@ FileList={ } }); } - + } tr.attr('data-file', newname); var path = td.children('a.name').attr('href'); @@ -189,7 +189,7 @@ FileList={ FileList.replaceCanceled = false; FileList.replaceOldName = oldName; FileList.replaceNewName = newName; - FileList.lastAction = function() { + FileList.lastAction = function() { FileList.finishReplace(); }; $('#notification').html(t('files', 'replaced')+' '+newName+' '+t('files', 'with')+' '+oldName+'<span class="undo">'+t('files', 'undo')+'</span>'); @@ -236,23 +236,13 @@ FileList={ do_delete:function(files){ // Finish any existing actions if (FileList.lastAction || !FileList.useUndo) { + if(!FileList.deleteFiles) { + FileList.prepareDeletion(files); + } FileList.lastAction(); + 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.lastAction = function() { - FileList.finishDelete(null, true); - }; + FileList.prepareDeletion(files); $('#notification').html(t('files', 'deleted')+' '+files+'<span class="undo">'+t('files', 'undo')+'</span>'); $('#notification').fadeIn(); }, @@ -279,6 +269,23 @@ 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; + FileList.lastAction = function() { + FileList.finishDelete(null, true); + }; } } -- GitLab