mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
refactored
This commit is contained in:
parent
0849fc20d4
commit
576d5380dc
2 changed files with 22 additions and 60 deletions
|
|
@ -2,7 +2,7 @@
|
|||
"api_url" : "/api/v1",
|
||||
"appcache" : false,
|
||||
"minification" : {
|
||||
"js" : true,
|
||||
"js" : false,
|
||||
"css" : true,
|
||||
"html" : true,
|
||||
"img" : true
|
||||
|
|
|
|||
|
|
@ -1,23 +1,18 @@
|
|||
var CloudCommander, Util,
|
||||
DOM = {},
|
||||
CloudFunc;
|
||||
|
||||
var CloudCommander, Util, DOM = {}, CloudFunc;
|
||||
|
||||
(function(Util, DOM){
|
||||
'use strict';
|
||||
|
||||
/* PRIVATE */
|
||||
|
||||
/* private members */
|
||||
var /* название css-класа текущего файла*/
|
||||
CURRENT_FILE = 'current-file',
|
||||
var CURRENT_FILE = 'current-file',
|
||||
XMLHTTP,
|
||||
Title,
|
||||
|
||||
/* Обьект содержит функции для отображения картинок */
|
||||
Images = function (){
|
||||
var getImage = function(pName){
|
||||
function getImage(pName){
|
||||
var lId = pName + '-image',
|
||||
lE = DOM.getById(lId);
|
||||
lE = DOM.getById(lId);
|
||||
|
||||
if (!lE)
|
||||
lE = DOM.anyload({
|
||||
name : 'span',
|
||||
|
|
@ -27,7 +22,8 @@ var CloudCommander, Util,
|
|||
});
|
||||
|
||||
return lE;
|
||||
};
|
||||
}
|
||||
|
||||
/* Функция создаёт картинку загрузки*/
|
||||
this.loading = function(){
|
||||
return getImage('loading');
|
||||
|
|
@ -133,20 +129,12 @@ var CloudCommander, Util,
|
|||
* @pCurrentFile
|
||||
*/
|
||||
function unSetCurrentFile(pCurrentFile){
|
||||
var lRet_b = DOM.isCurrentFile(pCurrentFile);
|
||||
var lRet = DOM.isCurrentFile(pCurrentFile);
|
||||
|
||||
if(!pCurrentFile)
|
||||
DOM.addCloudStatus({
|
||||
code : -1,
|
||||
msg : 'Error pCurrentFile in' +
|
||||
'unSetCurrentFile' +
|
||||
'could not be none'
|
||||
});
|
||||
|
||||
if(lRet_b)
|
||||
if(lRet)
|
||||
DOM.removeClass(pCurrentFile, CURRENT_FILE);
|
||||
|
||||
return lRet_b;
|
||||
return lRet;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1098,19 +1086,10 @@ var CloudCommander, Util,
|
|||
*/
|
||||
DOM.getRefreshButton = function(){
|
||||
var lPanel = DOM.getPanel(),
|
||||
lRefresh = DOM.getByClass(CloudFunc.REFRESHICON, lPanel);
|
||||
|
||||
if (lRefresh.length)
|
||||
lRefresh = lRefresh[0];
|
||||
else {
|
||||
DOM.addCloudStatus({
|
||||
code : -3,
|
||||
msg : 'Error Refresh icon not found'
|
||||
});
|
||||
lRefresh = false;
|
||||
}
|
||||
lRefresh = DOM.getByClass(CloudFunc.REFRESHICON, lPanel),
|
||||
lRet = lRefresh[0];
|
||||
|
||||
return lRefresh;
|
||||
return lRet;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -1146,12 +1125,10 @@ var CloudCommander, Util,
|
|||
* setting history wrapper
|
||||
*/
|
||||
DOM.setHistory = function(pData, pTitle, pUrl){
|
||||
var lRet = true;
|
||||
var lRet = window.history;
|
||||
|
||||
if(window.history)
|
||||
if(lRet)
|
||||
history.pushState(pData, pTitle, pUrl);
|
||||
else
|
||||
lRet = false;
|
||||
|
||||
return lRet;
|
||||
};
|
||||
|
|
@ -1470,6 +1447,7 @@ var CloudCommander, Util,
|
|||
lName = DOM.getCurrentName(lCurrent),
|
||||
lFromPath = DOM.getCurrentPath(),
|
||||
lToPath = DOM.getNotCurrentDirPath() + lName;
|
||||
|
||||
lToPath = prompt( 'Rename/Move file "' + lName + '"', lToPath );
|
||||
|
||||
if( lToPath && !Util.strCmp(lFromPath, lToPath) ){
|
||||
|
|
@ -1527,24 +1505,20 @@ var CloudCommander, Util,
|
|||
* @param pElement
|
||||
*/
|
||||
DOM.scrollIntoViewIfNeeded = function(pElement){
|
||||
var lRet = true;
|
||||
var lRet = pElement && pElement.scrollIntoViewIfNeeded;
|
||||
|
||||
if(pElement && pElement.scrollIntoViewIfNeeded)
|
||||
if(lRet)
|
||||
pElement.scrollIntoViewIfNeeded();
|
||||
else
|
||||
lRet = false;
|
||||
|
||||
return lRet;
|
||||
};
|
||||
|
||||
/* scroll on one page*/
|
||||
DOM.scrollByPages = function(pElement, pPages){
|
||||
var lRet = true;
|
||||
var lRet = pElement && pElement.scrollByPages && pPages;
|
||||
|
||||
if(pElement && pElement.scrollByPages && pPages)
|
||||
if(lRet)
|
||||
pElement.scrollByPages(pPages);
|
||||
else
|
||||
lRet = false;
|
||||
|
||||
return lRet;
|
||||
};
|
||||
|
|
@ -1564,16 +1538,4 @@ var CloudCommander, Util,
|
|||
return hours + ":" + minutes + ":" + seconds;
|
||||
};
|
||||
|
||||
/**
|
||||
* array of all statuses of opertattions
|
||||
*/
|
||||
DOM.CloudStatus = [];
|
||||
|
||||
/**
|
||||
* adds status of operation
|
||||
* @param pStatus
|
||||
*/
|
||||
DOM.addCloudStatus = function(pStatus){
|
||||
DOM.CloudStatus[DOM.CloudStatus.length] = pStatus;
|
||||
};
|
||||
})(Util, DOM);
|
||||
Loading…
Add table
Add a link
Reference in a new issue