mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-07 00:56:48 +01:00
Ignore deleting nothing & strip trailing slashes
Don't ask the user for any confirmation if there is nothing to delete. This could occur when you select something, delete it, then try to delete again. We need to also strip trailing slashes for deleting files when updating the file manager. This is much like what we needed to do with adding files to the root of the file manager. Locations should end without a trailing slash, but a root is a trailing slash as its only char. A regex here solves the issue.
This commit is contained in:
@@ -593,7 +593,9 @@ var ICEcoder = {
|
||||
deleteFile: function() {
|
||||
var delFiles, selectedFilesList;
|
||||
|
||||
delFiles = top.ICEcoder.ask('Delete:\n\n'+top.ICEcoder.selectedFiles.toString().replace(/\|/g,"/").replace(/,/g,"\n")+'?');
|
||||
if (top.ICEcoder.selectedFiles.length>0) {
|
||||
delFiles = top.ICEcoder.ask('Delete:\n\n'+top.ICEcoder.selectedFiles.toString().replace(/\|/g,"/").replace(/,/g,"\n")+'?');
|
||||
}
|
||||
if (delFiles) {
|
||||
selectedFilesList = "";
|
||||
for (var i=0;i<top.ICEcoder.selectedFiles.length;i++) {
|
||||
@@ -761,7 +763,7 @@ var ICEcoder = {
|
||||
// Deleting files
|
||||
if (action=="delete") {
|
||||
// Simply get our target and make it dissapear
|
||||
targetElem = document.getElementById('filesFrame').contentWindow.document.getElementById(location.replace(/\//g,"|")+"|"+file).parentNode.parentNode;
|
||||
targetElem = document.getElementById('filesFrame').contentWindow.document.getElementById(location.replace(/\/$/, "").replace(/\//g,"|")+"|"+file).parentNode.parentNode;
|
||||
targetElem.parentNode.removeChild(targetElem);
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user