1/*! 2 * FANCYBOX - jQuery Plugin 3 * version: 2.1.5 (Fri, 14 Jun 2013) 4 * @requires jQuery v1.6 or later 5 * 6 * Examples at http://fancyapps.com/fancybox/ 7 * License: www.fancyapps.com/fancybox/#license 8 * 9 * Copyright 2012 Janis Skarnelis - [email protected] 10 * 11 */ 12(function(e, t, n, r) { 13 "use strict"; 14 var i = n("html"), 15 s = n(e), 16 o = n(t), 17 u = n.esgbox = function() { 18 u.open.apply(this, arguments) 19 }, 20 a = navigator.userAgent.match(/msie/i), 21 f = null, 22 l = t.createTouch !== r, 23 c = function(e) { 24 return e && e.hasOwnProperty && e instanceof n 25 }, 26 h = function(e) { 27 return e && n.type(e) === "string" 28 }, 29 p = function(e) { 30 return h(e) && e.indexOf("%") > 0 31 }, 32 d = function(e) { 33 return e && !(e.style.overflow && e.style.overflow === "hidden") && (e.clientWidth && e.scrollWidth > e.clientWidth || e.clientHeight && e.scrollHeight > e.clientHeight) 34 }, 35 v = function(e, t) { 36 var n = parseInt(e, 10) || 0; 37 if (t && p(e)) { 38 n = u.getViewport()[t] / 100 * n 39 } 40 return Math.ceil(n) 41 }, 42 m = function(e, t) { 43 return v(e, t) + "px" 44 }; 45 n.extend(u, { 46 version: "2.1.5", 47 defaults: { 48 padding: 15, 49 margin: 20, 50 width: 800, 51 height: 600, 52 minWidth: 100, 53 minHeight: 100, 54 maxWidth: 9999, 55 maxHeight: 9999, 56 pixelRatio: 1, 57 autoSize: true, 58 autoHeight: false, 59 autoWidth: false, 60 autoResize: true, 61 autoCenter: !l, 62 fitToView: true, 63 aspectRatio: false, 64 topRatio: .5, 65 leftRatio: .5, 66 scrolling: "auto", 67 wrapCSS: "", 68 arrows: true, 69 closeBtn: true, 70 closeClick: false, 71 nextClick: false, 72 mouseWheel: true, 73 autoPlay: false, 74 playSpeed: 3e3, 75 preload: 3, 76 modal: false, 77 loop: true, 78 ajax: { 79 dataType: "html", 80 headers: { 81 "X-esgbox": true 82 } 83 }, 84 iframe: { 85 scrolling: "auto", 86 preload: true 87 }, 88 swf: { 89 wmode: "transparent", 90 allowfullscreen: "true", 91 allowscriptaccess: "always" 92 }, 93 keys: { 94 next: { 95 13: "left", 96 34: "up", 97 39: "left", 98 40: "up" 99 }, 100 prev: { 101 8: "right", 102 33: "down", 103 37: "right", 104 38: "down" 105 }, 106 close: [27], 107 play: [32], 108 toggle: [70] 109 }, 110 direction: { 111 next: "left", 112 prev: "right" 113 }, 114 scrollOutside: true, 115 index: 0, 116 type: null, 117 href: null, 118 content: null, 119 title: null, 120 tpl: { 121 wrap: '<div class="esgbox-wrap" tabIndex="-1"><div class="esgbox-skin"><div class="esgbox-outer"><div class="esgbox-inner"></div></div></div></div>', 122 image: '<img class="esgbox-image" src="{href}" alt="" />', 123 iframe: '<iframe id="esgbox-frame{rnd}" name="esgbox-frame{rnd}" class="esgbox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen' + (a ? ' allowtransparency="true"' : "") + "></iframe>", 124 error: '<p class="esgbox-error">The requested content cannot be loaded.<br/>Please try again later.</p>', 125 closeBtn: '<a title="Close" class="esgbox-item esgbox-close" href="javascript:;"></a>', 126 next: '<a title="Next" class="esgbox-nav esgbox-next" href="javascript:;"><span></span></a>', 127 prev: '<a title="Previous" class="esgbox-nav esgbox-prev" href="javascript:;"><span></span></a>' 128 }, 129 openEffect: "fade", 130 openSpeed: 250, 131 openEasing: "swing", 132 openOpacity: true, 133 openMethod: "zoomIn", 134 closeEffect: "fade", 135 closeSpeed: 250, 136 closeEasing: "swing", 137 closeOpacity: true, 138 closeMethod: "zoomOut", 139 nextEffect: "elastic", 140 nextSpeed: 250, 141 nextEasing: "swing", 142 nextMethod: "changeIn", 143 prevEffect: "elastic", 144 prevSpeed: 250, 145 prevEasing: "swing", 146 prevMethod: "changeOut", 147 helpers: { 148 overlay: true, 149 title: true 150 }, 151 onCancel: n.noop, 152 beforeLoad: n.noop, 153 afterLoad: n.noop, 154 beforeShow: n.noop, 155 afterShow: n.noop, 156 beforeChange: n.noop, 157 beforeClose: n.noop, 158 afterClose: n.noop 159 }, 160 group: {}, 161 opts: {}, 162 previous: null, 163 coming: null, 164 current: null, 165 isActive: false, 166 isOpen: false, 167 isOpened: false, 168 wrap: null, 169 skin: null, 170 outer: null, 171 inner: null, 172 player: { 173 timer: null, 174 isActive: false 175 }, 176 ajaxLoad: null, 177 imgPreload: null, 178 transitions: {}, 179 helpers: {}, 180 open: function(e, t) { 181 if (!e) { 182 return 183 } 184 if (!n.isPlainObject(t)) { 185 t = {} 186 } 187 if (false === u.close(true)) { 188 return 189 } 190 if (!n.isArray(e)) { 191 e = c(e) ? n(e).get() : [e] 192 } 193 n.each(e, function(i, s) { 194 var o = {}, 195 a, f, l, p, d, v, m; 196 if (n.type(s) === "object") { 197 if (s.nodeType) { 198 s = n(s) 199 } 200 if (c(s)) { 201 o = { 202 href: s.data("esgbox-href") || s.attr("href"), 203 title: s.data("esgbox-title") || s.attr("title"), 204 isDom: true, 205 element: s 206 }; 207 if (n.metadata) { 208 n.extend(true, o, s.metadata()) 209 } 210 } else { 211 o = s 212 } 213 } 214 a = t.href || o.href || (h(s) ? s : null); 215 f = t.title !== r ? t.title : o.title || ""; 216 l = t.content || o.content; 217 p = l ? "html" : t.type || o.type; 218 if (!p && o.isDom) { 219 p = s.data("esgbox-type"); 220 if (!p) { 221 d = s.prop("class").match(/esgbox\.(\w+)/); 222 p = d ? d[1] : null 223 } 224 } 225 if (h(a)) { 226 if (!p) { 227 if (u.isImage(a)) { 228 p = "image" 229 } else if (u.isSWF(a)) { 230 p = "swf" 231 } else if (a.charAt(0) === "#") { 232 p = "inline" 233 } else if (h(s)) { 234 p = "html"; 235 l = s 236 } 237 } 238 if (p === "ajax") { 239 v = a.split(/\s+/, 2); 240 a = v.shift(); 241 m = v.shift() 242 } 243 } 244 if (!l) { 245 if (p === "inline") { 246 if (a) { 247 l = n(h(a) ? a.replace(/.*(?=#[^\s]+$)/, "") : a) 248 } else if (o.isDom) { 249 l = s 250 } 251 } else if (p === "html") { 252 l = a 253 } else if (!p && !a && o.isDom) { 254 p = "inline"; 255 l = s 256 } 257 } 258 n.extend(o, { 259 href: a, 260 type: p, 261 content: l, 262 title: f, 263 selector: m 264 }); 265 e[i] = o 266 }); 267 u.opts = n.extend(true, {}, u.defaults, t); 268 if (t.keys !== r) { 269 u.opts.keys = t.keys ? n.extend({}, u.defaults.keys, t.keys) : false 270 } 271 u.group = e; 272 return u._start(u.opts.index) 273 }, 274 cancel: function() { 275 var e = u.coming; 276 if (!e || false === u.trigger("onCancel")) { 277 return 278 } 279 u.hideLoading(); 280 if (u.ajaxLoad) { 281 u.ajaxLoad.abort() 282 } 283 u.ajaxLoad = null; 284 if (u.imgPreload) { 285 u.imgPreload.onload = u.imgPreload.onerror = null 286 } 287 if (e.wrap) {
288 e.wrap.stop(true, true).trigger("onReset").remove() 289 } 290 u.coming = null; 291 if (!u.current) { 292 u._afterZoomOut(e) 293 } 294 }, 295 close: function(e) { 296 u.cancel(); 297 if (false === u.trigger("beforeClose")) { 298 return 299 } 300 u.unbindEvents(); 301 if (!u.isActive) { 302 return 303 } 304 if (!u.isOpen || e === true) { 305 n(".esgbox-wrap").stop(true).trigger("onReset").remove(); 306 u._afterZoomOut() 307 } else { 308 u.isOpen = u.isOpened = false; 309 u.isClosing = true; 310 n(".esgbox-item, .esgbox-nav").remove(); 311 u.wrap.stop(true, true).removeClass("esgbox-opened"); 312 u.transitions[u.current.closeMethod]() 313 } 314 }, 315 play: function(e) { 316 var t = function() { 317 clearTimeout(u.player.timer) 318 }, 319 n = function() { 320 t(); 321 if (u.current && u.player.isActive) { 322 u.player.timer = setTimeout(u.next, u.current.playSpeed) 323 } 324 }, 325 r = function() { 326 t(); 327 o.unbind(".player"); 328 u.player.isActive = false; 329 u.trigger("onPlayEnd") 330 }, 331 i = function() { 332 if (u.current && (u.current.loop || u.current.index < u.group.length - 1)) { 333 u.player.isActive = true; 334 o.bind({ 335 "onCancel.player beforeClose.player": r, 336 "onUpdate.player": n, 337 "beforeLoad.player": t 338 }); 339 n(); 340 u.trigger("onPlayStart") 341 } 342 }; 343 if (e === true || !u.player.isActive && e !== false) { 344 i() 345 } else { 346 r() 347 } 348 }, 349 next: function(e) { 350 var t = u.current; 351 if (t) { 352 if (!h(e)) { 353 e = t.direction.next 354 } 355 u.jumpto(t.index + 1, e, "next") 356 } 357 }, 358 prev: function(e) { 359 var t = u.current; 360 if (t) { 361 if (!h(e)) { 362 e = t.direction.prev 363 } 364 u.jumpto(t.index - 1, e, "prev") 365 } 366 }, 367 jumpto: function(e, t, n) { 368 var i = u.current; 369 if (!i) { 370 return 371 } 372 e = v(e); 373 u.direction = t || i.direction[e >= i.index ? "next" : "prev"]; 374 u.router = n || "jumpto"; 375 if (i.loop) { 376 if (e < 0) { 377 e = i.group.length + e % i.group.length 378 } 379 e = e % i.group.length 380 } 381 if (i.group[e] !== r) { 382 u.cancel(); 383 u._start(e) 384 } 385 }, 386 reposition: function(e, t) { 387 var r = u.current, 388 i = r ? r.wrap : null, 389 s; 390 if (i) { 391 s = u._getPosition(t); 392 if (e && e.type === "scroll") { 393 delete s.position; 394 i.stop(true, true).animate(s, 200) 395 } else { 396 i.css(s); 397 r.pos = n.extend({}, r.dim, s) 398 } 399 } 400 }, 401 update: function(e) { 402 var t = e && e.type, 403 n = !t || t === "orientationchange"; 404 if (n) { 405 clearTimeout(f); 406 f = null 407 } 408 if (!u.isOpen || f) { 409 return 410 } 411 f = setTimeout(function() { 412 var r = u.current; 413 if (!r || u.isClosing) { 414 return 415 } 416 u.wrap.removeClass("esgbox-tmp"); 417 if (n || t === "load" || t === "resize" && r.autoResize) { 418 u._setDimension() 419 } 420 if (!(t === "scroll" && r.canShrink)) { 421 u.reposition(e) 422 } 423 u.trigger("onUpdate"); 424 f = null 425 }, n && !l ? 0 : 300) 426 }, 427 toggle: function(e) { 428 if (u.isOpen) { 429 u.current.fitToView = n.type(e) === "boolean" ? e : !u.current.fitToView; 430 if (l) { 431 u.wrap.removeAttr("style").addClass("esgbox-tmp"); 432 u.trigger("onUpdate") 433 }
434 u.update() 435 } 436 }, 437 hideLoading: function() { 438 o.unbind(".loading"); 439 n("#esgbox-loading").remove() 440 }, 441 showLoading: function() { 442 var e, t; 443 u.hideLoading(); 444 e = n('<div id="esgbox-loading"><div></div></div>').click(u.cancel).appendTo("body"); 445 o.bind("keydown.loading", function(e) { 446 if ((e.which || e.keyCode) === 27) { 447 e.preventDefault(); 448 u.cancel() 449 } 450 }); 451 if (!u.defaults.fixed) { 452 t = u.getViewport(); 453 e.css({ 454 position: "absolute", 455 top: t.h * .5 + t.y, 456 left: t.w * .5 + t.x 457 }) 458 } 459 }, 460 getViewport: function() { 461 var t = u.current && u.current.locked || false, 462 n = { 463 x: s.scrollLeft(), 464 y: s.scrollTop() 465 }; 466 if (t) { 467 n.w = t[0].clientWidth; 468 n.h = t[0].clientHeight 469 } else { 470 n.w = l && e.innerWidth ? e.innerWidth : s.width(); 471 n.h = l && e.innerHeight ? e.innerHeight : s.height() 472 } 473 return n 474 }, 475 unbindEvents: function() { 476 if (u.wrap && c(u.wrap)) { 477 u.wrap.unbind(".fb") 478 } 479 o.unbind(".fb"); 480 s.unbind(".fb") 481 }, 482 bindEvents: function() { 483 var e = u.current, 484 t; 485 if (!e) { 486 return 487 } 488 s.bind("orientationchange.fb" + (l ? "" : " resize.fb") + (e.autoCenter && !e.locked ? " scroll.fb" : ""), u.update); 489 t = e.keys; 490 if (t) { 491 o.bind("keydown.fb", function(i) { 492 var s = i.which || i.keyCode, 493 o = i.target || i.srcElement; 494 if (s === 27 && u.coming) { 495 return false 496 } 497 if (!i.ctrlKey && !i.altKey && !i.shiftKey && !i.metaKey && !(o && (o.type || n(o).is("[contenteditable]")))) { 498 n.each(t, function(t, o) { 499 if (e.group.length > 1 && o[s] !== r) { 500 u[t](o[s]); 501 i.preventDefault(); 502 return false 503 } 504 if (n.inArray(s, o) > -1) { 505 u[t](); 506 i.preventDefault(); 507 return false 508 } 509 }) 510 } 511 }) 512 } 513 if (n.fn.mousewheel && e.mouseWheel) { 514 u.wrap.bind("mousewheel.fb", function(t, r, i, s) { 515 var o = t.target || null, 516 a = n(o), 517 f = false; 518 while (a.length) { 519 if (f || a.is(".esgbox-skin") || a.is(".esgbox-wrap")) { 520 break 521 } 522 f = d(a[0]); 523 a = n(a).parent() 524 } 525 if (r !== 0 && !f) { 526 if (u.group.length > 1 && !e.canShrink) { 527 if (s > 0 || i > 0) { 528 u.prev(s > 0 ? "down" : "left") 529 } else if (s < 0 || i < 0) { 530 u.next(s < 0 ? "up" : "right") 531 } 532 t.preventDefault() 533 } 534 } 535 }) 536 } 537 }, 538 trigger: function(e, t) { 539 var r, i = t || u.coming || u.current; 540 if (!i) { 541 return 542 } 543 if (n.isFunction(i[e])) { 544 r = i[e].apply(i, Array.prototype.slice.call(arguments, 1)) 545 } 546 if (r === false) { 547 return false 548 } 549 if (i.helpers) { 550 n.each(i.helpers, function(t, r) { 551 if (r && u.helpers[t] && n.isFunction(u.helpers[t][e])) { 552 u.helpers[t][e](n.extend(true, {}, u.helpers[t].defaults, r), i) 553 } 554 }) 555 } 556 o.trigger(e) 557 }, 558 isImage: function(e) { 559 return h(e) && e.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i) 560 }, 561 isSWF: function(e) { 562 return h(e) && e.match(/\.(swf)((\?|#).*)?$/i) 563 }, 564 _start: function(e) { 565 var t = {}, 566 r, i, s, o, a; 567 568 569 //HACK FROM THEMEPUNCH 570 e = v(e); 571 r = u.group[e] || null; 572 var r_id = jQuery(r.element[0].parentNode).closest('.tp-esg-item'); 573 r_id = r_id.length>0 && r_id!==undefined ? r_id.attr('id') : "rnoid_0"; 574 if (!r) { 575 return false 576 } 577 var _tpgroup = new Array(); 578 jQuery.each(u.group,function(_i,el) { 579 var exists = false, 580 el_id = jQuery(el.element[0].parentNode).closest('.tp-esg-item'); 581 el_id = el_id.length>0 && el_id!==undefined ? el_id.attr('id') : "noid_0"; 582 583 jQuery.each(_tpgroup,function(_j,cel) { 584 var cel_id = jQuery(cel.element[0].parentNode).closest('.tp-esg-item'); 585 cel_id = cel_id.length>0 && cel_id!==undefined ? cel_id.attr('id') : "cel_noid_0"; 586 if (exists === false && cel.href === el.href && cel_id === el_id) exists = true; 587 }) 588 if (!exists) { 589 _tpgroup.push(el); 590 if (el.href===r.href && r_id === el_id) 591 e = _tpgroup.length-1; 592 } 593 }); 594 u.group = _tpgroup; 595 // END OF HACK FROM THEMEPUNCH 596 e = v(e); 597 r = u.group[e] || null; 598 599 if (!r) { 600 return false 601 } 602 t = n.extend(true, {}, u.opts, r); 603 604 605 o = t.margin; 606 a = t.padding; 607 if (n.type(o) === "number") { 608 t.margin = [o, o, o, o] 609 } 610 if (n.type(a) === "number") { 611 t.padding = [a, a, a, a] 612 } 613 if (t.modal) { 614 n.extend(true, t, { 615 closeBtn: false, 616 closeClick: false, 617 nextClick: false,
618 arrows: false, 619 mouseWheel: false, 620 keys: null, 621 helpers: { 622 overlay: { 623 closeClick: false 624 } 625 } 626 }) 627 } 628 if (t.autoSize) { 629 t.autoWidth = t.autoHeight = true 630 } 631 if (t.width === "auto") { 632 t.autoWidth = true 633 } 634 if (t.height === "auto") { 635 t.autoHeight = true 636 } 637 638 639 t.group = u.group; 640 641 642 643 t.index = e; 644 u.coming = t; 645 if (false === u.trigger("beforeLoad")) { 646 u.coming = null; 647 return 648 } 649 s = t.type; 650 i = t.href; 651 if (!s) { 652 u.coming = null; 653 if (u.current && u.router && u.router !== "jumpto") { 654 u.current.index = e; 655 return u[u.router](u.direction) 656 } 657 return false 658 } 659 u.isActive = true; 660 if (s === "image" || s === "swf") { 661 t.autoHeight = t.autoWidth = false; 662 t.scrolling = "visible" 663 } 664 if (s === "image") { 665 t.aspectRatio = true 666 } 667 if (s === "iframe" && l) { 668 t.scrolling = "scroll" 669 } 670 t.wrap = n(t.tpl.wrap).addClass("esgbox-" + (l ? "mobile" : "desktop") + " esgbox-type-" + s + " esgbox-tmp " + t.wrapCSS).appendTo(t.parent || "body"); 671 n.extend(t, { 672 skin: n(".esgbox-skin", t.wrap), 673 outer: n(".esgbox-outer", t.wrap), 674 inner: n(".esgbox-inner", t.wrap) 675 }); 676 n.each(["Top", "Right", "Bottom", "Left"], function(e, n) { 677 t.skin.css("padding" + n, m(t.padding[e])) 678 }); 679 u.trigger("onReady"); 680 if (s === "inline" || s === "html") { 681 if (!t.content || !t.content.length) { 682 return u._error("content") 683 } 684 } else if (!i) { 685 return u._error("href") 686 } 687 if (s === "image") { 688 u._loadImage() 689 } else if (s === "ajax") { 690 u._loadAjax() 691 } else if (s === "iframe") { 692 u._loadIframe() 693 } else { 694 u._afterLoad() 695 } 696 }, 697 _error: function(e) { 698 n.extend(u.coming, { 699 type: "html", 700 autoWidth: true, 701 autoHeight: true, 702 minWidth: 0, 703 minHeight: 0, 704 scrolling: "no", 705 hasError: e, 706 content: u.coming.tpl.error 707 }); 708 u._afterLoad() 709 }, 710 _loadImage: function() { 711 var e = u.imgPreload = new Image; 712 e.onload = function() { 713 this.onload = this.onerror = null; 714 u.coming.width = this.width / u.opts.pixelRatio; 715 u.coming.height = this.height / u.opts.pixelRatio; 716 u._afterLoad() 717 }; 718 e.onerror = function() { 719 this.onload = this.onerror = null; 720 u._error("image") 721 }; 722 e.src = u.coming.href; 723 if (e.complete !== true) { 724 u.showLoading() 725 } 726 }, 727 _loadAjax: function() { 728 var e = u.coming; 729 u.showLoading(); 730 u.ajaxLoad = n.ajax(n.extend({}, e.ajax, { 731 url: e.href, 732 error: function(e, t) { 733 if (u.coming && t !== "abort") { 734 u._error("ajax", e) 735 } else { 736 u.hideLoading() 737 } 738 }, 739 success: function(t, n) { 740 if (n === "success") { 741 e.content = t; 742 u._afterLoad() 743 } 744 } 745 })) 746 }, 747 _loadIframe: function() { 748 var e = u.coming, 749 t = n(e.tpl.iframe.replace(/\{rnd\}/g, (new Date).getTime())).attr("scrolling", l ? "auto" : e.iframe.
749scrolling).attr("src", e.href); 750 n(e.wrap).bind("onReset", function() { 751 try { 752 n(this).find("iframe").hide().attr("src", "//about:blank").end().empty() 753 } catch (e) {} 754 }); 755 if (e.iframe.preload) { 756 u.showLoading(); 757 t.one("load", function() { 758 n(this).data("ready", 1); 759 if (!l) { 760 n(this).bind("load.fb", u.update) 761 } 762 n(this).parents(".esgbox-wrap").width("100%").removeClass("esgbox-tmp").show(); 763 u._afterLoad() 764 }) 765 } 766 e.content = t.appendTo(e.inner); 767 if (!e.iframe.preload) { 768 u._afterLoad() 769 } 770 }, 771 _preloadImages: function() { 772 var e = u.group, 773 t = u.current, 774 n = e.length, 775 r = t.preload ? Math.min(t.preload, n - 1) : 0, 776 i, s; 777 for (s = 1; s <= r; s += 1) { 778 i = e[(t.index + s) % n]; 779 if (i.type === "image" && i.href) { 780 (new Image).src = i.href 781 } 782 } 783 }, 784 _afterLoad: function() { 785 var e = u.coming, 786 t = u.current, 787 r = "esgbox-placeholder", 788 i, s, o, a, f, l; 789 u.hideLoading(); 790 if (!e || u.isActive === false) { 791 return 792 } 793 if (false === u.trigger("afterLoad", e, t)) { 794 e.wrap.stop(true).trigger("onReset").remove(); 795 u.coming = null; 796 return 797 } 798 if (t) { 799 u.trigger("beforeChange", t); 800 t.wrap.stop(true).removeClass("esgbox-opened").find(".esgbox-item, .esgbox-nav").remove() 801 } 802 u.unbindEvents(); 803 i = e; 804 s = e.content; 805 o = e.type; 806 a = e.scrolling; 807 n.extend(u, { 808 wrap: i.wrap, 809 skin: i.skin, 810 outer: i.outer, 811 inner: i.inner, 812 current: i, 813 previous: t 814 }); 815 f = i.href; 816 switch (o) { 817 case "inline": 818 case "ajax": 819 case "html": 820 if (i.selector) { 821 s = n("<div>").html(s).find(i.selector) 822 } else if (c(s)) { 823 if (!s.data(r)) { 824 s.data(r, n('<div class="' + r + '"></div>').insertAfter(s).hide()) 825 } 826 s = s.show().detach(); 827 i.wrap.bind("onReset", function() { 828 if (n(this).find(s).length) { 829 s.hide().replaceAll(s.data(r)).data(r, false) 830 } 831 }) 832 } 833 break; 834 case "image": 835 s = i.tpl.image.replace("{href}", f); 836 break; 837 case "swf": 838 s = '<object id="esgbox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="' + f + '"></param>'; 839 l = ""; 840 n.each(i.swf, function(e, t) { 841 s += '<param name="' + e + '" value="' + t + '"></param>'; 842 l += " " + e + '="' + t + '"' 843 }); 844 s += '<embed src="' + f + '" type="application/x-shockwave-flash" width="100%" height="100%"' + l + "></embed></object>"; 845 break 846 } 847 if (!(c(s) && s.parent().is(i.inner))) { 848 i.inner.append(s) 849 } 850 u.trigger("beforeShow"); 851 i.inner.css("overflow", a === "yes" ? "scroll" : a === "no" ? "hidden" : a); 852 u._setDimension(); 853 u.reposition(); 854 u.isOpen = false; 855 u.coming = null; 856 u.bindEvents(); 857 if (!u.isOpened) { 858 n(".esgbox-wrap").not(i.wrap).stop(true).trigger("onReset").remove() 859 } else if (t.prevMethod) { 860 u.transitions[t.prevMethod]() 861 } 862 u.transitions[u.isOpened ? i.nextMethod : i.openMethod](); 863 u._preloadImages() 864 }, 865 _setDimension: function() { 866 867 var e = u.getViewport(), 868 t = 0, 869 r = false, 870 i = false, 871 s = u.wrap, 872 o = u.skin, 873 a = u.inner, 874 f = u.current, 875 l = f.width, 876 c = f.height, 877 h = f.minWidth, 878 d = f.minHeight, 879 g = f.maxWidth, 880 y = f.maxHeight, 881 b = f.scrolling, 882 w = f.scrollOutside ? f.scrollbarWidth : 0, 883 E = f.margin, 884 S = v(E[1] + E[3]), 885 x = v(E[0] + E[2]),
886 T, N, C, k, L, A, O, M, _, D, P, H, B, j, I; 887 888 889 s.add(o).add(a).width("auto").height("auto").removeClass("esgbox-tmp"); 890 T = v(o.outerWidth(true) - o.width()); 891 N = v(o.outerHeight(true) - o.height()); 892 C = S + T; 893 k = x + N; 894 L = p(l) ? (e.w - C) * v(l) / 100 : l; 895 A = p(c) ? (e.h - k) * v(c) / 100 : c; 896 897 898 if (f.type === "iframe") { 899 j = f.content; 900 if (f.autoHeight && j.data("ready") === 1) { 901 try { 902 if (j[0].contentWindow.document.location) { 903 a.width(L).height(9999); 904 I = j.contents().find("body"); 905 if (w) { 906 I.css("overflow-x", "hidden") 907 } 908 A = I.outerHeight(true) 909 } 910 } catch (q) {} 911 } 912 } else 913 if (f.type === "html5") { 914 L = l; 915 A = c; 916 jQuery('.esgbox-inner').addClass("html5video"); 917 } else 918 if (f.autoWidth || f.autoHeight) { 919 a.addClass("esgbox-tmp"); 920 if (!f.autoWidth) { 921 a.width(L) 922 } 923 if (!f.autoHeight) { 924 a.height(A) 925 } 926 if (f.autoWidth) { 927 L = a.width() 928 } 929 if (f.autoHeight) { 930 A = a.height() 931 } 932 a.removeClass("esgbox-tmp") 933 } 934 l = v(L); 935 c = v(A); 936 937 938 _ = L / A; 939 h = v(p(h) ? v(h, "w") - C : h); 940 g = v(p(g) ? v(g, "w") - C : g); 941 d = v(p(d) ? v(d, "h") - k : d); 942 y = v(p(y) ? v(y, "h") - k : y); 943 O = g; 944 M = y; 945 if (f.fitToView) { 946 g = Math.min(e.w - C, g); 947 y = Math.min(e.h - k, y) 948 } 949 H = e.w - S; 950 B = e.h - x; 951 952 if (f.aspectRatio) { 953 if (l > g) { 954 l = g; 955 c = v(l / _) 956 } 957 if (c > y) { 958 c = y; 959 l = v(c * _) 960 } 961 if (l < h) { 962 l = h; 963 c = v(l / _) 964 } 965 if (c < d) { 966 c = d; 967 l = v(c * _) 968 } 969 } else { 970 l = Math.max(h, Math.min(l, g)); 971 if (f.autoHeight && f.type !== "iframe") { 972 a.width(l); 973 c = a.height() 974 } 975 c = Math.max(d, Math.min(c, y)) 976 } 977 if (f.fitToView) { 978 a.width(l).height(c); 979 980 s.width(l + T); 981 D = s.width(); 982 P = s.height(); 983 if (f.aspectRatio) { 984 while ((D > H || P > B) && l > h && c > d) { 985 if (t++ > 19) { 986 break 987 } 988 c = Math.max(d, Math.min(y, c - 10)); 989 l = v(c * _); 990 if (l < h) { 991 l = h; 992 c = v(l / _) 993 } 994 if (l > g) { 995 l = g; 996 c = v(l / _) 997 } 998 a.width(l).height(c); 999 s.width(l + T); 1000 D = s.width(); 1001 P = s.height() 1002 } 1003 } else { 1004 l = Math.max(h, Math.min(l, l - (D - H))); 1005 c = Math.max(d, Math.min(c, c - (P - B))) 1006 } 1007 } 1008 if (w && b === "auto" && c < A && l + T + w < H) { 1009 l += w 1010 } 1011 a.width(l).height(c); 1012 s.width(l + T); 1013 D = s.width(); 1014 P = s.height(); 1015 r = (D > H || P > B) && l > h && c > d; 1016 i = f.aspectRatio ? l < O && c < M && l < L && c < A : (l < O || c < M) && (l < L || c < A); 1017 n.extend(f, { 1018 dim: { 1019 width: m(D), 1020 height: m(P) 1021 }, 1022 origWidth: L, 1023 origHeight: A, 1024 canShrink: r,
1025 canExpand: i, 1026 wPadding: T, 1027 hPadding: N, 1028 wrapSpace: P - o.outerHeight(true), 1029 skinSpace: o.height() - c 1030 }); 1031 if (!j && f.autoHeight && c > d && c < y && !i) { 1032 a.height("auto") 1033 } 1034 1035 }, 1036 _getPosition: function(e) { 1037 var t = u.current, 1038 n = u.getViewport(), 1039 r = t.margin, 1040 i = u.wrap.width() + r[1] + r[3], 1041 s = u.wrap.height() + r[0] + r[2], 1042 o = { 1043 position: "absolute", 1044 top: r[0], 1045 left: r[3] 1046 }; 1047 if (t.autoCenter && t.fixed && !e && s <= n.h && i <= n.w) { 1048 o.position = "fixed" 1049 } else if (!t.locked) { 1050 o.top += n.y; 1051 o.left += n.x 1052 } 1053 o.top = m(Math.max(o.top, o.top + (n.h - s) * t.topRatio)); 1054 o.left = m(Math.max(o.left, o.left + (n.w - i) * t.leftRatio)); 1055 return o 1056 }, 1057 _afterZoomIn: function() { 1058 var e = u.current; 1059 if (!e) { 1060 return 1061 } 1062 u.isOpen = u.isOpened = true; 1063 u.wrap.css("overflow", "visible").addClass("esgbox-opened"); 1064 u.update(); 1065 if (e.closeClick || e.nextClick && u.group.length > 1) { 1066 u.inner.css("cursor", "pointer").bind("click.fb", function(t) { 1067 if (!n(t.target).is("a") && !n(t.target).parent().is("a")) { 1068 t.preventDefault(); 1069 u[e.closeClick ? "close" : "next"]() 1070 } 1071 }) 1072 } 1073 if (e.closeBtn) { 1074 n(e.tpl.closeBtn).appendTo(u.skin).bind("click.fb", function(e) { 1075 e.preventDefault(); 1076 u.close() 1077 }) 1078 } 1079 if (e.arrows && u.group.length > 1) { 1080 if (e.loop || e.index > 0) { 1081 n(e.tpl.prev).appendTo(u.outer).bind("click.fb", u.prev) 1082 } 1083 if (e.loop || e.index < u.group.length - 1) { 1084 n(e.tpl.next).appendTo(u.outer).bind("click.fb", u.next) 1085 } 1086 } 1087 u.trigger("afterShow"); 1088 if (!e.loop && e.index === e.group.length - 1) { 1089 u.play(false) 1090 } else if (u.opts.autoPlay && !u.player.isActive) { 1091 u.opts.autoPlay = false; 1092 u.play() 1093 } 1094 }, 1095 _afterZoomOut: function(e) { 1096 e = e || u.current; 1097 n(".esgbox-wrap").trigger("onReset").remove(); 1098 n.extend(u, { 1099 group: {}, 1100 opts: {}, 1101 router: false, 1102 current: null, 1103 isActive: false, 1104 isOpened: false, 1105 isOpen: false, 1106 isClosing: false, 1107 wrap: null, 1108 skin: null, 1109 outer: null, 1110 inner: null 1111 }); 1112 u.trigger("afterClose", e) 1113 } 1114 }); 1115 u.transitions = { 1116 getOrigPosition: function() { 1117 var e = u.current, 1118 t = e.element, 1119 n = e.orig, 1120 r = {}, 1121 i = 50, 1122 s = 50, 1123 o = e.hPadding, 1124 a = e.wPadding, 1125 f = u.getViewport(); 1126 if (!n && e.isDom && t.is(":visible")) { 1127 n = t.find("img:first"); 1128 if (!n.length) { 1129 n = t 1130 } 1131 } 1132 if (c(n)) { 1133 r = n.offset(); 1134 if (n.is("img")) { 1135 i = n.outerWidth(); 1136 s = n.outerHeight() 1137 } 1138 } else { 1139 r.top = f.y + (f.h - s) * e.topRatio; 1140 r.left = f.x + (f.w - i) * e.leftRatio 1141 } 1142 if (u.wrap.css("position") === "fixed" || e.locked) { 1143 r.top -= f.y; 1144 r.left -= f.x 1145 } 1146 r = {
1147 top: m(r.top - o * e.topRatio), 1148 left: m(r.left - a * e.leftRatio), 1149 width: m(i + a), 1150 height: m(s + o) 1151 }; 1152 return r 1153 }, 1154 step: function(e, t) { 1155 var n, r, i, s = t.prop, 1156 o = u.current, 1157 a = o.wrapSpace, 1158 f = o.skinSpace; 1159 if (s === "width" || s === "height") { 1160 n = t.end === t.start ? 1 : (e - t.start) / (t.end - t.start); 1161 if (u.isClosing) { 1162 n = 1 - n 1163 } 1164 r = s === "width" ? o.wPadding : o.hPadding; 1165 i = e - r; 1166 u.skin[s](v(s === "width" ? i : i - a * n)); 1167 u.inner[s](v(s === "width" ? i : i - a * n - f * n)) 1168 } 1169 }, 1170 zoomIn: function() { 1171 var e = u.current, 1172 t = e.pos, 1173 r = e.openEffect, 1174 i = r === "elastic", 1175 s = n.extend({ 1176 opacity: 1 1177 }, t); 1178 delete s.position; 1179 if (i) { 1180 t = this.getOrigPosition(); 1181 if (e.openOpacity) { 1182 t.opacity = .1 1183 } 1184 } else if (r === "fade") { 1185 t.opacity = .1 1186 } 1187 u.wrap.css(t).animate(s, { 1188 duration: r === "none" ? 0 : e.openSpeed, 1189 easing: e.openEasing, 1190 step: i ? this.step : null, 1191 complete: u._afterZoomIn 1192 }) 1193 }, 1194 zoomOut: function() { 1195 var e = u.current, 1196 t = e.closeEffect, 1197 n = t === "elastic", 1198 r = { 1199 opacity: .1 1200 }; 1201 if (n) { 1202 r = this.getOrigPosition(); 1203 if (e.closeOpacity) { 1204 r.opacity = .1 1205 } 1206 } 1207 u.wrap.animate(r, { 1208 duration: t === "none" ? 0 : e.closeSpeed, 1209 easing: e.closeEasing, 1210 step: n ? this.step : null, 1211 complete: u._afterZoomOut 1212 }) 1213 }, 1214 changeIn: function() { 1215 var e = u.current, 1216 t = e.nextEffect, 1217 n = e.pos, 1218 r = { 1219 opacity: 1 1220 }, 1221 i = u.direction, 1222 s = 200, 1223 o; 1224 n.opacity = .1; 1225 if (t === "elastic") { 1226 o = i === "down" || i === "up" ? "top" : "left"; 1227 if (i === "down" || i === "right") { 1228 n[o] = m(v(n[o]) - s); 1229 r[o] = "+=" + s + "px" 1230 } else { 1231 n[o] = m(v(n[o]) + s); 1232 r[o] = "-=" + s + "px" 1233 } 1234 } 1235 if (t === "none") { 1236 u._afterZoomIn() 1237 } else { 1238 u.wrap.css(n).animate(r, { 1239 duration: e.nextSpeed, 1240 easing: e.nextEasing, 1241 complete: u._afterZoomIn 1242 }) 1243 } 1244 }, 1245 changeOut: function() { 1246 var e = u.previous, 1247 t = e.prevEffect, 1248 r = { 1249 opacity: .1 1250 }, 1251 i = u.direction, 1252 s = 200; 1253 if (t === "elastic") { 1254 r[i === "down" || i === "up" ? "top" : "left"] = (i === "up" || i === "left" ? "-" : "+") + "=" + s + "px" 1255 } 1256 e.wrap.animate(r, { 1257 duration: t === "none" ? 0 : e.prevSpeed, 1258 easing: e.prevEasing, 1259 complete: function() { 1260 n(this).trigger("onReset").remove() 1261 } 1262 }) 1263 } 1264 }; 1265 u.helpers.overlay = { 1266 defaults: { 1267 closeClick: true, 1268 speedOut: 200, 1269 showEarly: true, 1270 css: {}, 1271 locked: !l, 1272 fixed: true 1273 }, 1274 overlay: null, 1275 fixed: false, 1276 el: n("html"), 1277 create: function(e) { 1278 e = n.extend({}, this.defaults, e); 1279 if (this.overlay) { 1280 this.close() 1281 }
1282 this.overlay = n('<div class="esgbox-overlay"></div>').appendTo(u.coming ? u.coming.parent : e.parent); 1283 this.fixed = false; 1284 if (e.fixed && u.defaults.fixed) { 1285 this.overlay.addClass("esgbox-overlay-fixed"); 1286 this.fixed = true 1287 } 1288 }, 1289 open: function(e) { 1290 var t = this; 1291 e = n.extend({}, this.defaults, e); 1292 if (this.overlay) { 1293 this.overlay.unbind(".overlay").width("auto").height("auto") 1294 } else { 1295 this.create(e) 1296 } 1297 if (!this.fixed) { 1298 s.bind("resize.overlay", n.proxy(this.update, this)); 1299 this.update() 1300 } 1301 if (e.closeClick) { 1302 this.overlay.bind("click.overlay", function(e) { 1303 if (n(e.target).hasClass("esgbox-overlay")) { 1304 if (u.isActive) { 1305 u.close() 1306 } else { 1307 t.close() 1308 } 1309 return false 1310 } 1311 }) 1312 } 1313 this.overlay.css(e.css).show() 1314 }, 1315 close: function() { 1316 var e, t; 1317 s.unbind("resize.overlay"); 1318 if (this.el.hasClass("esgbox-lock")) { 1319 n(".esgbox-margin").removeClass("esgbox-margin"); 1320 e = s.scrollTop(); 1321 t = s.scrollLeft(); 1322 this.el.removeClass("esgbox-lock"); 1323 s.scrollTop(e).scrollLeft(t) 1324 } 1325 n(".esgbox-overlay").remove().hide(); 1326 n.extend(this, { 1327 overlay: null, 1328 fixed: false 1329 }) 1330 }, 1331 update: function() { 1332 var e = "100%", 1333 n; 1334 this.overlay.width(e).height("100%"); 1335 if (a) { 1336 n = Math.max(t.documentElement.offsetWidth, t.body.offsetWidth); 1337 if (o.width() > n) { 1338 e = o.width() 1339 } 1340 } else if (o.width() > s.width()) { 1341 e = o.width() 1342 } 1343 this.overlay.width(e).height(o.height()) 1344 }, 1345 onReady: function(e, t) { 1346 var r = this.overlay; 1347 n(".esgbox-overlay").stop(true, true); 1348 if (!r) { 1349 this.create(e) 1350 } 1351 if (e.locked && this.fixed && t.fixed) { 1352 if (!r) { 1353 this.margin = o.height() > s.height() ? n("html").css("margin-right").replace("px", "") : false 1354 } 1355 t.locked = this.overlay.append(t.wrap); 1356 t.fixed = false 1357 } 1358 if (e.showEarly === true) { 1359 this.beforeShow.apply(this, arguments) 1360 } 1361 }, 1362 beforeShow: function(e, t) { 1363 var r, i; 1364 if (t.locked) { 1365 if (this.margin !== false) { 1366 n("*").filter(function() { 1367 return n(this).css("position") === "fixed" && !n(this).hasClass("esgbox-overlay") && !n(this).hasClass("esgbox-wrap") 1368 }).addClass("esgbox-margin"); 1369 this.el.addClass("esgbox-margin") 1370 } 1371 r = s.scrollTop(); 1372 i = s.scrollLeft(); 1373 this.el.addClass("esgbox-lock"); 1374 s.scrollTop(r).scrollLeft(i) 1375 } 1376 this.open(e) 1377 }, 1378 onUpdate: function() { 1379 if (!this.fixed) { 1380 this.update() 1381 } 1382 }, 1383 afterClose: function(e) { 1384 if (this.overlay && !u.coming) { 1385 this.overlay.fadeOut(e.speedOut, n.proxy(this.close, this)) 1386 } 1387 } 1388 }; 1389 u.helpers.title = { 1390 defaults: { 1391 type: "float", 1392 position: "bottom" 1393 }, 1394 beforeShow: function(e) { 1395 var t = u.current, 1396 r = t.title, 1397 i = e.type, 1398 s, o; 1399 if (n.isFunction(r)) { 1400 r = r.call(t.element, t) 1401 } 1402 if (!h(r) || n.trim(r) === "") { 1403 return 1404 } 1405 s = n('<div class="esgbox-title esgbox-title-' + i + '-wrap">' + r + "</div>"); 1406 switch (i) { 1407 case "inside": 1408 o = u.skin; 1409 break; 1410 case "outside": 1411 o = u.wrap; 1412 break; 1413 case "over": 1414 o = u.inner; 1415 break; 1416 default: 1417 o = u.skin; 1418 s.appendTo("body"); 1419 if (a) { 1420 s.width(s.width()) 1421 } 1422 s.wrapInner('<span class="child"></span>'); 1423 u.current.margin[2] += Math.abs(v(s.css("margin-bottom"))); 1424 break 1425 } 1426 s[e.position === "top" ? "prependTo" : "appendTo"](o) 1427 } 1428 }; 1429 n.fn.esgbox = function(e) { 1430 var t, r = n(this), 1431 i = this.selector || "", 1432 s = function(s) { 1433 var o = n(this).blur(), 1434 a = t, 1435 f, l; 1436 if (!(s.ctrlKey || s.altKey || s.shiftKey || s.metaKey) && !o.is(".esgbox-wrap")) { 1437 f = e.groupAttr || "data-esgbox-group"; 1438 l = o.attr(f); 1439 if (!l) { 1440 f = "rel"; 1441 l = o.get(0)[f] 1442 }
1443 if (l && l !== "" && l !== "nofollow") { 1444 o = i.length ? n(i) : r; 1445 o = o.filter("[" + f + '="' + l + '"]'); 1446 a = o.index(this) 1447 } 1448 e.index = a; 1449 if (u.open(o, e) !== false) { 1450 s.preventDefault() 1451 } 1452 } 1453 }; 1454 e = e || {}; 1455 t = e.index || 0; 1456 if (!i || e.live === false) { 1457 r.unbind("click.fb-start").bind("click.fb-start", s) 1458 } else { 1459 o.undelegate(i, "click.fb-start").delegate(i + ":not('.esgbox-item, .esgbox-nav')", "click.fb-start", s) 1460 } 1461 this.filter("[data-esgbox-start=1]").trigger("click"); 1462 return this 1463 }; 1464 o.ready(function() { 1465 var t, s; 1466 if (n.scrollbarWidth === r) { 1467 n.scrollbarWidth = function() { 1468 var e = n('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body"), 1469 t = e.children(), 1470 r = t.innerWidth() - t.height(99).innerWidth(); 1471 e.remove(); 1472 return r 1473 } 1474 } 1475 if (n.support.fixedPosition === r) { 1476 n.support.fixedPosition = function() { 1477 var e = n('<div style="position:fixed;top:20px;"></div>').appendTo("body"), 1478 t = e[0].offsetTop === 20 || e[0].offsetTop === 15; 1479 e.remove(); 1480 return t 1481 }() 1482 } 1483 n.extend(u.defaults, { 1484 scrollbarWidth: n.scrollbarWidth(), 1485 fixed: n.support.fixedPosition, 1486 parent: n("body") 1487 }); 1488 t = n(e).width(); 1489 i.addClass("esgbox-lock-test"); 1490 s = n(e).width(); 1491 i.removeClass("esgbox-lock-test"); 1492 n("<style type='text/css'>.esgbox-margin{margin-right:" + (s - t) + "px;}</style>").appendTo("head") 1493 }) 1494})(window, document, jQuery); 1495(function(e) { 1496 var t = e.esgbox; 1497 t.helpers.buttons = { 1498 defaults: { 1499 skipSingle: false, 1500 position: "top", 1501 tpl: '<div id="esgbox-buttons"><ul><li><a class="btnPrev" title="Previous" href="javascript:;"></a></li><li><a class="btnPlay" title="Start slideshow" href="javascript:;"></a></li><li><a class="btnNext" title="Next" href="javascript:;"></a></li><li><a class="btnToggle" title="Toggle size" href="javascript:;"></a></li><li><a class="btnClose" title="Close" href="javascript:;"></a></li></ul></div>' 1502 }, 1503 list: null, 1504 buttons: null, 1505 beforeLoad: function(e, t) { 1506 if (e.skipSingle && t.group.length < 2) { 1507 t.helpers.buttons = false; 1508 t.closeBtn = true; 1509 return 1510 } 1511 t.margin[e.position === "bottom" ? 2 : 0] += 30 1512 }, 1513 onPlayStart: function() { 1514 if (this.buttons) { 1515 this.buttons.play.attr("title", "Pause slideshow").addClass("btnPlayOn") 1516 } 1517 }, 1518 onPlayEnd: function() { 1519 if (this.buttons) { 1520 this.buttons.play.attr("title", "Start slideshow").removeClass("btnPlayOn") 1521 } 1522 }, 1523 afterShow: function(n, r) { 1524 var i = this.buttons; 1525 if (!i) { 1526 this.list = e(n.tpl).addClass(n.position).appendTo("body"); 1527 i = { 1528 prev: this.list.find(".btnPrev").click(t.prev), 1529 next: this.list.find(".btnNext").click(t.next), 1530 play: this.list.find(".btnPlay").click(t.play), 1531 toggle: this.list.find(".btnToggle").click(t.toggle), 1532 close: this.list.find(".btnClose").click(t.close) 1533 } 1534 } 1535 if (r.index > 0 || r.loop) { 1536 i.prev.removeClass("btnDisabled") 1537 } else { 1538 i.prev.addClass("btnDisabled") 1539 } 1540 if (r.loop || r.index < r.group.length - 1) { 1541 i.next.removeClass("btnDisabled"); 1542 i.play.removeClass("btnDisabled") 1543 } else { 1544 i.next.addClass("btnDisabled"); 1545 i.play.addClass("btnDisabled") 1546 } 1547 this.buttons = i; 1548 this.onUpdate(n, r) 1549 }, 1550 onUpdate: function(e, t) { 1551 var n; 1552 if (!this.buttons) { 1553 return 1554 } 1555 n = this.buttons.toggle.removeClass("btnDisabled btnToggleOn"); 1556 if (t.canShrink) { 1557 n.addClass("btnToggleOn") 1558 } else if (!t.canExpand) { 1559 n.addClass("btnDisabled") 1560 } 1561 }, 1562 beforeClose: function() { 1563 if (this.list) { 1564 this.list.remove() 1565 } 1566 this.list = null; 1567 this.buttons = null 1568 } 1569 } 1570})(jQuery); 1571(function(e) { 1572 "use strict"; 1573 var t = e.esgbox, 1574 n = function(t, n, r) { 1575 r = r || ""; 1576 if (e.type(r) === "object") { 1577 r = e.param(r, true) 1578 } 1579 e.each(n, function(e, n) { 1580 t = t.replace("$" + e, n || "") 1581 }); 1582 if (r.length) { 1583 t += (t.indexOf("?") > 0 ? "&" : "?") + r 1584 } 1585 return t 1586 }; 1587 t.helpers.media = { 1588 defaults: { 1589 youtube: { 1590 matcher: /(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i, 1591 params: { 1592 autoplay: 1, 1593 autohide: 1, 1594 fs: 1, 1595 rel: 0, 1596 hd: 1, 1597 wmode: "opaque", 1598 enablejsapi: 1 1599 }, 1600 type: "iframe", 1601 url: "//www.youtube.com/embed/$3" 1602 }, 1603 vimeo: { 1604 matcher: /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/, 1605 params: { 1606 autoplay: 1, 1607 hd: 1, 1608 show_title: 1, 1609 show_byline: 1, 1610 show_portrait: 0, 1611 fullscreen: 1 1612 }, 1613 type: "iframe", 1614 url: "//player.vimeo.com/video/$1" 1615 }, 1616 metacafe: { 1617 matcher: /metacafe.com\/(?:watch|fplayer)\/([\w\-]{1,10})/, 1618 params: { 1619 autoPlay: "yes" 1620 }, 1621 type: "swf", 1622 url: function(t, n, r) { 1623 r.swf.flashVars = "playerVars=" + e.param(n, true); 1624 return "//www.metacafe.com/fplayer/" + t[1] + "/.swf" 1625 } 1626 }, 1627 dailymotion: { 1628 matcher: /dailymotion.com\/video\/(.*)\/?(.*)/, 1629 params: { 1630 additionalInfos: 0, 1631 autoStart: 1 1632 }, 1633 type: "swf", 1634 url: "//www.dailymotion.com/swf/video/$1" 1635 }, 1636 twitvid: { 1637 matcher: /twitvid\.com\/([a-zA-Z0-9_\-\?\=]+)/i, 1638 params: { 1639 autoplay: 0 1640 }, 1641 type: "iframe", 1642 url: "//www.twitvid.com/embed.php?guid=$1" 1643 }, 1644 twitpic: { 1645 matcher: /twitpic\.com\/(?!(?:place|photos|events)\/)([a-zA-Z0-9\?\=\-]+)/i, 1646 type: "image", 1647 url: "//twitpic.com/show/full/$1/" 1648 }, 1649 instagram: { 1650 matcher: /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i, 1651 type: "image", 1652 url: "//$1/p/$2/media/?size=l" 1653 }, 1654 google_maps: { 1655 matcher: /maps\.google\.([a-z]{2,3}(\.[a-z]{2})?)\/(\?ll=|maps\?)(.*)/i, 1656 type: "iframe", 1657 url: function(e) { 1658 return "//maps.google." + e[1] + "/" + e[3] + "" + e[4] + "&output=" + (e[4].indexOf("layer=c") > 0 ? "svembed" : "embed") 1659 } 1660 } 1661 }, 1662 beforeLoad: function(t, r) { 1663 var i = r.href || "", 1664 s = false, 1665 o, u, a, f; 1666 for (o in t) { 1667 if (t.hasOwnProperty(o)) { 1668 u = t[o]; 1669 a = i.match(u.matcher); 1670 if (a) { 1671 s = u.type; 1672 f = e.extend(true, {}, u.params, r[o] || (e.isPlainObject(t[o]) ? t[o].params : null)); 1673 i = e.type(u.url) === "function" ? u.url.call(this, a, f, r) : n(u.url, a, f); 1674 break 1675 } 1676 } 1677 } 1678 if (s) { 1679 r.href = i; 1680 r.type = s; 1681 r.autoHeight = false 1682 } 1683 } 1684 } 1685})(jQuery); 1686(function(e) { 1687 var t = e.esgbox; 1688 t.helpers.thumbs = { 1689 defaults: { 1690 width: 50, 1691 height: 50, 1692 position: "bottom", 1693 source: function(t) { 1694 var n; 1695 if (t.element) { 1696 n = e(t.element).find("img").attr("src") 1697 } 1698 if (!n && t.type === "image" && t.href) { 1699 n = t.href 1700 } 1701 return n 1702 } 1703 }, 1704 wrap: null, 1705 list: null, 1706 width: 0, 1707 init: function(t, n) { 1708 var r = this, 1709 i, s = t.width, 1710 o = t.height, 1711 u = t.source; 1712 i = ""; 1713 1714 for (var a = 0; a < n.group.length; a++) { 1715 i += '<li><a style="width:' + s + "px;height:" + o + 'px;" href="javascript:jQuery.esgbox.jumpto(' + a + ');"></a></li>' 1716 } 1717 this.wrap = e('<div id="esgbox-thumbs"></div>').addClass(t.position).appendTo("body"); 1718 this.list = e("<ul>" + i + "</ul>").appendTo(this.wrap); 1719 e.each(n.group, function(t) { 1720 var i = u(n.group[t]); 1721 if (!i) { 1722 return 1723 } 1724 e("<img />").load(function() { 1725 var n = this.width, 1726 i = this.height, 1727 u, a, f; 1728 if (!r.list || !n || !i) { 1729 return 1730 } 1731 u = n / s; 1732 a = i / o; 1733 f = r.list.children().eq(t).find("a"); 1734 if (u >= 1 && a >= 1) { 1735 if (u > a) { 1736 n = Math.floor(n / a); 1737 i = o 1738 } else { 1739 n = s; 1740 i = Math.floor(i / u) 1741 } 1742 } 1743 e(this).css({ 1744 width: n, 1745 height: i, 1746 top: Math.floor(o / 2 - i / 2), 1747 left: Math.floor(s / 2 - n / 2) 1748 }); 1749 f.width(s).height(o); 1750 e(this).hide().appendTo(f).fadeIn(300) 1751 }).attr("src", i) 1752 }); 1753 1754 this.width = this.list.children().eq(0).outerWidth(true); 1755 this.list.width(this.width * (n.group.length + 1)).css("left", Math.floor(e(window).width() * .5 - (n.index * this.width + this.width * .5))) 1756 }, 1757 beforeLoad: function(e, t) { 1758 if (t.group.length < 2) { 1759 t.helpers.thumbs = false; 1760 return 1761 } 1762 t.margin[e.position === "top" ? 0 : 2] += e.height + 15 1763 }, 1764 afterShow: function(e, t) { 1765 1766 if (this.list) { 1767 this.onUpdate(e, t) 1768 } else { 1769 this.init(e, t) 1770 } 1771 this.list.children().removeClass("active").eq(t.index).addClass("active") 1772 }, 1773 onUpdate: function(t, n) { 1774 if (this.list) { 1775 this.width = this.list.children().eq(0).outerWidth(true); 1776 punchgs.TweenLite.set(this.list,{width:(this.width * (n.group.length + 1))}) 1777 punchgs.TweenLite.to(this.list,0.5,{ease:punchgs.Power3.easeInOut,left:Math.floor(e(window).width() * .5 - (n.index * this.width + this.width * .5))}); 1778 1779 } 1780 }, 1781 beforeClose: function() { 1782 if (this.wrap) { 1783 this.wrap.remove() 1784 } 1785 this.wrap = null; 1786 this.list = null; 1787 this.width = 0 1788 } 1789 } 1790})(jQuery) 1791 1792jQuery('body').on('click', '.esgbox', function() { 1793 1794 var $this = jQuery(this); 1795 if($this.attr('href').search('wistia') !== -1 && !$this.hasClass('esgbox.iframe')) { 1796 $this.addClass('esgbox.iframe').attr('href', $this.attr('href') + '?autoPlay=true').click(); 1797 return false; 1798 } 1799 1800});
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.