mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactoring
This commit is contained in:
parent
6595a72b9b
commit
e3d16a3da5
2 changed files with 23 additions and 21 deletions
|
|
@ -347,11 +347,12 @@ CloudClient.Util = (function(){
|
|||
element.onerror = (function(){
|
||||
(pParams_o.parent || document.body)
|
||||
.removeChild(element);
|
||||
|
||||
|
||||
Util.Images.showError({
|
||||
responseText: 'file ' +
|
||||
lSrc +
|
||||
' could not be loaded'
|
||||
' could not be loaded',
|
||||
status : 404
|
||||
});
|
||||
|
||||
if(lFunc && lFunc.onerror &&
|
||||
|
|
|
|||
|
|
@ -3,28 +3,27 @@ var CloudCommander, CloudFunc, $;
|
|||
* https://github.com/fancyapps/fancyBox
|
||||
*/
|
||||
(function(){
|
||||
var cloudcmd = CloudCommander;
|
||||
var Util = cloudcmd.Util;
|
||||
var KeyBinding = cloudcmd.KeyBinding;
|
||||
var cloudcmd = CloudCommander;
|
||||
var Util = cloudcmd.Util;
|
||||
var KeyBinding = cloudcmd.KeyBinding;
|
||||
|
||||
CloudCommander.Viewer = {
|
||||
CloudCommander.Viewer = {
|
||||
get: (function(){
|
||||
return this.FancyBox;
|
||||
})
|
||||
};
|
||||
|
||||
CloudCommander.Viewer.FancyBox = {};
|
||||
var FancyBox = {};
|
||||
|
||||
CloudCommander.Viewer.dir = './lib/client/viewer/';
|
||||
CloudCommander.Viewer.FancyBox.dir = CloudCommander.Viewer.dir +
|
||||
'fancybox/';
|
||||
cloudcmd.Viewer.dir = './lib/client/viewer/';
|
||||
FancyBox.dir = cloudcmd.Viewer.dir + 'fancybox/';
|
||||
|
||||
/* function return configureation
|
||||
* for FancyBox open and
|
||||
* onclick (it shoud be
|
||||
* different objects)
|
||||
*/
|
||||
CloudCommander.Viewer.FancyBox.getConfig = (function(){
|
||||
FancyBox.getConfig = (function(){
|
||||
return{
|
||||
/* function do her work
|
||||
* before FauncyBox shows
|
||||
|
|
@ -63,7 +62,7 @@ var CloudCommander, CloudFunc, $;
|
|||
* @pParent - this
|
||||
* @pCallBack - executes, when everything loaded
|
||||
*/
|
||||
CloudCommander.Viewer.FancyBox.load = (function(pThis, pCallBack){
|
||||
FancyBox.load = (function(pThis, pCallBack){
|
||||
Util.jqueryLoad();
|
||||
|
||||
var ljsLoad_f = function(){
|
||||
|
|
@ -95,7 +94,7 @@ var CloudCommander, CloudFunc, $;
|
|||
});
|
||||
|
||||
|
||||
CloudCommander.Viewer.FancyBox.loadData = (function(pA){
|
||||
FancyBox.loadData = (function(pA){
|
||||
Util.Images.showLoad();
|
||||
|
||||
var lThis = this;
|
||||
|
|
@ -129,7 +128,7 @@ var CloudCommander, CloudFunc, $;
|
|||
});
|
||||
|
||||
|
||||
CloudCommander.Viewer.FancyBox.set = (function(){
|
||||
FancyBox.set = (function(){
|
||||
if(Util.getByClass('fancybox').length)
|
||||
return;
|
||||
try{
|
||||
|
|
@ -170,8 +169,8 @@ var CloudCommander, CloudFunc, $;
|
|||
});
|
||||
|
||||
|
||||
CloudCommander.Viewer.FancyBox.show = (function(pCurrentFile){
|
||||
CloudCommander.Viewer.FancyBox.set();
|
||||
FancyBox.show = (function(pCurrentFile){
|
||||
FancyBox.set();
|
||||
|
||||
var lConfig = this.getConfig();
|
||||
|
||||
|
|
@ -192,7 +191,7 @@ var CloudCommander, CloudFunc, $;
|
|||
Util.Images.hideLoad();
|
||||
});
|
||||
|
||||
CloudCommander.Viewer.Keys = (function(pCurrentFile){
|
||||
cloudcmd.Viewer.Keys = (function(pCurrentFile){
|
||||
"use strict";
|
||||
|
||||
var lCallBack_f = (function(){
|
||||
|
|
@ -200,10 +199,10 @@ var CloudCommander, CloudFunc, $;
|
|||
/* если клавиши можно обрабатывать */
|
||||
if( KeyBinding.get() )
|
||||
/* if f3 pressed */
|
||||
if(pEvent.keyCode === CloudCommander.KEY.F3 &&
|
||||
if(pEvent.keyCode === cloudcmd.KEY.F3 &&
|
||||
pEvent.shiftKey){
|
||||
var lCurrentFile = Util.getCurrentFile();
|
||||
CloudCommander.Viewer.FancyBox.show(lCurrentFile);
|
||||
FancyBox.show(lCurrentFile);
|
||||
|
||||
pEvent.preventDefault();
|
||||
}
|
||||
|
|
@ -227,10 +226,12 @@ var CloudCommander, CloudFunc, $;
|
|||
}
|
||||
|
||||
/* showing images preview*/
|
||||
CloudCommander.Viewer.FancyBox.show(pCurrentFile);
|
||||
FancyBox.show(pCurrentFile);
|
||||
Util.Images.hideLoad();
|
||||
});
|
||||
|
||||
CloudCommander.Viewer.FancyBox.load(this.FancyBox, lCallBack_f);
|
||||
FancyBox.load(this.FancyBox, lCallBack_f);
|
||||
});
|
||||
|
||||
cloudcmd.Viewer.FancyBox = FancyBox;
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue