mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactor(client) ajaxLoad
This commit is contained in:
parent
3b82890b47
commit
0ae7a0701b
1 changed files with 9 additions and 19 deletions
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue