mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-24 03:05:41 +00:00
refactor(dom) pCurrent -> currentFile
This commit is contained in:
parent
cd1db20a31
commit
287a0fd1dc
1 changed files with 67 additions and 67 deletions
|
|
@ -609,13 +609,13 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
/**
|
||||
* private function thet unset currentfile
|
||||
*
|
||||
* @pCurrentFile
|
||||
* @currentFile
|
||||
*/
|
||||
function unsetCurrentFile(pCurrentFile) {
|
||||
var lRet = DOM.isCurrentFile(pCurrentFile);
|
||||
function unsetCurrentFile(currentFile) {
|
||||
var lRet = DOM.isCurrentFile(currentFile);
|
||||
|
||||
if (lRet)
|
||||
DOM.removeClass(pCurrentFile, CURRENT_FILE);
|
||||
DOM.removeClass(currentFile, CURRENT_FILE);
|
||||
|
||||
return lRet;
|
||||
}
|
||||
|
|
@ -696,7 +696,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
/**
|
||||
* delete currentfile, prompt before it
|
||||
*
|
||||
* @pCurrentFile
|
||||
* @currentFile
|
||||
*/
|
||||
this.promptDeleteSelected = function(current) {
|
||||
var ret, type, isDir, path, query, msg,
|
||||
|
|
@ -818,7 +818,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
/**
|
||||
* unified way to get current file
|
||||
*
|
||||
* @pCurrentFile
|
||||
* @currentFile
|
||||
*/
|
||||
this.getCurrentFile = function() {
|
||||
var ret = this.getByClass(CURRENT_FILE);
|
||||
|
|
@ -842,7 +842,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
/**
|
||||
* unified way to get current file
|
||||
*
|
||||
* @pCurrentFile
|
||||
* @currentFile
|
||||
*/
|
||||
this.getSelectedFiles = function() {
|
||||
var selected = this.getByClassAll(SELECTED_FILE),
|
||||
|
|
@ -853,11 +853,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
|
||||
/**
|
||||
* get size
|
||||
* @pCurrentFile
|
||||
* @currentFile
|
||||
*/
|
||||
this.getCurrentSize = function(pCurrentFile) {
|
||||
this.getCurrentSize = function(currentFile) {
|
||||
var lRet,
|
||||
lCurrent = pCurrentFile || Cmd.getCurrentFile(),
|
||||
lCurrent = currentFile || Cmd.getCurrentFile(),
|
||||
lSize = this.getByClass('size', lCurrent);
|
||||
lSize = lSize.textContent;
|
||||
/* если это папка - возвращаем слово dir вместо размера*/
|
||||
|
|
@ -868,11 +868,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
|
||||
/**
|
||||
* get size
|
||||
* @pCurrentFile
|
||||
* @currentFile
|
||||
*/
|
||||
this.loadCurrentSize = function(pCallBack, pCurrent) {
|
||||
this.loadCurrentSize = function(pCallBack, currentFile) {
|
||||
var lRet,
|
||||
lCurrent = pCurrent || this.getCurrentFile(),
|
||||
lCurrent = currentFile || this.getCurrentFile(),
|
||||
lLink = this.getCurrentPath(lCurrent),
|
||||
lName = this.getCurrentName(lCurrent);
|
||||
|
||||
|
|
@ -888,11 +888,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
/**
|
||||
* load hash
|
||||
* @pCallBack
|
||||
* @pCurrentFile
|
||||
* @currentFile
|
||||
*/
|
||||
this.loadCurrentHash = function(pCallBack, pCurrent) {
|
||||
this.loadCurrentHash = function(pCallBack, currentFile) {
|
||||
var lRet,
|
||||
lCurrent = pCurrent || this.getCurrentFile(),
|
||||
lCurrent = currentFile || this.getCurrentFile(),
|
||||
lLink = this.getCurrentPath(lCurrent),
|
||||
lName = this.getCurrentName(lCurrent);
|
||||
|
||||
|
|
@ -904,11 +904,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
/**
|
||||
* load current modification time of file
|
||||
* @pCallBack
|
||||
* @pCurrentFile
|
||||
* @currentFile
|
||||
*/
|
||||
this.loadCurrentTime = function(pCallBack, pCurrent) {
|
||||
this.loadCurrentTime = function(pCallBack, currentFile) {
|
||||
var lRet,
|
||||
lCurrent = pCurrent || this.getCurrentFile(),
|
||||
lCurrent = currentFile || this.getCurrentFile(),
|
||||
lLink = this.getCurrentPath(lCurrent),
|
||||
lName = this.getCurrentName(lCurrent);
|
||||
|
||||
|
|
@ -919,10 +919,10 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
|
||||
/**
|
||||
* set size
|
||||
* @pCurrentFile
|
||||
* @currentFile
|
||||
*/
|
||||
this.setCurrentSize = function(pSize, pCurrentFile) {
|
||||
var lCurrent = pCurrentFile || this.getCurrentFile(),
|
||||
this.setCurrentSize = function(pSize, currentFile) {
|
||||
var lCurrent = currentFile || this.getCurrentFile(),
|
||||
lSizeElement = this.getByClass('size', lCurrent),
|
||||
lSize = CloudFunc.getShortSize(pSize);
|
||||
|
||||
|
|
@ -931,11 +931,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
};
|
||||
|
||||
/**
|
||||
* @pCurrentFile
|
||||
* @currentFile
|
||||
*/
|
||||
this.getCurrentMode = function(pCurrentFile) {
|
||||
this.getCurrentMode = function(currentFile) {
|
||||
var lRet,
|
||||
lCurrent = pCurrentFile || this.getCurrentFile(),
|
||||
lCurrent = currentFile || this.getCurrentFile(),
|
||||
lMode = this.getByClass('mode', lCurrent);
|
||||
lRet = lMode.textContent;
|
||||
|
||||
|
|
@ -943,11 +943,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
};
|
||||
|
||||
/**
|
||||
* @pCurrentFile
|
||||
* @currentFile
|
||||
*/
|
||||
this.getCurrentOwner = function(pCurrentFile) {
|
||||
this.getCurrentOwner = function(currentFile) {
|
||||
var ret,
|
||||
current = pCurrentFile || this.getCurrentFile(),
|
||||
current = currentFile || this.getCurrentFile(),
|
||||
owner = this.getByClass('owner', current);
|
||||
|
||||
ret = owner.textContent;
|
||||
|
|
@ -959,11 +959,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
* unified way to get current file content
|
||||
*
|
||||
* @pCallBack - callback function or data struct {sucess, error}
|
||||
* @pCurrentFile
|
||||
* @currentFile
|
||||
*/
|
||||
this.getCurrentFileContent = function(pParams, pCurrentFile) {
|
||||
this.getCurrentFileContent = function(pParams, currentFile) {
|
||||
var lRet,
|
||||
lCurrentFile = pCurrentFile ? pCurrentFile : this.getCurrentFile(),
|
||||
lCurrentFile = currentFile ? currentFile : this.getCurrentFile(),
|
||||
lParams = pParams ? pParams : {},
|
||||
lPath = this.getCurrentPath(lCurrentFile),
|
||||
lErrorWas = pParams.error,
|
||||
|
|
@ -995,11 +995,11 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
* unified way to get current file content
|
||||
*
|
||||
* @pCallBack - function({data, name}) {}
|
||||
* @pCurrentFile
|
||||
* @currentFile
|
||||
*/
|
||||
this.getCurrentData = function(callback, pCurrentFile) {
|
||||
this.getCurrentData = function(callback, currentFile) {
|
||||
var lHash,
|
||||
lCurrentFile = pCurrentFile ? pCurrentFile : Cmd.getCurrentFile(),
|
||||
lCurrentFile = currentFile ? currentFile : Cmd.getCurrentFile(),
|
||||
path = DOM.getCurrentPath(lCurrentFile),
|
||||
isDir = DOM.isCurrentIsDir(lCurrentFile),
|
||||
|
||||
|
|
@ -1035,7 +1035,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
* unified way to save current file content
|
||||
*
|
||||
* @pCallBack - function({data, name}) {}
|
||||
* @pCurrentFile
|
||||
* @currentFile
|
||||
*/
|
||||
this.saveCurrentData = function(pUrl, pData, pCallBack, pQuery) {
|
||||
RESTful.save(pUrl, pData, function() {
|
||||
|
|
@ -1061,18 +1061,18 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
/**
|
||||
* unified way to set current file
|
||||
*/
|
||||
this.setCurrentFile = function(pCurrentFile) {
|
||||
this.setCurrentFile = function(currentFile) {
|
||||
var lRet,
|
||||
lCurrentFileWas = this.getCurrentFile();
|
||||
|
||||
if (pCurrentFile) {
|
||||
if (currentFile) {
|
||||
if (lCurrentFileWas)
|
||||
unsetCurrentFile(lCurrentFileWas);
|
||||
|
||||
this.addClass(pCurrentFile, CURRENT_FILE);
|
||||
this.addClass(currentFile, CURRENT_FILE);
|
||||
|
||||
/* scrolling to current file */
|
||||
this.scrollIntoViewIfNeeded(pCurrentFile);
|
||||
this.scrollIntoViewIfNeeded(currentFile);
|
||||
|
||||
lRet = true;
|
||||
|
||||
|
|
@ -1084,19 +1084,19 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
|
||||
/**
|
||||
* select current file
|
||||
* @param pCurrent
|
||||
* @param currentFile
|
||||
*/
|
||||
this.toggleSelectedFile = function(pCurrent) {
|
||||
var lCurrent = pCurrent || this.getCurrentFile(),
|
||||
lRet = this.toggleClass(pCurrent, SELECTED_FILE);
|
||||
this.toggleSelectedFile = function(currentFile) {
|
||||
var lCurrent = currentFile || this.getCurrentFile(),
|
||||
lRet = this.toggleClass(currentFile, SELECTED_FILE);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
this.toggleAllSelectedFiles = function(pCurrent) {
|
||||
this.toggleAllSelectedFiles = function(currentFile) {
|
||||
var i, n,
|
||||
isStr = Util.isString(pCurrent),
|
||||
lCurrent = !isStr && pCurrent || Cmd.getCurrentFile(),
|
||||
isStr = Util.isString(currentFile),
|
||||
lCurrent = !isStr && currentFile || Cmd.getCurrentFile(),
|
||||
panel = DOM.getPanel(),
|
||||
files = DOM.getFiles(panel),
|
||||
name = DOM.getCurrentName(files[0]);
|
||||
|
|
@ -1224,13 +1224,13 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
/**
|
||||
* current file check
|
||||
*
|
||||
* @param pCurrentFile
|
||||
* @param currentFile
|
||||
*/
|
||||
this.isCurrentFile = function(pCurrent) {
|
||||
this.isCurrentFile = function(currentFile) {
|
||||
var lRet;
|
||||
|
||||
if (pCurrent )
|
||||
lRet = this.isContainClass(pCurrent, CURRENT_FILE);
|
||||
if (currentFile )
|
||||
lRet = this.isContainClass(currentFile, CURRENT_FILE);
|
||||
|
||||
return lRet;
|
||||
};
|
||||
|
|
@ -1238,7 +1238,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
/**
|
||||
* selected file check
|
||||
*
|
||||
* @param pCurrentFile
|
||||
* @param currentFile
|
||||
*/
|
||||
this.isSelected = function(pSelected) {
|
||||
var lRet;
|
||||
|
|
@ -1252,10 +1252,10 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
/**
|
||||
* check is current file is a directory
|
||||
*
|
||||
* @param pCurrentFile
|
||||
* @param currentFile
|
||||
*/
|
||||
this.isCurrentIsDir = function(pCurrent) {
|
||||
var lCurrent = pCurrent || this.getCurrentFile(),
|
||||
this.isCurrentIsDir = function(currentFile) {
|
||||
var lCurrent = currentFile || this.getCurrentFile(),
|
||||
lFileType = this.getByClass('mini-icon', lCurrent),
|
||||
lRet = this.isContainClass(lFileType, 'directory');
|
||||
|
||||
|
|
@ -1266,10 +1266,10 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
/**
|
||||
* get link from current (or param) file
|
||||
*
|
||||
* @param pCurrentFile - current file by default
|
||||
* @param currentFile - current file by default
|
||||
*/
|
||||
this.getCurrentLink = function(pCurrentFile) {
|
||||
var lLink = this.getByTag( 'a', pCurrentFile || this.getCurrentFile()),
|
||||
this.getCurrentLink = function(currentFile) {
|
||||
var lLink = this.getByTag( 'a', currentFile || this.getCurrentFile()),
|
||||
|
||||
lRet = lLink.length > 0 ? lLink[0] : -1;
|
||||
|
||||
|
|
@ -1279,10 +1279,10 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
/**
|
||||
* get link from current (or param) file
|
||||
*
|
||||
* @param pCurrentFile - current file by default
|
||||
* @param currentFile - current file by default
|
||||
*/
|
||||
this.getCurrentPath = function(pCurrentFile) {
|
||||
var lCurrent = pCurrentFile || this.getCurrentFile(),
|
||||
this.getCurrentPath = function(currentFile) {
|
||||
var lCurrent = currentFile || this.getCurrentFile(),
|
||||
lPath = this.getCurrentLink( lCurrent ).href;
|
||||
|
||||
lPath = decodeURI(lPath);
|
||||
|
|
@ -1295,10 +1295,10 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
/**
|
||||
* get name from current (or param) file
|
||||
*
|
||||
* @param pCurrentFile
|
||||
* @param currentFile
|
||||
*/
|
||||
this.getCurrentName = function(pCurrentFile) {
|
||||
var lCurrent = pCurrentFile || this.getCurrentFile(),
|
||||
this.getCurrentName = function(currentFile) {
|
||||
var lCurrent = currentFile || this.getCurrentFile(),
|
||||
lLink = this.getCurrentLink( lCurrent );
|
||||
|
||||
if (Util.isObject(lLink))
|
||||
|
|
@ -1604,7 +1604,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
/**
|
||||
* rename current file
|
||||
*
|
||||
* @pCurrent
|
||||
* @currentFile
|
||||
*/
|
||||
this.renameCurrent = function(current) {
|
||||
var from, to, dirPath, cmp, files;
|
||||
|
|
@ -1636,7 +1636,7 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
/**
|
||||
* move current file
|
||||
*
|
||||
* @pCurrent
|
||||
* @currentFile
|
||||
*/
|
||||
this.moveCurrent = function(current) {
|
||||
var name, from, to, cmp, files;
|
||||
|
|
@ -1754,9 +1754,9 @@ var CloudCmd, Util, DOM, CloudFunc, Dialog;
|
|||
|
||||
this.CurrentInfo = CurrentInfo,
|
||||
|
||||
this.updateCurrentInfo = function(pCurrent) {
|
||||
this.updateCurrentInfo = function(currentFile) {
|
||||
var info = Cmd.CurrentInfo,
|
||||
current = pCurrent || Cmd.getCurrentFile(),
|
||||
current = currentFile || Cmd.getCurrentFile(),
|
||||
files = current.parentElement,
|
||||
panel = files.parentElement,
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue