diff --git a/css/style.css b/css/style.css index 7d305fd1..2e5f9833 100644 --- a/css/style.css +++ b/css/style.css @@ -115,12 +115,12 @@ body { transition: ease 0.1s; } -.clear-cache { +.clear-storage { margin-right: 6px; margin-left: 7px; background:url(/img/console_clear.png) -4px -4px no-repeat; } -.clear-cache:active { +.clear-storage:active { top:5px; } diff --git a/html/path.html b/html/path.html index 08ac9edf..ca997182 100644 --- a/html/path.html +++ b/html/path.html @@ -1 +1 @@ -
  • {{ path }}
  • \ No newline at end of file +
  • {{ path }}
  • \ No newline at end of file diff --git a/lib/client.js b/lib/client.js index 28cabf3d..e2e9bb03 100644 --- a/lib/client.js +++ b/lib/client.js @@ -8,7 +8,7 @@ var Util, DOM, CloudFunc, CloudCmd; 'use strict'; var Key, Config, Modules, FileTemplate, PathTemplate, Listeners, - Cache = DOM.Cache; + Storage = DOM.Storage; CloudCmd = { LIBDIR : '/lib/', @@ -262,11 +262,11 @@ var Util, DOM, CloudFunc, CloudCmd; CloudCmd.getConfig(function(config) { var localStorage = config.localStorage; /* устанавливаем переменную доступности кэша */ - Cache.setAllowed(localStorage); + Storage.setAllowed(localStorage); /* Устанавливаем кэш корневого каталога */ var lDirPath = DOM.getCurrentDirPath(); - if (!Cache.get(lDirPath)) - Cache.set(lDirPath, getJSONfromFileTable()); + if (!Storage.get(lDirPath)) + Storage.set(lDirPath, getJSONfromFileTable()); }); Util.exec(pCallBack); @@ -368,7 +368,7 @@ var Util, DOM, CloudFunc, CloudCmd; */ var lRet = pOptions.refresh; if (!lRet) { - var lJSON = Cache.get(lCleanPath); + var lJSON = Storage.get(lCleanPath); if (lJSON) { lJSON = Util.parseJSON(lJSON); @@ -399,7 +399,7 @@ var Util, DOM, CloudFunc, CloudCmd; /* если размер данных не очень бошьой * * сохраняем их в кэше */ if (lJSON_s.length < 50000 ) - Cache.set(lCleanPath, lJSON_s); + Storage.set(lCleanPath, lJSON_s); } }); }; diff --git a/lib/client/dom.js b/lib/client/dom.js index 3c2f1314..c109993a 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -570,21 +570,21 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; } } }, - CacheProto = function() { + StorageProto = function() { /* приватный переключатель возможности работы с кэшем */ - var CacheAllowed; + var StorageAllowed; /* функция проверяет возможно ли работать с кэшем каким-либо образом */ this.isAllowed = function() { - var lRet = CacheAllowed && !!window.localStorage; + var lRet = StorageAllowed && !!window.localStorage; return lRet; }; /** - * allow cache usage + * allow Storage usage */ this.setAllowed = function(pAllowd) { - CacheAllowed = pAllowd; + StorageAllowed = pAllowd; return pAllowd; }; @@ -593,7 +593,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; this.remove = function(pItem) { var lRet = this; - if (CacheAllowed) + if (StorageAllowed) localStorage.removeItem(pItem); return lRet; @@ -606,27 +606,27 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; this.set = function(pName, pData) { var lRet = this; - if (CacheAllowed && pName && pData) + if (StorageAllowed && pName && pData) localStorage.setItem(pName,pData); return lRet; }, - /** Если доступен Cache принимаем из него данные*/ + /** Если доступен Storage принимаем из него данные*/ this.get = function(pName) { var lRet; - if (CacheAllowed) + if (StorageAllowed) lRet = localStorage.getItem(pName); return lRet; }, - /* get all cache from local storage */ + /* get all Storage from local storage */ this.getAll = function() { var lRet = null; - if (CacheAllowed) + if (StorageAllowed) lRet = localStorage; return lRet; @@ -636,7 +636,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; this.clear = function() { var lRet = this; - if (CacheAllowed) + if (StorageAllowed) localStorage.clear(); return lRet; @@ -1262,7 +1262,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; DOM.getCurrentDirPath() ); - Cache.remove(lDir); + Storage.remove(lDir); }, lQuery); return lCurrent; @@ -1486,7 +1486,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; lName += lExt; } - DOM.saveDataToCache(lPath, pData); + DOM.saveDataToStorage(lPath, pData); Util.exec(pCallBack, { data: pData, @@ -1502,7 +1502,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; error : pCallBack.error }; - DOM.getDataFromCache(lPath, function(data) { + DOM.getDataFromStorage(lPath, function(data) { if (data) lFunc(data); else @@ -1519,7 +1519,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; */ this.saveCurrentData = function(pUrl, pData, pCallBack, pQuery) { RESTful.save(pUrl, pData, function() { - DOM.saveDataToCache(pUrl, pData); + DOM.saveDataToStorage(pUrl, pData); }, pQuery); }; @@ -1758,7 +1758,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * @param data * @param callback */ - this.saveDataToCache = function(name, data, callback) { + this.saveDataToStorage = function(name, data, callback) { CloudCmd.getConfig(function(config) { var hash, nameHash = name + '-hash', @@ -1768,14 +1768,14 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; if (!allowed) Util.exec(callback); else { - hash = Cache.get(name + '-hash'); + hash = Storage.get(name + '-hash'); DOM.loadCurrentHash(function(pHash) { var isContain = Util.isContainStr(hash, 'error'); if (!isContain && hash !== pHash) { - Cache.set(nameHash, pHash); - Cache.set(nameData, data); + Storage.set(nameHash, pHash); + Storage.set(nameData, data); } Util.exec(callback, hash); @@ -1791,7 +1791,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * @param data * @param callback */ - this.getDataFromCache = function(name, callback) { + this.getDataFromStorage = function(name, callback) { CloudCmd.getConfig(function(config) { var hash, allowed = config.localStorage, isDir = DOM.isCurrentIsDir(); @@ -1799,7 +1799,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; if (!allowed || isDir) Util.exec(callback); else { - hash = Cache.get(name + '-hash'); + hash = Storage.get(name + '-hash'); if (!hash) Util.exec(callback); @@ -1809,7 +1809,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; isContain = Util.isContainStr(hash, 'error'); if (!isContain && hash === pHash) - data = Cache.get(name + '-data'); + data = Storage.get(name + '-data'); Util.exec(callback, data); }); @@ -2108,7 +2108,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; Loader = Util.extendProto(LoaderProto), Images = Util.extendProto(ImagesProto), RESTful = Util.extendProto(RESTfulProto), - Cache = Util.extendProto(CacheProto); + Storage = Util.extendProto(StorageProto); DOMProto = DOMFunc.prototype = new CmdProto(); @@ -2120,7 +2120,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; Events : Events, RESTful : RESTful, Images : Images, - Cache : Cache, + Storage : Storage, Notify : Notify, Dialog : Dialog } diff --git a/lib/client/key.js b/lib/client/key.js index aabca0e9..ed799fe9 100644 --- a/lib/client/key.js +++ b/lib/client/key.js @@ -303,10 +303,10 @@ var CloudCmd, Util, DOM; case Key.D: if (lCtrl) { Util.log('+d pressed\n' + - 'clearing cache...\n' + + 'clearing Storage...\n' + 'press +q to remove all key-handlers'); - DOM.Cache.clear(); + DOM.Storage.clear(); DOM.preventDefault(); } break; @@ -316,7 +316,7 @@ var CloudCmd, Util, DOM; if (lAlt) { Util.log('+q pressed\n' + '+r reload key-handerl - removed' + - '+s clear cache key-handler - removed'+ + '+s clear Storage key-handler - removed'+ 'press +s to to set them'); Binded = false; @@ -334,7 +334,7 @@ var CloudCmd, Util, DOM; Binded = true; Util.log('+s pressed \n' + '+r reload key-handerl - set \n' + - '+s clear cache key-handler - set \n' + + '+s clear Storage key-handler - set \n' + 'press +q to remove them'); DOM.preventDefault(pEvent); diff --git a/lib/client/listeners.js b/lib/client/listeners.js index b4bede34..b153e9dd 100644 --- a/lib/client/listeners.js +++ b/lib/client/listeners.js @@ -6,7 +6,7 @@ var Util, DOM, CloudCmd; CloudCmd.Listeners = new ListenersProto(CloudCmd, Util, DOM); function ListenersProto(CloudCmd, Util, DOM){ - var Cache = DOM.Cache, + var Storage = DOM.Storage, Events = DOM.Events, getConfig = CloudCmd.getConfig; @@ -29,7 +29,7 @@ var Util, DOM, CloudCmd; }; this.init = function () { - appCache(); + appStorage(); contextMenu(); dragndrop(); unload(); @@ -80,8 +80,8 @@ var Util, DOM, CloudCmd; */ this.changeLinks = function(pPanelID) { /* назначаем кнопку очистить кэш и показываем её */ - var lClearcache = DOM.getById('clear-cache'); - Events.addClick(Cache.clear, lClearcache); + var lClearStorage = DOM.getById('clear-storage'); + Events.addClick(Storage.clear, lClearStorage); /* меняем ссылки на ajax-запросы */ var lPanel = DOM.getById(pPanelID), @@ -191,19 +191,19 @@ var Util, DOM, CloudCmd; } }; - function appCache() { + function appStorage() { getConfig(function(config) { - var isAppCache = config.appCache, - appCache = window.applicationCache; + var isAppStorage = config.appStorage, + appStorage = window.applicationStorage; - if (isAppCache && appCache) + if (isAppStorage && appStorage) Events.add('updateready', function() { var ret = confirm('An update is available. Reload now?'); if (ret) location.reload(); - }, appCache); + }, appStorage); }); } diff --git a/lib/client/polyfill.js b/lib/client/polyfill.js index 172a7aa3..8e8b54a6 100644 --- a/lib/client/polyfill.js +++ b/lib/client/polyfill.js @@ -214,25 +214,25 @@ var Util, DOM, jQuery; } if(!window.localStorage){ - var Cache = function(){ + var Storage = function(){ /* приватный переключатель возможности работы с кэшем */ - var CacheAllowed, + var StorageAllowed, Data = {}; /* функция проверяет возможно ли работать с кэшем каким-либо образом */ this.isAllowed = function(){ - return CacheAllowed; + return StorageAllowed; }; this.setAllowed = function(pAllowed){ - CacheAllowed = pAllowed; + StorageAllowed = pAllowed; return pAllowed; }; /** remove element */ this.remove = function(pItem){ var lRet = this; - if(CacheAllowed) + if(StorageAllowed) delete Data[pItem]; return lRet; @@ -245,27 +245,27 @@ var Util, DOM, jQuery; this.set = function(pName, pData){ var lRet = this; - if(CacheAllowed && pName && pData) + if(StorageAllowed && pName && pData) Data[pName] = pData; return lRet; }, - /** Если доступен Cache принимаем из него данные*/ + /** Если доступен Storage принимаем из него данные*/ this.get = function(pName){ var lRet = false; - if(CacheAllowed) + if(StorageAllowed) lRet = Data[pName]; return lRet; }, - /* get all cache from local storage */ + /* get all Storage from local storage */ this.getAll = function(){ var lRet = null; - if(CacheAllowed) + if(StorageAllowed) lRet = Data; return lRet; @@ -275,14 +275,14 @@ var Util, DOM, jQuery; this.clear = function(){ var lRet = this; - if(CacheAllowed) + if(StorageAllowed) Data = {}; return lRet; }; }; - DOM.Cache = new Cache(); + DOM.Storage = new Storage(); } })(Util, DOM, jQuery); \ No newline at end of file diff --git a/lib/client/storage/_github.js b/lib/client/storage/_github.js index 9ee2b8e4..06258d87 100644 --- a/lib/client/storage/_github.js +++ b/lib/client/storage/_github.js @@ -4,7 +4,7 @@ var CloudCmd, Util, DOM, $, Github, cb; (function(CloudCmd, Util, DOM){ 'use strict'; - var Cache = DOM.Cache, + var Storage = DOM.Storage, GithubLocal, User, GitHubStore = {}; @@ -37,7 +37,7 @@ var CloudCmd, Util, DOM, $, Github, cb; GitHubStore.autorize = function(pCallBack, pCode){ - var lToken = Cache.get('token'); + var lToken = Storage.get('token'); if(lToken){ GitHubStore.Login(lToken); Util.exec(pCallBack); @@ -55,7 +55,7 @@ var CloudCmd, Util, DOM, $, Github, cb; lToken = pData.token; GitHubStore.Login(lToken); - Cache.set('token', lToken); + Storage.set('token', lToken); Util.exec(pCallBack); } else @@ -77,7 +77,7 @@ var CloudCmd, Util, DOM, $, Github, cb; Util.log('Hello ' + lName + ' :)!'); } else - DOM.Cache.remove('token'); + DOM.Storage.remove('token'); }); Util.exec(pCallBack);