refactored

This commit is contained in:
coderaiser 2013-04-08 06:42:50 -04:00
parent eb87f1c665
commit 31af952b37
3 changed files with 20 additions and 25 deletions

View file

@ -325,7 +325,7 @@ var Util, DOM, CloudFunc, $, KeyBinding, CloudCommander;
CloudCmd._changeLinks(CloudFunc.RIGHTPANEL);
/* устанавливаем переменную доступности кэша */
DOM.Cache.isAllowed();
DOM.Cache.setAllowed(true);
/* Устанавливаем кэш корневого каталога */
var lDirPath = DOM.getCurrentDirPath();
if( !DOM.Cache.get(lDirPath) )

View file

@ -326,29 +326,17 @@ var CloudCommander, Util, DOM = {}, CloudFunc;
/* функция проверяет возможно ли работать с кэшем каким-либо образом */
this.isAllowed = function(){
CacheAllowed = Util.isObject( window.localStorage );
return CacheAllowed;
var lRet = CacheAllowed && window.localStorage;
return lRet;
};
/**
* allow cache usage
*/
this.setAllowed = function(){
var lRet = this;
CacheAllowed = true;
this.setAllowed = function(pAllowd){
CacheAllowed = pAllowd;
return lRet;
};
/**
* dissalow cache usage
*/
this.UnSetAllowed = function(){
var lRet = this;
CacheAllowed = false;
return lRet;
return pAllowd;
};
/** remove element */
@ -376,7 +364,7 @@ var CloudCommander, Util, DOM = {}, CloudFunc;
/** Если доступен Cache принимаем из него данные*/
this.get = function(pName){
var lRet = this;
var lRet;
if(CacheAllowed)
lRet = localStorage.getItem(pName);

View file

@ -215,12 +215,9 @@ var Util, DOM, jQuery;
return CacheAllowed;
};
this.setAllowed = function(){
CacheAllowed = true;
};
this.UnSetAllowed = function(){
CacheAllowed = false;
this.setAllowed = function(pAllowed){
CacheAllowed = pAllowed;
return pAllowed;
};
/** remove element */
@ -255,6 +252,16 @@ var Util, DOM, jQuery;
return lRet;
},
/* get all cache from local storage */
this.getAll = function(){
var lRet = null;
if(CacheAllowed)
lRet = Data;
return lRet;
};
/** функция чистит весь кэш для всех каталогов*/
this.clear = function(){
var lRet = this;