From 5d4e6deb57f2b54d3f9146879d3e01d9423b6907 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 3 Sep 2012 09:28:04 -0400 Subject: [PATCH] fixed bug with getElementsByClassName IE version --- client.js | 30 +++++++++++++++++++----------- lib/client/ie.js | 17 ++++++----------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/client.js b/client.js index 269577ec..0cace627 100644 --- a/client.js +++ b/client.js @@ -421,11 +421,13 @@ CloudClient.Utils = (function(){ return this.anyload(pParams_o); }; - this.jqueryLoad = function(){ + this.jqueryLoad = function(pCallBack){ /* загружаем jquery: */ Util.jsload('//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js',{ onload: function(){ $ = window.jQuery; + if(typeof pCallBack === 'function') + pCallBack(); }, onerror: function(){ @@ -1014,23 +1016,29 @@ var CloudFunc, $, Util, * выполняет весь функционал по * инициализации */ -CloudClient.init = (function() -{ - if(!document.head){ - this.OLD_BROWSER = true; - document.head = document.getElementsByTagName("head")[0]; - } - +CloudClient.init = (function(){ Util = new CloudClient.Utils(); getByClass = Util.getByClass; getById = Util.getById; - + + if(!document.body.scrollIntoViewIfNeeded){ + this.OLD_BROWSER = true; + Util.jsload(CloudClient.LIBDIRCLIENT + 'ie.js', + function(){ + Util.jqueryLoad(CloudClient.baseInit); + }); + } + else CloudClient.baseInit(); +}); + +CloudClient.baseInit = (function(){ /* меняем title * если js включен - имена папок отображать необязательно... * а может и обязательно при переходе, можно будет это сделать */ - var lTitle=document.getElementsByTagName('title'); - if(lTitle.length>0)lTitle[0].textContent='Cloud Commander'; + var lTitle = Util.getByTag('title'); + if(lTitle.length > 0) + lTitle[0].textContent = 'Cloud Commander'; /* загружаем общие функции для клиента и сервера*/ Util.jsload(CloudClient.LIBDIR+'cloudfunc.js',function(){ diff --git a/lib/client/ie.js b/lib/client/ie.js index 3f77bf91..89d647ca 100644 --- a/lib/client/ie.js +++ b/lib/client/ie.js @@ -4,17 +4,12 @@ var CloudCommander, $; (function(){ "use strict"; - document.head = document.getElementsByTagName("head")[0]; - - document.getElementsByClassName = function(pClassName){ - return window.jQuery('.'+pClassName)[0]; - }; - /* setting head ie6 - ie8 */ + if(!document.head) + document.head = document.getElementsByTagName("head")[0]; + var lUtil = CloudCommander.Util; - - lUtil.jqueryLoad(); - + /* setting function context (this) */ lUtil.bind = function(pFunction, pContext){ return $.proxy(pFunction, pContext); @@ -48,7 +43,7 @@ var CloudCommander, $; {name: '', src: ' ',func: '', style: '', id: '', parent: '', async: false, inner: 'id{color:red, }, class:'', not_append: false} */ - this.cssSet = function(pParams_o){ + lUtil.cssSet = function(pParams_o){ var lElement = '