From d4ee6dad5b51fea9e67c89010daed499cefda7d6 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Fri, 4 Apr 2014 06:39:35 -0400 Subject: [PATCH] chore(dom) rm unused vars --- lib/client/dom.js | 48 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/lib/client/dom.js b/lib/client/dom.js index 5429605f..8336d273 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -459,14 +459,14 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * @param pEvent */ this.dispatch = function(pEvent, pElement) { - var lRet, lEvent; + var event; if (Util.isString(pEvent)) - lEvent = Events.create(pEvent); + event = Events.create(pEvent); else - lEvent = pEvent; + event = pEvent; - return (pElement || window).dispatchEvent(lEvent); + return (pElement || window).dispatchEvent(event); }; /** @@ -992,12 +992,12 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * @currentFile */ this.getCurrentData = function(callback, currentFile) { - var lHash, + var hash, lCurrentFile = currentFile ? currentFile : Cmd.getCurrentFile(), path = DOM.getCurrentPath(lCurrentFile), isDir = DOM.isCurrentIsDir(lCurrentFile), - func = function(data, hash) { + func = function(data) { var length, ONE_MEGABYTE = 1024 * 1024 * 1024; @@ -1005,8 +1005,8 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; data = Util.stringifyJSON(data); length = data.length; - if (lHash && length < ONE_MEGABYTE) - DOM.saveDataToStorage(path, data, lHash); + if (hash && length < ONE_MEGABYTE) + DOM.saveDataToStorage(path, data, hash); Util.exec(callback, data); }; @@ -1014,11 +1014,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; if (isDir) DOM.getCurrentFileContent(func, lCurrentFile); else - DOM.checkStorageHash(path, function(error, equal, hash) { + DOM.checkStorageHash(path, function(error, equal, hashNew) { Util.ifExec(!error && equal, function() { DOM.getDataFromStorage(path, callback); }, function() { - lHash = hash; + hash = hashNew; DOM.getCurrentFileContent(func, lCurrentFile); }); }); @@ -1118,16 +1118,14 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * @param currentFile */ this.toggleSelectedFile = function(currentFile) { - var lCurrent = currentFile || this.getCurrentFile(), - lRet = this.toggleClass(currentFile, SELECTED_FILE); + var current = currentFile || this.getCurrentFile(), + ret = this.toggleClass(current, SELECTED_FILE); - return this; + return ret; }; - this.toggleAllSelectedFiles = function(currentFile) { + this.toggleAllSelectedFiles = function() { var i, n, - isStr = Util.isString(currentFile), - lCurrent = !isStr && currentFile || Cmd.getCurrentFile(), panel = DOM.getPanel(), files = DOM.getFiles(panel), name = DOM.getCurrentName(files[0]); @@ -1147,8 +1145,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; function selectByPattern(msg, files) { var n, allMsg = 'Specify file type for ' + msg + ' selection', - i = 0, - arr = [], + i = 0, type, matches = 0, name, @@ -1383,11 +1380,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; */ this.checkStorageHash = function(name, callback) { DOM.loadCurrentHash(function(loadHash) { - var Storage = DOM.Storage; + var Storage = DOM.Storage, + nameHash = name + '-hash'; - Storage.get(name + '-hash', function(storeHash) { + Storage.get(nameHash, function(storeHash) { var equal, error, - nameHash = name + '-hash', isContain = Util.isContainStr(loadHash, 'error'); if (isContain) @@ -1442,8 +1439,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; */ this.getDataFromStorage = function(name, callback) { CloudCmd.getConfig(function(config) { - var data, hash, - Storage = DOM.Storage, + var Storage = DOM.Storage, nameHash = name + '-hash', nameData = name + '-data', allowed = config.localStorage, @@ -1617,7 +1613,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; * @Selected */ this.deleteSelected = function(selected) { - var i, n, last, current; + var i, n, current; if (!selected) selected = this.getSelectedFiles(); @@ -1641,7 +1637,6 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; */ this.renameCurrent = function(current) { var from, to, dirPath, cmp, files, - path = CurrentInfo.dirPath, RESTful = DOM.RESTful; if (!Cmd.isCurrentFile(current)) @@ -1784,8 +1779,9 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog; this.getType = function(name, callback) { CloudCmd.getExt(function(extensions) { - var str, index, + var index, ext = Util.getExtension(name); + ext = extensions[ext]; if (ext) {