From 5bdc7a6f8864d306f87f3d2071158d248fff0e14 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Thu, 29 Aug 2013 13:34:24 +0000 Subject: [PATCH] chore(dom) "){" -> ") {" --- lib/client/dom.js | 330 +++++++++++++++++++++++----------------------- 1 file changed, 165 insertions(+), 165 deletions(-) diff --git a/lib/client/dom.js b/lib/client/dom.js index 450353cc..fe9a5f96 100644 --- a/lib/client/dom.js +++ b/lib/client/dom.js @@ -1,14 +1,14 @@ var CloudCmd, Util, DOM, CloudFunc; -(function(Util){ +(function(Util) { 'use strict'; - var DOMFunc = function(){}, + var DOMFunc = function() {}, DOMProto, - ImagesProto = function(){ - var LImagesProto = function (){ - function getImage(pName){ + ImagesProto = function() { + var LImagesProto = function() { + function getImage(pName) { var lId = pName + '-image', lE = DOM.getById(lId); @@ -24,12 +24,12 @@ var CloudCmd, Util, DOM, CloudFunc; } /* Функция создаёт картинку загрузки */ - this.loading = function(){ + this.loading = function() { return getImage('loading'); }; /* Функция создаёт картинку ошибки загрузки */ - this.error = function(){ + this.error = function() { return getImage('error'); }; }, @@ -38,7 +38,7 @@ var CloudCmd, Util, DOM, CloudFunc; * Function shows loading spinner * pPosition = {top: true}; */ - this.showLoad = function(pPosition){ + this.showLoad = function(pPosition) { var lRet_b, lLoadingImage = lImages.loading(), lErrorImage = lImages.error(); @@ -67,14 +67,14 @@ var CloudCmd, Util, DOM, CloudFunc; /** * hide load image */ - this.hideLoad = function(){ + this.hideLoad = function() { DOM.hide( lImages.loading() ); }; /** * show error image (usualy after error on ajax request) */ - this.showError = function(jqXHR, textStatus, errorThrown){ + this.showError = function(jqXHR, textStatus, errorThrown) { var lLoadingImage = lImages.loading(), lErrorImage = lImages.error(), lResponse = jqXHR.responseText, @@ -106,8 +106,8 @@ var CloudCmd, Util, DOM, CloudFunc; }; }, - RESTfullProto = function(){ - this.delete = function(pUrl, pData, pCallBack, pQuery){ + RESTfullProto = function() { + this.delete = function(pUrl, pData, pCallBack, pQuery) { sendRequest({ method : 'DELETE', url : CloudFunc.FS + pUrl + (pQuery || ''), @@ -117,7 +117,7 @@ var CloudCmd, Util, DOM, CloudFunc; }); }; - this.save = function(pUrl, pData, pCallBack, pQuery){ + this.save = function(pUrl, pData, pCallBack, pQuery) { sendRequest({ method : 'PUT', url : CloudFunc.FS + pUrl + (pQuery || ''), @@ -127,7 +127,7 @@ var CloudCmd, Util, DOM, CloudFunc; }); }; - this.read = function(pUrl, pCallBack, pQuery){ + this.read = function(pUrl, pCallBack, pQuery) { sendRequest({ method : 'GET', url : CloudFunc.FS + pUrl + (pQuery || ''), @@ -135,7 +135,7 @@ var CloudCmd, Util, DOM, CloudFunc; }); }; - this.cp = function(pData, pCallBack){ + this.cp = function(pData, pCallBack) { sendRequest({ method : 'PUT', url : '/cp', @@ -144,7 +144,7 @@ var CloudCmd, Util, DOM, CloudFunc; }); }; - this.zip = function(pData, pCallBack){ + this.zip = function(pData, pCallBack) { sendRequest({ method : 'PUT', url : '/zip', @@ -153,7 +153,7 @@ var CloudCmd, Util, DOM, CloudFunc; }); }; - this.mv = function(pData, pCallBack){ + this.mv = function(pData, pCallBack) { sendRequest({ method : 'PUT', url : '/mv', @@ -162,13 +162,13 @@ var CloudCmd, Util, DOM, CloudFunc; }); }; - function sendRequest(pParams){ + function sendRequest(pParams) { var lRet = Util.checkObjTrue(pParams, ['method']); - if (lRet){ + if (lRet) { var p = pParams; Images.showLoad( p.imgPosition ); - CloudCmd.getConfig(function(pConfig){ + CloudCmd.getConfig(function(pConfig) { var lData; if ( Util.isString(p.url) ) @@ -198,17 +198,17 @@ var CloudCmd, Util, DOM, CloudFunc; } }, - DOMTreeProto = function(){ + DOMTreeProto = function() { /** * add class to element * * @param pElement * @param pClass */ - this.addClass = function(pElement, pClass){ + this.addClass = function(pElement, pClass) { var lRet; - if (pElement){ + if (pElement) { var lClassList = pElement.classList; lRet = !this.isContainClass(pElement, pClass); @@ -225,7 +225,7 @@ var CloudCmd, Util, DOM, CloudFunc; * @param pElement * @param pClass */ - this.isContainClass = function(pElement, pClass){ + this.isContainClass = function(pElement, pClass) { var lRet, lClassList = pElement && pElement.classList; @@ -240,7 +240,7 @@ var CloudCmd, Util, DOM, CloudFunc; * @param pTag - className * @param pElement - element */ - this.getByTag = function(pTag, pElement){ + this.getByTag = function(pTag, pElement) { return (pElement || document).getElementsByTagName(pTag); }; @@ -249,7 +249,7 @@ var CloudCmd, Util, DOM, CloudFunc; * @param Id - className * @param pElement - element */ - this.getById = function(pId, pElement){ + this.getById = function(pId, pElement) { return (pElement || document).getElementById(pId); }; @@ -258,7 +258,7 @@ var CloudCmd, Util, DOM, CloudFunc; * @param pClass - className * @param pElement - element */ - this.getByClass = function(pClass, pElement){ + this.getByClass = function(pClass, pElement) { return (pElement || document).getElementsByClassName(pClass); }; @@ -267,16 +267,16 @@ var CloudCmd, Util, DOM, CloudFunc; * * @param pElement */ - this.hide = function(pElement){ + this.hide = function(pElement) { return this.addClass(pElement, 'hidden'); }; - this.show = function(pElement){ + this.show = function(pElement) { this.removeClass(pElement, 'hidden'); }; }, - EventsProto = function(){ + EventsProto = function() { var Events = this, ADD = true, REMOVE = false; @@ -289,7 +289,7 @@ var CloudCmd, Util, DOM, CloudFunc; * @param pUseCapture * @param pElement {document by default} */ - this.add = function(pType, pListener, pElement, pUseCapture){ + this.add = function(pType, pListener, pElement, pUseCapture) { return process( ADD, pType, @@ -307,9 +307,9 @@ var CloudCmd, Util, DOM, CloudFunc; * @param pUseCapture * @param pElement {document by default} */ - this.addOneTime = function(pType, pListener, pElement, pUseCapture){ + this.addOneTime = function(pType, pListener, pElement, pUseCapture) { var lRet = this, - lOneTime = function (pEvent){ + lOneTime = function (pEvent) { lRet.remove(pType, lOneTime, pElement, pUseCapture); pListener(pEvent); }; @@ -327,7 +327,7 @@ var CloudCmd, Util, DOM, CloudFunc; * @param pUseCapture * @param pElement {document by default} */ - this.remove = function(pType, pListener, pElement, pUseCapture){ + this.remove = function(pType, pListener, pElement, pUseCapture) { return process( REMOVE, pType, @@ -344,7 +344,7 @@ var CloudCmd, Util, DOM, CloudFunc; * @param pListener * @param pUseCapture */ - this.addKey = function(pListener, pElement, pUseCapture){ + this.addKey = function(pListener, pElement, pUseCapture) { return this.add('keydown', pListener, pElement, pUseCapture); }; @@ -354,11 +354,11 @@ var CloudCmd, Util, DOM, CloudFunc; * @param pListener * @param pUseCapture */ - this.addClick = function(pListener, pElement, pUseCapture){ + this.addClick = function(pListener, pElement, pUseCapture) { return this.add('click', pListener, pElement, pUseCapture); }; - this.addContextMenu = function(pListener, pElement, pUseCapture){ + this.addContextMenu = function(pListener, pElement, pUseCapture) { return this.add('contextmenu', pListener, pElement, pUseCapture); }; @@ -368,7 +368,7 @@ var CloudCmd, Util, DOM, CloudFunc; * @param pListener * @param pUseCapture */ - this.addError = function(pListener, pElement, pUseCapture){ + this.addError = function(pListener, pElement, pUseCapture) { return this.add('error', pListener, pElement, pUseCapture); }; @@ -378,7 +378,7 @@ var CloudCmd, Util, DOM, CloudFunc; * @param pEventName * @param pKeyCode - not necessarily */ - this.create = function(pEventName, pKeyCode){ + this.create = function(pEventName, pKeyCode) { var lEvent = document.createEvent('Event'); lEvent.initEvent(pEventName, true, true); @@ -386,7 +386,7 @@ var CloudCmd, Util, DOM, CloudFunc; if (pKeyCode) lEvent.keyCode = pKeyCode; - lEvent.isDefaultPrevented = function(){ + lEvent.isDefaultPrevented = function() { return this.defaultPrevented; }; @@ -399,7 +399,7 @@ var CloudCmd, Util, DOM, CloudFunc; * * @param pKeyCode */ - this.createKey = function(pKeyCode){ + this.createKey = function(pKeyCode) { return this.create('keydown', pKeyCode); }; @@ -408,7 +408,7 @@ var CloudCmd, Util, DOM, CloudFunc; * * @param pKeyCode */ - this.createClick = function(){ + this.createClick = function() { return this.create('click'); }; @@ -417,7 +417,7 @@ var CloudCmd, Util, DOM, CloudFunc; * * @param pKeyCode */ - this.createDblClick = function(){ + this.createDblClick = function() { return this.create('dblclick'); }; @@ -426,7 +426,7 @@ var CloudCmd, Util, DOM, CloudFunc; * * @param pEvent */ - this.dispatch = function(pEvent, pElement){ + this.dispatch = function(pEvent, pElement) { var lRet, lEvent; if (Util.isString(pEvent)) @@ -443,7 +443,7 @@ var CloudCmd, Util, DOM, CloudFunc; * @param pKeyCode * @param pElement */ - this.dispatchKey = function(pKeyCode, pElement){ + this.dispatchKey = function(pKeyCode, pElement) { var lEvent = this.createKey(pKeyCode), lRet = this.dispatch(lEvent, pElement); @@ -455,7 +455,7 @@ var CloudCmd, Util, DOM, CloudFunc; * * @param pElement */ - this.dispatchClick = function(pElement){ + this.dispatchClick = function(pElement) { var lEvent = this.createClick(), lRet = this.dispatch(lEvent, pElement); @@ -467,14 +467,14 @@ var CloudCmd, Util, DOM, CloudFunc; * * @param pElement */ - this.dispatchDblClick = function(pElement){ + this.dispatchDblClick = function(pElement) { var lEvent = this.createDblClick(), lRet = this.dispatch(lEvent, pElement); return lRet; }; - function process(pAdd, pType, pListener, pElement, pUseCapture){ + function process(pAdd, pType, pListener, pElement, pUseCapture) { var i, n, lElement = (pElement || window), @@ -490,14 +490,14 @@ var CloudCmd, Util, DOM, CloudFunc; lEventProcess = lEventProcess.bind(lElement); - if (lRet){ + if (lRet) { if (Util.isString(pType) ) lEventProcess( pType, pListener, pUseCapture ); - else if (Util.isArray(pType)) + else if (Util.isArray(pType)) for (i = 0, n = pType.length; i < n; i++) lProcess( pType[i], @@ -505,7 +505,7 @@ var CloudCmd, Util, DOM, CloudFunc; pElement, pUseCapture ); - else if (Util.isObject(pType)){ + else if (Util.isObject(pType)) { if (pListener) pElement = pListener; @@ -520,12 +520,12 @@ var CloudCmd, Util, DOM, CloudFunc; } } }, - CacheProto = function(){ + CacheProto = function() { /* приватный переключатель возможности работы с кэшем */ var CacheAllowed; /* функция проверяет возможно ли работать с кэшем каким-либо образом */ - this.isAllowed = function(){ + this.isAllowed = function() { var lRet = CacheAllowed && window.localStorage; return lRet; }; @@ -533,14 +533,14 @@ var CloudCmd, Util, DOM, CloudFunc; /** * allow cache usage */ - this.setAllowed = function(pAllowd){ + this.setAllowed = function(pAllowd) { CacheAllowed = pAllowd; return pAllowd; }; /** remove element */ - this.remove = function(pItem){ + this.remove = function(pItem) { var lRet = this; if (CacheAllowed) @@ -553,7 +553,7 @@ var CloudCmd, Util, DOM, CloudFunc; * в нём есть нужная нам директория - * записываем данные в него */ - this.set = function(pName, pData){ + this.set = function(pName, pData) { var lRet = this; if (CacheAllowed && pName && pData) @@ -563,7 +563,7 @@ var CloudCmd, Util, DOM, CloudFunc; }, /** Если доступен Cache принимаем из него данные*/ - this.get = function(pName){ + this.get = function(pName) { var lRet; if (CacheAllowed) @@ -573,7 +573,7 @@ var CloudCmd, Util, DOM, CloudFunc; }, /* get all cache from local storage */ - this.getAll = function(){ + this.getAll = function() { var lRet = null; if (CacheAllowed) @@ -583,7 +583,7 @@ var CloudCmd, Util, DOM, CloudFunc; }; /** функция чистит весь кэш для всех каталогов*/ - this.clear = function(){ + this.clear = function() { var lRet = this; if (CacheAllowed) @@ -593,7 +593,7 @@ var CloudCmd, Util, DOM, CloudFunc; }; }, - LoaderProto = function(){ + LoaderProto = function() { var XMLHTTP; /** @@ -602,10 +602,10 @@ var CloudCmd, Util, DOM, CloudFunc; * * Example: http://domain.com/1.js -> 1_js */ - this.getIdBySrc = function(pSrc){ + this.getIdBySrc = function(pSrc) { var lRet = Util.isString(pSrc); - if (lRet){ + if (lRet) { var lNum = pSrc.lastIndexOf('/') + 1, lSub = pSrc.substr(pSrc, lNum), lID = Util.removeStrOneTime(pSrc, lSub ); @@ -625,9 +625,9 @@ var CloudCmd, Util, DOM, CloudFunc; * * @param pParams */ - this.ajax = function(pParams){ + this.ajax = function(pParams) { var lRet = Util.checkObjTrue(pParams, ['url', 'success']); - if (lRet){ + if (lRet) { var p = pParams, lType = p.type || p.method || 'GET'; @@ -637,12 +637,12 @@ var CloudCmd, Util, DOM, CloudFunc; XMLHTTP.open(lType, pParams.url, true); XMLHTTP.send(p.data); - XMLHTTP.onreadystatechange = function(pEvent){ - if (XMLHTTP.readyState === 4 /* Complete */){ + XMLHTTP.onreadystatechange = function(pEvent) { + if (XMLHTTP.readyState === 4 /* Complete */) { var lJqXHR = pEvent.target, lType = XMLHTTP.getResponseHeader('content-type'); - if (XMLHTTP.status === 200 /* OK */){ + if (XMLHTTP.status === 200 /* OK */) { var lData = lJqXHR.response; /* If it's json - parse it as json */ @@ -675,23 +675,23 @@ var CloudCmd, Util, DOM, CloudFunc; * @param pParams_a * @param pFunc - onload function */ - this.anyLoadOnLoad = function(pParams_a, pFunc){ + this.anyLoadOnLoad = function(pParams_a, pFunc) { var lRet = this; if ( Util.isArray(pParams_a) ) { var lParam = pParams_a.pop(), - lFunc = function(){ + lFunc = function() { Loader.anyLoadOnLoad(pParams_a, pFunc); }; if ( Util.isString(lParam) ) lParam = { src : lParam }; - else if ( Util.isArray(lParam) ){ + else if ( Util.isArray(lParam) ) { this.anyLoadInParallel(lParam, lFunc); } - if (lParam && !lParam.func){ + if (lParam && !lParam.func) { lParam.func = lFunc; this.anyload(lParam); @@ -711,25 +711,25 @@ var CloudCmd, Util, DOM, CloudFunc; * @param pParams_a * @param pFunc - onload function */ - this.anyLoadInParallel = function(pParams_a, pFunc){ + this.anyLoadInParallel = function(pParams_a, pFunc) { var lRet = this, lDone = [], - lDoneFunc = function (pCallBack){ + lDoneFunc = function (pCallBack) { Util.exec(pCallBack); if ( !lDone.pop() ) Util.exec(pFunc); }; - if ( !Util.isArray(pParams_a) ){ + if ( !Util.isArray(pParams_a) ) { pParams_a = [pParams_a]; } - for(var i = 0, n = pParams_a.length; i < n; i++){ + for(var i = 0, n = pParams_a.length; i < n; i++) { var lParam = pParams_a.pop(); - if (lParam){ + if (lParam) { lDone.push(i); if (Util.isString(lParam) ) @@ -753,7 +753,7 @@ var CloudCmd, Util, DOM, CloudFunc; * src', - путь к файлу * func, - обьект, содержаий одну из функций * или сразу две onload и onerror - * {onload: function(){}, onerror: function();} + * {onload: function() {}, onerror: function();} * style, * id, * element, @@ -763,7 +763,7 @@ var CloudCmd, Util, DOM, CloudFunc; * not_append - false by default * } */ - this.anyload = function(pParams_o){ + this.anyload = function(pParams_o) { var i, n, lElements_a; if ( !pParams_o ) return; @@ -772,7 +772,7 @@ var CloudCmd, Util, DOM, CloudFunc; * processing every of params * and quit */ - if ( Util.isArray(pParams_o) ){ + if ( Util.isArray(pParams_o) ) { lElements_a = []; for(i = 0, n = pParams_o.length; i < n ; i++) lElements_a[i] = this.anyload(pParams_o[i]); @@ -793,7 +793,7 @@ var CloudCmd, Util, DOM, CloudFunc; lStyle = pParams_o.style, lNotAppend = pParams_o.not_append; - if ( Util.isObject(lFunc) ){ + if ( Util.isObject(lFunc) ) { lOnError = lFunc.onerror; lFunc = lFunc.onload; } @@ -804,12 +804,12 @@ var CloudCmd, Util, DOM, CloudFunc; var lElement = DOMTree.getById(lID); /* если скрипт еще не загружен */ - if (!lElement){ - if (!lName && lSrc){ + if (!lElement) { + if (!lName && lSrc) { var lDot = lSrc.lastIndexOf('.'), lExt = lSrc.substr(lDot); - switch(lExt){ + switch(lExt) { case '.js': lName = 'script'; break; @@ -831,7 +831,7 @@ var CloudCmd, Util, DOM, CloudFunc; if(lSrc) { /* if work with css use href */ - if (lName === 'link'){ + if (lName === 'link') { lElement.href = lSrc; lElement.rel = 'stylesheet'; }else @@ -843,14 +843,14 @@ var CloudCmd, Util, DOM, CloudFunc; * * if object - then onload and onerror */ - var lLoad = function(pEvent){ + var lLoad = function(pEvent) { Events.remove('load', lLoad, lElement); Events.remove('error', lError, lElement); Util.exec(lFunc, pEvent); }, - lError = function(){ + lError = function() { lParent.removeChild(lElement); Images.showError({ @@ -898,7 +898,7 @@ var CloudCmd, Util, DOM, CloudFunc; * @param pSrc * @param pFunc */ - this.jsload = function(pSrc, pFunc){ + this.jsload = function(pSrc, pFunc) { var lRet = this.anyload({ name : 'script', src : pSrc, @@ -911,8 +911,8 @@ var CloudCmd, Util, DOM, CloudFunc; /** * returns jsload functions */ - this.retJSLoad = function(pSrc, pFunc){ - var lRet = function(){ + this.retJSLoad = function(pSrc, pFunc) { + var lRet = function() { return this.jsload(pSrc, pFunc); }; @@ -926,7 +926,7 @@ var CloudCmd, Util, DOM, CloudFunc; * образом: {src: ' ',func: '', id: '', element: '', inner: ''} * все параметры опциональны */ - this.cssSet = function(pParams_o){ + this.cssSet = function(pParams_o) { pParams_o.name = 'style'; pParams_o.parent = pParams_o.parent || document.head; @@ -939,9 +939,9 @@ var CloudCmd, Util, DOM, CloudFunc; * образом: {src: ' ',func: '', id: '', element: '', inner: ''} * все параметры опциональны */ - this.cssLoad = function(pParams_o){ - if ( Util.isArray(pParams_o) ){ - for(var i = 0, n = pParams_o.length; i < n; i++){ + this.cssLoad = function(pParams_o) { + if ( Util.isArray(pParams_o) ) { + for(var i = 0, n = pParams_o.length; i < n; i++) { pParams_o[i].name = 'link'; pParams_o[i].parent = pParams_o.parent || document.head; } @@ -962,7 +962,7 @@ var CloudCmd, Util, DOM, CloudFunc; * load jquery from google cdn or local copy * @param pParams */ - this.jquery = function(pParams){ + this.jquery = function(pParams) { if (!pParams) pParams = {}; /* загружаем jquery: */ @@ -973,7 +973,7 @@ var CloudCmd, Util, DOM, CloudFunc; }; }, - CmdProto = function(){ + CmdProto = function() { var Cmd = this, CURRENT_FILE = 'current-file', SELECTED_FILE = 'selected-file', @@ -984,7 +984,7 @@ var CloudCmd, Util, DOM, CloudFunc; * * @pCurrentFile */ - function unsetCurrentFile(pCurrentFile){ + function unsetCurrentFile(pCurrentFile) { var lRet = DOM.isCurrentFile(pCurrentFile); if (lRet) @@ -998,11 +998,11 @@ var CloudCmd, Util, DOM, CloudFunc; * load jquery from google cdn or local copy * @param pCallBack */ - this.jqueryLoad = function(pCallBack){ + this.jqueryLoad = function(pCallBack) { Loader.jquery({ onload: pCallBack, - onerror: function(){ + onerror: function() { Loader.jsload('/lib/client/jquery.js'); /* if could not load jquery from google server @@ -1024,7 +1024,7 @@ var CloudCmd, Util, DOM, CloudFunc; * load socket.io * @param pCallBack */ - this.socketLoad = function(pCallBack){ + this.socketLoad = function(pCallBack) { Loader.jsload('/lib/client/socket.js', pCallBack); }; @@ -1032,7 +1032,7 @@ var CloudCmd, Util, DOM, CloudFunc; * create new folder * */ - this.promptNewDir = function(){ + this.promptNewDir = function() { Cmd.promptNewFile('directory', '?dir'); }; @@ -1042,7 +1042,7 @@ var CloudCmd, Util, DOM, CloudFunc; * @pTypeName * @pType */ - this.promptNewFile = function(pTypeName, pType){ + this.promptNewFile = function(pTypeName, pType) { var lName = Cmd.getCurrentName(), lDir = Cmd.getCurrentDirPath(), lMsg = 'New ' + pTypeName || 'File', @@ -1061,7 +1061,7 @@ var CloudCmd, Util, DOM, CloudFunc; * zip file * */ - this.zipFile = function(){ + this.zipFile = function() { var lName = Cmd.getCurrentName(), lDir = Cmd.getCurrentDirPath(), lPath = lDir + lName, @@ -1079,7 +1079,7 @@ var CloudCmd, Util, DOM, CloudFunc; * * @pCurrentFile */ - this.promptDeleteSelected = function(pCurrentFile){ + this.promptDeleteSelected = function(pCurrentFile) { var lRet, lCurrent, lQuery, lMsg, lName = '', @@ -1092,7 +1092,7 @@ var CloudCmd, Util, DOM, CloudFunc; if ( !Cmd.isCurrentFile(pCurrentFile) ) pCurrentFile = null; - if (n > 1){ + if (n > 1) { for (i = 0; i < 5 && i < n; i++) lName += '\n' + lSelected[i]; @@ -1112,7 +1112,7 @@ var CloudCmd, Util, DOM, CloudFunc; lIsDir = Cmd.isCurrentIsDir(lCurrent); - if (lIsDir){ + if (lIsDir) { lQuery = '?dir'; lType ='directory'; } @@ -1141,7 +1141,7 @@ var CloudCmd, Util, DOM, CloudFunc; } if (lCurrent || lSelected) - RESTfull.delete(lUrl, lSelected, function(){ + RESTfull.delete(lUrl, lSelected, function() { if (n > 1) DOM.deleteSelected(lFiles); else @@ -1164,7 +1164,7 @@ var CloudCmd, Util, DOM, CloudFunc; /** * get current direcotory name */ - this.getCurrentDirName = function(){ + this.getCurrentDirName = function() { var lRet, lSubstr, lPanel = this.getPanel(), @@ -1183,7 +1183,7 @@ var CloudCmd, Util, DOM, CloudFunc; /** * get current direcotory path */ - this.getCurrentDirPath = function(pPanel){ + this.getCurrentDirPath = function(pPanel) { var lPanel = pPanel || this.getPanel(), lPath = this.getByClass('path', lPanel)[0], lRet; @@ -1197,7 +1197,7 @@ var CloudCmd, Util, DOM, CloudFunc; /** * get current direcotory path */ - this.getNotCurrentDirPath = function(){ + this.getNotCurrentDirPath = function() { var lPanel = this.getPanel(true), lPath = this.getByClass('path', lPanel)[0], lRet; @@ -1213,7 +1213,7 @@ var CloudCmd, Util, DOM, CloudFunc; * * @pCurrentFile */ - this.getCurrentFile = function(){ + this.getCurrentFile = function() { var lRet = this.getByClass( CURRENT_FILE )[0]; return lRet; @@ -1222,7 +1222,7 @@ var CloudCmd, Util, DOM, CloudFunc; /** * get current file by name */ - this.getCurrentFileByName = function(pName){ + this.getCurrentFileByName = function(pName) { var lRet, lPanel, lName; lPanel = DOM.getPanel(); @@ -1237,7 +1237,7 @@ var CloudCmd, Util, DOM, CloudFunc; * * @pCurrentFile */ - this.getSelectedFiles = function(){ + this.getSelectedFiles = function() { var lRet = this.getByClass(SELECTED_FILE); return lRet.length ? lRet : null; @@ -1247,7 +1247,7 @@ var CloudCmd, Util, DOM, CloudFunc; * get size * @pCurrentFile */ - this.getCurrentSize = function(pCurrentFile){ + this.getCurrentSize = function(pCurrentFile) { var lRet, lCurrent = pCurrentFile || this.getCurrentFile(), lSize = this.getByClass('size', lCurrent); @@ -1262,7 +1262,7 @@ var CloudCmd, Util, DOM, CloudFunc; * get size * @pCurrentFile */ - this.loadCurrentSize = function(pCallBack, pCurrent){ + this.loadCurrentSize = function(pCallBack, pCurrent) { var lRet, lCurrent = pCurrent || this.getCurrentFile(), lLink = this.getCurrentPath(lCurrent), @@ -1270,7 +1270,7 @@ var CloudCmd, Util, DOM, CloudFunc; /* если это папка - возвращаем слово dir вместо размера*/ if (lName !== '..') - RESTfull.read(lLink, function(pSize){ + RESTfull.read(lLink, function(pSize) { DOM.setCurrentSize(pSize, lCurrent); Util.exec(pCallBack, lCurrent); }, '?size'); @@ -1282,7 +1282,7 @@ var CloudCmd, Util, DOM, CloudFunc; * set size * @pCurrentFile */ - this.setCurrentSize = function(pSize, pCurrentFile){ + this.setCurrentSize = function(pSize, pCurrentFile) { var lCurrent = pCurrentFile || this.getCurrentFile(), lSizeElement = this.getByClass('size', lCurrent), lSize = CloudFunc.getShortSize(pSize); @@ -1294,7 +1294,7 @@ var CloudCmd, Util, DOM, CloudFunc; /** * @pCurrentFile */ - this.getCurrentMode = function(pCurrentFile){ + this.getCurrentMode = function(pCurrentFile) { var lRet, lCurrent = pCurrentFile || this.getCurrentFile(), lMode = this.getByClass('mode', lCurrent); @@ -1309,13 +1309,13 @@ var CloudCmd, Util, DOM, CloudFunc; * @pCallBack - callback function or data struct {sucess, error} * @pCurrentFile */ - this.getCurrentFileContent = function(pParams, pCurrentFile){ + this.getCurrentFileContent = function(pParams, pCurrentFile) { var lRet, lCurrentFile = pCurrentFile ? pCurrentFile : this.getCurrentFile(), lParams = pParams ? pParams : {}, lPath = this.getCurrentPath(lCurrentFile), lErrorWas = pParams.error, - lError = function(jqXHR){ + lError = function(jqXHR) { Util.exec(lErrorWas); Images.showError(jqXHR); }; @@ -1340,15 +1340,15 @@ var CloudCmd, Util, DOM, CloudFunc; /** * unified way to get current file content * - * @pCallBack - function({data, name}){} + * @pCallBack - function({data, name}) {} * @pCurrentFile */ - this.getCurrentData = function(pCallBack, pCurrentFile){ + this.getCurrentData = function(pCallBack, pCurrentFile) { var lParams, lCurrentFile = pCurrentFile ? pCurrentFile : this.getCurrentFile(), - lFunc = function(pData){ + lFunc = function(pData) { var lName = DOM.getCurrentName(lCurrentFile); - if ( Util.isObject(pData) ){ + if ( Util.isObject(pData) ) { pData = Util.stringifyJSON(pData); var lExt = '.json'; @@ -1377,7 +1377,7 @@ var CloudCmd, Util, DOM, CloudFunc; /** * unified way to get RefreshButton */ - this.getRefreshButton = function(){ + this.getRefreshButton = function() { if (!CloudFunc) console.trace(); @@ -1392,11 +1392,11 @@ var CloudCmd, Util, DOM, CloudFunc; /** * unified way to set current file */ - this.setCurrentFile = function(pCurrentFile){ + this.setCurrentFile = function(pCurrentFile) { var lRet, lCurrentFileWas = this.getCurrentFile(); - if (pCurrentFile){ + if (pCurrentFile) { if (pCurrentFile.className === 'path') pCurrentFile = pCurrentFile.nextSibling; @@ -1421,7 +1421,7 @@ var CloudCmd, Util, DOM, CloudFunc; * select current file * @param pCurrent */ - this.setSelectedFile = function(pCurrent){ + this.setSelectedFile = function(pCurrent) { var lCurrent = pCurrent || this.getCurrentFile(), lRet = this.addClass(pCurrent, SELECTED_FILE); @@ -1435,7 +1435,7 @@ var CloudCmd, Util, DOM, CloudFunc; * unselect current file * @param pCurrent */ - this.unsetSelectedFile = function(pCurrent){ + this.unsetSelectedFile = function(pCurrent) { var lCurrent = pCurrent || this.getCurrentFile(), lRet = this.removeClass(lCurrent, SELECTED_FILE); @@ -1445,7 +1445,7 @@ var CloudCmd, Util, DOM, CloudFunc; /** * setting history wrapper */ - this.setHistory = function(pData, pTitle, pUrl){ + this.setHistory = function(pData, pTitle, pUrl) { var lRet = window.history; if (lRet) @@ -1458,7 +1458,7 @@ var CloudCmd, Util, DOM, CloudFunc; * set onclick handler on buttons f1-f10 * @param pKey - 'f1'-'f10' */ - this.setButtonKey = function(pKey, pFunc){ + this.setButtonKey = function(pKey, pFunc) { Events.addClick(pFunc, CloudCmd.KeysPanel[pKey]); }; @@ -1469,7 +1469,7 @@ var CloudCmd, Util, DOM, CloudFunc; * @param pName */ - this.setTitle = function(pName){ + this.setTitle = function(pName) { if (!Title) Title = DOMTree.getByTag('title')[0] || Loader.anyload({ @@ -1488,7 +1488,7 @@ var CloudCmd, Util, DOM, CloudFunc; * * @param pCurrentFile */ - this.isCurrentFile = function(pCurrent){ + this.isCurrentFile = function(pCurrent) { var lRet; if ( pCurrent ) @@ -1502,7 +1502,7 @@ var CloudCmd, Util, DOM, CloudFunc; * * @param pCurrentFile */ - this.isSelected = function(pSelected){ + this.isSelected = function(pSelected) { var lRet; if ( pSelected ) @@ -1516,7 +1516,7 @@ var CloudCmd, Util, DOM, CloudFunc; * * @param pCurrentFile */ - this.isCurrentIsDir = function(pCurrent){ + this.isCurrentIsDir = function(pCurrent) { var lCurrent = pCurrent || this.getCurrentFile(), lFileType = this.getByClass('mini-icon', lCurrent)[0], lRet = this.isContainClass(lFileType, 'directory'); @@ -1530,7 +1530,7 @@ var CloudCmd, Util, DOM, CloudFunc; * * @param pCurrentFile - current file by default */ - this.getCurrentLink = function(pCurrentFile){ + this.getCurrentLink = function(pCurrentFile) { var lLink = this.getByTag( 'a', pCurrentFile || this.getCurrentFile() ), lRet = lLink.length > 0 ? lLink[0] : -1; @@ -1543,7 +1543,7 @@ var CloudCmd, Util, DOM, CloudFunc; * * @param pCurrentFile - current file by default */ - this.getCurrentPath = function(pCurrentFile){ + this.getCurrentPath = function(pCurrentFile) { var lCurrent = pCurrentFile || this.getCurrentFile(), lPath = this.getCurrentLink( lCurrent ).href; @@ -1559,7 +1559,7 @@ var CloudCmd, Util, DOM, CloudFunc; * * @param pCurrentFile */ - this.getCurrentName = function(pCurrentFile){ + this.getCurrentName = function(pCurrentFile) { var lCurrent = pCurrentFile || this.getCurrentFile(), lLink = this.getCurrentLink( lCurrent ); @@ -1569,11 +1569,11 @@ var CloudCmd, Util, DOM, CloudFunc; return lLink; }; - this.getSelectedNames = function(pSelected){ + this.getSelectedNames = function(pSelected) { var lSelected = pSelected || this.getSelectedFiles(), lRet = lSelected ? [] : null; - if (lRet){ + if (lRet) { var lFirst = lSelected[0], lName = this.getCurrentName( lFirst ); @@ -1591,7 +1591,7 @@ var CloudCmd, Util, DOM, CloudFunc; * * @param pCurrentFile */ - this.setCurrentName = function(pName, pCurrentFile){ + this.setCurrentName = function(pName, pCurrentFile) { var lLink = this.getCurrentLink( pCurrentFile ), lDir = this.getCurrentDirName() + '/'; @@ -1604,18 +1604,18 @@ var CloudCmd, Util, DOM, CloudFunc; /** function getting FM * @param pPanel_o = {active: true} */ - this.getFM = function(){ + this.getFM = function() { return this.getPanel().parentElement; }; /** function getting panel active, or passive * @param pPanel_o = {active: true} */ - this.getPanel = function(pActive){ + this.getPanel = function(pActive) { var lPanel = this.getCurrentFile().parentElement; /* if {active : false} getting passive panel */ - if (pActive && !pActive.active){ + if (pActive && !pActive.active) { var lId = lPanel.id === 'left' ? 'right' : 'left'; lPanel = this.getById(lId); } @@ -1635,7 +1635,7 @@ var CloudCmd, Util, DOM, CloudFunc; }; /** prevent default event */ - this.preventDefault = function(pEvent){ + this.preventDefault = function(pEvent) { var lRet, lPreventDefault = pEvent && pEvent.preventDefault, lFunc = Util.bind(lPreventDefault, pEvent); @@ -1648,7 +1648,7 @@ var CloudCmd, Util, DOM, CloudFunc; /** * shows panel right or left (or active) */ - this.showPanel = function(pActive){ + this.showPanel = function(pActive) { var lRet = true, lPanel = this.getPanel(pActive); @@ -1663,7 +1663,7 @@ var CloudCmd, Util, DOM, CloudFunc; /** * hides panel right or left (or active) */ - this.hidePanel = function(pActive){ + this.hidePanel = function(pActive) { var lRet = false, lPanel = this.getPanel(pActive); @@ -1677,7 +1677,7 @@ var CloudCmd, Util, DOM, CloudFunc; * open window with URL * @param pUrl */ - this.openWindow = function(pUrl){ + this.openWindow = function(pUrl) { var left = 140, top = 187, width = 1000, @@ -1700,7 +1700,7 @@ var CloudCmd, Util, DOM, CloudFunc; * @param pChild * @param pElement */ - this.remove = function(pChild, pElement){ + this.remove = function(pChild, pElement) { return (pElement || document.body).removeChild(pChild); }; @@ -1709,7 +1709,7 @@ var CloudCmd, Util, DOM, CloudFunc; * @param pElement * @param pClass */ - this.removeClass = function(pElement, pClass){ + this.removeClass = function(pElement, pClass) { var lRet_b = true, lClassList = pElement.classList; @@ -1726,12 +1726,12 @@ var CloudCmd, Util, DOM, CloudFunc; * remove current file from file table * @pCurrent */ - this.deleteCurrent = function(pCurrent, pNextFile, pPreviousFile, pNotSet){ + this.deleteCurrent = function(pCurrent, pNextFile, pPreviousFile, pNotSet) { var lCurrent = pCurrent || Cmd.getCurrentFile(), lParent = lCurrent && lCurrent.parentElement, lName = Cmd.getCurrentName(lCurrent); - if (lCurrent && lParent && lName !== '..'){ + if (lCurrent && lParent && lName !== '..') { var lNext = pNextFile || lCurrent.nextSibling, lPrevious = pPreviousFile || lCurrent.previousSibling; @@ -1751,10 +1751,10 @@ var CloudCmd, Util, DOM, CloudFunc; * remove selected files from file table * @Selected */ - this.deleteSelected = function(pSelected){ + this.deleteSelected = function(pSelected) { var lSelected = pSelected || this.getSelectedFiles(); - if (lSelected){ + if (lSelected) { var n = lSelected.length, lLast = n-1, lNext = lSelected[lLast].nextSibling, @@ -1775,7 +1775,7 @@ var CloudCmd, Util, DOM, CloudFunc; * * @pCurrent */ - this.renameCurrent = function(pCurrentFile){ + this.renameCurrent = function(pCurrentFile) { if ( !Cmd.isCurrentFile(pCurrentFile) ) pCurrentFile = null; @@ -1784,13 +1784,13 @@ var CloudCmd, Util, DOM, CloudFunc; lTo = prompt('Rename', lFrom) || lFrom, lDirPath = Cmd.getCurrentDirPath(); - if ( !Util.strCmp(lFrom, lTo) ){ + if ( !Util.strCmp(lFrom, lTo) ) { var lFiles = { from : lDirPath + lFrom, to : lDirPath + lTo }; - RESTfull.mv(lFiles, function(){ + RESTfull.mv(lFiles, function() { DOM.setCurrentName(lTo, lCurrent); }); } @@ -1801,7 +1801,7 @@ var CloudCmd, Util, DOM, CloudFunc; * * @pCurrent */ - this.moveCurrent = function(pCurrentFile){ + this.moveCurrent = function(pCurrentFile) { if ( !Cmd.isCurrentFile(pCurrentFile) ) pCurrentFile = null; @@ -1812,13 +1812,13 @@ var CloudCmd, Util, DOM, CloudFunc; lToPath = prompt( 'Rename/Move file "' + lName + '"', lToPath ); - if ( lToPath && !Util.strCmp(lFromPath, lToPath) ){ + if ( lToPath && !Util.strCmp(lFromPath, lToPath) ) { var lFiles = { from : lFromPath, to : lToPath }; - RESTfull.mv(lFiles, function(){ + RESTfull.mv(lFiles, function() { DOM.deleteCurrent(lCurrent); var lPanel = DOM.getPanel(true), @@ -1835,7 +1835,7 @@ var CloudCmd, Util, DOM, CloudFunc; * * @pCurrent */ - this.copyCurrent = function(pCurrentFile){ + this.copyCurrent = function(pCurrentFile) { if ( !Cmd.isCurrentFile(pCurrentFile) ) pCurrentFile = null; @@ -1845,13 +1845,13 @@ var CloudCmd, Util, DOM, CloudFunc; lToPath = Cmd.getNotCurrentDirPath() + lName; lToPath = prompt( 'Copy file "' + lName + '" to', lToPath ); - if ( lToPath && !Util.strCmp(lFromPath, lToPath) ){ + if ( lToPath && !Util.strCmp(lFromPath, lToPath) ) { var lFiles = { from : lFromPath, to : lToPath }; - RESTfull.cp(lFiles, function(){ + RESTfull.cp(lFiles, function() { var lPanel = DOM.getPanel(true), lDotDot = DOM.getById( '..(' + lPanel.id + ')'); @@ -1866,7 +1866,7 @@ var CloudCmd, Util, DOM, CloudFunc; * (native suporte by webkit only) * @param pElement */ - this.scrollIntoViewIfNeeded = function(pElement){ + this.scrollIntoViewIfNeeded = function(pElement) { var lRet = pElement && pElement.scrollIntoViewIfNeeded; if (lRet) @@ -1876,7 +1876,7 @@ var CloudCmd, Util, DOM, CloudFunc; }; /* scroll on one page*/ - this.scrollByPages = function(pElement, pPages){ + this.scrollByPages = function(pElement, pPages) { var lRet = pElement && pElement.scrollByPages && pPages; if (lRet) @@ -1888,7 +1888,7 @@ var CloudCmd, Util, DOM, CloudFunc; /** * function gets time */ - this.getTime = function(){ + this.getTime = function() { var lRet, lDate = new Date(), lHours = lDate.getHours(),