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 9!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(_4ORMAT.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)}})}); 10/*! 11 * fancyBox - jQuery Plugin 12 * version: 2.1.5 (Fri, 14 Jun 2013) 13 * @requires jQuery v1.6 or later 14 * 15 * Examples at http://fancyapps.com/fancybox/ 16 * License: www.fancyapps.com/fancybox/#license 17 * 18 * Copyright 2012 Janis Skarnelis - [email protected] 19 * 20 */ 21 22 23(function (window, document, $, undefined) { 24 "use strict"; 25 26 var H = $("html"), 27 W = $(window), 28 D = $(document), 29 F = $.fancybox = function () { 30 F.open.apply( this, arguments ); 31 }, 32 IE = navigator.userAgent.match(/msie/i), 33 didUpdate = null, 34 isTouch = document.createTouch !== undefined, 35 36 isQuery = function(obj) { 37 return obj && obj.hasOwnProperty && obj instanceof $; 38 }, 39 isString = function(str) { 40 return str && $.type(str) === "string"; 41 }, 42 isPercentage = function(str) { 43 return isString(str) && str.indexOf('%') > 0; 44 }, 45 isScrollable = function(el) { 46 return (el && !(el.style.overflow && el.style.overflow === 'hidden') && ((el.clientWidth && el.scrollWidth > el.clientWidth) || (el.clientHeight && el.scrollHeight > el.clientHeight))); 47 }, 48 getScalar = function(orig, dim) { 49 var value = parseInt(orig, 10) || 0; 50 51 if (dim && isPercentage(orig)) { 52 value = F.getViewport()[ dim ] / 100 * value; 53 } 54 55 return Math.ceil(value); 56 }, 57 getValue = function(value, dim) { 58 return getScalar(value, dim) + 'px'; 59 }; 60 61 $.extend(F, { 62 // The current version of fancyBox 63 version: '2.1.5', 64 65 defaults: { 66 padding : 15, 67 margin : 20, 68 69 width : 800, 70 height : 600, 71 minWidth : 100, 72 minHeight : 100, 73 maxWidth : 9999, 74 maxHeight : 9999,
vendor: 39,142 bytes, lines 75-1699
75 pixelRatio: 1, // Set to 2 for retina display support 76 77 autoSize : true, 78 autoHeight : false, 79 autoWidth : false, 80 81 autoResize : true, 82 autoCenter : !isTouch, 83 fitToView : true, 84 aspectRatio : false, 85 topRatio : 0.5, 86 leftRatio : 0.5, 87 88 scrolling : 'auto', // 'auto', 'yes' or 'no' 89 wrapCSS : '', 90 91 arrows : true, 92 closeBtn : true, 93 closeClick : false, 94 nextClick : false, 95 mouseWheel : true, 96 autoPlay : false, 97 playSpeed : 3000, 98 preload : 3, 99 modal : false, 100 loop : true, 101 102 ajax : { 103 dataType : 'html', 104 headers : { 'X-fancyBox': true } 105 }, 106 iframe : { 107 scrolling : 'auto', 108 preload : true 109 }, 110 swf : { 111 wmode: 'transparent', 112 allowfullscreen : 'true', 113 allowscriptaccess : 'always' 114 }, 115 116 keys : { 117 next : { 118 13 : 'left', // enter 119 34 : 'up', // page down 120 39 : 'left', // right arrow 121 40 : 'up' // down arrow 122 }, 123 prev : { 124 8 : 'right', // backspace 125 33 : 'down', // page up 126 37 : 'right', // left arrow 127 38 : 'down' // up arrow 128 }, 129 close : [27], // escape key 130 play : [32], // space - start/stop slideshow 131 toggle : [70] // letter "f" - toggle fullscreen 132 }, 133 134 direction : { 135 next : 'left', 136 prev : 'right' 137 }, 138 139 scrollOutside : true, 140 141 // Override some properties 142 index : 0, 143 type : null, 144 href : null, 145 content : null, 146 title : null, 147 148 // HTML templates 149 tpl: { 150 wrap : '<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>', 151 image : '<img class="fancybox-image" src="{href}" alt="" />', 152 iframe : '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen' + (IE ? ' allowtransparency="true"' : '') + '></iframe>', 153 error : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>', 154 closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>', 155 next : '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>', 156 prev : '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>' 157 }, 158 159 // Properties for each animation type 160 // Opening fancyBox 161 openEffect : 'fade', // 'elastic', 'fade' or 'none' 162 openSpeed : 250, 163 openEasing : 'swing', 164 openOpacity : true, 165 openMethod : 'zoomIn', 166 167 // Closing fancyBox 168 closeEffect : 'fade', // 'elastic', 'fade' or 'none' 169 closeSpeed : 250, 170 closeEasing : 'swing', 171 closeOpacity : true, 172 closeMethod : 'zoomOut', 173 174 // Changing next gallery item 175 nextEffect : 'elastic', // 'elastic', 'fade' or 'none' 176 nextSpeed : 250, 177 nextEasing : 'swing', 178 nextMethod : 'changeIn', 179 180 // Changing previous gallery item 181 prevEffect : 'elastic', // 'elastic', 'fade' or 'none' 182 prevSpeed : 250, 183 prevEasing : 'swing', 184 prevMethod : 'changeOut', 185 186 // Enable default helpers 187 helpers : { 188 overlay : true, 189 title : true 190 }, 191 192 // Callbacks 193 onCancel : $.noop, // If canceling 194 beforeLoad : $.noop, // Before loading 195 afterLoad : $.noop, // After loading 196 beforeShow : $.noop, // Before changing in current item 197 afterShow : $.noop, // After opening 198 beforeChange : $.noop, // Before changing gallery item 199 beforeClose : $.noop, // Before closing 200 afterClose : $.noop // After closing 201 }, 202 203 //Current state 204 group : {}, // Selected group 205 opts : {}, // Group options 206 previous : null, // Previous element 207 coming : null, // Element being loaded 208 current : null, // Currently loaded element 209 isActive : false, // Is activated 210 isOpen : false, // Is currently open 211 isOpened : false, // Have been fully opened at least once 212 213 wrap : null, 214 skin : null, 215 outer : null, 216 inner : null, 217 218 player : { 219 timer : null, 220 isActive : false 221 }, 222 223 // Loaders 224 ajaxLoad : null, 225 imgPreload : null, 226 227 // Some collections 228 transitions : {}, 229 helpers : {}, 230 231 /* 232 * Static methods 233 */ 234 235 open: function (group, opts) { 236 if (!group) { 237 return; 238 } 239 240 if (!$.isPlainObject(opts)) { 241 opts = {}; 242 } 243 244 // Close if already active 245 if (false === F.close(true)) { 246 return; 247 } 248 249 // Normalize group 250 if (!$.isArray(group)) { 251 group = isQuery(group) ? $(group).get() : [group]; 252 } 253 254 // Recheck if the type of each element is `object` and set content type (image, ajax, etc) 255 $.each(group, function(i, element) { 256 var obj = {}, 257 href, 258 title, 259 content, 260 type, 261 rez, 262 hrefParts, 263 selector; 264 265 if ($.type(element) === "object") { 266 // Check if is DOM element 267 if (element.nodeType) { 268 element = $(element); 269 } 270 271 if (isQuery(element)) { 272 obj = { 273 href : element.data('fancybox-href') || element.attr('href'), 274 title : element.data('fancybox-title') || element.attr('title'), 275 isDom : true, 276 element : element 277 }; 278 279 if ($.metadata) { 280 $.extend(true, obj, element.metadata()); 281 } 282 283 } else { 284 obj = element; 285 } 286 } 287 288 href = opts.href || obj.href || (isString(element) ? element : null); 289 title = opts.title !== undefined ? opts.title : obj.title || ''; 290 291 content = opts.content || obj.content; 292 type = content ? 'html' : (opts.type || obj.type); 293 294 if (!type && obj.isDom) { 295 type = element.data('fancybox-type'); 296 297 if (!type) { 298 rez = element.prop('class').match(/fancybox\.(\w+)/); 299 type = rez ? rez[1] : null; 300 } 301 } 302 303 if (isString(href)) { 304 // Try to guess the content type 305 if (!type) { 306 if (F.isImage(href)) { 307 type = 'image'; 308 309 } else if (F.isSWF(href)) { 310 type = 'swf'; 311 312 } else if (href.charAt(0) === '#') { 313 type = 'inline'; 314 315 } else if (isString(element)) { 316 type = 'html'; 317 content = element; 318 } 319 } 320 321 // Split url into two pieces with source url and content selector, e.g, 322 // "/mypage.html #my_id" will load "/mypage.html" and display element having id "my_id" 323 if (type === 'ajax') { 324 hrefParts = href.split(/\s+/, 2); 325 href = hrefParts.shift(); 326 selector = hrefParts.shift(); 327 } 328 } 329 330 if (!content) { 331 if (type === 'inline') { 332 if (href) { 333 content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7 334 335 } else if (obj.isDom) { 336 content = element; 337 } 338 339 } else if (type === 'html') { 340 content = href; 341 342 } else if (!type && !href && obj.isDom) { 343 type = 'inline'; 344 content = element; 345 } 346 } 347 348 $.extend(obj, { 349 href : href, 350 type : type, 351 content : content, 352 title : title, 353 selector : selector 354 }); 355 356 group[ i ] = obj; 357 }); 358 359 // Extend the defaults 360 F.opts = $.extend(true, {}, F.defaults, opts); 361 362 // All options are merged recursive except keys 363 if (opts.keys !== undefined) { 364 F.opts.keys = opts.keys ? $.extend({}, F.defaults.keys, opts.keys) : false; 365 } 366 367 F.group = group; 368 369 return F._start(F.opts.index); 370 }, 371 372 // Cancel image loading or abort ajax request 373 cancel: function () { 374 var coming = F.coming; 375 376 if (!coming || false === F.trigger('onCancel')) { 377 return; 378 } 379 380 F.hideLoading(); 381 382 if (F.ajaxLoad) { 383 F.ajaxLoad.abort(); 384 } 385 386 F.ajaxLoad = null; 387 388 if (F.imgPreload) { 389 F.imgPreload.onload = F.imgPreload.onerror = null; 390 } 391 392 if (coming.wrap) { 393 coming.wrap.stop(true, true).trigger('onReset').remove(); 394 } 395 396 F.coming = null; 397 398 // If the first item has been canceled, then clear everything 399 if (!F.current) { 400 F._afterZoomOut( coming ); 401 } 402 }, 403 404 // Start closing animation if is open; remove immediately if opening/closing 405 close: function (event) { 406 F.cancel(); 407 408 if (false === F.trigger('beforeClose')) { 409 return; 410 } 411 412 F.unbindEvents(); 413 414 if (!F.isActive) { 415 return; 416 } 417 418 if (!F.isOpen || event === true) { 419 $('.fancybox-wrap').stop(true).trigger('onReset').remove(); 420 421 F._afterZoomOut(); 422 423 } else { 424 F.isOpen = F.isOpened = false; 425 F.isClosing = true; 426 427 $('.fancybox-item, .fancybox-nav').remove(); 428 429 F.wrap.stop(true, true).removeClass('fancybox-opened'); 430 431 F.transitions[ F.current.closeMethod ](); 432 } 433 }, 434 435 // Manage slideshow: 436 // $.fancybox.play(); - toggle slideshow 437 // $.fancybox.play( true ); - start 438 // $.fancybox.play( false ); - stop 439 play: function ( action ) { 440 var clear = function () { 441 clearTimeout(F.player.timer); 442 }, 443 set = function () { 444 clear(); 445 446 if (F.current && F.player.isActive) { 447 F.player.timer = setTimeout(F.next, F.current.playSpeed); 448 } 449 }, 450 stop = function () { 451 clear(); 452 453 D.unbind('.player'); 454 455 F.player.isActive = false; 456 457 F.trigger('onPlayEnd'); 458 }, 459 start = function () { 460 if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) { 461 F.player.isActive = true; 462 463 D.bind({ 464 'onCancel.player beforeClose.player' : stop, 465 'onUpdate.player' : set, 466 'beforeLoad.player' : clear 467 }); 468 469 set(); 470 471 F.trigger('onPlayStart'); 472 } 473 }; 474 475 if (action === true || (!F.player.isActive && action !== false)) { 476 start(); 477 } else { 478 stop(); 479 } 480 }, 481 482 // Navigate to next gallery item 483 next: function ( direction ) { 484 var current = F.current; 485 486 if (current) { 487 if (!isString(direction)) { 488 direction = current.direction.next; 489 } 490 491 F.jumpto(current.index + 1, direction, 'next'); 492 } 493 }, 494 495 // Navigate to previous gallery item 496 prev: function ( direction ) { 497 var current = F.current; 498 499 if (current) { 500 if (!isString(direction)) { 501 direction = current.direction.prev; 502 } 503 504 F.jumpto(current.index - 1, direction, 'prev'); 505 } 506 }, 507 508 // Navigate to gallery item by index 509 jumpto: function ( index, direction, router ) { 510 var current = F.current; 511 512 if (!current) { 513 return; 514 } 515 516 index = getScalar(index); 517 518 F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ]; 519 F.router = router || 'jumpto'; 520 521 if (current.loop) { 522 if (index < 0) { 523 index = current.group.length + (index % current.group.length); 524 } 525 526 index = index % current.group.length; 527 } 528 529 if (current.group[ index ] !== undefined) { 530 F.cancel(); 531 532 F._start(index); 533 } 534 }, 535 536 // Center inside viewport and toggle position type to fixed or absolute if needed 537 reposition: function (e, onlyAbsolute) { 538 var current = F.current, 539 wrap = current ? current.wrap : null, 540 pos; 541 542 if (wrap) { 543 pos = F._getPosition(onlyAbsolute); 544 545 if (e && e.type === 'scroll') { 546 delete pos.position; 547 548 wrap.stop(true, true).animate(pos, 200); 549 550 } else { 551 wrap.css(pos); 552 553 current.pos = $.extend({}, current.dim, pos); 554 } 555 } 556 }, 557 558 update: function (e) { 559 var type = (e && e.type), 560 anyway = !type || type === 'orientationchange'; 561 562 if (anyway) { 563 clearTimeout(didUpdate); 564 565 didUpdate = null; 566 } 567 568 if (!F.isOpen || didUpdate) { 569 return; 570 } 571 572 didUpdate = setTimeout(function() { 573 var current = F.current; 574 575 if (!current || F.isClosing) { 576 return; 577 } 578 579 F.wrap.removeClass('fancybox-tmp'); 580 581 if (anyway || type === 'load' || (type === 'resize' && current.autoResize)) { 582 F._setDimension(); 583 } 584 585 if (!(type === 'scroll' && current.canShrink)) { 586 F.reposition(e); 587 } 588 589 F.trigger('onUpdate'); 590 591 didUpdate = null; 592 593 }, (anyway && !isTouch ? 0 : 300)); 594 }, 595 596 // Shrink content to fit inside viewport or restore if resized 597 toggle: function ( action ) { 598 if (F.isOpen) { 599 F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView; 600 601 // Help browser to restore document dimensions 602 if (isTouch) { 603 F.wrap.removeAttr('style').addClass('fancybox-tmp'); 604 605 F.trigger('onUpdate'); 606 } 607 608 F.update(); 609 } 610 }, 611 612 hideLoading: function () { 613 D.unbind('.loading'); 614 615 $('#fancybox-loading').remove(); 616 }, 617 618 showLoading: function () { 619 var el, viewport; 620 621 F.hideLoading(); 622 623 el = $('<div id="fancybox-loading"><div></div></div>').click(F.cancel).appendTo('body'); 624 625 // If user will press the escape-button, the request will be canceled 626 D.bind('keydown.loading', function(e) { 627 if ((e.which || e.keyCode) === 27) { 628 e.preventDefault(); 629 630 F.cancel(); 631 } 632 }); 633 634 if (!F.defaults.fixed) { 635 viewport = F.getViewport(); 636 637 el.css({ 638 position : 'absolute', 639 top : (viewport.h * 0.5) + viewport.y, 640 left : (viewport.w * 0.5) + viewport.x 641 }); 642 } 643 }, 644 645 getViewport: function () { 646 var locked = (F.current && F.current.locked) || false, 647 rez = { 648 x: W.scrollLeft(), 649 y: W.scrollTop() 650 }; 651 652 if (locked) { 653 rez.w = locked[0].clientWidth; 654 rez.h = locked[0].clientHeight; 655 656 } else { 657 // See http://bugs.jquery.com/ticket/6724 658 rez.w = isTouch && window.innerWidth ? window.innerWidth : W.width(); 659 rez.h = isTouch && window.innerHeight ? window.innerHeight : W.height(); 660 } 661 662 return rez; 663 }, 664 665 // Unbind the keyboard / clicking actions 666 unbindEvents: function () { 667 if (F.wrap && isQuery(F.wrap)) { 668 F.wrap.unbind('.fb'); 669 } 670 671 D.unbind('.fb'); 672 W.unbind('.fb'); 673 }, 674 675 bindEvents: function () { 676 var current = F.current, 677 keys; 678 679 if (!current) { 680 return; 681 } 682 683 // Changing document height on iOS devices triggers a 'resize' event, 684 // that can change document height... repeating infinitely 685 W.bind('orientationchange.fb' + (isTouch ? '' : ' resize.fb') + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update); 686 687 keys = current.keys; 688 689 if (keys) { 690 D.bind('keydown.fb', function (e) { 691 var code = e.which || e.keyCode, 692 target = e.target || e.srcElement; 693 694 // Skip esc key if loading, because showLoading will cancel preloading 695 if (code === 27 && F.coming) { 696 return false; 697 } 698 699 // Ignore key combinations and key events within form elements 700 if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && !(target && (target.type || $(target).is('[contenteditable]')))) { 701 $.each(keys, function(i, val) { 702 if (current.group.length > 1 && val[ code ] !== undefined) { 703 F[ i ]( val[ code ] ); 704 705 e.preventDefault(); 706 return false; 707 } 708 709 if ($.inArray(code, val) > -1) { 710 F[ i ] (); 711 712 e.preventDefault(); 713 return false; 714 } 715 }); 716 } 717 }); 718 } 719 720 if ($.fn.mousewheel && current.mouseWheel) { 721 F.wrap.bind('mousewheel.fb', function (e, delta, deltaX, deltaY) { 722 var target = e.target || null, 723 parent = $(target), 724 canScroll = false; 725 726 while (parent.length) { 727 if (canScroll || parent.is('.fancybox-skin') || parent.is('.fancybox-wrap')) { 728 break; 729 } 730 731 canScroll = isScrollable( parent[0] ); 732 parent = $(parent).parent(); 733 } 734 735 if (delta !== 0 && !canScroll) { 736 if (F.group.length > 1 && !current.canShrink) { 737 if (deltaY > 0 || deltaX > 0) { 738 F.prev( deltaY > 0 ? 'down' : 'left' ); 739 740 } else if (deltaY < 0 || deltaX < 0) { 741 F.next( deltaY < 0 ? 'up' : 'right' ); 742 } 743 744 e.preventDefault(); 745 } 746 } 747 }); 748 } 749 }, 750 751 trigger: function (event, o) { 752 var ret, obj = o || F.coming || F.current; 753 754 if (!obj) { 755 return; 756 } 757 758 if ($.isFunction( obj[event] )) { 759 ret = obj[event].apply(obj, Array.prototype.slice.call(arguments, 1)); 760 } 761 762 if (ret === false) { 763 return false; 764 } 765 766 if (obj.helpers) { 767 $.each(obj.helpers, function (helper, opts) { 768 if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) { 769 F.helpers[helper][event]($.extend(true, {}, F.helpers[helper].defaults, opts), obj); 770 } 771 }); 772 } 773 774 D.trigger(event); 775 }, 776 777 isImage: function (str) { 778 return isString(str) && str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i); 779 }, 780 781 isSWF: function (str) { 782 return isString(str) && str.match(/\.(swf)((\?|#).*)?$/i); 783 }, 784 785 _start: function (index) { 786 var coming = {}, 787 obj, 788 href, 789 type, 790 margin, 791 padding; 792 793 index = getScalar( index ); 794 obj = F.group[ index ] || null; 795 796 if (!obj) { 797 return false; 798 } 799 800 coming = $.extend(true, {}, F.opts, obj); 801 802 // Convert margin and padding properties to array - top, right, bottom, left 803 margin = coming.margin; 804 padding = coming.padding; 805 806 if ($.type(margin) === 'number') { 807 coming.margin = [margin, margin, margin, margin]; 808 } 809 810 if ($.type(padding) === 'number') { 811 coming.padding = [padding, padding, padding, padding]; 812 } 813 814 // 'modal' propery is just a shortcut 815 if (coming.modal) { 816 $.extend(true, coming, { 817 closeBtn : false, 818 closeClick : false, 819 nextClick : false, 820 arrows : false, 821 mouseWheel : false, 822 keys : null, 823 helpers: { 824 overlay : { 825 closeClick : false 826 } 827 } 828 }); 829 } 830 831 // 'autoSize' property is a shortcut, too 832 if (coming.autoSize) { 833 coming.autoWidth = coming.autoHeight = true; 834 } 835 836 if (coming.width === 'auto') { 837 coming.autoWidth = true; 838 } 839 840 if (coming.height === 'auto') { 841 coming.autoHeight = true; 842 } 843 844 /* 845 * Add reference to the group, so it`s possible to access from callbacks, example: 846 * afterLoad : function() { 847 * this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : ''); 848 * } 849 */ 850 851 coming.group = F.group; 852 coming.index = index; 853 854 // Give a chance for callback or helpers to update coming item (type, title, etc) 855 F.coming = coming; 856 857 if (false === F.trigger('beforeLoad')) { 858 F.coming = null; 859 860 return; 861 } 862 863 type = coming.type; 864 href = coming.href; 865 866 if (!type) { 867 F.coming = null; 868 869 //If we can not determine content type then drop silently or display next/prev item if looping through gallery 870 if (F.current && F.router && F.router !== 'jumpto') { 871 F.current.index = index; 872 873 return F[ F.router ]( F.direction ); 874 } 875 876 return false; 877 } 878 879 F.isActive = true; 880 881 if (type === 'image' || type === 'swf') { 882 coming.autoHeight = coming.autoWidth = false; 883 coming.scrolling = 'visible'; 884 } 885 886 if (type === 'image') { 887 coming.aspectRatio = true; 888 } 889 890 if (type === 'iframe' && isTouch) { 891 coming.scrolling = 'scroll'; 892 } 893 894 // Build the necessary markup 895 coming.wrap = $(coming.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-type-' + type + ' fancybox-tmp ' + coming.wrapCSS).appendTo( coming.parent || 'body' ); 896 897 $.extend(coming, { 898 skin : $('.fancybox-skin', coming.wrap), 899 outer : $('.fancybox-outer', coming.wrap), 900 inner : $('.fancybox-inner', coming.wrap) 901 }); 902 903 $.each(["Top", "Right", "Bottom", "Left"], function(i, v) { 904 coming.skin.css('padding' + v, getValue(coming.padding[ i ])); 905 }); 906 907 F.trigger('onReady'); 908 909 // Check before try to load; 'inline' and 'html' types need content, others - href 910 if (type === 'inline' || type === 'html') { 911 if (!coming.content || !coming.content.length) { 912 return F._error( 'content' ); 913 } 914 915 } else if (!href) { 916 return F._error( 'href' ); 917 } 918 919 if (type === 'image') { 920 F._loadImage(); 921 922 } else if (type === 'ajax') { 923 F._loadAjax(); 924 925 } else if (type === 'iframe') { 926 F._loadIframe(); 927 928 } else { 929 F._afterLoad(); 930 } 931 }, 932 933 _error: function ( type ) { 934 $.extend(F.coming, { 935 type : 'html', 936 autoWidth : true, 937 autoHeight : true, 938 minWidth : 0, 939 minHeight : 0, 940 scrolling : 'no', 941 hasError : type, 942 content : F.coming.tpl.error 943 }); 944 945 F._afterLoad(); 946 }, 947 948 _loadImage: function () { 949 // Reset preload image so it is later possible to check "complete" property 950 var img = F.imgPreload = new Image(); 951 952 img.onload = function () { 953 this.onload = this.onerror = null; 954 955 F.coming.width = this.width / F.opts.pixelRatio; 956 F.coming.height = this.height / F.opts.pixelRatio; 957 958 F._afterLoad(); 959 }; 960 961 img.onerror = function () { 962 this.onload = this.onerror = null; 963 964 F._error( 'image' ); 965 }; 966 967 img.src = F.coming.href; 968 969 if (img.complete !== true) { 970 F.showLoading(); 971 } 972 }, 973 974 _loadAjax: function () { 975 var coming = F.coming; 976 977 F.showLoading(); 978 979 F.ajaxLoad = $.ajax($.extend({}, coming.ajax, { 980 url: coming.href, 981 error: function (jqXHR, textStatus) { 982 if (F.coming && textStatus !== 'abort') { 983 F._error( 'ajax', jqXHR ); 984 985 } else { 986 F.hideLoading(); 987 } 988 }, 989 success: function (data, textStatus) { 990 if (textStatus === 'success') { 991 coming.content = data; 992 993 F._afterLoad(); 994 } 995 } 996 })); 997 }, 998 999 _loadIframe: function() { 1000 var coming = F.coming, 1001 iframe = $(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime())) 1002 .attr('scrolling', isTouch ? 'auto' : coming.iframe.scrolling) 1003 .attr('src', coming.href); 1004 1005 // This helps IE 1006 $(coming.wrap).bind('onReset', function () { 1007 try { 1008 $(this).find('iframe').hide().attr('src', '//about:blank').end().empty(); 1009 } catch (e) {} 1010 }); 1011 1012 if (coming.iframe.preload) { 1013 F.showLoading(); 1014 1015 iframe.one('load', function() { 1016 $(this).data('ready', 1); 1017 1018 // iOS will lose scrolling if we resize 1019 if (!isTouch) { 1020 $(this).bind('load.fb', F.update); 1021 } 1022 1023 // Without this trick: 1024 // - iframe won't scroll on iOS devices 1025 // - IE7 sometimes displays empty iframe 1026 $(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show(); 1027 1028 F._afterLoad(); 1029 }); 1030 } 1031 1032 coming.content = iframe.appendTo( coming.inner ); 1033 1034 if (!coming.iframe.preload) { 1035 F._afterLoad(); 1036 } 1037 }, 1038 1039 _preloadImages: function() { 1040 var group = F.group, 1041 current = F.current, 1042 len = group.length, 1043 cnt = current.preload ? Math.min(current.preload, len - 1) : 0, 1044 item, 1045 i; 1046 1047 for (i = 1; i <= cnt; i += 1) { 1048 item = group[ (current.index + i ) % len ]; 1049 1050 if (item.type === 'image' && item.href) { 1051 new Image().src = item.href; 1052 } 1053 } 1054 }, 1055 1056 _afterLoad: function () { 1057 var coming = F.coming, 1058 previous = F.current, 1059 placeholder = 'fancybox-placeholder', 1060 current, 1061 content, 1062 type, 1063 scrolling, 1064 href, 1065 embed; 1066 1067 F.hideLoading(); 1068 1069 if (!coming || F.isActive === false) { 1070 return; 1071 } 1072 1073 if (false === F.trigger('afterLoad', coming, previous)) { 1074 coming.wrap.stop(true).trigger('onReset').remove(); 1075 1076 F.coming = null; 1077 1078 return; 1079 } 1080 1081 if (previous) { 1082 F.trigger('beforeChange', previous); 1083 1084 previous.wrap.stop(true).removeClass('fancybox-opened') 1085 .find('.fancybox-item, .fancybox-nav') 1086 .remove(); 1087 } 1088 1089 F.unbindEvents(); 1090 1091 current = coming; 1092 content = coming.content; 1093 type = coming.type; 1094 scrolling = coming.scrolling; 1095 1096 $.extend(F, { 1097 wrap : current.wrap, 1098 skin : current.skin, 1099 outer : current.outer, 1100 inner : current.inner, 1101 current : current, 1102 previous : previous 1103 }); 1104 1105 href = current.href; 1106 1107 switch (type) { 1108 case 'inline': 1109 case 'ajax': 1110 case 'html': 1111 if (current.selector) { 1112 content = $('<div>').html(content).find(current.selector); 1113 1114 } else if (isQuery(content)) { 1115 if (!content.data(placeholder)) { 1116 content.data(placeholder, $('<div class="' + placeholder + '"></div>').insertAfter( content ).hide() ); 1117 } 1118 1119 content = content.show().detach(); 1120 1121 current.wrap.bind('onReset', function () { 1122 if ($(this).find(content).length) { 1123 content.hide().replaceAll( content.data(placeholder) ).data(placeholder, false); 1124 } 1125 }); 1126 } 1127 break; 1128 1129 case 'image': 1130 content = current.tpl.image.replace('{href}', href); 1131 break; 1132 1133 case 'swf': 1134 content = '<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="' + href + '"></param>'; 1135 embed = ''; 1136 1137 $.each(current.swf, function(name, val) { 1138 content += '<param name="' + name + '" value="' + val + '"></param>'; 1139 embed += ' ' + name + '="' + val + '"'; 1140 }); 1141 1142 content += '<embed src="' + href + '" type="application/x-shockwave-flash" width="100%" height="100%"' + embed + '></embed></object>'; 1143 break; 1144 } 1145 1146 if (!(isQuery(content) && content.parent().is(current.inner))) { 1147 current.inner.append( content ); 1148 } 1149 1150 // Give a chance for helpers or callbacks to update elements 1151 F.trigger('beforeShow'); 1152 1153 // Set scrolling before calculating dimensions 1154 current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling)); 1155 1156 // Set initial dimensions and start position 1157 F._setDimension(); 1158 1159 F.reposition(); 1160 1161 F.isOpen = false; 1162 F.coming = null; 1163 1164 F.bindEvents(); 1165 1166 if (!F.isOpened) { 1167 $('.fancybox-wrap').not( current.wrap ).stop(true).trigger('onReset').remove(); 1168 1169 } else if (previous.prevMethod) { 1170 F.transitions[ previous.prevMethod ](); 1171 } 1172 1173 F.transitions[ F.isOpened ? current.nextMethod : current.openMethod ](); 1174 1175 F._preloadImages(); 1176 }, 1177 1178 _setDimension: function () { 1179 var viewport = F.getViewport(), 1180 steps = 0, 1181 canShrink = false, 1182 canExpand = false, 1183 wrap = F.wrap, 1184 skin = F.skin, 1185 inner = F.inner, 1186 current = F.current, 1187 width = current.width, 1188 height = current.height, 1189 minWidth = current.minWidth, 1190 minHeight = current.minHeight, 1191 maxWidth = current.maxWidth, 1192 maxHeight = current.maxHeight, 1193 scrolling = current.scrolling, 1194 scrollOut = current.scrollOutside ? current.scrollbarWidth : 0, 1195 margin = current.margin, 1196 wMargin = getScalar(margin[1] + margin[3]), 1197 hMargin = getScalar(margin[0] + margin[2]), 1198 wPadding, 1199 hPadding, 1200 wSpace, 1201 hSpace, 1202 origWidth, 1203 origHeight, 1204 origMaxWidth, 1205 origMaxHeight, 1206 ratio, 1207 width_, 1208 height_, 1209 maxWidth_, 1210 maxHeight_, 1211 iframe, 1212 body; 1213 1214 // Reset dimensions so we could re-check actual size 1215 wrap.add(skin).add(inner).width('auto').height('auto').removeClass('fancybox-tmp'); 1216 1217 wPadding = getScalar(skin.outerWidth(true) - skin.width()); 1218 hPadding = getScalar(skin.outerHeight(true) - skin.height()); 1219 1220 // Any space between content and viewport (margin, padding, border, title) 1221 wSpace = wMargin + wPadding; 1222 hSpace = hMargin + hPadding; 1223 1224 origWidth = isPercentage(width) ? (viewport.w - wSpace) * getScalar(width) / 100 : width; 1225 origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height; 1226 1227 if (current.type === 'iframe') { 1228 iframe = current.content; 1229 1230 if (current.autoHeight && iframe.data('ready') === 1) { 1231 try { 1232 if (iframe[0].contentWindow.document.location) { 1233 inner.width( origWidth ).height(9999); 1234 1235 body = iframe.contents().find('body'); 1236 1237 if (scrollOut) { 1238 body.css('overflow-x', 'hidden'); 1239 } 1240 1241 origHeight = body.outerHeight(true); 1242 } 1243 1244 } catch (e) {} 1245 } 1246 1247 } else if (current.autoWidth || current.autoHeight) { 1248 inner.addClass( 'fancybox-tmp' ); 1249 1250 // Set width or height in case we need to calculate only one dimension 1251 if (!current.autoWidth) { 1252 inner.width( origWidth ); 1253 } 1254 1255 if (!current.autoHeight) { 1256 inner.height( origHeight ); 1257 } 1258 1259 if (current.autoWidth) { 1260 origWidth = inner.width(); 1261 } 1262 1263 if (current.autoHeight) { 1264 origHeight = inner.height(); 1265 } 1266 1267 inner.removeClass( 'fancybox-tmp' ); 1268 } 1269 1270 width = getScalar( origWidth ); 1271 height = getScalar( origHeight ); 1272 1273 ratio = origWidth / origHeight; 1274 1275 // Calculations for the content 1276 minWidth = getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth); 1277 maxWidth = getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth); 1278 1279 minHeight = getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight); 1280 maxHeight = getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight); 1281 1282 // These will be used to determine if wrap can fit in the viewport 1283 origMaxWidth = maxWidth; 1284 origMaxHeight = maxHeight; 1285 1286 if (current.fitToView) { 1287 maxWidth = Math.min(viewport.w - wSpace, maxWidth); 1288 maxHeight = Math.min(viewport.h - hSpace, maxHeight); 1289 } 1290 1291 maxWidth_ = viewport.w - wMargin; 1292 maxHeight_ = viewport.h - hMargin; 1293 1294 if (current.aspectRatio) { 1295 if (width > maxWidth) { 1296 width = maxWidth; 1297 height = getScalar(width / ratio); 1298 } 1299 1300 if (height > maxHeight) { 1301 height = maxHeight; 1302 width = getScalar(height * ratio); 1303 } 1304 1305 if (width < minWidth) { 1306 width = minWidth; 1307 height = getScalar(width / ratio); 1308 } 1309 1310 if (height < minHeight) { 1311 height = minHeight; 1312 width = getScalar(height * ratio); 1313 } 1314 1315 } else { 1316 width = Math.max(minWidth, Math.min(width, maxWidth)); 1317 1318 if (current.autoHeight && current.type !== 'iframe') { 1319 inner.width( width ); 1320 1321 height = inner.height(); 1322 } 1323 1324 height = Math.max(minHeight, Math.min(height, maxHeight)); 1325 } 1326 1327 // Try to fit inside viewport (including the title) 1328 if (current.fitToView) { 1329 inner.width( width ).height( height ); 1330 1331 wrap.width( width + wPadding ); 1332 1333 // Real wrap dimensions 1334 width_ = wrap.width(); 1335 height_ = wrap.height(); 1336 1337 if (current.aspectRatio) { 1338 while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) { 1339 if (steps++ > 19) { 1340 break; 1341 } 1342 1343 height = Math.max(minHeight, Math.min(maxHeight, height - 10)); 1344 width = getScalar(height * ratio); 1345 1346 if (width < minWidth) { 1347 width = minWidth; 1348 height = getScalar(width / ratio); 1349 } 1350 1351 if (width > maxWidth) { 1352 width = maxWidth; 1353 height = getScalar(width / ratio); 1354 } 1355 1356 inner.width( width ).height( height ); 1357 1358 wrap.width( width + wPadding ); 1359 1360 width_ = wrap.width(); 1361 height_ = wrap.height(); 1362 } 1363 1364 } else { 1365 width = Math.max(minWidth, Math.min(width, width - (width_ - maxWidth_))); 1366 height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_))); 1367 } 1368 } 1369 1370 if (scrollOut && scrolling === 'auto' && height < origHeight && (width + wPadding + scrollOut) < maxWidth_) { 1371 width += scrollOut; 1372 } 1373 1374 inner.width( width ).height( height ); 1375 1376 wrap.width( width + wPadding ); 1377 1378 width_ = wrap.width(); 1379 height_ = wrap.height(); 1380 1381 canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight; 1382 canExpand = current.aspectRatio ? (width < origMaxWidth && height < origMaxHeight && width < origWidth && height < origHeight) : ((width < origMaxWidth || height < origMaxHeight) && (width < origWidth || height < origHeight)); 1383 1384 $.extend(current, { 1385 dim : { 1386 width : getValue( width_ ), 1387 height : getValue( height_ ) 1388 }, 1389 origWidth : origWidth, 1390 origHeight : origHeight, 1391 canShrink : canShrink, 1392 canExpand : canExpand, 1393 wPadding : wPadding, 1394 hPadding : hPadding, 1395 wrapSpace : height_ - skin.outerHeight(true), 1396 skinSpace : skin.height() - height 1397 }); 1398 1399 if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) { 1400 inner.height('auto'); 1401 } 1402 }, 1403 1404 _getPosition: function (onlyAbsolute) { 1405 var current = F.current, 1406 viewport = F.getViewport(), 1407 margin = current.margin, 1408 width = F.wrap.width() + margin[1] + margin[3], 1409 height = F.wrap.height() + margin[0] + margin[2], 1410 rez = { 1411 position: 'absolute', 1412 top : margin[0], 1413 left : margin[3] 1414 }; 1415 1416 if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) { 1417 rez.position = 'fixed'; 1418 1419 } else if (!current.locked) { 1420 rez.top += viewport.y; 1421 rez.left += viewport.x; 1422 } 1423 1424 rez.top = getValue(Math.max(rez.top, rez.top + ((viewport.h - height) * current.topRatio))); 1425 rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width) * current.leftRatio))); 1426 1427 return rez; 1428 }, 1429 1430 _afterZoomIn: function () { 1431 var current = F.current; 1432 1433 if (!current) { 1434 return; 1435 } 1436 1437 F.isOpen = F.isOpened = true; 1438 1439 F.wrap.css('overflow', 'visible').addClass('fancybox-opened'); 1440 1441 F.update(); 1442 1443 // Assign a click event 1444 if ( current.closeClick || (current.nextClick && F.group.length > 1) ) { 1445 F.inner.css('cursor', 'pointer').bind('click.fb', function(e) { 1446 if (!$(e.target).is('a') && !$(e.target).parent().is('a')) { 1447 e.preventDefault(); 1448 1449 F[ current.closeClick ? 'close' : 'next' ](); 1450 } 1451 }); 1452 } 1453 1454 // Create a close button 1455 if (current.closeBtn) { 1456 $(current.tpl.closeBtn).appendTo(F.skin).bind('click.fb', function(e) { 1457 e.preventDefault(); 1458 1459 F.close(); 1460 }); 1461 } 1462 1463 // Create navigation arrows 1464 if (current.arrows && F.group.length > 1) { 1465 if (current.loop || current.index > 0) { 1466 $(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev); 1467 } 1468 1469 if (current.loop || current.index < F.group.length - 1) { 1470 $(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next); 1471 } 1472 } 1473 1474 F.trigger('afterShow'); 1475 1476 // Stop the slideshow if this is the last item 1477 if (!current.loop && current.index === current.group.length - 1) { 1478 F.play( false ); 1479 1480 } else if (F.opts.autoPlay && !F.player.isActive) { 1481 F.opts.autoPlay = false; 1482 1483 F.play(); 1484 } 1485 }, 1486 1487 _afterZoomOut: function ( obj ) { 1488 obj = obj || F.current; 1489 1490 $('.fancybox-wrap').trigger('onReset').remove(); 1491 1492 $.extend(F, { 1493 group : {}, 1494 opts : {}, 1495 router : false, 1496 current : null, 1497 isActive : false, 1498 isOpened : false, 1499 isOpen : false, 1500 isClosing : false, 1501 wrap : null, 1502 skin : null, 1503 outer : null, 1504 inner : null 1505 }); 1506 1507 F.trigger('afterClose', obj); 1508 } 1509 }); 1510 1511 /* 1512 * Default transitions 1513 */ 1514 1515 F.transitions = { 1516 getOrigPosition: function () { 1517 var current = F.current, 1518 element = current.element, 1519 orig = current.orig, 1520 pos = {}, 1521 width = 50, 1522 height = 50, 1523 hPadding = current.hPadding, 1524 wPadding = current.wPadding, 1525 viewport = F.getViewport(); 1526 1527 if (!orig && current.isDom && element.is(':visible')) { 1528 orig = element.find('img:first'); 1529 1530 if (!orig.length) { 1531 orig = element; 1532 } 1533 } 1534 1535 if (isQuery(orig)) { 1536 pos = orig.offset(); 1537 1538 if (orig.is('img')) { 1539 width = orig.outerWidth(); 1540 height = orig.outerHeight(); 1541 } 1542 1543 } else { 1544 pos.top = viewport.y + (viewport.h - height) * current.topRatio; 1545 pos.left = viewport.x + (viewport.w - width) * current.leftRatio; 1546 } 1547 1548 if (F.wrap.css('position') === 'fixed' || current.locked) { 1549 pos.top -= viewport.y; 1550 pos.left -= viewport.x; 1551 } 1552 1553 pos = { 1554 top : getValue(pos.top - hPadding * current.topRatio), 1555 left : getValue(pos.left - wPadding * current.leftRatio), 1556 width : getValue(width + wPadding), 1557 height : getValue(height + hPadding) 1558 }; 1559 1560 return pos; 1561 }, 1562 1563 step: function (now, fx) { 1564 var ratio, 1565 padding, 1566 value, 1567 prop = fx.prop, 1568 current = F.current, 1569 wrapSpace = current.wrapSpace, 1570 skinSpace = current.skinSpace; 1571 1572 if (prop === 'width' || prop === 'height') { 1573 ratio = fx.end === fx.start ? 1 : (now - fx.start) / (fx.end - fx.start); 1574 1575 if (F.isClosing) { 1576 ratio = 1 - ratio; 1577 } 1578 1579 padding = prop === 'width' ? current.wPadding : current.hPadding; 1580 value = now - padding; 1581 1582 F.skin[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) ) ); 1583 F.inner[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) - (skinSpace * ratio) ) ); 1584 } 1585 }, 1586 1587 zoomIn: function () { 1588 var current = F.current, 1589 startPos = current.pos, 1590 effect = current.openEffect, 1591 elastic = effect === 'elastic', 1592 endPos = $.extend({opacity : 1}, startPos); 1593 1594 // Remove "position" property that breaks older IE 1595 delete endPos.position; 1596 1597 if (elastic) { 1598 startPos = this.getOrigPosition(); 1599 1600 if (current.openOpacity) { 1601 startPos.opacity = 0.1; 1602 } 1603 1604 } else if (effect === 'fade') { 1605 startPos.opacity = 0.1; 1606 } 1607 1608 F.wrap.css(startPos).animate(endPos, { 1609 duration : effect === 'none' ? 0 : current.openSpeed, 1610 easing : current.openEasing, 1611 step : elastic ? this.step : null, 1612 complete : F._afterZoomIn 1613 }); 1614 }, 1615 1616 zoomOut: function () { 1617 var current = F.current, 1618 effect = current.closeEffect, 1619 elastic = effect === 'elastic', 1620 endPos = {opacity : 0.1}; 1621 1622 if (elastic) { 1623 endPos = this.getOrigPosition(); 1624 1625 if (current.closeOpacity) { 1626 endPos.opacity = 0.1; 1627 } 1628 } 1629 1630 F.wrap.animate(endPos, { 1631 duration : effect === 'none' ? 0 : current.closeSpeed, 1632 easing : current.closeEasing, 1633 step : elastic ? this.step : null, 1634 complete : F._afterZoomOut 1635 }); 1636 }, 1637 1638 changeIn: function () { 1639 var current = F.current, 1640 effect = current.nextEffect, 1641 startPos = current.pos, 1642 endPos = { opacity : 1 }, 1643 direction = F.direction, 1644 distance = 200, 1645 field; 1646 1647 startPos.opacity = 0.1; 1648 1649 if (effect === 'elastic') { 1650 field = direction === 'down' || direction === 'up' ? 'top' : 'left'; 1651 1652 if (direction === 'down' || direction === 'right') { 1653 startPos[ field ] = getValue(getScalar(startPos[ field ]) - distance); 1654 endPos[ field ] = '+=' + distance + 'px'; 1655 1656 } else { 1657 startPos[ field ] = getValue(getScalar(startPos[ field ]) + distance); 1658 endPos[ field ] = '-=' + distance + 'px'; 1659 } 1660 } 1661 1662 // Workaround for http://bugs.jquery.com/ticket/12273 1663 if (effect === 'none') { 1664 F._afterZoomIn(); 1665 1666 } else { 1667 F.wrap.css(startPos).animate(endPos, { 1668 duration : current.nextSpeed, 1669 easing : current.nextEasing, 1670 complete : F._afterZoomIn 1671 }); 1672 } 1673 }, 1674 1675 changeOut: function () { 1676 var previous = F.previous, 1677 effect = previous.prevEffect, 1678 endPos = { opacity : 0.1 }, 1679 direction = F.direction, 1680 distance = 200; 1681 1682 if (effect === 'elastic') { 1683 endPos[ direction === 'down' || direction === 'up' ? 'top' : 'left' ] = ( direction === 'up' || direction === 'left' ? '-' : '+' ) + '=' + distance + 'px'; 1684 } 1685 1686 previous.wrap.animate(endPos, { 1687 duration : effect === 'none' ? 0 : previous.prevSpeed, 1688 easing : previous.prevEasing, 1689 complete : function () { 1690 $(this).trigger('onReset').remove(); 1691 } 1692 }); 1693 } 1694 }; 1695 1696 /* 1697 * Overlay helper 1698 */ 1699
1700 F.helpers.overlay = { 1701 defaults : { 1702 closeClick : true, // if true, fancyBox will be closed when user clicks on the overlay 1703 speedOut : 200, // duration of fadeOut animation 1704 showEarly : true, // indicates if should be opened immediately or wait until the content is ready 1705 css : {}, // custom CSS properties 1706 locked : !isTouch, // if true, the content will be locked into overlay 1707 fixed : true // if false, the overlay CSS position property will not be set to "fixed" 1708 }, 1709 1710 overlay : null, // current handle 1711 fixed : false, // indicates if the overlay has position "fixed" 1712 el : $('html'), // element that contains "the lock" 1713 1714 // Public methods 1715 create : function(opts) { 1716 opts = $.extend({}, this.defaults, opts); 1717 1718 if (this.overlay) { 1719 this.close(); 1720 } 1721 1722 this.overlay = $('<div class="fancybox-overlay"></div>').appendTo( F.coming ? F.coming.parent : opts.parent ); 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 var scrollV, scrollH; 1769 1770 W.unbind('resize.overlay'); 1771 1772 if (this.el.hasClass('fancybox-lock')) { 1773 $('.fancybox-margin').removeClass('fancybox-margin'); 1774 1775 scrollV = W.scrollTop(); 1776 scrollH = W.scrollLeft(); 1777 1778 this.el.removeClass('fancybox-lock'); 1779 1780 W.scrollTop( scrollV ).scrollLeft( scrollH ); 1781 } 1782 1783 $('.fancybox-overlay').remove().hide(); 1784 1785 $.extend(this, { 1786 overlay : null, 1787 fixed : false 1788 }); 1789 }, 1790 1791 // Private, callbacks 1792 1793 update : function () { 1794 var width = '100%', offsetWidth; 1795 1796 // Reset width/height so it will not mess 1797 this.overlay.width(width).height('100%'); 1798 1799 // jQuery does not return reliable result for IE 1800 if (IE) { 1801 offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth); 1802 1803 if (D.width() > offsetWidth) { 1804 width = D.width(); 1805 } 1806 1807 } else if (D.width() > W.width()) { 1808 width = D.width(); 1809 } 1810 1811 this.overlay.width(width).height(D.height()); 1812 }, 1813 1814 // This is where we can manipulate DOM, because later it would cause iframes to reload 1815 onReady : function (opts, obj) { 1816 var overlay = this.overlay; 1817 1818 $('.fancybox-overlay').stop(true, true); 1819 1820 if (!overlay) { 1821 this.create(opts); 1822 } 1823 1824 if (opts.locked && this.fixed && obj.fixed) { 1825 if (!overlay) { 1826 this.margin = D.height() > W.height() ? $('html').css('margin-right').replace("px", "") : false; 1827 } 1828 1829 obj.locked = this.overlay.append( obj.wrap ); 1830 obj.fixed = false; 1831 } 1832 1833 if (opts.showEarly === true) { 1834 this.beforeShow.apply(this, arguments); 1835 } 1836 }, 1837 1838 beforeShow : function(opts, obj) { 1839 var scrollV, scrollH; 1840 1841 if (obj.locked) { 1842 if (this.margin !== false) { 1843 $('*').filter(function(){ 1844 return ($(this).css('position') === 'fixed' && !$(this).hasClass("fancybox-overlay") && !$(this).hasClass("fancybox-wrap") ); 1845 }).addClass('fancybox-margin'); 1846 1847 this.el.addClass('fancybox-margin'); 1848 } 1849 1850 scrollV = W.scrollTop(); 1851 scrollH = W.scrollLeft(); 1852 1853 this.el.addClass('fancybox-lock'); 1854 1855 W.scrollTop( scrollV ).scrollLeft( scrollH ); 1856 } 1857 1858 this.open(opts); 1859 }, 1860 1861 onUpdate : function() { 1862 if (!this.fixed) { 1863 this.update(); 1864 } 1865 }, 1866 1867 afterClose: function (opts) { 1868 // Remove overlay if exists and fancyBox is not opening 1869 // (e.g., it is not being open using afterClose callback) 1870 //if (this.overlay && !F.isActive) { 1871 if (this.overlay && !F.coming) { 1872 this.overlay.fadeOut(opts.speedOut, $.proxy( this.close, this )); 1873 } 1874 } 1875 }; 1876 1877 /* 1878 * Title helper 1879 */ 1880 1881 F.helpers.title = { 1882 defaults : { 1883 type : 'float', // 'float', 'inside', 'outside' or 'over', 1884 position : 'bottom' // 'top' or 'bottom' 1885 }, 1886 1887 beforeShow: function (opts) { 1888 var current = F.current, 1889 text = current.title, 1890 type = opts.type, 1891 title, 1892 target; 1893 1894 if ($.isFunction(text)) { 1895 text = text.call(current.element, current); 1896 } 1897 1898 if (!isString(text) || $.trim(text) === '') { 1899 return; 1900 } 1901 1902 title = $('<div class="fancybox-title fancybox-title-' + type + '-wrap">
1902' + text + '</div>'); 1903 1904 switch (type) { 1905 case 'inside': 1906 target = F.skin; 1907 break; 1908 1909 case 'outside': 1910 target = F.wrap; 1911 break; 1912 1913 case 'over': 1914 target = F.inner; 1915 break; 1916 1917 default: // 'float' 1918 target = F.skin; 1919 1920 title.appendTo('body'); 1921 1922 if (IE) { 1923 title.width( title.width() ); 1924 } 1925 1926 title.wrapInner('<span class="child"></span>'); 1927 1928 //Increase bottom margin so this title will also fit into viewport 1929 F.current.margin[2] += Math.abs( getScalar(title.css('margin-bottom')) ); 1930 break; 1931 } 1932 1933 title[ (opts.position === 'top' ? 'prependTo' : 'appendTo') ](target); 1934 } 1935 }; 1936 1937 // jQuery plugin initialization 1938 $.fn.fancybox = function (options) { 1939 var index, 1940 that = $(this), 1941 selector = this.selector || '', 1942 run = function(e) { 1943 var what = $(this).blur(), idx = index, relType, relVal; 1944 1945 if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !what.is('.fancybox-wrap')) { 1946 relType = options.groupAttr || 'data-fancybox-group'; 1947 relVal = what.attr(relType); 1948 1949 if (!relVal) { 1950 relType = 'rel'; 1951 relVal = what.get(0)[ relType ]; 1952 } 1953 1954 if (relVal && relVal !== '' && relVal !== 'nofollow') { 1955 what = selector.length ? $(selector) : that; 1956 what = what.filter('[' + relType + '="' + relVal + '"]'); 1957 idx = what.index(this); 1958 } 1959 1960 options.index = idx; 1961 1962 // Stop an event from bubbling if everything is fine 1963 if (F.open(what, options) !== false) { 1964 e.preventDefault(); 1965 } 1966 } 1967 }; 1968 1969 options = options || {}; 1970 index = options.index || 0; 1971 1972 if (!selector || options.live === false) { 1973 that.unbind('click.fb-start').bind('click.fb-start', run); 1974 1975 } else { 1976 D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run); 1977 } 1978 1979 this.filter('[data-fancybox-start=1]').trigger('click'); 1980 1981 return this; 1982 }; 1983 1984 // Tests that need a body at doc ready 1985 D.ready(function() { 1986 var w1, w2; 1987 1988 if ( $.scrollbarWidth === undefined ) { 1989 // http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth 1990 $.scrollbarWidth = function() { 1991 var parent = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body'), 1992 child = parent.children(), 1993 width = child.innerWidth() - child.height( 99 ).innerWidth(); 1994 1995 parent.remove(); 1996 1997 return width; 1998 }; 1999 } 2000 2001 if ( $.support.fixedPosition === undefined ) { 2002 $.support.fixedPosition = (function() { 2003 var elem = $('<div style="position:fixed;top:20px;"></div>').appendTo('body'), 2004 fixed = ( elem[0].offsetTop === 20 || elem[0].offsetTop === 15 ); 2005 2006 elem.remove(); 2007 2008 return fixed; 2009 }()); 2010 } 2011 2012 $.extend(F.defaults, { 2013 scrollbarWidth : $.scrollbarWidth(), 2014 fixed : $.support.fixedPosition, 2015 parent : $('body') 2016 }); 2017 2018 //Get real width of page scroll-bar 2019 w1 = $(window).width(); 2020 2021 H.addClass('fancybox-lock-test'); 2022 2023 w2 = $(window).width(); 2024 2025 H.removeClass('fancybox-lock-test'); 2026 2027 $("<style type='text/css'>.fancybox-margin{margin-right:" + (w2 - w1) + "px;}</style>").appendTo("head"); 2028 }); 2029 2030}(window, document, _4ORMAT.$)); 2031// CUSTOM 4ORMAT PLUGIN - MODIFIED SLIDE JS 2032 2033// Generated by CoffeeScript 1.6.1 2034(function() { 2035 2036 (function($, window, document) { 2037 var Plugin, defaults, pluginName; 2038 pluginName = "slidesjs"; 2039 defaults = { 2040 width: 940, 2041 height: 528, 2042 start: 1, 2043 navigation: { 2044 active: true, 2045 effect: "slide" 2046 }, 2047 pagination: { 2048 active: true, 2049 effect: "slide" 2050 }, 2051 play: { 2052 active: false, 2053 effect: "slide", 2054 interval: 5000, 2055 auto: false, 2056 swap: true, 2057 pauseOnHover: false, 2058 restartDelay: 2500 2059 }, 2060 effect: { 2061 slide: { 2062 speed: 500 2063 }, 2064 fade: { 2065 speed: 300, 2066 crossfade: true 2067 } 2068 }, 2069 callback: { 2070 loaded: function() {}, 2071 start: function() {}, 2072 complete: function() {} 2073 } 2074 }; 2075 Plugin = (function() { 2076 2077 function Plugin(element, options) { 2078 this.element = element; 2079 this.options = $.extend(true, {}, defaults, options); 2080 this._defaults = defaults; 2081 this._name = pluginName; 2082 this.init(); 2083 } 2084 2085 return Plugin; 2086 2087 })(); 2088 Plugin.prototype.init = function() { 2089 var $element, nextButton, pagination, playButton, prevButton, stopButton, 2090 _this = this; 2091 $element = $(this.element); 2092 this.data = $.data(this); 2093 $.data(this, "animating", false); 2094 $.data(this, "total", $element.children().not(".slidesjs-navigation", $element).length); 2095 $.data(this, "current", this.options.start - 1); 2096 $.data(this, "vendorPrefix", this._getVendorPrefix()); 2097 if (typeof TouchEvent !== "undefined") { 2098 $.data(this, "touch", true); 2099 this.options.effect.slide.speed = this.options.effect.slide.speed / 2; 2100 } 2101 $element.css({ 2102 overflow: "hidden" 2103 }); 2104 $element.slidesContainer = $element.children().not(".slidesjs-navigation", $element).wrapAll("<div class='slidesjs-container'>", $element).parent().css({ 2105 overflow: "hidden", 2106 position: "relative" 2107 }); 2108 $(".slidesjs-container", $element).wrapInner("<div class='slidesjs-control'>", $element).children(); 2109 $(".slidesjs-control", $element).css({ 2110 position: "relative", 2111 left: 0 2112 }); 2113 $(".slidesjs-control", $element).children().addClass("slidesjs-slide").css({ 2114 position: "absolute", 2115 top: 0, 2116 left: 0, 2117 width: "100%", 2118 display: "none", 2119 webkitBackfaceVisibility: "hidden" 2120 }); 2121 $.each($(".slidesjs-control", $element).children(), function(i) { 2122 var $slide; 2123 $slide = $(this); 2124 return $slide.attr("slidesjs-index", i); 2125 }); 2126 if (this.data.touch) { 2127 $(".slidesjs-control", $element).on("touchstart", function(e) { 2128 return _this._touchstart(e); 2129 }); 2130 $(".slidesjs-control", $element).on("touchmove", function(e) { 2131 return _this._touchmove(e); 2132 }); 2133 $(".slidesjs-control", $element).on("touchend", function(e) { 2134 return _this._touchend(e); 2135 }); 2136 } 2137 $element.fadeIn(0); 2138 this.update(); 2139 if (this.data.touch) { 2140 this._setuptouch(); 2141 } 2142 $(".slidesjs-control", $element).children(":eq(" + this.data.current + ")").eq(0).fadeIn(0, function() { 2143 return $(this); 2144 }); 2145 if (this.options.navigation.active) { 2146 prevButton = $("<a>", { 2147 "class": "slidesjs-previous slidesjs-navigation", 2148 href: "#", 2149 title: "Previous", 2150 text: "Previous" 2151 }).appendTo($element); 2152 nextButton = $("<a>", { 2153 "class": "slidesjs-next slidesjs-navigation", 2154 href: "#", 2155 // title: "Next", Removed by Mat 2156 text: "Next" 2157 }).appendTo($element); 2158 } 2159 $(".slidesjs-next", $element).click(function(e) { 2160 e.preventDefault(); 2161 _this.stop(true); 2162 return _this.next(_this.options.navigation.effect); 2163 }); 2164 $(".slidesjs-previous", $element).click(function(e) { 2165 e.preventDefault(); 2166 _this.stop(true); 2167 return _this.previous(_this.options.navigation.effect); 2168 }); 2169 if (this.options.play.active) { 2170 playButton = $("<a>", { 2171 "class": "slidesjs-play slidesjs-navigation", 2172 href: "#", 2173 title: "Play", 2174 text: "Play" 2175 }).appendTo($element); 2176 stopButton = $("<a>", { 2177 "class": "slidesjs-stop slidesjs-navigation", 2178 href: "#", 2179 title: "Stop", 2180 text: "Stop" 2181 }).appendTo($element); 2182 playButton.click(function(e) { 2183 e.preventDefault(); 2184 return _this.play(true); 2185 }); 2186 stopButton.click(function(e) { 2187 e.preventDefault(); 2188 return _this.stop(true); 2189 }); 2190 if (this.options.play.swap) { 2191 stopButton.css({ 2192 display: "none" 2193 }); 2194 } 2195 } 2196 if (this.options.pagination.active) { 2197 pagination = $("<ul>", { 2198 "class": "slidesjs-pagination" 2199 }).appendTo($element); 2200 $.each(new Array(this.data.total), function(i) { 2201 var paginationItem, paginationLink; 2202 paginationItem = $("<li>", { 2203 "class": "slidesjs-pagination-item" 2204 }).appendTo(pagination); 2205 paginationLink = $("<a>", { 2206 href: "#",
2207 "data-slidesjs-item": i, 2208 html: i + 1 2209 }).appendTo(paginationItem); 2210 return paginationLink.click(function(e) { 2211 e.preventDefault(); 2212 _this.stop(true); 2213 return _this.goto(($(e.currentTarget).attr("data-slidesjs-item") * 1) + 1); 2214 }); 2215 }); 2216 } 2217 $(window).bind("resize", function() { 2218 return _this.update(); 2219 }); 2220 this._setActive(); 2221 this._enough_to_scroll(); 2222 if (this.options.play.auto) { 2223 this.play(); 2224 } 2225 return this.options.callback.loaded(this.options.start); 2226 }; 2227 Plugin.prototype._setActive = function(number) { 2228 var $element, current; 2229 $element = $(this.element); 2230 this.data = $.data(this); 2231 current = number > -1 ? number : this.data.current; 2232 $(".active", $element).removeClass("active"); 2233 $(".slidesjs-pagination li:eq(" + current + ") a", $element).addClass("active"); 2234 }; 2235 Plugin.prototype._enough_to_scroll = function() { 2236 var $element = $(this.element); 2237 var offset = ($(".slidesjs-pagination li", $element).length * 64 - 4) - $('.slidesjs-container').width(); 2238 2239 if(offset < 0) { 2240 this.options.too_few = true; 2241 $('.slidesjs-pagination', $element).stop().animate({'left': -offset/2 + 'px'}, 200); 2242 } 2243 }; 2244 Plugin.prototype._centerThumbs = function(number) { 2245 var $element, current; 2246 $element = $(this.element); 2247 this.data = $.data(this); 2248 current = number > -1 ? number : this.data.current; 2249 // Mat - custom code: center thumbnails when images 2250 if (this.options.pagination.thumbs) { 2251 if(this.options.too_few) { return false; } 2252 2253 var current_slide = $(".slidesjs-pagination li:eq(" + current + ") a", $element); 2254 var offset = current_slide.parents('li').index() * current_slide.parents('li').width(); 2255 var test_val = $('.slidesjs-pagination', $element).width() - $('.slidesjs-container', $element).width(); 2256 2257 offset = offset - ($element.width() / 2) + (current_slide.width() / 2); 2258 2259 if(offset < 0) { offset = 0; } 2260 if(offset > test_val) { offset = test_val; } 2261 2262 $('.slidesjs-pagination', $element).stop().animate({'left': -offset + 'px'}, 200); 2263 } 2264 }; 2265 Plugin.prototype.update = function() { 2266 var $element, height, width; 2267 $element = $(this.element); 2268 this.data = $.data(this); 2269 $(".slidesjs-control", $element).children(":not(:eq(" + this.data.current + "))").css({ 2270 display: "none", 2271 left: 0 2272 }); 2273 width = $element.width(); 2274 height = (this.options.height / this.options.width) * width; 2275 this.options.width = width; 2276 this.options.height = height; 2277 // Mat : hack to add f_blog_post_images_slideshow_item_inner 2278 return $(".slidesjs-control, .slidesjs-container, .f_blog_post_images_slideshow_item_inner", $element).css({ 2279 width: width, 2280 height: height 2281 }); 2282 }; 2283 Plugin.prototype.next = function(effect) { 2284 var $element; 2285 $element = $(this.element); 2286 this.data = $.data(this); 2287 $.data(this, "direction", "next"); 2288 if (effect === void 0) { 2289 effect = this.options.navigation.effect; 2290 } 2291 if (effect === "fade") { 2292 return this._fade(); 2293 } else { 2294 return this._slide(); 2295 } 2296 }; 2297 Plugin.prototype.previous = function(effect) { 2298 var $element; 2299 $element = $(this.element); 2300 this.data = $.data(this); 2301 $.data(this, "direction", "previous"); 2302 if (effect === void 0) { 2303 effect = this.options.navigation.effect; 2304 } 2305 if (effect === "fade") { 2306 return this._fade(); 2307 } else { 2308 return this._slide(); 2309 } 2310 }; 2311 Plugin.prototype.goto = function(number) { 2312 var $element, effect; 2313 $element = $(this.element); 2314 this.data = $.data(this); 2315 if (effect === void 0) { 2316 effect = this.options.pagination.effect; 2317 } 2318 if (number > this.data.total) { 2319 number = this.data.total; 2320 } else if (number < 1) { 2321 number = 1; 2322 } 2323 if (typeof number === "number") { 2324 if (effect === "fade") { 2325 return this._fade(number); 2326 } else { 2327 return this._slide(number); 2328 } 2329 } else if (typeof number === "string") { 2330 if (number === "first") { 2331 if (effect === "fade") { 2332 return this._fade(0); 2333 } else { 2334 return this._slide(0); 2335 } 2336 } else if (number === "last") { 2337 if (effect === "fade") { 2338 return this._fade(this.data.total); 2339 } else { 2340 return this._slide(this.data.total); 2341 } 2342 } 2343 } 2344 }; 2345 Plugin.prototype._setuptouch = function() { 2346 var $element, next, previous, slidesControl; 2347 $element = $(this.element); 2348 this.data = $.data(this); 2349 slidesControl = $(".slidesjs-control", $element); 2350 next = this.data.current + 1; 2351 previous = this.data.current - 1; 2352 if (previous < 0) { 2353 previous = this.data.total - 1; 2354 } 2355 if (next > this.data.total - 1) { 2356 next = 0; 2357 } 2358 slidesControl.children(":eq(" + next + ")").css({ 2359 display: "block", 2360 left: this.options.width 2361 }); 2362 return slidesControl.children(":eq(" + previous + ")").css({ 2363 display: "block", 2364 left: -this.options.width 2365 }); 2366 }; 2367 Plugin.prototype._touchstart = function(e) { 2368 var $element, touches; 2369 $element = $(this.element); 2370 this.data = $.data(this); 2371 touches = e.originalEvent.touches[0]; 2372 this._setuptouch(); 2373 $.data(this, "touchtimer", Number(new Date())); 2374 $.data(this, "touchstartx", touches.pageX); 2375 $.data(this, "touchstarty", touches.pageY); 2376 return e.stopPropagation(); 2377 }; 2378 Plugin.prototype._touchend = function(e) { 2379 var $element, duration, prefix, slidesControl, timing, touches, transform, 2380 _this = this; 2381 $element = $(this.element); 2382 this.data = $.data(this); 2383 touches = e.originalEvent.touches[0]; 2384 slidesControl = $(".slidesjs-control", $element); 2385 if (slidesControl.position().left > this.options.width * 0.5 || slidesControl.position().left > this.options.width * 0.1 && (Number(new Date()) - this.data.touchtimer < 250)) { 2386 $.data(this, "direction", "previous"); 2387 this._slide(); 2388 } else if (slidesControl.position().left < -(this.options.width * 0.5) || slidesControl.position().left < -(this.options.width * 0.1) && (Number(new Date()) - this.data.touchtimer < 250)) { 2389 $.data(this, "direction", "next"); 2390 this._slide(); 2391 } else { 2392 prefix = this.data.vendorPrefix; 2393 transform = prefix + "Transform"; 2394 duration = prefix + "TransitionDuration"; 2395 timing = prefix + "TransitionTimingFunction"; 2396 slidesControl[0].style[transform] = "translateX(0px)"; 2397 slidesControl[0].style[duration] = this.options.effect.slide.speed * 0.85 + "ms"; 2398 } 2399 slidesControl.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd", function() { 2400 prefix = _this.data.vendorPrefix; 2401 transform = prefix + "Transform"; 2402 duration = prefix + "TransitionDuration"; 2403 timing = prefix + "TransitionTimingFunction"; 2404 slidesControl[0].style[transform] = ""; 2405 slidesControl[0].style[duration] = ""; 2406 return slidesControl[0].style[timing] = ""; 2407 }); 2408 return e.stopPropagation(); 2409 }; 2410 Plugin.prototype._touchmove = function(e) { 2411 var $element, prefix, slidesControl, touches, transform; 2412 $element = $(this.element); 2413 this.data = $.data(this); 2414 touches = e.originalEvent.touches[0]; 2415 prefix = this.data.vendorPrefix; 2416 slidesControl = $(".slidesjs-control", $element); 2417 transform = prefix + "Transform"; 2418 $.data(this, "scrolling", Math.abs(touches.pageX - this.data.touchstartx) < Math.abs(touches.pageY - this.data.touchstarty)); 2419 if (!this.data.animating && !this.data.scrolling) { 2420 e.preventDefault(); 2421 this._setuptouch();
2422 slidesControl[0].style[transform] = "translateX(" + (touches.pageX - this.data.touchstartx) + "px)"; 2423 } 2424 return e.stopPropagation(); 2425 }; 2426 Plugin.prototype.play = function(next) { 2427 var $element, currentSlide, slidesContainer, 2428 _this = this; 2429 $element = $(this.element); 2430 this.data = $.data(this); 2431 if (!this.data.playInterval) { 2432 if (next) { 2433 currentSlide = this.data.current; 2434 this.data.direction = "next"; 2435 if (this.options.play.effect === "fade") { 2436 this._fade(); 2437 } else { 2438 this._slide(); 2439 } 2440 } 2441 $.data(this, "playInterval", setInterval((function() { 2442 currentSlide = _this.data.current; 2443 _this.data.direction = "next"; 2444 if (_this.options.play.effect === "fade") { 2445 return _this._fade(); 2446 } else { 2447 return _this._slide(); 2448 } 2449 }), this.options.play.interval)); 2450 slidesContainer = $(".slidesjs-container", $element); 2451 if (this.options.play.pauseOnHover) { 2452 slidesContainer.unbind(); 2453 slidesContainer.bind("mouseenter", function() { 2454 return _this.stop(); 2455 }); 2456 slidesContainer.bind("mouseleave", function() { 2457 if (_this.options.play.restartDelay) { 2458 return $.data(_this, "restartDelay", setTimeout((function() { 2459 return _this.play(true); 2460 }), _this.options.play.restartDelay)); 2461 } else { 2462 return _this.play(); 2463 } 2464 }); 2465 } 2466 $.data(this, "playing", true); 2467 $(".slidesjs-play", $element).addClass("slidesjs-playing"); 2468 if (this.options.play.swap) { 2469 $(".slidesjs-play", $element).hide(); 2470 return $(".slidesjs-stop", $element).show(); 2471 } 2472 } 2473 }; 2474 Plugin.prototype.stop = function(clicked) { 2475 var $element; 2476 $element = $(this.element); 2477 this.data = $.data(this); 2478 clearInterval(this.data.playInterval); 2479 if (this.options.play.pauseOnHover && clicked) { 2480 $(".slidesjs-container", $element).unbind(); 2481 } 2482 $.data(this, "playInterval", null); 2483 $.data(this, "playing", false); 2484 $(".slidesjs-play", $element).removeClass("slidesjs-playing"); 2485 if (this.options.play.swap) { 2486 $(".slidesjs-stop", $element).hide(); 2487 return $(".slidesjs-play", $element).show(); 2488 } 2489 }; 2490 Plugin.prototype._slide = function(number) { 2491 var $element, currentSlide, direction, duration, next, prefix, slidesControl, timing, transform, value, 2492 _this = this; 2493 $element = $(this.element); 2494 this.data = $.data(this); 2495 if (!this.data.animating && number !== this.data.current + 1) { 2496 $.data(this, "animating", true); 2497 currentSlide = this.data.current; 2498 if (number > -1) { 2499 number = number - 1; 2500 value = number > currentSlide ? 1 : -1; 2501 direction = number > currentSlide ? -this.options.width : this.options.width; 2502 next = number; 2503 } else { 2504 value = this.data.direction === "next" ? 1 : -1; 2505 direction = this.data.direction === "next" ? -this.options.width : this.options.width; 2506 next = currentSlide + value; 2507 } 2508 if (next === -1) { 2509 next = this.data.total - 1; 2510 } 2511 if (next === this.data.total) { 2512 next = 0; 2513 } 2514 this._setActive(next); 2515 this._centerThumbs(next); 2516 slidesControl = $(".slidesjs-control", $element); 2517 if (number > -1) { 2518 slidesControl.children(":not(:eq(" + currentSlide + "))").css({ 2519 display: "none", 2520 left: 0 2521 }); 2522 } 2523 slidesControl.children(":eq(" + next + ")").css({ 2524 display: "block", 2525 left: value * this.options.width 2526 }); 2527 this.options.callback.start(currentSlide + 1); 2528 if (this.data.vendorPrefix) { 2529 prefix = this.data.vendorPrefix; 2530 transform = prefix + "Transform"; 2531 duration = prefix + "TransitionDuration"; 2532 timing = prefix + "TransitionTimingFunction";
2533 slidesControl[0].style[transform] = "translateX(" + direction + "px)"; 2534 slidesControl[0].style[duration] = this.options.effect.slide.speed + "ms"; 2535 return slidesControl.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd", function() { 2536 slidesControl[0].style[transform] = ""; 2537 slidesControl[0].style[duration] = ""; 2538 slidesControl.children(":eq(" + next + ")").css({ 2539 left: 0 2540 }); 2541 slidesControl.children(":eq(" + currentSlide + ")").css({ 2542 display: "none", 2543 left: 0 2544 }); 2545 $.data(_this, "current", next); 2546 $.data(_this, "animating", false); 2547 slidesControl.unbind("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd"); 2548 slidesControl.children(":not(:eq(" + next + "))").css({ 2549 display: "none", 2550 left: 0 2551 }); 2552 if (_this.data.touch) { 2553 _this._setuptouch(); 2554 } 2555 return _this.options.callback.complete(next + 1); 2556 }); 2557 } else { 2558 return slidesControl.stop().animate({ 2559 left: direction 2560 }, this.options.effect.slide.speed, (function() { 2561 slidesControl.css({ 2562 left: 0 2563 }); 2564 slidesControl.children(":eq(" + next + ")").css({ 2565 left: 0 2566 }); 2567 return slidesControl.children(":eq(" + currentSlide + ")").css({ 2568 display: "none", 2569 left: 0 2570 }, $.data(_this, "current", next), $.data(_this, "animating", false), _this.options.callback.complete(next + 1)); 2571 })); 2572 } 2573 } 2574 }; 2575 Plugin.prototype._fade = function(number) { 2576 var $element, currentSlide, next, slidesControl, value, 2577 _this = this; 2578 $element = $(this.element); 2579 this.data = $.data(this); 2580 if (!this.data.animating && number !== this.data.current + 1) { 2581 $.data(this, "animating", true); 2582 currentSlide = this.data.current; 2583 if (number) { 2584 number = number - 1; 2585 value = number > currentSlide ? 1 : -1; 2586 next = number; 2587 } else { 2588 value = this.data.direction === "next" ? 1 : -1; 2589 next = currentSlide + value; 2590 } 2591 if (next === -1) { 2592 next = this.data.total - 1; 2593 } 2594 if (next === this.data.total) { 2595 next = 0; 2596 } 2597 this._setActive(next); 2598 this._centerThumbs(next); 2599 slidesControl = $(".slidesjs-control", $element); 2600 slidesControl.children(":eq(" + next + ")").css({ 2601 display: "none", 2602 left: 0 2603 }); 2604 this.options.callback.start(currentSlide + 1); 2605 if (this.options.effect.fade.crossfade) { 2606 slidesControl.children(":eq(" + this.data.current + ")").stop().fadeOut(this.options.effect.fade.speed); 2607 return slidesControl.children(":eq(" + next + ")").stop().fadeIn(this.options.effect.fade.speed, (function() { 2608 slidesControl.children(":eq(" + next + ")"); 2609 $.data(_this, "animating", false); 2610 $.data(_this, "current", next); 2611 return _this.options.callback.complete(next + 1); 2612 })); 2613 } else { 2614 return slidesControl.children(":eq(" + currentSlide + ")").stop().fadeOut(this.options.effect.fade.speed, (function() { 2615 slidesControl.children(":eq(" + next + ")").stop().fadeIn(_this.options.effect.fade.speed, (function() { 2616 return slidesControl.children(":eq(" + next + ")"); 2617 })); 2618 $.data(_this, "animating", false); 2619 $.data(_this, "current", next); 2620 return _this.options.callback.complete(next + 1); 2621 })); 2622 } 2623 } 2624 }; 2625 Plugin.prototype._getVendorPrefix = function() { 2626 var body, i, style, transition, vendor; 2627 body = document.body || document.documentElement; 2628 style = body.style; 2629 transition = "transition"; 2630 vendor = ["Moz", "Webkit", "Khtml", "O", "ms"]; 2631 transition = transition.charAt(0).toUpperCase() + transition.substr(1); 2632 i = 0; 2633 while (i < vendor.length) { 2634 if (typeof style[vendor[i] + transition] === "string") { 2635 return vendor[i]; 2636 } 2637 i++; 2638 } 2639 return false;
2640 }; 2641 return $.fn[pluginName] = function(options) { 2642 return this.each(function() { 2643 if (!$.data(this, "plugin_" + pluginName)) { 2644 return $.data(this, "plugin_" + pluginName, new Plugin(this, options)); 2645 } 2646 }); 2647 }; 2648 })(_4ORMAT.$, window, document); 2649 2650}).call(this); 2651 2652 2653 2654 2655_4ORMAT.$(function() { 2656 var $ = _4ORMAT.$; 2657 $('.f_blog_post_image_hoverwrap').fancybox({ 2658 padding: 0, 2659 arrows: false, 2660 loop: false, 2661 nextClick: true, 2662 helpers: { 2663 overlay: { 2664 locked: false 2665 } 2666 }, 2667 afterShow: function() { 2668 $('.fancybox-title').after('<a href="javascript:void(0)" class="fancybox-title-toggle">toggle</a>'); 2669 $('.fancybox-title-toggle').on('click', fancy_box_toggle); 2670 } 2671 }); 2672 2673 $('.f_blog_post_images_slideshow').each(function() { 2674 var slideshow = $(this); 2675 var width = $('.f_blog_post_images_slideshow_item_inner').length; // 1px padding on each item 2676 slideshow.slidesjs({ 2677 width: 700, 2678 height: 467, 2679 effect: { 2680 slide: { 2681 speed: 1000 2682 } 2683 }, 2684 pagination: { 2685 active: true, 2686 thumbs: true 2687 }, 2688 callback: { 2689 loaded: function(number) { 2690 // block right click on next slider <a> overlay if image protection is enabled. 2691 if (_4ORMAT.ImageProtection.is_enabled()) slideshow.on('contextmenu', '.slidesjs-navigation', _4ORMAT.ImageProtection.trap); 2692 2693 var num_thumbs = slideshow.find('.f_blog_post_images_slideshow_item_inner').length; 2694 slideshow.find('.slidesjs-pagination').width( 64 * num_thumbs - 4 ); 2695 slideshow.find('.f_blog_post_images_slideshow_item_inner').each(function(i) { 2696 var is_active = i == 0 ? '.active' : ''; 2697 slideshow.find('.slidesjs-pagination li:eq(' + i + ') a' + is_active).html('<img src="' + ($(this).find('img').data('thumb') || $(this).find('img').attr('src')) + '" />'); 2698 }); 2699 slideshow.find('.slidesjs-control').after("<a href='javascript:void(0);' class='f_blog_post_images_slideshow_caption_toggle'>toggle</a>"); 2700 slideshow.find('.f_blog_post_images_slideshow_caption_toggle').click(function() { 2701 var active_slide = slideshow.find('.slidesjs-pagination-item .active').parent().index(); 2702 slideshow.find('.slidesjs-slide').eq(active_slide).find('.f_blog_post_images_slideshow_caption').toggleClass('show'); 2703 $(this).toggleClass('f_close_icon'); 2704 }); 2705 if(slideshow.find('.f_blog_post_images_slideshow_item').eq(0).find('.f_blog_post_images_slideshow_caption').length) { 2706 slideshow.find('.f_blog_post_images_slideshow_caption_toggle').addClass('show'); 2707 } else { 2708 slideshow.find('.f_blog_post_images_slideshow_caption_toggle').removeClass('show'); 2709 } 2710 if($('html').hasClass('ie8')) { $(".slidesjs-pagination li:last-child a").css('padding-right', '0'); } 2711 }, 2712 start: function(number) { 2713 var $slide_item = slideshow.find('.f_blog_post_images_slideshow_item').eq(number - 1); 2714 if($slide_item.find('.f_blog_post_images_slideshow_caption').length) { 2715 slideshow.find('.f_blog_post_images_slideshow_caption_toggle').removeClass('f_close_icon'); 2716 } 2717 slideshow.find('.slidesjs-slide .f_blog_post_images_slideshow_caption').removeClass('show'); 2718 }, 2719 complete: function(number) { 2720 var $slide_item = slideshow.find('.f_blog_post_images_slideshow_item').eq(number - 1); 2721 if($slide_item.find('.f_blog_post_images_slideshow_caption').length) { 2722 slideshow.find('.f_blog_post_images_slideshow_caption_toggle').removeClass('f_close_icon'); 2723 slideshow.find('.f_blog_post_images_slideshow_caption_toggle').addClass('show'); 2724 } else { 2725 slideshow.find('.f_blog_post_images_slideshow_caption_toggle').removeClass('show'); 2726 setTimeout(function() { 2727 slideshow.find('.f_blog_post_images_slideshow_caption_toggle').removeClass('f_close_icon'); 2728 }, 350); 2729 } 2730 } 2731 } 2732 }); 2733 slideshow.find('.slidesjs-pagination').wrap('<div class="slidesjs-pagination-wrapper"></div>'); 2734 }); 2735 2736 if (_4ORMAT.ImageProtection.is_enabled()) { 2737 $('.f_blog_post_image_hoverwrap').on('click', function(e) { 2738 if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey) { return false; } 2739 }); 2740 _4ORMAT.$('body').delegate('.f_blog_post_image_hoverwrap', 'contextmenu', _4ORMAT.ImageProtection.trap); 2741 } 2742 2743 function addFluidWrapperToIFrames() { 2744 $(".f_blog_wrapper iframe").each(function () { 2745 var $frame_elem = $(this); 2746 if ($frame_elem.parent(".fluid-width-video-wrapper, .js-reframe, .ratio-container").length) { 2747 return; 2748 } 2749 $frame_elem.wrap("<div class='iframe-wrapper'></div>"); 2750 }); 2751 } 2752 2753 $(window).load(function () { 2754 addFluidWrapperToIFrames(); 2755 $(".f_blog_post_images_intelligent").each(function () { 2756 var msnry = new Masonry($(this)[0], { 2757 itemSelector: '.f_blog_post_image_hoverwrap' 2758 }); 2759 }); 2760 }); 2761}); 2762 2763var fancy_box_toggle = function() { 2764 var $ = _4ORMAT.$; 2765 $(this).prev().toggleClass('show'); 2766 $(this).toggleClass('f_close_icon'); 2767} 2768;
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.