mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 17:05:17 +00:00
minor changes
This commit is contained in:
parent
1214c16453
commit
94acf9ffdc
3 changed files with 40 additions and 13 deletions
|
|
@ -608,11 +608,7 @@ CloudClient._anyload = function(pParams_o)
|
|||
var lFunc = pParams_o.func;
|
||||
|
||||
if(!lID){
|
||||
lID=lSrc.replace(lSrc.substr(lSrc,
|
||||
lSrc.lastIndexOf('/')+1),
|
||||
'');
|
||||
/* убираем точку*/
|
||||
lID=lID.replace('.','_');
|
||||
lID = CloudFunc.getIdBySrc(lSrc);
|
||||
}
|
||||
var element = document.getElementById(lID);
|
||||
/* если скрипт еще не загружен */
|
||||
|
|
|
|||
|
|
@ -41,21 +41,28 @@ CloudCommander.Viewer.FancyBox = {
|
|||
}),
|
||||
load: (function(pParent){
|
||||
return function(){
|
||||
var ljsLoad_f = function(){
|
||||
CloudCommander.jsload(
|
||||
'http://fancyapps.com/fancybox/source/jquery.fancybox.pack.js',{
|
||||
onerror: (function(){
|
||||
var ljsLoad_f = function(){
|
||||
var lSrc = 'http://fancyapps.com/fancybox/source/jquery.fancybox.pack.js';
|
||||
|
||||
CloudCommander.jsload(lSrc,{
|
||||
onerror: (function(){
|
||||
pParent.removeNotLoaded(lSrc, pParent);
|
||||
|
||||
CloudCommander.jsload(pParent.dir +
|
||||
'jquery.fancybox.pack.js');
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
var lSrc = 'http://fancyapps.com/fancybox/source/jquery.fancybox.css';
|
||||
|
||||
CloudCommander.cssLoad({
|
||||
src : 'http://fancyapps.com/fancybox/source/jquery.fancybox.css',
|
||||
src : lSrc,
|
||||
func : {
|
||||
onload: ljsLoad_f,
|
||||
onerror: (function(){
|
||||
onerror: (function(){
|
||||
pParent.removeNotLoaded(lSrc, pParent);
|
||||
|
||||
CloudCommander.cssLoad({
|
||||
src : pParent.dir +'jquery.fancybox.css',
|
||||
func : ljsLoad_f
|
||||
|
|
@ -93,9 +100,20 @@ CloudCommander.Viewer.FancyBox = {
|
|||
console.log(pError);
|
||||
}
|
||||
},
|
||||
getById : function(pId){return document.getElementById(pId);},
|
||||
getByClass : function(pClass){
|
||||
getById : function(pId){return document.getElementById(pId);},
|
||||
|
||||
getByClass : function(pClass){
|
||||
return document.getElementsByClassName(pClass);
|
||||
},
|
||||
|
||||
removeNotLoaded : function(pSrc, pParent){
|
||||
/* removing already loaded element
|
||||
* with same id
|
||||
*/
|
||||
var lId = CloudFunc.getIdBySrc(pSrc);
|
||||
lId = pParent.getById(lId);
|
||||
lId &&
|
||||
document.removeChild(lId);
|
||||
}
|
||||
};
|
||||
CloudCommander.Viewer.Keys = (function(){
|
||||
|
|
|
|||
|
|
@ -268,6 +268,19 @@ CloudFunc._getDirPath=function(url)
|
|||
return lHtmlPath;
|
||||
};
|
||||
|
||||
/*
|
||||
* Function gets id by src
|
||||
* from http://domain.com/1.js to
|
||||
* 1_js
|
||||
*/
|
||||
CloudFunc._getIdBySrc = function(pSrc){
|
||||
var lID=pSrc.replace(pSrc.substr(pSrc,
|
||||
pSrc.lastIndexOf('/')+1),
|
||||
'');
|
||||
/* убираем точку*/
|
||||
return lID.replace('.','_');
|
||||
};
|
||||
|
||||
/*
|
||||
* Функция ищет в имени файла расширение
|
||||
* и если находит возвращает true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue