mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-24 03:05:41 +00:00
refactored
This commit is contained in:
parent
030a4d552c
commit
ef3ef781a3
3 changed files with 32 additions and 26 deletions
|
|
@ -421,7 +421,7 @@ var Util, DOM, CloudFunc, $, KeyBinding, CloudCommander;
|
|||
|
||||
/* меняем ссылки на ajax-запросы */
|
||||
var lPanel = DOM.getById(pPanelID),
|
||||
a = lPanel.getElementsByTagName('a'),
|
||||
a = DOM.getByTag('a', lPanel),
|
||||
|
||||
/* right mouse click function varible */
|
||||
lOnContextMenu_f = function(pEvent){
|
||||
|
|
@ -487,17 +487,17 @@ var Util, DOM, CloudFunc, $, KeyBinding, CloudCommander;
|
|||
lUrl = CloudCmd.HOST,
|
||||
lLoadDirOnce = CloudCmd.loadDir();
|
||||
|
||||
(function(a){
|
||||
var a0 = a[0],
|
||||
lParent = a0.parentElement,
|
||||
lNEEDREFRESH = true,
|
||||
lLink = Util.removeStr(a0.href, lUrl);
|
||||
|
||||
CloudCmd.refresh = CloudCmd.loadDir(lLink, lNEEDREFRESH);
|
||||
|
||||
/* ставим загрузку гифа на клик*/
|
||||
DOM.addClickListener( CloudCmd.refresh, lParent );
|
||||
})(a);
|
||||
CloudCmd.refresh = function(){
|
||||
var lNEEDREFRESH = true,
|
||||
lPath = DOM.getCurrentDirPath(),
|
||||
lLink = CloudFunc.FS + lPath,
|
||||
lNotSlashlLink = CloudFunc.removeLastSlash(lLink),
|
||||
lLoad = CloudCmd.loadDir(lNotSlashlLink, lNEEDREFRESH);
|
||||
lLoad();
|
||||
};
|
||||
|
||||
/* ставим загрузку гифа на клик*/
|
||||
DOM.addClickListener( CloudCmd.refresh, a[0].parentElement );
|
||||
|
||||
/* start from 1 cous 0 is a path and it's setted up */
|
||||
for(var i = 1, n = a.length; i < n ; i++){
|
||||
|
|
@ -554,8 +554,6 @@ var Util, DOM, CloudFunc, $, KeyBinding, CloudCommander;
|
|||
|
||||
if(lCleanPath === lSLASH)
|
||||
lNOJSPath = lSLASH;
|
||||
else
|
||||
lCleanPath += lSLASH;
|
||||
|
||||
Util.log ('reading dir: "' + lCleanPath + '";');
|
||||
|
||||
|
|
|
|||
|
|
@ -945,8 +945,9 @@ var CloudCommander, Util,
|
|||
/**
|
||||
* get current direcotory path
|
||||
*/
|
||||
DOM.getCurrentDirPath = function(){
|
||||
var lPath = DOM.getByClass('path')[0],
|
||||
DOM.getCurrentDirPath = function(pPanel){
|
||||
var lPanel = pPanel || DOM.getPanel(),
|
||||
lPath = DOM.getByClass('path', lPanel)[0],
|
||||
lRet;
|
||||
|
||||
if(lPath)
|
||||
|
|
@ -1468,24 +1469,29 @@ var CloudCommander, Util,
|
|||
var lCurrent = pCurrentFile || DOM.getCurrentFile(),
|
||||
lName = DOM.getCurrentName(lCurrent),
|
||||
lFromPath = DOM.getCurrentPath(),
|
||||
lToPath = DOM.getNotCurrentDirPath() + lName,
|
||||
lTo = prompt( 'Rename/Move file "' + lName + '"', lToPath );
|
||||
lToPath = DOM.getNotCurrentDirPath() + lName;
|
||||
lToPath = prompt( 'Rename/Move file "' + lName + '"', lToPath );
|
||||
|
||||
if( lTo && !Util.strCmp(lFromPath, lToPath) ){
|
||||
if( lToPath && !Util.strCmp(lFromPath, lToPath) ){
|
||||
var lFiles = {
|
||||
from : lFromPath,
|
||||
to : lToPath
|
||||
};
|
||||
|
||||
DOM.RESTfull.mv(lFiles, function(){
|
||||
//CloudCommander.refresh();
|
||||
DOM.deleteCurrent(lCurrent);
|
||||
|
||||
var lPanel = DOM.getPanel(true),
|
||||
lDotDot = DOM.getById( '..(' + lPanel.id + ')');
|
||||
|
||||
DOM.setCurrentFile ( lDotDot );
|
||||
CloudCommander.refresh();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* move current file
|
||||
* copy current file
|
||||
*
|
||||
* @pCurrent
|
||||
*/
|
||||
|
|
@ -1496,17 +1502,21 @@ var CloudCommander, Util,
|
|||
var lCurrent = pCurrentFile || DOM.getCurrentFile(),
|
||||
lName = DOM.getCurrentName(lCurrent),
|
||||
lFromPath = DOM.getCurrentPath(),
|
||||
lToPath = DOM.getNotCurrentDirPath() + lName,
|
||||
lTo = prompt( 'Copy file "' + lName + '" to', lToPath );
|
||||
lToPath = DOM.getNotCurrentDirPath() + lName;
|
||||
lToPath = prompt( 'Copy file "' + lName + '" to', lToPath );
|
||||
|
||||
if( lTo && !Util.strCmp(lFromPath, lToPath) ){
|
||||
if( lToPath && !Util.strCmp(lFromPath, lToPath) ){
|
||||
var lFiles = {
|
||||
from : lFromPath,
|
||||
to : lToPath
|
||||
};
|
||||
|
||||
DOM.RESTfull.cp(lFiles, function(){
|
||||
var lPanel = DOM.getPanel(true),
|
||||
lDotDot = DOM.getById( '..(' + lPanel.id + ')');
|
||||
|
||||
DOM.setCurrentFile ( lDotDot );
|
||||
CloudCommander.refresh();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -154,8 +154,6 @@
|
|||
lJSON[i+1] = lJSONFile;
|
||||
}
|
||||
|
||||
lDirPath = lDirPath.substr(lDirPath, lDirPath.lastIndexOf('/') );
|
||||
|
||||
Util.exec(p.callback, null, lJSON);
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue