fixed bug with getElementsByClassName IE version

This commit is contained in:
coderaiser 2012-09-03 09:28:04 -04:00
parent 3fe6943237
commit 5d4e6deb57
2 changed files with 25 additions and 22 deletions

View file

@ -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(){

View file

@ -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 = '<style ';
if (pParams_o.id) lElement += 'id=' + pParams_o.id + ' ';
@ -63,7 +58,7 @@ var CloudCommander, $;
},
this.scrollIntoViewIfNeeded = function(el){
lUtil.scrollIntoViewIfNeeded = function(el){
/*
* http://www.performantdesign.com/2009/08/26/scrollintoview-but-only-if-out-of-view/
*/