diff options
| author | spider@dev <spiderr@bitweaver.org> | 2016-08-17 00:18:24 -0400 |
|---|---|---|
| committer | spider@dev <spiderr@bitweaver.org> | 2016-08-17 00:18:24 -0400 |
| commit | 12c2821caf1b3a0cefdebe67cabc9df032347b12 (patch) | |
| tree | 16f93162c0a7b0d89aac70378720e218bda31bb7 | |
| parent | e0706c8db672831701766fc86227321d0b2e8752 (diff) | |
| download | util-12c2821caf1b3a0cefdebe67cabc9df032347b12.tar.gz util-12c2821caf1b3a0cefdebe67cabc9df032347b12.tar.bz2 util-12c2821caf1b3a0cefdebe67cabc9df032347b12.zip | |
update fancybox to 2.1.5
35 files changed, 1618 insertions, 1052 deletions
diff --git a/javascript/jquery/plugins/fancybox/fancy_close.png b/javascript/jquery/plugins/fancybox/fancy_close.png Binary files differdeleted file mode 100644 index 0703530..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_close.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancy_closebox.png b/javascript/jquery/plugins/fancybox/fancy_closebox.png Binary files differdeleted file mode 100644 index 4de4396..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_closebox.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancy_left.png b/javascript/jquery/plugins/fancybox/fancy_left.png Binary files differdeleted file mode 100644 index 61494e6..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_left.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancy_loading.png b/javascript/jquery/plugins/fancybox/fancy_loading.png Binary files differdeleted file mode 100644 index 2503017..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_loading.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancy_nav_left.png b/javascript/jquery/plugins/fancybox/fancy_nav_left.png Binary files differdeleted file mode 100644 index ebaa6a4..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_nav_left.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancy_nav_right.png b/javascript/jquery/plugins/fancybox/fancy_nav_right.png Binary files differdeleted file mode 100644 index 873294e..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_nav_right.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancy_progress.png b/javascript/jquery/plugins/fancybox/fancy_progress.png Binary files differdeleted file mode 100644 index 06b7c89..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_progress.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancy_right.png b/javascript/jquery/plugins/fancybox/fancy_right.png Binary files differdeleted file mode 100644 index 0a56042..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_right.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancy_shadow_e.png b/javascript/jquery/plugins/fancybox/fancy_shadow_e.png Binary files differdeleted file mode 100644 index 2eda089..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_shadow_e.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancy_shadow_n.png b/javascript/jquery/plugins/fancybox/fancy_shadow_n.png Binary files differdeleted file mode 100644 index 69aa10e..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_shadow_n.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancy_shadow_ne.png b/javascript/jquery/plugins/fancybox/fancy_shadow_ne.png Binary files differdeleted file mode 100644 index 79f6980..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_shadow_ne.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancy_shadow_nw.png b/javascript/jquery/plugins/fancybox/fancy_shadow_nw.png Binary files differdeleted file mode 100644 index 7182cd9..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_shadow_nw.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancy_shadow_s.png b/javascript/jquery/plugins/fancybox/fancy_shadow_s.png Binary files differdeleted file mode 100644 index d8858bf..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_shadow_s.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancy_shadow_se.png b/javascript/jquery/plugins/fancybox/fancy_shadow_se.png Binary files differdeleted file mode 100644 index 541e3ff..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_shadow_se.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancy_shadow_sw.png b/javascript/jquery/plugins/fancybox/fancy_shadow_sw.png Binary files differdeleted file mode 100644 index b451689..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_shadow_sw.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancy_shadow_w.png b/javascript/jquery/plugins/fancybox/fancy_shadow_w.png Binary files differdeleted file mode 100644 index 8a4e4a8..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_shadow_w.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancy_title_left.png b/javascript/jquery/plugins/fancybox/fancy_title_left.png Binary files differdeleted file mode 100644 index 6049223..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_title_left.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancy_title_main.png b/javascript/jquery/plugins/fancybox/fancy_title_main.png Binary files differdeleted file mode 100644 index 8044271..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_title_main.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancy_title_over.png b/javascript/jquery/plugins/fancybox/fancy_title_over.png Binary files differdeleted file mode 100644 index d9f458f..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_title_over.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancy_title_right.png b/javascript/jquery/plugins/fancybox/fancy_title_right.png Binary files differdeleted file mode 100644 index e36d9db..0000000 --- a/javascript/jquery/plugins/fancybox/fancy_title_right.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancybox-x.png b/javascript/jquery/plugins/fancybox/fancybox-x.png Binary files differdeleted file mode 100644 index c2130f8..0000000 --- a/javascript/jquery/plugins/fancybox/fancybox-x.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancybox-y.png b/javascript/jquery/plugins/fancybox/fancybox-y.png Binary files differdeleted file mode 100644 index 7ef399b..0000000 --- a/javascript/jquery/plugins/fancybox/fancybox-y.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancybox.png b/javascript/jquery/plugins/fancybox/fancybox.png Binary files differdeleted file mode 100644 index 65e14f6..0000000 --- a/javascript/jquery/plugins/fancybox/fancybox.png +++ /dev/null diff --git a/javascript/jquery/plugins/fancybox/fancybox_loading.gif b/javascript/jquery/plugins/fancybox/fancybox_loading.gif Binary files differindex 742131f..a03a40c 100644 --- a/javascript/jquery/plugins/fancybox/fancybox_loading.gif +++ b/javascript/jquery/plugins/fancybox/fancybox_loading.gif diff --git a/javascript/jquery/plugins/fancybox/fancybox_sprite.png b/javascript/jquery/plugins/fancybox/fancybox_sprite.png Binary files differindex 753021b..fd8d5ca 100644 --- a/javascript/jquery/plugins/fancybox/fancybox_sprite.png +++ b/javascript/jquery/plugins/fancybox/fancybox_sprite.png diff --git a/javascript/jquery/plugins/fancybox/helpers/fancybox_buttons.png b/javascript/jquery/plugins/fancybox/helpers/fancybox_buttons.png Binary files differindex e0e1ea8..0787207 100644 --- a/javascript/jquery/plugins/fancybox/helpers/fancybox_buttons.png +++ b/javascript/jquery/plugins/fancybox/helpers/fancybox_buttons.png diff --git a/javascript/jquery/plugins/fancybox/helpers/jquery.fancybox-buttons.css b/javascript/jquery/plugins/fancybox/helpers/jquery.fancybox-buttons.css index 1e83200..a26273a 100644 --- a/javascript/jquery/plugins/fancybox/helpers/jquery.fancybox-buttons.css +++ b/javascript/jquery/plugins/fancybox/helpers/jquery.fancybox-buttons.css @@ -2,7 +2,7 @@ position: fixed; left: 0; width: 100%; - z-index: 1005; + z-index: 8050; } #fancybox-buttons.top { @@ -15,17 +15,24 @@ #fancybox-buttons ul { display: block; - width: 170px; + width: 166px; height: 30px; margin: 0 auto; padding: 0; list-style: none; - background: #111; - -webkit-box-shadow: 0 1px 3px #000,0 0 0 1px rgba(0,0,0,.7),inset 0 0 0 1px rgba(255,255,255,.05); - -moz-box-shadow: 0 1px 3px #000,0 0 0 1px rgba(0,0,0,.7),inset 0 0 0 1px rgba(255,255,255,.05); - background: #111 -webkit-gradient(linear,0% 0%,0% 100%,from(rgba(255,255,255,.2)),color-stop(.5,rgba(255,255,255,.15)),color-stop(.5,rgba(255,255,255,.1)),to(rgba(255,255,255,.15))); - background: #111 -moz-linear-gradient(top,rgba(255,255,255,.2) 0%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.1) 50%,rgba(255,255,255,.15) 100%); + border: 1px solid #111; border-radius: 3px; + -webkit-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); + -moz-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); + box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); + background: rgb(50,50,50); + background: -moz-linear-gradient(top, rgb(68,68,68) 0%, rgb(52,52,52) 50%, rgb(41,41,41) 50%, rgb(51,51,51) 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgb(68,68,68)), color-stop(50%,rgb(52,52,52)), color-stop(50%,rgb(41,41,41)), color-stop(100%,rgb(51,51,51))); + background: -webkit-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); + background: -o-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); + background: -ms-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); + background: linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%); + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#444444', endColorstr='#222222',GradientType=0 ); } #fancybox-buttons ul li { @@ -39,14 +46,19 @@ width: 30px; height: 30px; text-indent: -9999px; + background-color: transparent; background-image: url('fancybox_buttons.png'); background-repeat: no-repeat; outline: none; + opacity: 0.8; +} + +#fancybox-buttons a:hover { + opacity: 1; } #fancybox-buttons a.btnPrev { - width: 32px; - background-position: 6px 0; + background-position: 5px 0; } #fancybox-buttons a.btnNext { @@ -75,11 +87,11 @@ #fancybox-buttons a.btnClose { border-left: 1px solid #111; - width: 38px; - background-position: -57px 0px; + width: 35px; + background-position: -56px 0px; } #fancybox-buttons a.btnDisabled { - opacity : 0.5; + opacity : 0.4; cursor: default; }
\ No newline at end of file diff --git a/javascript/jquery/plugins/fancybox/helpers/jquery.fancybox-buttons.js b/javascript/jquery/plugins/fancybox/helpers/jquery.fancybox-buttons.js index e116e38..fd8b955 100644 --- a/javascript/jquery/plugins/fancybox/helpers/jquery.fancybox-buttons.js +++ b/javascript/jquery/plugins/fancybox/helpers/jquery.fancybox-buttons.js @@ -1,19 +1,17 @@ /*! * Buttons helper for fancyBox - * version: 1.0.2 + * version: 1.0.5 (Mon, 15 Oct 2012) * @requires fancyBox v2.0 or later * - * Usage: + * Usage: * $(".fancybox").fancybox({ - * buttons: { - * position : 'top' + * helpers : { + * buttons: { + * position : 'top' + * } * } * }); - * - * Options: - * tpl - HTML template - * position - 'top' or 'bottom' - * + * */ (function ($) { //Shortcut for fancyBox object @@ -21,72 +19,65 @@ //Add helper object F.helpers.buttons = { - tpl: '<div id="fancybox-buttons"><ul><li><a class="btnPrev" title="Previous" href="javascript:;"></a></li><li><a class="btnPlay" title="Start slideshow" href="javascript:;"></a></li><li><a class="btnNext" title="Next" href="javascript:;"></a></li><li><a class="btnToggle" title="Toggle size" href="javascript:;"></a></li><li><a class="btnClose" title="Close" href="javascript:jQuery.fancybox.close();"></a></li></ul></div>', - list: null, - buttons: {}, - - update: function () { - var toggle = this.buttons.toggle.removeClass('btnDisabled btnToggleOn'); - - //Size toggle button - if (F.current.canShrink) { - toggle.addClass('btnToggleOn'); - - } else if (!F.current.canExpand) { - toggle.addClass('btnDisabled'); - } + defaults : { + skipSingle : false, // disables if gallery contains single image + position : 'top', // 'top' or 'bottom' + tpl : '<div id="fancybox-buttons"><ul><li><a class="btnPrev" title="Previous" href="javascript:;"></a></li><li><a class="btnPlay" title="Start slideshow" href="javascript:;"></a></li><li><a class="btnNext" title="Next" href="javascript:;"></a></li><li><a class="btnToggle" title="Toggle size" href="javascript:;"></a></li><li><a class="btnClose" title="Close" href="javascript:;"></a></li></ul></div>' }, - beforeLoad: function (opts) { + list : null, + buttons: null, + + beforeLoad: function (opts, obj) { //Remove self if gallery do not have at least two items - if (F.group.length < 2) { - F.coming.helpers.buttons = false; - F.coming.closeBtn = true; + + if (opts.skipSingle && obj.group.length < 2) { + obj.helpers.buttons = false; + obj.closeBtn = true; return; } //Increase top margin to give space for buttons - F.coming.margin[ opts.position === 'bottom' ? 2 : 0 ] += 30; + obj.margin[ opts.position === 'bottom' ? 2 : 0 ] += 30; }, onPlayStart: function () { - if (this.list) { + if (this.buttons) { this.buttons.play.attr('title', 'Pause slideshow').addClass('btnPlayOn'); } }, onPlayEnd: function () { - if (this.list) { + if (this.buttons) { this.buttons.play.attr('title', 'Start slideshow').removeClass('btnPlayOn'); } }, - afterShow: function (opts) { - var buttons; + afterShow: function (opts, obj) { + var buttons = this.buttons; - if (!this.list) { - this.list = $(opts.tpl || this.tpl).addClass(opts.position || 'top').appendTo('body'); + if (!buttons) { + this.list = $(opts.tpl).addClass(opts.position).appendTo('body'); - this.buttons = { - prev : this.list.find('.btnPrev').click( F.prev ), - next : this.list.find('.btnNext').click( F.next ), - play : this.list.find('.btnPlay').click( F.play ), - toggle : this.list.find('.btnToggle').click( F.toggle ) + buttons = { + prev : this.list.find('.btnPrev').click( F.prev ), + next : this.list.find('.btnNext').click( F.next ), + play : this.list.find('.btnPlay').click( F.play ), + toggle : this.list.find('.btnToggle').click( F.toggle ), + close : this.list.find('.btnClose').click( F.close ) } } - buttons = this.buttons; - //Prev - if (F.current.index > 0 || F.current.loop) { + if (obj.index > 0 || obj.loop) { buttons.prev.removeClass('btnDisabled'); } else { buttons.prev.addClass('btnDisabled'); } //Next / Play - if (F.current.loop || F.current.index < F.group.length - 1) { + if (obj.loop || obj.index < obj.group.length - 1) { buttons.next.removeClass('btnDisabled'); buttons.play.removeClass('btnDisabled'); @@ -95,11 +86,27 @@ buttons.play.addClass('btnDisabled'); } - this.update(); + this.buttons = buttons; + + this.onUpdate(opts, obj); }, - onUpdate: function () { - this.update(); + onUpdate: function (opts, obj) { + var toggle; + + if (!this.buttons) { + return; + } + + toggle = this.buttons.toggle.removeClass('btnDisabled btnToggleOn'); + + //Size toggle button + if (obj.canShrink) { + toggle.addClass('btnToggleOn'); + + } else if (!obj.canExpand) { + toggle.addClass('btnDisabled'); + } }, beforeClose: function () { @@ -107,9 +114,9 @@ this.list.remove(); } - this.list = null; - this.buttons = {}; + this.list = null; + this.buttons = null; } }; -}(jQuery));
\ No newline at end of file +}(jQuery)); diff --git a/javascript/jquery/plugins/fancybox/helpers/jquery.fancybox-thumbs.css b/javascript/jquery/plugins/fancybox/helpers/jquery.fancybox-thumbs.css index aadfb73..63d2943 100644 --- a/javascript/jquery/plugins/fancybox/helpers/jquery.fancybox-thumbs.css +++ b/javascript/jquery/plugins/fancybox/helpers/jquery.fancybox-thumbs.css @@ -1,9 +1,9 @@ #fancybox-thumbs { position: fixed; - left: 0px; + left: 0; width: 100%; overflow: hidden; - z-index: 1005; + z-index: 8050; } #fancybox-thumbs.bottom { @@ -51,4 +51,5 @@ position: relative; border: 0; padding: 0; + max-width: none; }
\ No newline at end of file diff --git a/javascript/jquery/plugins/fancybox/helpers/jquery.fancybox-thumbs.js b/javascript/jquery/plugins/fancybox/helpers/jquery.fancybox-thumbs.js index 04a97db..5db3d4a 100644 --- a/javascript/jquery/plugins/fancybox/helpers/jquery.fancybox-thumbs.js +++ b/javascript/jquery/plugins/fancybox/helpers/jquery.fancybox-thumbs.js @@ -1,22 +1,18 @@ /*! * Thumbnail helper for fancyBox - * version: 1.0.3 + * version: 1.0.7 (Mon, 01 Oct 2012) * @requires fancyBox v2.0 or later * - * Usage: + * Usage: * $(".fancybox").fancybox({ - * thumbs: { - * width : 50, - * height : 50 + * helpers : { + * thumbs: { + * width : 50, + * height : 50 + * } * } * }); - * - * Options: - * width - thumbnail width - * height - thumbnail height - * source - function to obtain the URL of the thumbnail image - * position - 'top' or 'bottom' - * + * */ (function ($) { //Shortcut for fancyBox object @@ -24,44 +20,56 @@ //Add helper object F.helpers.thumbs = { - wrap: null, - list: null, - width: 0, - - //Default function to obtain the URL of the thumbnail image - source: function (el) { - var img; + defaults : { + width : 50, // thumbnail width + height : 50, // thumbnail height + position : 'bottom', // 'top' or 'bottom' + source : function ( item ) { // function to obtain the URL of the thumbnail image + var href; - if ($.type(el) === 'string') { - return el; - } + if (item.element) { + href = $(item.element).find('img').attr('src'); + } - img = $(el).find('img'); + if (!href && item.type === 'image' && item.href) { + href = item.href; + } - return img.length ? img.attr('src') : el.href; + return href; + } }, - init: function (opts) { + wrap : null, + list : null, + width : 0, + + init: function (opts, obj) { var that = this, list, - thumbWidth = opts.width || 50, - thumbHeight = opts.height || 50, - thumbSource = opts.source || this.source; + thumbWidth = opts.width, + thumbHeight = opts.height, + thumbSource = opts.source; //Build list structure list = ''; - for (var n = 0; n < F.group.length; n++) { + for (var n = 0; n < obj.group.length; n++) { list += '<li><a style="width:' + thumbWidth + 'px;height:' + thumbHeight + 'px;" href="javascript:jQuery.fancybox.jumpto(' + n + ');"></a></li>'; } - this.wrap = $('<div id="fancybox-thumbs"></div>').addClass(opts.position || 'bottom').appendTo('body'); + this.wrap = $('<div id="fancybox-thumbs"></div>').addClass(opts.position).appendTo('body'); this.list = $('<ul>' + list + '</ul>').appendTo(this.wrap); //Load each thumbnail - $.each(F.group, function (i) { + $.each(obj.group, function (i) { + var href = thumbSource( obj.group[ i ] ); + + if (!href) { + return; + } + $("<img />").load(function () { - var width = this.width, + var width = this.width, height = this.height, widthRatio, heightRatio, parent; @@ -70,77 +78,74 @@ } //Calculate thumbnail width/height and center it - widthRatio = width / thumbWidth; + widthRatio = width / thumbWidth; heightRatio = height / thumbHeight; + parent = that.list.children().eq(i).find('a'); if (widthRatio >= 1 && heightRatio >= 1) { if (widthRatio > heightRatio) { - width = Math.floor(width / heightRatio); + width = Math.floor(width / heightRatio); height = thumbHeight; } else { - width = thumbWidth; + width = thumbWidth; height = Math.floor(height / widthRatio); } } $(this).css({ - width: width, - height: height, - top: Math.floor(thumbHeight / 2 - height / 2), - left: Math.floor(thumbWidth / 2 - width / 2) + width : width, + height : height, + top : Math.floor(thumbHeight / 2 - height / 2), + left : Math.floor(thumbWidth / 2 - width / 2) }); parent.width(thumbWidth).height(thumbHeight); $(this).hide().appendTo(parent).fadeIn(300); - }).attr('src', thumbSource( F.group[ i ] )); + }).attr('src', href); }); //Set initial width - this.width = this.list.children().eq(0).outerWidth(); - - this.list.width(this.width * (F.group.length + 1)).css('left', Math.floor($(window).width() * 0.5 - (F.current.index * this.width + this.width * 0.5))); - }, + this.width = this.list.children().eq(0).outerWidth(true); - //Center list - update: function (opts) { - if (this.list) { - this.list.stop(true).animate({ - 'left': Math.floor($(window).width() * 0.5 - (F.current.index * this.width + this.width * 0.5)) - }, 150); - } + this.list.width(this.width * (obj.group.length + 1)).css('left', Math.floor($(window).width() * 0.5 - (obj.index * this.width + this.width * 0.5))); }, - beforeLoad: function (opts) { - //Remove self if gallery do not have at least two items - if (F.group.length < 2) { - F.coming.helpers.thumbs = false; + beforeLoad: function (opts, obj) { + //Remove self if gallery do not have at least two items + if (obj.group.length < 2) { + obj.helpers.thumbs = false; return; } //Increase bottom margin to give space for thumbs - F.coming.margin[ opts.position === 'top' ? 0 : 2 ] = opts.height + 30; + obj.margin[ opts.position === 'top' ? 0 : 2 ] += ((opts.height) + 15); }, - afterShow: function (opts) { + afterShow: function (opts, obj) { //Check if exists and create or update list if (this.list) { - this.update(opts); + this.onUpdate(opts, obj); } else { - this.init(opts); + this.init(opts, obj); } //Set active element - this.list.children().removeClass('active').eq(F.current.index).addClass('active'); + this.list.children().removeClass('active').eq(obj.index).addClass('active'); }, - onUpdate: function () { - this.update(); + //Center list + onUpdate: function (opts, obj) { + if (this.list) { + this.list.stop(true).animate({ + 'left': Math.floor($(window).width() * 0.5 - (obj.index * this.width + this.width * 0.5)) + }, 150); + } }, beforeClose: function () { @@ -148,8 +153,8 @@ this.wrap.remove(); } - this.wrap = null; - this.list = null; + this.wrap = null; + this.list = null; this.width = 0; } } diff --git a/javascript/jquery/plugins/fancybox/jquery.easing-1.3.pack.js b/javascript/jquery/plugins/fancybox/jquery.easing-1.3.pack.js deleted file mode 100644 index 9028179..0000000 --- a/javascript/jquery/plugins/fancybox/jquery.easing-1.3.pack.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ - * - * Uses the built in easing capabilities added In jQuery 1.1 - * to offer multiple easing options - * - * TERMS OF USE - jQuery Easing - * - * Open source under the BSD License. - * - * Copyright © 2008 George McGinley Smith - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * Neither the name of the author nor the names of contributors may be used to endorse - * or promote products derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * -*/ - -// t: current time, b: begInnIng value, c: change In value, d: duration -eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('h.i[\'1a\']=h.i[\'z\'];h.O(h.i,{y:\'D\',z:9(x,t,b,c,d){6 h.i[h.i.y](x,t,b,c,d)},17:9(x,t,b,c,d){6 c*(t/=d)*t+b},D:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},13:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},X:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},U:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},R:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},N:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},M:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},L:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},K:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},J:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},I:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},G:9(x,t,b,c,d){6-c*8.C(t/d*(8.g/2))+c+b},15:9(x,t,b,c,d){6 c*8.n(t/d*(8.g/2))+b},12:9(x,t,b,c,d){6-c/2*(8.C(8.g*t/d)-1)+b},Z:9(x,t,b,c,d){6(t==0)?b:c*8.j(2,10*(t/d-1))+b},Y:9(x,t,b,c,d){6(t==d)?b+c:c*(-8.j(2,-10*t/d)+1)+b},W:9(x,t,b,c,d){e(t==0)6 b;e(t==d)6 b+c;e((t/=d/2)<1)6 c/2*8.j(2,10*(t-1))+b;6 c/2*(-8.j(2,-10*--t)+2)+b},V:9(x,t,b,c,d){6-c*(8.o(1-(t/=d)*t)-1)+b},S:9(x,t,b,c,d){6 c*8.o(1-(t=t/d-1)*t)+b},Q:9(x,t,b,c,d){e((t/=d/2)<1)6-c/2*(8.o(1-t*t)-1)+b;6 c/2*(8.o(1-(t-=2)*t)+1)+b},P:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6-(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b},H:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6 a*8.j(2,-10*t)*8.n((t*d-s)*(2*8.g)/p)+c+b},T:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d/2)==2)6 b+c;e(!p)p=d*(.3*1.5);e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);e(t<1)6-.5*(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b;6 a*8.j(2,-10*(t-=1))*8.n((t*d-s)*(2*8.g)/p)*.5+c+b},F:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*(t/=d)*t*((s+1)*t-s)+b},E:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},16:9(x,t,b,c,d,s){e(s==u)s=1.l;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.B))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.B))+1)*t+s)+2)+b},A:9(x,t,b,c,d){6 c-h.i.v(x,d-t,0,c,d)+b},v:9(x,t,b,c,d){e((t/=d)<(1/2.k)){6 c*(7.q*t*t)+b}m e(t<(2/2.k)){6 c*(7.q*(t-=(1.5/2.k))*t+.k)+b}m e(t<(2.5/2.k)){6 c*(7.q*(t-=(2.14/2.k))*t+.11)+b}m{6 c*(7.q*(t-=(2.18/2.k))*t+.19)+b}},1b:9(x,t,b,c,d){e(t<d/2)6 h.i.A(x,t*2,0,c,d)*.5+b;6 h.i.v(x,t*2-d,0,c,d)*.5+c*.5+b}});',62,74,'||||||return||Math|function|||||if|var|PI|jQuery|easing|pow|75|70158|else|sin|sqrt||5625|asin|||undefined|easeOutBounce|abs||def|swing|easeInBounce|525|cos|easeOutQuad|easeOutBack|easeInBack|easeInSine|easeOutElastic|easeInOutQuint|easeOutQuint|easeInQuint|easeInOutQuart|easeOutQuart|easeInQuart|extend|easeInElastic|easeInOutCirc|easeInOutCubic|easeOutCirc|easeInOutElastic|easeOutCubic|easeInCirc|easeInOutExpo|easeInCubic|easeOutExpo|easeInExpo||9375|easeInOutSine|easeInOutQuad|25|easeOutSine|easeInOutBack|easeInQuad|625|984375|jswing|easeInOutBounce'.split('|'),0,{})) - -/* - * - * TERMS OF USE - EASING EQUATIONS - * - * Open source under the BSD License. - * - * Copyright © 2001 Robert Penner - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * Neither the name of the author nor the names of contributors may be used to endorse - * or promote products derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ diff --git a/javascript/jquery/plugins/fancybox/jquery.fancybox.css b/javascript/jquery/plugins/fancybox/jquery.fancybox.css index fa9ab43..367890a 100644 --- a/javascript/jquery/plugins/fancybox/jquery.fancybox.css +++ b/javascript/jquery/plugins/fancybox/jquery.fancybox.css @@ -1,64 +1,73 @@ -/*! fancyBox v2.0.5 fancyapps.com | fancyapps.com/fancybox/#license */ -.fancybox-tmp iframe, .fancybox-tmp object { - vertical-align: top; +/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */ +.fancybox-wrap, +.fancybox-skin, +.fancybox-outer, +.fancybox-inner, +.fancybox-image, +.fancybox-wrap iframe, +.fancybox-wrap object, +.fancybox-nav, +.fancybox-nav span, +.fancybox-tmp +{ padding: 0; margin: 0; + border: 0; + outline: none; + vertical-align: top; } .fancybox-wrap { position: absolute; top: 0; left: 0; - z-index: 1002; + z-index: 8020; } -.fancybox-outer { +.fancybox-skin { position: relative; - padding: 0; - margin: 0; background: #f9f9f9; color: #444; text-shadow: none; -webkit-border-radius: 4px; -moz-border-radius: 4px; - border-radius: 4px; + border-radius: 4px; } .fancybox-opened { - z-index: 1003; + z-index: 8030; } -.fancybox-opened .fancybox-outer { +.fancybox-opened .fancybox-skin { -webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); -moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); } -.fancybox-inner { - width: 100%; - height: 100%; - padding: 0; - margin: 0; +.fancybox-outer, .fancybox-inner { position: relative; - outline: none; +} + +.fancybox-inner { overflow: hidden; } +.fancybox-type-iframe .fancybox-inner { + -webkit-overflow-scrolling: touch; +} + .fancybox-error { color: #444; - font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; - margin: 0; - padding: 10px; + font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; + margin: 0; + padding: 15px; + white-space: nowrap; } .fancybox-image, .fancybox-iframe { display: block; width: 100%; height: 100%; - border: 0; - padding: 0; - margin: 0; - vertical-align: top; } .fancybox-image { @@ -79,7 +88,7 @@ background-position: 0 -108px; opacity: 0.8; cursor: pointer; - z-index: 1010; + z-index: 8060; } #fancybox-loading div { @@ -95,7 +104,7 @@ width: 36px; height: 36px; cursor: pointer; - z-index: 1004; + z-index: 8040; } .fancybox-nav { @@ -104,12 +113,14 @@ width: 40%; height: 100%; cursor: pointer; + text-decoration: none; background: transparent url('blank.gif'); /* helps IE */ - z-index: 1003; + -webkit-tap-highlight-color: rgba(0,0,0,0); + z-index: 8040; } .fancybox-prev { - left: 0; + left: 0; } .fancybox-next { @@ -120,20 +131,20 @@ position: absolute; top: 50%; width: 36px; - height: 36px; + height: 34px; margin-top: -18px; cursor: pointer; - z-index: 1003; + z-index: 8040; visibility: hidden; } .fancybox-prev span { - left: 20px; + left: 10px; background-position: 0 -36px; } .fancybox-next span { - right: 20px; + right: 10px; background-position: 0 -72px; } @@ -143,33 +154,58 @@ .fancybox-tmp { position: absolute; - top: -9999px; - left: -9999px; - padding: 0; - overflow: visible; + top: -99999px; + left: -99999px; visibility: hidden; + max-width: 99999px; + max-height: 99999px; + overflow: visible !important; } /* Overlay helper */ -#fancybox-overlay { +.fancybox-lock { + overflow: hidden !important; + width: auto; +} + +.fancybox-lock body { + overflow: hidden !important; +} + +.fancybox-lock-test { + overflow-y: hidden !important; +} + +.fancybox-overlay { position: absolute; top: 0; left: 0; overflow: hidden; display: none; - z-index: 1001; - background: #000; + z-index: 8010; + background: url('fancybox_overlay.png'); +} + +.fancybox-overlay-fixed { + position: fixed; + bottom: 0; + right: 0; +} + +.fancybox-lock .fancybox-overlay { + overflow: auto; + overflow-y: scroll; } /* Title helper */ .fancybox-title { - visibility: hidden; + visibility: hidden; font: normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; position: relative; text-shadow: none; - z-index: 1005; + z-index: 8050; } .fancybox-opened .fancybox-title { @@ -181,7 +217,7 @@ bottom: 0; right: 50%; margin-bottom: -35px; - z-index: 1003; + z-index: 8050; text-align: center; } @@ -193,7 +229,7 @@ background: rgba(0, 0, 0, 0.8); -webkit-border-radius: 15px; -moz-border-radius: 15px; - border-radius: 15px; + border-radius: 15px; text-shadow: 0 1px 2px #222; color: #FFF; font-weight: bold; @@ -208,15 +244,31 @@ } .fancybox-title-inside-wrap { - margin-top: 10px; + padding-top: 10px; } .fancybox-title-over-wrap { position: absolute; bottom: 0; - left: 0; + left: 0; color: #fff; padding: 10px; background: #000; background: rgba(0, 0, 0, .8); +} + +/*Retina graphics!*/ +@media only screen and (-webkit-min-device-pixel-ratio: 1.5), + only screen and (min--moz-device-pixel-ratio: 1.5), + only screen and (min-device-pixel-ratio: 1.5){ + + #fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span { + background-image: url('fancybox_sprite@2x.png'); + background-size: 44px 152px; /*The size of the normal image, half the size of the hi-res image*/ + } + + #fancybox-loading div { + background-image: url('fancybox_loading@2x.gif'); + background-size: 24px 24px; /*The size of the normal image, half the size of the hi-res image*/ + } }
\ No newline at end of file diff --git a/javascript/jquery/plugins/fancybox/jquery.fancybox.js b/javascript/jquery/plugins/fancybox/jquery.fancybox.js index 435f8a0..e8e1987 100644..100755 --- a/javascript/jquery/plugins/fancybox/jquery.fancybox.js +++ b/javascript/jquery/plugins/fancybox/jquery.fancybox.js @@ -1,6 +1,6 @@ - /*! +/*! * fancyBox - jQuery Plugin - * version: 2.0.5 (02/03/2012) + * version: 2.1.5 (Fri, 14 Jun 2013) * @requires jQuery v1.6 or later * * Examples at http://fancyapps.com/fancybox/ @@ -9,197 +9,364 @@ * Copyright 2012 Janis Skarnelis - janis@fancyapps.com * */ -(function (window, document, undefined) { + +(function (window, document, $, undefined) { "use strict"; - var $ = window.jQuery, + var H = $("html"), W = $(window), D = $(document), F = $.fancybox = function () { F.open.apply( this, arguments ); }, - didResize = false, - resizeTimer = null, - isMobile = document.createTouch !== undefined, + IE = navigator.userAgent.match(/msie/i), + didUpdate = null, + isTouch = document.createTouch !== undefined, + + isQuery = function(obj) { + return obj && obj.hasOwnProperty && obj instanceof $; + }, isString = function(str) { - return $.type(str) === "string"; + return str && $.type(str) === "string"; + }, + isPercentage = function(str) { + return isString(str) && str.indexOf('%') > 0; + }, + isScrollable = function(el) { + return (el && !(el.style.overflow && el.style.overflow === 'hidden') && ((el.clientWidth && el.scrollWidth > el.clientWidth) || (el.clientHeight && el.scrollHeight > el.clientHeight))); + }, + getScalar = function(orig, dim) { + var value = parseInt(orig, 10) || 0; + + if (dim && isPercentage(orig)) { + value = F.getViewport()[ dim ] / 100 * value; + } + + return Math.ceil(value); + }, + getValue = function(value, dim) { + return getScalar(value, dim) + 'px'; }; $.extend(F, { // The current version of fancyBox - version: '2.0.5', + version: '2.1.5', defaults: { - padding: 15, - margin: 20, + padding : 15, + margin : 20, - width: 800, - height: 600, - minWidth: 100, - minHeight: 100, - maxWidth: 9999, - maxHeight: 9999, + width : 800, + height : 600, + minWidth : 100, + minHeight : 100, + maxWidth : 9999, + maxHeight : 9999, + pixelRatio: 1, // Set to 2 for retina display support - autoSize: true, - autoResize: !isMobile, - autoCenter : !isMobile, - fitToView: true, - aspectRatio: false, - topRatio: 0.5, + autoSize : true, + autoHeight : false, + autoWidth : false, - fixed: !($.browser.msie && $.browser.version <= 6) && !isMobile, - scrolling: 'auto', // 'auto', 'yes' or 'no' - wrapCSS: 'fancybox-default', + autoResize : true, + autoCenter : !isTouch, + fitToView : true, + aspectRatio : false, + topRatio : 0.5, + leftRatio : 0.5, - arrows: true, - closeBtn: true, - closeClick: false, - nextClick : false, - mouseWheel: true, - autoPlay: false, - playSpeed: 3000, - preload : 3, + scrolling : 'auto', // 'auto', 'yes' or 'no' + wrapCSS : '', - modal: false, - loop: true, - ajax: { dataType: 'html', headers: { 'X-fancyBox': true } }, - keys: { - next: [13, 32, 34, 39, 40], // enter, space, page down, right arrow, down arrow - prev: [8, 33, 37, 38], // backspace, page up, left arrow, up arrow - close: [27] // escape key + arrows : true, + closeBtn : true, + closeClick : false, + nextClick : false, + mouseWheel : true, + autoPlay : false, + playSpeed : 3000, + preload : 3, + modal : false, + loop : true, + + ajax : { + dataType : 'html', + headers : { 'X-fancyBox': true } + }, + iframe : { + scrolling : 'auto', + preload : true + }, + swf : { + wmode: 'transparent', + allowfullscreen : 'true', + allowscriptaccess : 'always' }, + keys : { + next : { + 13 : 'left', // enter + 34 : 'up', // page down + 39 : 'left', // right arrow + 40 : 'up' // down arrow + }, + prev : { + 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 + toggle : [70] // letter "f" - toggle fullscreen + }, + + direction : { + next : 'left', + prev : 'right' + }, + + scrollOutside : true, + // Override some properties - index: 0, - type: null, - href: null, - content: null, - title: null, + index : 0, + type : null, + href : null, + content : null, + title : null, // HTML templates tpl: { - wrap: '<div class="fancybox-wrap"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div>', - image: '<img class="fancybox-image" src="{href}" alt="" />', - iframe: '<iframe class="fancybox-iframe" name="fancybox-frame{rnd}" frameborder="0" hspace="0"' + ($.browser.msie ? ' allowtransparency="true"' : '') + '></iframe>', - swf: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="wmode" value="transparent" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{href}" /><embed src="{href}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="100%" height="100%" wmode="transparent"></embed></object>', - 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>' + 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" webkitAllowFullScreen mozallowfullscreen allowFullScreen' + (IE ? ' allowtransparency="true"' : '') + '></iframe>', + error : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>', + 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 // Opening fancyBox - openEffect: 'fade', // 'elastic', 'fade' or 'none' - openSpeed: 250, - openEasing: 'swing', - openOpacity: true, - openMethod: 'zoomIn', + openEffect : 'fade', // 'elastic', 'fade' or 'none' + openSpeed : 250, + openEasing : 'swing', + openOpacity : true, + openMethod : 'zoomIn', // Closing fancyBox - closeEffect: 'fade', // 'elastic', 'fade' or 'none' - closeSpeed: 250, - closeEasing: 'swing', - closeOpacity: true, - closeMethod: 'zoomOut', + closeEffect : 'fade', // 'elastic', 'fade' or 'none' + closeSpeed : 250, + closeEasing : 'swing', + closeOpacity : true, + closeMethod : 'zoomOut', // Changing next gallery item - nextEffect: 'elastic', // 'elastic', 'fade' or 'none' - nextSpeed: 300, - nextEasing: 'swing', - nextMethod: 'changeIn', + nextEffect : 'elastic', // 'elastic', 'fade' or 'none' + nextSpeed : 250, + nextEasing : 'swing', + nextMethod : 'changeIn', // Changing previous gallery item - prevEffect: 'elastic', // 'elastic', 'fade' or 'none' - prevSpeed: 300, - prevEasing: 'swing', - prevMethod: 'changeOut', + prevEffect : 'elastic', // 'elastic', 'fade' or 'none' + prevSpeed : 250, + prevEasing : 'swing', + prevMethod : 'changeOut', - // Enabled helpers - helpers: { - overlay: { - speedIn: 0, - speedOut: 300, - opacity: 0.8, - css: { - cursor: 'pointer' - }, - closeClick: true - }, - title: { - type: 'float' // 'float', 'inside', 'outside' or 'over' - } + // Enable default helpers + helpers : { + overlay : true, + title : true }, // Callbacks - onCancel: $.noop, // If canceling - beforeLoad: $.noop, // Before loading - afterLoad: $.noop, // After loading - beforeShow: $.noop, // Before changing in current item - afterShow: $.noop, // After opening - beforeClose: $.noop, // Before closing - afterClose: $.noop // After closing + onCancel : $.noop, // If canceling + beforeLoad : $.noop, // Before loading + afterLoad : $.noop, // After loading + beforeShow : $.noop, // Before changing in current item + afterShow : $.noop, // After opening + beforeChange : $.noop, // Before changing gallery item + beforeClose : $.noop, // Before closing + afterClose : $.noop // After closing }, //Current state - group: {}, // Selected group - opts: {}, // Group options - coming: null, // Element being loaded - current: null, // Currently loaded element - isOpen: false, // Is currently open - isOpened: false, // Have been fully opened at least once - wrap: null, - outer: null, - inner: null, + group : {}, // Selected group + opts : {}, // Group options + previous : null, // Previous element + coming : null, // Element being loaded + current : null, // Currently loaded element + isActive : false, // Is activated + isOpen : false, // Is currently open + isOpened : false, // Have been fully opened at least once - player: { - timer: null, - isActive: false + wrap : null, + skin : null, + outer : null, + inner : null, + + player : { + timer : null, + isActive : false }, // Loaders - ajaxLoad: null, - imgPreload: null, + ajaxLoad : null, + imgPreload : null, // Some collections - transitions: {}, - helpers: {}, + transitions : {}, + helpers : {}, /* - * Static methods - */ + * Static methods + */ open: function (group, opts) { - //Kill existing instances - F.close(true); + if (!group) { + return; + } - //Normalize group - if (group && !$.isArray(group)) { - group = group instanceof $ ? $(group).get() : [group]; + if (!$.isPlainObject(opts)) { + opts = {}; } - F.isActive = true; + // Close if already active + if (false === F.close(true)) { + return; + } + + // Normalize group + if (!$.isArray(group)) { + group = isQuery(group) ? $(group).get() : [group]; + } + + // Recheck if the type of each element is `object` and set content type (image, ajax, etc) + $.each(group, function(i, element) { + var obj = {}, + href, + title, + content, + type, + rez, + hrefParts, + selector; + + if ($.type(element) === "object") { + // Check if is DOM element + if (element.nodeType) { + element = $(element); + } + + if (isQuery(element)) { + obj = { + href : element.data('fancybox-href') || element.attr('href'), + title : element.data('fancybox-title') || element.attr('title'), + isDom : true, + element : element + }; + + if ($.metadata) { + $.extend(true, obj, element.metadata()); + } + + } else { + obj = element; + } + } + + href = opts.href || obj.href || (isString(element) ? element : null); + title = opts.title !== undefined ? opts.title : obj.title || ''; + + content = opts.content || obj.content; + type = content ? 'html' : (opts.type || obj.type); + + if (!type && obj.isDom) { + type = element.data('fancybox-type'); + + if (!type) { + rez = element.prop('class').match(/fancybox\.(\w+)/); + type = rez ? rez[1] : null; + } + } + + if (isString(href)) { + // Try to guess the content type + if (!type) { + if (F.isImage(href)) { + type = 'image'; + + } else if (F.isSWF(href)) { + type = 'swf'; + + } else if (href.charAt(0) === '#') { + type = 'inline'; + + } else if (isString(element)) { + type = 'html'; + content = element; + } + } + + // Split url into two pieces with source url and content selector, e.g, + // "/mypage.html #my_id" will load "/mypage.html" and display element having id "my_id" + if (type === 'ajax') { + hrefParts = href.split(/\s+/, 2); + href = hrefParts.shift(); + selector = hrefParts.shift(); + } + } + + if (!content) { + if (type === 'inline') { + if (href) { + content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7 + + } else if (obj.isDom) { + content = element; + } + + } else if (type === 'html') { + content = href; - //Extend the defaults + } else if (!type && !href && obj.isDom) { + type = 'inline'; + content = element; + } + } + + $.extend(obj, { + href : href, + type : type, + content : content, + title : title, + selector : selector + }); + + group[ i ] = obj; + }); + + // Extend the defaults F.opts = $.extend(true, {}, F.defaults, opts); - //All options are merged recursive except keys - if ($.isPlainObject(opts) && opts.keys !== undefined) { + // All options are merged recursive except keys + if (opts.keys !== undefined) { F.opts.keys = opts.keys ? $.extend({}, F.defaults.keys, opts.keys) : false; } F.group = group; - F._start(F.opts.index || 0); + return F._start(F.opts.index); }, + // Cancel image loading or abort ajax request cancel: function () { - if (F.coming && false === F.trigger('onCancel')) { + var coming = F.coming; + + if (!coming || false === F.trigger('onCancel')) { return; } - F.coming = null; - F.hideLoading(); if (F.ajaxLoad) { @@ -209,39 +376,57 @@ F.ajaxLoad = null; if (F.imgPreload) { - F.imgPreload.onload = F.imgPreload.onabort = F.imgPreload.onerror = null; + F.imgPreload.onload = F.imgPreload.onerror = null; + } + + if (coming.wrap) { + coming.wrap.stop(true, true).trigger('onReset').remove(); + } + + F.coming = null; + + // If the first item has been canceled, then clear everything + if (!F.current) { + F._afterZoomOut( coming ); } }, - close: function (a) { + // Start closing animation if is open; remove immediately if opening/closing + close: function (event) { F.cancel(); - if (!F.current || false === F.trigger('beforeClose')) { + if (false === F.trigger('beforeClose')) { return; } F.unbindEvents(); - //If forced or is still opening then remove immediately - if (!F.isOpen || (a && a[0] === true)) { - $(".fancybox-wrap").stop().trigger('onReset').remove(); + if (!F.isActive) { + return; + } + + if (!F.isOpen || event === true) { + $('.fancybox-wrap').stop(true).trigger('onReset').remove(); F._afterZoomOut(); } else { F.isOpen = F.isOpened = false; + F.isClosing = true; - $(".fancybox-item, .fancybox-nav").remove(); + $('.fancybox-item, .fancybox-nav').remove(); - F.wrap.stop(true).removeClass('fancybox-opened'); - F.inner.css('overflow', 'hidden'); + F.wrap.stop(true, true).removeClass('fancybox-opened'); - F.transitions[F.current.closeMethod](); + F.transitions[ F.current.closeMethod ](); } }, - // Start/stop slideshow - play: function (a) { + // Manage slideshow: + // $.fancybox.play(); - toggle slideshow + // $.fancybox.play( true ); - start + // $.fancybox.play( false ); - stop + play: function ( action ) { var clear = function () { clearTimeout(F.player.timer); }, @@ -255,7 +440,7 @@ stop = function () { clear(); - $('body').unbind('.player'); + D.unbind('.player'); F.player.isActive = false; @@ -265,10 +450,10 @@ if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) { F.player.isActive = true; - $('body').bind({ - 'afterShow.player onUpdate.player': set, - 'onCancel.player beforeClose.player': stop, - 'beforeLoad.player': clear + D.bind({ + 'onCancel.player beforeClose.player' : stop, + 'onUpdate.player' : set, + 'beforeLoad.player' : clear }); set(); @@ -277,136 +462,199 @@ } }; - if (F.player.isActive || (a && a[0] === false)) { - stop(); - } else { + if (action === true || (!F.player.isActive && action !== false)) { start(); + } else { + stop(); } }, - next: function () { - if (F.current) { - F.jumpto(F.current.index + 1); + // Navigate to next gallery item + next: function ( direction ) { + var current = F.current; + + if (current) { + if (!isString(direction)) { + direction = current.direction.next; + } + + F.jumpto(current.index + 1, direction, 'next'); } }, - prev: function () { - if (F.current) { - F.jumpto(F.current.index - 1); + // Navigate to previous gallery item + prev: function ( direction ) { + var current = F.current; + + if (current) { + if (!isString(direction)) { + direction = current.direction.prev; + } + + F.jumpto(current.index - 1, direction, 'prev'); } }, - jumpto: function (index) { - if (!F.current) { + // Navigate to gallery item by index + jumpto: function ( index, direction, router ) { + var current = F.current; + + if (!current) { return; } - index = parseInt(index, 10); + index = getScalar(index); - if (F.group.length > 1 && F.current.loop) { - if (index >= F.group.length) { - index = 0; + F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ]; + F.router = router || 'jumpto'; - } else if (index < 0) { - index = F.group.length - 1; + if (current.loop) { + if (index < 0) { + index = current.group.length + (index % current.group.length); } + + index = index % current.group.length; } - if (F.group[index] !== undefined) { + if (current.group[ index ] !== undefined) { F.cancel(); F._start(index); } }, - reposition: function (a, b) { - if (F.isOpen) { - if (b && b.type === 'scroll') { - F.wrap.stop().animate(F._getPosition(a), 200); + // Center inside viewport and toggle position type to fixed or absolute if needed + reposition: function (e, onlyAbsolute) { + var current = F.current, + wrap = current ? current.wrap : null, + pos; + + if (wrap) { + pos = F._getPosition(onlyAbsolute); + + if (e && e.type === 'scroll') { + delete pos.position; + + wrap.stop(true, true).animate(pos, 200); + } else { - F.wrap.css(F._getPosition(a)); + wrap.css(pos); + + current.pos = $.extend({}, current.dim, pos); } } }, update: function (e) { - if (F.isOpen) { - // It's a very bad idea to attach handlers to the window scroll event, run this code after a delay - if (!didResize) { - resizeTimer = setTimeout(function () { - var current = F.current; + var type = (e && e.type), + anyway = !type || type === 'orientationchange'; + + if (anyway) { + clearTimeout(didUpdate); - if (didResize) { - didResize = false; + didUpdate = null; + } + + if (!F.isOpen || didUpdate) { + return; + } - if (current) { - if (!e || (e && (e.type === 'orientationchange' || (current.autoResize && e.type === 'resize')))) { - if (current.autoSize) { - F.inner.height('auto'); - current.height = F.inner.height(); - } + didUpdate = setTimeout(function() { + var current = F.current; - F._setDimension(); + if (!current || F.isClosing) { + return; + } - if (current.canGrow) { - F.inner.height('auto'); - } - } + F.wrap.removeClass('fancybox-tmp'); - if (current.autoCenter) { - F.reposition(null, e); - } + if (anyway || type === 'load' || (type === 'resize' && current.autoResize)) { + F._setDimension(); + } - F.trigger('onUpdate'); - } - } - }, 100); + if (!(type === 'scroll' && current.canShrink)) { + F.reposition(e); } - didResize = true; - } + F.trigger('onUpdate'); + + didUpdate = null; + + }, (anyway && !isTouch ? 0 : 300)); }, - toggle: function () { + // Shrink content to fit inside viewport or restore if resized + toggle: function ( action ) { if (F.isOpen) { - F.current.fitToView = !F.current.fitToView; + F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView; + + // Help browser to restore document dimensions + if (isTouch) { + F.wrap.removeAttr('style').addClass('fancybox-tmp'); + + F.trigger('onUpdate'); + } F.update(); } }, hideLoading: function () { - D.unbind('keypress.fb'); + D.unbind('.loading'); - $("#fancybox-loading").remove(); + $('#fancybox-loading').remove(); }, showLoading: function () { + var el, viewport; + F.hideLoading(); - //If user will press the escape-button, the request will be canceled - D.bind('keypress.fb', function(e) { - if (e.keyCode == 27) { + el = $('<div id="fancybox-loading"><div></div></div>').click(F.cancel).appendTo('body'); + + // If user will press the escape-button, the request will be canceled + D.bind('keydown.loading', function(e) { + if ((e.which || e.keyCode) === 27) { e.preventDefault(); + F.cancel(); } }); - $('<div id="fancybox-loading"><div></div></div>').click(F.cancel).appendTo('body'); + if (!F.defaults.fixed) { + viewport = F.getViewport(); + + el.css({ + position : 'absolute', + top : (viewport.h * 0.5) + viewport.y, + left : (viewport.w * 0.5) + viewport.x + }); + } }, getViewport: function () { - return { - x: W.scrollLeft(), - y: W.scrollTop(), - w: W.width(), - h: W.height() - }; + var locked = (F.current && F.current.locked) || false, + rez = { + x: W.scrollLeft(), + y: W.scrollTop() + }; + + if (locked) { + rez.w = locked[0].clientWidth; + rez.h = locked[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 unbindEvents: function () { - if (F.wrap) { + if (F.wrap && isQuery(F.wrap)) { F.wrap.unbind('.fb'); } @@ -416,57 +664,82 @@ bindEvents: function () { var current = F.current, - keys = current.keys; + keys; if (!current) { return; } - W.bind('resize.fb, orientationchange.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); - if (!current.fixed && current.autoCenter) { - W.bind("scroll.fb", F.update); - } + keys = current.keys; if (keys) { D.bind('keydown.fb', function (e) { - var code; + var code = e.which || e.keyCode, + target = e.target || e.srcElement; + + // Skip esc key if loading, because showLoading will cancel preloading + if (code === 27 && F.coming) { + return false; + } // Ignore key combinations and key events within form elements - if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && $.inArray(e.target.tagName.toLowerCase(), ['input', 'textarea', 'select', 'button']) < 0) { - code = e.keyCode; + if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && !(target && (target.type || $(target).is('[contenteditable]')))) { + $.each(keys, function(i, val) { + if (current.group.length > 1 && val[ code ] !== undefined) { + F[ i ]( val[ code ] ); - if ($.inArray(code, keys.close) > -1) { - F.close(); - e.preventDefault(); + e.preventDefault(); + return false; + } - } else if ($.inArray(code, keys.next) > -1) { - F.next(); - e.preventDefault(); + if ($.inArray(code, val) > -1) { + F[ i ] (); - } else if ($.inArray(code, keys.prev) > -1) { - F.prev(); - e.preventDefault(); - } + e.preventDefault(); + return false; + } + }); } }); } - if ($.fn.mousewheel && current.mouseWheel && F.group.length > 1) { - F.wrap.bind('mousewheel.fb', function (e, delta) { - var target = e.target || null; + if ($.fn.mousewheel && current.mouseWheel) { + F.wrap.bind('mousewheel.fb', function (e, delta, deltaX, deltaY) { + var target = e.target || null, + parent = $(target), + canScroll = false; - if (delta !== 0 && (!target || target.clientHeight === 0 || (target.scrollHeight === target.clientHeight && target.scrollWidth === target.clientWidth))) { - e.preventDefault(); + while (parent.length) { + if (canScroll || parent.is('.fancybox-skin') || parent.is('.fancybox-wrap')) { + break; + } - F[delta > 0 ? 'prev' : 'next'](); + canScroll = isScrollable( parent[0] ); + parent = $(parent).parent(); + } + + if (delta !== 0 && !canScroll) { + if (F.group.length > 1 && !current.canShrink) { + if (deltaY > 0 || deltaX > 0) { + F.prev( deltaY > 0 ? 'down' : 'left' ); + + } else if (deltaY < 0 || deltaX < 0) { + F.next( deltaY < 0 ? 'up' : 'right' ); + } + + e.preventDefault(); + } } }); } }, - trigger: function (event) { - var ret, obj = F[ $.inArray(event, ['onCancel', 'beforeLoad', 'afterLoad']) > -1 ? 'coming' : 'current' ]; + trigger: function (event, o) { + var ret, obj = o || F.coming || F.current; if (!obj) { return; @@ -482,172 +755,181 @@ if (obj.helpers) { $.each(obj.helpers, function (helper, opts) { - if (opts && $.isPlainObject(F.helpers[helper]) && $.isFunction(F.helpers[helper][event])) { - F.helpers[helper][event](opts, obj); + if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) { + F.helpers[helper][event]($.extend(true, {}, F.helpers[helper].defaults, opts), obj); } }); } - $.event.trigger(event + '.fb'); + D.trigger(event); }, isImage: function (str) { - return str && str.toString().match(/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i); + return isString(str) && str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i); }, isSWF: function (str) { - return str && str.toString().match(/\.(swf)(.*)?$/i); + return isString(str) && str.match(/\.(swf)((\?|#).*)?$/i); }, _start: function (index) { var coming = {}, - element = F.group[index] || null, - isDom, + obj, href, type, - rez, - hrefParts; + margin, + padding; - if (element && (element.nodeType || element instanceof $)) { - isDom = true; + index = getScalar( index ); + obj = F.group[ index ] || null; - if ($.metadata) { - coming = $(element).metadata(); - } + if (!obj) { + return false; } - coming = $.extend(true, {}, F.opts, {index : index, element : element}, ($.isPlainObject(element) ? element : coming)); + coming = $.extend(true, {}, F.opts, obj); - // Re-check overridable options - $.each(['href', 'title', 'content', 'type'], function(i,v) { - coming[v] = F.opts[ v ] || (isDom && $(element).attr( v )) || coming[ v ] || null; - }); + // Convert margin and padding properties to array - top, right, bottom, left + margin = coming.margin; + padding = coming.padding; + + if ($.type(margin) === 'number') { + coming.margin = [margin, margin, margin, margin]; + } - // Convert margin property to array - top, right, bottom, left - if (typeof coming.margin === 'number') { - coming.margin = [coming.margin, coming.margin, coming.margin, coming.margin]; + if ($.type(padding) === 'number') { + coming.padding = [padding, padding, padding, padding]; } // 'modal' propery is just a shortcut if (coming.modal) { $.extend(true, coming, { - closeBtn : false, - closeClick: false, - nextClick : false, - arrows : false, + closeBtn : false, + closeClick : false, + nextClick : false, + arrows : false, mouseWheel : false, - keys : null, + keys : null, helpers: { overlay : { - css: { - cursor : 'auto' - }, closeClick : false } } }); } - //Give a chance for callback or helpers to update coming item (type, title, etc) + // 'autoSize' property is a shortcut, too + if (coming.autoSize) { + coming.autoWidth = coming.autoHeight = true; + } + + if (coming.width === 'auto') { + coming.autoWidth = true; + } + + if (coming.height === 'auto') { + coming.autoHeight = true; + } + + /* + * Add reference to the group, so it`s possible to access from callbacks, example: + * afterLoad : function() { + * this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : ''); + * } + */ + + coming.group = F.group; + coming.index = index; + + // Give a chance for callback or helpers to update coming item (type, title, etc) F.coming = coming; if (false === F.trigger('beforeLoad')) { F.coming = null; + return; } type = coming.type; - href = coming.href || element; + href = coming.href; - ///Check if content type is set, if not, try to get if (!type) { - if (isDom) { - rez = $(element).data('fancybox-type'); + F.coming = null; - if (!rez && element.className) { - rez = element.className.match(/fancybox\.(\w+)/); - type = rez ? rez[1] : null; - } + //If we can not determine content type then drop silently or display next/prev item if looping through gallery + if (F.current && F.router && F.router !== 'jumpto') { + F.current.index = index; + + return F[ F.router ]( F.direction ); } - if (!type && isString(href)) { - if (F.isImage(href)) { - type = 'image'; + return false; + } - } else if (F.isSWF(href)) { - type = 'swf'; + F.isActive = true; - } else if (href.match(/^#/)) { - type = 'inline'; - } - } + if (type === 'image' || type === 'swf') { + coming.autoHeight = coming.autoWidth = false; + coming.scrolling = 'visible'; + } - // ...if not - display element itself - if (!type) { - type = isDom ? 'inline' : 'html'; - } + if (type === 'image') { + coming.aspectRatio = true; + } - coming.type = type; + if (type === 'iframe' && isTouch) { + coming.scrolling = 'scroll'; } - // Check before try to load; 'inline' and 'html' types need content, others - href - if (type === 'inline' || type === 'html') { - if (!coming.content) { - if (type === 'inline') { - coming.content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7 + // Build the neccessary markup + coming.wrap = $(coming.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-type-' + type + ' fancybox-tmp ' + coming.wrapCSS).appendTo( coming.parent || 'body' ); - } else { - coming.content = element; - } - } + $.extend(coming, { + skin : $('.fancybox-skin', coming.wrap), + outer : $('.fancybox-outer', coming.wrap), + inner : $('.fancybox-inner', coming.wrap) + }); + + $.each(["Top", "Right", "Bottom", "Left"], function(i, v) { + 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) { - type = null; + return F._error( 'content' ); } } else if (!href) { - type = null; + return F._error( 'href' ); } - /* - Add reference to the group, so it`s possible to access from callbacks, example: - - afterLoad : function() { - this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : ''); - } - - */ - - hrefParts = href.split(/\s+/, 2); - - coming.group = F.group; - coming.isDom = isDom; - coming.href = hrefParts.shift(); - coming.selector = hrefParts.shift(); - if (type === 'image') { F._loadImage(); } else if (type === 'ajax') { F._loadAjax(); - } else if (type) { - F._afterLoad(); + } else if (type === 'iframe') { + F._loadIframe(); } else { - F._error( 'type' ); + F._afterLoad(); } }, _error: function ( type ) { - F.hideLoading(); - $.extend(F.coming, { - type : 'html', - autoSize : true, - minHeight : 0, - hasError : type, - content : F.coming.tpl.error + type : 'html', + autoWidth : true, + autoHeight : true, + minWidth : 0, + minHeight : 0, + scrolling : 'no', + hasError : type, + content : F.coming.tpl.error }); F._afterLoad(); @@ -655,35 +937,37 @@ _loadImage: function () { // Reset preload image so it is later possible to check "complete" property - F.imgPreload = new Image(); + var img = F.imgPreload = new Image(); - F.imgPreload.onload = function () { + img.onload = function () { this.onload = this.onerror = null; - F.coming.width = this.width; - F.coming.height = this.height; + F.coming.width = this.width / F.opts.pixelRatio; + F.coming.height = this.height / F.opts.pixelRatio; F._afterLoad(); }; - F.imgPreload.onerror = function () { + img.onerror = function () { this.onload = this.onerror = null; F._error( 'image' ); }; - F.imgPreload.src = F.coming.href; + img.src = F.coming.href; - if (!F.imgPreload.width) { + if (img.complete !== true) { F.showLoading(); } }, _loadAjax: function () { + var coming = F.coming; + F.showLoading(); - F.ajaxLoad = $.ajax($.extend({}, F.coming.ajax, { - url: F.coming.href, + F.ajaxLoad = $.ajax($.extend({}, coming.ajax, { + url: coming.href, error: function (jqXHR, textStatus) { if (F.coming && textStatus !== 'abort') { F._error( 'ajax', jqXHR ); @@ -694,7 +978,7 @@ }, success: function (data, textStatus) { if (textStatus === 'success') { - F.coming.content = data; + coming.content = data; F._afterLoad(); } @@ -702,351 +986,439 @@ })); }, + _loadIframe: function() { + var coming = F.coming, + iframe = $(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime())) + .attr('scrolling', isTouch ? 'auto' : coming.iframe.scrolling) + .attr('src', coming.href); + + // This helps IE + $(coming.wrap).bind('onReset', function () { + try { + $(this).find('iframe').hide().attr('src', '//about:blank').end().empty(); + } catch (e) {} + }); + + if (coming.iframe.preload) { + F.showLoading(); + + 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 + $(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show(); + + F._afterLoad(); + }); + } + + coming.content = iframe.appendTo( coming.inner ); + + if (!coming.iframe.preload) { + F._afterLoad(); + } + }, + _preloadImages: function() { - var group = F.group, + var group = F.group, current = F.current, - len = group.length, + len = group.length, + cnt = current.preload ? Math.min(current.preload, len - 1) : 0, item, - href, - i, - cnt = Math.min(current.preload, len - 1); - - if (!current.preload || group.length < 2) { - return; - } + i; for (i = 1; i <= cnt; i += 1) { item = group[ (current.index + i ) % len ]; - href = $( item ).attr('href') || item; - if (item.type === 'image' || F.isImage(href)) { - new Image().src = href; + if (item.type === 'image' && item.href) { + new Image().src = item.href; } } }, _afterLoad: function () { - F.hideLoading(); + var coming = F.coming, + previous = F.current, + placeholder = 'fancybox-placeholder', + current, + content, + type, + scrolling, + href, + embed; - if (!F.coming || false === F.trigger('afterLoad', F.current)) { - F.coming = false; + F.hideLoading(); + if (!coming || F.isActive === false) { return; } - if (F.isOpened) { - $(".fancybox-item").remove(); + if (false === F.trigger('afterLoad', coming, previous)) { + coming.wrap.stop(true).trigger('onReset').remove(); - F.wrap.stop(true).removeClass('fancybox-opened'); - F.inner.css('overflow', 'hidden'); + F.coming = null; - F.transitions[F.current.prevMethod](); + return; + } - } else { - $(".fancybox-wrap").stop().trigger('onReset').remove(); + if (previous) { + F.trigger('beforeChange', previous); - F.trigger('afterClose'); + previous.wrap.stop(true).removeClass('fancybox-opened') + .find('.fancybox-item, .fancybox-nav') + .remove(); } F.unbindEvents(); - F.isOpen = false; - F.current = F.coming; + current = coming; + content = coming.content; + type = coming.type; + scrolling = coming.scrolling; - //Build the neccessary markup - F.wrap = $(F.current.tpl.wrap).addClass('fancybox-' + (isMobile ? 'mobile' : 'desktop') + ' fancybox-tmp ' + F.current.wrapCSS).appendTo('body'); - F.outer = $('.fancybox-outer', F.wrap).css('padding', F.current.padding + 'px'); - F.inner = $('.fancybox-inner', F.wrap); - - F._setContent(); - }, + $.extend(F, { + wrap : current.wrap, + skin : current.skin, + outer : current.outer, + inner : current.inner, + current : current, + previous : previous + }); - _setContent: function () { - var current = F.current, content = current.content, type = current.type, loadingBay; + href = current.href; switch (type) { case 'inline': case 'ajax': case 'html': if (current.selector) { - content = $("<div>").html(content).find(current.selector); + content = $('<div>').html(content).find(current.selector); - } else if (content instanceof $) { - content = content.show().detach(); - - if (content.parent().hasClass('fancybox-inner')) { - content.parents('.fancybox-wrap').trigger('onReset').remove(); + } else if (isQuery(content)) { + if (!content.data(placeholder)) { + content.data(placeholder, $('<div class="' + placeholder + '"></div>').insertAfter( content ).hide() ); } - $(F.wrap).bind('onReset', function () { - content.appendTo('body').hide(); - }); - } - - if (current.autoSize) { - loadingBay = $('<div class="fancybox-tmp ' + F.current.wrapCSS + '"></div>').appendTo('body').append(content); - current.width = loadingBay.width(); - current.height = loadingBay.height(); - - // Re-check to fix 1px bug in some browsers - loadingBay.width( F.current.width ); - - if (loadingBay.height() > current.height) { - loadingBay.width(current.width + 1); - - current.width = loadingBay.width(); - current.height = loadingBay.height(); - } - - content = loadingBay.contents().detach(); + content = content.show().detach(); - loadingBay.remove(); + current.wrap.bind('onReset', function () { + if ($(this).find(content).length) { + content.hide().replaceAll( content.data(placeholder) ).data(placeholder, false); + } + }); } - break; case 'image': - content = current.tpl.image.replace('{href}', current.href); - - current.aspectRatio = true; + content = current.tpl.image.replace('{href}', href); break; case 'swf': - content = current.tpl.swf.replace(/\{width\}/g, current.width).replace(/\{height\}/g, current.height).replace(/\{href\}/g, current.href); + content = '<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="' + href + '"></param>'; + embed = ''; + + $.each(current.swf, function(name, val) { + content += '<param name="' + name + '" value="' + val + '"></param>'; + embed += ' ' + name + '="' + val + '"'; + }); + + content += '<embed src="' + href + '" type="application/x-shockwave-flash" width="100%" height="100%"' + embed + '></embed></object>'; break; } - if (type === 'iframe') { - content = $(current.tpl.iframe.replace('{rnd}', new Date().getTime()) ).attr('scrolling', current.scrolling); + if (!(isQuery(content) && content.parent().is(current.inner))) { + current.inner.append( content ); + } - current.scrolling = 'auto'; + // Give a chance for helpers or callbacks to update elements + F.trigger('beforeShow'); - // Set auto height for iframes - if (current.autoSize) { - content.width( current.width ); + // Set scrolling before calculating dimensions + current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling)); - F.showLoading(); + // Set initial dimensions and start position + F._setDimension(); - content.data('ready', false).appendTo(F.inner).bind({ - onCancel : function() { - $(this).unbind(); + F.reposition(); - F._afterZoomOut(); - }, - load : function() { - var iframe = $(this), height; + F.isOpen = false; + F.coming = null; - try { - if (this.contentWindow.document.location) { - height = iframe.contents().find('body').height() + 12; + F.bindEvents(); - iframe.height( height ); - } + if (!F.isOpened) { + $('.fancybox-wrap').not( current.wrap ).stop(true).trigger('onReset').remove(); - } catch (e) { - current.autoSize = false; - } + } else if (previous.prevMethod) { + F.transitions[ previous.prevMethod ](); + } - if (iframe.data('ready') === false) { - F.hideLoading(); + F.transitions[ F.isOpened ? current.nextMethod : current.openMethod ](); - if (height) { - F.current.height = height; - } + F._preloadImages(); + }, - F._beforeShow(); + _setDimension: function () { + var viewport = F.getViewport(), + steps = 0, + canShrink = false, + canExpand = false, + wrap = F.wrap, + skin = F.skin, + inner = F.inner, + current = F.current, + width = current.width, + height = current.height, + minWidth = current.minWidth, + minHeight = current.minHeight, + maxWidth = current.maxWidth, + maxHeight = current.maxHeight, + scrolling = current.scrolling, + scrollOut = current.scrollOutside ? current.scrollbarWidth : 0, + margin = current.margin, + wMargin = getScalar(margin[1] + margin[3]), + hMargin = getScalar(margin[0] + margin[2]), + wPadding, + hPadding, + wSpace, + hSpace, + origWidth, + origHeight, + origMaxWidth, + origMaxHeight, + ratio, + width_, + height_, + maxWidth_, + maxHeight_, + iframe, + body; - iframe.data('ready', true); + // Reset dimensions so we could re-check actual size + wrap.add(skin).add(inner).width('auto').height('auto').removeClass('fancybox-tmp'); - } else if (height) { - F.update(); - } - } + wPadding = getScalar(skin.outerWidth(true) - skin.width()); + hPadding = getScalar(skin.outerHeight(true) - skin.height()); - }).attr('src', current.href); + // Any space between content and viewport (margin, padding, border, title) + wSpace = wMargin + wPadding; + hSpace = hMargin + hPadding; - return; - } + origWidth = isPercentage(width) ? (viewport.w - wSpace) * getScalar(width) / 100 : width; + origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height; - content.attr('src', current.href); + if (current.type === 'iframe') { + iframe = current.content; - } else if (type === 'image' || type === 'swf') { - current.autoSize = false; - current.scrolling = 'visible'; - } - - F.inner.append(content); + if (current.autoHeight && iframe.data('ready') === 1) { + try { + if (iframe[0].contentWindow.document.location) { + inner.width( origWidth ).height(9999); - F._beforeShow(); - }, + body = iframe.contents().find('body'); - _beforeShow : function() { - F.coming = null; + if (scrollOut) { + body.css('overflow-x', 'hidden'); + } - //Give a chance for helpers or callbacks to update elements - F.trigger('beforeShow'); + origHeight = body.outerHeight(true); + } - //Set initial dimensions and hide - F._setDimension(); + } catch (e) {} + } - F.wrap.hide().removeClass('fancybox-tmp'); + } else if (current.autoWidth || current.autoHeight) { + inner.addClass( 'fancybox-tmp' ); - F.bindEvents(); - F._preloadImages(); + // Set width or height in case we need to calculate only one dimension + if (!current.autoWidth) { + inner.width( origWidth ); + } - F.transitions[ F.isOpened ? F.current.nextMethod : F.current.openMethod ](); - }, + if (!current.autoHeight) { + inner.height( origHeight ); + } - _setDimension: function () { - var wrap = F.wrap, - outer = F.outer, - inner = F.inner, - current = F.current, - viewport = F.getViewport(), - margin = current.margin, - padding2 = current.padding * 2, - width = current.width, - height = current.height, - maxWidth = current.maxWidth, - maxHeight = current.maxHeight, - minWidth = current.minWidth, - minHeight = current.minHeight, - ratio, - height_, - space; + if (current.autoWidth) { + origWidth = inner.width(); + } - viewport.w -= (margin[1] + margin[3]); - viewport.h -= (margin[0] + margin[2]); + if (current.autoHeight) { + origHeight = inner.height(); + } - if (width.toString().indexOf('%') > -1) { - width = (((viewport.w - padding2) * parseFloat(width)) / 100); + inner.removeClass( 'fancybox-tmp' ); } - if (height.toString().indexOf('%') > -1) { - height = (((viewport.h - padding2) * parseFloat(height)) / 100); - } + width = getScalar( origWidth ); + height = getScalar( origHeight ); + + ratio = origWidth / origHeight; - ratio = width / height; + // Calculations for the content + minWidth = getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth); + maxWidth = getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth); - width += padding2; - height += padding2; + minHeight = getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight); + maxHeight = getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight); + + // These will be used to determine if wrap can fit in the viewport + origMaxWidth = maxWidth; + origMaxHeight = maxHeight; if (current.fitToView) { - maxWidth = Math.min(viewport.w, maxWidth); - maxHeight = Math.min(viewport.h, maxHeight); + maxWidth = Math.min(viewport.w - wSpace, maxWidth); + maxHeight = Math.min(viewport.h - hSpace, maxHeight); } + maxWidth_ = viewport.w - wMargin; + maxHeight_ = viewport.h - hMargin; + if (current.aspectRatio) { if (width > maxWidth) { - width = maxWidth; - height = ((width - padding2) / ratio) + padding2; + width = maxWidth; + height = getScalar(width / ratio); } if (height > maxHeight) { height = maxHeight; - width = ((height - padding2) * ratio) + padding2; + width = getScalar(height * ratio); } if (width < minWidth) { - width = minWidth; - height = ((width - padding2) / ratio) + padding2; + width = minWidth; + height = getScalar(width / ratio); } if (height < minHeight) { height = minHeight; - width = ((height - padding2) * ratio) + padding2; + width = getScalar(height * ratio); } } else { width = Math.max(minWidth, Math.min(width, maxWidth)); + + if (current.autoHeight && current.type !== 'iframe') { + inner.width( width ); + + height = inner.height(); + } + height = Math.max(minHeight, Math.min(height, maxHeight)); } - width = Math.round(width); - height = Math.round(height); - - //Reset dimensions - $(wrap.add(outer).add(inner)).width('auto').height('auto'); + // Try to fit inside viewport (including the title) + if (current.fitToView) { + inner.width( width ).height( height ); - inner.width(width - padding2).height(height - padding2); - wrap.width(width); + wrap.width( width + wPadding ); - height_ = wrap.height(); // Real wrap height + // Real wrap dimensions + width_ = wrap.width(); + height_ = wrap.height(); - //Fit wrapper inside - if (width > maxWidth || height_ > maxHeight) { - while ((width > maxWidth || height_ > maxHeight) && width > minWidth && height_ > minHeight) { - height = height - 10; + if (current.aspectRatio) { + while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) { + if (steps++ > 19) { + break; + } - if (current.aspectRatio) { - width = Math.round(((height - padding2) * ratio) + padding2); + height = Math.max(minHeight, Math.min(maxHeight, height - 10)); + width = getScalar(height * ratio); if (width < minWidth) { - width = minWidth; - height = ((width - padding2) / ratio) + padding2; + width = minWidth; + height = getScalar(width / ratio); } - } else { - width = width - 10; - } + if (width > maxWidth) { + width = maxWidth; + height = getScalar(width / ratio); + } + + inner.width( width ).height( height ); - inner.width(width - padding2).height(height - padding2); - wrap.width(width); + wrap.width( width + wPadding ); + + width_ = wrap.width(); + height_ = wrap.height(); + } - height_ = wrap.height(); + } else { + width = Math.max(minWidth, Math.min(width, width - (width_ - maxWidth_))); + height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_))); } } - current.dim = { - width: width, - height: height_ - }; + if (scrollOut && scrolling === 'auto' && height < origHeight && (width + wPadding + scrollOut) < maxWidth_) { + width += scrollOut; + } - current.canGrow = current.autoSize && height > minHeight && height < maxHeight; - current.canShrink = false; - current.canExpand = false; + inner.width( width ).height( height ); - if ((width - padding2) < current.width || (height - padding2) < current.height) { - current.canExpand = true; + wrap.width( width + wPadding ); - } else if ((width > viewport.w || height_ > viewport.h) && width > minWidth && height > minHeight) { - current.canShrink = true; - } + width_ = wrap.width(); + height_ = wrap.height(); - space = height_ - padding2; + canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight; + canExpand = current.aspectRatio ? (width < origMaxWidth && height < origMaxHeight && width < origWidth && height < origHeight) : ((width < origMaxWidth || height < origMaxHeight) && (width < origWidth || height < origHeight)); - F.innerSpace = space - inner.height(); - F.outerSpace = space - outer.height(); + $.extend(current, { + dim : { + width : getValue( width_ ), + height : getValue( height_ ) + }, + origWidth : origWidth, + origHeight : origHeight, + canShrink : canShrink, + canExpand : canExpand, + wPadding : wPadding, + hPadding : hPadding, + wrapSpace : height_ - skin.outerHeight(true), + skinSpace : skin.height() - height + }); + + if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) { + inner.height('auto'); + } }, - _getPosition: function (a) { - var current = F.current, + _getPosition: function (onlyAbsolute) { + var current = F.current, viewport = F.getViewport(), - margin = current.margin, - width = F.wrap.width() + margin[1] + margin[3], - height = F.wrap.height() + margin[0] + margin[2], - rez = { + margin = current.margin, + width = F.wrap.width() + margin[1] + margin[3], + height = F.wrap.height() + margin[0] + margin[2], + rez = { position: 'absolute', - top: margin[0] + viewport.y, - left: margin[3] + viewport.x + top : margin[0], + left : margin[3] }; - if (current.autoCenter && current.fixed && (!a || a[0] === false) && 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 = Math.ceil(Math.max(rez.top, rez.top + ((viewport.h - height) * current.topRatio))) + 'px'; - rez.left = Math.ceil(Math.max(rez.left, rez.left + ((viewport.w - width) * 0.5))) + 'px'; + 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; }, _afterZoomIn: function () { - var current = F.current, scrolling = current ? current.scrolling : 'no'; + var current = F.current; if (!current) { return; @@ -1054,403 +1426,595 @@ F.isOpen = F.isOpened = true; - F.wrap.addClass('fancybox-opened').css('overflow', 'visible'); + F.wrap.css('overflow', 'visible').addClass('fancybox-opened'); F.update(); - F.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling)); - - //Assign a click event - if (current.closeClick || current.nextClick) { - //This is not the perfect solution but arrows have to be next to content so their height will match - // and I do not want another wrapper around content + // Assign a click event + if ( current.closeClick || (current.nextClick && F.group.length > 1) ) { F.inner.css('cursor', 'pointer').bind('click.fb', function(e) { if (!$(e.target).is('a') && !$(e.target).parent().is('a')) { + e.preventDefault(); + F[ current.closeClick ? 'close' : 'next' ](); } }); } - //Create a close button + // Create a close button if (current.closeBtn) { - $(current.tpl.closeBtn).appendTo(F.outer).bind('click.fb', F.close); + $(current.tpl.closeBtn).appendTo(F.skin).bind('click.fb', function(e) { + e.preventDefault(); + + F.close(); + }); } - //Create navigation arrows + // Create navigation arrows if (current.arrows && F.group.length > 1) { if (current.loop || current.index > 0) { - $(current.tpl.prev).appendTo(F.inner).bind('click.fb', F.prev); + $(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev); } if (current.loop || current.index < F.group.length - 1) { - $(current.tpl.next).appendTo(F.inner).bind('click.fb', F.next); + $(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next); } } F.trigger('afterShow'); - 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(); } }, - _afterZoomOut: function () { - F.trigger('afterClose'); + _afterZoomOut: function ( obj ) { + obj = obj || F.current; - F.wrap.trigger('onReset').remove(); + $('.fancybox-wrap').trigger('onReset').remove(); $.extend(F, { - group: {}, - opts: {}, - current: null, - isActive: false, - isOpened: false, - isOpen: false, - wrap: null, - outer: null, - inner: null + group : {}, + opts : {}, + router : false, + current : null, + isActive : false, + isOpened : false, + isOpen : false, + isClosing : false, + wrap : null, + skin : null, + outer : null, + inner : null }); + + F.trigger('afterClose', obj); } }); /* - * Default transitions - */ + * Default transitions + */ F.transitions = { getOrigPosition: function () { - var current = F.current, - element = current.element, - padding = current.padding, - orig = $(current.orig), - pos = {}, - width = 50, - height = 50, - viewport; + var current = F.current, + element = current.element, + orig = current.orig, + pos = {}, + width = 50, + height = 50, + hPadding = current.hPadding, + wPadding = current.wPadding, + viewport = F.getViewport(); - if (!orig.length && current.isDom && $(element).is(':visible')) { - orig = $(element).find('img:first'); + if (!orig && current.isDom && element.is(':visible')) { + orig = element.find('img:first'); if (!orig.length) { - orig = $(element); + orig = element; } } - if (orig.length) { + if (isQuery(orig)) { pos = orig.offset(); if (orig.is('img')) { - width = orig.outerWidth(); + width = orig.outerWidth(); height = orig.outerHeight(); } } 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 (F.wrap.css('position') === 'fixed' || current.locked) { + pos.top -= viewport.y; + pos.left -= viewport.x; } pos = { - top: Math.ceil(pos.top - padding) + 'px', - left: Math.ceil(pos.left - padding) + 'px', - width: Math.ceil(width + padding * 2) + 'px', - height: Math.ceil(height + padding * 2) + 'px' + top : getValue(pos.top - hPadding * current.topRatio), + left : getValue(pos.left - wPadding * current.leftRatio), + width : getValue(width + wPadding), + height : getValue(height + hPadding) }; return pos; }, step: function (now, fx) { - var ratio, innerValue, outerValue; + var ratio, + padding, + value, + prop = fx.prop, + current = F.current, + wrapSpace = current.wrapSpace, + skinSpace = current.skinSpace; - if (fx.prop === 'width' || fx.prop === 'height') { - innerValue = outerValue = Math.ceil(now - (F.current.padding * 2)); + if (prop === 'width' || prop === 'height') { + ratio = fx.end === fx.start ? 1 : (now - fx.start) / (fx.end - fx.start); - if (fx.prop === 'height') { - ratio = (now - fx.start) / (fx.end - fx.start); - - if (fx.start > fx.end) { - ratio = 1 - ratio; - } - - innerValue -= F.innerSpace * ratio; - outerValue -= F.outerSpace * ratio; + if (F.isClosing) { + ratio = 1 - ratio; } - F.inner[fx.prop](innerValue); - F.outer[fx.prop](outerValue); + padding = prop === 'width' ? current.wPadding : current.hPadding; + value = now - padding; + + F.skin[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) ) ); + F.inner[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) - (skinSpace * ratio) ) ); } }, zoomIn: function () { - var wrap = F.wrap, - current = F.current, - startPos, - endPos, - dim = current.dim; - - if (current.openEffect === 'elastic') { - endPos = $.extend({}, dim, F._getPosition(true)); + var current = F.current, + startPos = current.pos, + effect = current.openEffect, + elastic = effect === 'elastic', + endPos = $.extend({opacity : 1}, startPos); - //Remove "position" property - delete endPos.position; + // Remove "position" property that breaks older IE + delete endPos.position; + if (elastic) { startPos = this.getOrigPosition(); if (current.openOpacity) { - startPos.opacity = 0; - endPos.opacity = 1; + startPos.opacity = 0.1; } - F.outer.add(F.inner).width('auto').height('auto'); + } else if (effect === 'fade') { + startPos.opacity = 0.1; + } - wrap.css(startPos).show(); + F.wrap.css(startPos).animate(endPos, { + duration : effect === 'none' ? 0 : current.openSpeed, + easing : current.openEasing, + step : elastic ? this.step : null, + complete : F._afterZoomIn + }); + }, - wrap.animate(endPos, { - duration: current.openSpeed, - easing: current.openEasing, - step: this.step, - complete: F._afterZoomIn - }); + zoomOut: function () { + var current = F.current, + effect = current.closeEffect, + elastic = effect === 'elastic', + endPos = {opacity : 0.1}; - } else { - wrap.css($.extend({}, dim, F._getPosition())); + if (elastic) { + endPos = this.getOrigPosition(); + + if (current.closeOpacity) { + endPos.opacity = 0.1; + } + } + + F.wrap.animate(endPos, { + duration : effect === 'none' ? 0 : current.closeSpeed, + easing : current.closeEasing, + step : elastic ? this.step : null, + complete : F._afterZoomOut + }); + }, + + changeIn: function () { + var current = F.current, + effect = current.nextEffect, + startPos = current.pos, + endPos = { opacity : 1 }, + direction = F.direction, + distance = 200, + field; + + startPos.opacity = 0.1; - if (current.openEffect === 'fade') { - wrap.fadeIn(current.openSpeed, F._afterZoomIn); + if (effect === 'elastic') { + field = direction === 'down' || direction === 'up' ? 'top' : 'left'; + + if (direction === 'down' || direction === 'right') { + startPos[ field ] = getValue(getScalar(startPos[ field ]) - distance); + endPos[ field ] = '+=' + distance + 'px'; } else { - wrap.show(); - F._afterZoomIn(); + startPos[ field ] = getValue(getScalar(startPos[ field ]) + distance); + endPos[ field ] = '-=' + distance + 'px'; } } + + // 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 + }); + } }, - zoomOut: function () { - var wrap = F.wrap, - current = F.current, - endPos; + changeOut: function () { + var previous = F.previous, + effect = previous.prevEffect, + endPos = { opacity : 0.1 }, + direction = F.direction, + distance = 200; + + if (effect === 'elastic') { + endPos[ direction === 'down' || direction === 'up' ? 'top' : 'left' ] = ( direction === 'up' || direction === 'left' ? '-' : '+' ) + '=' + distance + 'px'; + } - if (current.closeEffect === 'elastic') { - if (wrap.css('position') === 'fixed') { - wrap.css(F._getPosition(true)); + previous.wrap.animate(endPos, { + duration : effect === 'none' ? 0 : previous.prevSpeed, + easing : previous.prevEasing, + complete : function () { + $(this).trigger('onReset').remove(); } + }); + } + }; - endPos = this.getOrigPosition(); + /* + * Overlay helper + */ - if (current.closeOpacity) { - endPos.opacity = 0; - } + F.helpers.overlay = { + defaults : { + closeClick : true, // if true, fancyBox will be closed when user clicks on the overlay + speedOut : 200, // duration of fadeOut animation + showEarly : true, // indicates if should be opened immediately or wait until the content is ready + css : {}, // custom CSS properties + locked : !isTouch, // if true, the content will be locked into overlay + fixed : true // if false, the overlay CSS position property will not be set to "fixed" + }, - wrap.animate(endPos, { - duration: current.closeSpeed, - easing: current.closeEasing, - step: this.step, - complete: F._afterZoomOut - }); + overlay : null, // current handle + fixed : false, // indicates if the overlay has position "fixed" + el : $('html'), // element that contains "the lock" - } else { - wrap.fadeOut(current.closeEffect === 'fade' ? current.closeSpeed : 0, F._afterZoomOut); + // Public methods + create : function(opts) { + opts = $.extend({}, this.defaults, opts); + + if (this.overlay) { + this.close(); + } + + this.overlay = $('<div class="fancybox-overlay"></div>').appendTo( F.coming ? F.coming.parent : opts.parent ); + this.fixed = false; + + if (opts.fixed && F.defaults.fixed) { + this.overlay.addClass('fancybox-overlay-fixed'); + + this.fixed = true; } }, - changeIn: function () { - var wrap = F.wrap, - current = F.current, - startPos; + open : function(opts) { + var that = this; - if (current.nextEffect === 'elastic') { - startPos = F._getPosition(true); - startPos.opacity = 0; - startPos.top = (parseInt(startPos.top, 10) - 200) + 'px'; + opts = $.extend({}, this.defaults, opts); - wrap.css(startPos).show().animate({ - opacity: 1, - top: '+=200px' - }, { - duration: current.nextSpeed, - easing: current.nextEasing, - complete: F._afterZoomIn - }); + if (this.overlay) { + this.overlay.unbind('.overlay').width('auto').height('auto'); } else { - wrap.css(F._getPosition()); + this.create(opts); + } - if (current.nextEffect === 'fade') { - wrap.hide().fadeIn(current.nextSpeed, F._afterZoomIn); + if (!this.fixed) { + W.bind('resize.overlay', $.proxy( this.update, this) ); - } else { - wrap.show(); - F._afterZoomIn(); - } + this.update(); } + + if (opts.closeClick) { + this.overlay.bind('click.overlay', function(e) { + if ($(e.target).hasClass('fancybox-overlay')) { + if (F.isActive) { + F.close(); + } else { + that.close(); + } + + return false; + } + }); + } + + this.overlay.css( opts.css ).show(); }, - changeOut: function () { - var wrap = F.wrap, - current = F.current, - cleanUp = function () { - $(this).trigger('onReset').remove(); - }; + close : function() { + var scrollV, scrollH; - wrap.removeClass('fancybox-opened'); + W.unbind('resize.overlay'); - if (current.prevEffect === 'elastic') { - wrap.animate({ - 'opacity': 0, - top: '+=200px' - }, { - duration: current.prevSpeed, - easing: current.prevEasing, - complete: cleanUp - }); + if (this.el.hasClass('fancybox-lock')) { + $('.fancybox-margin').removeClass('fancybox-margin'); - } else { - wrap.fadeOut(current.prevEffect === 'fade' ? current.prevSpeed : 0, cleanUp); + scrollV = W.scrollTop(); + scrollH = W.scrollLeft(); + + this.el.removeClass('fancybox-lock'); + + W.scrollTop( scrollV ).scrollLeft( scrollH ); } - } - }; - /* - * Overlay helper - */ + $('.fancybox-overlay').remove().hide(); - F.helpers.overlay = { - overlay: null, + $.extend(this, { + overlay : null, + fixed : false + }); + }, - update: function () { - var width, scrollWidth, offsetWidth; + // Private, callbacks - //Reset width/height so it will not mess - this.overlay.width(0).height(0); + update : function () { + var width = '100%', offsetWidth; - if ($.browser.msie) { - scrollWidth = Math.max(document.documentElement.scrollWidth, document.body.scrollWidth); + // Reset width/height so it will not mess + this.overlay.width(width).height('100%'); + + // jQuery does not return reliable result for IE + if (IE) { 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) { - if (this.overlay) { - return; + // This is where we can manipulate DOM, because later it would cause iframes to reload + onReady : function (opts, obj) { + var overlay = this.overlay; + + $('.fancybox-overlay').stop(true, true); + + if (!overlay) { + this.create(opts); } - opts = $.extend(true, { - speedIn : 'fast', - closeClick : true, - opacity : 1, - css : { - background: 'black' + if (opts.locked && this.fixed && obj.fixed) { + if (!overlay) { + this.margin = D.height() > W.height() ? $('html').css('margin-right').replace("px", "") : false; } - }, opts); - - this.overlay = $('<div id="fancybox-overlay"></div>').css(opts.css).appendTo('body'); - this.update(); + obj.locked = this.overlay.append( obj.wrap ); + obj.fixed = false; + } - if (opts.closeClick) { - this.overlay.bind('click.fb', F.close); + if (opts.showEarly === true) { + this.beforeShow.apply(this, arguments); } + }, + + beforeShow : function(opts, obj) { + var scrollV, scrollH; + + if (obj.locked) { + if (this.margin !== false) { + $('*').filter(function(){ + return ($(this).css('position') === 'fixed' && !$(this).hasClass("fancybox-overlay") && !$(this).hasClass("fancybox-wrap") ); + }).addClass('fancybox-margin'); + + this.el.addClass('fancybox-margin'); + } + + scrollV = W.scrollTop(); + scrollH = W.scrollLeft(); - W.bind("resize.fb", $.proxy(this.update, this)); + this.el.addClass('fancybox-lock'); - this.overlay.fadeTo(opts.speedIn, opts.opacity); + W.scrollTop( scrollV ).scrollLeft( scrollH ); + } + + this.open(opts); }, - onUpdate: function () { - //Update as content may change document dimensions - this.update(); + onUpdate : function() { + if (!this.fixed) { + this.update(); + } }, afterClose: function (opts) { - if (this.overlay) { - this.overlay.fadeOut(opts.speedOut || 0, function () { - $(this).remove(); - }); + // Remove overlay if exists and fancyBox is not opening + // (e.g., it is not being open using afterClose callback) + //if (this.overlay && !F.isActive) { + if (this.overlay && !F.coming) { + this.overlay.fadeOut(opts.speedOut, $.proxy( this.close, this )); } - - this.overlay = null; } }; /* - * Title helper - */ + * Title helper + */ F.helpers.title = { + defaults : { + type : 'float', // 'float', 'inside', 'outside' or 'over', + position : 'bottom' // 'top' or 'bottom' + }, + beforeShow: function (opts) { - var title, text = F.current.title; + var current = F.current, + text = current.title, + type = opts.type, + title, + target; + + if ($.isFunction(text)) { + text = text.call(current.element, current); + } + + if (!isString(text) || $.trim(text) === '') { + return; + } + + title = $('<div class="fancybox-title fancybox-title-' + type + '-wrap">' + text + '</div>'); + + switch (type) { + case 'inside': + target = F.skin; + break; + + case 'outside': + target = F.wrap; + break; + + case 'over': + target = F.inner; + break; - if (text) { - title = $('<div class="fancybox-title fancybox-title-' + opts.type + '-wrap">' + text + '</div>').appendTo('body'); + default: // 'float' + target = F.skin; - if (opts.type === 'float') { - //This helps for some browsers - title.width(title.width()); + title.appendTo('body'); + + if (IE) { + title.width( title.width() ); + } title.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)); - } - - title.appendTo(opts.type === 'over' ? F.inner : (opts.type === 'outside' ? F.wrap : F.outer)); + F.current.margin[2] += Math.abs( getScalar(title.css('margin-bottom')) ); + break; } + + title[ (opts.position === 'top' ? 'prependTo' : 'appendTo') ](target); } }; // jQuery plugin initialization $.fn.fancybox = function (options) { - var that = $(this), + var index, + that = $(this), selector = this.selector || '', - index, - run = function(e) { - var what = this, idx = index, relType, relVal; - - if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey)) { - e.preventDefault(); + run = function(e) { + var what = $(this).blur(), idx = index, relType, relVal; + 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') { what = selector.length ? $(selector) : that; what = what.filter('[' + relType + '="' + relVal + '"]'); - idx = what.index(this); + idx = what.index(this); } options.index = idx; - F.open(what, options); + // Stop an event from bubbling if everything is fine + if (F.open(what, options) !== false) { + e.preventDefault(); + } } }; options = options || {}; - index = options.index || 0; + index = options.index || 0; - if (selector) { - D.undelegate(selector, 'click.fb-start').delegate(selector, 'click.fb-start', run); + if (!selector || options.live === false) { + that.unbind('click.fb-start').bind('click.fb-start', run); } else { - that.unbind('click.fb-start').bind('click.fb-start', run); + D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run); } + this.filter('[data-fancybox-start=1]').trigger('click'); + return this; }; -}(window, document));
\ No newline at end of file + // Tests that need a body at doc ready + D.ready(function() { + var w1, w2; + + 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, { + scrollbarWidth : $.scrollbarWidth(), + fixed : $.support.fixedPosition, + parent : $('body') + }); + + //Get real width of page scroll-bar + w1 = $(window).width(); + + H.addClass('fancybox-lock-test'); + + w2 = $(window).width(); + + H.removeClass('fancybox-lock-test'); + + $("<style type='text/css'>.fancybox-margin{margin-right:" + (w2 - w1) + "px;}</style>").appendTo("head"); + }); + +}(window, document, jQuery));
\ No newline at end of file diff --git a/javascript/jquery/plugins/fancybox/jquery.fancybox.pack.js b/javascript/jquery/plugins/fancybox/jquery.fancybox.pack.js index 4b73736..73f7578 100644..100755 --- a/javascript/jquery/plugins/fancybox/jquery.fancybox.pack.js +++ b/javascript/jquery/plugins/fancybox/jquery.fancybox.pack.js @@ -1,35 +1,46 @@ -/*! fancyBox v2.0.5 fancyapps.com | fancyapps.com/fancybox/#license */ -(function(t,n,s){var d=t.jQuery,l=d(t),m=d(n),a=d.fancybox=function(){a.open.apply(this,arguments)},q=!1,r=n.createTouch!==s;d.extend(a,{version:"2.0.5",defaults:{padding:15,margin:20,width:800,height:600,minWidth:100,minHeight:100,maxWidth:9999,maxHeight:9999,autoSize:!0,autoResize:!r,autoCenter:!r,fitToView:!0,aspectRatio:!1,topRatio:0.5,fixed:!(d.browser.msie&&6>=d.browser.version)&&!r,scrolling:"auto",wrapCSS:"fancybox-default",arrows:!0,closeBtn:!0,closeClick:!1,nextClick:!1,mouseWheel:!0,autoPlay:!1, -playSpeed:3E3,preload:3,modal:!1,loop:!0,ajax:{dataType:"html",headers:{"X-fancyBox":!0}},keys:{next:[13,32,34,39,40],prev:[8,33,37,38],close:[27]},tpl:{wrap:'<div class="fancybox-wrap"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div>',image:'<img class="fancybox-image" src="{href}" alt="" />',iframe:'<iframe class="fancybox-iframe" name="fancybox-frame{rnd}" frameborder="0" hspace="0"'+(d.browser.msie?' allowtransparency="true"':"")+"></iframe>",swf:'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="wmode" value="transparent" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{href}" /><embed src="{href}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="100%" height="100%" wmode="transparent"></embed></object>', -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>'},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0,openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut", -nextEffect:"elastic",nextSpeed:300,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:300,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:{speedIn:0,speedOut:300,opacity:0.8,css:{cursor:"pointer"},closeClick:!0},title:{type:"float"}}},group:{},opts:{},coming:null,current:null,isOpen:!1,isOpened:!1,wrap:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(b,c){a.close(!0);b&&!d.isArray(b)&&(b= -b instanceof d?d(b).get():[b]);a.isActive=!0;a.opts=d.extend(!0,{},a.defaults,c);d.isPlainObject(c)&&c.keys!==s&&(a.opts.keys=c.keys?d.extend({},a.defaults.keys,c.keys):!1);a.group=b;a._start(a.opts.index||0)},cancel:function(){a.coming&&!1===a.trigger("onCancel")||(a.coming=null,a.hideLoading(),a.ajaxLoad&&a.ajaxLoad.abort(),a.ajaxLoad=null,a.imgPreload&&(a.imgPreload.onload=a.imgPreload.onabort=a.imgPreload.onerror=null))},close:function(b){a.cancel();a.current&&!1!==a.trigger("beforeClose")&&(a.unbindEvents(), -!a.isOpen||b&&!0===b[0]?(d(".fancybox-wrap").stop().trigger("onReset").remove(),a._afterZoomOut()):(a.isOpen=a.isOpened=!1,d(".fancybox-item, .fancybox-nav").remove(),a.wrap.stop(!0).removeClass("fancybox-opened"),a.inner.css("overflow","hidden"),a.transitions[a.current.closeMethod]()))},play:function(b){var c=function(){clearTimeout(a.player.timer)},f=function(){c();a.current&&a.player.isActive&&(a.player.timer=setTimeout(a.next,a.current.playSpeed))},e=function(){c();d("body").unbind(".player"); -a.player.isActive=!1;a.trigger("onPlayEnd")};if(a.player.isActive||b&&!1===b[0])e();else if(a.current&&(a.current.loop||a.current.index<a.group.length-1))a.player.isActive=!0,d("body").bind({"afterShow.player onUpdate.player":f,"onCancel.player beforeClose.player":e,"beforeLoad.player":c}),f(),a.trigger("onPlayStart")},next:function(){a.current&&a.jumpto(a.current.index+1)},prev:function(){a.current&&a.jumpto(a.current.index-1)},jumpto:function(b){a.current&&(b=parseInt(b,10),1<a.group.length&&a.current.loop&& -(b>=a.group.length?b=0:0>b&&(b=a.group.length-1)),a.group[b]!==s&&(a.cancel(),a._start(b)))},reposition:function(b,c){a.isOpen&&(c&&"scroll"===c.type?a.wrap.stop().animate(a._getPosition(b),200):a.wrap.css(a._getPosition(b)))},update:function(b){a.isOpen&&(q||setTimeout(function(){var c=a.current;if(q&&(q=!1,c)){if(!b||b&&("orientationchange"===b.type||c.autoResize&&"resize"===b.type))c.autoSize&&(a.inner.height("auto"),c.height=a.inner.height()),a._setDimension(),c.canGrow&&a.inner.height("auto"); -c.autoCenter&&a.reposition(null,b);a.trigger("onUpdate")}},100),q=!0)},toggle:function(){a.isOpen&&(a.current.fitToView=!a.current.fitToView,a.update())},hideLoading:function(){m.unbind("keypress.fb");d("#fancybox-loading").remove()},showLoading:function(){a.hideLoading();m.bind("keypress.fb",function(b){27==b.keyCode&&(b.preventDefault(),a.cancel())});d('<div id="fancybox-loading"><div></div></div>').click(a.cancel).appendTo("body")},getViewport:function(){return{x:l.scrollLeft(),y:l.scrollTop(), -w:l.width(),h:l.height()}},unbindEvents:function(){a.wrap&&a.wrap.unbind(".fb");m.unbind(".fb");l.unbind(".fb")},bindEvents:function(){var b=a.current,c=b.keys;b&&(l.bind("resize.fb, orientationchange.fb",a.update),!b.fixed&&b.autoCenter&&l.bind("scroll.fb",a.update),c&&m.bind("keydown.fb",function(b){var e;!b.ctrlKey&&!b.altKey&&!b.shiftKey&&!b.metaKey&&0>d.inArray(b.target.tagName.toLowerCase(),["input","textarea","select","button"])&&(e=b.keyCode,-1<d.inArray(e,c.close)?(a.close(),b.preventDefault()): --1<d.inArray(e,c.next)?(a.next(),b.preventDefault()):-1<d.inArray(e,c.prev)&&(a.prev(),b.preventDefault()))}),d.fn.mousewheel&&b.mouseWheel&&1<a.group.length&&a.wrap.bind("mousewheel.fb",function(b,c){var d=b.target||null;if(0!==c&&(!d||0===d.clientHeight||d.scrollHeight===d.clientHeight&&d.scrollWidth===d.clientWidth))b.preventDefault(),a[0<c?"prev":"next"]()}))},trigger:function(b){var c,f=a[-1<d.inArray(b,["onCancel","beforeLoad","afterLoad"])?"coming":"current"];if(f){d.isFunction(f[b])&&(c=f[b].apply(f, -Array.prototype.slice.call(arguments,1)));if(!1===c)return!1;f.helpers&&d.each(f.helpers,function(c,g){if(g&&d.isPlainObject(a.helpers[c])&&d.isFunction(a.helpers[c][b]))a.helpers[c][b](g,f)});d.event.trigger(b+".fb")}},isImage:function(a){return a&&a.toString().match(/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i)},isSWF:function(a){return a&&a.toString().match(/\.(swf)(.*)?$/i)},_start:function(b){var c={},f=a.group[b]||null,e,g,k;if(f&&(f.nodeType||f instanceof d))e=!0,d.metadata&&(c=d(f).metadata());c=d.extend(!0, -{},a.opts,{index:b,element:f},d.isPlainObject(f)?f:c);d.each(["href","title","content","type"],function(b,g){c[g]=a.opts[g]||e&&d(f).attr(g)||c[g]||null});"number"===typeof c.margin&&(c.margin=[c.margin,c.margin,c.margin,c.margin]);c.modal&&d.extend(!0,c,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,mouseWheel:!1,keys:null,helpers:{overlay:{css:{cursor:"auto"},closeClick:!1}}});a.coming=c;if(!1===a.trigger("beforeLoad"))a.coming=null;else{b=c.type;g=c.href||f;b||(e&&(k=d(f).data("fancybox-type"), -!k&&f.className&&(b=(k=f.className.match(/fancybox\.(\w+)/))?k[1]:null)),!b&&"string"===d.type(g)&&(a.isImage(g)?b="image":a.isSWF(g)?b="swf":g.match(/^#/)&&(b="inline")),b||(b=e?"inline":"html"),c.type=b);if("inline"===b||"html"===b){if(c.content||(c.content="inline"===b?d("string"===d.type(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):f),!c.content||!c.content.length)b=null}else g||(b=null);g=g.split(/\s+/,2);c.group=a.group;c.isDom=e;c.href=g.shift();c.selector=g.shift();"image"===b?a._loadImage():"ajax"=== -b?a._loadAjax():b?a._afterLoad():a._error("type")}},_error:function(b){a.hideLoading();d.extend(a.coming,{type:"html",autoSize:!0,minHeight:0,hasError:b,content:a.coming.tpl.error});a._afterLoad()},_loadImage:function(){a.imgPreload=new Image;a.imgPreload.onload=function(){this.onload=this.onerror=null;a.coming.width=this.width;a.coming.height=this.height;a._afterLoad()};a.imgPreload.onerror=function(){this.onload=this.onerror=null;a._error("image")};a.imgPreload.src=a.coming.href;a.imgPreload.width|| -a.showLoading()},_loadAjax:function(){a.showLoading();a.ajaxLoad=d.ajax(d.extend({},a.coming.ajax,{url:a.coming.href,error:function(b,c){a.coming&&"abort"!==c?a._error("ajax",b):a.hideLoading()},success:function(b,c){"success"===c&&(a.coming.content=b,a._afterLoad())}}))},_preloadImages:function(){var b=a.group,c=a.current,f=b.length,e,g,k,h=Math.min(c.preload,f-1);if(c.preload&&!(2>b.length))for(k=1;k<=h;k+=1)if(e=b[(c.index+k)%f],g=d(e).attr("href")||e,"image"===e.type||a.isImage(g))(new Image).src= -g},_afterLoad:function(){a.hideLoading();!a.coming||!1===a.trigger("afterLoad",a.current)?a.coming=!1:(a.isOpened?(d(".fancybox-item").remove(),a.wrap.stop(!0).removeClass("fancybox-opened"),a.inner.css("overflow","hidden"),a.transitions[a.current.prevMethod]()):(d(".fancybox-wrap").stop().trigger("onReset").remove(),a.trigger("afterClose")),a.unbindEvents(),a.isOpen=!1,a.current=a.coming,a.wrap=d(a.current.tpl.wrap).addClass("fancybox-"+(r?"mobile":"desktop")+" fancybox-tmp "+a.current.wrapCSS).appendTo("body"), -a.outer=d(".fancybox-outer",a.wrap).css("padding",a.current.padding+"px"),a.inner=d(".fancybox-inner",a.wrap),a._setContent())},_setContent:function(){var b=a.current,c=b.content,f=b.type,e;switch(f){case "inline":case "ajax":case "html":b.selector?c=d("<div>").html(c).find(b.selector):c instanceof d&&(c=c.show().detach(),c.parent().hasClass("fancybox-inner")&&c.parents(".fancybox-wrap").trigger("onReset").remove(),d(a.wrap).bind("onReset",function(){c.appendTo("body").hide()}));b.autoSize&&(e=d('<div class="fancybox-tmp '+ -a.current.wrapCSS+'"></div>').appendTo("body").append(c),b.width=e.width(),b.height=e.height(),e.width(a.current.width),e.height()>b.height&&(e.width(b.width+1),b.width=e.width(),b.height=e.height()),c=e.contents().detach(),e.remove());break;case "image":c=b.tpl.image.replace("{href}",b.href);b.aspectRatio=!0;break;case "swf":c=b.tpl.swf.replace(/\{width\}/g,b.width).replace(/\{height\}/g,b.height).replace(/\{href\}/g,b.href)}if("iframe"===f){c=d(b.tpl.iframe.replace("{rnd}",(new Date).getTime())).attr("scrolling", -b.scrolling);b.scrolling="auto";if(b.autoSize){c.width(b.width);a.showLoading();c.data("ready",!1).appendTo(a.inner).bind({onCancel:function(){d(this).unbind();a._afterZoomOut()},load:function(){var c=d(this),f;try{this.contentWindow.document.location&&(f=c.contents().find("body").height()+12,c.height(f))}catch(e){b.autoSize=!1}!1===c.data("ready")?(a.hideLoading(),f&&(a.current.height=f),a._beforeShow(),c.data("ready",!0)):f&&a.update()}}).attr("src",b.href);return}c.attr("src",b.href)}else if("image"=== -f||"swf"===f)b.autoSize=!1,b.scrolling="visible";a.inner.append(c);a._beforeShow()},_beforeShow:function(){a.coming=null;a.trigger("beforeShow");a._setDimension();a.wrap.hide().removeClass("fancybox-tmp");a.bindEvents();a._preloadImages();a.transitions[a.isOpened?a.current.nextMethod:a.current.openMethod]()},_setDimension:function(){var b=a.wrap,c=a.outer,f=a.inner,e=a.current,g=a.getViewport(),k=e.margin,h=2*e.padding,i=e.width,j=e.height,l=e.maxWidth,o=e.maxHeight,m=e.minWidth,n=e.minHeight,p;g.w-= -k[1]+k[3];g.h-=k[0]+k[2];-1<i.toString().indexOf("%")&&(i=(g.w-h)*parseFloat(i)/100);-1<j.toString().indexOf("%")&&(j=(g.h-h)*parseFloat(j)/100);k=i/j;i+=h;j+=h;e.fitToView&&(l=Math.min(g.w,l),o=Math.min(g.h,o));e.aspectRatio?(i>l&&(i=l,j=(i-h)/k+h),j>o&&(j=o,i=(j-h)*k+h),i<m&&(i=m,j=(i-h)/k+h),j<n&&(j=n,i=(j-h)*k+h)):(i=Math.max(m,Math.min(i,l)),j=Math.max(n,Math.min(j,o)));i=Math.round(i);j=Math.round(j);d(b.add(c).add(f)).width("auto").height("auto");f.width(i-h).height(j-h);b.width(i);p=b.height(); -if(i>l||p>o)for(;(i>l||p>o)&&i>m&&p>n;)j-=10,e.aspectRatio?(i=Math.round((j-h)*k+h),i<m&&(i=m,j=(i-h)/k+h)):i-=10,f.width(i-h).height(j-h),b.width(i),p=b.height();e.dim={width:i,height:p};e.canGrow=e.autoSize&&j>n&&j<o;e.canShrink=!1;e.canExpand=!1;if(i-h<e.width||j-h<e.height)e.canExpand=!0;else if((i>g.w||p>g.h)&&i>m&&j>n)e.canShrink=!0;b=p-h;a.innerSpace=b-f.height();a.outerSpace=b-c.height()},_getPosition:function(b){var c=a.current,f=a.getViewport(),d=c.margin,g=a.wrap.width()+d[1]+d[3],k=a.wrap.height()+ -d[0]+d[2],h={position:"absolute",top:d[0]+f.y,left:d[3]+f.x};if(c.autoCenter&&c.fixed&&(!b||!1===b[0])&&k<=f.h&&g<=f.w)h={position:"fixed",top:d[0],left:d[3]};h.top=Math.ceil(Math.max(h.top,h.top+(f.h-k)*c.topRatio))+"px";h.left=Math.ceil(Math.max(h.left,h.left+0.5*(f.w-g)))+"px";return h},_afterZoomIn:function(){var b=a.current,c=b?b.scrolling:"no";b&&(a.isOpen=a.isOpened=!0,a.wrap.addClass("fancybox-opened").css("overflow","visible"),a.update(),a.inner.css("overflow","yes"===c?"scroll":"no"===c? -"hidden":c),(b.closeClick||b.nextClick)&&a.inner.css("cursor","pointer").bind("click.fb",function(c){if(!d(c.target).is("a")&&!d(c.target).parent().is("a"))a[b.closeClick?"close":"next"]()}),b.closeBtn&&d(b.tpl.closeBtn).appendTo(a.outer).bind("click.fb",a.close),b.arrows&&1<a.group.length&&((b.loop||0<b.index)&&d(b.tpl.prev).appendTo(a.inner).bind("click.fb",a.prev),(b.loop||b.index<a.group.length-1)&&d(b.tpl.next).appendTo(a.inner).bind("click.fb",a.next)),a.trigger("afterShow"),a.opts.autoPlay&& -!a.player.isActive&&(a.opts.autoPlay=!1,a.play()))},_afterZoomOut:function(){a.trigger("afterClose");a.wrap.trigger("onReset").remove();d.extend(a,{group:{},opts:{},current:null,isActive:!1,isOpened:!1,isOpen:!1,wrap:null,outer:null,inner:null})}});a.transitions={getOrigPosition:function(){var b=a.current,c=b.element,f=b.padding,e=d(b.orig),g={},k=50,h=50;!e.length&&b.isDom&&d(c).is(":visible")&&(e=d(c).find("img:first"),e.length||(e=d(c)));e.length?(g=e.offset(),e.is("img")&&(k=e.outerWidth(),h= -e.outerHeight())):(b=a.getViewport(),g.top=b.y+0.5*(b.h-h),g.left=b.x+0.5*(b.w-k));return g={top:Math.ceil(g.top-f)+"px",left:Math.ceil(g.left-f)+"px",width:Math.ceil(k+2*f)+"px",height:Math.ceil(h+2*f)+"px"}},step:function(b,c){var d,e,g;if("width"===c.prop||"height"===c.prop)e=g=Math.ceil(b-2*a.current.padding),"height"===c.prop&&(d=(b-c.start)/(c.end-c.start),c.start>c.end&&(d=1-d),e-=a.innerSpace*d,g-=a.outerSpace*d),a.inner[c.prop](e),a.outer[c.prop](g)},zoomIn:function(){var b=a.wrap,c=a.current, -f,e;f=c.dim;"elastic"===c.openEffect?(e=d.extend({},f,a._getPosition(!0)),delete e.position,f=this.getOrigPosition(),c.openOpacity&&(f.opacity=0,e.opacity=1),a.outer.add(a.inner).width("auto").height("auto"),b.css(f).show(),b.animate(e,{duration:c.openSpeed,easing:c.openEasing,step:this.step,complete:a._afterZoomIn})):(b.css(d.extend({},f,a._getPosition())),"fade"===c.openEffect?b.fadeIn(c.openSpeed,a._afterZoomIn):(b.show(),a._afterZoomIn()))},zoomOut:function(){var b=a.wrap,c=a.current,d;"elastic"=== -c.closeEffect?("fixed"===b.css("position")&&b.css(a._getPosition(!0)),d=this.getOrigPosition(),c.closeOpacity&&(d.opacity=0),b.animate(d,{duration:c.closeSpeed,easing:c.closeEasing,step:this.step,complete:a._afterZoomOut})):b.fadeOut("fade"===c.closeEffect?c.closeSpeed:0,a._afterZoomOut)},changeIn:function(){var b=a.wrap,c=a.current,d;"elastic"===c.nextEffect?(d=a._getPosition(!0),d.opacity=0,d.top=parseInt(d.top,10)-200+"px",b.css(d).show().animate({opacity:1,top:"+=200px"},{duration:c.nextSpeed, -easing:c.nextEasing,complete:a._afterZoomIn})):(b.css(a._getPosition()),"fade"===c.nextEffect?b.hide().fadeIn(c.nextSpeed,a._afterZoomIn):(b.show(),a._afterZoomIn()))},changeOut:function(){var b=a.wrap,c=a.current,f=function(){d(this).trigger("onReset").remove()};b.removeClass("fancybox-opened");"elastic"===c.prevEffect?b.animate({opacity:0,top:"+=200px"},{duration:c.prevSpeed,easing:c.prevEasing,complete:f}):b.fadeOut("fade"===c.prevEffect?c.prevSpeed:0,f)}};a.helpers.overlay={overlay:null,update:function(){var a, -c;this.overlay.width(0).height(0);d.browser.msie?(a=Math.max(n.documentElement.scrollWidth,n.body.scrollWidth),c=Math.max(n.documentElement.offsetWidth,n.body.offsetWidth),a=a<c?l.width():a):a=m.width();this.overlay.width(a).height(m.height())},beforeShow:function(b){this.overlay||(b=d.extend(!0,{speedIn:"fast",closeClick:!0,opacity:1,css:{background:"black"}},b),this.overlay=d('<div id="fancybox-overlay"></div>').css(b.css).appendTo("body"),this.update(),b.closeClick&&this.overlay.bind("click.fb", -a.close),l.bind("resize.fb",d.proxy(this.update,this)),this.overlay.fadeTo(b.speedIn,b.opacity))},onUpdate:function(){this.update()},afterClose:function(a){this.overlay&&this.overlay.fadeOut(a.speedOut||0,function(){d(this).remove()});this.overlay=null}};a.helpers.title={beforeShow:function(b){var c;if(c=a.current.title)c=d('<div class="fancybox-title fancybox-title-'+b.type+'-wrap">'+c+"</div>").appendTo("body"),"float"===b.type&&(c.width(c.width()),c.wrapInner('<span class="child"></span>'),a.current.margin[2]+= -Math.abs(parseInt(c.css("margin-bottom"),10))),c.appendTo("over"===b.type?a.inner:"outside"===b.type?a.wrap:a.outer)}};d.fn.fancybox=function(b){var c=d(this),f=this.selector||"",e,g=function(g){var h=this,i=e,j;!g.ctrlKey&&!g.altKey&&!g.shiftKey&&!g.metaKey&&(g.preventDefault(),g=b.groupAttr||"data-fancybox-group",j=d(h).attr(g),j||(g="rel",j=h[g]),j&&""!==j&&"nofollow"!==j&&(h=f.length?d(f):c,h=h.filter("["+g+'="'+j+'"]'),i=h.index(this)),b.index=i,a.open(h,b))},b=b||{};e=b.index||0;f?m.undelegate(f, -"click.fb-start").delegate(f,"click.fb-start",g):c.unbind("click.fb-start").bind("click.fb-start",g);return this}})(window,document);
\ No newline at end of file +/*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */ +(function(r,G,f,v){var J=f("html"),n=f(r),p=f(G),b=f.fancybox=function(){b.open.apply(this,arguments)},I=navigator.userAgent.match(/msie/i),B=null,s=G.createTouch!==v,t=function(a){return a&&a.hasOwnProperty&&a instanceof f},q=function(a){return a&&"string"===f.type(a)},E=function(a){return q(a)&&0<a.indexOf("%")},l=function(a,d){var e=parseInt(a,10)||0;d&&E(a)&&(e*=b.getViewport()[d]/100);return Math.ceil(e)},w=function(a,b){return l(a,b)+"px"};f.extend(b,{version:"2.1.5",defaults:{padding:15,margin:20, +width:800,height:600,minWidth:100,minHeight:100,maxWidth:9999,maxHeight:9999,pixelRatio:1,autoSize:!0,autoHeight:!1,autoWidth:!1,autoResize:!0,autoCenter:!s,fitToView:!0,aspectRatio:!1,topRatio:0.5,leftRatio:0.5,scrolling:"auto",wrapCSS:"",arrows:!0,closeBtn:!0,closeClick:!1,nextClick:!1,mouseWheel:!0,autoPlay:!1,playSpeed:3E3,preload:3,modal:!1,loop:!0,ajax:{dataType:"html",headers:{"X-fancyBox":!0}},iframe:{scrolling:"auto",preload:!0},swf:{wmode:"transparent",allowfullscreen:"true",allowscriptaccess:"always"}, +keys:{next:{13:"left",34:"up",39:"left",40:"up"},prev:{8:"right",33:"down",37:"right",38:"down"},close:[27],play:[32],toggle:[70]},direction:{next:"left",prev:"right"},scrollOutside:!0,index:0,type:null,href:null,content:null,title:null,tpl:{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" webkitAllowFullScreen mozallowfullscreen allowFullScreen'+ +(I?' allowtransparency="true"':"")+"></iframe>",error:'<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',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>'},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0, +openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1, +isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k, +c.metadata())):k=c);g=d.href||k.href||(q(c)?c:null);h=d.title!==v?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));q(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":q(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(q(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&& +k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==v&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current|| +b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer= +setTimeout(b.next,b.current.playSpeed))},c=function(){d();p.unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index<b.group.length-1))b.player.isActive=!0,p.bind({"onCancel.player beforeClose.player":c,"onUpdate.player":e,"beforeLoad.player":d}),e(),b.trigger("onPlayStart")}else c()},next:function(a){var d=b.current;d&&(q(a)||(a=d.direction.next),b.jumpto(d.index+1,a,"next"))},prev:function(a){var d=b.current; +d&&(q(a)||(a=d.direction.prev),b.jumpto(d.index-1,a,"prev"))},jumpto:function(a,d,e){var c=b.current;c&&(a=l(a),b.direction=d||c.direction[a>=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==v&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({},e.dim,k)))},update:function(a){var d= +a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(B),B=null);b.isOpen&&!B&&(B=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),B=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"),b.trigger("onUpdate")), +b.update())},hideLoading:function(){p.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('<div id="fancybox-loading"><div></div></div>').click(b.cancel).appendTo("body");p.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked||!1,d={x:n.scrollLeft(), +y:n.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&r.innerWidth?r.innerWidth:n.width(),d.h=s&&r.innerHeight?r.innerHeight:n.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");p.unbind(".fb");n.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(n.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&p.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k=e.target||e.srcElement; +if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1<a.group.length&&k[c]!==v)return b[d](k[c]),e.preventDefault(),!1;if(-1<f.inArray(c,k))return b[d](),e.preventDefault(),!1})}),f.fn.mousewheel&&a.mouseWheel&&b.wrap.bind("mousewheel.fb",function(d,c,k,g){for(var h=f(d.target||null),j=!1;h.length&&!j&&!h.is(".fancybox-skin")&&!h.is(".fancybox-wrap");)j=h[0]&&!(h[0].style.overflow&&"hidden"===h[0].style.overflow)&& +(h[0].clientWidth&&h[0].scrollWidth>h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1<b.group.length&&!a.canShrink){if(0<g||0<k)b.prev(0<g?"down":"left");else if(0>g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d,e){if(e&&b.helpers[d]&&f.isFunction(b.helpers[d][a]))b.helpers[d][a](f.extend(!0, +{},b.helpers[d].defaults,e),c)});p.trigger(a)}},isImage:function(a){return q(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i)},isSWF:function(a){return q(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&&(d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1, +mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive=!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio= +!0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,w(d.padding[a]))});b.trigger("onReady");if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href"); +"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width=this.width/b.opts.pixelRatio;b.coming.height=this.height/b.opts.pixelRatio;b._afterLoad()};a.onerror=function(){this.onload= +this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g,(new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href); +f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a=b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload, +e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents();e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin, +outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("<div>").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('<div class="fancybox-placeholder"></div>').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder",!1)}));break;case "image":e=a.tpl.image.replace("{href}", +g);break;case "swf":e='<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="'+g+'"></param>',h="",f.each(a.swf,function(a,b){e+='<param name="'+a+'" value="'+b+'"></param>';h+=" "+a+'="'+b+'"'}),e+='<embed src="'+g+'" type="application/x-shockwave-flash" width="100%" height="100%"'+h+"></embed></object>"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow");a.inner.css("overflow","yes"===k?"scroll": +"no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth,p=h.maxHeight,s=h.scrolling,q=h.scrollOutside? +h.scrollbarWidth:0,x=h.margin,y=l(x[1]+x[3]),r=l(x[0]+x[2]),v,z,t,C,A,F,B,D,H;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");x=l(k.outerWidth(!0)-k.width());v=l(k.outerHeight(!0)-k.height());z=y+x;t=r+v;C=E(c)?(a.w-z)*l(c)/100:c;A=E(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(H=h.content,h.autoHeight&&1===H.data("ready"))try{H[0].contentWindow.document.location&&(g.width(C).height(9999),F=H.contents().find("body"),q&&F.css("overflow-x","hidden"),A=F.outerHeight(!0))}catch(G){}}else if(h.autoWidth|| +h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(C),h.autoHeight||g.height(A),h.autoWidth&&(C=g.width()),h.autoHeight&&(A=g.height()),g.removeClass("fancybox-tmp");c=l(C);j=l(A);D=C/A;m=l(E(m)?l(m,"w")-z:m);n=l(E(n)?l(n,"w")-z:n);u=l(E(u)?l(u,"h")-t:u);p=l(E(p)?l(p,"h")-t:p);F=n;B=p;h.fitToView&&(n=Math.min(a.w-z,n),p=Math.min(a.h-t,p));z=a.w-y;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/D)),j>p&&(j=p,c=l(j*D)),c<m&&(c=m,j=l(c/D)),j<u&&(j=u,c=l(j*D))):(c=Math.max(m,Math.min(c,n)),h.autoHeight&& +"iframe"!==h.type&&(g.width(c),j=g.height()),j=Math.max(u,Math.min(j,p)));if(h.fitToView)if(g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height(),h.aspectRatio)for(;(a>z||y>r)&&(c>m&&j>u)&&!(19<d++);)j=Math.max(u,Math.min(p,j-10)),c=l(j*D),c<m&&(c=m,j=l(c/D)),c>n&&(c=n,j=l(c/D)),g.width(c).height(j),e.width(c+x),a=e.width(),y=e.height();else c=Math.max(m,Math.min(c,c-(a-z))),j=Math.max(u,Math.min(j,j-(y-r)));q&&("auto"===s&&j<A&&c+x+q<z)&&(c+=q);g.width(c).height(j);e.width(c+x);a=e.width(); +y=e.height();e=(a>z||y>r)&&c>m&&j>u;c=h.aspectRatio?c<F&&j<B&&c<C&&j<A:(c<F||j<B)&&(c<C||j<A);f.extend(h,{dim:{width:w(a),height:w(y)},origWidth:C,origHeight:A,canShrink:e,canExpand:c,wPadding:x,hPadding:v,wrapSpace:y-k.outerHeight(!0),skinSpace:k.height()-j});!H&&(h.autoHeight&&j>u&&j<p&&!c)&&g.height("auto")},_getPosition:function(a){var d=b.current,e=b.getViewport(),c=d.margin,f=b.wrap.width()+c[1]+c[3],g=b.wrap.height()+c[0]+c[2],c={position:"absolute",top:c[0],left:c[3]};d.autoCenter&&d.fixed&& +!a&&g<=e.h&&f<=e.w?c.position="fixed":d.locked||(c.top+=e.y,c.left+=e.x);c.top=w(Math.max(c.top,c.top+(e.h-g)*d.topRatio));c.left=w(Math.max(c.left,c.left+(e.w-f)*d.leftRatio));return c},_afterZoomIn:function(){var a=b.current;a&&(b.isOpen=b.isOpened=!0,b.wrap.css("overflow","visible").addClass("fancybox-opened"),b.update(),(a.closeClick||a.nextClick&&1<b.group.length)&&b.inner.css("cursor","pointer").bind("click.fb",function(d){!f(d.target).is("a")&&!f(d.target).parent().is("a")&&(d.preventDefault(), +b[a.closeClick?"close":"next"]())}),a.closeBtn&&f(a.tpl.closeBtn).appendTo(b.skin).bind("click.fb",function(a){a.preventDefault();b.close()}),a.arrows&&1<b.group.length&&((a.loop||0<a.index)&&f(a.tpl.prev).appendTo(b.outer).bind("click.fb",b.prev),(a.loop||a.index<b.group.length-1)&&f(a.tpl.next).appendTo(b.outer).bind("click.fb",b.next)),b.trigger("afterShow"),!a.loop&&a.index===a.group.length-1?b.play(!1):b.opts.autoPlay&&!b.player.isActive&&(b.opts.autoPlay=!1,b.play()))},_afterZoomOut:function(a){a= +a||b.current;f(".fancybox-wrap").trigger("onReset").remove();f.extend(b,{group:{},opts:{},router:!1,current:null,isActive:!1,isOpened:!1,isOpen:!1,isClosing:!1,wrap:null,skin:null,outer:null,inner:null});b.trigger("afterClose",a)}});b.transitions={getOrigPosition:function(){var a=b.current,d=a.element,e=a.orig,c={},f=50,g=50,h=a.hPadding,j=a.wPadding,m=b.getViewport();!e&&(a.isDom&&d.is(":visible"))&&(e=d.find("img:first"),e.length||(e=d));t(e)?(c=e.offset(),e.is("img")&&(f=e.outerWidth(),g=e.outerHeight())): +(c.top=m.y+(m.h-g)*a.topRatio,c.left=m.x+(m.w-f)*a.leftRatio);if("fixed"===b.wrap.css("position")||a.locked)c.top-=m.y,c.left-=m.x;return c={top:w(c.top-h*a.topRatio),left:w(c.left-j*a.leftRatio),width:w(f+j),height:w(g+h)}},step:function(a,d){var e,c,f=d.prop;c=b.current;var g=c.wrapSpace,h=c.skinSpace;if("width"===f||"height"===f)e=d.end===d.start?1:(a-d.start)/(d.end-d.start),b.isClosing&&(e=1-e),c="width"===f?c.wPadding:c.hPadding,c=a-c,b.skin[f](l("width"===f?c:c-g*e)),b.inner[f](l("width"=== +f?c:c-g*e-h*e))},zoomIn:function(){var a=b.current,d=a.pos,e=a.openEffect,c="elastic"===e,k=f.extend({opacity:1},d);delete k.position;c?(d=this.getOrigPosition(),a.openOpacity&&(d.opacity=0.1)):"fade"===e&&(d.opacity=0.1);b.wrap.css(d).animate(k,{duration:"none"===e?0:a.openSpeed,easing:a.openEasing,step:c?this.step:null,complete:b._afterZoomIn})},zoomOut:function(){var a=b.current,d=a.closeEffect,e="elastic"===d,c={opacity:0.1};e&&(c=this.getOrigPosition(),a.closeOpacity&&(c.opacity=0.1));b.wrap.animate(c, +{duration:"none"===d?0:a.closeSpeed,easing:a.closeEasing,step:e?this.step:null,complete:b._afterZoomOut})},changeIn:function(){var a=b.current,d=a.nextEffect,e=a.pos,c={opacity:1},f=b.direction,g;e.opacity=0.1;"elastic"===d&&(g="down"===f||"up"===f?"top":"left","down"===f||"right"===f?(e[g]=w(l(e[g])-200),c[g]="+=200px"):(e[g]=w(l(e[g])+200),c[g]="-=200px"));"none"===d?b._afterZoomIn():b.wrap.css(e).animate(c,{duration:a.nextSpeed,easing:a.nextEasing,complete:b._afterZoomIn})},changeOut:function(){var a= +b.previous,d=a.prevEffect,e={opacity:0.1},c=b.direction;"elastic"===d&&(e["down"===c||"up"===c?"top":"left"]=("up"===c||"left"===c?"-":"+")+"=200px");a.wrap.animate(e,{duration:"none"===d?0:a.prevSpeed,easing:a.prevEasing,complete:function(){f(this).trigger("onReset").remove()}})}};b.helpers.overlay={defaults:{closeClick:!0,speedOut:200,showEarly:!0,css:{},locked:!s,fixed:!0},overlay:null,fixed:!1,el:f("html"),create:function(a){a=f.extend({},this.defaults,a);this.overlay&&this.close();this.overlay= +f('<div class="fancybox-overlay"></div>').appendTo(b.coming?b.coming.parent:a.parent);this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(n.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){if(f(a.target).hasClass("fancybox-overlay"))return b.isActive? +b.close():d.close(),!1});this.overlay.css(a.css).show()},close:function(){var a,b;n.unbind("resize.overlay");this.el.hasClass("fancybox-lock")&&(f(".fancybox-margin").removeClass("fancybox-margin"),a=n.scrollTop(),b=n.scrollLeft(),this.el.removeClass("fancybox-lock"),n.scrollTop(a).scrollLeft(b));f(".fancybox-overlay").remove().hide();f.extend(this,{overlay:null,fixed:!1})},update:function(){var a="100%",b;this.overlay.width(a).height("100%");I?(b=Math.max(G.documentElement.offsetWidth,G.body.offsetWidth), +p.width()>b&&(a=p.width())):p.width()>n.width()&&(a=p.width());this.overlay.width(a).height(p.height())},onReady:function(a,b){var e=this.overlay;f(".fancybox-overlay").stop(!0,!0);e||this.create(a);a.locked&&(this.fixed&&b.fixed)&&(e||(this.margin=p.height()>n.height()?f("html").css("margin-right").replace("px",""):!1),b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){var e,c;b.locked&&(!1!==this.margin&&(f("*").filter(function(){return"fixed"=== +f(this).css("position")&&!f(this).hasClass("fancybox-overlay")&&!f(this).hasClass("fancybox-wrap")}).addClass("fancybox-margin"),this.el.addClass("fancybox-margin")),e=n.scrollTop(),c=n.scrollLeft(),this.el.addClass("fancybox-lock"),n.scrollTop(e).scrollLeft(c));this.open(a)},onUpdate:function(){this.fixed||this.update()},afterClose:function(a){this.overlay&&!b.coming&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d= +b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(q(e)&&""!==f.trim(e)){d=f('<div class="fancybox-title fancybox-title-'+c+'-wrap">'+e+"</div>");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"),I&&d.width(d.width()),d.wrapInner('<span class="child"></span>'),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d, +e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+'"]'),j=h.index(this)),a.index=j,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):p.undelegate(c,"click.fb-start").delegate(c+ +":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};p.ready(function(){var a,d;f.scrollbarWidth===v&&(f.scrollbarWidth=function(){var a=f('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body"),b=a.children(),b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===v){a=f.support;d=f('<div style="position:fixed;top:20px;"></div>').appendTo("body");var e=20=== +d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")});a=f(r).width();J.addClass("fancybox-lock-test");d=f(r).width();J.removeClass("fancybox-lock-test");f("<style type='text/css'>.fancybox-margin{margin-right:"+(d-a)+"px;}</style>").appendTo("head")})})(window,document,jQuery);
\ No newline at end of file diff --git a/javascript/jquery/plugins/fancybox/jquery.mousewheel-3.0.4.pack.js b/javascript/jquery/plugins/fancybox/jquery.mousewheel-3.0.4.pack.js deleted file mode 100644 index cb66588..0000000 --- a/javascript/jquery/plugins/fancybox/jquery.mousewheel-3.0.4.pack.js +++ /dev/null @@ -1,14 +0,0 @@ -/*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net) -* Licensed under the MIT License (LICENSE.txt). -* -* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers. -* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix. -* Thanks to: Seamus Leahy for adding deltaX and deltaY -* -* Version: 3.0.4 -* -* Requires: 1.2.2+ -*/ - -(function(d){function g(a){var b=a||window.event,i=[].slice.call(arguments,1),c=0,h=0,e=0;a=d.event.fix(b);a.type="mousewheel";if(a.wheelDelta)c=a.wheelDelta/120;if(a.detail)c=-a.detail/3;e=c;if(b.axis!==undefined&&b.axis===b.HORIZONTAL_AXIS){e=0;h=-1*c}if(b.wheelDeltaY!==undefined)e=b.wheelDeltaY/120;if(b.wheelDeltaX!==undefined)h=-1*b.wheelDeltaX/120;i.unshift(a,c,h,e);return d.event.handle.apply(this,i)}var f=["DOMMouseScroll","mousewheel"];d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a= -f.length;a;)this.addEventListener(f[--a],g,false);else this.onmousewheel=g},teardown:function(){if(this.removeEventListener)for(var a=f.length;a;)this.removeEventListener(f[--a],g,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);
\ No newline at end of file |
