diff --git a/ChangeLog b/ChangeLog index 38d2b803..2b1442d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -49,7 +49,10 @@ document.location.origin) * Fixed bug with keybinding in FireFox (removed KeyBinding call on window load). -* Fixed bug with getting url in Firefox. +* Fixed bug with getting current url in Firefox. + +* Util cleaned up (addClass and removeClass +moved to ie.js). 2012.10.01, Version 0.1.7 diff --git a/client.js b/client.js index 9ad8e4ac..7f5c949c 100644 --- a/client.js +++ b/client.js @@ -29,6 +29,7 @@ var CloudClient = { /* ОБЬЕКТЫ */ /* Обьект для работы с кэшем */ Cache : {}, + /* Object contain additional system functional */ Util : {}, @@ -99,7 +100,7 @@ var loadModule = function(pParams){ if( Util.isFunction(lDoBefore) ) lDoBefore(); - Util.jsload(CloudClient.LIBDIRCLIENT + lPath, lFunc || + Util.jsload(cloudcmd.LIBDIRCLIENT + lPath, lFunc || function(){ cloudcmd[lName].Keys(pArg); }); @@ -191,16 +192,7 @@ CloudClient.Util = (function(){ lClassList.add(pClass); else lRet_b = false; - } - else{ - var lSpaceChar = ''; - if(pElement.className) - lSpaceChar = ' '; - if( !pElement.contains(pClass) ) - pElement.className += lSpaceChar + pClass; - else - lRet_b = false; - } + } return lRet_b; }; @@ -979,9 +971,6 @@ CloudClient.Util = (function(){ this.removeClass = function(pElement, pClass){ if(pElement.classList) pElement.classList.remove(pClass); - - else if(pElement.className.length > pClass.length) - pElement.className = pElement.className.replace(pClass, ''); }; this.removeCurrent = function(pCurrent){ @@ -1494,30 +1483,28 @@ CloudClient._changeLinks = function(pPanelID){ CloudClient._ajaxLoad = function(path, pNeedRefresh){ /* Отображаем красивые пути */ /* added supporting of russian language */ - var lPath = decodeURI(path); - var lFS_s = CloudFunc.FS; + var lPath = decodeURI(path), + lFS_s = CloudFunc.FS; + if(lPath.indexOf(lFS_s) === 0){ lPath = lPath.replace(lFS_s,''); - if(lPath === '') lPath='/'; + if(lPath === '') lPath = '/'; } - console.log ('reading dir: "'+lPath+'";'); + console.log ('reading dir: "' + lPath + '";'); /* если доступен localStorage и - * в нём есть нужная нам директория - - * читаем данные с него и - * выходим - * если стоит поле обязательной перезагрузки - - * перезагружаемся - */ + * в нём есть нужная нам директория - + * читаем данные с него и + * выходим + * если стоит поле обязательной перезагрузки - + * перезагружаемся + */ /* опредиляем в какой мы панели: * правой или левой */ - var lPanel; - try{ - lPanel = Util.getPanel().id; - }catch(error){console.log("Current panel not found\n"+error);} + var lPanel = Util.getPanel().id; if(pNeedRefresh === undefined && lPanel){ var lJSON = CloudClient.Cache.get(lPath); @@ -1532,7 +1519,7 @@ CloudClient._ajaxLoad = function(path, pNeedRefresh){ } }else lJSON = JSON.parse(lJSON); - CloudClient._createFileTable(lPanel,lJSON); + CloudClient._createFileTable(lPanel, lJSON); CloudClient._changeLinks(lPanel); return; diff --git a/lib/client/ie.js b/lib/client/ie.js index 2b18a590..7d030cb0 100644 --- a/lib/client/ie.js +++ b/lib/client/ie.js @@ -108,5 +108,26 @@ var CloudCommander, $; pElement.scrollIntoView(alignWithTop); } }; + + if(!document.body.classList){ + lUtil.addClass = function(pElement, pClass){ + var lSpaceChar = '', + lRet_b = true; + + if(pElement.className) + lSpaceChar = ' '; + if( !pElement.contains(pClass) ) + pElement.className += lSpaceChar + pClass; + else + lRet_b = false; + }; + + lUtil.removeClass = function(pElement, pClass){ + var lClassName = pElement.className; + + if(lClassName.length > pClass.length) + pElement.className = lClassName.replace(pClass, ''); + }; + } })(); \ No newline at end of file