refactor(client) ajaxLoad

This commit is contained in:
coderaiser 2014-05-13 10:57:13 -04:00
parent 3b82890b47
commit 0ae7a0701b

View file

@ -387,27 +387,17 @@ var Util, DOM, CloudFunc;
Util.log ('reading dir: "' + cleanPath + '";');
/* если доступен localStorage и
* в нём есть нужная нам директория -
* читаем данные с него и
* выходим
* если стоит поле обязательной перезагрузки -
* перезагружаемся
*/
Storage.get(cleanPath, function(json) {
var ret = options && options.refresh;
var RESTful = DOM.RESTful,
obj = Util.parseJSON(json),
isRefresh = options && options.refresh;
if (!ret && json) {
json = Util.parseJSON(json);
CloudCmd.createFileTable(json, panel);
} else
DOM.getCurrentFileContent({
url : fsPath,
dataType : 'json',
success : function(json) {
CloudCmd.createFileTable(json, panel);
Storage.set(cleanPath, json);
}
if (!isRefresh && json)
CloudCmd.createFileTable(obj, panel);
else
RESTful.read(cleanPath, function(json) {
CloudCmd.createFileTable(json, panel);
Storage.set(cleanPath, json);
});
});
};