From de2c8f6b97ed7faa9b626edd36254aa6e5072607 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Wed, 22 Jul 2015 03:00:07 -0400 Subject: [PATCH] feature(dom) getCurrentData: show alert when ".." --- lib/client/dom.js | 10 ++++++---- lib/client/edit.js | 4 +++- lib/client/view.js | 1 - 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/client/dom.js b/lib/client/dom.js index eaabc6fd..8e903f32 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -735,11 +735,12 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; callback(error, data); }; - if (Info.name === '..') - callback('No files selected!'); - else if (isDir) + if (Info.name === '..') { + Dialog.alert.noFiles(); + callback(Error('No files selected!')); + } else if (isDir) { RESTful.read(path, func); - else + } else { DOM.checkStorageHash(path, function(error, equal, hashNew) { Util.exec.if(!error && equal, function() { DOM.getDataFromStorage(path, callback); @@ -748,6 +749,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; RESTful.read(path, func); }); }); + } }; diff --git a/lib/client/edit.js b/lib/client/edit.js index 45e0fbd6..e5ae9fc5 100644 --- a/lib/client/edit.js +++ b/lib/client/edit.js @@ -81,7 +81,9 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO, Format, edward; if (isDir) name += '.json'; - if (!error) { + if (error) { + Images.hide(); + } else { edward.setValueFirst(path, data); setMsgChanged(name); diff --git a/lib/client/view.js b/lib/client/view.js index d0543e8f..110e22f1 100644 --- a/lib/client/view.js +++ b/lib/client/view.js @@ -132,7 +132,6 @@ var CloudCmd, Util, DOM, CloudFunc, $; var element; if (error) { Images.hide(); - Dialog.alert(error); } else { element = document.createTextNode(data); /* add margin only for view text documents */