Clean fileObject

pull/1/head
yflory 8 years ago
parent cde724399c
commit 4e61b79f9a

@ -89,6 +89,9 @@ define([
var isPathInTrash = exp.isPathInTrash = function (path) { var isPathInTrash = exp.isPathInTrash = function (path) {
return path[0] && path[0] === TRASH; return path[0] && path[0] === TRASH;
}; };
var isInTrashRoot = exp.isInTrashRoot = function (path) {
return path[0] === TRASH && path.length === 4;
};
var isPathInFilesData = exp.isPathInFilesData = function (path) { var isPathInFilesData = exp.isPathInFilesData = function (path) {
return path[0] && path[0] === FILES_DATA; return path[0] && path[0] === FILES_DATA;
@ -439,10 +442,6 @@ define([
return paths; return paths;
}; };
var isInTrashRoot = exp.isInTrashRoot = function (path) {
return path[0] === TRASH && path.length === 4;
};
var removePadAttribute = function (f) { var removePadAttribute = function (f) {
Object.keys(files).forEach(function (key) { Object.keys(files).forEach(function (key) {
var hash = f.indexOf('#') !== -1 ? f.slice(f.indexOf('#') + 1) : null; var hash = f.indexOf('#') !== -1 ? f.slice(f.indexOf('#') + 1) : null;
@ -486,9 +485,9 @@ define([
var parentPath = path.slice(); var parentPath = path.slice();
var key = parentPath.pop(); var key = parentPath.pop();
var parentEl = exp.findElement(files, parentPath); var parentEl = exp.findElement(files, parentPath);
if (path.length === 4 && path[0] === TRASH) { if (isInTrashRoot(path)) {
files[TRASH][path[1]].splice(path[2], 1); files[TRASH][path[1]].splice(path[2], 1);
} else if (path[0] === UNSORTED || path[0] === TEMPLATE) { } else if (isPathInHrefArray(path)) {
parentEl.splice(key, 1); parentEl.splice(key, 1);
} else { } else {
parentEl[key] = undefined; parentEl[key] = undefined;

Loading…
Cancel
Save