mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-18 17:05:17 +00:00
changed version of FuncyBox to 2.1.0
This commit is contained in:
parent
6351631d36
commit
eebe33e398
6 changed files with 325 additions and 205 deletions
|
|
@ -48,9 +48,8 @@ var CloudCommander, CloudFunc, $;
|
|||
height : window.innerHeight,
|
||||
helpers : {
|
||||
overlay : {
|
||||
opacity: 0.1,
|
||||
css : {
|
||||
'background-color' : '#fff'
|
||||
'background' : 'rgba(255, 255, 255, 0.1)'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
FancyBox licensed under Creative Commons Attribution-NonCommercial 3.0 license.
|
||||
You are free to use fancyBox for your personal or non-profit website projects.
|
||||
You can get the author's permission to use fancyBox for commercial websites by
|
||||
paying a fee.
|
||||
|
||||
http://www.fancyapps.com/fancybox/#license
|
||||
|
|
@ -29,7 +29,8 @@
|
|||
|
||||
beforeLoad: function (opts, obj) {
|
||||
//Remove self if gallery do not have at least two items
|
||||
if (obj.group.length < 2) {
|
||||
|
||||
if (opts.skipSingle && obj.group.length < 2) {
|
||||
obj.helpers.buttons = false;
|
||||
obj.closeBtn = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*!
|
||||
/*!
|
||||
* Media helper for fancyBox
|
||||
* version: 1.0.3
|
||||
* version: 1.0.3 (Mon, 13 Aug 2012)
|
||||
* @requires fancyBox v2.0 or later
|
||||
*
|
||||
* Usage:
|
||||
|
|
@ -15,13 +15,26 @@
|
|||
* helpers : {
|
||||
* media: {
|
||||
* youtube : {
|
||||
* autoplay : 0
|
||||
* params : {
|
||||
* autoplay : 0
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* Or:
|
||||
* $(".fancybox").fancybox({,
|
||||
* helpers : {
|
||||
* media: true
|
||||
* },
|
||||
* youtube : {
|
||||
* autoplay: 0
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* Supports:
|
||||
*
|
||||
* Youtube
|
||||
* http://www.youtube.com/watch?v=opj24KnzrWo
|
||||
* http://youtu.be/opj24KnzrWo
|
||||
|
|
@ -29,6 +42,7 @@
|
|||
* http://vimeo.com/40648169
|
||||
* http://vimeo.com/channels/staffpicks/38843628
|
||||
* http://vimeo.com/groups/surrealism/videos/36516384
|
||||
* http://player.vimeo.com/video/45074303
|
||||
* Metacafe
|
||||
* http://www.metacafe.com/watch/7635964/dr_seuss_the_lorax_movie_trailer/
|
||||
* http://www.metacafe.com/watch/7635964/
|
||||
|
|
@ -59,7 +73,7 @@
|
|||
}
|
||||
|
||||
$.each(rez, function(key, value) {
|
||||
url = url.replace( '$' + key, value );
|
||||
url = url.replace( '$' + key, value || '' );
|
||||
});
|
||||
|
||||
if (params.length) {
|
||||
|
|
@ -71,9 +85,9 @@
|
|||
|
||||
//Add helper object
|
||||
F.helpers.media = {
|
||||
defaults : {
|
||||
types : {
|
||||
youtube : {
|
||||
matcher : /(youtube\.com|youtu\.be)\/(v\/|u\/|embed\/|watch\?v=)?([^#\&\?]*).*/i,
|
||||
matcher : /(youtube\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed)?([\w-]{11}|\?listType=(.*)&list=(.*)).*/i,
|
||||
params : {
|
||||
autoplay : 1,
|
||||
autohide : 1,
|
||||
|
|
@ -87,7 +101,7 @@
|
|||
url : '//www.youtube.com/embed/$3'
|
||||
},
|
||||
vimeo : {
|
||||
matcher : /(vimeo.com|vimeopro.com)\/((.*)\/(.*)\/)?(\d+)\/?(.*)/,
|
||||
matcher : /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/,
|
||||
params : {
|
||||
autoplay : 1,
|
||||
hd : 1,
|
||||
|
|
@ -98,7 +112,7 @@
|
|||
fullscreen : 1
|
||||
},
|
||||
type : 'iframe',
|
||||
url : '//player.vimeo.com/video/$5'
|
||||
url : '//player.vimeo.com/video/$1'
|
||||
},
|
||||
metacafe : {
|
||||
matcher : /metacafe.com\/(?:watch|fplayer)\/([\w\-]{1,10})/,
|
||||
|
|
@ -150,26 +164,23 @@
|
|||
|
||||
beforeLoad : function(opts, obj) {
|
||||
var url = obj.href || '',
|
||||
types = $.extend(true, {}, this.defaults, opts || {}),
|
||||
type = false,
|
||||
what,
|
||||
item,
|
||||
rez,
|
||||
params;
|
||||
|
||||
for (what in types) {
|
||||
if (types.hasOwnProperty(what)){
|
||||
item = types[ what ];
|
||||
rez = url.match( item.matcher );
|
||||
for (what in this.types) {
|
||||
item = this.types[ what ];
|
||||
rez = url.match( item.matcher );
|
||||
|
||||
if (rez) {
|
||||
type = item.type;
|
||||
params = item.params || null;
|
||||
if (rez) {
|
||||
type = item.type;
|
||||
params = $.extend(true, {}, item.params, obj[ what ] || ($.isPlainObject(opts[ what ]) ? opts[ what ].params : null));
|
||||
|
||||
url = $.type( item.url ) === "function" ? item.url.call( this, rez, params, obj ) : format( item.url, rez, params );
|
||||
url = $.type( item.url ) === "function" ? item.url.call( this, rez, params, obj ) : format( item.url, rez, params );
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
17
lib/client/viewer/fancybox/jquery.fancybox.css
vendored
17
lib/client/viewer/fancybox/jquery.fancybox.css
vendored
|
|
@ -1,4 +1,4 @@
|
|||
/*! fancyBox v2.0.6 fancyapps.com | fancyapps.com/fancybox/#license */
|
||||
/*! fancyBox v2.1.0 fancyapps.com | fancyapps.com/fancybox/#license */
|
||||
.fancybox-wrap,
|
||||
.fancybox-skin,
|
||||
.fancybox-outer,
|
||||
|
|
@ -161,22 +161,31 @@
|
|||
|
||||
/* Overlay helper */
|
||||
|
||||
#fancybox-overlay {
|
||||
.fancybox-lock {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.fancybox-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
overflow: hidden;
|
||||
display: none;
|
||||
z-index: 8010;
|
||||
background: #000;
|
||||
background: url('fancybox_overlay.png');
|
||||
}
|
||||
|
||||
#fancybox-overlay.overlay-fixed {
|
||||
.fancybox-overlay-fixed {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.fancybox-lock .fancybox-overlay {
|
||||
overflow: auto;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
/* Title helper */
|
||||
|
||||
.fancybox-title {
|
||||
|
|
|
|||
452
lib/client/viewer/fancybox/jquery.fancybox.js
vendored
452
lib/client/viewer/fancybox/jquery.fancybox.js
vendored
|
|
@ -1,6 +1,6 @@
|
|||
/*!
|
||||
* fancyBox - jQuery Plugin
|
||||
* version: 2.0.6 (Thu, 19 Jul 2012)
|
||||
* version: 2.1.0 (Mon, 20 Aug 2012)
|
||||
* @requires jQuery v1.6 or later
|
||||
*
|
||||
* Examples at http://fancyapps.com/fancybox/
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
F = $.fancybox = function () {
|
||||
F.open.apply( this, arguments );
|
||||
},
|
||||
didUpdate = false,
|
||||
didUpdate = null,
|
||||
isTouch = document.createTouch !== undefined,
|
||||
|
||||
isQuery = function(obj) {
|
||||
|
|
@ -34,11 +34,13 @@
|
|||
return (el && !(el.style.overflow && el.style.overflow === 'hidden') && ((el.clientWidth && el.scrollWidth > el.clientWidth) || (el.clientHeight && el.scrollHeight > el.clientHeight)));
|
||||
},
|
||||
getScalar = function(value, dim) {
|
||||
var value_ = parseInt(value, 10);
|
||||
|
||||
if (dim && isPercentage(value)) {
|
||||
value = F.getViewport()[ dim ] / 100 * parseInt(value, 10);
|
||||
value_ = F.getViewport()[ dim ] / 100 * value_;
|
||||
}
|
||||
|
||||
return Math.ceil(value);
|
||||
return Math.ceil(value_);
|
||||
},
|
||||
getValue = function(value, dim) {
|
||||
return getScalar(value, dim) + 'px';
|
||||
|
|
@ -46,7 +48,7 @@
|
|||
|
||||
$.extend(F, {
|
||||
// The current version of fancyBox
|
||||
version: '2.0.6',
|
||||
version: '2.1.0',
|
||||
|
||||
defaults: {
|
||||
padding : 15,
|
||||
|
|
@ -68,8 +70,8 @@
|
|||
fitToView : true,
|
||||
aspectRatio : false,
|
||||
topRatio : 0.5,
|
||||
leftRatio : 0.5,
|
||||
|
||||
fixed : false,
|
||||
scrolling : 'auto', // 'auto', 'yes' or 'no'
|
||||
wrapCSS : '',
|
||||
|
||||
|
|
@ -100,16 +102,16 @@
|
|||
|
||||
keys : {
|
||||
next : {
|
||||
13 : 'right', // enter
|
||||
34 : 'down', // page down
|
||||
39 : 'right', // right arrow
|
||||
40 : 'down' // down arrow
|
||||
13 : 'left', // enter
|
||||
34 : 'up', // page down
|
||||
39 : 'left', // right arrow
|
||||
40 : 'up' // down arrow
|
||||
},
|
||||
prev : {
|
||||
8 : 'left', // backspace
|
||||
33 : 'up', // page up
|
||||
37 : 'left', // left arrow
|
||||
38 : 'up' // up arrow
|
||||
8 : 'right', // backspace
|
||||
33 : 'down', // page up
|
||||
37 : 'right', // left arrow
|
||||
38 : 'down' // up arrow
|
||||
},
|
||||
close : [27], // escape key
|
||||
play : [32], // space - start/stop slideshow
|
||||
|
|
@ -117,10 +119,12 @@
|
|||
},
|
||||
|
||||
direction : {
|
||||
next: 'right',
|
||||
prev: 'left'
|
||||
next : 'left',
|
||||
prev : 'right'
|
||||
},
|
||||
|
||||
scrollOutside : true,
|
||||
|
||||
// Override some properties
|
||||
index : 0,
|
||||
type : null,
|
||||
|
|
@ -130,13 +134,13 @@
|
|||
|
||||
// HTML templates
|
||||
tpl: {
|
||||
wrap : '<div class="fancybox-wrap"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',
|
||||
wrap : '<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',
|
||||
image : '<img class="fancybox-image" src="{href}" alt="" />',
|
||||
iframe : '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0"' + ($.browser.msie ? ' allowtransparency="true"' : '') + '></iframe>',
|
||||
error : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',
|
||||
closeBtn : '<div title="Close" class="fancybox-item fancybox-close"></div>',
|
||||
next : '<a title="Next" class="fancybox-nav fancybox-next"><span></span></a>',
|
||||
prev : '<a title="Previous" class="fancybox-nav fancybox-prev"><span></span></a>'
|
||||
closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',
|
||||
next : '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
|
||||
prev : '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
|
||||
},
|
||||
|
||||
// Properties for each animation type
|
||||
|
|
@ -169,13 +173,10 @@
|
|||
// Enabled helpers
|
||||
helpers : {
|
||||
overlay : {
|
||||
speedIn : 0,
|
||||
speedOut : 250,
|
||||
opacity : 0.8,
|
||||
css : {
|
||||
cursor : 'pointer'
|
||||
},
|
||||
closeClick: true
|
||||
closeClick : true,
|
||||
speedOut : 200,
|
||||
showEarly : true,
|
||||
css : {}
|
||||
},
|
||||
title : {
|
||||
type : 'float' // 'float', 'inside', 'outside' or 'over'
|
||||
|
|
@ -230,10 +231,14 @@
|
|||
return;
|
||||
}
|
||||
|
||||
opts = $.isPlainObject(opts) ? opts : {};
|
||||
if (!$.isPlainObject(opts)) {
|
||||
opts = {};
|
||||
}
|
||||
|
||||
// Close if already active
|
||||
F.close(true);
|
||||
if (false === F.close(true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Normalize group
|
||||
if (!$.isArray(group)) {
|
||||
|
|
@ -355,7 +360,7 @@
|
|||
|
||||
F.group = group;
|
||||
|
||||
return F._start(F.opts.index || 0);
|
||||
return F._start(F.opts.index);
|
||||
},
|
||||
|
||||
// Cancel image loading or abort ajax request
|
||||
|
|
@ -368,12 +373,6 @@
|
|||
|
||||
F.hideLoading();
|
||||
|
||||
if (coming.wrap) {
|
||||
coming.wrap.stop().trigger('onReset').remove();
|
||||
}
|
||||
|
||||
F.coming = null;
|
||||
|
||||
if (F.ajaxLoad) {
|
||||
F.ajaxLoad.abort();
|
||||
}
|
||||
|
|
@ -383,20 +382,31 @@
|
|||
if (F.imgPreload) {
|
||||
F.imgPreload.onload = F.imgPreload.onerror = null;
|
||||
}
|
||||
|
||||
// If the first item has been canceled, then clear everything
|
||||
if (coming.wrap) {
|
||||
coming.wrap.stop(true).trigger('onReset').remove();
|
||||
}
|
||||
|
||||
if (!F.current) {
|
||||
F.trigger('afterClose');
|
||||
}
|
||||
|
||||
F.coming = null;
|
||||
},
|
||||
|
||||
// Start closing animation if is open; remove immediately if opening/closing
|
||||
close: function (immediately) {
|
||||
F.cancel();
|
||||
|
||||
if (!F.current || false === F.trigger('beforeClose')) {
|
||||
if (false === F.trigger('beforeClose')) {
|
||||
return;
|
||||
}
|
||||
|
||||
F.unbindEvents();
|
||||
|
||||
if (!F.isOpen || immediately === true) {
|
||||
$('.fancybox-wrap').stop().trigger('onReset').remove();
|
||||
$('.fancybox-wrap').stop(true).trigger('onReset').remove();
|
||||
|
||||
F._afterZoomOut();
|
||||
|
||||
|
|
@ -406,7 +416,7 @@
|
|||
|
||||
$('.fancybox-item, .fancybox-nav').remove();
|
||||
|
||||
F.wrap.stop(true).removeClass('fancybox-opened');
|
||||
F.wrap.stop(true, true).removeClass('fancybox-opened');
|
||||
|
||||
if (F.wrap.css('position') === 'fixed') {
|
||||
F.wrap.css(F._getPosition( true ));
|
||||
|
|
@ -497,9 +507,9 @@
|
|||
return;
|
||||
}
|
||||
|
||||
index = parseInt(index, 10);
|
||||
index = getScalar(index);
|
||||
|
||||
F.direction = direction || (index > current.index ? 'right' : 'left');
|
||||
F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ];
|
||||
F.router = router || 'jumpto';
|
||||
|
||||
if (current.loop) {
|
||||
|
|
@ -536,8 +546,8 @@
|
|||
},
|
||||
|
||||
update: function (e) {
|
||||
var anyway = !e || (e && e.type === 'orientationchange'),
|
||||
scroll = e && e.type === 'scroll';
|
||||
var type = (e && e.type),
|
||||
anyway = !type || type === 'orientationchange';
|
||||
|
||||
if (anyway) {
|
||||
clearTimeout(didUpdate);
|
||||
|
|
@ -549,8 +559,8 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// Touch devices need some help to restore document dimensions
|
||||
if (anyway && isTouch) {
|
||||
// Help browser to restore document dimensions
|
||||
if (anyway || isTouch) {
|
||||
F.wrap.removeAttr('style').addClass('fancybox-tmp');
|
||||
|
||||
F.trigger('onUpdate');
|
||||
|
|
@ -559,27 +569,25 @@
|
|||
didUpdate = setTimeout(function() {
|
||||
var current = F.current;
|
||||
|
||||
didUpdate = null;
|
||||
|
||||
if (!current) {
|
||||
return;
|
||||
}
|
||||
|
||||
F.wrap.removeClass('fancybox-tmp');
|
||||
|
||||
if ((current.autoResize && !scroll) || anyway) {
|
||||
if (type !== 'scroll') {
|
||||
F._setDimension();
|
||||
|
||||
F.trigger('onUpdate');
|
||||
}
|
||||
|
||||
if ((current.autoCenter && !(scroll && current.canShrink)) || anyway) {
|
||||
if (!(type === 'scroll' && current.canShrink)) {
|
||||
F.reposition(e);
|
||||
}
|
||||
|
||||
F.trigger('onUpdate');
|
||||
|
||||
}, (anyway ? 20 : 300));
|
||||
didUpdate = null;
|
||||
|
||||
}, (isTouch ? 500 : (anyway ? 20 : 300)));
|
||||
},
|
||||
|
||||
// Shrink content to fit inside viewport or restore if resized
|
||||
|
|
@ -612,7 +620,7 @@
|
|||
|
||||
el = $('<div id="fancybox-loading"><div></div></div>').click(F.cancel).appendTo('body');
|
||||
|
||||
if (F.coming && !F.coming.fixed) {
|
||||
if (!F.defaults.fixed) {
|
||||
viewport = F.getViewport();
|
||||
|
||||
el.css({
|
||||
|
|
@ -624,13 +632,23 @@
|
|||
},
|
||||
|
||||
getViewport: function () {
|
||||
// See http://bugs.jquery.com/ticket/6724
|
||||
return {
|
||||
x: W.scrollLeft(),
|
||||
y: W.scrollTop(),
|
||||
w: isTouch && window.innerWidth ? window.innerWidth : W.width(),
|
||||
h: isTouch && window.innerHeight ? window.innerHeight : W.height()
|
||||
};
|
||||
var lock = F.current ? F.current.locked : false,
|
||||
rez = {
|
||||
x: W.scrollLeft(),
|
||||
y: W.scrollTop()
|
||||
};
|
||||
|
||||
if (lock) {
|
||||
rez.w = lock[0].clientWidth;
|
||||
rez.h = lock[0].clientHeight;
|
||||
|
||||
} else {
|
||||
// See http://bugs.jquery.com/ticket/6724
|
||||
rez.w = isTouch && window.innerWidth ? window.innerWidth : W.width();
|
||||
rez.h = isTouch && window.innerHeight ? window.innerHeight : W.height();
|
||||
}
|
||||
|
||||
return rez;
|
||||
},
|
||||
|
||||
// Unbind the keyboard / clicking actions
|
||||
|
|
@ -651,7 +669,9 @@
|
|||
return;
|
||||
}
|
||||
|
||||
W.bind('resize.fb orientationchange.fb' + (current.autoCenter && !current.fixed ? ' scroll.fb' : ''), F.update);
|
||||
// Changing document height on iOS devices triggers a 'resize' event,
|
||||
// that can change document height... repeating infinitely
|
||||
W.bind('orientationchange.fb' + (isTouch ? '' : ' resize.fb' ) + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update);
|
||||
|
||||
keys = current.keys;
|
||||
|
||||
|
|
@ -699,16 +719,13 @@
|
|||
if (delta !== 0 && !canScroll) {
|
||||
if (F.group.length > 1 && !current.canShrink) {
|
||||
if (deltaY > 0 || deltaX > 0) {
|
||||
F.prev( deltaY > 0 ? 'up' : 'left' );
|
||||
F.prev( deltaY > 0 ? 'down' : 'left' );
|
||||
|
||||
} else if (deltaY < 0 || deltaX < 0) {
|
||||
F.next( deltaY < 0 ? 'down' : 'right' );
|
||||
F.next( deltaY < 0 ? 'up' : 'right' );
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
|
||||
} else if (F.wrap.css('position') === 'fixed') {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -716,7 +733,7 @@
|
|||
},
|
||||
|
||||
trigger: function (event, o) {
|
||||
var ret, obj = o || F[ $.inArray(event, ['onCancel', 'beforeLoad', 'afterLoad']) > -1 ? 'coming' : 'current' ];
|
||||
var ret, obj = o || F.coming || F.current;
|
||||
|
||||
if (!obj) {
|
||||
return;
|
||||
|
|
@ -730,6 +747,10 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
if (event === 'onCancel' && !F.isOpened) {
|
||||
F.isActive = false;
|
||||
}
|
||||
|
||||
if (obj.helpers) {
|
||||
$.each(obj.helpers, function (helper, opts) {
|
||||
if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) {
|
||||
|
|
@ -751,12 +772,15 @@
|
|||
|
||||
_start: function (index) {
|
||||
var coming = {},
|
||||
obj = F.group[ index ] || null,
|
||||
obj,
|
||||
href,
|
||||
type,
|
||||
margin,
|
||||
padding;
|
||||
|
||||
index = getScalar( index );
|
||||
obj = F.group[ index ] || null;
|
||||
|
||||
if (!obj) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -786,9 +810,6 @@
|
|||
keys : null,
|
||||
helpers: {
|
||||
overlay : {
|
||||
css: {
|
||||
cursor : 'auto'
|
||||
},
|
||||
closeClick : false
|
||||
}
|
||||
}
|
||||
|
|
@ -823,6 +844,7 @@
|
|||
|
||||
if (false === F.trigger('beforeLoad')) {
|
||||
F.coming = null;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -870,6 +892,8 @@
|
|||
coming.skin.css('padding' + v, getValue(coming.padding[ i ]));
|
||||
});
|
||||
|
||||
F.trigger('onReady');
|
||||
|
||||
// Check before try to load; 'inline' and 'html' types need content, others - href
|
||||
if (type === 'inline' || type === 'html') {
|
||||
if (!coming.content || !coming.content.length) {
|
||||
|
|
@ -969,20 +993,25 @@
|
|||
// This helps IE
|
||||
$(coming.wrap).bind('onReset', function () {
|
||||
try {
|
||||
iframe.hide().parent().empty();
|
||||
$(this).find('iframe').hide().attr('src', '//about:blank').end().empty();
|
||||
} catch (e) {}
|
||||
});
|
||||
|
||||
if (coming.iframe.preload) {
|
||||
F.showLoading();
|
||||
|
||||
iframe.bind('load', function() {
|
||||
$(this).unbind().bind('load.fb', F.update).data('ready', 1);
|
||||
iframe.one('load', function() {
|
||||
$(this).data('ready', 1);
|
||||
|
||||
// iOS will lose scrolling if we resize
|
||||
if (!isTouch) {
|
||||
$(this).bind('load.fb', F.update);
|
||||
}
|
||||
|
||||
// Without this trick:
|
||||
// - iframe won't scroll on iOS devices
|
||||
// - IE7 sometimes displays empty iframe
|
||||
F.coming.wrap.removeClass('fancybox-tmp').show();
|
||||
$(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show();
|
||||
|
||||
F._afterLoad();
|
||||
});
|
||||
|
|
@ -1013,8 +1042,9 @@
|
|||
},
|
||||
|
||||
_afterLoad: function () {
|
||||
var coming = F.coming,
|
||||
previous = F.current,
|
||||
var coming = F.coming,
|
||||
previous = F.current,
|
||||
placeholder = 'fancybox-placeholder',
|
||||
current,
|
||||
content,
|
||||
type,
|
||||
|
|
@ -1024,8 +1054,12 @@
|
|||
|
||||
F.hideLoading();
|
||||
|
||||
if (!coming || false === F.trigger('afterLoad', coming, previous)) {
|
||||
F.coming.wrap.stop().trigger('onReset').remove();
|
||||
if (!coming || F.isActive === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (false === F.trigger('afterLoad', coming, previous)) {
|
||||
coming.wrap.stop(true).trigger('onReset').remove();
|
||||
|
||||
F.coming = null;
|
||||
|
||||
|
|
@ -1070,10 +1104,16 @@
|
|||
content = $('<div>').html(content).find(current.selector);
|
||||
|
||||
} else if (isQuery(content)) {
|
||||
if (!content.data(placeholder)) {
|
||||
content.data(placeholder, $('<div class="' + placeholder + '"></div>').insertAfter( content ).hide() );
|
||||
}
|
||||
|
||||
content = content.show().detach();
|
||||
|
||||
current.wrap.bind('onReset', function () {
|
||||
$(this).find('.fancybox-inner').children().appendTo( current.parent ).hide();
|
||||
if ($(this).find(content).length) {
|
||||
content.hide().replaceAll( content.data(placeholder) ).data(placeholder, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
|
|
@ -1095,20 +1135,21 @@
|
|||
break;
|
||||
}
|
||||
|
||||
if (!(current.type === 'iframe' && current.iframe.preload)) {
|
||||
current.inner.append(content);
|
||||
if (!(isQuery(content) && content.parent().is(current.inner))) {
|
||||
current.inner.append( content );
|
||||
}
|
||||
|
||||
// Give a chance for helpers or callbacks to update elements
|
||||
F.trigger('beforeShow');
|
||||
|
||||
// Set scrolling before calculating dimensions
|
||||
current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling));
|
||||
|
||||
// Set initial dimensions and start position
|
||||
F._setDimension();
|
||||
|
||||
current.wrap.removeClass('fancybox-tmp');
|
||||
|
||||
current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling));
|
||||
|
||||
current.pos = $.extend({}, current.dim, F._getPosition( true ));
|
||||
|
||||
F.isOpen = false;
|
||||
|
|
@ -1117,7 +1158,7 @@
|
|||
F.bindEvents();
|
||||
|
||||
if (!F.isOpened) {
|
||||
$('.fancybox-wrap').not( current.wrap ).stop().trigger('onReset').remove();
|
||||
$('.fancybox-wrap').not( current.wrap ).stop(true).trigger('onReset').remove();
|
||||
|
||||
} else if (previous.prevMethod) {
|
||||
F.transitions[ previous.prevMethod ]();
|
||||
|
|
@ -1144,7 +1185,7 @@
|
|||
maxWidth = current.maxWidth,
|
||||
maxHeight = current.maxHeight,
|
||||
scrolling = current.scrolling,
|
||||
scrollOut = current.scrollOutside,
|
||||
scrollOut = current.scrollOutside ? current.scrollbarWidth : 0,
|
||||
margin = current.margin,
|
||||
wMargin = margin[1] + margin[3],
|
||||
hMargin = margin[0] + margin[2],
|
||||
|
|
@ -1174,8 +1215,8 @@
|
|||
wSpace = wMargin + wPadding;
|
||||
hSpace = hMargin + hPadding;
|
||||
|
||||
origWidth = isPercentage(width) ? (viewport.w - wSpace) * parseFloat(width) / 100 : width;
|
||||
origHeight = isPercentage(height) ? (viewport.h - hSpace) * parseFloat(height) / 100 : height;
|
||||
origWidth = isPercentage(width) ? (viewport.w - wSpace) * getScalar(width) / 100 : width;
|
||||
origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height;
|
||||
|
||||
if (current.type === 'iframe') {
|
||||
iframe = current.content;
|
||||
|
|
@ -1200,6 +1241,15 @@
|
|||
} else if (current.autoWidth || current.autoHeight) {
|
||||
inner.addClass( 'fancybox-tmp' );
|
||||
|
||||
// Set width or height in case we need to calculate only one dimension
|
||||
if (!current.autoWidth) {
|
||||
inner.width( origWidth );
|
||||
}
|
||||
|
||||
if (!current.autoHeight) {
|
||||
inner.height( origHeight );
|
||||
}
|
||||
|
||||
if (current.autoWidth) {
|
||||
origWidth = inner.width();
|
||||
}
|
||||
|
|
@ -1344,20 +1394,20 @@
|
|||
height = F.wrap.height() + margin[0] + margin[2],
|
||||
rez = {
|
||||
position: 'absolute',
|
||||
top : margin[0] + viewport.y,
|
||||
left : margin[3] + viewport.x
|
||||
};
|
||||
|
||||
if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) {
|
||||
rez = {
|
||||
position: 'fixed',
|
||||
top : margin[0],
|
||||
left : margin[3]
|
||||
};
|
||||
|
||||
if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) {
|
||||
rez.position = 'fixed';
|
||||
|
||||
} else if (!current.locked) {
|
||||
rez.top += viewport.y;
|
||||
rez.left += viewport.x;
|
||||
}
|
||||
|
||||
rez.top = getValue(Math.max(rez.top, rez.top + ((viewport.h - height) * current.topRatio)));
|
||||
rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width) * 0.5)));
|
||||
rez.top = getValue(Math.max(rez.top, rez.top + ((viewport.h - height) * current.topRatio)));
|
||||
rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width) * current.leftRatio)));
|
||||
|
||||
return rez;
|
||||
},
|
||||
|
|
@ -1402,8 +1452,11 @@
|
|||
|
||||
F.trigger('afterShow');
|
||||
|
||||
// Start slideshow
|
||||
if (F.opts.autoPlay && !F.player.isActive) {
|
||||
// Stop the slideshow if this is the last item
|
||||
if (!current.loop && current.index === current.group.length - 1) {
|
||||
F.play( false );
|
||||
|
||||
} else if (F.opts.autoPlay && !F.player.isActive) {
|
||||
F.opts.autoPlay = false;
|
||||
|
||||
F.play();
|
||||
|
|
@ -1413,7 +1466,7 @@
|
|||
_afterZoomOut: function () {
|
||||
var current = F.current;
|
||||
|
||||
F.wrap.trigger('onReset').remove();
|
||||
$('.fancybox-wrap').stop(true).trigger('onReset').remove();
|
||||
|
||||
$.extend(F, {
|
||||
group : {},
|
||||
|
|
@ -1442,15 +1495,15 @@
|
|||
getOrigPosition: function () {
|
||||
var current = F.current,
|
||||
element = current.element,
|
||||
orig = $(current.orig),
|
||||
orig = current.orig,
|
||||
pos = {},
|
||||
width = 50,
|
||||
height = 50,
|
||||
hPadding = current.hPadding,
|
||||
wPadding = current.wPadding,
|
||||
viewport;
|
||||
viewport = F.getViewport();
|
||||
|
||||
if (!orig.length && current.isDom && element.is(':visible')) {
|
||||
if (!orig && current.isDom && element.is(':visible')) {
|
||||
orig = element.find('img:first');
|
||||
|
||||
if (!orig.length) {
|
||||
|
|
@ -1458,7 +1511,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
if (orig.length) {
|
||||
if (isQuery(orig)) {
|
||||
pos = orig.offset();
|
||||
|
||||
if (orig.is('img')) {
|
||||
|
|
@ -1467,15 +1520,18 @@
|
|||
}
|
||||
|
||||
} else {
|
||||
viewport = F.getViewport();
|
||||
pos.top = viewport.y + (viewport.h - height) * current.topRatio;
|
||||
pos.left = viewport.x + (viewport.w - width) * current.leftRatio;
|
||||
}
|
||||
|
||||
pos.top = viewport.y + (viewport.h - height) * 0.5;
|
||||
pos.left = viewport.x + (viewport.w - width) * 0.5;
|
||||
if (current.locked) {
|
||||
pos.top -= viewport.y;
|
||||
pos.left -= viewport.x;
|
||||
}
|
||||
|
||||
pos = {
|
||||
top : getValue(pos.top - hPadding * 0.5),
|
||||
left : getValue(pos.left - wPadding * 0.5),
|
||||
top : getValue(pos.top - hPadding * current.topRatio),
|
||||
left : getValue(pos.left - wPadding * current.leftRatio),
|
||||
width : getValue(width + wPadding),
|
||||
height : getValue(height + hPadding)
|
||||
};
|
||||
|
|
@ -1572,23 +1628,27 @@
|
|||
if (effect === 'elastic') {
|
||||
field = direction === 'down' || direction === 'up' ? 'top' : 'left';
|
||||
|
||||
if (direction === 'up' || direction === 'left') {
|
||||
startPos[ field ] = getValue(parseInt(startPos[ field ], 10) - distance);
|
||||
if (direction === 'down' || direction === 'right') {
|
||||
startPos[ field ] = getValue(getScalar(startPos[ field ]) - distance);
|
||||
endPos[ field ] = '+=' + distance + 'px';
|
||||
|
||||
} else {
|
||||
startPos[ field ] = getValue(parseInt(startPos[ field ], 10) + distance);
|
||||
startPos[ field ] = getValue(getScalar(startPos[ field ]) + distance);
|
||||
endPos[ field ] = '-=' + distance + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
F.wrap.css(startPos).animate(endPos, {
|
||||
duration : effect === 'none' ? 0 : current.nextSpeed,
|
||||
easing : current.nextEasing,
|
||||
complete : function() {
|
||||
setTimeout(F._afterZoomIn, 10);
|
||||
}
|
||||
});
|
||||
// Workaround for http://bugs.jquery.com/ticket/12273
|
||||
if (effect === 'none') {
|
||||
F._afterZoomIn();
|
||||
|
||||
} else {
|
||||
F.wrap.css(startPos).animate(endPos, {
|
||||
duration : current.nextSpeed,
|
||||
easing : current.nextEasing,
|
||||
complete : F._afterZoomIn
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
changeOut: function () {
|
||||
|
|
@ -1599,7 +1659,7 @@
|
|||
distance = 200;
|
||||
|
||||
if (effect === 'elastic') {
|
||||
endPos[ direction === 'down' || direction === 'up' ? 'top' : 'left' ] = ( direction === 'down' || direction === 'right' ? '-' : '+' ) + '=' + distance + 'px';
|
||||
endPos[ direction === 'down' || direction === 'up' ? 'top' : 'left' ] = ( direction === 'up' || direction === 'left' ? '-' : '+' ) + '=' + distance + 'px';
|
||||
}
|
||||
|
||||
previous.wrap.animate(endPos, {
|
||||
|
|
@ -1620,68 +1680,103 @@
|
|||
overlay: null,
|
||||
|
||||
update: function () {
|
||||
var width, scrollWidth, offsetWidth;
|
||||
var width = '100%', offsetWidth;
|
||||
|
||||
// Reset width/height so it will not mess
|
||||
this.overlay.width('100%').height('100%');
|
||||
this.overlay.width(width).height('100%');
|
||||
|
||||
if ($.browser.msie || isTouch) {
|
||||
scrollWidth = Math.max(document.documentElement.scrollWidth, document.body.scrollWidth);
|
||||
// jQuery does not return reliable result for IE
|
||||
if ($.browser.msie) {
|
||||
offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth);
|
||||
|
||||
width = scrollWidth < offsetWidth ? W.width() : scrollWidth;
|
||||
if (D.width() > offsetWidth) {
|
||||
width = D.width();
|
||||
}
|
||||
|
||||
} else {
|
||||
} else if (D.width() > W.width()) {
|
||||
width = D.width();
|
||||
}
|
||||
|
||||
this.overlay.width(width).height(D.height());
|
||||
},
|
||||
|
||||
beforeShow: function (opts) {
|
||||
var overlay;
|
||||
// This is where we can manipulate DOM, because later it would cause iframes to reload
|
||||
onReady: function (opts, obj) {
|
||||
$('.fancybox-overlay').stop(true, true);
|
||||
|
||||
if (this.overlay) {
|
||||
return;
|
||||
if (!this.overlay) {
|
||||
$.extend(this, {
|
||||
overlay : $('<div class="fancybox-overlay"></div>').appendTo( obj.parent ),
|
||||
margin : D.height() > W.height() || $('body').css('overflow-y') === 'scroll' ? $('body').css('margin-right') : false,
|
||||
el : document.all && !document.querySelector ? $('html') : $('body')
|
||||
});
|
||||
}
|
||||
|
||||
opts = $.extend(true, {}, F.defaults.helpers.overlay, opts);
|
||||
if (obj.fixed && !isTouch) {
|
||||
this.overlay.addClass('fancybox-overlay-fixed');
|
||||
|
||||
overlay = this.overlay = $('<div id="fancybox-overlay"></div>')
|
||||
.css(opts.css)
|
||||
.appendTo('body')
|
||||
.bind('mousewheel', function(e) {
|
||||
if (!F.wrap || (F.wrap.css('position') === 'fixed' || F.wrap.is(':animated'))) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
if (obj.autoCenter) {
|
||||
this.overlay.append( obj.wrap );
|
||||
|
||||
obj.locked = this.overlay;
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.showEarly === true) {
|
||||
this.beforeShow.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
|
||||
beforeShow : function(opts, obj) {
|
||||
var overlay = this.overlay.unbind('.fb').width('auto').height('auto').css( opts.css );
|
||||
|
||||
if (opts.closeClick) {
|
||||
overlay.bind('click.fb', F.close);
|
||||
overlay.bind('click.fb', function(e) {
|
||||
if ($(e.target).hasClass('fancybox-overlay')) {
|
||||
F.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (F.defaults.fixed && !isTouch) {
|
||||
overlay.addClass('overlay-fixed');
|
||||
if (obj.fixed && !isTouch) {
|
||||
if (obj.locked) {
|
||||
this.el.addClass('fancybox-lock');
|
||||
|
||||
if (this.margin !== false) {
|
||||
$('body').css('margin-right', getScalar( this.margin ) + obj.scrollbarWidth);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
this.update();
|
||||
|
||||
this.onUpdate = function () {
|
||||
this.update();
|
||||
};
|
||||
}
|
||||
|
||||
overlay.fadeTo(opts.speedIn, opts.opacity);
|
||||
overlay.show();
|
||||
},
|
||||
|
||||
onUpdate : function(opts, obj) {
|
||||
if (!obj.fixed || isTouch) {
|
||||
this.update();
|
||||
}
|
||||
},
|
||||
|
||||
afterClose: function (opts) {
|
||||
if (this.overlay) {
|
||||
this.overlay.fadeOut(opts.speedOut || 0, function () {
|
||||
$(this).remove();
|
||||
var that = this,
|
||||
speed = opts.speedOut || 0;
|
||||
|
||||
// Remove overlay if exists and fancyBox is not opening
|
||||
// (e.g., it is not being open using afterClose callback)
|
||||
if (that.overlay && !F.isActive) {
|
||||
that.overlay.fadeOut(speed || 0, function () {
|
||||
$('body').css('margin-right', that.margin);
|
||||
|
||||
that.el.removeClass('fancybox-lock');
|
||||
|
||||
that.overlay.remove();
|
||||
|
||||
that.overlay = null;
|
||||
});
|
||||
}
|
||||
|
||||
this.overlay = null;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -1724,11 +1819,11 @@
|
|||
.wrapInner('<span class="child"></span>');
|
||||
|
||||
//Increase bottom margin so this title will also fit into viewport
|
||||
F.current.margin[2] += Math.abs(parseInt(title.css('margin-bottom'), 10));
|
||||
F.current.margin[2] += Math.abs( getScalar(title.css('margin-bottom')) );
|
||||
break;
|
||||
}
|
||||
|
||||
if (opts.position === 'top'){
|
||||
if (opts.position === 'top') {
|
||||
title.prependTo(target);
|
||||
|
||||
} else {
|
||||
|
|
@ -1743,15 +1838,15 @@
|
|||
that = $(this),
|
||||
selector = this.selector || '',
|
||||
run = function(e) {
|
||||
var what = this, idx = index, relType, relVal;
|
||||
var what = $(this).blur(), idx = index, relType, relVal;
|
||||
|
||||
if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !$(what).is('.fancybox-wrap')) {
|
||||
if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !what.is('.fancybox-wrap')) {
|
||||
relType = options.groupAttr || 'data-fancybox-group';
|
||||
relVal = $(what).attr(relType);
|
||||
relVal = what.attr(relType);
|
||||
|
||||
if (!relVal) {
|
||||
relType = 'rel';
|
||||
relVal = what[ relType ];
|
||||
relVal = what.get(0)[ relType ];
|
||||
}
|
||||
|
||||
if (relVal && relVal !== '' && relVal !== 'nofollow') {
|
||||
|
|
@ -1781,24 +1876,35 @@
|
|||
return this;
|
||||
};
|
||||
|
||||
if (!$.scrollbarWidth) {
|
||||
// http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth
|
||||
$.scrollbarWidth = function() {
|
||||
var parent, child, width;
|
||||
parent = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body');
|
||||
child = parent.children();
|
||||
width = child.innerWidth() - child.height( 99 ).innerWidth();
|
||||
parent.remove();
|
||||
|
||||
return width;
|
||||
};
|
||||
}
|
||||
|
||||
// Tests that need a body at doc ready
|
||||
D.ready(function() {
|
||||
if ( $.scrollbarWidth === undefined ) {
|
||||
// http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth
|
||||
$.scrollbarWidth = function() {
|
||||
var parent = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body'),
|
||||
child = parent.children(),
|
||||
width = child.innerWidth() - child.height( 99 ).innerWidth();
|
||||
|
||||
parent.remove();
|
||||
|
||||
return width;
|
||||
};
|
||||
}
|
||||
|
||||
if ( $.support.fixedPosition === undefined ) {
|
||||
$.support.fixedPosition = (function() {
|
||||
var elem = $('<div style="position:fixed;top:20px;"></div>').appendTo('body'),
|
||||
fixed = ( elem[0].offsetTop === 20 || elem[0].offsetTop === 15 );
|
||||
|
||||
elem.remove();
|
||||
|
||||
return fixed;
|
||||
}());
|
||||
}
|
||||
|
||||
$.extend(F.defaults, {
|
||||
scrollOutside : $.scrollbarWidth(),
|
||||
fixed : $.support.fixedPosition || !(($.browser.msie && $.browser.version <= 6) || isTouch),
|
||||
scrollbarWidth : $.scrollbarWidth(),
|
||||
fixed : $.support.fixedPosition,
|
||||
parent : $('body')
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue