From now jquery not necessary for Cloud Commander, so start load get faster

This commit is contained in:
coderaiser 2012-09-03 05:52:28 -04:00
parent 840abadf54
commit 7ad33a4617
4 changed files with 35 additions and 25 deletions

View file

@ -10,6 +10,10 @@ would be doing on-a-fly
* Added ability to use ajax without jquery.
* From now jquery not necessary for Cloud Commander
work, (so start load get faster), but it could be
loaded any time by any extension.
2012.08.24, Version 0.1.6

View file

@ -421,6 +421,32 @@ CloudClient.Utils = (function(){
return this.anyload(pParams_o);
};
this.jqueryLoad = function(){
/* загружаем jquery: */
Util.jsload('//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js',{
onload: function(){
$ = window.jQuery;
},
onerror: function(){
Util.jsload('lib/client/jquery.js');
/*
* if could not load jquery from google server
* maybe we offline, load font from local
* directory
*/
Util.cssSet({id:'local-droids-font',
element : document.head,
inner : '@font-face {font-family: "Droid Sans Mono";' +
'font-style: normal;font-weight: normal;' +
'src: local("Droid Sans Mono"), local("DroidSansMono"),'+
' url("font/DroidSansMono.woff") format("woff");}'
});
}
});
};
this.getByTag = function(pTag, pElement){
return (pElement || document).getElementsByTagName(pTag);
};
@ -995,31 +1021,7 @@ CloudClient.init = (function()
*/
var lTitle=document.getElementsByTagName('title');
if(lTitle.length>0)lTitle[0].textContent='Cloud Commander';
/* загружаем jquery: */
Util.jsload('//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js',{
onload: function(){
$ = window.jQuery;
},
onerror: function(){
Util.jsload('lib/client/jquery.js');
/*
* if could not load jquery from google server
* maybe we offline, load font from local
* directory
*/
Util.cssSet({id:'local-droids-font',
element : document.head,
inner : '@font-face {font-family: "Droid Sans Mono";' +
'font-style: normal;font-weight: normal;' +
'src: local("Droid Sans Mono"), local("DroidSansMono"),'+
' url("font/DroidSansMono.woff") format("woff");}'
});
}
});
/* загружаем общие функции для клиента и сервера*/
Util.jsload(CloudClient.LIBDIR+'cloudfunc.js',function(){
/* берём из обьекта window общий с сервером функционал */

View file

@ -13,6 +13,8 @@ var CloudCommander, $;
/* setting head ie6 - ie8 */
var lUtil = CloudCommander.Util;
lUtil.jqueryLoad();
/* setting function context (this) */
lUtil.bind = function(pFunction, pContext){
return $.proxy(pFunction, pContext);

View file

@ -61,6 +61,8 @@ var CloudCommander, CloudFunc, $;
* @pCallBack - executes, when everything loaded
*/
CloudCommander.Viewer.FancyBox.load = (function(pThis, pCallBack){
Util.jqueryLoad();
var ljsLoad_f = function(){
var lSrc = pThis.dir + 'jquery.fancybox.js';
Util.jsload(lSrc,{