├── LICENSE ├── README.md ├── composer.json └── src ├── FancyBox.php ├── FancyBoxAsset.php ├── FancyBoxHelpersAsset.php ├── MousewheelAsset.php └── assets ├── blank.gif ├── fancybox_loading.gif ├── fancybox_loading@2x.gif ├── fancybox_overlay.png ├── fancybox_sprite.png ├── fancybox_sprite@2x.png ├── helpers ├── fancybox_buttons.png ├── jquery.fancybox-buttons.css ├── jquery.fancybox-buttons.js ├── jquery.fancybox-media.js ├── jquery.fancybox-thumbs.css └── jquery.fancybox-thumbs.js ├── jquery-mousewheel ├── jquery.mousewheel.js └── jquery.mousewheel.min.js ├── jquery.fancybox.css ├── jquery.fancybox.js └── jquery.fancybox.min.js /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Newerton 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | yii2-fancybox 2 | ============= 3 | 4 | fancyBox is a tool that offers a nice and elegant way to add zooming 5 | functionality for images, html content and multi-media on your webpages. http://fancyapps.com/fancybox/ 6 | 7 | Installation 8 | ------------ 9 | 10 | The preferred way to install this extension is through [composer](http://getcomposer.org/download/). 11 | 12 | Either run 13 | 14 | ``` 15 | php composer.phar require newerton/yii2-fancybox 16 | ``` 17 | 18 | or add 19 | 20 | ``` 21 | "newerton/yii2-fancybox": "^1.0" 22 | ``` 23 | 24 | to the require section of your `composer.json` file. 25 | 26 | 27 | Usage 28 | ----- 29 | 30 | Once the extension is installed, simply use it in your code by : 31 | 32 | ```php 33 | 'a[rel=fancybox]', 36 | 'helpers' => true, 37 | 'mouse' => true, 38 | 'config' => [ 39 | 'maxWidth' => '90%', 40 | 'maxHeight' => '90%', 41 | 'playSpeed' => 7000, 42 | 'padding' => 0, 43 | 'fitToView' => false, 44 | 'width' => '70%', 45 | 'height' => '70%', 46 | 'autoSize' => false, 47 | 'closeClick' => false, 48 | 'openEffect' => 'elastic', 49 | 'closeEffect' => 'elastic', 50 | 'prevEffect' => 'elastic', 51 | 'nextEffect' => 'elastic', 52 | 'closeBtn' => false, 53 | 'openOpacity' => true, 54 | 'helpers' => [ 55 | 'title' => ['type' => 'float'], 56 | 'buttons' => [], 57 | 'thumbs' => ['width' => 68, 'height' => 50], 58 | 'overlay' => [ 59 | 'css' => [ 60 | 'background' => 'rgba(0, 0, 0, 0.8)' 61 | ] 62 | ] 63 | ], 64 | ] 65 | ]); 66 | 67 | echo Html::a(Html::img('/folder/thumb.jpg'), '/folder/imagem.jpg', ['rel' => 'fancybox']); 68 | ?> 69 | ``` 70 | 71 | Hint: Do not forget to declare the Html class at the top of the file. 72 | 73 | ``` 74 | use yii\helpers\Html; 75 | ``` 76 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "newerton/yii2-fancybox", 3 | "description": "fancyBox is a tool that offers a nice and elegant way to add zooming functionality for images, html content and multi-media on your webpages.", 4 | "type": "yii2-extension", 5 | "keywords": [ 6 | "yii2", 7 | "extension", 8 | "fancyapps", 9 | "fancybox" 10 | ], 11 | "license": "BSD-3-Clause", 12 | "authors": [ 13 | { 14 | "name": "Newerton Vargas de Araujo", 15 | "email": "newerton.araujo@gmail.com" 16 | } 17 | ], 18 | "require": { 19 | "php": ">=5.4.0", 20 | "yiisoft/yii2": "~2.0.14" 21 | }, 22 | "autoload": { 23 | "psr-4": { 24 | "newerton\\fancybox\\": "src" 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/FancyBox.php: -------------------------------------------------------------------------------- 1 | 19 | * @since 1.0 20 | */ 21 | class FancyBox extends Widget 22 | { 23 | 24 | /** 25 | * @var type string target of the widget 26 | */ 27 | public $target; 28 | 29 | /** 30 | * @var type boolean whether to enable the easing functions. You must set the eansing on $config 31 | */ 32 | public $helpers = false; 33 | 34 | /** 35 | * @var type bollean whether to enable mouse interaction 36 | */ 37 | public $mouse = true; 38 | // @ array of config settings for fancybox 39 | /** 40 | * 41 | * @var type array of config settings for fancybox 42 | */ 43 | public $config = []; 44 | 45 | /** 46 | * @var array to use for $.fancybox.open( [group], [options] ) scenario 47 | */ 48 | public $group = []; 49 | 50 | /** 51 | * @inheritdoc 52 | */ 53 | public function init() 54 | { 55 | if (is_null($this->target)) { 56 | throw new InvalidConfigException('"FancyBox.target has not been defined.'); 57 | } 58 | // publish the required assets 59 | $this->registerAssets(); 60 | } 61 | 62 | /** 63 | * @inheritdoc 64 | */ 65 | public function run() 66 | { 67 | $view = $this->getView(); 68 | 69 | $config = Json::encode($this->config); 70 | 71 | if (!empty($this->group)) { 72 | $config = Json::encode($this->group) . ',' . $config; 73 | } 74 | $view->registerJs("jQuery('{$this->target}').fancybox({$config});"); 75 | } 76 | 77 | /** 78 | * Registers required script for the plugin to work as DatePicker 79 | */ 80 | public function registerAssets() 81 | { 82 | $view = $this->getView(); 83 | 84 | FancyBoxAsset::register($view); 85 | 86 | if ($this->mouse) { 87 | MousewheelAsset::register($view); 88 | } 89 | 90 | if ($this->helpers) { 91 | FancyBoxHelpersAsset::register($view); 92 | } 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/FancyBoxAsset.php: -------------------------------------------------------------------------------- 1 | ' 26 | }, 27 | 28 | list : null, 29 | buttons: null, 30 | 31 | beforeLoad: function (opts, obj) { 32 | //Remove self if gallery do not have at least two items 33 | 34 | if (opts.skipSingle && obj.group.length < 2) { 35 | obj.helpers.buttons = false; 36 | obj.closeBtn = true; 37 | 38 | return; 39 | } 40 | 41 | //Increase top margin to give space for buttons 42 | obj.margin[ opts.position === 'bottom' ? 2 : 0 ] += 30; 43 | }, 44 | 45 | onPlayStart: function () { 46 | if (this.buttons) { 47 | this.buttons.play.attr('title', 'Pause slideshow').addClass('btnPlayOn'); 48 | } 49 | }, 50 | 51 | onPlayEnd: function () { 52 | if (this.buttons) { 53 | this.buttons.play.attr('title', 'Start slideshow').removeClass('btnPlayOn'); 54 | } 55 | }, 56 | 57 | afterShow: function (opts, obj) { 58 | var buttons = this.buttons; 59 | 60 | if (!buttons) { 61 | this.list = $(opts.tpl).addClass(opts.position).appendTo('body'); 62 | 63 | buttons = { 64 | prev : this.list.find('.btnPrev').click( F.prev ), 65 | next : this.list.find('.btnNext').click( F.next ), 66 | play : this.list.find('.btnPlay').click( F.play ), 67 | toggle : this.list.find('.btnToggle').click( F.toggle ), 68 | close : this.list.find('.btnClose').click( F.close ) 69 | } 70 | } 71 | 72 | //Prev 73 | if (obj.index > 0 || obj.loop) { 74 | buttons.prev.removeClass('btnDisabled'); 75 | } else { 76 | buttons.prev.addClass('btnDisabled'); 77 | } 78 | 79 | //Next / Play 80 | if (obj.loop || obj.index < obj.group.length - 1) { 81 | buttons.next.removeClass('btnDisabled'); 82 | buttons.play.removeClass('btnDisabled'); 83 | 84 | } else { 85 | buttons.next.addClass('btnDisabled'); 86 | buttons.play.addClass('btnDisabled'); 87 | } 88 | 89 | this.buttons = buttons; 90 | 91 | this.onUpdate(opts, obj); 92 | }, 93 | 94 | onUpdate: function (opts, obj) { 95 | var toggle; 96 | 97 | if (!this.buttons) { 98 | return; 99 | } 100 | 101 | toggle = this.buttons.toggle.removeClass('btnDisabled btnToggleOn'); 102 | 103 | //Size toggle button 104 | if (obj.canShrink) { 105 | toggle.addClass('btnToggleOn'); 106 | 107 | } else if (!obj.canExpand) { 108 | toggle.addClass('btnDisabled'); 109 | } 110 | }, 111 | 112 | beforeClose: function () { 113 | if (this.list) { 114 | this.list.remove(); 115 | } 116 | 117 | this.list = null; 118 | this.buttons = null; 119 | } 120 | }; 121 | 122 | }(jQuery)); 123 | -------------------------------------------------------------------------------- /src/assets/helpers/jquery.fancybox-media.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Media helper for fancyBox 3 | * version: 1.0.6 (Fri, 14 Jun 2013) 4 | * @requires fancyBox v2.0 or later 5 | * 6 | * Usage: 7 | * $(".fancybox").fancybox({ 8 | * helpers : { 9 | * media: true 10 | * } 11 | * }); 12 | * 13 | * Set custom URL parameters: 14 | * $(".fancybox").fancybox({ 15 | * helpers : { 16 | * media: { 17 | * youtube : { 18 | * params : { 19 | * autoplay : 0 20 | * } 21 | * } 22 | * } 23 | * } 24 | * }); 25 | * 26 | * Or: 27 | * $(".fancybox").fancybox({, 28 | * helpers : { 29 | * media: true 30 | * }, 31 | * youtube : { 32 | * autoplay: 0 33 | * } 34 | * }); 35 | * 36 | * Supports: 37 | * 38 | * Youtube 39 | * http://www.youtube.com/watch?v=opj24KnzrWo 40 | * http://www.youtube.com/embed/opj24KnzrWo 41 | * http://youtu.be/opj24KnzrWo 42 | * http://www.youtube-nocookie.com/embed/opj24KnzrWo 43 | * Vimeo 44 | * http://vimeo.com/40648169 45 | * http://vimeo.com/channels/staffpicks/38843628 46 | * http://vimeo.com/groups/surrealism/videos/36516384 47 | * http://player.vimeo.com/video/45074303 48 | * Metacafe 49 | * http://www.metacafe.com/watch/7635964/dr_seuss_the_lorax_movie_trailer/ 50 | * http://www.metacafe.com/watch/7635964/ 51 | * Dailymotion 52 | * http://www.dailymotion.com/video/xoytqh_dr-seuss-the-lorax-premiere_people 53 | * Twitvid 54 | * http://twitvid.com/QY7MD 55 | * Twitpic 56 | * http://twitpic.com/7p93st 57 | * Instagram 58 | * http://instagr.am/p/IejkuUGxQn/ 59 | * http://instagram.com/p/IejkuUGxQn/ 60 | * Google maps 61 | * http://maps.google.com/maps?q=Eiffel+Tower,+Avenue+Gustave+Eiffel,+Paris,+France&t=h&z=17 62 | * http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16 63 | * http://maps.google.com/?ll=48.859463,2.292626&spn=0.000965,0.002642&t=m&z=19&layer=c&cbll=48.859524,2.292532&panoid=YJ0lq28OOy3VT2IqIuVY0g&cbp=12,151.58,,0,-15.56 64 | */ 65 | ;(function ($) { 66 | "use strict"; 67 | 68 | //Shortcut for fancyBox object 69 | var F = $.fancybox, 70 | format = function( url, rez, params ) { 71 | params = params || ''; 72 | 73 | if ( $.type( params ) === "object" ) { 74 | params = $.param(params, true); 75 | } 76 | 77 | $.each(rez, function(key, value) { 78 | url = url.replace( '$' + key, value || '' ); 79 | }); 80 | 81 | if (params.length) { 82 | url += ( url.indexOf('?') > 0 ? '&' : '?' ) + params; 83 | } 84 | 85 | return url; 86 | }; 87 | 88 | //Add helper object 89 | F.helpers.media = { 90 | defaults : { 91 | youtube : { 92 | matcher : /(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i, 93 | params : { 94 | autoplay : 1, 95 | autohide : 1, 96 | fs : 1, 97 | rel : 0, 98 | hd : 1, 99 | wmode : 'opaque', 100 | enablejsapi : 1, 101 | ps: 'docs', 102 | controls: 1 103 | }, 104 | type : 'iframe', 105 | url : '//www.youtube.com/embed/$3' 106 | }, 107 | vimeo : { 108 | matcher : /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/, 109 | params : { 110 | autoplay : 1, 111 | hd : 1, 112 | show_title : 1, 113 | show_byline : 1, 114 | show_portrait : 0, 115 | fullscreen : 1 116 | }, 117 | type : 'iframe', 118 | url : '//player.vimeo.com/video/$1' 119 | }, 120 | metacafe : { 121 | matcher : /metacafe.com\/(?:watch|fplayer)\/([\w\-]{1,10})/, 122 | params : { 123 | autoPlay : 'yes' 124 | }, 125 | type : 'swf', 126 | url : function( rez, params, obj ) { 127 | obj.swf.flashVars = 'playerVars=' + $.param( params, true ); 128 | 129 | return '//www.metacafe.com/fplayer/' + rez[1] + '/.swf'; 130 | } 131 | }, 132 | dailymotion : { 133 | matcher : /dailymotion.com\/video\/(.*)\/?(.*)/, 134 | params : { 135 | additionalInfos : 0, 136 | autoStart : 1 137 | }, 138 | type : 'swf', 139 | url : '//www.dailymotion.com/swf/video/$1' 140 | }, 141 | twitvid : { 142 | matcher : /twitvid\.com\/([a-zA-Z0-9_\-\?\=]+)/i, 143 | params : { 144 | autoplay : 0 145 | }, 146 | type : 'iframe', 147 | url : '//www.twitvid.com/embed.php?guid=$1' 148 | }, 149 | twitpic : { 150 | matcher : /twitpic\.com\/(?!(?:place|photos|events)\/)([a-zA-Z0-9\?\=\-]+)/i, 151 | type : 'image', 152 | url : '//twitpic.com/show/full/$1/' 153 | }, 154 | instagram : { 155 | matcher : /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i, 156 | type : 'image', 157 | url : '//$1/p/$2/media/?size=l' 158 | }, 159 | google_maps : { 160 | matcher : /maps\.google\.([a-z]{2,3}(\.[a-z]{2})?)\/(\?ll=|maps\?)(.*)/i, 161 | type : 'iframe', 162 | url : function( rez ) { 163 | return '//maps.google.' + rez[1] + '/' + rez[3] + '' + rez[4] + '&output=' + (rez[4].indexOf('layer=c') > 0 ? 'svembed' : 'embed'); 164 | } 165 | } 166 | }, 167 | 168 | beforeLoad : function(opts, obj) { 169 | var url = obj.href || '', 170 | type = false, 171 | what, 172 | item, 173 | rez, 174 | params; 175 | 176 | for (what in opts) { 177 | if (opts.hasOwnProperty(what)) { 178 | item = opts[ what ]; 179 | rez = url.match( item.matcher ); 180 | 181 | if (rez) { 182 | type = item.type; 183 | params = $.extend(true, {}, item.params, obj[ what ] || ($.isPlainObject(opts[ what ]) ? opts[ what ].params : null)); 184 | 185 | url = $.type( item.url ) === "function" ? item.url.call( this, rez, params, obj ) : format( item.url, rez, params ); 186 | 187 | break; 188 | } 189 | } 190 | } 191 | 192 | if (type) { 193 | obj.href = url; 194 | obj.type = type; 195 | 196 | obj.autoHeight = false; 197 | } 198 | } 199 | }; 200 | 201 | }(jQuery)); 202 | -------------------------------------------------------------------------------- /src/assets/helpers/jquery.fancybox-thumbs.css: -------------------------------------------------------------------------------- 1 | #fancybox-thumbs { 2 | position: fixed; 3 | left: 0; 4 | width: 100%; 5 | overflow: hidden; 6 | z-index: 8050; 7 | } 8 | 9 | #fancybox-thumbs.bottom { 10 | bottom: 2px; 11 | } 12 | 13 | #fancybox-thumbs.top { 14 | top: 2px; 15 | } 16 | 17 | #fancybox-thumbs ul { 18 | position: relative; 19 | list-style: none; 20 | margin: 0; 21 | padding: 0; 22 | } 23 | 24 | #fancybox-thumbs ul li { 25 | float: left; 26 | padding: 1px; 27 | opacity: 0.5; 28 | } 29 | 30 | #fancybox-thumbs ul li.active { 31 | opacity: 0.75; 32 | padding: 0; 33 | border: 1px solid #fff; 34 | } 35 | 36 | #fancybox-thumbs ul li:hover { 37 | opacity: 1; 38 | } 39 | 40 | #fancybox-thumbs ul li a { 41 | display: block; 42 | position: relative; 43 | overflow: hidden; 44 | border: 1px solid #222; 45 | background: #111; 46 | outline: none; 47 | } 48 | 49 | #fancybox-thumbs ul li img { 50 | display: block; 51 | position: relative; 52 | border: 0; 53 | padding: 0; 54 | max-width: none; 55 | } -------------------------------------------------------------------------------- /src/assets/helpers/jquery.fancybox-thumbs.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Thumbnail helper for fancyBox 3 | * version: 1.0.7 (Mon, 01 Oct 2012) 4 | * @requires fancyBox v2.0 or later 5 | * 6 | * Usage: 7 | * $(".fancybox").fancybox({ 8 | * helpers : { 9 | * thumbs: { 10 | * width : 50, 11 | * height : 50 12 | * } 13 | * } 14 | * }); 15 | * 16 | */ 17 | ;(function ($) { 18 | //Shortcut for fancyBox object 19 | var F = $.fancybox; 20 | 21 | //Add helper object 22 | F.helpers.thumbs = { 23 | defaults : { 24 | width : 50, // thumbnail width 25 | height : 50, // thumbnail height 26 | position : 'bottom', // 'top' or 'bottom' 27 | source : function ( item ) { // function to obtain the URL of the thumbnail image 28 | var href; 29 | 30 | if (item.element) { 31 | href = $(item.element).find('img').attr('src'); 32 | } 33 | 34 | if (!href && item.type === 'image' && item.href) { 35 | href = item.href; 36 | } 37 | 38 | return href; 39 | } 40 | }, 41 | 42 | wrap : null, 43 | list : null, 44 | width : 0, 45 | 46 | init: function (opts, obj) { 47 | var that = this, 48 | list, 49 | thumbWidth = opts.width, 50 | thumbHeight = opts.height, 51 | thumbSource = opts.source; 52 | 53 | //Build list structure 54 | list = ''; 55 | 56 | for (var n = 0; n < obj.group.length; n++) { 57 | list += '
  • '; 58 | } 59 | 60 | this.wrap = $('
    ').addClass(opts.position).appendTo('body'); 61 | this.list = $('').appendTo(this.wrap); 62 | 63 | //Load each thumbnail 64 | $.each(obj.group, function (i) { 65 | var el = obj.group[ i ], 66 | href = thumbSource( el ); 67 | 68 | if (!href) { 69 | return; 70 | } 71 | 72 | $("").on("load", function () { 73 | var width = this.width, 74 | height = this.height, 75 | widthRatio, heightRatio, parent; 76 | 77 | if (!that.list || !width || !height) { 78 | return; 79 | } 80 | 81 | //Calculate thumbnail width/height and center it 82 | widthRatio = width / thumbWidth; 83 | heightRatio = height / thumbHeight; 84 | 85 | parent = that.list.children().eq(i).find('a'); 86 | 87 | if (widthRatio >= 1 && heightRatio >= 1) { 88 | if (widthRatio > heightRatio) { 89 | width = Math.floor(width / heightRatio); 90 | height = thumbHeight; 91 | 92 | } else { 93 | width = thumbWidth; 94 | height = Math.floor(height / widthRatio); 95 | } 96 | } 97 | 98 | $(this).css({ 99 | width : width, 100 | height : height, 101 | top : Math.floor(thumbHeight / 2 - height / 2), 102 | left : Math.floor(thumbWidth / 2 - width / 2) 103 | }); 104 | 105 | parent.width(thumbWidth).height(thumbHeight); 106 | 107 | $(this).hide().appendTo(parent).fadeIn(300); 108 | 109 | }) 110 | .attr('src', href) 111 | .attr('title', el.title); 112 | }); 113 | 114 | //Set initial width 115 | this.width = this.list.children().eq(0).outerWidth(true); 116 | 117 | 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))); 118 | }, 119 | 120 | beforeLoad: function (opts, obj) { 121 | //Remove self if gallery do not have at least two items 122 | if (obj.group.length < 2) { 123 | obj.helpers.thumbs = false; 124 | 125 | return; 126 | } 127 | 128 | //Increase bottom margin to give space for thumbs 129 | obj.margin[ opts.position === 'top' ? 0 : 2 ] += ((opts.height) + 15); 130 | }, 131 | 132 | afterShow: function (opts, obj) { 133 | //Check if exists and create or update list 134 | if (this.list) { 135 | this.onUpdate(opts, obj); 136 | 137 | } else { 138 | this.init(opts, obj); 139 | } 140 | 141 | //Set active element 142 | this.list.children().removeClass('active').eq(obj.index).addClass('active'); 143 | }, 144 | 145 | //Center list 146 | onUpdate: function (opts, obj) { 147 | if (this.list) { 148 | this.list.stop(true).animate({ 149 | 'left': Math.floor($(window).width() * 0.5 - (obj.index * this.width + this.width * 0.5)) 150 | }, 150); 151 | } 152 | }, 153 | 154 | beforeClose: function () { 155 | if (this.wrap) { 156 | this.wrap.remove(); 157 | } 158 | 159 | this.wrap = null; 160 | this.list = null; 161 | this.width = 0; 162 | } 163 | } 164 | 165 | }(jQuery)); 166 | -------------------------------------------------------------------------------- /src/assets/jquery-mousewheel/jquery.mousewheel.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery Mousewheel 3.1.13 3 | * 4 | * Copyright jQuery Foundation and other contributors 5 | * Released under the MIT license 6 | * http://jquery.org/license 7 | */ 8 | 9 | (function (factory) { 10 | if ( typeof define === 'function' && define.amd ) { 11 | // AMD. Register as an anonymous module. 12 | define(['jquery'], factory); 13 | } else if (typeof exports === 'object') { 14 | // Node/CommonJS style for Browserify 15 | module.exports = factory; 16 | } else { 17 | // Browser globals 18 | factory(jQuery); 19 | } 20 | }(function ($) { 21 | 22 | var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'], 23 | toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ? 24 | ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'], 25 | slice = Array.prototype.slice, 26 | nullLowestDeltaTimeout, lowestDelta; 27 | 28 | if ( $.event.fixHooks ) { 29 | for ( var i = toFix.length; i; ) { 30 | $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks; 31 | } 32 | } 33 | 34 | var special = $.event.special.mousewheel = { 35 | version: '3.1.12', 36 | 37 | setup: function() { 38 | if ( this.addEventListener ) { 39 | for ( var i = toBind.length; i; ) { 40 | this.addEventListener( toBind[--i], handler, false ); 41 | } 42 | } else { 43 | this.onmousewheel = handler; 44 | } 45 | // Store the line height and page height for this particular element 46 | $.data(this, 'mousewheel-line-height', special.getLineHeight(this)); 47 | $.data(this, 'mousewheel-page-height', special.getPageHeight(this)); 48 | }, 49 | 50 | teardown: function() { 51 | if ( this.removeEventListener ) { 52 | for ( var i = toBind.length; i; ) { 53 | this.removeEventListener( toBind[--i], handler, false ); 54 | } 55 | } else { 56 | this.onmousewheel = null; 57 | } 58 | // Clean up the data we added to the element 59 | $.removeData(this, 'mousewheel-line-height'); 60 | $.removeData(this, 'mousewheel-page-height'); 61 | }, 62 | 63 | getLineHeight: function(elem) { 64 | var $elem = $(elem), 65 | $parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent'](); 66 | if (!$parent.length) { 67 | $parent = $('body'); 68 | } 69 | return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16; 70 | }, 71 | 72 | getPageHeight: function(elem) { 73 | return $(elem).height(); 74 | }, 75 | 76 | settings: { 77 | adjustOldDeltas: true, // see shouldAdjustOldDeltas() below 78 | normalizeOffset: true // calls getBoundingClientRect for each event 79 | } 80 | }; 81 | 82 | $.fn.extend({ 83 | mousewheel: function(fn) { 84 | return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel'); 85 | }, 86 | 87 | unmousewheel: function(fn) { 88 | return this.unbind('mousewheel', fn); 89 | } 90 | }); 91 | 92 | 93 | function handler(event) { 94 | var orgEvent = event || window.event, 95 | args = slice.call(arguments, 1), 96 | delta = 0, 97 | deltaX = 0, 98 | deltaY = 0, 99 | absDelta = 0, 100 | offsetX = 0, 101 | offsetY = 0; 102 | event = $.event.fix(orgEvent); 103 | event.type = 'mousewheel'; 104 | 105 | // Old school scrollwheel delta 106 | if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; } 107 | if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; } 108 | if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; } 109 | if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; } 110 | 111 | // Firefox < 17 horizontal scrolling related to DOMMouseScroll event 112 | if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) { 113 | deltaX = deltaY * -1; 114 | deltaY = 0; 115 | } 116 | 117 | // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy 118 | delta = deltaY === 0 ? deltaX : deltaY; 119 | 120 | // New school wheel delta (wheel event) 121 | if ( 'deltaY' in orgEvent ) { 122 | deltaY = orgEvent.deltaY * -1; 123 | delta = deltaY; 124 | } 125 | if ( 'deltaX' in orgEvent ) { 126 | deltaX = orgEvent.deltaX; 127 | if ( deltaY === 0 ) { delta = deltaX * -1; } 128 | } 129 | 130 | // No change actually happened, no reason to go any further 131 | if ( deltaY === 0 && deltaX === 0 ) { return; } 132 | 133 | // Need to convert lines and pages to pixels if we aren't already in pixels 134 | // There are three delta modes: 135 | // * deltaMode 0 is by pixels, nothing to do 136 | // * deltaMode 1 is by lines 137 | // * deltaMode 2 is by pages 138 | if ( orgEvent.deltaMode === 1 ) { 139 | var lineHeight = $.data(this, 'mousewheel-line-height'); 140 | delta *= lineHeight; 141 | deltaY *= lineHeight; 142 | deltaX *= lineHeight; 143 | } else if ( orgEvent.deltaMode === 2 ) { 144 | var pageHeight = $.data(this, 'mousewheel-page-height'); 145 | delta *= pageHeight; 146 | deltaY *= pageHeight; 147 | deltaX *= pageHeight; 148 | } 149 | 150 | // Store lowest absolute delta to normalize the delta values 151 | absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) ); 152 | 153 | if ( !lowestDelta || absDelta < lowestDelta ) { 154 | lowestDelta = absDelta; 155 | 156 | // Adjust older deltas if necessary 157 | if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) { 158 | lowestDelta /= 40; 159 | } 160 | } 161 | 162 | // Adjust older deltas if necessary 163 | if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) { 164 | // Divide all the things by 40! 165 | delta /= 40; 166 | deltaX /= 40; 167 | deltaY /= 40; 168 | } 169 | 170 | // Get a whole, normalized value for the deltas 171 | delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta); 172 | deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta); 173 | deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta); 174 | 175 | // Normalise offsetX and offsetY properties 176 | if ( special.settings.normalizeOffset && this.getBoundingClientRect ) { 177 | var boundingRect = this.getBoundingClientRect(); 178 | offsetX = event.clientX - boundingRect.left; 179 | offsetY = event.clientY - boundingRect.top; 180 | } 181 | 182 | // Add information to the event object 183 | event.deltaX = deltaX; 184 | event.deltaY = deltaY; 185 | event.deltaFactor = lowestDelta; 186 | event.offsetX = offsetX; 187 | event.offsetY = offsetY; 188 | // Go ahead and set deltaMode to 0 since we converted to pixels 189 | // Although this is a little odd since we overwrite the deltaX/Y 190 | // properties with normalized deltas. 191 | event.deltaMode = 0; 192 | 193 | // Add event and delta to the front of the arguments 194 | args.unshift(event, delta, deltaX, deltaY); 195 | 196 | // Clearout lowestDelta after sometime to better 197 | // handle multiple device types that give different 198 | // a different lowestDelta 199 | // Ex: trackpad = 3 and mouse wheel = 120 200 | if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); } 201 | nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200); 202 | 203 | return ($.event.dispatch || $.event.handle).apply(this, args); 204 | } 205 | 206 | function nullLowestDelta() { 207 | lowestDelta = null; 208 | } 209 | 210 | function shouldAdjustOldDeltas(orgEvent, absDelta) { 211 | // If this is an older event and the delta is divisable by 120, 212 | // then we are assuming that the browser is treating this as an 213 | // older mouse wheel event and that we should divide the deltas 214 | // by 40 to try and get a more usable deltaFactor. 215 | // Side note, this actually impacts the reported scroll distance 216 | // in older browsers and can cause scrolling to be slower than native. 217 | // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false. 218 | return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0; 219 | } 220 | 221 | })); 222 | -------------------------------------------------------------------------------- /src/assets/jquery-mousewheel/jquery.mousewheel.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery Mousewheel 3.1.13 3 | * 4 | * Copyright 2015 jQuery Foundation and other contributors 5 | * Released under the MIT license. 6 | * http://jquery.org/license 7 | */ 8 | !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}); -------------------------------------------------------------------------------- /src/assets/jquery.fancybox.css: -------------------------------------------------------------------------------- 1 | /*! fancyBox v2.1.5 fancyapps.com | fancyapps.com/fancybox/#license */ 2 | .fancybox-wrap, 3 | .fancybox-skin, 4 | .fancybox-outer, 5 | .fancybox-inner, 6 | .fancybox-image, 7 | .fancybox-wrap iframe, 8 | .fancybox-wrap object, 9 | .fancybox-nav, 10 | .fancybox-nav span, 11 | .fancybox-tmp 12 | { 13 | padding: 0; 14 | margin: 0; 15 | border: 0; 16 | outline: none; 17 | vertical-align: top; 18 | } 19 | 20 | .fancybox-wrap { 21 | position: absolute; 22 | top: 0; 23 | left: 0; 24 | -webkit-transform: translate3d(0, 0, 0); 25 | transform: translate3d(0, 0, 0); 26 | z-index: 8020; 27 | } 28 | 29 | .fancybox-skin { 30 | position: relative; 31 | background: #f9f9f9; 32 | color: #444; 33 | text-shadow: none; 34 | -webkit-border-radius: 4px; 35 | -moz-border-radius: 4px; 36 | border-radius: 4px; 37 | } 38 | 39 | .fancybox-opened { 40 | z-index: 8030; 41 | } 42 | 43 | .fancybox-opened .fancybox-skin { 44 | -webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); 45 | -moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); 46 | box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5); 47 | } 48 | 49 | .fancybox-outer, .fancybox-inner { 50 | position: relative; 51 | } 52 | 53 | .fancybox-inner { 54 | overflow: hidden; 55 | } 56 | 57 | .fancybox-type-iframe .fancybox-inner { 58 | -webkit-overflow-scrolling: touch; 59 | } 60 | 61 | .fancybox-error { 62 | color: #444; 63 | font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; 64 | margin: 0; 65 | padding: 15px; 66 | white-space: nowrap; 67 | } 68 | 69 | .fancybox-image, .fancybox-iframe { 70 | display: block; 71 | width: 100%; 72 | height: 100%; 73 | } 74 | 75 | .fancybox-image { 76 | max-width: 100%; 77 | max-height: 100%; 78 | } 79 | 80 | #fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span { 81 | background-image: url(fancybox_sprite.png); 82 | } 83 | 84 | #fancybox-loading { 85 | position: fixed; 86 | top: 50%; 87 | left: 50%; 88 | margin-top: -22px; 89 | margin-left: -22px; 90 | background-position: 0 -108px; 91 | opacity: 0.8; 92 | cursor: pointer; 93 | z-index: 8060; 94 | } 95 | 96 | #fancybox-loading div { 97 | width: 44px; 98 | height: 44px; 99 | background: url(fancybox_loading.gif) center center no-repeat; 100 | } 101 | 102 | .fancybox-close { 103 | position: absolute; 104 | top: -18px; 105 | right: -18px; 106 | width: 36px; 107 | height: 36px; 108 | cursor: pointer; 109 | z-index: 8040; 110 | } 111 | 112 | .fancybox-nav { 113 | position: absolute; 114 | top: 0; 115 | width: 40%; 116 | height: 100%; 117 | cursor: pointer; 118 | text-decoration: none; 119 | background: transparent url(blank.gif); /* helps IE */ 120 | -webkit-tap-highlight-color: rgba(0,0,0,0); 121 | z-index: 8040; 122 | } 123 | 124 | .fancybox-prev { 125 | left: 0; 126 | } 127 | 128 | .fancybox-next { 129 | right: 0; 130 | } 131 | 132 | .fancybox-nav span { 133 | position: absolute; 134 | top: 50%; 135 | width: 36px; 136 | height: 34px; 137 | margin-top: -18px; 138 | cursor: pointer; 139 | z-index: 8040; 140 | visibility: hidden; 141 | } 142 | 143 | .fancybox-prev span { 144 | left: 10px; 145 | background-position: 0 -36px; 146 | } 147 | 148 | .fancybox-next span { 149 | right: 10px; 150 | background-position: 0 -72px; 151 | } 152 | 153 | .fancybox-nav:hover span { 154 | visibility: visible; 155 | } 156 | 157 | .fancybox-tmp { 158 | position: absolute; 159 | top: -99999px; 160 | left: -99999px; 161 | max-width: 99999px; 162 | max-height: 99999px; 163 | overflow: visible !important; 164 | } 165 | 166 | /* Overlay helper */ 167 | 168 | .fancybox-lock { 169 | overflow: visible !important; 170 | width: auto; 171 | } 172 | 173 | .fancybox-lock body { 174 | overflow: hidden !important; 175 | } 176 | 177 | .fancybox-lock-test { 178 | overflow-y: hidden !important; 179 | } 180 | 181 | .fancybox-overlay { 182 | position: absolute; 183 | top: 0; 184 | left: 0; 185 | overflow: hidden; 186 | display: none; 187 | z-index: 8010; 188 | background: url(fancybox_overlay.png); 189 | } 190 | 191 | .fancybox-overlay-fixed { 192 | position: fixed; 193 | bottom: 0; 194 | right: 0; 195 | } 196 | 197 | .fancybox-lock .fancybox-overlay { 198 | overflow: auto; 199 | overflow-y: scroll; 200 | } 201 | 202 | /* Title helper */ 203 | 204 | .fancybox-title { 205 | visibility: hidden; 206 | font: normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif; 207 | position: relative; 208 | text-shadow: none; 209 | z-index: 8050; 210 | } 211 | 212 | .fancybox-opened .fancybox-title { 213 | visibility: visible; 214 | } 215 | 216 | .fancybox-title-float-wrap { 217 | position: absolute; 218 | bottom: 0; 219 | right: 50%; 220 | margin-bottom: -35px; 221 | z-index: 8050; 222 | text-align: center; 223 | } 224 | 225 | .fancybox-title-float-wrap .child { 226 | display: inline-block; 227 | margin-right: -100%; 228 | padding: 2px 20px; 229 | background: transparent; /* Fallback for web browsers that doesn't support RGBa */ 230 | background: rgba(0, 0, 0, 0.8); 231 | -webkit-border-radius: 15px; 232 | -moz-border-radius: 15px; 233 | border-radius: 15px; 234 | text-shadow: 0 1px 2px #222; 235 | color: #FFF; 236 | font-weight: bold; 237 | line-height: 24px; 238 | white-space: nowrap; 239 | } 240 | 241 | .fancybox-title-outside-wrap { 242 | position: relative; 243 | margin-top: 10px; 244 | color: #fff; 245 | } 246 | 247 | .fancybox-title-inside-wrap { 248 | padding-top: 10px; 249 | } 250 | 251 | .fancybox-title-over-wrap { 252 | position: absolute; 253 | bottom: 0; 254 | left: 0; 255 | color: #fff; 256 | padding: 10px; 257 | background: #000; 258 | background: rgba(0, 0, 0, .8); 259 | } 260 | 261 | /*Retina graphics!*/ 262 | @media only screen and (-webkit-min-device-pixel-ratio: 1.5), 263 | only screen and (min--moz-device-pixel-ratio: 1.5), 264 | only screen and (min-device-pixel-ratio: 1.5){ 265 | 266 | #fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span { 267 | background-image: url(fancybox_sprite@2x.png); 268 | background-size: 44px 152px; /*The size of the normal image, half the size of the hi-res image*/ 269 | } 270 | 271 | #fancybox-loading div { 272 | background-image: url(fancybox_loading@2x.gif); 273 | background-size: 24px 24px; /*The size of the normal image, half the size of the hi-res image*/ 274 | } 275 | } -------------------------------------------------------------------------------- /src/assets/jquery.fancybox.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * fancyBox - jQuery Plugin 3 | * version: 2.1.7 (Tue, 28 Feb 2017) 4 | * requires jQuery v1.6 or later 5 | * 6 | * Examples at http://fancyapps.com/fancybox/ 7 | * License: www.fancyapps.com/fancybox/#license 8 | * 9 | * Copyright 2017 fancyapps.com 10 | * 11 | */ 12 | 13 | ;(function (window, document, $, undefined) { 14 | "use strict"; 15 | 16 | var H = $("html"), 17 | W = $(window), 18 | D = $(document), 19 | F = $.fancybox = function () { 20 | F.open.apply( this, arguments ); 21 | }, 22 | IE = navigator.userAgent.match(/msie/i), 23 | didUpdate = null, 24 | isTouch = document.createTouch !== undefined, 25 | 26 | isQuery = function(obj) { 27 | return obj && obj.hasOwnProperty && obj instanceof $; 28 | }, 29 | isString = function(str) { 30 | return str && $.type(str) === "string"; 31 | }, 32 | isPercentage = function(str) { 33 | return isString(str) && str.indexOf('%') > 0; 34 | }, 35 | isScrollable = function(el) { 36 | return (el && !(el.style.overflow && el.style.overflow === 'hidden') && ((el.clientWidth && el.scrollWidth > el.clientWidth) || (el.clientHeight && el.scrollHeight > el.clientHeight))); 37 | }, 38 | getScalar = function(orig, dim) { 39 | var value = parseInt(orig, 10) || 0; 40 | 41 | if (dim && isPercentage(orig)) { 42 | value = F.getViewport()[ dim ] / 100 * value; 43 | } 44 | 45 | return Math.ceil(value); 46 | }, 47 | getValue = function(value, dim) { 48 | return getScalar(value, dim) + 'px'; 49 | }; 50 | 51 | $.extend(F, { 52 | // The current version of fancyBox 53 | version: '2.1.7', 54 | 55 | defaults: { 56 | padding : 15, 57 | margin : 20, 58 | 59 | width : 800, 60 | height : 600, 61 | minWidth : 100, 62 | minHeight : 100, 63 | maxWidth : 9999, 64 | maxHeight : 9999, 65 | pixelRatio: 1, // Set to 2 for retina display support 66 | 67 | autoSize : true, 68 | autoHeight : false, 69 | autoWidth : false, 70 | 71 | autoResize : true, 72 | autoCenter : !isTouch, 73 | fitToView : true, 74 | aspectRatio : false, 75 | topRatio : 0.5, 76 | leftRatio : 0.5, 77 | 78 | scrolling : 'auto', // 'auto', 'yes' or 'no' 79 | wrapCSS : '', 80 | 81 | arrows : true, 82 | closeBtn : true, 83 | closeClick : false, 84 | nextClick : false, 85 | mouseWheel : true, 86 | autoPlay : false, 87 | playSpeed : 3000, 88 | preload : 3, 89 | modal : false, 90 | loop : true, 91 | 92 | ajax : { 93 | dataType : 'html', 94 | headers : { 'X-fancyBox': true } 95 | }, 96 | iframe : { 97 | scrolling : 'auto', 98 | preload : true 99 | }, 100 | swf : { 101 | wmode: 'transparent', 102 | allowfullscreen : 'true', 103 | allowscriptaccess : 'always' 104 | }, 105 | 106 | keys : { 107 | next : { 108 | 13 : 'left', // enter 109 | 34 : 'up', // page down 110 | 39 : 'left', // right arrow 111 | 40 : 'up' // down arrow 112 | }, 113 | prev : { 114 | 8 : 'right', // backspace 115 | 33 : 'down', // page up 116 | 37 : 'right', // left arrow 117 | 38 : 'down' // up arrow 118 | }, 119 | close : [27], // escape key 120 | play : [32], // space - start/stop slideshow 121 | toggle : [70] // letter "f" - toggle fullscreen 122 | }, 123 | 124 | direction : { 125 | next : 'left', 126 | prev : 'right' 127 | }, 128 | 129 | scrollOutside : true, 130 | 131 | // Override some properties 132 | index : 0, 133 | type : null, 134 | href : null, 135 | content : null, 136 | title : null, 137 | 138 | // HTML templates 139 | tpl: { 140 | wrap : '
    ', 141 | image : '', 142 | iframe : '', 143 | error : '

    The requested content cannot be loaded.
    Please try again later.

    ', 144 | closeBtn : '', 145 | next : '', 146 | prev : '', 147 | loading : '
    ' 148 | }, 149 | 150 | // Properties for each animation type 151 | // Opening fancyBox 152 | openEffect : 'fade', // 'elastic', 'fade' or 'none' 153 | openSpeed : 250, 154 | openEasing : 'swing', 155 | openOpacity : true, 156 | openMethod : 'zoomIn', 157 | 158 | // Closing fancyBox 159 | closeEffect : 'fade', // 'elastic', 'fade' or 'none' 160 | closeSpeed : 250, 161 | closeEasing : 'swing', 162 | closeOpacity : true, 163 | closeMethod : 'zoomOut', 164 | 165 | // Changing next gallery item 166 | nextEffect : 'elastic', // 'elastic', 'fade' or 'none' 167 | nextSpeed : 250, 168 | nextEasing : 'swing', 169 | nextMethod : 'changeIn', 170 | 171 | // Changing previous gallery item 172 | prevEffect : 'elastic', // 'elastic', 'fade' or 'none' 173 | prevSpeed : 250, 174 | prevEasing : 'swing', 175 | prevMethod : 'changeOut', 176 | 177 | // Enable default helpers 178 | helpers : { 179 | overlay : true, 180 | title : true 181 | }, 182 | 183 | // Callbacks 184 | onCancel : $.noop, // If canceling 185 | beforeLoad : $.noop, // Before loading 186 | afterLoad : $.noop, // After loading 187 | beforeShow : $.noop, // Before changing in current item 188 | afterShow : $.noop, // After opening 189 | beforeChange : $.noop, // Before changing gallery item 190 | beforeClose : $.noop, // Before closing 191 | afterClose : $.noop // After closing 192 | }, 193 | 194 | //Current state 195 | group : {}, // Selected group 196 | opts : {}, // Group options 197 | previous : null, // Previous element 198 | coming : null, // Element being loaded 199 | current : null, // Currently loaded element 200 | isActive : false, // Is activated 201 | isOpen : false, // Is currently open 202 | isOpened : false, // Have been fully opened at least once 203 | 204 | wrap : null, 205 | skin : null, 206 | outer : null, 207 | inner : null, 208 | 209 | player : { 210 | timer : null, 211 | isActive : false 212 | }, 213 | 214 | // Loaders 215 | ajaxLoad : null, 216 | imgPreload : null, 217 | 218 | // Some collections 219 | transitions : {}, 220 | helpers : {}, 221 | 222 | /* 223 | * Static methods 224 | */ 225 | 226 | open: function (group, opts) { 227 | if (!group) { 228 | return; 229 | } 230 | 231 | if (!$.isPlainObject(opts)) { 232 | opts = {}; 233 | } 234 | 235 | // Close if already active 236 | if (false === F.close(true)) { 237 | return; 238 | } 239 | 240 | // Normalize group 241 | if (!$.isArray(group)) { 242 | group = isQuery(group) ? $(group).get() : [group]; 243 | } 244 | 245 | // Recheck if the type of each element is `object` and set content type (image, ajax, etc) 246 | $.each(group, function(i, element) { 247 | var obj = {}, 248 | href, 249 | title, 250 | content, 251 | type, 252 | rez, 253 | hrefParts, 254 | selector; 255 | 256 | if ($.type(element) === "object") { 257 | // Check if is DOM element 258 | if (element.nodeType) { 259 | element = $(element); 260 | } 261 | 262 | if (isQuery(element)) { 263 | obj = { 264 | href : element.data('fancybox-href') || element.attr('href'), 265 | title : $('
    ').text( element.data('fancybox-title') || element.attr('title') || '' ).html(), 266 | isDom : true, 267 | element : element 268 | }; 269 | 270 | if ($.metadata) { 271 | $.extend(true, obj, element.metadata()); 272 | } 273 | 274 | } else { 275 | obj = element; 276 | } 277 | } 278 | 279 | href = opts.href || obj.href || (isString(element) ? element : null); 280 | title = opts.title !== undefined ? opts.title : obj.title || ''; 281 | 282 | content = opts.content || obj.content; 283 | type = content ? 'html' : (opts.type || obj.type); 284 | 285 | if (!type && obj.isDom) { 286 | type = element.data('fancybox-type'); 287 | 288 | if (!type) { 289 | rez = element.prop('class').match(/fancybox\.(\w+)/); 290 | type = rez ? rez[1] : null; 291 | } 292 | } 293 | 294 | if (isString(href)) { 295 | // Try to guess the content type 296 | if (!type) { 297 | if (F.isImage(href)) { 298 | type = 'image'; 299 | 300 | } else if (F.isSWF(href)) { 301 | type = 'swf'; 302 | 303 | } else if (href.charAt(0) === '#') { 304 | type = 'inline'; 305 | 306 | } else if (isString(element)) { 307 | type = 'html'; 308 | content = element; 309 | } 310 | } 311 | 312 | // Split url into two pieces with source url and content selector, e.g, 313 | // "/mypage.html #my_id" will load "/mypage.html" and display element having id "my_id" 314 | if (type === 'ajax') { 315 | hrefParts = href.split(/\s+/, 2); 316 | href = hrefParts.shift(); 317 | selector = hrefParts.shift(); 318 | } 319 | } 320 | 321 | if (!content) { 322 | if (type === 'inline') { 323 | if (href) { 324 | content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7 325 | 326 | } else if (obj.isDom) { 327 | content = element; 328 | } 329 | 330 | } else if (type === 'html') { 331 | content = href; 332 | 333 | } else if (!type && !href && obj.isDom) { 334 | type = 'inline'; 335 | content = element; 336 | } 337 | } 338 | 339 | $.extend(obj, { 340 | href : href, 341 | type : type, 342 | content : content, 343 | title : title, 344 | selector : selector 345 | }); 346 | 347 | group[ i ] = obj; 348 | }); 349 | 350 | // Extend the defaults 351 | F.opts = $.extend(true, {}, F.defaults, opts); 352 | 353 | // All options are merged recursive except keys 354 | if (opts.keys !== undefined) { 355 | F.opts.keys = opts.keys ? $.extend({}, F.defaults.keys, opts.keys) : false; 356 | } 357 | 358 | F.group = group; 359 | 360 | return F._start(F.opts.index); 361 | }, 362 | 363 | // Cancel image loading or abort ajax request 364 | cancel: function () { 365 | var coming = F.coming; 366 | 367 | if (coming && false === F.trigger('onCancel')) { 368 | return; 369 | } 370 | 371 | F.hideLoading(); 372 | 373 | if (!coming) { 374 | return; 375 | } 376 | 377 | if (F.ajaxLoad) { 378 | F.ajaxLoad.abort(); 379 | } 380 | 381 | F.ajaxLoad = null; 382 | 383 | if (F.imgPreload) { 384 | F.imgPreload.onload = F.imgPreload.onerror = null; 385 | } 386 | 387 | if (coming.wrap) { 388 | coming.wrap.stop(true, true).trigger('onReset').remove(); 389 | } 390 | 391 | F.coming = null; 392 | 393 | // If the first item has been canceled, then clear everything 394 | if (!F.current) { 395 | F._afterZoomOut( coming ); 396 | } 397 | }, 398 | 399 | // Start closing animation if is open; remove immediately if opening/closing 400 | close: function (event) { 401 | F.cancel(); 402 | 403 | if (false === F.trigger('beforeClose')) { 404 | return; 405 | } 406 | 407 | F.unbindEvents(); 408 | 409 | if (!F.isActive) { 410 | return; 411 | } 412 | 413 | if (!F.isOpen || event === true) { 414 | $('.fancybox-wrap').stop(true).trigger('onReset').remove(); 415 | 416 | F._afterZoomOut(); 417 | 418 | } else { 419 | F.isOpen = F.isOpened = false; 420 | F.isClosing = true; 421 | 422 | $('.fancybox-item, .fancybox-nav').remove(); 423 | 424 | F.wrap.stop(true, true).removeClass('fancybox-opened'); 425 | 426 | F.transitions[ F.current.closeMethod ](); 427 | } 428 | }, 429 | 430 | // Manage slideshow: 431 | // $.fancybox.play(); - toggle slideshow 432 | // $.fancybox.play( true ); - start 433 | // $.fancybox.play( false ); - stop 434 | play: function ( action ) { 435 | var clear = function () { 436 | clearTimeout(F.player.timer); 437 | }, 438 | set = function () { 439 | clear(); 440 | 441 | if (F.current && F.player.isActive) { 442 | F.player.timer = setTimeout(F.next, F.current.playSpeed); 443 | } 444 | }, 445 | stop = function () { 446 | clear(); 447 | 448 | D.unbind('.player'); 449 | 450 | F.player.isActive = false; 451 | 452 | F.trigger('onPlayEnd'); 453 | }, 454 | start = function () { 455 | if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) { 456 | F.player.isActive = true; 457 | 458 | D.bind({ 459 | 'onCancel.player beforeClose.player' : stop, 460 | 'onUpdate.player' : set, 461 | 'beforeLoad.player' : clear 462 | }); 463 | 464 | set(); 465 | 466 | F.trigger('onPlayStart'); 467 | } 468 | }; 469 | 470 | if (action === true || (!F.player.isActive && action !== false)) { 471 | start(); 472 | } else { 473 | stop(); 474 | } 475 | }, 476 | 477 | // Navigate to next gallery item 478 | next: function ( direction ) { 479 | var current = F.current; 480 | 481 | if (current) { 482 | if (!isString(direction)) { 483 | direction = current.direction.next; 484 | } 485 | 486 | F.jumpto(current.index + 1, direction, 'next'); 487 | } 488 | }, 489 | 490 | // Navigate to previous gallery item 491 | prev: function ( direction ) { 492 | var current = F.current; 493 | 494 | if (current) { 495 | if (!isString(direction)) { 496 | direction = current.direction.prev; 497 | } 498 | 499 | F.jumpto(current.index - 1, direction, 'prev'); 500 | } 501 | }, 502 | 503 | // Navigate to gallery item by index 504 | jumpto: function ( index, direction, router ) { 505 | var current = F.current; 506 | 507 | if (!current) { 508 | return; 509 | } 510 | 511 | index = getScalar(index); 512 | 513 | F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ]; 514 | F.router = router || 'jumpto'; 515 | 516 | if (current.loop) { 517 | if (index < 0) { 518 | index = current.group.length + (index % current.group.length); 519 | } 520 | 521 | index = index % current.group.length; 522 | } 523 | 524 | if (current.group[ index ] !== undefined) { 525 | F.cancel(); 526 | 527 | F._start(index); 528 | } 529 | }, 530 | 531 | // Center inside viewport and toggle position type to fixed or absolute if needed 532 | reposition: function (e, onlyAbsolute) { 533 | var current = F.current, 534 | wrap = current ? current.wrap : null, 535 | pos; 536 | 537 | if (wrap) { 538 | pos = F._getPosition(onlyAbsolute); 539 | 540 | if (e && e.type === 'scroll') { 541 | delete pos.position; 542 | 543 | wrap.stop(true, true).animate(pos, 200); 544 | 545 | } else { 546 | wrap.css(pos); 547 | 548 | current.pos = $.extend({}, current.dim, pos); 549 | } 550 | } 551 | }, 552 | 553 | update: function (e) { 554 | var type = (e && e.originalEvent && e.originalEvent.type), 555 | anyway = !type || type === 'orientationchange'; 556 | 557 | if (anyway) { 558 | clearTimeout(didUpdate); 559 | 560 | didUpdate = null; 561 | } 562 | 563 | if (!F.isOpen || didUpdate) { 564 | return; 565 | } 566 | 567 | didUpdate = setTimeout(function() { 568 | var current = F.current; 569 | 570 | if (!current || F.isClosing) { 571 | return; 572 | } 573 | 574 | F.wrap.removeClass('fancybox-tmp'); 575 | 576 | if (anyway || type === 'load' || (type === 'resize' && current.autoResize)) { 577 | F._setDimension(); 578 | } 579 | 580 | if (!(type === 'scroll' && current.canShrink)) { 581 | F.reposition(e); 582 | } 583 | 584 | F.trigger('onUpdate'); 585 | 586 | didUpdate = null; 587 | 588 | }, (anyway && !isTouch ? 0 : 300)); 589 | }, 590 | 591 | // Shrink content to fit inside viewport or restore if resized 592 | toggle: function ( action ) { 593 | if (F.isOpen) { 594 | F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView; 595 | 596 | // Help browser to restore document dimensions 597 | if (isTouch) { 598 | F.wrap.removeAttr('style').addClass('fancybox-tmp'); 599 | 600 | F.trigger('onUpdate'); 601 | } 602 | 603 | F.update(); 604 | } 605 | }, 606 | 607 | hideLoading: function () { 608 | D.unbind('.loading'); 609 | 610 | $('#fancybox-loading').remove(); 611 | }, 612 | 613 | showLoading: function () { 614 | var el, viewport; 615 | 616 | F.hideLoading(); 617 | 618 | el = $(F.opts.tpl.loading).click(F.cancel).appendTo('body'); 619 | 620 | // If user will press the escape-button, the request will be canceled 621 | D.bind('keydown.loading', function(e) { 622 | if ((e.which || e.keyCode) === 27) { 623 | e.preventDefault(); 624 | 625 | F.cancel(); 626 | } 627 | }); 628 | 629 | if (!F.defaults.fixed) { 630 | viewport = F.getViewport(); 631 | 632 | el.css({ 633 | position : 'absolute', 634 | top : (viewport.h * 0.5) + viewport.y, 635 | left : (viewport.w * 0.5) + viewport.x 636 | }); 637 | } 638 | 639 | F.trigger('onLoading'); 640 | }, 641 | 642 | getViewport: function () { 643 | var locked = (F.current && F.current.locked) || false, 644 | rez = { 645 | x: W.scrollLeft(), 646 | y: W.scrollTop() 647 | }; 648 | 649 | if (locked && locked.length) { 650 | rez.w = locked[0].clientWidth; 651 | rez.h = locked[0].clientHeight; 652 | 653 | } else { 654 | // See http://bugs.jquery.com/ticket/6724 655 | rez.w = isTouch && window.innerWidth ? window.innerWidth : W.width(); 656 | rez.h = isTouch && window.innerHeight ? window.innerHeight : W.height(); 657 | } 658 | 659 | return rez; 660 | }, 661 | 662 | // Unbind the keyboard / clicking actions 663 | unbindEvents: function () { 664 | if (F.wrap && isQuery(F.wrap)) { 665 | F.wrap.unbind('.fb'); 666 | } 667 | 668 | D.unbind('.fb'); 669 | W.unbind('.fb'); 670 | }, 671 | 672 | bindEvents: function () { 673 | var current = F.current, 674 | keys; 675 | 676 | if (!current) { 677 | return; 678 | } 679 | 680 | // Changing document height on iOS devices triggers a 'resize' event, 681 | // that can change document height... repeating infinitely 682 | W.bind('orientationchange.fb' + (isTouch ? '' : ' resize.fb') + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update); 683 | 684 | keys = current.keys; 685 | 686 | if (keys) { 687 | D.bind('keydown.fb', function (e) { 688 | var code = e.which || e.keyCode, 689 | target = e.target || e.srcElement; 690 | 691 | // Skip esc key if loading, because showLoading will cancel preloading 692 | if (code === 27 && F.coming) { 693 | return false; 694 | } 695 | 696 | // Ignore key combinations and key events within form elements 697 | if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && !(target && (target.type || $(target).is('[contenteditable]')))) { 698 | $.each(keys, function(i, val) { 699 | if (current.group.length > 1 && val[ code ] !== undefined) { 700 | F[ i ]( val[ code ] ); 701 | 702 | e.preventDefault(); 703 | return false; 704 | } 705 | 706 | if ($.inArray(code, val) > -1) { 707 | F[ i ] (); 708 | 709 | e.preventDefault(); 710 | return false; 711 | } 712 | }); 713 | } 714 | }); 715 | } 716 | 717 | if ($.fn.mousewheel && current.mouseWheel) { 718 | F.wrap.bind('mousewheel.fb', function (e, delta, deltaX, deltaY) { 719 | var target = e.target || null, 720 | parent = $(target), 721 | canScroll = false; 722 | 723 | while (parent.length) { 724 | if (canScroll || parent.is('.fancybox-skin') || parent.is('.fancybox-wrap')) { 725 | break; 726 | } 727 | 728 | canScroll = isScrollable( parent[0] ); 729 | parent = $(parent).parent(); 730 | } 731 | 732 | if (delta !== 0 && !canScroll) { 733 | if (F.group.length > 1 && !current.canShrink) { 734 | if (deltaY > 0 || deltaX > 0) { 735 | F.prev( deltaY > 0 ? 'down' : 'left' ); 736 | 737 | } else if (deltaY < 0 || deltaX < 0) { 738 | F.next( deltaY < 0 ? 'up' : 'right' ); 739 | } 740 | 741 | e.preventDefault(); 742 | } 743 | } 744 | }); 745 | } 746 | }, 747 | 748 | trigger: function (event, o) { 749 | var ret, obj = o || F.coming || F.current; 750 | 751 | if (obj) { 752 | if ($.isFunction( obj[event] )) { 753 | ret = obj[event].apply(obj, Array.prototype.slice.call(arguments, 1)); 754 | } 755 | 756 | if (ret === false) { 757 | return false; 758 | } 759 | 760 | if (obj.helpers) { 761 | $.each(obj.helpers, function (helper, opts) { 762 | if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) { 763 | F.helpers[helper][event]($.extend(true, {}, F.helpers[helper].defaults, opts), obj); 764 | } 765 | }); 766 | } 767 | } 768 | 769 | D.trigger(event); 770 | }, 771 | 772 | isImage: function (str) { 773 | return isString(str) && str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i); 774 | }, 775 | 776 | isSWF: function (str) { 777 | return isString(str) && str.match(/\.(swf)((\?|#).*)?$/i); 778 | }, 779 | 780 | _start: function (index) { 781 | var coming = {}, 782 | obj, 783 | href, 784 | type, 785 | margin, 786 | padding; 787 | 788 | index = getScalar( index ); 789 | obj = F.group[ index ] || null; 790 | 791 | if (!obj) { 792 | return false; 793 | } 794 | 795 | coming = $.extend(true, {}, F.opts, obj); 796 | 797 | // Convert margin and padding properties to array - top, right, bottom, left 798 | margin = coming.margin; 799 | padding = coming.padding; 800 | 801 | if ($.type(margin) === 'number') { 802 | coming.margin = [margin, margin, margin, margin]; 803 | } 804 | 805 | if ($.type(padding) === 'number') { 806 | coming.padding = [padding, padding, padding, padding]; 807 | } 808 | 809 | // 'modal' propery is just a shortcut 810 | if (coming.modal) { 811 | $.extend(true, coming, { 812 | closeBtn : false, 813 | closeClick : false, 814 | nextClick : false, 815 | arrows : false, 816 | mouseWheel : false, 817 | keys : null, 818 | helpers: { 819 | overlay : { 820 | closeClick : false 821 | } 822 | } 823 | }); 824 | } 825 | 826 | // 'autoSize' property is a shortcut, too 827 | if (coming.autoSize) { 828 | coming.autoWidth = coming.autoHeight = true; 829 | } 830 | 831 | if (coming.width === 'auto') { 832 | coming.autoWidth = true; 833 | } 834 | 835 | if (coming.height === 'auto') { 836 | coming.autoHeight = true; 837 | } 838 | 839 | /* 840 | * Add reference to the group, so it`s possible to access from callbacks, example: 841 | * afterLoad : function() { 842 | * this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : ''); 843 | * } 844 | */ 845 | 846 | coming.group = F.group; 847 | coming.index = index; 848 | 849 | // Give a chance for callback or helpers to update coming item (type, title, etc) 850 | F.coming = coming; 851 | 852 | if (false === F.trigger('beforeLoad')) { 853 | F.coming = null; 854 | 855 | return; 856 | } 857 | 858 | type = coming.type; 859 | href = coming.href; 860 | 861 | if (!type) { 862 | F.coming = null; 863 | 864 | //If we can not determine content type then drop silently or display next/prev item if looping through gallery 865 | if (F.current && F.router && F.router !== 'jumpto') { 866 | F.current.index = index; 867 | 868 | return F[ F.router ]( F.direction ); 869 | } 870 | 871 | return false; 872 | } 873 | 874 | F.isActive = true; 875 | 876 | if (type === 'image' || type === 'swf') { 877 | coming.autoHeight = coming.autoWidth = false; 878 | coming.scrolling = 'visible'; 879 | } 880 | 881 | if (type === 'image') { 882 | coming.aspectRatio = true; 883 | } 884 | 885 | if (type === 'iframe' && isTouch) { 886 | coming.scrolling = 'scroll'; 887 | } 888 | 889 | // Build the neccessary markup 890 | coming.wrap = $(coming.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-type-' + type + ' fancybox-tmp ' + coming.wrapCSS).appendTo( coming.parent || 'body' ); 891 | 892 | $.extend(coming, { 893 | skin : $('.fancybox-skin', coming.wrap), 894 | outer : $('.fancybox-outer', coming.wrap), 895 | inner : $('.fancybox-inner', coming.wrap) 896 | }); 897 | 898 | $.each(["Top", "Right", "Bottom", "Left"], function(i, v) { 899 | coming.skin.css('padding' + v, getValue(coming.padding[ i ])); 900 | }); 901 | 902 | F.trigger('onReady'); 903 | 904 | // Check before try to load; 'inline' and 'html' types need content, others - href 905 | if (type === 'inline' || type === 'html') { 906 | if (!coming.content || !coming.content.length) { 907 | return F._error( 'content' ); 908 | } 909 | 910 | } else if (!href) { 911 | return F._error( 'href' ); 912 | } 913 | 914 | if (type === 'image') { 915 | F._loadImage(); 916 | 917 | } else if (type === 'ajax') { 918 | F._loadAjax(); 919 | 920 | } else if (type === 'iframe') { 921 | F._loadIframe(); 922 | 923 | } else { 924 | F._afterLoad(); 925 | } 926 | }, 927 | 928 | _error: function ( type ) { 929 | $.extend(F.coming, { 930 | type : 'html', 931 | autoWidth : true, 932 | autoHeight : true, 933 | minWidth : 0, 934 | minHeight : 0, 935 | scrolling : 'no', 936 | hasError : type, 937 | content : F.coming.tpl.error 938 | }); 939 | 940 | F._afterLoad(); 941 | }, 942 | 943 | _loadImage: function () { 944 | // Reset preload image so it is later possible to check "complete" property 945 | var img = F.imgPreload = new Image(); 946 | 947 | img.onload = function () { 948 | this.onload = this.onerror = null; 949 | 950 | F.coming.width = this.width / F.opts.pixelRatio; 951 | F.coming.height = this.height / F.opts.pixelRatio; 952 | 953 | F._afterLoad(); 954 | }; 955 | 956 | img.onerror = function () { 957 | this.onload = this.onerror = null; 958 | 959 | F._error( 'image' ); 960 | }; 961 | 962 | img.src = F.coming.href; 963 | 964 | if (img.complete !== true) { 965 | F.showLoading(); 966 | } 967 | }, 968 | 969 | _loadAjax: function () { 970 | var coming = F.coming; 971 | 972 | F.showLoading(); 973 | 974 | F.ajaxLoad = $.ajax($.extend({}, coming.ajax, { 975 | url: coming.href, 976 | error: function (jqXHR, textStatus) { 977 | if (F.coming && textStatus !== 'abort') { 978 | F._error( 'ajax', jqXHR ); 979 | 980 | } else { 981 | F.hideLoading(); 982 | } 983 | }, 984 | success: function (data, textStatus) { 985 | if (textStatus === 'success') { 986 | coming.content = data; 987 | 988 | F._afterLoad(); 989 | } 990 | } 991 | })); 992 | }, 993 | 994 | _loadIframe: function() { 995 | var coming = F.coming, 996 | iframe = $(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime())) 997 | .attr('scrolling', isTouch ? 'auto' : coming.iframe.scrolling) 998 | .attr('src', coming.href); 999 | 1000 | // This helps IE 1001 | $(coming.wrap).bind('onReset', function () { 1002 | try { 1003 | $(this).find('iframe').hide().attr('src', '//about:blank').end().empty(); 1004 | } catch (e) {} 1005 | }); 1006 | 1007 | if (coming.iframe.preload) { 1008 | F.showLoading(); 1009 | 1010 | iframe.one('load', function() { 1011 | $(this).data('ready', 1); 1012 | 1013 | // iOS will lose scrolling if we resize 1014 | if (!isTouch) { 1015 | $(this).bind('load.fb', F.update); 1016 | } 1017 | 1018 | // Without this trick: 1019 | // - iframe won't scroll on iOS devices 1020 | // - IE7 sometimes displays empty iframe 1021 | $(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show(); 1022 | 1023 | F._afterLoad(); 1024 | }); 1025 | } 1026 | 1027 | coming.content = iframe.appendTo( coming.inner ); 1028 | 1029 | if (!coming.iframe.preload) { 1030 | F._afterLoad(); 1031 | } 1032 | }, 1033 | 1034 | _preloadImages: function() { 1035 | var group = F.group, 1036 | current = F.current, 1037 | len = group.length, 1038 | cnt = current.preload ? Math.min(current.preload, len - 1) : 0, 1039 | item, 1040 | i; 1041 | 1042 | for (i = 1; i <= cnt; i += 1) { 1043 | item = group[ (current.index + i ) % len ]; 1044 | 1045 | if (item.type === 'image' && item.href) { 1046 | new Image().src = item.href; 1047 | } 1048 | } 1049 | }, 1050 | 1051 | _afterLoad: function () { 1052 | var coming = F.coming, 1053 | previous = F.current, 1054 | placeholder = 'fancybox-placeholder', 1055 | current, 1056 | content, 1057 | type, 1058 | scrolling, 1059 | href, 1060 | embed; 1061 | 1062 | F.hideLoading(); 1063 | 1064 | if (!coming || F.isActive === false) { 1065 | return; 1066 | } 1067 | 1068 | if (false === F.trigger('afterLoad', coming, previous)) { 1069 | coming.wrap.stop(true).trigger('onReset').remove(); 1070 | 1071 | F.coming = null; 1072 | 1073 | return; 1074 | } 1075 | 1076 | if (previous) { 1077 | F.trigger('beforeChange', previous); 1078 | 1079 | previous.wrap.stop(true).removeClass('fancybox-opened') 1080 | .find('.fancybox-item, .fancybox-nav') 1081 | .remove(); 1082 | } 1083 | 1084 | F.unbindEvents(); 1085 | 1086 | current = coming; 1087 | content = coming.content; 1088 | type = coming.type; 1089 | scrolling = coming.scrolling; 1090 | 1091 | $.extend(F, { 1092 | wrap : current.wrap, 1093 | skin : current.skin, 1094 | outer : current.outer, 1095 | inner : current.inner, 1096 | current : current, 1097 | previous : previous 1098 | }); 1099 | 1100 | href = current.href; 1101 | 1102 | switch (type) { 1103 | case 'inline': 1104 | case 'ajax': 1105 | case 'html': 1106 | if (current.selector) { 1107 | content = $('
    ').html(content).find(current.selector); 1108 | 1109 | } else if (isQuery(content)) { 1110 | if (!content.data(placeholder)) { 1111 | content.data(placeholder, $('
    ').insertAfter( content ).hide() ); 1112 | } 1113 | 1114 | content = content.show().detach(); 1115 | 1116 | current.wrap.bind('onReset', function () { 1117 | if ($(this).find(content).length) { 1118 | content.hide().replaceAll( content.data(placeholder) ).data(placeholder, false); 1119 | } 1120 | }); 1121 | } 1122 | break; 1123 | 1124 | case 'image': 1125 | content = current.tpl.image.replace(/\{href\}/g, href); 1126 | break; 1127 | 1128 | case 'swf': 1129 | content = ''; 1130 | embed = ''; 1131 | 1132 | $.each(current.swf, function(name, val) { 1133 | content += ''; 1134 | embed += ' ' + name + '="' + val + '"'; 1135 | }); 1136 | 1137 | content += ''; 1138 | break; 1139 | } 1140 | 1141 | if (!(isQuery(content) && content.parent().is(current.inner))) { 1142 | current.inner.append( content ); 1143 | } 1144 | 1145 | // Give a chance for helpers or callbacks to update elements 1146 | F.trigger('beforeShow'); 1147 | 1148 | // Set scrolling before calculating dimensions 1149 | current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling)); 1150 | 1151 | // Set initial dimensions and start position 1152 | F._setDimension(); 1153 | 1154 | F.reposition(); 1155 | 1156 | F.isOpen = false; 1157 | F.coming = null; 1158 | 1159 | F.bindEvents(); 1160 | 1161 | if (!F.isOpened) { 1162 | $('.fancybox-wrap').not( current.wrap ).stop(true).trigger('onReset').remove(); 1163 | 1164 | } else if (previous.prevMethod) { 1165 | F.transitions[ previous.prevMethod ](); 1166 | } 1167 | 1168 | F.transitions[ F.isOpened ? current.nextMethod : current.openMethod ](); 1169 | 1170 | F._preloadImages(); 1171 | }, 1172 | 1173 | _setDimension: function () { 1174 | var viewport = F.getViewport(), 1175 | steps = 0, 1176 | canShrink = false, 1177 | canExpand = false, 1178 | wrap = F.wrap, 1179 | skin = F.skin, 1180 | inner = F.inner, 1181 | current = F.current, 1182 | width = current.width, 1183 | height = current.height, 1184 | minWidth = current.minWidth, 1185 | minHeight = current.minHeight, 1186 | maxWidth = current.maxWidth, 1187 | maxHeight = current.maxHeight, 1188 | scrolling = current.scrolling, 1189 | scrollOut = current.scrollOutside ? current.scrollbarWidth : 0, 1190 | margin = current.margin, 1191 | wMargin = getScalar(margin[1] + margin[3]), 1192 | hMargin = getScalar(margin[0] + margin[2]), 1193 | wPadding, 1194 | hPadding, 1195 | wSpace, 1196 | hSpace, 1197 | origWidth, 1198 | origHeight, 1199 | origMaxWidth, 1200 | origMaxHeight, 1201 | ratio, 1202 | width_, 1203 | height_, 1204 | maxWidth_, 1205 | maxHeight_, 1206 | iframe, 1207 | body; 1208 | 1209 | // Reset dimensions so we could re-check actual size 1210 | wrap.add(skin).add(inner).width('auto').height('auto').removeClass('fancybox-tmp'); 1211 | 1212 | wPadding = getScalar(skin.outerWidth(true) - skin.width()); 1213 | hPadding = getScalar(skin.outerHeight(true) - skin.height()); 1214 | 1215 | // Any space between content and viewport (margin, padding, border, title) 1216 | wSpace = wMargin + wPadding; 1217 | hSpace = hMargin + hPadding; 1218 | 1219 | origWidth = isPercentage(width) ? (viewport.w - wSpace) * getScalar(width) / 100 : width; 1220 | origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height; 1221 | 1222 | if (current.type === 'iframe') { 1223 | iframe = current.content; 1224 | 1225 | if (current.autoHeight && iframe && iframe.data('ready') === 1) { 1226 | try { 1227 | if (iframe[0].contentWindow.document.location) { 1228 | inner.width( origWidth ).height(9999); 1229 | 1230 | body = iframe.contents().find('body'); 1231 | 1232 | if (scrollOut) { 1233 | body.css('overflow-x', 'hidden'); 1234 | } 1235 | 1236 | origHeight = body.outerHeight(true); 1237 | } 1238 | 1239 | } catch (e) {} 1240 | } 1241 | 1242 | } else if (current.autoWidth || current.autoHeight) { 1243 | inner.addClass( 'fancybox-tmp' ); 1244 | 1245 | // Set width or height in case we need to calculate only one dimension 1246 | if (!current.autoWidth) { 1247 | inner.width( origWidth ); 1248 | } 1249 | 1250 | if (!current.autoHeight) { 1251 | inner.height( origHeight ); 1252 | } 1253 | 1254 | if (current.autoWidth) { 1255 | origWidth = inner.width(); 1256 | } 1257 | 1258 | if (current.autoHeight) { 1259 | origHeight = inner.height(); 1260 | } 1261 | 1262 | inner.removeClass( 'fancybox-tmp' ); 1263 | } 1264 | 1265 | width = getScalar( origWidth ); 1266 | height = getScalar( origHeight ); 1267 | 1268 | ratio = origWidth / origHeight; 1269 | 1270 | // Calculations for the content 1271 | minWidth = getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth); 1272 | maxWidth = getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth); 1273 | 1274 | minHeight = getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight); 1275 | maxHeight = getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight); 1276 | 1277 | // These will be used to determine if wrap can fit in the viewport 1278 | origMaxWidth = maxWidth; 1279 | origMaxHeight = maxHeight; 1280 | 1281 | if (current.fitToView) { 1282 | maxWidth = Math.min(viewport.w - wSpace, maxWidth); 1283 | maxHeight = Math.min(viewport.h - hSpace, maxHeight); 1284 | } 1285 | 1286 | maxWidth_ = viewport.w - wMargin; 1287 | maxHeight_ = viewport.h - hMargin; 1288 | 1289 | if (current.aspectRatio) { 1290 | if (width > maxWidth) { 1291 | width = maxWidth; 1292 | height = getScalar(width / ratio); 1293 | } 1294 | 1295 | if (height > maxHeight) { 1296 | height = maxHeight; 1297 | width = getScalar(height * ratio); 1298 | } 1299 | 1300 | if (width < minWidth) { 1301 | width = minWidth; 1302 | height = getScalar(width / ratio); 1303 | } 1304 | 1305 | if (height < minHeight) { 1306 | height = minHeight; 1307 | width = getScalar(height * ratio); 1308 | } 1309 | 1310 | } else { 1311 | width = Math.max(minWidth, Math.min(width, maxWidth)); 1312 | 1313 | if (current.autoHeight && current.type !== 'iframe') { 1314 | inner.width( width ); 1315 | 1316 | height = inner.height(); 1317 | } 1318 | 1319 | height = Math.max(minHeight, Math.min(height, maxHeight)); 1320 | } 1321 | 1322 | // Try to fit inside viewport (including the title) 1323 | if (current.fitToView) { 1324 | inner.width( width ).height( height ); 1325 | 1326 | wrap.width( width + wPadding ); 1327 | 1328 | // Real wrap dimensions 1329 | width_ = wrap.width(); 1330 | height_ = wrap.height(); 1331 | 1332 | if (current.aspectRatio) { 1333 | while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) { 1334 | if (steps++ > 19) { 1335 | break; 1336 | } 1337 | 1338 | height = Math.max(minHeight, Math.min(maxHeight, height - 10)); 1339 | width = getScalar(height * ratio); 1340 | 1341 | if (width < minWidth) { 1342 | width = minWidth; 1343 | height = getScalar(width / ratio); 1344 | } 1345 | 1346 | if (width > maxWidth) { 1347 | width = maxWidth; 1348 | height = getScalar(width / ratio); 1349 | } 1350 | 1351 | inner.width( width ).height( height ); 1352 | 1353 | wrap.width( width + wPadding ); 1354 | 1355 | width_ = wrap.width(); 1356 | height_ = wrap.height(); 1357 | } 1358 | 1359 | } else { 1360 | width = Math.max(minWidth, Math.min(width, width - (width_ - maxWidth_))); 1361 | height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_))); 1362 | } 1363 | } 1364 | 1365 | if (scrollOut && scrolling === 'auto' && height < origHeight && (width + wPadding + scrollOut) < maxWidth_) { 1366 | width += scrollOut; 1367 | } 1368 | 1369 | inner.width( width ).height( height ); 1370 | 1371 | wrap.width( width + wPadding ); 1372 | 1373 | width_ = wrap.width(); 1374 | height_ = wrap.height(); 1375 | 1376 | canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight; 1377 | canExpand = current.aspectRatio ? (width < origMaxWidth && height < origMaxHeight && width < origWidth && height < origHeight) : ((width < origMaxWidth || height < origMaxHeight) && (width < origWidth || height < origHeight)); 1378 | 1379 | $.extend(current, { 1380 | dim : { 1381 | width : getValue( width_ ), 1382 | height : getValue( height_ ) 1383 | }, 1384 | origWidth : origWidth, 1385 | origHeight : origHeight, 1386 | canShrink : canShrink, 1387 | canExpand : canExpand, 1388 | wPadding : wPadding, 1389 | hPadding : hPadding, 1390 | wrapSpace : height_ - skin.outerHeight(true), 1391 | skinSpace : skin.height() - height 1392 | }); 1393 | 1394 | if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) { 1395 | inner.height('auto'); 1396 | } 1397 | }, 1398 | 1399 | _getPosition: function (onlyAbsolute) { 1400 | var current = F.current, 1401 | viewport = F.getViewport(), 1402 | margin = current.margin, 1403 | width = F.wrap.width() + margin[1] + margin[3], 1404 | height = F.wrap.height() + margin[0] + margin[2], 1405 | rez = { 1406 | position: 'absolute', 1407 | top : margin[0], 1408 | left : margin[3] 1409 | }; 1410 | 1411 | if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) { 1412 | rez.position = 'fixed'; 1413 | 1414 | } else if (!current.locked) { 1415 | rez.top += viewport.y; 1416 | rez.left += viewport.x; 1417 | } 1418 | 1419 | rez.top = getValue(Math.max(rez.top, rez.top + ((viewport.h - height) * current.topRatio))); 1420 | rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width) * current.leftRatio))); 1421 | 1422 | return rez; 1423 | }, 1424 | 1425 | _afterZoomIn: function () { 1426 | var current = F.current; 1427 | 1428 | if (!current) { 1429 | return; 1430 | } 1431 | 1432 | F.isOpen = F.isOpened = true; 1433 | 1434 | F.wrap.css('overflow', 'visible').addClass('fancybox-opened').hide().show(0); 1435 | 1436 | F.update(); 1437 | 1438 | // Assign a click event 1439 | if ( current.closeClick || (current.nextClick && F.group.length > 1) ) { 1440 | F.inner.css('cursor', 'pointer').bind('click.fb', function(e) { 1441 | if (!$(e.target).is('a') && !$(e.target).parent().is('a')) { 1442 | e.preventDefault(); 1443 | 1444 | F[ current.closeClick ? 'close' : 'next' ](); 1445 | } 1446 | }); 1447 | } 1448 | 1449 | // Create a close button 1450 | if (current.closeBtn) { 1451 | $(current.tpl.closeBtn).appendTo(F.skin).bind('click.fb', function(e) { 1452 | e.preventDefault(); 1453 | 1454 | F.close(); 1455 | }); 1456 | } 1457 | 1458 | // Create navigation arrows 1459 | if (current.arrows && F.group.length > 1) { 1460 | if (current.loop || current.index > 0) { 1461 | $(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev); 1462 | } 1463 | 1464 | if (current.loop || current.index < F.group.length - 1) { 1465 | $(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next); 1466 | } 1467 | } 1468 | 1469 | F.trigger('afterShow'); 1470 | 1471 | // Stop the slideshow if this is the last item 1472 | if (!current.loop && current.index === current.group.length - 1) { 1473 | 1474 | F.play( false ); 1475 | 1476 | } else if (F.opts.autoPlay && !F.player.isActive) { 1477 | F.opts.autoPlay = false; 1478 | 1479 | F.play(true); 1480 | } 1481 | }, 1482 | 1483 | _afterZoomOut: function ( obj ) { 1484 | obj = obj || F.current; 1485 | 1486 | $('.fancybox-wrap').trigger('onReset').remove(); 1487 | 1488 | $.extend(F, { 1489 | group : {}, 1490 | opts : {}, 1491 | router : false, 1492 | current : null, 1493 | isActive : false, 1494 | isOpened : false, 1495 | isOpen : false, 1496 | isClosing : false, 1497 | wrap : null, 1498 | skin : null, 1499 | outer : null, 1500 | inner : null 1501 | }); 1502 | 1503 | F.trigger('afterClose', obj); 1504 | } 1505 | }); 1506 | 1507 | /* 1508 | * Default transitions 1509 | */ 1510 | 1511 | F.transitions = { 1512 | getOrigPosition: function () { 1513 | var current = F.current, 1514 | element = current.element, 1515 | orig = current.orig, 1516 | pos = {}, 1517 | width = 50, 1518 | height = 50, 1519 | hPadding = current.hPadding, 1520 | wPadding = current.wPadding, 1521 | viewport = F.getViewport(); 1522 | 1523 | if (!orig && current.isDom && element.is(':visible')) { 1524 | orig = element.find('img:first'); 1525 | 1526 | if (!orig.length) { 1527 | orig = element; 1528 | } 1529 | } 1530 | 1531 | if (isQuery(orig)) { 1532 | pos = orig.offset(); 1533 | 1534 | if (orig.is('img')) { 1535 | width = orig.outerWidth(); 1536 | height = orig.outerHeight(); 1537 | } 1538 | 1539 | } else { 1540 | pos.top = viewport.y + (viewport.h - height) * current.topRatio; 1541 | pos.left = viewport.x + (viewport.w - width) * current.leftRatio; 1542 | } 1543 | 1544 | if (F.wrap.css('position') === 'fixed' || current.locked) { 1545 | pos.top -= viewport.y; 1546 | pos.left -= viewport.x; 1547 | } 1548 | 1549 | pos = { 1550 | top : getValue(pos.top - hPadding * current.topRatio), 1551 | left : getValue(pos.left - wPadding * current.leftRatio), 1552 | width : getValue(width + wPadding), 1553 | height : getValue(height + hPadding) 1554 | }; 1555 | 1556 | return pos; 1557 | }, 1558 | 1559 | step: function (now, fx) { 1560 | var ratio, 1561 | padding, 1562 | value, 1563 | prop = fx.prop, 1564 | current = F.current, 1565 | wrapSpace = current.wrapSpace, 1566 | skinSpace = current.skinSpace; 1567 | 1568 | if (prop === 'width' || prop === 'height') { 1569 | ratio = fx.end === fx.start ? 1 : (now - fx.start) / (fx.end - fx.start); 1570 | 1571 | if (F.isClosing) { 1572 | ratio = 1 - ratio; 1573 | } 1574 | 1575 | padding = prop === 'width' ? current.wPadding : current.hPadding; 1576 | value = now - padding; 1577 | 1578 | F.skin[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) ) ); 1579 | F.inner[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) - (skinSpace * ratio) ) ); 1580 | } 1581 | }, 1582 | 1583 | zoomIn: function () { 1584 | var current = F.current, 1585 | startPos = current.pos, 1586 | effect = current.openEffect, 1587 | elastic = effect === 'elastic', 1588 | endPos = $.extend({opacity : 1}, startPos); 1589 | 1590 | // Remove "position" property that breaks older IE 1591 | delete endPos.position; 1592 | 1593 | if (elastic) { 1594 | startPos = this.getOrigPosition(); 1595 | 1596 | if (current.openOpacity) { 1597 | startPos.opacity = 0.1; 1598 | } 1599 | 1600 | } else if (effect === 'fade') { 1601 | startPos.opacity = 0.1; 1602 | } 1603 | 1604 | F.wrap.css(startPos).animate(endPos, { 1605 | duration : effect === 'none' ? 0 : current.openSpeed, 1606 | easing : current.openEasing, 1607 | step : elastic ? this.step : null, 1608 | complete : F._afterZoomIn 1609 | }); 1610 | }, 1611 | 1612 | zoomOut: function () { 1613 | var current = F.current, 1614 | effect = current.closeEffect, 1615 | elastic = effect === 'elastic', 1616 | endPos = {opacity : 0.1}; 1617 | 1618 | if (elastic) { 1619 | endPos = this.getOrigPosition(); 1620 | 1621 | if (current.closeOpacity) { 1622 | endPos.opacity = 0.1; 1623 | } 1624 | } 1625 | 1626 | F.wrap.animate(endPos, { 1627 | duration : effect === 'none' ? 0 : current.closeSpeed, 1628 | easing : current.closeEasing, 1629 | step : elastic ? this.step : null, 1630 | complete : F._afterZoomOut 1631 | }); 1632 | }, 1633 | 1634 | changeIn: function () { 1635 | var current = F.current, 1636 | effect = current.nextEffect, 1637 | startPos = current.pos, 1638 | endPos = { opacity : 1 }, 1639 | direction = F.direction, 1640 | distance = 200, 1641 | field; 1642 | 1643 | startPos.opacity = 0.1; 1644 | 1645 | if (effect === 'elastic') { 1646 | field = direction === 'down' || direction === 'up' ? 'top' : 'left'; 1647 | 1648 | if (direction === 'down' || direction === 'right') { 1649 | startPos[ field ] = getValue(getScalar(startPos[ field ]) - distance); 1650 | endPos[ field ] = '+=' + distance + 'px'; 1651 | 1652 | } else { 1653 | startPos[ field ] = getValue(getScalar(startPos[ field ]) + distance); 1654 | endPos[ field ] = '-=' + distance + 'px'; 1655 | } 1656 | } 1657 | 1658 | // Workaround for http://bugs.jquery.com/ticket/12273 1659 | if (effect === 'none') { 1660 | F._afterZoomIn(); 1661 | 1662 | } else { 1663 | F.wrap.css(startPos).animate(endPos, { 1664 | duration : current.nextSpeed, 1665 | easing : current.nextEasing, 1666 | complete : F._afterZoomIn 1667 | }); 1668 | } 1669 | }, 1670 | 1671 | changeOut: function () { 1672 | var previous = F.previous, 1673 | effect = previous.prevEffect, 1674 | endPos = { opacity : 0.1 }, 1675 | direction = F.direction, 1676 | distance = 200; 1677 | 1678 | if (effect === 'elastic') { 1679 | endPos[ direction === 'down' || direction === 'up' ? 'top' : 'left' ] = ( direction === 'up' || direction === 'left' ? '-' : '+' ) + '=' + distance + 'px'; 1680 | } 1681 | 1682 | previous.wrap.animate(endPos, { 1683 | duration : effect === 'none' ? 0 : previous.prevSpeed, 1684 | easing : previous.prevEasing, 1685 | complete : function () { 1686 | $(this).trigger('onReset').remove(); 1687 | } 1688 | }); 1689 | } 1690 | }; 1691 | 1692 | /* 1693 | * Overlay helper 1694 | */ 1695 | 1696 | F.helpers.overlay = { 1697 | defaults : { 1698 | closeClick : true, // if true, fancyBox will be closed when user clicks on the overlay 1699 | speedOut : 200, // duration of fadeOut animation 1700 | showEarly : true, // indicates if should be opened immediately or wait until the content is ready 1701 | css : {}, // custom CSS properties 1702 | locked : !isTouch, // if true, the content will be locked into overlay 1703 | fixed : true // if false, the overlay CSS position property will not be set to "fixed" 1704 | }, 1705 | 1706 | overlay : null, // current handle 1707 | fixed : false, // indicates if the overlay has position "fixed" 1708 | el : $('html'), // element that contains "the lock" 1709 | 1710 | // Public methods 1711 | create : function(opts) { 1712 | var parent; 1713 | 1714 | opts = $.extend({}, this.defaults, opts); 1715 | 1716 | if (this.overlay) { 1717 | this.close(); 1718 | } 1719 | 1720 | parent = F.coming ? F.coming.parent : opts.parent; 1721 | 1722 | this.overlay = $('
    ').appendTo( parent && parent.length ? parent : 'body' ); 1723 | this.fixed = false; 1724 | 1725 | if (opts.fixed && F.defaults.fixed) { 1726 | this.overlay.addClass('fancybox-overlay-fixed'); 1727 | 1728 | this.fixed = true; 1729 | } 1730 | }, 1731 | 1732 | open : function(opts) { 1733 | var that = this; 1734 | 1735 | opts = $.extend({}, this.defaults, opts); 1736 | 1737 | if (this.overlay) { 1738 | this.overlay.unbind('.overlay').width('auto').height('auto'); 1739 | 1740 | } else { 1741 | this.create(opts); 1742 | } 1743 | 1744 | if (!this.fixed) { 1745 | W.bind('resize.overlay', $.proxy( this.update, this) ); 1746 | 1747 | this.update(); 1748 | } 1749 | 1750 | if (opts.closeClick) { 1751 | this.overlay.bind('click.overlay', function(e) { 1752 | if ($(e.target).hasClass('fancybox-overlay')) { 1753 | if (F.isActive) { 1754 | F.close(); 1755 | } else { 1756 | that.close(); 1757 | } 1758 | 1759 | return false; 1760 | } 1761 | }); 1762 | } 1763 | 1764 | this.overlay.css( opts.css ).show(); 1765 | }, 1766 | 1767 | close : function() { 1768 | W.unbind('resize.overlay'); 1769 | 1770 | if (this.el.hasClass('fancybox-lock')) { 1771 | $('.fancybox-margin').removeClass('fancybox-margin'); 1772 | 1773 | this.el.removeClass('fancybox-lock'); 1774 | 1775 | W.scrollTop( this.scrollV ).scrollLeft( this.scrollH ); 1776 | } 1777 | 1778 | $('.fancybox-overlay').remove().hide(); 1779 | 1780 | $.extend(this, { 1781 | overlay : null, 1782 | fixed : false 1783 | }); 1784 | }, 1785 | 1786 | // Private, callbacks 1787 | 1788 | update : function () { 1789 | var width = '100%', offsetWidth; 1790 | 1791 | // Reset width/height so it will not mess 1792 | this.overlay.width(width).height('100%'); 1793 | 1794 | // jQuery does not return reliable result for IE 1795 | if (IE) { 1796 | offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth); 1797 | 1798 | if (D.width() > offsetWidth) { 1799 | width = D.width(); 1800 | } 1801 | 1802 | } else if (D.width() > W.width()) { 1803 | width = D.width(); 1804 | } 1805 | 1806 | this.overlay.width(width).height(D.height()); 1807 | }, 1808 | 1809 | // This is where we can manipulate DOM, because later it would cause iframes to reload 1810 | onReady : function (opts, obj) { 1811 | var overlay = this.overlay; 1812 | 1813 | $('.fancybox-overlay').stop(true, true); 1814 | 1815 | if (!overlay) { 1816 | this.create(opts); 1817 | } 1818 | 1819 | if (opts.locked && this.fixed && obj.fixed) { 1820 | obj.locked = this.overlay.append( obj.wrap ); 1821 | obj.fixed = false; 1822 | } 1823 | 1824 | if (opts.showEarly === true) { 1825 | this.beforeShow.apply(this, arguments); 1826 | } 1827 | }, 1828 | 1829 | beforeShow : function(opts, obj) { 1830 | if (obj.locked && !this.el.hasClass('fancybox-lock')) { 1831 | if (this.fixPosition !== false) { 1832 | $('*:not(object)').filter(function(){ 1833 | return ($(this).css('position') === 'fixed' && !$(this).hasClass("fancybox-overlay") && !$(this).hasClass("fancybox-wrap") ); 1834 | }).addClass('fancybox-margin'); 1835 | } 1836 | 1837 | this.el.addClass('fancybox-margin'); 1838 | 1839 | this.scrollV = W.scrollTop(); 1840 | this.scrollH = W.scrollLeft(); 1841 | 1842 | this.el.addClass('fancybox-lock'); 1843 | 1844 | W.scrollTop( this.scrollV ).scrollLeft( this.scrollH ); 1845 | } 1846 | 1847 | this.open(opts); 1848 | }, 1849 | 1850 | onUpdate : function() { 1851 | if (!this.fixed) { 1852 | this.update(); 1853 | } 1854 | }, 1855 | 1856 | afterClose: function (opts) { 1857 | // Remove overlay if exists and fancyBox is not opening 1858 | // (e.g., it is not being open using afterClose callback) 1859 | if (this.overlay && !F.coming) { 1860 | this.overlay.fadeOut(opts.speedOut, $.proxy( this.close, this )); 1861 | } 1862 | } 1863 | }; 1864 | 1865 | /* 1866 | * Title helper 1867 | */ 1868 | 1869 | F.helpers.title = { 1870 | defaults : { 1871 | type : 'float', // 'float', 'inside', 'outside' or 'over', 1872 | position : 'bottom' // 'top' or 'bottom' 1873 | }, 1874 | 1875 | beforeShow: function (opts) { 1876 | var current = F.current, 1877 | text = current.title, 1878 | type = opts.type, 1879 | title, 1880 | target; 1881 | 1882 | if ($.isFunction(text)) { 1883 | text = text.call(current.element, current); 1884 | } 1885 | 1886 | if (!isString(text) || $.trim(text) === '') { 1887 | return; 1888 | } 1889 | 1890 | title = $('
    ' + text + '
    '); 1891 | 1892 | switch (type) { 1893 | case 'inside': 1894 | target = F.skin; 1895 | break; 1896 | 1897 | case 'outside': 1898 | target = F.wrap; 1899 | break; 1900 | 1901 | case 'over': 1902 | target = F.inner; 1903 | break; 1904 | 1905 | default: // 'float' 1906 | target = F.skin; 1907 | 1908 | title.appendTo('body'); 1909 | 1910 | if (IE) { 1911 | title.width( title.width() ); 1912 | } 1913 | 1914 | title.wrapInner(''); 1915 | 1916 | //Increase bottom margin so this title will also fit into viewport 1917 | F.current.margin[2] += Math.abs( getScalar(title.css('margin-bottom')) ); 1918 | break; 1919 | } 1920 | 1921 | title[ (opts.position === 'top' ? 'prependTo' : 'appendTo') ](target); 1922 | } 1923 | }; 1924 | 1925 | // jQuery plugin initialization 1926 | $.fn.fancybox = function (options) { 1927 | var index, 1928 | that = $(this), 1929 | selector = this.selector || '', 1930 | run = function(e) { 1931 | var what = $(this).blur(), idx = index, relType, relVal; 1932 | 1933 | if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !what.is('.fancybox-wrap')) { 1934 | relType = options.groupAttr || 'data-fancybox-group'; 1935 | relVal = what.attr(relType); 1936 | 1937 | if (!relVal) { 1938 | relType = 'rel'; 1939 | relVal = what.get(0)[ relType ]; 1940 | } 1941 | 1942 | if (relVal && relVal !== '' && relVal !== 'nofollow') { 1943 | what = selector.length ? $(selector) : that; 1944 | what = what.filter('[' + relType + '="' + relVal + '"]'); 1945 | idx = what.index(this); 1946 | } 1947 | 1948 | options.index = idx; 1949 | 1950 | // Stop an event from bubbling if everything is fine 1951 | if (F.open(what, options) !== false) { 1952 | e.preventDefault(); 1953 | } 1954 | } 1955 | }; 1956 | 1957 | options = options || {}; 1958 | index = options.index || 0; 1959 | 1960 | if (!selector || options.live === false) { 1961 | that.unbind('click.fb-start').bind('click.fb-start', run); 1962 | 1963 | } else { 1964 | D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run); 1965 | } 1966 | 1967 | this.filter('[data-fancybox-start=1]').trigger('click'); 1968 | 1969 | return this; 1970 | }; 1971 | 1972 | // Tests that need a body at doc ready 1973 | D.ready(function() { 1974 | var w1, w2; 1975 | 1976 | if ( $.scrollbarWidth === undefined ) { 1977 | // http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth 1978 | $.scrollbarWidth = function() { 1979 | var parent = $('
    ').appendTo('body'), 1980 | child = parent.children(), 1981 | width = child.innerWidth() - child.height( 99 ).innerWidth(); 1982 | 1983 | parent.remove(); 1984 | 1985 | return width; 1986 | }; 1987 | } 1988 | 1989 | if ( $.support.fixedPosition === undefined ) { 1990 | $.support.fixedPosition = (function() { 1991 | var elem = $('
    ').appendTo('body'), 1992 | fixed = ( elem[0].offsetTop === 20 || elem[0].offsetTop === 15 ); 1993 | 1994 | elem.remove(); 1995 | 1996 | return fixed; 1997 | }()); 1998 | } 1999 | 2000 | $.extend(F.defaults, { 2001 | scrollbarWidth : $.scrollbarWidth(), 2002 | fixed : $.support.fixedPosition, 2003 | parent : $('body') 2004 | }); 2005 | 2006 | //Get real width of page scroll-bar 2007 | w1 = $(window).width(); 2008 | 2009 | H.addClass('fancybox-lock-test'); 2010 | 2011 | w2 = $(window).width(); 2012 | 2013 | H.removeClass('fancybox-lock-test'); 2014 | 2015 | $("").appendTo("head"); 2016 | }); 2017 | 2018 | }(window, document, jQuery)); 2019 | -------------------------------------------------------------------------------- /src/assets/jquery.fancybox.min.js: -------------------------------------------------------------------------------- 1 | /*! fancyBox v2.1.7 fancyapps.com | fancyapps.com/fancybox/#license */ 2 | (function(t,J,f,x){var L=f("html"),q=f(t),p=f(J),b=f.fancybox=function(){b.open.apply(this,arguments)},K=navigator.userAgent.match(/msie/i),D=null,u=J.createTouch!==x,v=function(a){return a&&a.hasOwnProperty&&a instanceof f},r=function(a){return a&&"string"===f.type(a)},G=function(a){return r(a)&&0
    ',image:'',iframe:'",error:'

    The requested content cannot be loaded.
    Please try again later.

    ',closeBtn:'',next:'',prev:'',loading:'
    '},openEffect:"fade", 6 | 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:{}, 7 | 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,c){if(a&&(f.isPlainObject(c)||(c={}),!1!==b.close(!0)))return f.isArray(a)||(a=v(a)?f(a).get():[a]),f.each(a,function(d,e){var k={},g,l,h,n,m;"object"===f.type(e)&&(e.nodeType&&(e=f(e)),v(e)?(k={href:e.data("fancybox-href")||e.attr("href"),title:f("
    ").text(e.data("fancybox-title")|| 8 | e.attr("title")||"").html(),isDom:!0,element:e},f.metadata&&f.extend(!0,k,e.metadata())):k=e);g=c.href||k.href||(r(e)?e:null);l=c.title!==x?c.title:k.title||"";n=(h=c.content||k.content)?"html":c.type||k.type;!n&&k.isDom&&(n=e.data("fancybox-type"),n||(n=(n=e.prop("class").match(/fancybox\.(\w+)/))?n[1]:null));r(g)&&(n||(b.isImage(g)?n="image":b.isSWF(g)?n="swf":"#"===g.charAt(0)?n="inline":r(e)&&(n="html",h=e)),"ajax"===n&&(m=g.split(/\s+/,2),g=m.shift(),m=m.shift()));h||("inline"===n?g?h=f(r(g)? 9 | g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(h=e):"html"===n?h=g:n||g||!k.isDom||(n="inline",h=e));f.extend(k,{href:g,type:n,content:h,title:l,selector:m});a[d]=k}),b.opts=f.extend(!0,{},b.defaults,c),c.keys!==x&&(b.opts.keys=c.keys?f.extend({},b.defaults.keys,c.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1===b.trigger("onCancel")||(b.hideLoading(),a&&(b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&& 10 | 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?(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]()):(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut())))},play:function(a){var c=function(){clearTimeout(b.player.timer)}, 11 | d=function(){c();b.current&&b.player.isActive&&(b.player.timer=setTimeout(b.next,b.current.playSpeed))},e=function(){c();p.unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};!0===a||!b.player.isActive&&!1!==a?b.current&&(b.current.loop||b.current.index=e.index?"next":"prev"],b.router=d||"jumpto",e.loop&&(0>a&&(a=e.group.length+a%e.group.length),a%=e.group.length),e.group[a]!==x&&(b.cancel(),b._start(a)))},reposition:function(a,c){var d=b.current,e=d?d.wrap:null,k;e&&(k=b._getPosition(c),a&&"scroll"===a.type?(delete k.position,e.stop(!0,!0).animate(k,200)):(e.css(k), 13 | d.pos=f.extend({},d.dim,k)))},update:function(a){var c=a&&a.originalEvent&&a.originalEvent.type,d=!c||"orientationchange"===c;d&&(clearTimeout(D),D=null);b.isOpen&&!D&&(D=setTimeout(function(){var e=b.current;e&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(d||"load"===c||"resize"===c&&e.autoResize)&&b._setDimension(),"scroll"===c&&e.canShrink||b.reposition(a),b.trigger("onUpdate"),D=null)},d&&!u?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView, 14 | u&&(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,c;b.hideLoading();a=f(b.opts.tpl.loading).click(b.cancel).appendTo("body");p.bind("keydown.loading",function(a){27===(a.which||a.keyCode)&&(a.preventDefault(),b.cancel())});b.defaults.fixed||(c=b.getViewport(),a.css({position:"absolute",top:.5*c.h+c.y,left:.5*c.w+c.x}));b.trigger("onLoading")},getViewport:function(){var a= 15 | b.current&&b.current.locked||!1,c={x:q.scrollLeft(),y:q.scrollTop()};a&&a.length?(c.w=a[0].clientWidth,c.h=a[0].clientHeight):(c.w=u&&t.innerWidth?t.innerWidth:q.width(),c.h=u&&t.innerHeight?t.innerHeight:q.height());return c},unbindEvents:function(){b.wrap&&v(b.wrap)&&b.wrap.unbind(".fb");p.unbind(".fb");q.unbind(".fb")},bindEvents:function(){var a=b.current,c;a&&(q.bind("orientationchange.fb"+(u?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(c=a.keys)&&p.bind("keydown.fb", 16 | function(d){var e=d.which||d.keyCode,k=d.target||d.srcElement;if(27===e&&b.coming)return!1;d.ctrlKey||d.altKey||d.shiftKey||d.metaKey||k&&(k.type||f(k).is("[contenteditable]"))||f.each(c,function(c,k){if(1h.clientWidth||h.clientHeight&&h.scrollHeight>h.clientHeight),d=f(d).parent();0!==e&&!h&&1g||0>k)&&b.next(0>g?"up":"right"),c.preventDefault())}))},trigger:function(a,c){var d,e=c||b.coming||b.current;if(e){f.isFunction(e[a])&&(d=e[a].apply(e,Array.prototype.slice.call(arguments,1)));if(!1===d)return!1;e.helpers&&f.each(e.helpers,function(c, 18 | d){if(d&&b.helpers[c]&&f.isFunction(b.helpers[c][a]))b.helpers[c][a](f.extend(!0,{},b.helpers[c].defaults,d),e)})}p.trigger(a)},isImage:function(a){return r(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i)},isSWF:function(a){return r(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var c={},d,e;a=m(a);d=b.group[a]||null;if(!d)return!1;c=f.extend(!0,{},b.opts,d);d=c.margin;e=c.padding;"number"===f.type(d)&&(c.margin=[d,d,d,d]);"number"===f.type(e)&&(c.padding= 19 | [e,e,e,e]);c.modal&&f.extend(!0,c,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});c.autoSize&&(c.autoWidth=c.autoHeight=!0);"auto"===c.width&&(c.autoWidth=!0);"auto"===c.height&&(c.autoHeight=!0);c.group=b.group;c.index=a;b.coming=c;if(!1===b.trigger("beforeLoad"))b.coming=null;else{e=c.type;d=c.href;if(!e)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"=== 20 | e||"swf"===e)c.autoHeight=c.autoWidth=!1,c.scrolling="visible";"image"===e&&(c.aspectRatio=!0);"iframe"===e&&u&&(c.scrolling="scroll");c.wrap=f(c.tpl.wrap).addClass("fancybox-"+(u?"mobile":"desktop")+" fancybox-type-"+e+" fancybox-tmp "+c.wrapCSS).appendTo(c.parent||"body");f.extend(c,{skin:f(".fancybox-skin",c.wrap),outer:f(".fancybox-outer",c.wrap),inner:f(".fancybox-inner",c.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){c.skin.css("padding"+b,y(c.padding[a]))});b.trigger("onReady"); 21 | if("inline"===e||"html"===e){if(!c.content||!c.content.length)return b._error("content")}else if(!d)return b._error("href");"image"===e?b._loadImage():"ajax"===e?b._loadAjax():"iframe"===e?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= 22 | 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,d){b.coming&&"abort"!==d?b._error("ajax",a):b.hideLoading()},success:function(c,d){"success"===d&&(a.content=c,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming, 23 | c=f(a.tpl.iframe.replace(/\{rnd\}/g,(new Date).getTime())).attr("scrolling",u?"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(d){}});a.iframe.preload&&(b.showLoading(),c.one("load",function(){f(this).data("ready",1);u||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=c.appendTo(a.inner);a.iframe.preload|| 24 | b._afterLoad()},_preloadImages:function(){var a=b.group,c=b.current,d=a.length,e=c.preload?Math.min(c.preload,d-1):0,f,g;for(g=1;g<=e;g+=1)f=a[(c.index+g)%d],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,c=b.current,d,e,k,g,l;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,c))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{c&&(b.trigger("beforeChange",c),c.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove()); 25 | b.unbindEvents();d=a.content;e=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,outer:a.outer,inner:a.inner,current:a,previous:c});g=a.href;switch(e){case "inline":case "ajax":case "html":a.selector?d=f("
    ").html(d).find(a.selector):v(d)&&(d.data("fancybox-placeholder")||d.data("fancybox-placeholder",f('
    ').insertAfter(d).hide()),d=d.show().detach(),a.wrap.bind("onReset",function(){f(this).find(d).length&&d.hide().replaceAll(d.data("fancybox-placeholder")).data("fancybox-placeholder", 26 | !1)}));break;case "image":d=a.tpl.image.replace(/\{href\}/g,g);break;case "swf":d='',l="",f.each(a.swf,function(a,b){d+='';l+=" "+a+'="'+b+'"'}),d+='"}v(d)&&d.parent().is(a.inner)||a.inner.append(d);b.trigger("beforeShow"); 27 | 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)f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();else if(c.prevMethod)b.transitions[c.prevMethod]();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),c=0,d,e=b.wrap,k=b.skin,g=b.inner,l=b.current;d=l.width;var h=l.height,n=l.minWidth,w=l.minHeight,p=l.maxWidth, 28 | q=l.maxHeight,u=l.scrolling,r=l.scrollOutside?l.scrollbarWidth:0,z=l.margin,A=m(z[1]+z[3]),t=m(z[0]+z[2]),x,B,v,E,C,H,D,F,I;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");z=m(k.outerWidth(!0)-k.width());x=m(k.outerHeight(!0)-k.height());B=A+z;v=t+x;E=G(d)?(a.w-B)*m(d)/100:d;C=G(h)?(a.h-v)*m(h)/100:h;if("iframe"===l.type){if(I=l.content,l.autoHeight&&I&&1===I.data("ready"))try{I[0].contentWindow.document.location&&(g.width(E).height(9999),H=I.contents().find("body"),r&&H.css("overflow-x", 29 | "hidden"),C=H.outerHeight(!0))}catch(M){}}else if(l.autoWidth||l.autoHeight)g.addClass("fancybox-tmp"),l.autoWidth||g.width(E),l.autoHeight||g.height(C),l.autoWidth&&(E=g.width()),l.autoHeight&&(C=g.height()),g.removeClass("fancybox-tmp");d=m(E);h=m(C);F=E/C;n=m(G(n)?m(n,"w")-B:n);p=m(G(p)?m(p,"w")-B:p);w=m(G(w)?m(w,"h")-v:w);q=m(G(q)?m(q,"h")-v:q);H=p;D=q;l.fitToView&&(p=Math.min(a.w-B,p),q=Math.min(a.h-v,q));B=a.w-A;t=a.h-t;l.aspectRatio?(d>p&&(d=p,h=m(d/F)),h>q&&(h=q,d=m(h*F)),dB||A>t)&&d>n&&h>w&&!(19p&&(d=p,h=m(d/F)),g.width(d).height(h),e.width(d+z),a=e.width(),A=e.height();else d=Math.max(n,Math.min(d,d-(a-B))),h=Math.max(w,Math.min(h,h-(A-t)));r&&"auto"===u&&hB||A>t)&&d>n&&h>w;d=l.aspectRatio?dw&&h
    ').appendTo(c&&c.length?c:"body");this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var c=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(q.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&& 40 | this.overlay.bind("click.overlay",function(a){if(f(a.target).hasClass("fancybox-overlay"))return b.isActive?b.close():c.close(),!1});this.overlay.css(a.css).show()},close:function(){q.unbind("resize.overlay");this.el.hasClass("fancybox-lock")&&(f(".fancybox-margin").removeClass("fancybox-margin"),this.el.removeClass("fancybox-lock"),q.scrollTop(this.scrollV).scrollLeft(this.scrollH));f(".fancybox-overlay").remove().hide();f.extend(this,{overlay:null,fixed:!1})},update:function(){var a="100%",b;this.overlay.width(a).height("100%"); 41 | K?(b=Math.max(J.documentElement.offsetWidth,J.body.offsetWidth),p.width()>b&&(a=p.width())):p.width()>q.width()&&(a=p.width());this.overlay.width(a).height(p.height())},onReady:function(a,b){var d=this.overlay;f(".fancybox-overlay").stop(!0,!0);d||this.create(a);a.locked&&this.fixed&&b.fixed&&(b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){b.locked&&!this.el.hasClass("fancybox-lock")&&(!1!==this.fixPosition&&f("*:not(object)").filter(function(){return"fixed"=== 42 | f(this).css("position")&&!f(this).hasClass("fancybox-overlay")&&!f(this).hasClass("fancybox-wrap")}).addClass("fancybox-margin"),this.el.addClass("fancybox-margin"),this.scrollV=q.scrollTop(),this.scrollH=q.scrollLeft(),this.el.addClass("fancybox-lock"),q.scrollTop(this.scrollV).scrollLeft(this.scrollH));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", 43 | position:"bottom"},beforeShow:function(a){var c=b.current,d=c.title,e=a.type;f.isFunction(d)&&(d=d.call(c.element,c));if(r(d)&&""!==f.trim(d)){c=f('
    '+d+"
    ");switch(e){case "inside":e=b.skin;break;case "outside":e=b.wrap;break;case "over":e=b.inner;break;default:e=b.skin,c.appendTo("body"),K&&c.width(c.width()),c.wrapInner(''),b.current.margin[2]+=Math.abs(m(c.css("margin-bottom")))}c["top"===a.position?"prependTo": 44 | "appendTo"](e)}}};f.fn.fancybox=function(a){var c,d=f(this),e=this.selector||"",k=function(g){var l=f(this).blur(),h=c,k,m;g.ctrlKey||g.altKey||g.shiftKey||g.metaKey||l.is(".fancybox-wrap")||(k=a.groupAttr||"data-fancybox-group",m=l.attr(k),m||(k="rel",m=l.get(0)[k]),m&&""!==m&&"nofollow"!==m&&(l=e.length?f(e):d,l=l.filter("["+k+'="'+m+'"]'),h=l.index(this)),a.index=h,!1!==b.open(l,a)&&g.preventDefault())};a=a||{};c=a.index||0;e&&!1!==a.live?p.undelegate(e,"click.fb-start").delegate(e+":not('.fancybox-item, .fancybox-nav')", 45 | "click.fb-start",k):d.unbind("click.fb-start").bind("click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};p.ready(function(){var a,c;f.scrollbarWidth===x&&(f.scrollbarWidth=function(){var a=f('
    ').appendTo("body"),b=a.children(),b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});f.support.fixedPosition===x&&(f.support.fixedPosition=function(){var a=f('
    ').appendTo("body"), 46 | b=20===a[0].offsetTop||15===a[0].offsetTop;a.remove();return b}());f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")});a=f(t).width();L.addClass("fancybox-lock-test");c=f(t).width();L.removeClass("fancybox-lock-test");f("").appendTo("head")})})(window,document,jQuery); 47 | --------------------------------------------------------------------------------