fix(client) disable localStorage

This commit is contained in:
coderaiser 2014-07-16 02:54:17 -04:00
parent c458f926cb
commit 5cd04d0191
2 changed files with 28 additions and 22 deletions

View file

@ -236,15 +236,17 @@ var Util, DOM, CloudFunc;
}
function baseInit(callback) {
var files = DOM.getFiles(),
LEFT = CloudFunc.PANEL_LEFT,
RIGHT = CloudFunc.PANEL_RIGHT;
var dirPath = '',
files = DOM.getFiles(),
LEFT = CloudFunc.PANEL_LEFT,
RIGHT = CloudFunc.PANEL_RIGHT;
/* выделяем строку с первым файлом */
if (files)
DOM.setCurrentFile(files[0]);
Listeners = CloudCmd.Listeners;
dirPath = DOM.getCurrentDirPath(),
Listeners = CloudCmd.Listeners;
Listeners.init();
/* загружаем Google Analytics */
Listeners.analytics();
@ -254,22 +256,14 @@ var Util, DOM, CloudFunc;
Listeners.initKeysPanel();
Files.get('config', function(error, config) {
var localStorage = config.localStorage,
dirPath = DOM.getCurrentDirPath();
/* устанавливаем переменную доступности кэша */
Storage.setAllowed(localStorage);
/* Устанавливаем кэш корневого каталога */
dirPath = CloudFunc.rmLastSlash(dirPath) || '/';
Storage.get(dirPath, function(error, data) {
if (!data) {
data = getJSONfromFileTable();
Storage.set(dirPath, data);
}
});
/* Устанавливаем кэш корневого каталога */
dirPath = CloudFunc.rmLastSlash(dirPath) || '/';
Storage.get(dirPath, function(error, data) {
if (!data) {
data = getJSONfromFileTable();
Storage.set(dirPath, data);
}
});
callback();

View file

@ -11,6 +11,7 @@ var Util, DOM, Promise;
function FilesProto(Util, DOM) {
var Promises = {},
Storage = DOM.Storage,
Files = this,
FILES_JSON = 'config|modules|ext',
FILES_HTML = 'file|path|link|pathLink|media',
@ -59,6 +60,9 @@ var Util, DOM, Promise;
callback(null);
}
if (name === 'config')
setConfig(data);
return Files;
};
@ -138,11 +142,19 @@ var Util, DOM, Promise;
});
Promises.config.then(function(data) {
if (!Data.config)
if (!Data.config) {
Data.config = data;
Storage.setAllowed(data.localStorage);
}
callback(null, data);
});
}
function setConfig(config) {
var isStorage = config.localStorage;
Storage.setAllowed(isStorage);
}
}
})(Util, DOM);