1var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; }; 2if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } } 3{ 4 let window = _____WB$wombat$assign$function_____("window"); 5 let self = _____WB$wombat$assign$function_____("self"); 6 let document = _____WB$wombat$assign$function_____("document"); 7 let location = _____WB$wombat$assign$function_____("location"); 8 let top = _____WB$wombat$assign$function_____("top"); 9 let parent = _____WB$wombat$assign$function_____("parent"); 10 let frames = _____WB$wombat$assign$function_____("frames"); 11 let opener = _____WB$wombat$assign$function_____("opener"); 12 13/*! 14 * fancyBox - jQuery Plugin 15 * version: 2.0.6 (16/04/2012) 16 * @requires jQuery v1.6 or later 17 * 18 * Examples at http://fancyapps.com/fancybox/ 19 * License: www.fancyapps.com/fancybox/#license 20 * 21 * Copyright 2012 Janis Skarnelis - [email protected] 22 * 23 */ 24(function (window, document, $, undefined) { 25 "use strict"; 26 var W = $(window), 27 D = $(document), 28 F = $.fancybox = function () { 29 F.open.apply( this, arguments ); 30 }, 31 didResize = false, 32 resizeTimer = null, 33 isTouch = document.createTouch !== undefined, 34 isString = function(str) { 35 return $.type(str) === "string"; 36 }, 37 isPercentage = function(str) { 38 return isString(str) && str.indexOf('%') > 0; 39 }, 40 getValue = function(value, dim) { 41 if (dim && isPercentage(value)) { 42 value = F.getViewport()[ dim ] / 100 * parseInt(value, 10); 43 } 44 return Math.round(value) + 'px'; 45 }; 46 $.extend(F, { 47 // The current version of fancyBox 48 version: '2.0.5', 49 defaults: { 50 padding: 15, 51 margin: 20, 52 width: 800, 53 height: 600, 54 minWidth: 100, 55 minHeight: 100, 56 maxWidth: 9999, 57 maxHeight: 9999, 58 autoSize: true, 59 autoResize: !isTouch, 60 autoCenter : !isTouch, 61 fitToView: true, 62 aspectRatio: false, 63 topRatio: 0.5, 64 fixed: false, 65 scrolling: 'auto', // 'auto', 'yes' or 'no' 66 wrapCSS: '', 67 arrows: true, 68 closeBtn: true, 69 closeClick: false, 70 nextClick : false, 71 mouseWheel: true, 72 autoPlay: false, 73 playSpeed: 3000, 74 preload : 3, 75 modal: false, 76 loop: true, 77 ajax: { dataType: 'html', headers: { 'X-fancyBox': true } }, 78 keys: { 79 next: [13, 32, 34, 39, 40], // enter, space, page down, right arrow, down arrow 80 prev: [8, 33, 37, 38], // backspace, page up, left arrow, up arrow 81 close: [27] // escape key 82 }, 83 // Override some properties 84 index: 0, 85 type: null, 86 href: null, 87 content: null, 88 title: null, 89 // HTML templates 90 tpl: { 91 wrap: '<div class="fancybox-wrap"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>', 92 image: '<img class="fancybox-image" src="{href}" alt="" />', 93 iframe: '<iframe class="fancybox-iframe" name="fancybox-frame{rnd}" frameborder="0" hspace="0"' + ($.browser.msie ? ' allowtransparency="true"' : '') + '></iframe>', 94 swf: '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="wmode" value="transparent" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{href}" /><embed src="{href}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="100%" height="100%" wmode="transparent"></embed></object>', 95 error: '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>', 96 closeBtn: '<div title="Close" class="fancybox-item fancybox-close"></div>', 97 next: '<a title="Next" class="fancybox-nav fancybox-next"><span></span></a>', 98 prev: '<a title="Previous" class="fancybox-nav fancybox-prev"><span></span></a>' 99 }, 100 // Properties for each animation type 101 // Opening fancyBox 102 openEffect: 'fade', // 'elastic', 'fade' or 'none' 103 openSpeed: 300, 104 openEasing: 'swing', 105 openOpacity: true, 106 openMethod: 'zoomIn', 107 // Closing fancyBox 108 closeEffect: 'fade', // 'elastic', 'fade' or 'none' 109 closeSpeed: 300, 110 closeEasing: 'swing', 111 closeOpacity: true, 112 closeMethod: 'zoomOut', 113 // Changing next gallery item 114 nextEffect: 'elastic', // 'elastic', 'fade' or 'none' 115 nextSpeed: 300, 116 nextEasing: 'swing', 117 nextMethod: 'changeIn', 118 // Changing previous gallery item 119 prevEffect: 'elastic', // 'elastic', 'fade' or 'none' 120 prevSpeed: 300, 121 prevEasing: 'swing', 122 prevMethod: 'changeOut', 123 // Enabled helpers 124 helpers: { 125 overlay: { 126 speedIn: 0, 127 speedOut: 300, 128 opacity: 0.8, 129 css: { 130 cursor: 'pointer' 131 }, 132 closeClick: true 133 }, 134 title: { 135 type: 'float' // 'float', 'inside', 'outside' or 'over' 136 } 137 }, 138 // Callbacks 139 onCancel: $.noop, // If canceling 140 beforeLoad: $.noop, // Before loading 141 afterLoad: $.noop, // After loading 142 beforeShow: $.noop, // Before changing in current item 143 afterShow: $.noop, // After opening 144 beforeClose: $.noop, // Before closing 145 afterClose: $.noop // After closing 146 }, 147 //Current state 148 group: {}, // Selected group 149 opts: {}, // Group options 150 coming: null, // Element being loaded 151 current: null, // Currently loaded element 152 isOpen: false, // Is currently open 153 isOpened: false, // Have been fully opened at least once 154 wrap: null, 155 skin: null, 156 outer: null, 157 inner: null, 158 player: { 159 timer: null, 160 isActive: false 161 }, 162 // Loaders
163 ajaxLoad: null, 164 imgPreload: null, 165 // Some collections 166 transitions: {}, 167 helpers: {}, 168 /* 169 * Static methods 170 */ 171 open: function (group, opts) { 172 //Kill existing instances 173 F.close(true); 174 //Normalize group 175 if (group && !$.isArray(group)) { 176 group = group instanceof $ ? $(group).get() : [group]; 177 } 178 F.isActive = true; 179 //Extend the defaults 180 F.opts = $.extend(true, {}, F.defaults, opts); 181 //All options are merged recursive except keys 182 if ($.isPlainObject(opts) && opts.keys !== undefined) { 183 F.opts.keys = opts.keys ? $.extend({}, F.defaults.keys, opts.keys) : false; 184 } 185 F.group = group; 186 F._start(F.opts.index || 0); 187 }, 188 cancel: function () { 189 if (F.coming && false === F.trigger('onCancel')) { 190 return; 191 } 192 F.coming = null; 193 F.hideLoading(); 194 if (F.ajaxLoad) { 195 F.ajaxLoad.abort(); 196 } 197 F.ajaxLoad = null; 198 if (F.imgPreload) { 199 F.imgPreload.onload = F.imgPreload.onabort = F.imgPreload.onerror = null; 200 } 201 }, 202 close: function (a) { 203 F.cancel(); 204 if (!F.current || false === F.trigger('beforeClose')) { 205 return; 206 } 207 F.unbindEvents(); 208 //If forced or is still opening then remove immediately 209 if (!F.isOpen || (a && a[0] === true)) { 210 $('.fancybox-wrap').stop().trigger('onReset').remove(); 211 F._afterZoomOut(); 212 } else { 213 F.isOpen = F.isOpened = false; 214 $('.fancybox-item, .fancybox-nav').remove(); 215 F.wrap.stop(true).removeClass('fancybox-opened'); 216 F.inner.css('overflow', 'hidden'); 217 F.transitions[F.current.closeMethod](); 218 } 219 }, 220 // Start/stop slideshow 221 play: function (a) { 222 var clear = function () { 223 clearTimeout(F.player.timer); 224 }, 225 set = function () { 226 clear(); 227 if (F.current && F.player.isActive) { 228 F.player.timer = setTimeout(F.next, F.current.playSpeed); 229 } 230 }, 231 stop = function () { 232 clear(); 233 $('body').unbind('.player'); 234 F.player.isActive = false; 235 F.trigger('onPlayEnd'); 236 }, 237 start = function () { 238 if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) { 239 F.player.isActive = true; 240 $('body').bind({ 241 'afterShow.player onUpdate.player': set, 242 'onCancel.player beforeClose.player': stop, 243 'beforeLoad.player': clear 244 }); 245 set(); 246 F.trigger('onPlayStart'); 247 } 248 }; 249 if (F.player.isActive || (a && a[0] === false)) { 250 stop(); 251 } else { 252 start(); 253 } 254 }, 255 next: function () { 256 if (F.current) { 257 F.jumpto(F.current.index + 1); 258 } 259 }, 260 prev: function () { 261 if (F.current) { 262 F.jumpto(F.current.index - 1); 263 } 264 }, 265 jumpto: function (index) { 266 if (!F.current) { 267 return; 268 } 269 index = parseInt(index, 10); 270 if (F.group.length > 1 && F.current.loop) { 271 if (index >= F.group.length) { 272 index = 0; 273 } else if (index < 0) { 274 index = F.group.length - 1; 275 } 276 } 277 if (F.group[index] !== undefined) { 278 F.cancel(); 279 F._start(index); 280 } 281 }, 282 reposition: function (e, onlyAbsolute) { 283 var pos; 284 if (F.isOpen) { 285 pos = F._getPosition(onlyAbsolute); 286 if (e && e.type === 'scroll') { 287 delete pos.position; 288 F.wrap.stop(true, true).animate(pos, 200); 289 } else { 290 F.wrap.css(pos); 291 } 292 } 293 }, 294 update: function (e) { 295 if (!F.isOpen) { 296 return; 297 } 298 // Run this code after a delay for better performance 299 if (!didResize) { 300 resizeTimer = setTimeout(function () { 301 var current = F.current, anyway = !e || (e && e.type === 'orientationchange'); 302 if (didResize) { 303 didResize = false; 304 if (!current) { 305 return; 306 } 307 if ((!e || e.type !== 'scroll') || anyway) { 308 if (current.autoSize && current.type !== 'iframe') { 309 F.inner.height('auto'); 310 current.height = F.inner.height(); 311 } 312 if (current.autoResize || anyway) { 313 F._setDimension(); 314 } 315 if (current.canGrow && current.type !== 'iframe') { 316 F.inner.height('auto'); 317 } 318 } 319 if (current.autoCenter || anyway) { 320 F.reposition(e); 321 } 322 F.trigger('onUpdate'); 323 } 324 }, 200); 325 } 326 didResize = true; 327 }, 328 toggle: function () { 329 if (F.isOpen) { 330 F.current.fitToView = !F.current.fitToView; 331 F.update(); 332 } 333 }, 334 hideLoading: function () { 335 D.unbind('keypress.fb'); 336 $('#fancybox-loading').remove(); 337 }, 338 showLoading: function () { 339 F.hideLoading(); 340 //If user will press the escape-button, the request will be canceled 341 D.bind('keypress.fb', function(e) { 342 if (e.keyCode === 27) { 343 e.preventDefault(); 344 F.cancel(); 345 } 346 }); 347 $('<div id="fancybox-loading"><div></div></div>').click(F.cancel).appendTo('body'); 348 }, 349 getViewport: function () { 350 // See http://bugs.jquery.com/ticket/6724 351 return { 352 x: W.scrollLeft(), 353 y: W.scrollTop(), 354 w: isTouch && window.innerWidth ? window.innerWidth : W.width(), 355 h: isTouch && window.innerHeight ? window.innerHeight : W.he
355ight() 356 }; 357 }, 358 // Unbind the keyboard / clicking actions 359 unbindEvents: function () { 360 if (F.wrap) { 361 F.wrap.unbind('.fb'); 362 } 363 D.unbind('.fb'); 364 W.unbind('.fb'); 365 }, 366 bindEvents: function () { 367 var current = F.current, 368 keys = current.keys; 369 if (!current) { 370 return; 371 } 372 W.bind('resize.fb orientationchange.fb' + (current.autoCenter && !current.fixed ? ' scroll.fb' : ''), F.update); 373 if (keys) { 374 D.bind('keydown.fb', function (e) { 375 var code, target = e.target || e.srcElement; 376 // Ignore key combinations and key events within form elements 377 if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && !(target && (target.type || $(target).is('[contenteditable]')))) { 378 code = e.keyCode; 379 if ($.inArray(code, keys.close) > -1) { 380 F.close(); 381 e.preventDefault(); 382 } else if ($.inArray(code, keys.next) > -1) { 383 F.next(); 384 e.preventDefault(); 385 } else if ($.inArray(code, keys.prev) > -1) { 386 F.prev(); 387 e.preventDefault(); 388 } 389 } 390 }); 391 } 392 if ($.fn.mousewheel && current.mouseWheel && F.group.length > 1) { 393 F.wrap.bind('mousewheel.fb', function (e, delta) { 394 var target = e.target || null; 395 if (delta !== 0 && (!target || target.clientHeight === 0 || (target.scrollHeight === target.clientHeight && target.scrollWidth === target.clientWidth))) { 396 e.preventDefault(); 397 F[delta > 0 ? 'prev' : 'next'](); 398 } 399 }); 400 } 401 }, 402 trigger: function (event, o) { 403 var ret, obj = o || F[ $.inArray(event, ['onCancel', 'beforeLoad', 'afterLoad']) > -1 ? 'coming' : 'current' ]; 404 if (!obj) { 405 return; 406 } 407 if ($.isFunction( obj[event] )) { 408 ret = obj[event].apply(obj, Array.prototype.slice.call(arguments, 1)); 409 } 410 if (ret === false) { 411 return false; 412 } 413 if (obj.helpers) { 414 $.each(obj.helpers, function (helper, opts) { 415 if (opts && $.isPlainObject(F.helpers[helper]) && $.isFunction(F.helpers[helper][event])) { 416 F.helpers[helper][event](opts, obj); 417 } 418 }); 419 } 420 $.event.trigger(event + '.fb'); 421 }, 422 isImage: function (str) { 423 return isString(str) && str.match(/\.(jpe?g|gif|png|bmp)((\?|#).*)?$/i); 424 }, 425 isSWF: function (str) { 426 return isString(str) && str.match(/\.(swf)((\?|#).*)?$/i); 427 }, 428 _start: function (index) { 429 var coming = {}, 430 element = F.group[index] || null, 431 isDom, 432 href, 433 type, 434 rez, 435 hrefParts; 436 if (element && (element.nodeType || element instanceof $)) { 437 isDom = true; 438 if ($.metadata) { 439 coming = $(element).metadata(); 440 } 441 } 442 coming = $.extend(true, {}, F.opts, {index : index, element : element}, ($.isPlainObject(element) ? element : coming)); 443 // Re-check overridable options 444 $.each(['href', 'title', 'content', 'type'], function(i,v) { 445 coming[v] = F.opts[ v ] || (isDom && $(element).attr( v )) || coming[ v ] || null; 446 }); 447 // Convert margin property to array - top, right, bottom, left 448 if (typeof coming.margin === 'number') { 449 coming.margin = [coming.margin, coming.margin, coming.margin, coming.margin]; 450 } 451 // 'modal' propery is just a shortcut 452 if (coming.modal) { 453 $.extend(true, coming, { 454 closeBtn : false, 455 closeClick: false, 456 nextClick : false, 457 arrows : false, 458 mouseWheel : false, 459 keys : null, 460 helpers: { 461 overlay : { 462 css: { 463 cursor : 'auto' 464 }, 465 closeClick : false 466 } 467 } 468 }); 469 } 470 //Give a chance for callback or helpers to update coming item (type, title, etc) 471 F.coming = coming; 472 if (false === F.trigger('beforeLoad')) { 473 F.coming = null; 474 return; 475 } 476 type = coming.type; 477 href = coming.href || element; 478 ///http://check if content type is set, if not, try to get 479 if (!type) { 480 if (isDom) { 481 type = $(element).data('fancybox-type'); 482 if (!type) { 483 rez = element.className.match(/fancybox\.(\w+)/); 484 type = rez ? rez[1] : null; 485 } 486 } 487 if (!type && isString(href)) { 488 if (F.isImage(href)) { 489 type = 'image'; 490 } else if (F.isSWF(href)) { 491 type = 'swf'; 492 } else if (href.match(/^#/)) { 493 type = 'inline'; 494 } 495 } 496 // ...if not - display element itself 497 if (!type) { 498 type = isDom ? 'inline' : 'html'; 499 } 500 coming.type = type; 501 } 502 // Check before try to load; 'inline' and 'html' types need content, others - href 503 if (type === 'inline' || type === 'html') { 504 if (!coming.content) { 505 if (type === 'inline') { 506 coming.content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7 507 } else { 508 coming.content = element; 509 } 510 } 511 if (!coming.content || !coming.content.length) { 512 type = null; 513 } 514 } else if (!href) { 515 type = null; 516 } 517 /* 518 * Add reference to the group, so it`s possible to access from callbacks, example: 519 * afterLoad : function() { 520 * this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : ''); 521 * } 522 */ 523 if (type === 'ajax' && isString(href)) { 524 hrefParts = href.split(/\s+/, 2); 525 href = hrefParts.shift(); 526 coming.selector = hrefParts.shift(); 527 } 528 coming.href = href; 529 coming.group = F.group; 530 coming.isDom = isDom; 531 switch (type) { 532 case 'image': 533 F._loadImage(); 534 break; 535 case 'ajax': 536 F._loadAjax(); 537 break; 538 case 'inline': 539 case 'iframe': 540 case 'swf': 541 case 'html': 542 F._afterLoad(); 543 break; 544 default: 545 F._error( 'type' ); 546 } 547 }, 548 _error: function ( type ) { 549 F.hideLoading(); 550 $.extend(F.coming, { 551 type : 'html', 552 autoSize : true, 553 minWidth : 0, 554 minHeight : 0, 555 padding : 15, 556 hasError : type, 557 content : F.coming.tpl.error 558 }); 559 F._afterLoad(); 560 }, 561 _loadImage: function () { 562 // Reset preload image so it is later possible to check "complete" property 563 var img = F.imgPreload = new Image(); 564 img.onload = function () { 565 this.onload = this.onerror = null; 566 F.coming.width = this.width; 567 F.coming.height = this.height; 568 F._afterLoad(); 569 }; 570 img.onerror = function () { 571 this.onload = this.onerror = null; 572 F._error( 'image' ); 573 }; 574 img.src = F.coming.href; 575 if (img.complete === undefined || !img.complete) { 576 F.showLoading(); 577 } 578 }, 579 _loadAjax: function () { 580 F.showLoading(); 581 F.ajaxLoad = $.ajax($.extend({}, F.coming.ajax, { 582 url: F.coming.href, 583 error: function (jqXHR, textStatus) { 584 if (F.coming && textStatus !== 'abort') { 585 F._error( 'ajax', jqXHR ); 586 } else { 587 F.hideLoading(); 588 } 589 }, 590 success: function (data, textStatus) { 591 if (textStatus === 'success') { 592 F.coming.content = data; 593 F._afterLoad(); 594 } 595 } 596 })); 597 }, 598 _preloadImages: function() { 599 var group = F.group, 600 current = F.current, 601 len = group.length, 602 item, 603 href, 604 i, 605 cnt = Math.min(current.preload, len - 1); 606 if (!current.preload || group.length < 2) { 607 return; 608 } 609 for (i = 1; i <= cnt; i += 1) { 610 item = group[ (current.index + i ) % len ]; 611 href = item.href || $( item ).attr('href') || item; 612 if (item.type === 'image' || F.isImage(href)) { 613 new Image().src = href; 614 } 615 } 616 }, 617 _afterLoad: function () { 618 F.hideLoading(); 619 if (!F.coming || false === F.trigger('afterLoad', F.current)) { 620 F.coming = false;
621 return; 622 } 623 if (F.isOpened) { 624 $('.fancybox-item, .fancybox-nav').remove(); 625 F.wrap.stop(true).removeClass('fancybox-opened'); 626 F.inner.css('overflow', 'hidden'); 627 F.transitions[F.current.prevMethod](); 628 } else { 629 $('.fancybox-wrap').stop().trigger('onReset').remove(); 630 F.trigger('afterClose'); 631 } 632 F.unbindEvents(); 633 F.isOpen = false; 634 F.current = F.coming; 635 //Build the neccessary markup 636 F.wrap = $(F.current.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-type-' + F.current.type + ' fancybox-tmp ' + F.current.wrapCSS).appendTo('body'); 637 F.skin = $('.fancybox-skin', F.wrap).css('padding', getValue(F.current.padding)); 638 F.outer = $('.fancybox-outer', F.wrap); 639 F.inner = $('.fancybox-inner', F.wrap); 640 F._setContent(); 641 }, 642 _setContent: function () { 643 var current = F.current, 644 content = current.content, 645 type = current.type, 646 minWidth = current.minWidth, 647 minHeight = current.minHeight, 648 maxWidth = current.maxWidth, 649 maxHeight = current.maxHeight, 650 loadingBay; 651 switch (type) { 652 case 'inline': 653 case 'ajax': 654 case 'html': 655 if (current.selector) { 656 content = $('<div>').html(content).find(current.selector); 657 } else if (content instanceof $) { 658 if (content.parent().hasClass('fancybox-inner')) { 659 content.parents('.fancybox-wrap').unbind('onReset'); 660 } 661 content = content.show().detach(); 662 $(F.wrap).bind('onReset', function () { 663 content.appendTo('body').hide(); 664 }); 665 } 666 if (current.autoSize) { 667 loadingBay = $('<div class="fancybox-wrap ' + F.current.wrapCSS + ' fancybox-tmp"></div>') 668 .appendTo('body') 669 .css({ 670 minWidth : getValue(minWidth, 'w'), 671 minHeight : getValue(minHeight, 'h'), 672 maxWidth : getValue(maxWidth, 'w'), 673 maxHeight : getValue(maxHeight, 'h') 674 }) 675 .append(content); 676 current.width = loadingBay.width(); 677 current.height = loadingBay.height(); 678 // Re-check to fix 1px bug in some browsers 679 loadingBay.width( F.current.width ); 680 if (loadingBay.height() > current.height) { 681 loadingBay.width(current.width + 1); 682 current.width = loadingBay.width(); 683 current.height = loadingBay.height(); 684 } 685 content = loadingBay.contents().detach(); 686 loadingBay.remove(); 687 } 688 break; 689 case 'image': 690 content = current.tpl.image.replace('{href}', current.href); 691 current.aspectRatio = true; 692 break; 693 case 'swf': 694 content = current.tpl.swf.replace(/\{width\}/g, current.width).replace(/\{height\}/g, current.height).replace(/\{href\}/g, current.href); 695 break; 696 case 'iframe': 697 content = $(current.tpl.iframe.replace('{rnd}', new Date().getTime()) ) 698 .attr('scrolling', current.scrolling) 699 .attr('src', current.href); 700 current.scrolling = isTouch ? 'scroll' : 'auto'; 701 break; 702 } 703 if (type === 'image' || type === 'swf') { 704 current.autoSize = false; 705 current.scrolling = 'visible'; 706 } 707 if (type === 'iframe' && current.autoSize) { 708 F.showLoading(); 709 F._setDimension(); 710 F.inner.css('overflow', current.scrolling); 711 content.bind({ 712 onCancel : function() { 713 $(this).unbind(); 714 F._afterZoomOut(); 715 }, 716 load : function() { 717 F.hideLoading(); 718 try { 719 if (this.contentWindow.document.location) { 720 F.current.height = $(this).contents().find('body').height(); 721 } 722 } catch (e) { 723 F.current.autoSize = false; 724 } 725 F[ F.isOpen ? '_afterZoomIn' : '_beforeShow'](); 726 } 727 }).appendTo(F.inner); 728 } else { 729 F.inner.append(content); 730 F._beforeShow(); 731 } 732 }, 733 _beforeShow : function() { 734 F.coming = null; 735 //Give a chance for helpers or callbacks to update elements 736 F.trigger('beforeShow'); 737 //Set initial dimensions and hide 738 F._setDimension(); 739 F.wrap.hide().removeClass('fancybox-tmp'); 740 F.bindEvents(); 741 F._preloadImages(); 742 F.transitions[ F.isOpened ? F.current.nextMethod : F.current.openMethod ](); 743 }, 744 _setDimension: function () { 745 var wrap = F.wrap, 746 inner = F.inner, 747 current = F.current, 748 viewport = F.getViewport(), 749 margin = current.margin, 750 padding2 = current.padding * 2, 751 width = current.width, 752 height = current.height, 753 maxWidth = current.maxWidth + padding2, 754 maxHeight = current.maxHeight + padding2, 755 minWidth = current.minWidth + padding2, 756 minHeight = current.minHeight + padding2, 757 ratio, 758 height_; 759 viewport.w -= (margin[1] + margin[3]); 760 viewport.h -= (margin[0] + margin[2]); 761 if (isPercentage(width)) {
762 width = (((viewport.w - padding2) * parseFloat(width)) / 100); 763 } 764 if (isPercentage(height)) { 765 height = (((viewport.h - padding2) * parseFloat(height)) / 100); 766 } 767 ratio = width / height; 768 width += padding2; 769 height += padding2; 770 if (current.fitToView) { 771 maxWidth = Math.min(viewport.w, maxWidth); 772 maxHeight = Math.min(viewport.h, maxHeight); 773 } 774 if (current.aspectRatio) { 775 if (width > maxWidth) { 776 width = maxWidth; 777 height = ((width - padding2) / ratio) + padding2; 778 } 779 if (height > maxHeight) { 780 height = maxHeight; 781 width = ((height - padding2) * ratio) + padding2; 782 } 783 if (width < minWidth) { 784 width = minWidth; 785 height = ((width - padding2) / ratio) + padding2; 786 } 787 if (height < minHeight) { 788 height = minHeight; 789 width = ((height - padding2) * ratio) + padding2; 790 } 791 } else { 792 width = Math.max(minWidth, Math.min(width, maxWidth)); 793 height = Math.max(minHeight, Math.min(height, maxHeight)); 794 } 795 width = Math.round(width); 796 height = Math.round(height); 797 //Reset dimensions 798 $(wrap.add(inner)).width('auto').height('auto'); 799 inner.width(width - padding2).height(height - padding2); 800 wrap.width(width); 801 height_ = wrap.height(); // Real wrap height 802 //Fit wrapper inside 803 if (width > maxWidth || height_ > maxHeight) { 804 while ((width > maxWidth || height_ > maxHeight) && width > minWidth && height_ > minHeight) { 805 height = height - 10; 806 if (current.aspectRatio) { 807 width = Math.round(((height - padding2) * ratio) + padding2); 808 if (width < minWidth) { 809 width = minWidth; 810 height = ((width - padding2) / ratio) + padding2; 811 } 812 } else { 813 width = width - 10; 814 } 815 inner.width(width - padding2).height(height - padding2); 816 wrap.width(width); 817 height_ = wrap.height(); 818 } 819 } 820 current.dim = { 821 width : getValue(width), 822 height : getValue(height_) 823 }; 824 current.canGrow = current.autoSize && height > minHeight && height < maxHeight; 825 current.canShrink = false; 826 current.canExpand = false; 827 if ((width - padding2) < current.width || (height - padding2) < current.height) { 828 current.canExpand = true; 829 } else if ((width > viewport.w || height_ > viewport.h) && width > minWidth && height > minHeight) { 830 current.canShrink = true; 831 } 832 F.innerSpace = height_ - padding2 - inner.height(); 833 }, 834 _getPosition: function (onlyAbsolute) { 835 var current = F.current, 836 viewport = F.getViewport(), 837 margin = current.margin, 838 width = F.wrap.width() + margin[1] + margin[3], 839 height = F.wrap.height() + margin[0] + margin[2], 840 rez = { 841 position: 'absolute', 842 top : margin[0] + viewport.y, 843 left : margin[3] + viewport.x 844 }; 845 if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) { 846 rez = { 847 position: 'fixed', 848 top : margin[0], 849 left : margin[3] 850 }; 851 } 852 rez.top = getValue(Math.max(rez.top, rez.top + ((viewport.h - height) * current.topRatio))); 853 rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width) * 0.5))); 854 return rez; 855 }, 856 _afterZoomIn: function () { 857 var current = F.current, scrolling = current ? current.scrolling : 'no'; 858 if (!current) { 859 return; 860 } 861 F.isOpen = F.isOpened = true; 862 F.wrap.addClass('fancybox-opened'); 863 F.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling)); 864 F.trigger('afterShow'); 865 F.update(); 866 //Assign a click event 867 if (current.closeClick || current.nextClick) { 868 F.inner.css('cursor', 'pointer').bind('click.fb', function(e) { 869 if (!$(e.target).is('a') && !$(e.target).parent().is('a')) { 870 F[ current.closeClick ? 'close' : 'next' ](); 871 } 872 }); 873 } 874 //Create a close button 875 if (current.closeBtn) { 876 $(current.tpl.closeBtn).appendTo(F.skin).bind('click.fb', F.close); 877 } 878 //Create navigation arrows 879 if (current.arrows && F.group.length > 1) { 880 if (current.loop || current.index > 0) { 881 $(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev); 882 } 883 if (current.loop || current.index < F.group.length - 1) { 884 $(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next); 885 } 886 } 887 if (F.opts.autoPlay && !F.player.isActive) { 888 F.opts.autoPlay = false;
889 F.play(); 890 } 891 }, 892 _afterZoomOut: function () { 893 var current = F.current; 894 F.wrap.trigger('onReset').remove(); 895 $.extend(F, { 896 group: {}, 897 opts: {}, 898 current: null, 899 isActive: false, 900 isOpened: false, 901 isOpen: false, 902 wrap: null, 903 skin: null, 904 outer: null, 905 inner: null 906 }); 907 F.trigger('afterClose', current); 908 } 909 }); 910 /* 911 * Default transitions 912 */ 913 F.transitions = { 914 getOrigPosition: function () { 915 var current = F.current, 916 element = current.element, 917 padding = current.padding, 918 orig = $(current.orig), 919 pos = {}, 920 width = 50, 921 height = 50, 922 viewport; 923 if (!orig.length && current.isDom && $(element).is(':visible')) { 924 orig = $(element).find('img:first'); 925 if (!orig.length) { 926 orig = $(element); 927 } 928 } 929 if (orig.length) { 930 pos = orig.offset(); 931 if (orig.is('img')) { 932 width = orig.outerWidth(); 933 height = orig.outerHeight(); 934 } 935 } else { 936 viewport = F.getViewport(); 937 pos.top = viewport.y + (viewport.h - height) * 0.5; 938 pos.left = viewport.x + (viewport.w - width) * 0.5; 939 } 940 pos = { 941 top : getValue(pos.top - padding), 942 left : getValue(pos.left - padding), 943 width : getValue(width + padding * 2), 944 height : getValue(height + padding * 2) 945 }; 946 return pos; 947 }, 948 step: function (now, fx) { 949 var prop = fx.prop, value, ratio; 950 if (prop === 'width' || prop === 'height') { 951 value = Math.ceil(now - (F.current.padding * 2)); 952 if (prop === 'height') { 953 ratio = (now - fx.start) / (fx.end - fx.start); 954 if (fx.start > fx.end) { 955 ratio = 1 - ratio; 956 } 957 value -= F.innerSpace * ratio; 958 } 959 F.inner[prop](value); 960 } 961 }, 962 zoomIn: function () { 963 var wrap = F.wrap, 964 current = F.current, 965 effect = current.openEffect, 966 elastic = effect === 'elastic', 967 dim = current.dim, 968 startPos = $.extend({}, dim, F._getPosition( elastic )), 969 endPos = $.extend({opacity : 1}, startPos); 970 //Remove "position" property that breaks older IE 971 delete endPos.position; 972 if (elastic) { 973 startPos = this.getOrigPosition(); 974 if (current.openOpacity) { 975 startPos.opacity = 0; 976 } 977 F.outer.add(F.inner).width('auto').height('auto'); 978 } else if (effect === 'fade') { 979 startPos.opacity = 0; 980 } 981 wrap.css(startPos) 982 .show() 983 .animate(endPos, { 984 duration : effect === 'none' ? 0 : current.openSpeed, 985 easing : current.openEasing, 986 step : elastic ? this.step : null, 987 complete : F._afterZoomIn 988 }); 989 }, 990 zoomOut: function () { 991 var wrap = F.wrap, 992 current = F.current, 993 effect = current.openEffect, 994 elastic = effect === 'elastic', 995 endPos = {opacity : 0}; 996 if (elastic) { 997 if (wrap.css('position') === 'fixed') { 998 wrap.css(F._getPosition(true)); 999 } 1000 endPos = this.getOrigPosition(); 1001 if (current.closeOpacity) { 1002 endPos.opacity = 0; 1003 } 1004 } 1005 wrap.animate(endPos, { 1006 duration : effect === 'none' ? 0 : current.closeSpeed, 1007 easing : current.closeEasing, 1008 step : elastic ? this.step : null, 1009 complete : F._afterZoomOut 1010 }); 1011 }, 1012 changeIn: function () { 1013 var wrap = F.wrap, 1014 current = F.current, 1015 effect = current.nextEffect, 1016 elastic = effect === 'elastic', 1017 startPos = F._getPosition( elastic ), 1018 endPos = { opacity : 1 }; 1019 startPos.opacity = 0; 1020 if (elastic) { 1021 startPos.top = getValue(parseInt(startPos.top, 10) - 200); 1022 endPos.top = '+=200px'; 1023 } 1024 wrap.css(startPos) 1025 .show() 1026 .animate(endPos, { 1027 duration : effect === 'none' ? 0 : current.nextSpeed, 1028 easing : current.nextEasing, 1029 complete : F._afterZoomIn 1030 }); 1031 }, 1032 changeOut: function () { 1033 var wrap = F.wrap, 1034 current = F.current, 1035 effect = current.prevEffect, 1036 endPos = { opacity : 0 }, 1037 cleanUp = function () { 1038 $(this).trigger('onReset').remove(); 1039 }; 1040 wrap.removeClass('fancybox-opened'); 1041 if (effect === 'elastic') { 1042 endPos.top = '+=200px'; 1043 } 1044 wrap.animate(endPos, { 1045 duration : effect === 'none' ? 0 : current.prevSpeed, 1046 easing : current.prevEasing, 1047 complete : cleanUp 1048 }); 1049 } 1050 }; 1051 /* 1052 * Overlay helper 1053 */
1054 F.helpers.overlay = { 1055 overlay: null, 1056 update: function () { 1057 var width, scrollWidth, offsetWidth; 1058 //Reset width/height so it will not mess 1059 this.overlay.width('100%').height('100%'); 1060 if ($.browser.msie || isTouch) { 1061 scrollWidth = Math.max(document.documentElement.scrollWidth, document.body.scrollWidth); 1062 offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth); 1063 width = scrollWidth < offsetWidth ? W.width() : scrollWidth; 1064 } else { 1065 width = D.width(); 1066 } 1067 this.overlay.width(width).height(D.height()); 1068 }, 1069 beforeShow: function (opts) { 1070 if (this.overlay) { 1071 return; 1072 } 1073 opts = $.extend(true, {}, F.defaults.helpers.overlay, opts); 1074 this.overlay = $('<div id="fancybox-overlay"></div>').css(opts.css).appendTo('body'); 1075 if (opts.closeClick) { 1076 this.overlay.bind('click.fb', F.close); 1077 } 1078 if (F.current.fixed && !isTouch) { 1079 this.overlay.addClass('overlay-fixed'); 1080 } else { 1081 this.update(); 1082 this.onUpdate = function () { 1083 this.update(); 1084 }; 1085 } 1086 this.overlay.fadeTo(opts.speedIn, opts.opacity); 1087 }, 1088 afterClose: function (opts) { 1089 if (this.overlay) { 1090 this.overlay.fadeOut(opts.speedOut || 0, function () { 1091 $(this).remove(); 1092 }); 1093 } 1094 this.overlay = null; 1095 } 1096 }; 1097 /* 1098 * Title helper 1099 */ 1100 F.helpers.title = { 1101 beforeShow: function (opts) { 1102 var title, text = F.current.title; 1103 if (text) { 1104 title = $('<div class="fancybox-title fancybox-title-' + opts.type + '-wrap">' + text + '</div>').appendTo('body'); 1105 if (opts.type === 'float') { 1106 //This helps for some browsers 1107 title.width(title.width()); 1108 title.wrapInner('<span class="child"></span>'); 1109 //Increase bottom margin so this title will also fit into viewport 1110 F.current.margin[2] += Math.abs(parseInt(title.css('margin-bottom'), 10)); 1111 } 1112 title.appendTo(opts.type === 'over' ? F.inner : (opts.type === 'outside' ? F.wrap : F.skin)); 1113 } 1114 } 1115 }; 1116 // jQuery plugin initialization 1117 $.fn.fancybox = function (options) { 1118 var that = $(this), 1119 selector = this.selector || '', 1120 index, 1121 run = function(e) { 1122 var what = this, idx = index, relType, relVal; 1123 if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !$(what).is('.fancybox-wrap')) { 1124 e.preventDefault(); 1125 relType = options.groupAttr || 'data-fancybox-group'; 1126 relVal = $(what).attr(relType); 1127 if (!relVal) { 1128 relType = 'rel'; 1129 relVal = what[ relType ]; 1130 } 1131 if (relVal && relVal !== '' && relVal !== 'nofollow') { 1132 what = selector.length ? $(selector) : that; 1133 what = what.filter('[' + relType + '="' + relVal + '"]'); 1134 idx = what.index(this); 1135 } 1136 options.index = idx; 1137 F.open(what, options); 1138 } 1139 }; 1140 options = options || {}; 1141 index = options.index || 0; 1142 if (selector) { 1143 D.undelegate(selector, 'click.fb-start').delegate(selector, 'click.fb-start', run); 1144 } else { 1145 that.unbind('click.fb-start').bind('click.fb-start', run); 1146 } 1147 return this; 1148 }; 1149 // Test for fixedPosition needs a body at doc ready 1150 $(document).ready(function() { 1151 F.defaults.fixed = $.support.fixedPosition || (!($.browser.msie && $.browser.version <= 6) && !isTouch); 1152 }); 1153}(window, document, jQuery)); 1154 1155}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.