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,197 bytes, lines 75-1700
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 // Fixed for blog grid galleries and Turbolinks 1168 // $('.fancybox-wrap').not( current.wrap ).stop(true).trigger('onReset').remove(); 1169 1170 } else if (previous.prevMethod) { 1171 F.transitions[ previous.prevMethod ](); 1172 } 1173 1174 F.transitions[ F.isOpened ? current.nextMethod : current.openMethod ](); 1175 1176 F._preloadImages(); 1177 }, 1178 1179 _setDimension: function () { 1180 var viewport = F.getViewport(), 1181 steps = 0, 1182 canShrink = false, 1183 canExpand = false, 1184 wrap = F.wrap, 1185 skin = F.skin, 1186 inner = F.inner, 1187 current = F.current, 1188 width = current.width, 1189 height = current.height, 1190 minWidth = current.minWidth, 1191 minHeight = current.minHeight, 1192 maxWidth = current.maxWidth, 1193 maxHeight = current.maxHeight, 1194 scrolling = current.scrolling, 1195 scrollOut = current.scrollOutside ? current.scrollbarWidth : 0, 1196 margin = current.margin, 1197 wMargin = getScalar(margin[1] + margin[3]), 1198 hMargin = getScalar(margin[0] + margin[2]), 1199 wPadding, 1200 hPadding, 1201 wSpace, 1202 hSpace, 1203 origWidth, 1204 origHeight, 1205 origMaxWidth, 1206 origMaxHeight, 1207 ratio, 1208 width_, 1209 height_, 1210 maxWidth_, 1211 maxHeight_, 1212 iframe, 1213 body; 1214 1215 // Reset dimensions so we could re-check actual size 1216 wrap.add(skin).add(inner).width('auto').height('auto').removeClass('fancybox-tmp'); 1217 1218 wPadding = getScalar(skin.outerWidth(true) - skin.width()); 1219 hPadding = getScalar(skin.outerHeight(true) - skin.height()); 1220 1221 // Any space between content and viewport (margin, padding, border, title) 1222 wSpace = wMargin + wPadding; 1223 hSpace = hMargin + hPadding; 1224 1225 origWidth = isPercentage(width) ? (viewport.w - wSpace) * getScalar(width) / 100 : width; 1226 origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height; 1227 1228 if (current.type === 'iframe') { 1229 iframe = current.content; 1230 1231 if (current.autoHeight && iframe.data('ready') === 1) { 1232 try { 1233 if (iframe[0].contentWindow.document.location) { 1234 inner.width( origWidth ).height(9999); 1235 1236 body = iframe.contents().find('body'); 1237 1238 if (scrollOut) { 1239 body.css('overflow-x', 'hidden'); 1240 } 1241 1242 origHeight = body.outerHeight(true); 1243 } 1244 1245 } catch (e) {} 1246 } 1247 1248 } else if (current.autoWidth || current.autoHeight) { 1249 inner.addClass( 'fancybox-tmp' ); 1250 1251 // Set width or height in case we need to calculate only one dimension 1252 if (!current.autoWidth) { 1253 inner.width( origWidth ); 1254 } 1255 1256 if (!current.autoHeight) { 1257 inner.height( origHeight ); 1258 } 1259 1260 if (current.autoWidth) { 1261 origWidth = inner.width(); 1262 } 1263 1264 if (current.autoHeight) { 1265 origHeight = inner.height(); 1266 } 1267 1268 inner.removeClass( 'fancybox-tmp' ); 1269 } 1270 1271 width = getScalar( origWidth ); 1272 height = getScalar( origHeight ); 1273 1274 ratio = origWidth / origHeight; 1275 1276 // Calculations for the content 1277 minWidth = getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth); 1278 maxWidth = getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth); 1279 1280 minHeight = getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight); 1281 maxHeight = getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight); 1282 1283 // These will be used to determine if wrap can fit in the viewport 1284 origMaxWidth = maxWidth; 1285 origMaxHeight = maxHeight; 1286 1287 if (current.fitToView) { 1288 maxWidth = Math.min(viewport.w - wSpace, maxWidth); 1289 maxHeight = Math.min(viewport.h - hSpace, maxHeight); 1290 } 1291 1292 maxWidth_ = viewport.w - wMargin; 1293 maxHeight_ = viewport.h - hMargin; 1294 1295 if (current.aspectRatio) { 1296 if (width > maxWidth) { 1297 width = maxWidth; 1298 height = getScalar(width / ratio); 1299 } 1300 1301 if (height > maxHeight) { 1302 height = maxHeight; 1303 width = getScalar(height * ratio); 1304 } 1305 1306 if (width < minWidth) { 1307 width = minWidth; 1308 height = getScalar(width / ratio); 1309 } 1310 1311 if (height < minHeight) { 1312 height = minHeight; 1313 width = getScalar(height * ratio); 1314 } 1315 1316 } else { 1317 width = Math.max(minWidth, Math.min(width, maxWidth)); 1318 1319 if (current.autoHeight && current.type !== 'iframe') { 1320 inner.width( width ); 1321 1322 height = inner.height(); 1323 } 1324 1325 height = Math.max(minHeight, Math.min(height, maxHeight)); 1326 } 1327 1328 // Try to fit inside viewport (including the title) 1329 if (current.fitToView) { 1330 inner.width( width ).height( height ); 1331 1332 wrap.width( width + wPadding ); 1333 1334 // Real wrap dimensions 1335 width_ = wrap.width(); 1336 height_ = wrap.height(); 1337 1338 if (current.aspectRatio) { 1339 while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) { 1340 if (steps++ > 19) { 1341 break; 1342 } 1343 1344 height = Math.max(minHeight, Math.min(maxHeight, height - 10)); 1345 width = getScalar(height * ratio); 1346 1347 if (width < minWidth) { 1348 width = minWidth; 1349 height = getScalar(width / ratio); 1350 } 1351 1352 if (width > maxWidth) { 1353 width = maxWidth; 1354 height = getScalar(width / ratio); 1355 } 1356 1357 inner.width( width ).height( height ); 1358 1359 wrap.width( width + wPadding ); 1360 1361 width_ = wrap.width(); 1362 height_ = wrap.height(); 1363 } 1364 1365 } else { 1366 width = Math.max(minWidth, Math.min(width, width - (width_ - maxWidth_))); 1367 height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_))); 1368 } 1369 } 1370 1371 if (scrollOut && scrolling === 'auto' && height < origHeight && (width + wPadding + scrollOut) < maxWidth_) { 1372 width += scrollOut; 1373 } 1374 1375 inner.width( width ).height( height ); 1376 1377 wrap.width( width + wPadding ); 1378 1379 width_ = wrap.width(); 1380 height_ = wrap.height(); 1381 1382 canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight; 1383 canExpand = current.aspectRatio ? (width < origMaxWidth && height < origMaxHeight && width < origWidth && height < origHeight) : ((width < origMaxWidth || height < origMaxHeight) && (width < origWidth || height < origHeight)); 1384 1385 $.extend(current, { 1386 dim : { 1387 width : getValue( width_ ), 1388 height : getValue( height_ ) 1389 }, 1390 origWidth : origWidth, 1391 origHeight : origHeight, 1392 canShrink : canShrink, 1393 canExpand : canExpand, 1394 wPadding : wPadding, 1395 hPadding : hPadding, 1396 wrapSpace : height_ - skin.outerHeight(true), 1397 skinSpace : skin.height() - height 1398 }); 1399 1400 if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) { 1401 inner.height('auto'); 1402 } 1403 }, 1404 1405 _getPosition: function (onlyAbsolute) { 1406 var current = F.current, 1407 viewport = F.getViewport(), 1408 margin = current.margin, 1409 width = F.wrap.width() + margin[1] + margin[3], 1410 height = F.wrap.height() + margin[0] + margin[2], 1411 rez = { 1412 position: 'absolute', 1413 top : margin[0], 1414 left : margin[3] 1415 }; 1416 1417 if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) { 1418 rez.position = 'fixed'; 1419 1420 } else if (!current.locked) { 1421 rez.top += viewport.y; 1422 rez.left += viewport.x; 1423 } 1424 1425 rez.top = getValue(Math.max(rez.top, rez.top + ((viewport.h - height) * current.topRatio))); 1426 rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width) * current.leftRatio))); 1427 1428 return rez; 1429 }, 1430 1431 _afterZoomIn: function () { 1432 var current = F.current; 1433 1434 if (!current) { 1435 return; 1436 } 1437 1438 F.isOpen = F.isOpened = true; 1439 1440 F.wrap.css('overflow', 'visible').addClass('fancybox-opened'); 1441 1442 F.update(); 1443 1444 // Assign a click event 1445 if ( current.closeClick || (current.nextClick && F.group.length > 1) ) { 1446 F.inner.css('cursor', 'pointer').bind('click.fb', function(e) { 1447 if (!$(e.target).is('a') && !$(e.target).parent().is('a')) { 1448 e.preventDefault(); 1449 1450 F[ current.closeClick ? 'close' : 'next' ](); 1451 } 1452 }); 1453 } 1454 1455 // Create a close button 1456 if (current.closeBtn) { 1457 $(current.tpl.closeBtn).appendTo(F.skin).bind('click.fb', function(e) { 1458 e.preventDefault(); 1459 1460 F.close(); 1461 }); 1462 } 1463 1464 // Create navigation arrows 1465 if (current.arrows && F.group.length > 1) { 1466 if (current.loop || current.index > 0) { 1467 $(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev); 1468 } 1469 1470 if (current.loop || current.index < F.group.length - 1) { 1471 $(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next); 1472 } 1473 } 1474 1475 F.trigger('afterShow'); 1476 1477 // Stop the slideshow if this is the last item 1478 if (!current.loop && current.index === current.group.length - 1) { 1479 F.play( false ); 1480 1481 } else if (F.opts.autoPlay && !F.player.isActive) { 1482 F.opts.autoPlay = false; 1483 1484 F.play(); 1485 } 1486 }, 1487 1488 _afterZoomOut: function ( obj ) { 1489 obj = obj || F.current; 1490 1491 $('.fancybox-wrap').trigger('onReset').remove(); 1492 1493 $.extend(F, { 1494 group : {}, 1495 opts : {}, 1496 router : false, 1497 current : null, 1498 isActive : false, 1499 isOpened : false, 1500 isOpen : false, 1501 isClosing : false, 1502 wrap : null, 1503 skin : null, 1504 outer : null, 1505 inner : null 1506 }); 1507 1508 F.trigger('afterClose', obj); 1509 } 1510 }); 1511 1512 /* 1513 * Default transitions 1514 */ 1515 1516 F.transitions = { 1517 getOrigPosition: function () { 1518 var current = F.current, 1519 element = current.element, 1520 orig = current.orig, 1521 pos = {}, 1522 width = 50, 1523 height = 50, 1524 hPadding = current.hPadding, 1525 wPadding = current.wPadding, 1526 viewport = F.getViewport(); 1527 1528 if (!orig && current.isDom && element.is(':visible')) { 1529 orig = element.find('img:first'); 1530 1531 if (!orig.length) { 1532 orig = element; 1533 } 1534 } 1535 1536 if (isQuery(orig)) { 1537 pos = orig.offset(); 1538 1539 if (orig.is('img')) { 1540 width = orig.outerWidth(); 1541 height = orig.outerHeight(); 1542 } 1543 1544 } else { 1545 pos.top = viewport.y + (viewport.h - height) * current.topRatio; 1546 pos.left = viewport.x + (viewport.w - width) * current.leftRatio; 1547 } 1548 1549 if (F.wrap.css('position') === 'fixed' || current.locked) { 1550 pos.top -= viewport.y; 1551 pos.left -= viewport.x; 1552 } 1553 1554 pos = { 1555 top : getValue(pos.top - hPadding * current.topRatio), 1556 left : getValue(pos.left - wPadding * current.leftRatio), 1557 width : getValue(width + wPadding), 1558 height : getValue(height + hPadding) 1559 }; 1560 1561 return pos; 1562 }, 1563 1564 step: function (now, fx) { 1565 var ratio, 1566 padding, 1567 value, 1568 prop = fx.prop, 1569 current = F.current, 1570 wrapSpace = current.wrapSpace, 1571 skinSpace = current.skinSpace; 1572 1573 if (prop === 'width' || prop === 'height') { 1574 ratio = fx.end === fx.start ? 1 : (now - fx.start) / (fx.end - fx.start); 1575 1576 if (F.isClosing) { 1577 ratio = 1 - ratio; 1578 } 1579 1580 padding = prop === 'width' ? current.wPadding : current.hPadding; 1581 value = now - padding; 1582 1583 F.skin[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) ) ); 1584 F.inner[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) - (skinSpace * ratio) ) ); 1585 } 1586 }, 1587 1588 zoomIn: function () { 1589 var current = F.current, 1590 startPos = current.pos, 1591 effect = current.openEffect, 1592 elastic = effect === 'elastic', 1593 endPos = $.extend({opacity : 1}, startPos); 1594 1595 // Remove "position" property that breaks older IE 1596 delete endPos.position; 1597 1598 if (elastic) { 1599 startPos = this.getOrigPosition(); 1600 1601 if (current.openOpacity) { 1602 startPos.opacity = 0.1; 1603 } 1604 1605 } else if (effect === 'fade') { 1606 startPos.opacity = 0.1; 1607 } 1608 1609 F.wrap.css(startPos).animate(endPos, { 1610 duration : effect === 'none' ? 0 : current.openSpeed, 1611 easing : current.openEasing, 1612 step : elastic ? this.step : null, 1613 complete : F._afterZoomIn 1614 }); 1615 }, 1616 1617 zoomOut: function () { 1618 var current = F.current, 1619 effect = current.closeEffect, 1620 elastic = effect === 'elastic', 1621 endPos = {opacity : 0.1}; 1622 1623 if (elastic) { 1624 endPos = this.getOrigPosition(); 1625 1626 if (current.closeOpacity) { 1627 endPos.opacity = 0.1; 1628 } 1629 } 1630 1631 F.wrap.animate(endPos, { 1632 duration : effect === 'none' ? 0 : current.closeSpeed, 1633 easing : current.closeEasing, 1634 step : elastic ? this.step : null, 1635 complete : F._afterZoomOut 1636 }); 1637 }, 1638 1639 changeIn: function () { 1640 var current = F.current, 1641 effect = current.nextEffect, 1642 startPos = current.pos, 1643 endPos = { opacity : 1 }, 1644 direction = F.direction, 1645 distance = 200, 1646 field; 1647 1648 startPos.opacity = 0.1; 1649 1650 if (effect === 'elastic') { 1651 field = direction === 'down' || direction === 'up' ? 'top' : 'left'; 1652 1653 if (direction === 'down' || direction === 'right') { 1654 startPos[ field ] = getValue(getScalar(startPos[ field ]) - distance); 1655 endPos[ field ] = '+=' + distance + 'px'; 1656 1657 } else { 1658 startPos[ field ] = getValue(getScalar(startPos[ field ]) + distance); 1659 endPos[ field ] = '-=' + distance + 'px'; 1660 } 1661 } 1662 1663 // Workaround for http://bugs.jquery.com/ticket/12273 1664 if (effect === 'none') { 1665 F._afterZoomIn(); 1666 1667 } else { 1668 F.wrap.css(startPos).animate(endPos, { 1669 duration : current.nextSpeed, 1670 easing : current.nextEasing, 1671 complete : F._afterZoomIn 1672 }); 1673 } 1674 }, 1675 1676 changeOut: function () { 1677 var previous = F.previous, 1678 effect = previous.prevEffect, 1679 endPos = { opacity : 0.1 }, 1680 direction = F.direction, 1681 distance = 200; 1682 1683 if (effect === 'elastic') { 1684 endPos[ direction === 'down' || direction === 'up' ? 'top' : 'left' ] = ( direction === 'up' || direction === 'left' ? '-' : '+' ) + '=' + distance + 'px'; 1685 } 1686 1687 previous.wrap.animate(endPos, { 1688 duration : effect === 'none' ? 0 : previous.prevSpeed, 1689 easing : previous.prevEasing, 1690 complete : function () { 1691 $(this).trigger('onReset').remove(); 1692 } 1693 }); 1694 } 1695 }; 1696 1697 /* 1698 * Overlay helper 1699 */ 1700
1701 F.helpers.overlay = { 1702 defaults : { 1703 closeClick : true, // if true, fancyBox will be closed when user clicks on the overlay 1704 speedOut : 200, // duration of fadeOut animation 1705 showEarly : true, // indicates if should be opened immediately or wait until the content is ready 1706 css : {}, // custom CSS properties 1707 locked : !isTouch, // if true, the content will be locked into overlay 1708 fixed : true // if false, the overlay CSS position property will not be set to "fixed" 1709 }, 1710 1711 overlay : null, // current handle 1712 fixed : false, // indicates if the overlay has position "fixed" 1713 el : $('html'), // element that contains "the lock" 1714 1715 // Public methods 1716 create : function(opts) { 1717 opts = $.extend({}, this.defaults, opts); 1718 1719 if (this.overlay) { 1720 this.close(); 1721 } 1722 1723 this.overlay = $('<div class="fancybox-overlay"></div>').appendTo( F.coming ? F.coming.parent : opts.parent ); 1724 this.fixed = false; 1725 1726 if (opts.fixed && F.defaults.fixed) { 1727 this.overlay.addClass('fancybox-overlay-fixed'); 1728 1729 this.fixed = true; 1730 } 1731 }, 1732 1733 open : function(opts) { 1734 var that = this; 1735 1736 opts = $.extend({}, this.defaults, opts); 1737 1738 if (this.overlay) { 1739 this.overlay.unbind('.overlay').width('auto').height('auto'); 1740 1741 } else { 1742 this.create(opts); 1743 } 1744 1745 if (!this.fixed) { 1746 W.bind('resize.overlay', $.proxy( this.update, this) ); 1747 1748 this.update(); 1749 } 1750 1751 if (opts.closeClick) { 1752 this.overlay.bind('click.overlay', function(e) { 1753 if ($(e.target).hasClass('fancybox-overlay')) { 1754 if (F.isActive) { 1755 F.close(); 1756 } else { 1757 that.close(); 1758 } 1759 1760 return false; 1761 } 1762 }); 1763 } 1764 1765 this.overlay.css( opts.css ).show(); 1766 }, 1767 1768 close : function() { 1769 var scrollV, scrollH; 1770 1771 W.unbind('resize.overlay'); 1772 1773 if (this.el.hasClass('fancybox-lock')) { 1774 $('.fancybox-margin').removeClass('fancybox-margin'); 1775 1776 scrollV = W.scrollTop(); 1777 scrollH = W.scrollLeft(); 1778 1779 this.el.removeClass('fancybox-lock'); 1780 1781 W.scrollTop( scrollV ).scrollLeft( scrollH ); 1782 } 1783 1784 $('.fancybox-overlay').remove().hide(); 1785 1786 $.extend(this, { 1787 overlay : null, 1788 fixed : false 1789 }); 1790 }, 1791 1792 // Private, callbacks 1793 1794 update : function () { 1795 var width = '100%', offsetWidth; 1796 1797 // Reset width/height so it will not mess 1798 this.overlay.width(width).height('100%'); 1799 1800 // jQuery does not return reliable result for IE 1801 if (IE) { 1802 offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth); 1803 1804 if (D.width() > offsetWidth) { 1805 width = D.width(); 1806 } 1807 1808 } else if (D.width() > W.width()) { 1809 width = D.width(); 1810 } 1811 1812 this.overlay.width(width).height(D.height()); 1813 }, 1814 1815 // This is where we can manipulate DOM, because later it would cause iframes to reload 1816 onReady : function (opts, obj) { 1817 var overlay = this.overlay; 1818 1819 $('.fancybox-overlay').stop(true, true); 1820 1821 if (!overlay) { 1822 this.create(opts); 1823 } 1824 1825 if (opts.locked && this.fixed && obj.fixed) { 1826 if (!overlay) { 1827 this.margin = D.height() > W.height() ? $('html').css('margin-right').replace("px", "") : false; 1828 } 1829 1830 obj.locked = this.overlay.append( obj.wrap ); 1831 obj.fixed = false; 1832 } 1833 1834 if (opts.showEarly === true) { 1835 this.beforeShow.apply(this, arguments); 1836 } 1837 }, 1838 1839 beforeShow : function(opts, obj) { 1840 var scrollV, scrollH; 1841 1842 if (obj.locked) { 1843 if (this.margin !== false) { 1844 $('*').filter(function(){ 1845 return ($(this).css('position') === 'fixed' && !$(this).hasClass("fancybox-overlay") && !$(this).hasClass("fancybox-wrap") ); 1846 }).addClass('fancybox-margin'); 1847 1848 this.el.addClass('fancybox-margin'); 1849 } 1850 1851 scrollV = W.scrollTop(); 1852 scrollH = W.scrollLeft(); 1853 1854 this.el.addClass('fancybox-lock'); 1855 1856 W.scrollTop( scrollV ).scrollLeft( scrollH ); 1857 } 1858 1859 this.open(opts); 1860 }, 1861 1862 onUpdate : function() { 1863 if (!this.fixed) { 1864 this.update(); 1865 } 1866 }, 1867 1868 afterClose: function (opts) { 1869 // Remove overlay if exists and fancyBox is not opening 1870 // (e.g., it is not being open using afterClose callback) 1871 //if (this.overlay && !F.isActive) { 1872 if (this.overlay && !F.coming) { 1873 this.overlay.fadeOut(opts.speedOut, $.proxy( this.close, this )); 1874 } 1875 } 1876 }; 1877 1878 /* 1879 * Title helper 1880 */ 1881 1882 F.helpers.title = { 1883 defaults : { 1884 type : 'float', // 'float', 'inside', 'outside' or 'over', 1885 position : 'bottom' // 'top' or 'bottom' 1886 }, 1887 1888 beforeShow: function (opts) { 1889 var current = F.current, 1890 text = current.title, 1891 type = opts.type, 1892 title, 1893 target; 1894 1895 if ($.isFunction(text)) { 1896 text = text.call(current.element, current); 1897 } 1898 1899 if (!isString(text) || $.trim(text) === '') { 1900 return; 1901 } 1902 1903 title = $('<div class="fancybox-title fancybox-title-' + type + '-wrap">
1903' + text + '</div>'); 1904 1905 switch (type) { 1906 case 'inside': 1907 target = F.skin; 1908 break; 1909 1910 case 'outside': 1911 target = F.wrap; 1912 break; 1913 1914 case 'over': 1915 target = F.inner; 1916 break; 1917 1918 default: // 'float' 1919 target = F.skin; 1920 1921 title.appendTo('body'); 1922 1923 if (IE) { 1924 title.width( title.width() ); 1925 } 1926 1927 title.wrapInner('<span class="child"></span>'); 1928 1929 //Increase bottom margin so this title will also fit into viewport 1930 F.current.margin[2] += Math.abs( getScalar(title.css('margin-bottom')) ); 1931 break; 1932 } 1933 1934 title[ (opts.position === 'top' ? 'prependTo' : 'appendTo') ](target); 1935 } 1936 }; 1937 1938 // jQuery plugin initialization 1939 $.fn.fancybox = function (options) { 1940 var index, 1941 that = $(this), 1942 selector = this.selector || '', 1943 run = function(e) { 1944 var what = $(this).blur(), idx = index, relType, relVal; 1945 1946 if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !what.is('.fancybox-wrap')) { 1947 relType = options.groupAttr || 'data-fancybox-group'; 1948 relVal = what.attr(relType); 1949 1950 if (!relVal) { 1951 relType = 'rel'; 1952 relVal = what.get(0)[ relType ]; 1953 } 1954 1955 if (relVal && relVal !== '' && relVal !== 'nofollow') { 1956 what = selector.length ? $(selector) : that; 1957 what = what.filter('[' + relType + '="' + relVal + '"]'); 1958 idx = what.index(this); 1959 } 1960 1961 options.index = idx; 1962 1963 // Stop an event from bubbling if everything is fine 1964 if (F.open(what, options) !== false) { 1965 e.preventDefault(); 1966 } 1967 } 1968 }; 1969 1970 options = options || {}; 1971 index = options.index || 0; 1972 1973 if (!selector || options.live === false) { 1974 that.unbind('click.fb-start').bind('click.fb-start', run); 1975 1976 } else { 1977 D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run); 1978 } 1979 1980 this.filter('[data-fancybox-start=1]').trigger('click'); 1981 1982 return this; 1983 }; 1984 1985 // Tests that need a body at doc ready 1986 D.ready(function() { 1987 var w1, w2; 1988 1989 if ( $.scrollbarWidth === undefined ) { 1990 // http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth 1991 $.scrollbarWidth = function() { 1992 var parent = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body'), 1993 child = parent.children(), 1994 width = child.innerWidth() - child.height( 99 ).innerWidth(); 1995 1996 parent.remove(); 1997 1998 return width; 1999 }; 2000 } 2001 2002 if ( $.support.fixedPosition === undefined ) { 2003 $.support.fixedPosition = (function() { 2004 var elem = $('<div style="position:fixed;top:20px;"></div>').appendTo('body'), 2005 fixed = ( elem[0].offsetTop === 20 || elem[0].offsetTop === 15 ); 2006 2007 elem.remove(); 2008 2009 return fixed; 2010 }()); 2011 } 2012 2013 $.extend(F.defaults, { 2014 scrollbarWidth : $.scrollbarWidth(), 2015 fixed : $.support.fixedPosition, 2016 parent : $('body') 2017 }); 2018 2019 //Get real width of page scroll-bar 2020 w1 = $(window).width(); 2021 2022 H.addClass('fancybox-lock-test'); 2023 2024 w2 = $(window).width(); 2025 2026 H.removeClass('fancybox-lock-test'); 2027 2028 $("<style type='text/css'>.fancybox-margin{margin-right:" + (w2 - w1) + "px;}</style>").appendTo("head"); 2029 }); 2030 2031}(window, document, _4ORMAT.$)); 2032// CUSTOM 4ORMAT PLUGIN - MODIFIED SLIDE JS 2033 2034// Generated by CoffeeScript 1.6.1 2035(function() { 2036 2037 (function($, window, document) { 2038 var Plugin, defaults, pluginName; 2039 pluginName = "slidesjs"; 2040 defaults = { 2041 width: 940, 2042 height: 528, 2043 start: 1, 2044 navigation: { 2045 active: true, 2046 effect: "slide" 2047 }, 2048 pagination: { 2049 active: true, 2050 effect: "slide" 2051 }, 2052 play: { 2053 active: false, 2054 effect: "slide", 2055 interval: 5000, 2056 auto: false, 2057 swap: true, 2058 pauseOnHover: false, 2059 restartDelay: 2500 2060 }, 2061 effect: { 2062 slide: { 2063 speed: 500 2064 }, 2065 fade: { 2066 speed: 300, 2067 crossfade: true 2068 } 2069 }, 2070 callback: { 2071 loaded: function() {}, 2072 start: function() {}, 2073 complete: function() {} 2074 } 2075 }; 2076 Plugin = (function() { 2077 2078 function Plugin(element, options) { 2079 this.element = element; 2080 this.options = $.extend(true, {}, defaults, options); 2081 this._defaults = defaults; 2082 this._name = pluginName; 2083 this.init(); 2084 } 2085 2086 return Plugin; 2087 2088 })(); 2089 Plugin.prototype.init = function() { 2090 var $element, nextButton, pagination, playButton, prevButton, stopButton, 2091 _this = this; 2092 $element = $(this.element); 2093 this.data = $.data(this); 2094 $.data(this, "animating", false); 2095 $.data(this, "total", $element.children().not(".slidesjs-navigation", $element).length); 2096 $.data(this, "current", this.options.start - 1); 2097 $.data(this, "vendorPrefix", this._getVendorPrefix()); 2098 if (typeof TouchEvent !== "undefined") { 2099 $.data(this, "touch", true); 2100 this.options.effect.slide.speed = this.options.effect.slide.speed / 2; 2101 } 2102 $element.css({ 2103 overflow: "hidden" 2104 }); 2105 $element.slidesContainer = $element.children().not(".slidesjs-navigation", $element).wrapAll("<div class='slidesjs-container'>", $element).parent().css({ 2106 overflow: "hidden", 2107 position: "relative" 2108 }); 2109 $(".slidesjs-container", $element).wrapInner("<div class='slidesjs-control'>", $element).children(); 2110 $(".slidesjs-control", $element).css({ 2111 position: "relative", 2112 left: 0 2113 }); 2114 $(".slidesjs-control", $element).children().addClass("slidesjs-slide").css({ 2115 position: "absolute", 2116 top: 0, 2117 left: 0, 2118 width: "100%", 2119 display: "none", 2120 webkitBackfaceVisibility: "hidden" 2121 }); 2122 $.each($(".slidesjs-control", $element).children(), function(i) { 2123 var $slide; 2124 $slide = $(this); 2125 return $slide.attr("slidesjs-index", i); 2126 }); 2127 if (this.data.touch) { 2128 $(".slidesjs-control", $element).on("touchstart", function(e) { 2129 return _this._touchstart(e); 2130 }); 2131 $(".slidesjs-control", $element).on("touchmove", function(e) { 2132 return _this._touchmove(e); 2133 }); 2134 $(".slidesjs-control", $element).on("touchend", function(e) { 2135 return _this._touchend(e); 2136 }); 2137 } 2138 $element.fadeIn(0); 2139 this.update(); 2140 if (this.data.touch) { 2141 this._setuptouch(); 2142 } 2143 $(".slidesjs-control", $element).children(":eq(" + this.data.current + ")").eq(0).fadeIn(0, function() { 2144 return $(this); 2145 }); 2146 if (this.options.navigation.active) { 2147 prevButton = $("<a>", { 2148 "class": "slidesjs-previous slidesjs-navigation", 2149 href: "#", 2150 title: "Previous", 2151 text: "Previous" 2152 }).appendTo($element); 2153 nextButton = $("<a>", { 2154 "class": "slidesjs-next slidesjs-navigation", 2155 href: "#", 2156 // title: "Next", Removed by Mat 2157 text: "Next" 2158 }).appendTo($element); 2159 } 2160 $(".slidesjs-next", $element).click(function(e) { 2161 e.preventDefault(); 2162 _this.stop(true); 2163 return _this.next(_this.options.navigation.effect); 2164 }); 2165 $(".slidesjs-previous", $element).click(function(e) { 2166 e.preventDefault(); 2167 _this.stop(true); 2168 return _this.previous(_this.options.navigation.effect); 2169 }); 2170 if (this.options.play.active) { 2171 playButton = $("<a>", { 2172 "class": "slidesjs-play slidesjs-navigation", 2173 href: "#", 2174 title: "Play", 2175 text: "Play" 2176 }).appendTo($element); 2177 stopButton = $("<a>", { 2178 "class": "slidesjs-stop slidesjs-navigation", 2179 href: "#", 2180 title: "Stop", 2181 text: "Stop" 2182 }).appendTo($element); 2183 playButton.click(function(e) { 2184 e.preventDefault(); 2185 return _this.play(true); 2186 }); 2187 stopButton.click(function(e) { 2188 e.preventDefault(); 2189 return _this.stop(true); 2190 }); 2191 if (this.options.play.swap) { 2192 stopButton.css({ 2193 display: "none" 2194 }); 2195 } 2196 } 2197 if (this.options.pagination.active) { 2198 pagination = $("<ul>", { 2199 "class": "slidesjs-pagination" 2200 }).appendTo($element); 2201 $.each(new Array(this.data.total), function(i) { 2202 var paginationItem, paginationLink; 2203 paginationItem = $("<li>", { 2204 "class": "slidesjs-pagination-item" 2205 }).appendTo(pagination); 2206 paginationLink = $("<a>", { 2207 href: "#",
2208 "data-slidesjs-item": i, 2209 html: i + 1 2210 }).appendTo(paginationItem); 2211 return paginationLink.click(function(e) { 2212 e.preventDefault(); 2213 _this.stop(true); 2214 return _this.goto(($(e.currentTarget).attr("data-slidesjs-item") * 1) + 1); 2215 }); 2216 }); 2217 } 2218 $(window).bind("resize", function() { 2219 return _this.update(); 2220 }); 2221 this._setActive(); 2222 this._enough_to_scroll(); 2223 if (this.options.play.auto) { 2224 this.play(); 2225 } 2226 return this.options.callback.loaded(this.options.start); 2227 }; 2228 Plugin.prototype._setActive = function(number) { 2229 var $element, current; 2230 $element = $(this.element); 2231 this.data = $.data(this); 2232 current = number > -1 ? number : this.data.current; 2233 $(".active", $element).removeClass("active"); 2234 $(".slidesjs-pagination li:eq(" + current + ") a", $element).addClass("active"); 2235 }; 2236 Plugin.prototype._enough_to_scroll = function() { 2237 var $element = $(this.element); 2238 var offset = ($(".slidesjs-pagination li", $element).length * 64 - 4) - $('.slidesjs-container').width(); 2239 2240 if(offset < 0) { 2241 this.options.too_few = true; 2242 $('.slidesjs-pagination', $element).stop().animate({'left': -offset/2 + 'px'}, 200); 2243 } 2244 }; 2245 Plugin.prototype._centerThumbs = function(number) { 2246 var $element, current; 2247 $element = $(this.element); 2248 this.data = $.data(this); 2249 current = number > -1 ? number : this.data.current; 2250 // Mat - custom code: center thumbnails when images 2251 if (this.options.pagination.thumbs) { 2252 if(this.options.too_few) { return false; } 2253 2254 var current_slide = $(".slidesjs-pagination li:eq(" + current + ") a", $element); 2255 var offset = current_slide.parents('li').index() * current_slide.parents('li').width(); 2256 var test_val = $('.slidesjs-pagination', $element).width() - $('.slidesjs-container', $element).width(); 2257 2258 offset = offset - ($element.width() / 2) + (current_slide.width() / 2); 2259 2260 if(offset < 0) { offset = 0; } 2261 if(offset > test_val) { offset = test_val; } 2262 2263 $('.slidesjs-pagination', $element).stop().animate({'left': -offset + 'px'}, 200); 2264 } 2265 }; 2266 Plugin.prototype.update = function() { 2267 var $element, height, width; 2268 $element = $(this.element); 2269 this.data = $.data(this); 2270 $(".slidesjs-control", $element).children(":not(:eq(" + this.data.current + "))").css({ 2271 display: "none", 2272 left: 0 2273 }); 2274 width = $element.width(); 2275 height = (this.options.height / this.options.width) * width; 2276 this.options.width = width; 2277 this.options.height = height; 2278 // Mat : hack to add f_blog_post_images_slideshow_item_inner 2279 return $(".slidesjs-control, .slidesjs-container, .f_blog_post_images_slideshow_item_inner", $element).css({ 2280 width: width, 2281 height: height 2282 }); 2283 }; 2284 Plugin.prototype.next = function(effect) { 2285 var $element; 2286 $element = $(this.element); 2287 this.data = $.data(this); 2288 $.data(this, "direction", "next"); 2289 if (effect === void 0) { 2290 effect = this.options.navigation.effect; 2291 } 2292 if (effect === "fade") { 2293 return this._fade(); 2294 } else { 2295 return this._slide(); 2296 } 2297 }; 2298 Plugin.prototype.previous = function(effect) { 2299 var $element; 2300 $element = $(this.element); 2301 this.data = $.data(this); 2302 $.data(this, "direction", "previous"); 2303 if (effect === void 0) { 2304 effect = this.options.navigation.effect; 2305 } 2306 if (effect === "fade") { 2307 return this._fade(); 2308 } else { 2309 return this._slide(); 2310 } 2311 }; 2312 Plugin.prototype.goto = function(number) { 2313 var $element, effect; 2314 $element = $(this.element); 2315 this.data = $.data(this); 2316 if (effect === void 0) { 2317 effect = this.options.pagination.effect; 2318 } 2319 if (number > this.data.total) { 2320 number = this.data.total; 2321 } else if (number < 1) { 2322 number = 1; 2323 } 2324 if (typeof number === "number") { 2325 if (effect === "fade") { 2326 return this._fade(number); 2327 } else { 2328 return this._slide(number); 2329 } 2330 } else if (typeof number === "string") { 2331 if (number === "first") { 2332 if (effect === "fade") { 2333 return this._fade(0); 2334 } else { 2335 return this._slide(0); 2336 } 2337 } else if (number === "last") { 2338 if (effect === "fade") { 2339 return this._fade(this.data.total); 2340 } else { 2341 return this._slide(this.data.total); 2342 } 2343 } 2344 } 2345 }; 2346 Plugin.prototype._setuptouch = function() { 2347 var $element, next, previous, slidesControl; 2348 $element = $(this.element); 2349 this.data = $.data(this); 2350 slidesControl = $(".slidesjs-control", $element); 2351 next = this.data.current + 1; 2352 previous = this.data.current - 1; 2353 if (previous < 0) { 2354 previous = this.data.total - 1; 2355 } 2356 if (next > this.data.total - 1) { 2357 next = 0; 2358 } 2359 slidesControl.children(":eq(" + next + ")").css({ 2360 display: "block", 2361 left: this.options.width 2362 }); 2363 return slidesControl.children(":eq(" + previous + ")").css({ 2364 display: "block", 2365 left: -this.options.width 2366 }); 2367 }; 2368 Plugin.prototype._touchstart = function(e) { 2369 var $element, touches; 2370 $element = $(this.element); 2371 this.data = $.data(this); 2372 touches = e.originalEvent.touches[0]; 2373 this._setuptouch(); 2374 $.data(this, "touchtimer", Number(new Date())); 2375 $.data(this, "touchstartx", touches.pageX); 2376 $.data(this, "touchstarty", touches.pageY); 2377 return e.stopPropagation(); 2378 }; 2379 Plugin.prototype._touchend = function(e) { 2380 var $element, duration, prefix, slidesControl, timing, touches, transform, 2381 _this = this; 2382 $element = $(this.element); 2383 this.data = $.data(this); 2384 touches = e.originalEvent.touches[0]; 2385 slidesControl = $(".slidesjs-control", $element); 2386 if (slidesControl.position().left > this.options.width * 0.5 || slidesControl.position().left > this.options.width * 0.1 && (Number(new Date()) - this.data.touchtimer < 250)) { 2387 $.data(this, "direction", "previous"); 2388 this._slide(); 2389 } 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)) { 2390 $.data(this, "direction", "next"); 2391 this._slide(); 2392 } else { 2393 prefix = this.data.vendorPrefix; 2394 transform = prefix + "Transform"; 2395 duration = prefix + "TransitionDuration"; 2396 timing = prefix + "TransitionTimingFunction"; 2397 slidesControl[0].style[transform] = "translateX(0px)"; 2398 slidesControl[0].style[duration] = this.options.effect.slide.speed * 0.85 + "ms"; 2399 } 2400 slidesControl.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd", function() { 2401 prefix = _this.data.vendorPrefix; 2402 transform = prefix + "Transform"; 2403 duration = prefix + "TransitionDuration"; 2404 timing = prefix + "TransitionTimingFunction"; 2405 slidesControl[0].style[transform] = ""; 2406 slidesControl[0].style[duration] = ""; 2407 return slidesControl[0].style[timing] = ""; 2408 }); 2409 return e.stopPropagation(); 2410 }; 2411 Plugin.prototype._touchmove = function(e) { 2412 var $element, prefix, slidesControl, touches, transform; 2413 $element = $(this.element); 2414 this.data = $.data(this); 2415 touches = e.originalEvent.touches[0]; 2416 prefix = this.data.vendorPrefix; 2417 slidesControl = $(".slidesjs-control", $element); 2418 transform = prefix + "Transform"; 2419 $.data(this, "scrolling", Math.abs(touches.pageX - this.data.touchstartx) < Math.abs(touches.pageY - this.data.touchstarty)); 2420 if (!this.data.animating && !this.data.scrolling) { 2421 e.preventDefault(); 2422 this._setuptouch();
2423 slidesControl[0].style[transform] = "translateX(" + (touches.pageX - this.data.touchstartx) + "px)"; 2424 } 2425 return e.stopPropagation(); 2426 }; 2427 Plugin.prototype.play = function(next) { 2428 var $element, currentSlide, slidesContainer, 2429 _this = this; 2430 $element = $(this.element); 2431 this.data = $.data(this); 2432 if (!this.data.playInterval) { 2433 if (next) { 2434 currentSlide = this.data.current; 2435 this.data.direction = "next"; 2436 if (this.options.play.effect === "fade") { 2437 this._fade(); 2438 } else { 2439 this._slide(); 2440 } 2441 } 2442 $.data(this, "playInterval", setInterval((function() { 2443 currentSlide = _this.data.current; 2444 _this.data.direction = "next"; 2445 if (_this.options.play.effect === "fade") { 2446 return _this._fade(); 2447 } else { 2448 return _this._slide(); 2449 } 2450 }), this.options.play.interval)); 2451 slidesContainer = $(".slidesjs-container", $element); 2452 if (this.options.play.pauseOnHover) { 2453 slidesContainer.unbind(); 2454 slidesContainer.bind("mouseenter", function() { 2455 return _this.stop(); 2456 }); 2457 slidesContainer.bind("mouseleave", function() { 2458 if (_this.options.play.restartDelay) { 2459 return $.data(_this, "restartDelay", setTimeout((function() { 2460 return _this.play(true); 2461 }), _this.options.play.restartDelay)); 2462 } else { 2463 return _this.play(); 2464 } 2465 }); 2466 } 2467 $.data(this, "playing", true); 2468 $(".slidesjs-play", $element).addClass("slidesjs-playing"); 2469 if (this.options.play.swap) { 2470 $(".slidesjs-play", $element).hide(); 2471 return $(".slidesjs-stop", $element).show(); 2472 } 2473 } 2474 }; 2475 Plugin.prototype.stop = function(clicked) { 2476 var $element; 2477 $element = $(this.element); 2478 this.data = $.data(this); 2479 clearInterval(this.data.playInterval); 2480 if (this.options.play.pauseOnHover && clicked) { 2481 $(".slidesjs-container", $element).unbind(); 2482 } 2483 $.data(this, "playInterval", null); 2484 $.data(this, "playing", false); 2485 $(".slidesjs-play", $element).removeClass("slidesjs-playing"); 2486 if (this.options.play.swap) { 2487 $(".slidesjs-stop", $element).hide(); 2488 return $(".slidesjs-play", $element).show(); 2489 } 2490 }; 2491 Plugin.prototype._slide = function(number) { 2492 var $element, currentSlide, direction, duration, next, prefix, slidesControl, timing, transform, value, 2493 _this = this; 2494 $element = $(this.element); 2495 this.data = $.data(this); 2496 if (!this.data.animating && number !== this.data.current + 1) { 2497 $.data(this, "animating", true); 2498 currentSlide = this.data.current; 2499 if (number > -1) { 2500 number = number - 1; 2501 value = number > currentSlide ? 1 : -1; 2502 direction = number > currentSlide ? -this.options.width : this.options.width; 2503 next = number; 2504 } else { 2505 value = this.data.direction === "next" ? 1 : -1; 2506 direction = this.data.direction === "next" ? -this.options.width : this.options.width; 2507 next = currentSlide + value; 2508 } 2509 if (next === -1) { 2510 next = this.data.total - 1; 2511 } 2512 if (next === this.data.total) { 2513 next = 0; 2514 } 2515 this._setActive(next); 2516 this._centerThumbs(next); 2517 slidesControl = $(".slidesjs-control", $element); 2518 if (number > -1) { 2519 slidesControl.children(":not(:eq(" + currentSlide + "))").css({ 2520 display: "none", 2521 left: 0 2522 }); 2523 } 2524 slidesControl.children(":eq(" + next + ")").css({ 2525 display: "block", 2526 left: value * this.options.width 2527 }); 2528 this.options.callback.start(currentSlide + 1); 2529 if (this.data.vendorPrefix) { 2530 prefix = this.data.vendorPrefix; 2531 transform = prefix + "Transform"; 2532 duration = prefix + "TransitionDuration"; 2533 timing = prefix + "TransitionTimingFunction";
2534 slidesControl[0].style[transform] = "translateX(" + direction + "px)"; 2535 slidesControl[0].style[duration] = this.options.effect.slide.speed + "ms"; 2536 return slidesControl.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd", function() { 2537 slidesControl[0].style[transform] = ""; 2538 slidesControl[0].style[duration] = ""; 2539 slidesControl.children(":eq(" + next + ")").css({ 2540 left: 0 2541 }); 2542 slidesControl.children(":eq(" + currentSlide + ")").css({ 2543 display: "none", 2544 left: 0 2545 }); 2546 $.data(_this, "current", next); 2547 $.data(_this, "animating", false); 2548 slidesControl.unbind("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd"); 2549 slidesControl.children(":not(:eq(" + next + "))").css({ 2550 display: "none", 2551 left: 0 2552 }); 2553 if (_this.data.touch) { 2554 _this._setuptouch(); 2555 } 2556 return _this.options.callback.complete(next + 1); 2557 }); 2558 } else { 2559 return slidesControl.stop().animate({ 2560 left: direction 2561 }, this.options.effect.slide.speed, (function() { 2562 slidesControl.css({ 2563 left: 0 2564 }); 2565 slidesControl.children(":eq(" + next + ")").css({ 2566 left: 0 2567 }); 2568 return slidesControl.children(":eq(" + currentSlide + ")").css({ 2569 display: "none", 2570 left: 0 2571 }, $.data(_this, "current", next), $.data(_this, "animating", false), _this.options.callback.complete(next + 1)); 2572 })); 2573 } 2574 } 2575 }; 2576 Plugin.prototype._fade = function(number) { 2577 var $element, currentSlide, next, slidesControl, value, 2578 _this = this; 2579 $element = $(this.element); 2580 this.data = $.data(this); 2581 if (!this.data.animating && number !== this.data.current + 1) { 2582 $.data(this, "animating", true); 2583 currentSlide = this.data.current; 2584 if (number) { 2585 number = number - 1; 2586 value = number > currentSlide ? 1 : -1; 2587 next = number; 2588 } else { 2589 value = this.data.direction === "next" ? 1 : -1; 2590 next = currentSlide + value; 2591 } 2592 if (next === -1) { 2593 next = this.data.total - 1; 2594 } 2595 if (next === this.data.total) { 2596 next = 0; 2597 } 2598 this._setActive(next); 2599 this._centerThumbs(next); 2600 slidesControl = $(".slidesjs-control", $element); 2601 slidesControl.children(":eq(" + next + ")").css({ 2602 display: "none", 2603 left: 0 2604 }); 2605 this.options.callback.start(currentSlide + 1); 2606 if (this.options.effect.fade.crossfade) { 2607 slidesControl.children(":eq(" + this.data.current + ")").stop().fadeOut(this.options.effect.fade.speed); 2608 return slidesControl.children(":eq(" + next + ")").stop().fadeIn(this.options.effect.fade.speed, (function() { 2609 slidesControl.children(":eq(" + next + ")"); 2610 $.data(_this, "animating", false); 2611 $.data(_this, "current", next); 2612 return _this.options.callback.complete(next + 1); 2613 })); 2614 } else { 2615 return slidesControl.children(":eq(" + currentSlide + ")").stop().fadeOut(this.options.effect.fade.speed, (function() { 2616 slidesControl.children(":eq(" + next + ")").stop().fadeIn(_this.options.effect.fade.speed, (function() { 2617 return slidesControl.children(":eq(" + next + ")"); 2618 })); 2619 $.data(_this, "animating", false); 2620 $.data(_this, "current", next); 2621 return _this.options.callback.complete(next + 1); 2622 })); 2623 } 2624 } 2625 }; 2626 Plugin.prototype._getVendorPrefix = function() { 2627 var body, i, style, transition, vendor; 2628 body = document.body || document.documentElement; 2629 style = body.style; 2630 transition = "transition"; 2631 vendor = ["Moz", "Webkit", "Khtml", "O", "ms"]; 2632 transition = transition.charAt(0).toUpperCase() + transition.substr(1); 2633 i = 0; 2634 while (i < vendor.length) { 2635 if (typeof style[vendor[i] + transition] === "string") { 2636 return vendor[i]; 2637 } 2638 i++; 2639 } 2640 return false;
2641 }; 2642 return $.fn[pluginName] = function(options) { 2643 return this.each(function() { 2644 if (!$.data(this, "plugin_" + pluginName)) { 2645 return $.data(this, "plugin_" + pluginName, new Plugin(this, options)); 2646 } 2647 }); 2648 }; 2649 })(_4ORMAT.$, window, document); 2650 2651}).call(this); 2652 2653 2654 2655 2656_4ORMAT.$(function() { 2657 var $ = _4ORMAT.$; 2658 $('.f_blog_post_image_hoverwrap').fancybox({ 2659 padding: 0, 2660 arrows: false, 2661 loop: false, 2662 nextClick: true, 2663 helpers: { 2664 overlay: { 2665 locked: false 2666 } 2667 }, 2668 afterShow: function() { 2669 $('.fancybox-close').attr('data-no-turbolink', ''); 2670 $('.fancybox-title').after('<a href="javascript:void(0)" class="fancybox-title-toggle" data-no-turbolink>toggle</a>'); 2671 $('.fancybox-title-toggle').on('click', fancy_box_toggle); 2672 } 2673 }); 2674 2675 $('.f_blog_post_images_slideshow').each(function() { 2676 var slideshow = $(this); 2677 var width = $('.f_blog_post_images_slideshow_item_inner').length; // 1px padding on each item 2678 slideshow.slidesjs({ 2679 width: 700, 2680 height: 467, 2681 effect: { 2682 slide: { 2683 speed: 1000 2684 } 2685 }, 2686 pagination: { 2687 active: true, 2688 thumbs: true 2689 }, 2690 callback: { 2691 loaded: function(number) { 2692 // block right click on next slider <a> overlay if image protection is enabled. 2693 if (_4ORMAT.ImageProtection.is_enabled()) slideshow.on('contextmenu', '.slidesjs-navigation', _4ORMAT.ImageProtection.trap); 2694 //Make sure turbolinks doesnt mess with the thumbs 2695 $('.slidesjs-pagination-item').children('a').attr('data-no-turbolink', ''); 2696 var num_thumbs = slideshow.find('.f_blog_post_images_slideshow_item_inner').length; 2697 slideshow.find('.slidesjs-pagination').width( 64 * num_thumbs - 4 ); 2698 slideshow.find('.f_blog_post_images_slideshow_item_inner').each(function(i) { 2699 var is_active = i == 0 ? '.active' : ''; 2700 slideshow.find('.slidesjs-pagination li:eq(' + i + ') a' + is_active).html('<img src="' + ($(this).find('img').data('thumb') || $(this).find('img').attr('src')) + '" />'); 2701 }); 2702 slideshow.find('.slidesjs-control').after("<a href='javascript:void(0);' class='f_blog_post_images_slideshow_caption_toggle' data-no-turbolink>toggle</a>"); 2703 slideshow.find('.f_blog_post_images_slideshow_caption_toggle').click(function() { 2704 var active_slide = slideshow.find('.slidesjs-pagination-item .active').parent().index(); 2705 slideshow.find('.slidesjs-slide').eq(active_slide).find('.f_blog_post_images_slideshow_caption').toggleClass('show'); 2706 $(this).toggleClass('f_close_icon'); 2707 }); 2708 if(slideshow.find('.f_blog_post_images_slideshow_item').eq(0).find('.f_blog_post_images_slideshow_caption').length) { 2709 slideshow.find('.f_blog_post_images_slideshow_caption_toggle').addClass('show'); 2710 } else { 2711 slideshow.find('.f_blog_post_images_slideshow_caption_toggle').removeClass('show'); 2712 } 2713 if($('html').hasClass('ie8')) { $(".slidesjs-pagination li:last-child a").css('padding-right', '0'); } 2714 }, 2715 start: function(number) { 2716 var $slide_item = slideshow.find('.f_blog_post_images_slideshow_item').eq(number - 1); 2717 if($slide_item.find('.f_blog_post_images_slideshow_caption').length) { 2718 slideshow.find('.f_blog_post_images_slideshow_caption_toggle').removeClass('f_close_icon'); 2719 } 2720 slideshow.find('.slidesjs-slide .f_blog_post_images_slideshow_caption').removeClass('show'); 2721 }, 2722 complete: function(number) { 2723 var $slide_item = slideshow.find('.f_blog_post_images_slideshow_item').eq(number - 1); 2724 if($slide_item.find('.f_blog_post_images_slideshow_caption').length) { 2725 slideshow.find('.f_blog_post_images_slideshow_caption_toggle').removeClass('f_close_icon'); 2726 slideshow.find('.f_blog_post_images_slideshow_caption_toggle').addClass('show'); 2727 } else { 2728 slideshow.find('.f_blog_post_images_slideshow_caption_toggle').removeClass('show'); 2729 setTimeout(function() { 2730 slideshow.find('.f_blog_post_images_slideshow_caption_toggle').removeClass('f_close_icon'); 2731 }, 350); 2732 } 2733 } 2734 } 2735 }); 2736 slideshow.find('.slidesjs-pagination').wrap('<div class="slidesjs-pagination-wrapper"></div>'); 2737 }); 2738 2739 if (_4ORMAT.ImageProtection.is_enabled()) { 2740 $('.f_blog_post_image_hoverwrap').on('click', function(e) { 2741 if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey) { return false; } 2742 }); 2743 _4ORMAT.$('body').delegate('.f_blog_post_image_hoverwrap', 'contextmenu', _4ORMAT.ImageProtection.trap); 2744 } 2745 2746 function addFluidWrapperToIframes() { 2747 $(".f_blog_wrapper iframe").each(function () { 2748 var $frame_elem = $(this); 2749 if ($frame_elem.parent(".fluid-width-video-wrapper, .js-reframe, .ratio-container").length) { 2750 return; 2751 } 2752 $frame_elem.wrap("<div class='iframe-wrapper'></div>"); 2753 }); 2754 } 2755 2756 $(window).load(function () { 2757 addFluidWrapperToIframes(); 2758 $(".f_blog_post_images_intelligent").each(function () { 2759 var msnry = new Masonry($(this)[0], { 2760 itemSelector: '.f_blog_post_image_hoverwrap' 2761 }); 2762 }); 2763 }); 2764}); 2765 2766var fancy_box_toggle = function() { 2767 var $ = _4ORMAT.$; 2768 $(this).prev().toggleClass('show'); 2769 $(this).toggleClass('f_close_icon'); 2770} 2771;
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.