mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 00:47:01 +00:00
refactored
This commit is contained in:
parent
1d1b861df7
commit
f69c460811
2 changed files with 35 additions and 44 deletions
|
|
@ -57,18 +57,13 @@ var CloudCmd = {
|
|||
};
|
||||
|
||||
CloudCmd.GoogleAnalytics = function(){
|
||||
/* google analytics */
|
||||
var lFunc = document.onmousemove;
|
||||
|
||||
document.onmousemove = function(){
|
||||
DOM.addOneTimeListener('mousemove', function(){
|
||||
var lUrl = CloudCmd.LIBDIRCLIENT + 'google_analytics.js';
|
||||
|
||||
setTimeout(function(){
|
||||
DOM.jsload(CloudCmd.LIBDIRCLIENT + 'google_analytics.js');
|
||||
DOM.jsload(lUrl);
|
||||
}, 5000);
|
||||
|
||||
Util.exec(lFunc);
|
||||
|
||||
document.onmousemove = lFunc;
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -79,30 +74,30 @@ CloudCmd.GoogleAnalytics = function(){
|
|||
* @param pNeedRefresh - необходимость обязательной загрузки данных с сервера
|
||||
*/
|
||||
CloudCmd._loadDir = function(pLink, pNeedRefresh){
|
||||
return function(pEvent){
|
||||
/* показываем гиф загрузки возле пути папки сверху
|
||||
* ctrl+r нажата? */
|
||||
return function(pEvent){
|
||||
/* показываем гиф загрузки возле пути папки сверху
|
||||
* ctrl+r нажата? */
|
||||
|
||||
var lCurrentLink = DOM.getCurrentLink(),
|
||||
lHref = lCurrentLink.href,
|
||||
lParent = lCurrentLink.textContent,
|
||||
lLink = pLink || Util.removeStr(lHref, CloudCmd.HOST),
|
||||
lDir = DOM.getCurrentDir();
|
||||
|
||||
if(pLink || lCurrentLink.target !== '_blank'){
|
||||
DOM.Images.showLoad(pNeedRefresh ? {top:true} : null);
|
||||
|
||||
var lCurrentLink = DOM.getCurrentLink(),
|
||||
lHref = lCurrentLink.href,
|
||||
lParent = lCurrentLink.textContent,
|
||||
lLink = pLink || Util.removeStr(lHref, CloudCmd.HOST),
|
||||
lDir = DOM.getCurrentDir();
|
||||
/* загружаем содержимое каталога */
|
||||
CloudCmd._ajaxLoad(lLink, { refresh: pNeedRefresh });
|
||||
|
||||
if(pLink || lCurrentLink.target !== '_blank'){
|
||||
DOM.Images.showLoad(pNeedRefresh ? {top:true} : null);
|
||||
|
||||
/* загружаем содержимое каталога */
|
||||
CloudCmd._ajaxLoad(lLink, { refresh: pNeedRefresh });
|
||||
|
||||
/* если нажали на ссылку на верхний каталог*/
|
||||
if(lParent === '..' && lDir !== '/')
|
||||
CloudCmd._currentToParent(lDir);
|
||||
}
|
||||
|
||||
DOM.preventDefault(pEvent);
|
||||
};
|
||||
/* если нажали на ссылку на верхний каталог*/
|
||||
if(lParent === '..' && lDir !== '/')
|
||||
CloudCmd._currentToParent(lDir);
|
||||
}
|
||||
|
||||
DOM.preventDefault(pEvent);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -141,16 +136,15 @@ CloudCmd._editFileName = function(pParent){
|
|||
*/
|
||||
CloudCmd._currentToParent = function(pDirName){
|
||||
/* убираем слэш с имени каталога */
|
||||
pDirName = pDirName.replace('/','');
|
||||
pDirName = Util.removeStr(pDirName, '/');
|
||||
|
||||
/* опредиляем в какой мы панели: *
|
||||
* правой или левой */
|
||||
var lPanel = DOM.getPanel(),
|
||||
lRootDir = DOM.getById(pDirName + '(' + lPanel.id + ')');
|
||||
|
||||
/* if found li element with ID directory name
|
||||
* set it to current file
|
||||
*/
|
||||
/* if found li element with ID directory name *
|
||||
* set it to current file */
|
||||
if(lRootDir){
|
||||
DOM.setCurrentFile(lRootDir);
|
||||
DOM.scrollIntoViewIfNeeded(lRootDir, true);
|
||||
|
|
@ -416,7 +410,7 @@ CloudCmd.getModules = function(pCallBack){
|
|||
CloudCmd._changeLinks = function(pPanelID){
|
||||
/* назначаем кнопку очистить кэш и показываем её */
|
||||
var lClearcache = DOM.getById('clear-cache');
|
||||
DOM.addListener('click', DOM.Cache.clear, lClearcache);
|
||||
DOM.addClickListener(DOM.Cache.clear, lClearcache);
|
||||
|
||||
/* меняем ссылки на ajax-запросы */
|
||||
var lPanel = DOM.getById(pPanelID),
|
||||
|
|
|
|||
|
|
@ -291,15 +291,12 @@ var CloudCommander, Util, DOM;
|
|||
}
|
||||
|
||||
/* если нажали <ctrl>+d чистим кэш */
|
||||
else if(lKeyCode === KEY.D &&
|
||||
pEvent.ctrlKey){
|
||||
console.log('<ctrl>+d pressed\n' +
|
||||
'clearing cache...\n' +
|
||||
'press <alt>+q to remove all key-handlers');
|
||||
|
||||
var lClearCache = DOM.getById('clear-cache');
|
||||
Util.exec( DOM.getListener(lClearCache) );
|
||||
else if(lKeyCode === KEY.D && pEvent.ctrlKey){
|
||||
Util.log('<ctrl>+d pressed\n' +
|
||||
'clearing cache...\n' +
|
||||
'press <alt>+q to remove all key-handlers');
|
||||
|
||||
DOM.Cache.clear();
|
||||
DOM.preventDefault();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue