1/** 2 * Fresco - A Beautiful Responsive Lightbox - v2.3.0 3 * (c) 2012-2019 Nick Stakenburg 4 * 5 * https://www.frescojs.com 6 * 7 * @license: https://creativecommons.org/licenses/by/4.0 8 */ 9!(function (i, e) { 10 "function" == typeof define && define.amd ? define(["jquery"], e) : "object" == typeof module && module.exports ? (module.exports = e(require("jquery"))) : (i.Fresco = e(jQuery)); 11})(this, function ($) { 12 var Fresco = {}; 13 $.extend(Fresco, { version: "2.3.0" }), (Fresco.Skins = { fresco: {} }); 14 var Bounds = { 15 viewport: function () { 16 var i = { width: $(window).width() }; 17 if (Browser.MobileSafari || (Browser.Android && Browser.Gecko)) { 18 var e = document.documentElement.clientWidth / window.innerWidth; 19 i.height = window.innerHeight * e; 20 } else i.height = $(window).height(); 21 return i; 22 }, 23 }, 24 Browser = 25 ((e = navigator.userAgent), 26 { 27 IE: !(!window.attachEvent || -1 !== e.indexOf("Opera")) && f("MSIE "), 28 Opera: -1 < e.indexOf("Opera") && ((!!window.opera && opera.version && parseFloat(opera.version())) || 7.55), 29 WebKit: -1 < e.indexOf("AppleWebKit/") && f("AppleWebKit/"), 30 Gecko: -1 < e.indexOf("Gecko") && -1 === e.indexOf("KHTML") && f("rv:"), 31 MobileSafari: !!e.match(/Apple.*Mobile.*Safari/), 32 Chrome: -1 < e.indexOf("Chrome") && f("Chrome/"), 33 ChromeMobile: -1 < e.indexOf("CrMo") && f("CrMo/"), 34 Android: -1 < e.indexOf("Android") && f("Android "), 35 IEMobile: -1 < e.indexOf("IEMobile") && f("IEMobile/"), 36 }), 37 e; 38 function f(i) { 39 var t = new RegExp(i + "([\\d.]+)").exec(e); 40 return !t || parseFloat(t[1]); 41 } 42 var _slice = Array.prototype.slice; 43 function baseToString(i) { 44 return "string" == typeof i ? i : null == i ? "" : i + ""; 45 } 46 var _ = { 47 isElement: function (i) { 48 return i && 1 === i.nodeType; 49 }, 50 String: { 51 capitalize: function (i) { 52 return (i = baseToString(i)) && i.charAt(0).toUpperCase() + i.slice(1); 53 }, 54 }, 55 }; 56 $(document.documentElement).on("mousewheel DOMMouseScroll", function (i) { 57 var e; 58 if ((i.originalEvent.wheelDelta ? (e = i.originalEvent.wheelDelta / 120) : i.originalEvent.detail && (e = -i.originalEvent.detail / 3), e)) { 59 var t = $.Event("fresco:mousewheel"); 60 $(i.target).trigger(t, e), t.isPropagationStopped() && i.stopPropagation(), t.isDefaultPrevented() && i.preventDefault(); 61 } 62 }); 63 var Fit = { 64 within: function (i, e) { 65 for (var t = $.extend({ height: !0, width: !0 }, arguments[2] || {}), s = $.extend({}, e), n = 1, o = 5, a = t.width, h = t.height; 0 < o && ((a && s.width > i.width) || (h && s.height > i.height)); ) { 66 var r = 1, 67 d = 1; 68 a && s.width > i.width && (r = i.width / s.width), h && s.height > i.height && (d = i.height / s.height), (n = Math.min(r, d)), (s = { width: e.width * n, height: e.height * n }), o--; 69 } 70 return (s.width = Math.max(s.width, 0)), (s.height = Math.max(s.height, 0)), s; 71 }, 72 }; 73 $.extend($.easing, { 74 frescoEaseInCubic: function (i, e, t, s, n) { 75 return s * (e /= n) * e * e + t; 76 }, 77 frescoEaseInSine: function (i, e, t, s, n) { 78 return -s * Math.cos((e / n) * (Math.PI / 2)) + s + t; 79 }, 80 frescoEaseOutSine: function (i, e, t, s, n) { 81 return s * Math.sin((e / n) * (Math.PI / 2)) + t; 82 }, 83 }); 84 var Support = 85 ((O = document.createElement("div")), 86 (P = "Webkit Moz O ms Khtml".split(" ")), 87 { 88 canvas: ((ba = document.createElement("canvas")), !(!ba.getContext || !ba.getContext("2d"))), 89 css: { 90 animation: S("animation"), 91 transform: S("transform"), 92 prefixed: function (i) { 93 return S(i, "prefix"); 94 }, 95 }, 96 svg: !!document.createElementNS && !!document.createElementNS("http://www.w3.org/2000/svg", "svg").createSVGRect, 97 touch: (function () { 98 try { 99 return !!("ontouchstart" in window || (window.DocumentTouch && document instanceof DocumentTouch)); 100 } catch (i) { 101 return !1; 102 } 103 })(), 104 }), 105 ba, 106 O, 107 P; 108 function S(i, e) { 109 var t = i.charAt(0).toUpperCase() + i.substr(1); 110 return (function (i, e) {
111 for (var t in i) if (void 0 !== O.style[i[t]]) return "prefix" !== e || i[t]; 112 return !1; 113 })((i + " " + P.join(t + " ") + t).split(" "), e); 114 } 115 (Support.detectMobileTouch = function () { 116 Support.mobileTouch = Support.touch && (Browser.MobileSafari || Browser.Android || Browser.IEMobile || Browser.ChromeMobile || !/^(Win|Mac|Linux)/.test(navigator.platform)); 117 }), 118 Support.detectMobileTouch(); 119 var ImageReady = function () { 120 return this.initialize.apply(this, Array.prototype.slice.call(arguments)); 121 }; 122 function Timers() { 123 return this.initialize.apply(this, _slice.call(arguments)); 124 } 125 function getURIData(s) { 126 var n = { type: "image" }; 127 return ( 128 $.each(Types, function (i, e) { 129 var t = e.data(s); 130 t && (((n = t).type = i), (n.url = s)); 131 }), 132 n 133 ); 134 } 135 function detectExtension(i) { 136 var e = (i || "").replace(/\?.*/g, "").match(/\.([^.]{3,4})$/); 137 return e ? e[1].toLowerCase() : null; 138 } 139 $.extend(ImageReady.prototype, { 140 supports: { naturalWidth: "naturalWidth" in new Image() }, 141 initialize: function (i, e, t) { 142 (this.img = $(i)[0]), 143 (this.successCallback = e), 144 (this.errorCallback = t), 145 (this.isLoaded = !1), 146 (this.options = $.extend({ method: "naturalWidth", pollFallbackAfter: 1e3 }, arguments[3] || {})), 147 this.supports.naturalWidth && "onload" !== this.options.method 148 ? this.img.complete && "undefined" !== $.type(this.img.naturalWidth) 149 ? setTimeout( 150 $.proxy(function () { 151 0 < this.img.naturalWidth ? this.success() : this.error(); 152 }, this) 153 ) 154 : ($(this.img).bind( 155 "error", 156 $.proxy(function () { 157 setTimeout( 158 $.proxy(function () { 159 this.error(); 160 }, this) 161 ); 162 }, this) 163 ), 164 (this.intervals = [ 165 [1e3, 10], 166 [2e3, 50], 167 [4e3, 100], 168 [2e4, 500], 169 ]), 170 (this._ipos = 0), 171 (this._time = 0), 172 (this._delay = this.intervals[this._ipos][1]), 173 this.poll()) 174 : setTimeout($.proxy(this.fallback, this)); 175 }, 176 poll: function () { 177 this._polling = setTimeout( 178 $.proxy(function () { 179 if (0 < this.img.naturalWidth) this.success(); 180 else { 181 if ( 182 ((this._time += this._delay), 183 this.options.pollFallbackAfter && this._time >= this.options.pollFallbackAfter && !this._usedPollFallback && ((this._usedPollFallback = !0), this.fallback()), 184 this._time > this.intervals[this._ipos][0]) 185 ) { 186 if (!this.intervals[this._ipos + 1]) return void this.error(); 187 this._ipos++, (this._delay = this.intervals[this._ipos][1]); 188 } 189 this.poll(); 190 } 191 }, this), 192 this._delay 193 ); 194 }, 195 fallback: function () { 196 var i = new Image(); 197 ((this._fallbackImg = i).onload = $.proxy(function () { 198 (i.onload = function () {}), this.supports.naturalWidth || ((this.img.naturalWidth = i.width), (this.img.naturalHeight = i.height)), this.success(); 199 }, this)), 200 (i.onerror = $.proxy(this.error, this)), 201 (i.src = this.img.src); 202 }, 203 abort: function () { 204 this._fallbackImg && (this._fallbackImg.onload = function () {}), this._polling && (clearTimeout(this._polling), (this._polling = null)); 205 }, 206 success: function () { 207 this._calledSuccess || ((this._calledSuccess = !0), (this.isLoaded = !0), this.successCallback(this)); 208 }, 209 error: function () { 210 this._calledError || ((this._calledError = !0), this.abort(), this.errorCallback && this.errorCallback(this)); 211 }, 212 }), 213 $.extend(Timers.prototype, { 214 initialize: function () { 215 this._timers = {}; 216 }, 217 set: function (i, e, t) { 218 this._timers[i] = setTimeout(e, t); 219 }, 220 get: function (i) { 221 return this._timers[i]; 222 }, 223 clear: function (i) { 224 i ? this._timers[i] && (clearTimeout(this._timers[i]), delete this._timers[i]) : this.clearAll(); 225 }, 226 clearAll: function () { 227 $.each(this._timers, function (i, e) { 228 clearTimeout(e); 229 }), 230 (this._timers = {}); 231 }, 232 }); 233 var Type = { 234 isVideo: function (i) { 235 return /^(youtube|vimeo)$/.test(i); 236 }, 237 }, 238 Types = { 239 image: { 240 extensions: "bmp gif jpeg jpg png webp", 241 detect: function (i) { 242 return -1 < $.inArray(detectExtension(i), this.extensions.split(" ")); 243 }, 244 data: function (i) { 245 return !!this.detect() && { extension: detectExtension(i) }; 246 }, 247 }, 248 vimeo: { 249 detect: function (i) { 250 var e = /(vimeo\.com)\/([a-zA-Z0-9-_]+)(?:\S+)?$/i.exec(i); 251 return !(!e || !e[2]) && e[2]; 252 }, 253 data: function (i) { 254 var e = this.detect(i); 255 return !!e && { id: e }; 256 }, 257 }, 258 youtube: { 259 detect: function (i) { 260 var e = /(youtube\.com|youtu\.be)\/watch\?(?=.*vi?=([a-zA-Z0-9-_]+))(?:\S+)?$/.exec(i); 261 return e && e[2] ? e[2] : !(!(e = /(youtube\.com|youtu\.be)\/(vi?\/|u\/|embed\/)?([a-zA-Z0-9-_]+)(?:\S+)?$/i.exec(i)) || !e[3]) && e[3]; 262 }, 263 data: function (i) { 264 var e = this.detect(i); 265 return !!e && { id: e }; 266 }, 267 }, 268 }, 269 VimeoThumbnail = (function () { 270 function i() { 271 return this.initialize.apply(this, _slice.call(arguments)); 272 } 273 $.extend(i.prototype, { 274 initialize: function (i, e, t) { 275 (this.url = i), (this.successCallback = e), (this.errorCallback = t), this.load(); 276 }, 277 load: function () { 278 var i = s.get(this.url); 279 if (i) return this.successCallback(i.data.url); 280 var e = "http" + (window.location && "https:" === window.location.protocol ? "s" : "") + ":", 281 t = getURIData(this.url).id; 282 this._xhr = $.getJSON( 283 e + "//vimeo.com/api/oembed.json?url=" + e + "//vimeo.com/" + t + "&callback=?", 284 $.proxy(function (i) { 285 if (i && i.thumbnail_url) { 286 var e = { url: i.thumbnail_url }; 287 s.set(this.url, e), this.successCallback(e.url); 288 } else this.errorCallback(); 289 }, this) 290 ); 291 }, 292 abort: function () { 293 this._xhr && (this._xhr.abort(), (this._xhr = null)); 294 }, 295 }); 296 var s = { 297 cache: [], 298 get: function (i) { 299 for (var e = null, t = 0; t < this.cache.length; t++) this.cache[t] && this.cache[t].url === i && (e = this.cache[t]); 300 return e; 301 }, 302 set: function (i, e) { 303 this.remove(i), this.cache.push({ url: i, data: e }); 304 }, 305 remove: function (i) { 306 for (var e = 0; e < this.cache.length; e++) this.cache[e] && this.cache[e].url === i && delete this.cache[e]; 307 }, 308 }; 309 return i; 310 })(), 311 VimeoReady = (function () { 312 function i() { 313 return this.initialize.apply(this, _slice.call(arguments)); 314 } 315 $.extend(i.prototype, { 316 initialize: function (i, e) { 317 (this.url = i), (this.callback = e), this.load(); 318 }, 319 load: function () { 320 var i = s.get(this.url); 321 if (i) return this.callback(i.data); 322 var e = "http" + (window.location && "https:" === window.location.protocol ? "s" : "") + ":", 323 t = getURIData(this.url).id; 324 this._xhr = $.getJSON( 325 e + "//vimeo.com/api/oembed.json?url=" + e + "//vimeo.com/" + t + "&maxwidth=9999999&maxheight=9999999&callback=?", 326 $.proxy(function (i) { 327 var e = { dimensions: { width: i.width, height: i.height } }; 328 s.set(this.url, e), this.callback && this.callback(e); 329 }, this) 330 ); 331 }, 332 abort: function () { 333 this._xhr && (this._xhr.abort(), (this._xhr = null)); 334 }, 335 }); 336 var s = { 337 cache: [], 338 get: function (i) { 339 for (var e = null, t = 0; t < this.cache.length; t++) this.cache[t] && this.cache[t].url === i && (e = this.cache[t]); 340 return e; 341 }, 342 set: function (i, e) { 343 this.remove(i), this.cache.push({ url: i, data: e }); 344 }, 345 remove: function (i) { 346 for (var e = 0; e < this.cache.length; e++) this.cache[e] && this.cache[e].url === i && delete this.cache[e]; 347 }, 348 }; 349 return i; 350 })(), 351 Options = { 352 defaults: { 353 effects: { content: { show: 0, hide: 0 }, spinner: { show: 150, hide: 150 }, window: { show: 440, hide: 300 }, thumbnail: { show: 300, delay: 150 }, thumbnails: { slide: 0 } }, 354 keyboard: { left: !0, right: !0, esc: !0 },
355 loadedMethod: "naturalWidth", 356 loop: !1, 357 onClick: "previous-next", 358 overflow: !1, 359 overlay: { close: !0 }, 360 preload: [1, 2], 361 position: !0, 362 skin: "fresco", 363 spinner: !0, 364 spinnerDelay: 300, 365 sync: !0, 366 thumbnails: "horizontal", 367 ui: "outside", 368 uiDelay: 3e3, 369 vimeo: { autoplay: 1, api: 1, title: 1, byline: 1, portrait: 0, loop: 0 }, 370 youtube: { autoplay: 1, controls: 1, enablejsapi: 1, hd: 1, iv_load_policy: 3, loop: 0, modestbranding: 1, rel: 0, vq: "hd1080" }, 371 initialTypeOptions: { image: {}, vimeo: { width: 1280 }, youtube: { width: 1280, height: 720 } }, 372 }, 373 create: function (i, e, t) { 374 (t = t || {}), ((i = i || {}).skin = i.skin || this.defaults.skin); 375 var s = i.skin ? $.extend({}, Fresco.Skins[i.skin] || Fresco.Skins[this.defaults.skin]) : {}, 376 n = $.extend(!0, {}, this.defaults, s); 377 n.initialTypeOptions && (e && n.initialTypeOptions[e] && (n = $.extend(!0, {}, n.initialTypeOptions[e], n)), delete n.initialTypeOptions); 378 var o = $.extend(!0, {}, n, i); 379 if ( 380 (Support.mobileTouch && "inside" === o.ui && (o.ui = "outside"), 381 (!o.effects || (Browser.IE && Browser.IE < 9)) && 382 ((o.effects = {}), 383 $.each(this.defaults.effects, function (e, i) { 384 $.each((o.effects[e] = $.extend({}, i)), function (i) { 385 o.effects[e][i] = 0; 386 }); 387 }), 388 (o.spinner = !1)), 389 o.keyboard && 390 ("boolean" === $.type(o.keyboard) && 391 ((o.keyboard = {}), 392 $.each(this.defaults.keyboard, function (i, e) { 393 o.keyboard[i] = !0; 394 })), 395 ("vimeo" !== e && "youtube" !== e) || $.extend(o.keyboard, { left: !1, right: !1 })), 396 !o.overflow || Support.mobileTouch ? (o.overflow = { x: !1, y: !1 }) : "boolean" === $.type(o.overflow) && (o.overflow = { x: !1, y: !0 }), 397 ("vimeo" !== e && "youtube" !== e) || (o.overlap = !1), 398 ((Browser.IE && Browser.IE < 9) || Support.mobileTouch) && ((o.thumbnail = !1), (o.thumbnails = !1)), 399 "youtube" !== e && (o.width && !o.maxWidth && (o.maxWidth = o.width), o.height && !o.maxHeight && (o.maxHeight = o.height)), 400 !o.thumbnail && "boolean" !== $.type(o.thumbnail)) 401 ) { 402 var a = !1; 403 switch (e) { 404 case "youtube": 405 a = "http" + (window.location && "https:" === window.location.protocol ? "s" : "") + ":" + "//img.youtube.com/vi/" + t.id + "/0.jpg"; 406 break; 407 case "image": 408 case "vimeo": 409 a = !0; 410 } 411 o.thumbnail = a; 412 } 413 return o; 414 }, 415 }, 416 Overlay = { 417 initialize: function () { 418 this.build(), (this.visible = !1); 419 }, 420 build: function () { 421 (this.element = $("<div>").addClass("fr-overlay").hide().append($("<div>").addClass("fr-overlay-background"))), 422 this.element.on( 423 "click", 424 $.proxy(function () { 425 var i = Pages.page; 426 (i && i.view && i.view.options.overlay && !i.view.options.overlay.close) || Window.hide(); 427 }, this) 428 ), 429 Support.mobileTouch && this.element.addClass("fr-mobile-touch"), 430 this.element.on("fresco:mousewheel", function (i) { 431 i.preventDefault(); 432 }); 433 }, 434 setSkin: function (i) { 435 this.skin && this.element.removeClass("fr-overlay-skin-" + this.skin), this.element.addClass("fr-overlay-skin-" + i), (this.skin = i); 436 }, 437 attach: function () { 438 $(document.body).append(this.element); 439 }, 440 detach: function () { 441 this.element.detach(); 442 }, 443 show: function (i, e) { 444 if (this.visible) i && i();
445 else { 446 (this.visible = !0), this.attach(), this.max(); 447 var t = (Pages.page && Pages.page.view.options.effects.window.show) || 0, 448 s = ("number" === $.type(e) ? e : t) || 0; 449 this.element.stop(!0).fadeTo(s, 1, i); 450 } 451 }, 452 hide: function (i, e) { 453 if (this.visible) { 454 var t = (Pages.page && Pages.page.view.options.effects.window.hide) || 0, 455 s = ("number" === $.type(e) ? e : t) || 0; 456 this.element.stop(!0).fadeOut( 457 s || 0, 458 $.proxy(function () { 459 this.detach(), (this.visible = !1), i && i(); 460 }, this) 461 ); 462 } else i && i(); 463 }, 464 getScrollDimensions: function () { 465 var n = {}; 466 return ( 467 $.each(["width", "height"], function (i, e) { 468 var t = e.substr(0, 1).toUpperCase() + e.substr(1), 469 s = document.documentElement; 470 n[e] = (Browser.IE ? Math.max(s["offset" + t], s["scroll" + t]) : Browser.WebKit ? document.body["scroll" + t] : s["scroll" + t]) || 0; 471 }), 472 n 473 ); 474 }, 475 max: function () { 476 var i; 477 if ((Browser.MobileSafari && Browser.WebKit && Browser.WebKit < 533.18 && ((i = this.getScrollDimensions()), this.element.css(i)), Browser.IE && Browser.IE < 9)) { 478 var e = Bounds.viewport(); 479 this.element.css({ height: e.height, width: e.width }); 480 } 481 Support.mobileTouch && !i && this.element.css({ height: this.getScrollDimensions().height }); 482 }, 483 }, 484 Window = { 485 initialize: function () { 486 (this.queues = []), (this.queues.hide = $({})), (this.pages = []), (this._tracking = []), (this._first = !0), (this.timers = new Timers()), this.build(), this.setSkin(Options.defaults.skin); 487 }, 488 build: function () { 489 if ( 490 ((this.element = $("<div>")
491 .addClass("fr-window fr-measured") 492 .hide() 493 .append( 494 (this._box = $("<div>") 495 .addClass("fr-box") 496 .append((this._pages = $("<div>").addClass("fr-pages")))) 497 ) 498 .append((this._thumbnails = $("<div>").addClass("fr-thumbnails")))), 499 Overlay.initialize(), 500 Pages.initialize(this._pages), 501 Thumbnails.initialize(this._thumbnails), 502 Spinner.initialize(), 503 UI.initialize(), 504 this.element.addClass("fr" + (Support.mobileTouch ? "" : "-no") + "-mobile-touch"), 505 this.element.addClass("fr" + (Support.svg ? "" : "-no") + "-svg"), 506 Browser.IE) 507 ) 508 for (var i = 7; i <= 9; i++) Browser.IE < i && this.element.addClass("fr-ltIE" + i); 509 this.element.on("fresco:mousewheel", function (i) { 510 i.preventDefault(); 511 }); 512 }, 513 attach: function () { 514 this._attached || ($(document.body).append(this.element), (this._attached = !0)); 515 }, 516 detach: function () { 517 this._attached && (this.element.detach(), (this._attached = !1)); 518 }, 519 setSkin: function (i) { 520 this._skin && this.element.removeClass("fr-window-skin-" + this._skin), this.element.addClass("fr-window-skin-" + i), Overlay.setSkin(i), (this._skin = i); 521 }, 522 setShowingType: function (i) { 523 this._showingType !== i && 524 (this._showingType && (this.element.removeClass("fr-showing-type-" + this._showingType), Type.isVideo(this._showingType) && this.element.removeClass("fr-showing-type-video")), 525 this.element.addClass("fr-showing-type-" + i), 526 Type.isVideo(i) && this.element.addClass("fr-showing-type-video"), 527 (this._showingType = i)); 528 }, 529 startObservingResize: function () { 530 this._onWindowResizeHandler || $(window).on("resize orientationchange", (this._onWindowResizeHandler = $.proxy(this._onWindowResize, this))); 531 }, 532 stopObservingResize: function () { 533 this._onWindowResizeHandler && ($(window).off("resize orientationchange", this._onWindowResizeHandler), (this._onWindowResizeHandler = null)); 534 }, 535 _onScroll: function () { 536 Support.mobileTouch && this.timers.set("scroll", $.proxy(this.adjustToScroll, this), 0); 537 }, 538 _onWindowResize: function () { 539 var i; 540 (i = Pages.page) && (Thumbnails.fitToViewport(), this.updateBoxDimensions(), i.fitToBox(), UI.update(), UI.adjustPrevNext(null, 0), Spinner.center(), Overlay.max(), UI._onWindowResize(), this._onScroll()); 541 }, 542 adjustToScroll: function () { 543 Support.mobileTouch && this.element.css({ top: $(window).scrollTop() }); 544 }, 545 getBoxDimensions: function () { 546 return this._boxDimensions; 547 }, 548 updateBoxDimensions: function () { 549 if (Pages.page) { 550 var i = Bounds.viewport(), 551 e = Thumbnails.getDimensions(), 552 t = "horizontal" === Thumbnails._orientation; 553 (this._boxDimensions = { width: t ? i.width : i.width - e.width, height: t ? i.height - e.height : i.height }), 554 (this._boxPosition = { top: 0, left: t ? 0 : e.width }), 555 this._box.css($.extend({}, this._boxDimensions, this._boxPosition)); 556 } 557 }, 558 show: function (i, e) { 559 if (this.visible) i && i(); 560 else { 561 (this.visible = !0), (this.opening = !0), this.attach(), this.timers.clear("show-window"), this.timers.clear("hide-overlay"), this.adjustToScroll(); 562 var t = ("number" === $.type(e) ? e : Pages.page && Pages.page.view.options.effects.window.show) || 0, 563 s = 2; 564 Overlay[Pages.page && Pages.page.view.options.overlay ? "show" : "hide"](function () { 565 i && --s < 1 && i();
566 }, t), 567 this.timers.set( 568 "show-window", 569 $.proxy(function () { 570 this._show( 571 $.proxy(function () { 572 (this.opening = !1), i && --s < 1 && i(); 573 }, this), 574 t 575 ); 576 }, this), 577 1 < t ? Math.min(0.5 * t, 50) : 1 578 ); 579 } 580 }, 581 _show: function (i, e) { 582 var t = ("number" === $.type(e) ? e : Pages.page && Pages.page.view.options.effects.window.show) || 0; 583 this.element.stop(!0).fadeTo(t, 1, i); 584 }, 585 hide: function (e) { 586 if (this.view) { 587 var i = this.queues.hide; 588 i.queue([]), this.timers.clear("show-window"), this.timers.clear("hide-overlay"); 589 var t = Pages.page ? Pages.page.view.options.effects.window.hide : 0; 590 i.queue( 591 $.proxy(function (i) { 592 Pages.stop(), Spinner.hide(), i(); 593 }, this) 594 ), 595 i.queue( 596 $.proxy(function (i) { 597 UI.disable(), UI.hide(null, t), Keyboard.disable(), i(); 598 }, this) 599 ), 600 i.queue( 601 $.proxy(function (i) { 602 var e = 2; 603 this._hide(function () { 604 --e < 1 && i(); 605 }, t), 606 this.timers.set( 607 "hide-overlay", 608 $.proxy(function () { 609 Overlay.hide(function () { 610 --e < 1 && i(); 611 }, t); 612 }, this), 613 1 < t ? Math.min(0.5 * t, 150) : 1 614 ), 615 (this._first = !0); 616 }, this) 617 ), 618 i.queue( 619 $.proxy(function (i) { 620 this._reset(), this.stopObservingResize(), Pages.removeAll(), Thumbnails.clear(), this.timers.clear(), (this._position = -1); 621 var e = Pages.page && Pages.page.view.options.afterHide; 622 "function" === $.type(e) && e.call(Fresco), (this.view = null), (this.opening = !1), (this.closing = !1), this.detach(), i(); 623 }, this) 624 ), 625 "function" === $.type(e) && 626 i.queue( 627 $.proxy(function (i) { 628 e(), i(); 629 }, this) 630 ); 631 } 632 }, 633 _hide: function (i, e) { 634 var t = ("number" === $.type(e) ? e : Pages.page && Pages.page.view.options.effects.window.hide) || 0; 635 this.element.stop(!0).fadeOut(t, i); 636 }, 637 load: function (i, e) { 638 (this.views = i), this.attach(), Thumbnails.load(i), Pages.load(i), this.startObservingResize(), e && this.setPosition(e); 639 }, 640 setPosition: function (i, e) { 641 (this._position = i), 642 (this.view = this.views[i - 1]), 643 this.stopHideQueue(), 644 (this.page = Pages.show( 645 i, 646 $.proxy(function () { 647 e && e(); 648 }, this) 649 )); 650 }, 651 stopHideQueue: function () { 652 this.queues.hide.queue([]); 653 }, 654 _reset: function () { 655 (this.visible = !1), UI.hide(null, 0), UI.reset(); 656 }, 657 mayPrevious: function () { 658 return (this.view && this.view.options.loop && this.views && 1 < this.views.length) || 1 !== this._position; 659 }, 660 previous: function (i) { 661 var e = this.mayPrevious(); 662 (i || e) && this.setPosition(this.getSurroundingIndexes().previous); 663 }, 664 mayNext: function () { 665 var i = this.views && 1 < this.views.length; 666 return (this.view && this.view.options.loop && i) || (i && 1 !== this.get
666SurroundingIndexes().next); 667 }, 668 next: function (i) { 669 var e = this.mayNext(); 670 (i || e) && this.setPosition(this.getSurroundingIndexes().next); 671 }, 672 getSurroundingIndexes: function () { 673 if (!this.views) return {}; 674 var i = this._position, 675 e = this.views.length; 676 return { previous: i <= 1 ? e : i - 1, next: e <= i ? 1 : i + 1 }; 677 }, 678 }, 679 Keyboard = { 680 enabled: !1, 681 keyCode: { left: 37, right: 39, esc: 27 }, 682 enable: function (i) { 683 this.disable(), 684 i && 685 ($(document) 686 .on("keydown", (this._onKeyDownHandler = $.proxy(this.onKeyDown, this))) 687 .on("keyup", (this._onKeyUpHandler = $.proxy(this.onKeyUp, this))), 688 (this.enabled = i)); 689 }, 690 disable: function () { 691 (this.enabled = !1), this._onKeyUpHandler && ($(document).off("keyup", this._onKeyUpHandler).off("keydown", this._onKeyDownHandler), (this._onKeyUpHandler = this._onKeyDownHandler = null)); 692 }, 693 onKeyDown: function (i) { 694 if (this.enabled) { 695 var e = this.getKeyByKeyCode(i.keyCode); 696 if (e && (!e || !this.enabled || this.enabled[e])) 697 switch ((i.preventDefault(), i.stopPropagation(), e)) { 698 case "left": 699 Window.previous(); 700 break; 701 case "right": 702 Window.next(); 703 } 704 } 705 }, 706 onKeyUp: function (i) { 707 if (this.enabled) { 708 var e = this.getKeyByKeyCode(i.keyCode); 709 if (e && (!e || !this.enabled || this.enabled[e])) 710 switch (e) { 711 case "esc": 712 Window.hide(); 713 } 714 } 715 }, 716 getKeyByKeyCode: function (i) { 717 for (var e in this.keyCode) if (this.keyCode[e] === i) return e; 718 return null; 719 }, 720 }, 721 Page = 722 ((Lc = 0), 723 (Mc = {}), 724 (Nc = $("<div>") 725 .addClass("fr-stroke fr-stroke-top fr-stroke-horizontal") 726 .append($("<div>").addClass("fr-stroke-color")) 727 .add($("<div>").addClass("fr-stroke fr-stroke-bottom fr-stroke-horizontal").append($("<div>").addClass("fr-stroke-color"))) 728 .add($("<div>").addClass("fr-stroke fr-stroke-left fr-stroke-vertical").append($("<div>").addClass("fr-stroke-color"))) 729 .add($("<div>").addClass("fr-stroke fr-stroke-right fr-stroke-vertical").append($("<div>").addClass("fr-stroke-color")))), 730 $.extend(Oc.prototype, { 731 initialize: function (i, e, t) { 732 (this.view = i), (this.dimensions = { width: 0, height: 0 }), (this.uid = Lc++), (this._position = e), (this._total = t), (this._fullClick = !1), (this._visible = !1), (this.queues = {}), (this.queues.showhide = $({})); 733 }, 734 create: function () { 735 if (!this._created) { 736 Pages.element.append( 737 (this.element = $("<div>") 738 .addClass("fr-page") 739 .append((this.container = $("<div>").addClass("fr-container"))) 740 .css({ opacity: 0 }) 741 .hide()) 742 ); 743 var i = this.view.options.position && 1 < this._total; 744 if ( 745 (i && this.element.addClass("fr-has-position"), 746 (this.view.caption || i) && 747 (this.element.append( 748 (this.info = $("<div>") 749 .addClass("fr-info") 750 .append($("<div>").addClass("fr-info-background")) 751 .append(Nc.clone(!0)) 752 .append((this.infoPadder = $("<div>").addClass("fr-info-padder")))) 753 ), 754 i && 755 (this.element.addClass("fr-has-position"), 756 this.infoPadder.append( 757 (this.pos = $("<div>") 758 .addClass("fr-position") 759 .append( 760 $("<span>") 761 .addClass("fr-position-text") 762 .html(this._position + " / " + this._total) 763 )) 764 )), 765 this.view.caption && this.infoPadder.append((this.caption = $("<div>").addClass("fr-caption").html(this.view.caption)))), 766 this.container.append((this.background = $("<div>").addClass("fr-content-background"))).append((this.content = $("<div>").addClass("fr-content"))), 767 "image" == this.view.type && (this.content.append((this.image = $("<img>").addClass("fr-content-element").attr({ src: this.view.url }))), this.content.append(Nc.clone(!0))), 768 i && 769 "outside" == this.view.options.ui && 770 this.container.append( 771 (this.positionOutside = $("<div>") 772 .addClass("fr-position-outside") 773 .append($("<div>").addClass("fr-position-background")) 774 .append( 775 $("<span>") 776 .addClass("fr-position-text") 777 .html(this._position + " / " + this._total) 778 )) 779 ), 780 "inside" == this.view.options.ui) 781 ) { 782 this.content 783 .append( 784 (this.previousInside = $("<div>") 785 .addClass("fr-side fr-side-previous fr-toggle-ui") 786 .append($("<div>").addClass("fr-side-button").append($("<div>").addClass("fr-side-button-background")).append($("<div>").addClass("fr-side-button-icon")))) 787 ) 788 .append( 789 (this.nextInside = $("<div>") 790 .addClass("fr-side fr-side-next fr-toggle-ui") 791 .append($("<div>").addClass("fr-side-button").append($("<div>").addClass("fr-side-button-background")).append($("<div>").addClass("fr-side-button-icon")))) 792 ) 793 .append((this.closeInside = $("<div>").addClass("fr-close fr-toggle-ui").append($("<div>").addClass("fr-close-background")).append($("<div>").addClass("fr-close-icon")))), 794 (this.view.caption || (i && this.view.grouped.caption)) && 795 (this.content.append( 796 (this.infoInside = $("<div>") 797 .addClass("fr-info fr-toggle-ui") 798 .append($("<div>").addClass("fr-info-background")) 799 .append(Nc.clone(!0)) 800 .append((this.infoPadderInside = $("<div>").addClass("fr-info-padder")))) 801 ), 802 i && 803 this.infoPadderInside.append( 804 (this.posInside = $("<div>") 805 .addClass("fr-position") 806 .append( 807 $("<span>") 808 .addClass("fr-position-text") 809 .html(this._position + " / " + this._total) 810 )) 811 ), 812 this.view.caption && this.infoPadderInside.append((this.captionInside = $("<div>").addClass("fr-caption").html(this.view.caption)))), 813 this.view.caption || 814 !i || 815 this.view.grouped.caption || 816 this.content.append( 817 (this.positionInside = $("<div>") 818 .addClass("fr-position-inside fr-toggle-ui") 819 .append($("<div>").addClass("fr-position-background")) 820 .append( 821 $("<span>") 822 .addClass("fr-position-text") 823 .html(this._position + " / " + this._total) 824 )) 825 ); 826 var e = (this.view.options.loop && 1 < this._total) || 1 != this._position, 827 t = (this.view.options.loop && 1 < this._total) || this._position < this._total; 828 this.previousInside[(e ? "remove" : "add") + "Class"]("fr-side-disabled"), this.nextInside[(t ? "remove" : "add") + "Class"]("fr-side-disabled"); 829 } 830 $.each( 831 ["x", "y"], 832 $.proxy(function (i, e) { 833 this.view.options.overflow[e] && this.element.addClass("fr-overflow-" + e); 834 }, this) 835 ), 836 this.element.addClass("fr-type-" + this.view.type), 837 Type.isVideo(this.view.type) && this.element.addClass("fr-type-video"), 838 this._total < 2 && this.element.addClass("fr-no-sides"), 839 (this._created = !0);
840 } 841 }, 842 _getSurroundingPages: function () { 843 var i; 844 if (!(i = this.view.options.preload)) return []; 845 for (var e = [], t = Math.max(1, this._position - i[0]), s = Math.min(this._position + i[1], this._total), n = this._position, o = n; o <= s; o++) (a = Pages.pages[o - 1])._position != n && e.push(a); 846 for (o = n; t <= o; o--) { 847 var a; 848 (a = Pages.pages[o - 1])._position != n && e.push(a); 849 } 850 return e; 851 }, 852 preloadSurroundingImages: function () { 853 var i = this._getSurroundingPages(); 854 $.each( 855 i, 856 $.proxy(function (i, e) { 857 e.preload(); 858 }, this) 859 ); 860 }, 861 preload: function () { 862 this.preloading || 863 this.preloaded || 864 "image" != this.view.type || 865 !this.view.options.preload || 866 this.loaded || 867 (this.create(), 868 (this.preloading = !0), 869 (this.preloadReady = new ImageReady( 870 this.image[0], 871 $.proxy(function (i) { 872 (this.loaded = !0), (Mc[this.view.url] = !0), (this.preloading = !1), (this.preloaded = !0), (this.dimensions = { width: i.img.naturalWidth, height: i.img.naturalHeight }); 873 }, this), 874 null, 875 { method: "naturalWidth" } 876 ))); 877 }, 878 load: function (e, i) { 879 if ((this.create(), this.loaded)) e && e(); 880 else 881 switch ( 882 (this.abort(), 883 (this.loading = !0), 884 this.view.options.spinner && 885 (this._spinnerDelay = setTimeout( 886 $.proxy(function () { 887 Spinner.show(); 888 }, this), 889 this.view.options.spinnerDelay || 0 890 )), 891 this.view.type) 892 ) { 893 case "image": 894 if (this.error) return void (e && e()); 895 this.imageReady = new ImageReady( 896 this.image[0], 897 $.proxy(function (i) { 898 this._markAsLoaded(), this.setDimensions({ width: i.img.naturalWidth, height: i.img.naturalHeight }), e && e(); 899 }, this), 900 $.proxy(function () { 901 this._markAsLoaded(), 902 this.image.hide(), 903 this.content.prepend((this.error = $("<div>").addClass("fr-error fr-content-element").append($("<div>").addClass("fr-error-icon")))), 904 this.element.addClass("fr-has-error"), 905 this.setDimensions({ width: this.error.outerWidth(), height: this.error.outerHeight() }), 906 this.error.css({ width: "100%", height: "100%" }), 907 e && e(); 908 }, this), 909 { method: this.view.options.loadedMethod } 910 ); 911 break; 912 case "vimeo": 913 this.vimeoReady = new VimeoReady( 914 this.view.url, 915 $.proxy(function (i) { 916 this._markAsLoaded(), this.setDimensions({ width: i.dimensions.width, height: i.dimensions.height }), e && e(); 917 }, this) 918 ); 919 break; 920 case "youtube": 921 this._markAsLoaded(), this.setDimensions({ width: this.view.options.width, height: this.view.options.height }), e && e(); 922 } 923 }, 924 setDimensions: function (i) { 925 if (((this.dimensions = i), this.view.options.maxWidth || this.view.options.maxHeight)) { 926 var e = this.view.options, 927 t = { width: e.maxWidth ? e.maxWidth : this.dimensions.width, height: e.maxHeight ? e.maxHeight : this.dimensions.height }; 928 this.dimensions = Fit.within(t, this.dimensions); 929 } 930 }, 931 _markAsLoaded: function () { 932 this._abortSpinnerDelay(), (this.loading = !1), (this.loaded = !0), (Mc[this.view.url] = !0), Spinner.hide(null, null, this._position); 933 }, 934 isVideo: function () { 935 return Type.isVideo(this.view.type); 936 }, 937 insertVideo: function (i) { 938 if (!this.playerIframe && this.isVideo()) { 939 var e = "http" + (window.location && "https:" === window.location.protocol ? "s" : "") + ":", 940 t = $.extend({}, this.view.options[this.view.type] || {}), 941 s = $.param(t), 942 n = { vimeo: e + "//player.vimeo.com/video/{id}?{queryString}", youtube: e + "//www.youtube.com/embed/{id}?{queryString}" }[this.view.type].replace("{id}", this.view._data.id).replace("{queryString}", s);
943 this.content.prepend( 944 (this.playerIframe = $("<iframe webkitAllowFullScreen mozallowfullscreen allowFullScreen>") 945 .addClass("fr-content-element") 946 .attr({ src: n, height: this._contentDimensions.height, width: this._contentDimensions.width, frameborder: 0 })) 947 ), 948 i && i(); 949 } else i && i(); 950 }, 951 raise: function () { 952 var i = Pages.element[0].lastChild; 953 (i && i === this.element[0]) || Pages.element.append(this.element); 954 }, 955 show: function (e) { 956 var i = this.queues.showhide; 957 i.queue([]), 958 i.queue( 959 $.proxy(function (i) { 960 var e = this.view.options.spinner && !Mc[this.view.url]; 961 Spinner._visible && !e && Spinner.hide(), Pages.stopInactive(), i(); 962 }, this) 963 ), 964 i.queue( 965 $.proxy(function (i) { 966 this.updateUI(), UI.set(this._ui), i(); 967 }, this) 968 ), 969 i.queue( 970 $.proxy(function (i) { 971 Keyboard.enable(this.view.options.keyboard), i();
972 }, this) 973 ), 974 i.queue( 975 $.proxy(function (i) { 976 Spinner.setSkin(this.view.options.skin), 977 this.load( 978 $.proxy(function () { 979 this.preloadSurroundingImages(), i(); 980 }, this) 981 ); 982 }, this) 983 ), 984 i.queue( 985 $.proxy(function (i) { 986 this.raise(), Window.setSkin(this.view.options.skin), UI.enable(), this.fitToBox(), Window.adjustToScroll(), i(); 987 }, this) 988 ), 989 this.isVideo() && 990 i.queue( 991 $.proxy(function (i) { 992 this.insertVideo( 993 $.proxy(function () { 994 i(); 995 }) 996 ); 997 }, this) 998 ), 999 this.view.options.sync || 1000 i.queue( 1001 $.proxy(function (i) { 1002 Pages.hideInactive(i); 1003 }, this) 1004 ), 1005 i.queue( 1006 $.proxy(function (i) { 1007 var e = 3, 1008 t = this.view.options.effects.content.show; 1009 Window.setShowingType(this.view.type), 1010 Window.visible || ((t = this.view.options.effects.window.show), "function" === $.type(this.view.options.onShow) && this.view.options.onShow.call(Fresco)), 1011 this.view.options.sync && 1012 (e++, 1013 Pages.hideInactive(function () { 1014 --e < 1 && i(); 1015 })), 1016 Window.show(function () { 1017 --e < 1 && i(); 1018 }, this.view.options.effects.window.show), 1019 this._show(function () { 1020 --e < 1 && i(); 1021 }, t), 1022 UI.adjustPrevNext( 1023 function () { 1024 --e < 1 && i(); 1025 }, 1026 Window._first ? 0 : t 1027 ), 1028 Window._first ? (UI.show(null, 0), (Window._first = !1)) : UI.show(null, 0); 1029 var s = this.view.options.afterPosition; 1030 "function" === $.type(s) && s.call(Fresco, this._position); 1031 }, this) 1032 ), 1033 i.queue( 1034 $.proxy(function (i) { 1035 (this._visible = !0), e && e(), i(); 1036 }, this) 1037 ); 1038 }, 1039 _show: function (i, e) { 1040 var t = Window.visible ? ("number" === $.type(e) ? e : this.view.options.effects.content.show) : 0; 1041 this.element 1042 .stop(!0) 1043 .show() 1044 .fadeTo(t || 0, 1, i); 1045 }, 1046 hide: function (i, e) { 1047 if (this.element) { 1048 this.removeVideo(), this.abort(); 1049 var t = "number" === $.type(e) ? e : this.view.options.effects.c
1049ontent.hide; 1050 this.isVideo() && (t = 0), 1051 this.element.stop(!0).fadeTo( 1052 t, 1053 0, 1054 "frescoEaseInCubic", 1055 $.proxy(function () { 1056 this.element.hide(), (this._visible = !1), Pages.removeTracking(this._position), i && i(); 1057 }, this) 1058 ); 1059 } else i && i(); 1060 }, 1061 stop: function () { 1062 this.queues.showhide.queue([]), this.element && this.element.stop(!0), this.abort(); 1063 }, 1064 removeVideo: function () { 1065 this.playerIframe && ((this.playerIframe[0].src = "//about:blank"), this.playerIframe.remove(), (this.playerIframe = null)); 1066 }, 1067 remove: function () { 1068 this.stop(), 1069 this.removeVideo(), 1070 this.element && this.element.remove(), 1071 this._track && (Pages.removeTracking(this._position), (this._track = !1)), 1072 this.preloadReady && (this.preloadReady.abort(), (this.preloadReady = null), (this.preloading = null), (this.preloaded = null)), 1073 (this._visible = !1), 1074 (this.removed = !0); 1075 }, 1076 abort: function () { 1077 this.imageReady && (this.imageReady.abort(), (this.imageReady = null)), this.vimeoReady && (this.vimeoReady.abort(), (this.vimeoReady = null)), this._abortSpinnerDelay(), (this.loading = !1); 1078 }, 1079 _abortSpinnerDelay: function () { 1080 this._spinnerDelay && (clearTimeout(this._spinnerDelay), (this._spinnerDelay = null)); 1081 }, 1082 _getInfoHeight: function (i) { 1083 var e = this.view.options.position && 1 < this._total; 1084 switch (this._ui) { 1085 case "fullclick": 1086 case "inside": 1087 if (!this.view.caption && !e) return 0; 1088 break; 1089 case "outside": 1090 if (!this.view.caption) return 0; 1091 } 1092 var t = "inside" === this._ui ? this.infoInside : this.info; 1093 "outside" === this._ui && (i = Math.min(i, Window._boxDimensions.width)); 1094 var s, 1095 n = t[0].style.width; 1096 return ("inside" !== this._ui && "fullclick" !== this._ui) || (n = "100%"), t.css({ width: i + "px" }), (s = parseFloat(t.outerHeight())), t.css({ width: n }), s; 1097 }, 1098 _whileVisible: function (i, e) { 1099 var t = [], 1100 s = Window.element.add(this.element); 1101 e && (s = s.add(e)), 1102 $.each(s, function (i, e) { 1103 $(e).is(":visible") || t.push($(e).show()); 1104 }); 1105 var n = this.element.hasClass("fr-no-caption"); 1106 this.element.removeClass("fr-no-caption"); 1107 var o = this.element.hasClass("fr-has-caption"); 1108 this.element.addClass("fr-has-caption"), 1109 Window.element.css({ visibility: "hidden" }), 1110 i(), 1111 Window.element.css({ visibility: "visible" }), 1112 n && this.element.addClass("fr-no-caption"), 1113 o || this.element.removeClass("fr-has-caption"), 1114 $.each(t, function (i, e) { 1115 e.hide(); 1116 }); 1117 }, 1118 updateForced: function () { 1119 this.create(), 1120 (this._fullClick = this.view.options.fullClick), 1121 (this._noOverflow = !1), 1122 0 < parseInt(this.element.css("min-width")) && (this._fullClick = !0), 1123 0 < parseInt(this.element.css("min-height")) && (this._noOverflow = !0);
1124 }, 1125 updateUI: function () { 1126 this.updateForced(); 1127 var i = this._fullClick ? "fullclick" : this.view.options.ui; 1128 this._ui && this.element.removeClass("fr-ui-" + this._ui), this.element.addClass("fr-ui-" + i), (this._ui = i); 1129 }, 1130 fitToBox: function () { 1131 if (this.content) { 1132 this.element; 1133 var t = $.extend({}, Window.getBoxDimensions()), 1134 i = $.extend({}, this.dimensions), 1135 e = this.container; 1136 this.updateUI(); 1137 var s = { left: parseInt(e.css("padding-left")), top: parseInt(e.css("padding-top")) }; 1138 if ("outside" === this._ui && this._positionOutside) { 1139 var n = 0; 1140 this._whileVisible( 1141 $.proxy(function () { 1142 this._positionOutside.is(":visible") && (n = this._positionOutside.outerWidth(!0)); 1143 }, this) 1144 ), 1145 n > s.left && (s.left = n); 1146 } 1147 (t.width -= 2 * s.left), (t.height -= 2 * s.top); 1148 var o, 1149 a, 1150 h = { width: !0, height: !!this._noOverflow || !this.view.options.overflow.y }, 1151 r = Fit.within(t, i, h), 1152 d = $.extend({}, r), 1153 l = (this.content, 0), 1154 u = "inside" === this._ui, 1155 c = u ? this.infoInside : this.info, 1156 p = u ? this.captionInside : this.caption, 1157 f = u ? this.posInside : this.pos, 1158 m = !!p; 1159 switch (this._ui) { 1160 case "outside": 1161 var v = $.extend({}, d); 1162 this.caption && 1163 ((a = this.caption), 1164 this._whileVisible( 1165 $.proxy(function () { 1166 for (var i = 0; i < 2; ) { 1167 l = this._getInfoHeight(d.width); 1168 var e = t.height - d.height; 1169 e < l && (d = Fit.within({ width: d.width, height: Math.max(d.height - (l - e), 0) }, d, h)), i++; 1170 } 1171 (l = this._getInfoHeight(d.width)), ((!this.view.options.overflow.y && l + d.height > t.height) || (c && "none" === c.css("display")) || l >= 0.5 * d.height) && ((m = !1), (l = 0), (d = v)); 1172 }, this), 1173 a 1174 )), 1175 c && c.css({ width: d.width + "px" }), 1176 (o = { width: d.width, height: d.height + l }); 1177 break; 1178 case "inside": 1179 this.caption && 1180 ((a = p), 1181 this._whileVisible( 1182 $.proxy(function () { 1183 (l = this._getInfoHeight(d.width)) >= 0.45 * d.height && ((m = !1), (l = 0)); 1184 }, this), 1185 a 1186 )), 1187 (o = d); 1188 break; 1189 case "fullclick": 1190 var g = []; 1191 p && g.push(p), 1192 this._whileVisible( 1193 $.proxy(function () { 1194 if (((p || f) && c.css({ width: "100%" }), (l = this._getInfoHeight(Window._boxDimensions.width)), p && l > 0.5 * t.height)) 1195 if (((m = !1), f)) { 1196 var i = this.caption.is(":visible"); 1197 this.caption.hide(), (l = this._getInfoHeight(Window._boxDimensions.width)), i && this.caption.show(); 1198 } else l = 0; 1199 (d = Fit.within({ width: t.width, height: Math.max(0, t.height - l) }, d, h)), (o = d); 1200 }, this), 1201 g 1202 ), 1203 this.content.css({ "padding-bottom": 0 }); 1204 } 1205 p && p[m ? "show" : "hide"](), 1206 this.element[(m ? "remove" : "add") + "Class"]("fr-no-caption"), 1207 this.element[(m ? "add" : "remove") + "Class"]("fr-has-caption"), 1208 this.content.css(d), 1209 this.background.css(o), 1210 this.playerIframe && this.playerIframe.attr(d), 1211 (this.overlap = { y: o.height + ("fullclick" === this._ui ? l : 0) - Window._boxDimensions.height, x: 0 }), 1212 (this._track = !this._noOverflow && this.view.options.overflow.y && 0 < this.overlap.y), 1213 (this._infoHeight = l), 1214 (this._padding = s), 1215 (this._contentDimensions = d), 1216 (this._backgroundDimensions = o), 1217 Pages[(this._track ? "set" : "remove") + "Tracking"](this._position), 1218 this.position(); 1219 } 1220 }, 1221 position: function () { 1222 if (this.content) { 1223 var i = this._contentDimensions, 1224 e = this._backgroundDimensions, 1225 t = { top: 0.5 * Window._boxDimensions.height - 0.5 * e.height, left: 0.5 * Window._boxDimensions.width - 0.5 * e.width }, 1226 s = { top: t.top + i.height, left: t.left }, 1227 n = 0, 1228 o = "inside" === this._ui ? this.infoInside : this.info; 1229 switch (this._ui) { 1230 case "fullclick": 1231 (t.top = 0.5 * (Window._boxDimensions.height - this._infoHeight) - 0.5 * e.height), (s = { top: Window._boxDimensions.height - this._infoHeight, left: 0, bottom: "auto" }), (n = this._infoHeight); 1232 break; 1233 case "inside": 1234 s = { top: "auto", left: 0, bottom: 0 }; 1235 } 1236 if (0 < this.overlap.y) { 1237 var a = Pages.getXYP(); 1238 switch (((t.top = 0 - a.y * this.overlap.y), this._ui)) { 1239 case "outside": 1240 case "fullclick": 1241 s.top = Window._boxDimensions.height - this._infoHeight; 1242 break; 1243 case "inside": 1244 var h = t.top + i.height - W
1244indow._boxDimensions.height, 1245 r = -1 * t.top; 1246 if (((s.bottom = h), this.closeInside.css({ top: r }), 1 < this._total)) { 1247 var d = Window.element.is(":visible"); 1248 d || Window.element.show(); 1249 var l = this.previousInside.attr("style"); 1250 this.previousInside.removeAttr("style"); 1251 var u = parseInt(this.previousInside.css("margin-top")); 1252 this.previousInside.attr({ style: l }), d || Window.element.hide(); 1253 var c = this.previousInside.add(this.nextInside), 1254 p = 0.5 * this.overlap.y; 1255 c.css({ "margin-top": u + (r - p) }), this.positionInside && this.positionInside.css({ bottom: h }); 1256 } 1257 } 1258 } else "inside" === this._ui && this.element.find(".fr-info, .fr-side, .fr-close, .fr-position-inside").removeAttr("style"); 1259 o && o.css(s), this.container.css({ bottom: n }), this.content.css(t), this.background.css(t); 1260 } 1261 }, 1262 }), 1263 Oc), 1264 Lc, 1265 Mc, 1266 Nc; 1267 function Oc() { 1268 return this.initialize.apply(this, _slice.call(arguments)); 1269 } 1270 var Pages = { 1271 initialize: function (i) { 1272 (this.element = i), (this.pages = []), (this.uid = 1), (this._tracking = []); 1273 }, 1274 load: function (i) { 1275 (this.views = i), 1276 this.removeAll(), 1277 $.each( 1278 i, 1279 $.proxy(function (i, e) { 1280 this.pages.push(new Page(e, i + 1, this.views.length)); 1281 }, this) 1282 ); 1283 }, 1284 show: function (i, e) { 1285 var t = this.pages[i - 1]; 1286 (this.page && this.page.uid === t.uid) || 1287 ((this.page = t), 1288 Thumbnails.show(i), 1289 Window.updateBoxDimensions(), 1290 t.show( 1291 $.proxy(function () { 1292 e && e(); 1293 }, this) 1294 )); 1295 }, 1296 getPositionInActivePageGroup: function (t) { 1297 var s = 0; 1298 return ( 1299 $.each(this.pages, function (i, e) { 1300 e.view.element && e.view.element === t && (s = i + 1); 1301 }), 1302 s 1303 ); 1304 }, 1305 getLoadingCount: function () { 1306 var t = 0; 1307 return ( 1308 $.each(this.pages, function (i, e) { 1309 e.loading && t++; 1310 }), 1311 t 1312 ); 1313 }, 1314 removeAll: function () { 1315 $.each(this.pages, function (i, e) { 1316 e.remove(); 1317 }), 1318 (this.pages = []); 1319 }, 1320 hideInactive: function (t, s) { 1321 var n = []; 1322 $.each( 1323 this.pages, 1324 $.proxy(function (i, e) { 1325 e.uid !== this.page.uid && n.push(e); 1326 }, this) 1327 ); 1328 var o = 0 + n.length; 1329 return ( 1330 o < 1 1331 ? t && t() 1332 : $.each(n, function (i, e) { 1333 e.hide(function () { 1334 t && --o < 1 && t(); 1335 }, s); 1336 }), 1337 n.length 1338 ); 1339 }, 1340 stopInactive: function () { 1341 $.each( 1342 this.pages, 1343 $.proxy(function (i, e) { 1344 e.uid !== this.page.uid && e.stop(); 1345 }, this) 1346 ); 1347 }, 1348 stop: function () { 1349 $.each(this.pages, function (i, e) { 1350 e.stop(); 1351 }); 1352 }, 1353 handleTracking: function (i) { 1354 Browser.IE && Browser.IE < 9 1355 ? (this.setXY({ x: i.pageX, y: i.pageY }), this.updatePositions()) 1356 : (this._tracking_timer = setTimeout( 1357 $.proxy(function () { 1358 this.setXY({ x: i.pageX, y: i.pageY }), this.updatePositions(); 1359 }, this), 1360 30 1361 )); 1362 }, 1363 clearTrackingTimer: function () { 1364 this._tracking_timer && (clearTimeout(this._tracking_timer), (this._tracking_timer = null)); 1365 }, 1366 startTracking: function () { 1367 Support.mobileTouch || this._handleTracking || $(document.documentElement).on("mousemove", (this._handleTracking = $.proxy(this.handleTracking, this))); 1368 }, 1369 stopTracking: function () { 1370 !Support.mobileTouch && this._handleTracking && ($(document.documentElement).off("mousemove", this._handleTracking), (this._handleTracking = null), this.clearTrackingTimer()); 1371 }, 1372 setTracking: function (i) { 1373 this.isTracking(i) || (this._tracking.push(this.pages[i - 1]), 1 === this._tracking.length && this.startTracking()); 1374 }, 1375 clearTracking: function () { 1376 this._tracking = []; 1377 }, 1378 removeTracking: function (e) { 1379 (this._tracking = $.grep(this._tracking, function (i) { 1380 return i._position !== e; 1381 })), 1382 this._tracking.length < 1 && this.stopTracking(); 1383 }, 1384 isTracking: function (t) { 1385 var s = !1; 1386 return ( 1387 $.each(this._tracking, function (i, e) { 1388 if (e._position === t) return !(s = !0);
1389 }), 1390 s 1391 ); 1392 }, 1393 setXY: function (i) { 1394 this._xy = i; 1395 }, 1396 getXYP: function () { 1397 var i = Pages.page, 1398 t = $.extend({}, Window._boxDimensions), 1399 e = $.extend({}, this._xy); 1400 (e.y -= $(window).scrollTop()), i && ("outside" === i._ui || "fullclick" === i._ui) && 0 < i._infoHeight && (t.height -= i._infoHeight), (e.y -= Window._boxPosition.top); 1401 var s = { x: 0, y: Math.min(Math.max(e.y / t.height, 0), 1) }, 1402 n = { x: "width", y: "height" }, 1403 o = {}; 1404 return ( 1405 $.each( 1406 "y".split(" "), 1407 $.proxy(function (i, e) { 1408 (o[e] = Math.min(Math.max(20 / t[n[e]], 0), 1)), (s[e] *= 1 + 2 * o[e]), (s[e] -= o[e]), (s[e] = Math.min(Math.max(s[e], 0), 1)); 1409 }, this) 1410 ), 1411 this.setXYP(s), 1412 this._xyp 1413 ); 1414 }, 1415 setXYP: function (i) { 1416 this._xyp = i; 1417 }, 1418 updatePositions: function () { 1419 this._tracking.length < 1 || 1420 $.each(this._tracking, function (i, e) { 1421 e.position(); 1422 }); 1423 }, 1424 }; 1425 function View() { 1426 this.initialize.apply(this, _slice.call(arguments)); 1427 } 1428 $.extend(View.prototype, { 1429 initialize: function (object) { 1430 var options = arguments[1] || {}, 1431 data = {}; 1432 if ("string" === $.type(object)) object = { url: object }; 1433 else if (object && 1 === object.nodeType) { 1434 var element = $(object); 1435 object = { 1436 element: element[0], 1437 url: element.attr("href"), 1438 caption: element.attr("data-fresco-caption"), 1439 group: element.attr("data-fresco-group"), 1440 extension: element.attr("data-fresco-extension"), 1441 type: element.attr("data-fresco-type"), 1442 options: (element.attr("data-fresco-options") && eval("({" + element.attr("data-fresco-options") + "})")) || {}, 1443 }; 1444 } 1445 return ( 1446 object && (object.extension || (object.extension = detectExtension(object.url)), object.type || ((data = getURIData(object.url)), (object._data = data), (object.type = data.type))), 1447 object._data || (object._data = getURIData(object.url)), 1448 object && object.options ? (object.options = $.extend(!0, $.extend({}, options), $.extend({}, object.options))) : (object.options = $.extend({}, options)), 1449 (object.options = Options.create(object.options, object.type, object._data)), 1450 $.extend(this, object), 1451 this 1452 ); 1453 }, 1454 }); 1455 var Spinner = { 1456 supported: Support.css.transform && Support.css.animation, 1457 initialize: function (i) { 1458 this.element = $("<div>").addClass("fr-spinner").hide(); 1459 for (var e = 1; e <= 12; e++) this.element.append($("<div>").addClass("fr-spin-" + e)); 1460 this.element.on( 1461 "click", 1462 $.proxy(function () { 1463 Window.hide(); 1464 }, this) 1465 ), 1466 this.element.on("fresco:mousewheel", function (i) { 1467 i.preventDefault(); 1468 }); 1469 }, 1470 setSkin: function (i) { 1471 this.supported && (this._skin && this.element.removeClass("fr-spinner-skin-" + this._skin), this.updateDimensions(), this.element.addClass("fr-spinner-skin-" + i), (this._skin = i)); 1472 }, 1473 updateDimensions: function () { 1474 var i = this._attached; 1475 i || this.attach(), (this._dimensions = { width: this.element.outerWidth(), height: this.element.outerHeight() }), i || this.detach(); 1476 }, 1477 attach: function () { 1478 this._attached || ($(document.body).append(this.element), (this._attached = !0)); 1479 }, 1480 detach: function () { 1481 this._attached && (this.element.detach(), (this._attached = !1)); 1482 }, 1483 show: function (i, e) { 1484 (this._visible = !0), this.attach(), this.center(); 1485 var t = (Pages.page && Pages.page.view.options.effects.spinner.show) || 0, 1486 s = ("number" === $.type(e) ? e : t) || 0; 1487 this.element.stop(!0).fadeTo(s, 1, i); 1488 }, 1489 hide: function (i, e, t) { 1490 this._visible = !1; 1491 var s = (Pages.page && Pages.page.view.options.effects.spinner.hide) || 0, 1492 n = ("number" === $.type(e) ? e : s) || 0; 1493 this.element.stop(!0).fadeOut( 1494 n || 0, 1495 $.proxy(function () { 1496 this.detach(), i && i();
1497 }, this) 1498 ); 1499 }, 1500 center: function () { 1501 if (this.supported) { 1502 this._dimensions || this.updateDimensions(); 1503 var i = Pages.page, 1504 e = 0; 1505 i && 1506 "fullclick" === i._ui && 1507 i._whileVisible(function () { 1508 e = i._getInfoHeight(Window._boxDimensions.width); 1509 }), 1510 this.element.css({ 1511 top: Window._boxPosition.top + 0.5 * Window._boxDimensions.height - 0.5 * this._dimensions.height - 0.5 * e, 1512 left: Window._boxPosition.left + 0.5 * Window._boxDimensions.width - 0.5 * this._dimensions.width, 1513 }); 1514 } 1515 }, 1516 }, 1517 _Fresco = { 1518 _disabled: !1, 1519 _fallback: !0, 1520 initialize: function () { 1521 Window.initialize(), this._disabled || this.startDelegating(); 1522 }, 1523 startDelegating: function () { 1524 this._delegateHandler || 1525 $(document.documentElement) 1526 .on("click", ".fresco[href]", (this._delegateHandler = $.proxy(this.delegate, this))) 1527 .on("click", (this._setClickXYHandler = $.proxy(this.setClickXY, this))); 1528 }, 1529 stopDelegating: function () { 1530 this._delegateHandler && ($(document.documentElement).off("click", ".fresco[href]", this._delegateHandler).off("click", this._setClickXYHandler), (this._setClickXYHandler = null), (this._delegateHandler = null)); 1531 }, 1532 setClickXY: function (i) { 1533 Pages.setXY({ x: i.pageX, y: i.pageY }); 1534 }, 1535 delegate: function (i) { 1536 if (!this._disabled) { 1537 i.stopPropagation(), i.preventDefault(); 1538 var e = i.currentTarget; 1539 this.setClickXY(i), _Fresco.show(e); 1540 } 1541 }, 1542 show: function (object) { 1543 if (this._disabled) this.showFallback.apply(_Fresco, _slice.call(arguments)); 1544 else { 1545 var options = arguments[1] || {}, 1546 position = arguments[2]; 1547 arguments[1] && "number" === $.type(arguments[1]) && ((position = arguments[1]), (options = {})); 1548 var views = [], 1549 object_type, 1550 isElement = _.isElement(object); 1551 switch ((object_type = $.type(object))) { 1552 case "string": 1553 case "object": 1554 var view = new View(object, options), 1555 _dgo = "data-fresco-group-options", 1556 groupOptions = {}; 1557 if (view.group) { 1558 if (isElement) { 1559 var elements = $('.fresco[data-fresco-group="' + $(object).attr("data-fresco-group") + '"]'); 1560 elements.filter("[" + _dgo + "]").each(function (i, element) { 1561 $.extend(groupOptions, eval("({" + ($(element).attr(_dgo) || "") + "})")); 1562 }), 1563 elements.each(function (i, e) { 1564 position || e !== object || (position = i + 1), views.push(new View(e, $.extend({}, groupOptions, options))); 1565 }); 1566 } 1567 } else isElement && $(object).is("[" + _dgo + "]") && ($.extend(groupOptions, eval("({" + ($(object).attr(_dgo) || "") + "})")), (view = new View(object, $.extend({}, groupOptions, options)))), views.push(view); 1568 break; 1569 case "array": 1570 $.each(object, function (i, e) { 1571 var t = new View(e, options); 1572 views.push(t); 1573 }); 1574 } 1575 var groupExtend = { grouped: { caption: !1 } }, 1576 firstUI = views[0].options.ui, 1577 positionInAPG; 1578 $.each(views, function (i, e) { 1579 e.caption && (groupExtend.grouped.caption = !0), 0 < i && e.o
1579ptions.ui !== firstUI && (e.options.ui = firstUI); 1580 }), 1581 $.each(views, function (i, e) { 1582 e = $.extend(e, groupExtend); 1583 }), 1584 (!position || position < 1) && (position = 1), 1585 position > views.length && (position = views.length), 1586 isElement && (positionInAPG = Pages.getPositionInActivePageGroup(object)) ? Window.setPosition(positionInAPG) : Window.load(views, position); 1587 } 1588 }, 1589 showFallback: function (i) { 1590 if (this._fallback) { 1591 var e = (function i(e) { 1592 var t = $.type(e); 1593 return "string" === t ? e : "array" === t && e[0] ? i(e[0]) : _.isElement(e) && $(e).attr("href") ? $(e).attr("href") : !!e.url && e.url; 1594 })(i); 1595 e && (window.location.href = e); 1596 } 1597 }, 1598 }; 1599 $.extend(Fresco, { 1600 show: function (i) { 1601 return _Fresco.show.apply(_Fresco, _slice.call(arguments)), this; 1602 }, 1603 hide: function () { 1604 return Window.hide(), this; 1605 }, 1606 disable: function () { 1607 return _Fresco.stopDelegating(), (_Fresco._disabled = !0), this; 1608 }, 1609 enable: function () { 1610 return (_Fresco._disabled = !1), _Fresco.startDelegating(), this; 1611 }, 1612 fallback: function (i) { 1613 return (_Fresco._fallback = i), this; 1614 }, 1615 setDefaultSkin: function (i) { 1616 return (Options.defaults.skin = i), this; 1617 }, 1618 }), 1619 ((Browser.IE && Browser.IE < 7) || ("number" === $.type(Browser.Android) && Browser.Android < 3) || (Browser.MobileSafari && "number" === $.type(Browser.WebKit) && Browser.WebKit < 533.18)) && (_Fresco.show = _Fresco.showFallback); 1620 var Thumbnails = { 1621 initialize: function (i) { 1622 (this.element = i), (this._thumbnails = []), (this._orientation = "vertical"), (this._vars = { thumbnail: {}, thumbnailFrame: {}, thumbnails: {} }), this.build(), this.startObserving(); 1623 }, 1624 build: function () { 1625 this.element.append( 1626 (this.wrapper = $("<div>") 1627 .addClass("fr-thumbnails-wrapper") 1628 .append( 1629 (this._slider = $("<div>") 1630 .addClass("fr-thumbnails-slider") 1631 .append( 1632 (this._previous = $("<div>") 1633 .addClass("fr-thumbnails-side fr-thumbnails-side-previous") 1634 .append( 1635 (this._previous_button = $("<div>") 1636 .addClass("fr-thumbnails-side-button") 1637 .append($("<div>").addClass("fr-thumbnails-side-button-background")) 1638 .append($("<div>").addClass("fr-thumbnails-side-button-icon"))) 1639 )) 1640 ) 1641 .append( 1642 (this._thumbs = $("<div>") 1643 .addClass("fr-thumbnails-thumbs") 1644 .append((this._slide = $("<div>").addClass("fr-thumbnails-slide")))) 1645 ) 1646 .append( 1647 (this._next = $("<div>") 1648 .addClass("fr-thumbnails-side fr-thumbnails-side-next") 1649 .append( 1650 (this._next_button = $("<div>").addClass("fr-thumbnails-side-button").append($("<div>").addClass("fr-thumbnails-side-button-background")).append($("<div>").addClass("fr-thumbnails-side-button-icon"))) 1651 )) 1652 )) 1653 )) 1654 ); 1655 }, 1656 startObserving: function () { 1657 this._slider.delegate( 1658 ".fr-thumbnail", 1659 "click", 1660 $.proxy(function (i) { 1661 i.stopPropagation(); 1662 var e = $(i.target).closest(".fr-thumbnail")[0], 1663 t = e && $(e).data("fr-position"); 1664 t && (this.setActive(t), Window.setPosition(t)); 1665 }, this) 1666 ), 1667 this._slider.bind("click", function (i) { 1668 i.stopPropagation(); 1669 }), 1670 this._previous.bind("click", $.proxy(this.previousPage, this)), 1671 this._next.bind("click", $.proxy(this.nextPage, this)); 1672 }, 1673 load: function (i) { 1674 this.clear(); 1675 var t = "horizontal", 1676 s = !1; 1677 $.each( 1678 i, 1679 $.proxy(function (i, e) { 1680 "vertical" === e.options.thumbnails && (t = "vertical"), e.options.thumbnails || (s = !0);
1681 }, this) 1682 ), 1683 this.setOrientation(t), 1684 (this._disabledGroup = s), 1685 $.each( 1686 i, 1687 $.proxy(function (i, e) { 1688 this._thumbnails.push(new Thumbnail(e, i + 1)); 1689 }, this) 1690 ), 1691 this.fitToViewport(); 1692 }, 1693 clear: function () { 1694 $.each(this._thumbnails, function (i, e) { 1695 e.remove(); 1696 }), 1697 (this._thumbnails = []), 1698 (this._position = -1), 1699 (this._page = -1); 1700 }, 1701 setOrientation: function (i) { 1702 this._orientation && Window.element.removeClass("fr-thumbnails-" + this._orientation), Window.element.addClass("fr-thumbnails-" + i), (this._orientation = i); 1703 }, 1704 disable: function () { 1705 Window.element.removeClass("fr-thumbnails-enabled").addClass("fr-thumbnails-disabled"), (this._disabled = !0); 1706 }, 1707 enable: function () { 1708 Window.element.removeClass("fr-thumbnails-disabled").addClass("fr-thumbnails-enabled"), (this._disabled = !1); 1709 }, 1710 enabled: function () { 1711 return !this._disabled; 1712 }, 1713 disabled: function () { 1714 return this._disabled; 1715 }, 1716 updateVars: function () { 1717 var i = Window.element, 1718 e = this._vars, 1719 t = "horizontal" === this._orientation, 1720 s = t ? "top" : "left", 1721 n = t ? "left" : "top", 1722 o = t ? "bottom" : "left", 1723 a = t ? "top" : "right", 1724 h = t ? "width" : "height", 1725 r = t ? "height" : "width", 1726 d = { left: "right", right: "left", top: "bottom", bottom: "top" }; 1727 this.element.removeClass("fr-thumbnails-measured"); 1728 var l = i.is(":visible"); 1729 if ((l || i.show(), this.disabled() && this.enable(), !this.element.is(":visible") || this._thumbnails.length < 2 || this._disabledGroup)) 1730 return this.disable(), $.extend(this._vars.thumbnails, { width: 0, height: 0 }), l || i.hide(), void this.element.addClass("fr-thumbnails-measured"); 1731 this.enable(); 1732 var u = this._previous, 1733 c = this._next, 1734 p = Bounds.viewport(), 1735 f = this.element["inner" + _.String.capitalize(r)](), 1736 m = parseInt(this._thumbs.css("padding-" + s)) || 0, 1737 //v = Math.max(f - 2 * m, 0), 1738 v = Math.max(140), 1739 g = parseInt(this._thumbs.css("padding-" + n)) || 0, 1740 w = (parseInt(this.element.css("margin-" + o)) || 0) + (parseInt(this.element.css("margin-" + a)) || 0); 1741 1742 $.extend(e.thumbnails, { height: f + w, width: p[t ? "width" : "height"], paddingTop: m }), 1743 //$.extend(e.thumbnail, { height: v, width: v }), 1744 //$.extend(e.thumbnailFrame, { width: v + 2 * g, height: f }), 1745 $.extend(e.thumbnail, { height: 160, width: 120 }), 1746 $.extend(e.thumbnailFrame, { width: 200 + 2 * g, height: 160 }), 1747 (e.sides = { 1748 previous: { width: c["inner" + _.String.capitalize(h)](), marginLeft: parseInt(u.css("margin-" + n)) || 0, marginRight: parseInt(u.css("margin-" + d[n])) || 0 }, 1749 next: { width: c["inner" + _.String.capitalize(h)](), marginLeft: parseInt(c.css("margin-" + n)) || 0, marginRight: parseInt(c.css("margin-" + d[n])) || 0 }, 1750 }); 1751 var b = p[h], 1752 y = e.thumbnailFrame.width, 1753 x = this._thumbnails.length; 1754 (e.thumbnails.width = b), (e.sides.enabled = 1 < (x * y) / b); 1755 var k = b, 1756 C = e.sides, 1757 S = C.previous, 1758 W = C.next, 1759 M = S.marginLeft + S.width + S.marginRight + W.marginLeft + W.width + W.marginRight; 1760 e.sides.enabled && (k -= M); 1761 var T = x * y;
1762 T < (k = Math.floor(k / y) * y) && (k = T); 1763 var I = k + (e.sides.enabled ? M : 0); 1764 (e.ipp = Math.round(k / y)), 1765 (this._mode = "page"), 1766 e.ipp <= 1 && ((I = k = b), (e.sides.enabled = !1), (this._mode = "center")), 1767 (e.pages = Math.ceil((x * y) / k)), 1768 (e.wrapper = { width: I + 1, height: f }), 1769 (e.thumbs = { width: k, height: f }), 1770 (e.slide = { width: x * y + 1, height: f }), 1771 l || i.hide(), 1772 this.element.addClass("fr-thumbnails-measured"); 1773 }, 1774 hide: function () { 1775 this.disable(), this.thumbnails.hide(), (this._visible = !1); 1776 }, 1777 getDimensions: function () { 1778 var i = "horizontal" === this._orientation; 1779 return { width: i ? this._vars.thumbnails.width : this._vars.thumbnails.height, height: i ? this._vars.thumbnails.height : this._vars.thumbnails.width }; 1780 }, 1781 fitToViewport: function () { 1782 if ((this.updateVars(), !this.disabled())) { 1783 var i = $.extend({}, this._vars), 1784 e = "horizontal" === this._orientation; 1785 $.each(this._thumbnails, function (i, e) { 1786 e.resize(); 1787 }), 1788 this._previous[i.sides.enabled ? "show" : "hide"](), 1789 this._next[i.sides.enabled ? "show" : "hide"](), 1790 this._thumbs.css({ width: i.thumbs[e ? "width" : "height"], height: i.thumbs[e ? "height" : "width"] }), 1791 this._slide.css({ width: i.slide[e ? "width" : "height"], height: i.slide[e ? "height" : "width"] }); 1792 var t = { width: i.wrapper[e ? "width" : "height"], height: i.wrapper[e ? "height" : "width"] }; 1793 (t["margin-" + (e ? "left" : "top")] = Math.round(-0.5 * i.wrapper.width) + "px"), (t["margin-" + (e ? "top" : "left")] = 0), this.wrapper.css(t), this._position && this.moveTo(this._position, !0); 1794 } 1795 }, 1796 moveToPage: function (i) { 1797 if (!(i < 1 || i > this._vars.pages || i === this._page)) { 1798 var e = this._vars.ipp * (i - 1) + 1; 1799 this.moveTo(e); 1800 } 1801 }, 1802 previousPage: function () { 1803 this.moveToPage(this._page - 1); 1804 }, 1805 nextPage: function () { 1806 this.moveToPage(this._page + 1); 1807 }, 1808 show: function (i) { 1809 var e = this._position < 0; 1810 i < 1 && (i = 1); 1811 var t = this._thumbnails.length; 1812 t < i && (i = t), (this._position = i), this.setActive(i), ("page" === this._mode && this._page === Math.ceil(i / this._vars.ipp)) || this.moveTo(i, e); 1813 }, 1814 moveTo: function (i, e) { 1815 if ((this.updateVars(), !this.disabled())) { 1816 var t, 1817 s, 1818 n = "horizontal" === this._orientation, 1819 o = 0.5 * Bounds.viewport()[n ? "width" : "height"], 1820 a = this._vars.thumbnailFrame.width; 1821 if ("page" === this._mode) { 1822 (s = Math.ceil(i / this._vars.ipp)), (this._page = s), (t = a * (this._page - 1) * this._vars.ipp * -1); 1823 var h = "fr-thumbnails-side-button-disabled"; 1824 this._previous_button[(s < 2 ? "add" : "remove") + "Class"](h), this._next_button[(s >= this._vars.pages ? "add" : "remove") + "Class"](h); 1825 } else t = o + -1 * (a * (i - 1) + 0.5 * a); 1826 s = Pages.page; 1827 var r = {}, 1828 d = {}; 1829 (r[n ? "top" : "left"] = 0), 1830 (d[n ? "left" : "top"] = t + "px"), 1831 this._slide 1832 .stop(!0) 1833 .css(r) 1834 .animate( 1835 d, 1836 e ? 0 : (s && s.view.options.effects.thumbnails.slide) || 0, 1837 $.proxy(function () { 1838 this.loadCurrentPage(); 1839 }, this) 1840 ); 1841 } 1842 }, 1843 loadCurrentPage: function () { 1844 var i, e; 1845 if (this._position && this._vars.thumbnailFrame.width && !(this._thumbnails.length < 1)) { 1846 if ("page" === this._mode) { 1847 if (this._page < 1) return; 1848 (i = (this._page - 1) * this._vars.ipp + 1), (e = Math.min(i - 1 + this._vars.ipp, this._thumbnails.length)); 1849 } else {
1850 var t = Math.ceil(this._vars.thumbnails.width / this._vars.thumbnailFrame.width); 1851 (i = Math.max(Math.floor(Math.max(this._position - 0.5 * t, 0)), 1)), (e = Math.ceil(Math.min(this._position + 0.5 * t))), this._thumbnails.length < e && (e = this._thumbnails.length); 1852 } 1853 for (var s = i; s <= e; s++) this._thumbnails[s - 1].load(); 1854 } 1855 }, 1856 setActive: function (i) { 1857 this._slide.find(".fr-thumbnail-active").removeClass("fr-thumbnail-active"); 1858 var e = i && this._thumbnails[i - 1]; 1859 e && e.activate(); 1860 }, 1861 refresh: function () { 1862 this._position && this.setPosition(this._position); 1863 }, 1864 }; 1865 function Thumbnail() { 1866 this.initialize.apply(this, _slice.call(arguments)); 1867 } 1868 $.extend(Thumbnail.prototype, { 1869 initialize: function (i, e) { 1870 (this.view = i), (this._position = e), this.preBuild(); 1871 }, 1872 preBuild: function () { 1873 this.thumbnail = $("<div>").addClass("fr-thumbnail").data("fr-position", this._position); 1874 }, 1875 build: function () { 1876 if (!this.thumbnailFrame) { 1877 var i = this.view.options; 1878 Thumbnails._slide.append( 1879 (this.thumbnailFrame = $("<div>") 1880 .addClass("fr-thumbnail-frame") 1881 .append(this.thumbnail.append((this.thumbnailWrapper = $("<div>").addClass("fr-thumbnail-wrapper"))))) 1882 ), 1883 "image" === this.view.type && this.thumbnail.addClass("fr-load-thumbnail").data("thumbnail", { view: this.view, src: i.thumbnail || this.view.url }); 1884 var e = i.thumbnail && i.thumbnail.icon; 1885 e && this.thumbnail.append($("<div>").addClass("fr-thumbnail-icon fr-thumbnail-icon-" + e)), 1886 this.thumbnail.append( 1887 $("<div>") 1888 .addClass("fr-thumbnail-overlay") 1889 .append($("<div>").addClass("fr-thumbnail-overlay-background")) 1890 .append( 1891 (this.loading = $("<div>") 1892 .addClass("fr-thumbnail-loading") 1893 .append($("<div>").addClass("fr-thumbnail-loading-background")) 1894 .append((this.spinner = $("<div>").addClass("fr-thumbnail-spinner").hide().append($("<div>").addClass("fr-thumbnail-spinner-spin"))))) 1895 ) 1896 .append($("<div>").addClass("fr-thumbnail-overlay-border")) 1897 ), 1898 this.thumbnail.append($("<div>").addClass("fr-thumbnail-state")), 1899 this.resize(); 1900 } 1901 }, 1902 remove: function () { 1903 this.thumbnailFrame && (this.thumbnailFrame.remove(), (this.thumbnailFrame = null), (this.image = null)), 1904 this.ready && (this.ready.abort(), (this.ready = null)), 1905 this.vimeoThumbnail && (this.vimeoThumbnail.abort(), (this.vimeoThumbnail = null)), 1906 (this._loading = !1), 1907 (this._removed = !0), 1908 (this.view = null), 1909 this._clearDelay(); 1910 }, 1911 load: function () { 1912 if (!(this._loaded || this._loading || this._removed)) { 1913 this.thumbnailWrapper || this.build(), (this._loading = !0); 1914 var i = this.view.options.thumbnail, 1915 e = i && "boolean" === $.type(i) ? this.view.url : i || this.view.url; 1916 if ((this._url = e)) 1917 if ("vimeo" === this.view.type) 1918 if (e === i) (this._url = e), this._load(this._url); 1919 else 1920 switch (this.view.type) { 1921 case "vimeo": 1922 this.vimeoThumbnail = new VimeoThumbnail( 1923 this.view.url, 1924 $.proxy(function (i) { 1925 (this._url = i), this._load(i); 1926 }, this), 1927 $.proxy(function () { 1928 this._error(); 1929 }, this) 1930 ); 1931 } 1932 else this._load(this._url); 1933 } 1934 }, 1935 activate: function () { 1936 this.thumbnail.addClass("fr-thumbnail-active"); 1937 }, 1938 _load: function (i) { 1939 this.thumbnailWrapper.prepend((this.image = $("<img>").addClass("fr-thumbnail-image").attr({ src: i }).css({ opacity: 1e-4 }))), 1940 this.fadeInSpinner(), 1941 (this.ready = new ImageReady( 1942 this.image[0], 1943 $.proxy(function (i) { 1944 var e = i.img; 1945 this.thumbnailFrame && this._loading && ((this._loaded = !0), (this._loading = !1), (this._dimensions = { width: e.naturalWi
1945dth, height: e.naturalHeight }), this.resize(), this.show()); 1946 }, this), 1947 $.proxy(function () { 1948 this._error(); 1949 }, this), 1950 { method: this.view.options.loadedMethod } 1951 )); 1952 }, 1953 _error: function () { 1954 (this._loaded = !0), (this._loading = !1), this.thumbnail.addClass("fr-thumbnail-error"), this.image && this.image.hide(), this.thumbnailWrapper.append($("<div>").addClass("fr-thumbnail-image")), this.show(); 1955 }, 1956 fadeInSpinner: function () { 1957 if (Spinner.supported && this.view.options.spinner) { 1958 this._clearDelay(); 1959 var i = this.view.options.effects.thumbnail; 1960 this._delay = setTimeout( 1961 $.proxy(function () { 1962 this.spinner.stop(!0).fadeTo(i.show || 0, 1); 1963 }, this), 1964 this.view.options.spinnerDelay || 0 1965 ); 1966 } 1967 }, 1968 show: function () { 1969 this._clearDelay(); 1970 var i = this.view.options.effects.thumbnail; 1971 this.loading.stop(!0).delay(i.delay).fadeTo(i.show, 0); 1972 }, 1973 _clearDelay: function () { 1974 this._delay && (clearTimeout(this._delay), (this._delay = null)); 1975 }, 1976 resize: function () { 1977 if (this.thumbnailFrame) { 1978 var i = "horizontal" === Thumbnails._orientation; 1979 if ( 1980 (this.thumbnailFrame.css({ width: Thumbnails._vars.thumbnailFrame[i ? "width" : "height"], height: Thumbnails._vars.thumbnailFrame[i ? "height" : "width"] }), 1981 this.thumbnailFrame.css({ top: i ? 0 : Thumbnails._vars.thumbnailFrame.width * (this._position - 1), left: i ? Thumbnails._vars.thumbnailFrame.width * (this._position - 1) : 0 }), 1982 this.thumbnailWrapper) 1983 ) { 1984 var e = Thumbnails._vars.thumbnail; 1985 // if ((this.thumbnail.css({ width: e.width, height: e.height, "margin-top": Math.round(-0.5 * e.height), "margin-left": Math.round(-0.5 * e.width), "margin-bottom": 0, "margin-right": 0 }), this._dimensions)) { 1986 if ((this.thumbnail.css({ width: e.width, height: 160, "margin-top": Math.round(-0.5 * e.height), "margin-left": Math.round(-0.5 * e.width), "margin-bottom": 0, "margin-right": 0 }), this._dimensions)) { 1987 var t, 1988 s = { width: e.width, height: e.height }, 1989 n = Math.max(s.width, s.height), 1990 o = $.extend({}, this._dimensions); 1991 if (o.width > s.width && o.height > s.height) { 1992 var a = 1, 1993 h = 1; 1994 (t = Fit.within(s, o)).width < s.width && (a = s.width / t.width), t.height < s.height && (h = s.height / t.height); 1995 var r = Math.max(a, h); 1996 1 < r && ((t.width *= r), (t.height *= r)), 1997 $.each("width height".split(" "), function (i, e) { 1998 t[e] = Math.round(t[e]); 1999 }); 2000 } else t = Fit.within(this._dimensions, o.width < s.width || o.height < s.height ? { width: n, height: n } : s); 2001 var d = Math.round(0.5 * s.width - 0.5 * t.width), 2002 l = Math.round(0.5 * s.height - 0.5 * t.height); 2003 this.image.removeAttr("style").css($.extend({}, t, { top: l, left: d })); 2004 } 2005 } 2006 } 2007 }, 2008 }); 2009 var UI = { 2010 _modes: ["fullclick", "outside", "inside"], 2011 _ui: !1, 2012 _validClickTargetSelector: [".fr-content-element", ".fr-content", ".fr-content > .fr-stroke", ".fr-content > .fr-stroke .fr-stroke-color"].join(", "), 2013 initialize: function (i) { 2014 $.each( 2015 this._modes, 2016 $.proxy(function (i, e) { 2017 this[e].initialize(); 2018 }, this) 2019 ), 2020 Window.element.addClass("fr-ui-inside-hidden fr-ui-fullclick-hidden"); 2021 }, 2022 set: function (i) { 2023 this._ui && (Window.element.removeClass("fr-window-ui-" + this._ui), Overlay.element.removeClass("fr-overlay-ui-" + this._ui)), 2024 Window.element.addClass("fr-window-ui-" + i), 2025 Overlay.element.addClass("fr-overlay-ui-" + i), 2026 this._enabled && this._ui && this._ui !== i && (this[this._ui].disable(), this[i].enable(), UI[i].show()), 2027 (this._ui = i); 2028 }, 2029 _onWindowResize: function () { 2030 Support.mobileTouch && this.show(); 2031 }, 2032 enable: function () { 2033 $.each( 2034 this._modes, 2035 $.proxy(function (i, e) { 2036 UI[e][e === this._ui ? "enable" : "disable"](); 2037 }, this) 2038 ), 2039 (this._enabled = !0);
2040 }, 2041 disable: function () { 2042 $.each( 2043 this._modes, 2044 $.proxy(function (i, e) { 2045 UI[e].disable(); 2046 }, this) 2047 ), 2048 (this._enabled = !1); 2049 }, 2050 adjustPrevNext: function (i, e) { 2051 UI[this._ui].adjustPrevNext(i, e); 2052 }, 2053 show: function (i, e) { 2054 UI[this._ui].show(i, e); 2055 }, 2056 hide: function (i, e) { 2057 UI[this._ui].hide(i, e); 2058 }, 2059 reset: function () { 2060 $.each( 2061 this._modes, 2062 $.proxy(function (i, e) { 2063 UI[e].reset(); 2064 }, this) 2065 ); 2066 }, 2067 update: function () { 2068 var i = Pages.page; 2069 i && this.set(i._ui); 2070 }, 2071 }; 2072 return ( 2073 (UI.fullclick = { 2074 initialize: function () { 2075 this.build(), (this._scrollLeft = -1); 2076 }, 2077 build: function () { 2078 Window._box 2079 .append( 2080 (this._previous = $("<div>") 2081 .addClass("fr-side fr-side-previous fr-side-previous-fullclick fr-toggle-ui") 2082 .append($("<div>").addClass("fr-side-button").append($("<div>").addClass("fr-side-button-background")).append($("<div>").addClass("fr-side-button-icon")))) 2083 ) 2084 .append( 2085 (this._next = $("<div>") 2086 .addClass("fr-side fr-side-next fr-side-next-fullclick fr-toggle-ui") 2087 .append($("<div>").addClass("fr-side-button").append($("<div>").addClass("fr-side-button-background")).append($("<div>").addClass("fr-side-button-icon")))) 2088 ) 2089 .append((this._close = $("<div>").addClass("fr-close fr-close-fullclick").append($("<div>").addClass("fr-close-background")).append($("<div>").addClass("fr-close-icon")))), 2090 Browser.IE && Browser.IE <= 7 && this._previous.add(this._next).add(this._close).hide(), 2091 this._close.on( 2092 "click", 2093 $.proxy(function (i) { 2094 i.preventDefault(), Window.hide(); 2095 }, this) 2096 ), 2097 this._previous.on( 2098 "click", 2099 $.proxy(function (i) { 2100 Window.previous(), this._onMouseMove(i); 2101 }, this) 2102 ), 2103 this._next.on( 2104 "click", 2105 $.proxy(function (i) { 2106 Window.next(), this._onMouseMove(i); 2107 }, this) 2108 ); 2109 }, 2110 enable: function () { 2111 this.bind(); 2112 }, 2113 disable: function () { 2114 this.unbind(); 2115 }, 2116 reset: function () { 2117 Window.timers.clear("ui-fullclick"), (this._x = -1), (this._y = -1), (this._scrollLeft = -1), this.resetPrevNext(), this._onMouseLeave(); 2118 }, 2119 resetPrevNext: function () { 2120 this._previous.add(this._next).stop(!0).removeAttr("style"); 2121 }, 2122 bind: function () { 2123 this._onMouseUpHandler || 2124 (this.unbind(), 2125 Window._pages.on("mouseup", ".fr-container", (this._onMouseUpHandler = $.proxy(this._onMouseUp, this))), 2126 Support.mobileTouch || 2127 (Window.element.on("mouseenter", (this._showHandler = $.proxy(this.show, this))).on("mouseleave", (this._hideHandler = $.proxy(this.hide, this))), 2128 Window.element.on( 2129 "mousemove", 2130 (this._mousemoveHandler = $.proxy(function (i) { 2131 var e = i.pageX, 2132 t = i.pageY; 2133 this._hoveringSideButton || (t === this._y && e === this._x) || ((this._x = e), (this._y = t), this.show(), this.startTimer()); 2134 }, this)) 2135 ), 2136 Window._pages 2137 .on("mousemove", ".fr-container", (this._onMouseMoveHandler = $.proxy(this._onMouseMove, this))) 2138 .on("mouseleave", ".fr-container", (this._onMouseLeaveHandler = $.proxy(this._onMouseLeave, this))) 2139 .on("mouseenter", ".fr-container", (this._onMouseEnterHandler = $.proxy(this._onMouseEnter, this))), 2140 Window.element 2141 .on("mouseenter", ".fr-side", (this._onSideMouseEnterHandler = $.proxy(this._onSideMouseEnter, this))) 2142 .on("mouseleave", ".fr-side", (this._onSideMouseLeaveHandler = $.proxy(this._onSideMouseLeave, this))), 2143 $(window).on("scroll", (this._onScrollHandler = $.proxy(this._onScroll, this))))); 2144 }, 2145 unbind: function () { 2146 this._onMouseUpHandler && 2147 (Window._pages.off("mouseup", ".fr-container", this._onMouseUpHandler), 2148 (this._onMouseUpHandler = null), 2149 this._showHandler && 2150 (Window.element.off("mouseenter", this._showHandler).off("mouseleave", this._hideHandler).off("mousemove", this._mousemoveHandler), 2151 Window._pages.off("mousemove", ".fr-container", this._onMouseMoveHandler).off("mouseleave", ".fr-container", this._onMouseLeaveHandler).off("mouseenter", ".fr-container", this._onMouseEnterHandler), 2152 Window.element.off("mouseenter", ".fr-side", this._onSideMouseEnterHandler).off("mouseleave", ".fr-side", this._onSideMouseLeaveHandler), 2153 $(window).off("scroll", this._onScrollHandler), 2154 (this._showHandler = null))); 2155 }, 2156 adjustPrevNext: function (i, e) { 2157 var t = Pages.page; 2158 if (t) { 2159 var s = Window.element.is(":visible"); 2160 s || Window.element.show(); 2161 var n = this._previous.attr("style"); 2162 this._previous.removeAttr("style"); 2163 var o = parseInt(this._previous.css("margin-top")); 2164 this._previous.attr({ style: n }), s || Window.element.hide(); 2165 var a = t._infoHeight || 0, 2166 h = this._previous.add(this._next), 2167 r = { "margin-top": o - 0.5 * a }, 2168 d = "number" === $.type(e) ? e : (Pages.page && Pages.page.view.options.effects.c
2168ontent.show) || 0; 2169 this.opening && (d = 0), 2170 h.stop(!0).animate(r, d, i), 2171 this._previous[(Window.mayPrevious() ? "remove" : "add") + "Class"]("fr-side-disabled"), 2172 this._next[(Window.mayNext() ? "remove" : "add") + "Class"]("fr-side-disabled"), 2173 h[(t._total < 2 ? "add" : "remove") + "Class"]("fr-side-hidden"), 2174 i && i(); 2175 } else i && i(); 2176 }, 2177 _onScroll: function () { 2178 this._scrollLeft = $(window).scrollLeft(); 2179 }, 2180 _onMouseMove: function (i) { 2181 if (!Support.mobileTouch) { 2182 var e = this._getEventSide(i), 2183 t = _.String.capitalize(e), 2184 s = !!e && Window["may" + t](); 2185 if (e !== this._hoveringSide || s !== this._mayClickHoveringSide) 2186 switch (((this._hoveringSide = e), (this._mayClickHoveringSide = s), Window._box[(s ? "add" : "remove") + "Class"]("fr-hovering-clickable"), e)) { 2187 case "previous": 2188 Window._box.addClass("fr-hovering-previous").removeClass("fr-hovering-next"); 2189 break; 2190 case "next": 2191 Window._box.addClass("fr-hovering-next").removeClass("fr-hovering-previous"); 2192 } 2193 } 2194 }, 2195 _onMouseLeave: function (i) { 2196 Window._box.removeClass("fr-hovering-clickable fr-hovering-previous fr-hovering-next"), (this._hoveringSide = !1); 2197 }, 2198 _onMouseUp: function (i) { 2199 if (!(1 < i.which)) 2200 if (1 !== Pages.pages.length) { 2201 var e = this._getEventSide(i); 2202 Window[e](), this._onMouseMove(i); 2203 } else Window.hide(); 2204 }, 2205 _onMouseEnter: function (i) { 2206 this._onMouseMove(i); 2207 }, 2208 _getEventSide: function (i) { 2209 -1 < this._scrollLeft ? this._scrollLeft : (this._scrollLeft = $(window).scrollLeft()); 2210 return i.pageX - Window._boxPosition.left - this._scrollLeft < 0.5 * Window._boxDimensions.width ? "previous" : "next"; 2211 }, 2212 _onSideMouseEnter: function (i) { 2213 (this._hoveringSideButton = !0), (this._hoveringSide = this._getEventSide(i)), (this._mayClickHoveringSide = Window["may" + _.String.capitalize(this._hoveringSide)]()), this.clearTimer(); 2214 }, 2215 _onSideMouseLeave: function (i) { 2216 (this._hoveringSideButton = !1), (this._hoveringSide = !1), (this._mayClickHoveringSide = !1), this.startTimer(); 2217 }, 2218 show: function (i) { 2219 if (this._visible) return this.startTimer(), void ("function" === $.type(i) && i()); 2220 (this._visible = !0), 2221 this.startTimer(), 2222 Window.element.addClass("fr-visible-fullclick-ui").removeClass("fr-hidden-fullclick-ui"), 2223 Browser.IE && Browser.IE <= 7 && this._previous.add(this._next).add(this._close).show(), 2224 "function" === $.type(i) && i(); 2225 }, 2226 hide: function (i) { 2227 var e = Pages.page && Pages.page.view.type; 2228 this._visible && (!e || ("youtube" !== e && "vimeo" !== e)) && ((this._visible = !1), Window.element.removeClass("fr-visible-fullclick-ui").addClass("fr-hidden-fullclick-ui")), "function" === $.type(i) && i(); 2229 }, 2230 clearTimer: function () { 2231 Support.mobileTouch || Window.timers.clear("ui-fullclick"); 2232 }, 2233 startTimer: function () { 2234 Support.mobileTouch || 2235 (this.clearTimer(), 2236 Window.timers.set( 2237 "ui-fullclick", 2238 $.proxy(function () { 2239 this.hide(); 2240 }, this), 2241 Window.view ? Window.view.options.uiDelay : 0 2242 )); 2243 }, 2244 }), 2245 (UI.inside = { 2246 initialize: function () {}, 2247 enable: function () { 2248 this.bind(); 2249 }, 2250 disable: function () { 2251 this.unbind(); 2252 }, 2253 bind: function () { 2254 this._onMouseUpHandler || 2255 (this.unbind(), 2256 Window._pages.on("mouseup", ".fr-content", (this._onMouseUpHandler = $.proxy(this._onMouseUp, this))), 2257 Window._pages 2258 .on( 2259 "click",
2260 ".fr-content .fr-close", 2261 $.proxy(function (i) { 2262 i.preventDefault(), Window.hide(); 2263 }, this) 2264 ) 2265 .on( 2266 "click", 2267 ".fr-content .fr-side-previous", 2268 $.proxy(function (i) { 2269 Window.previous(), this._onMouseMove(i); 2270 }, this) 2271 ) 2272 .on( 2273 "click", 2274 ".fr-content .fr-side-next", 2275 $.proxy(function (i) { 2276 Window.next(), this._onMouseMove(i); 2277 }, this) 2278 ), 2279 Window.element.on("click", ".fr-container, .fr-thumbnails, .fr-thumbnails-wrapper", (this._delegateOverlayCloseHandler = $.proxy(this._delegateOverlayClose, this))), 2280 Support.mobileTouch || 2281 (Window.element.on("mouseenter", ".fr-content", (this._showHandler = $.proxy(this.show, this))).on("mouseleave", ".fr-content", (this._hideHandler = $.proxy(this.hide, this))), 2282 Window.element.on( 2283 "mousemove", 2284 ".fr-content", 2285 (this._mousemoveHandler = $.proxy(function (i) { 2286 var e = i.pageX, 2287 t = i.pageY; 2288 this._hoveringSideButton || (t === this._y && e === this._x) || ((this._x = e), (this._y = t), this.show(), this.startTimer()); 2289 }, this)) 2290 ), 2291 Window._pages.on( 2292 "mousemove", 2293 ".fr-info, .fr-close", 2294 $.proxy(function (i) { 2295 i.stopPropagation(), this._onMouseLeave(i); 2296 }, this) 2297 ), 2298 Window._pages.on( 2299 "mousemove", 2300 ".fr-info", 2301 $.proxy(function () { 2302 this.clearTimer(); 2303 }, this) 2304 ), 2305 Window._pages 2306 .on("mousemove", ".fr-content", (this._onMouseMoveHandler = $.proxy(this._onMouseMove, this))) 2307 .on("mouseleave", ".fr-content", (this._onMouseLeaveHandler = $.proxy(this._onMouseLeave, this))) 2308 .on("mouseenter", ".fr-content", (this._onMouseEnterHandler = $.proxy(this._onMouseEnter, this))), 2309 Window.element 2310 .on("mouseenter", ".fr-side", (this._onSideMouseEnterHandler = $.proxy(this._onSideMouseEnter, this))) 2311 .on("mouseleave", ".fr-side", (this._onSideMouseLeaveHandler = $.proxy(this._onSideMouseLeave, this))), 2312 $(window).on("scroll", (this._onScrollHandler = $.proxy(this._onScroll, this))))); 2313 }, 2314 unbind: function () { 2315 this._onMouseUpHandler && 2316 (Window._pages.off("mouseup", ".fr-content", this._onMouseUpHandler), 2317 (this._onMouseUpHandler = null), 2318 Window._pages.off("click", ".fr-content .fr-close").off("click", ".fr-content .fr-side-previous").off("click", ".fr-content .fr-side-next"), 2319 Window.element.off("click", ".fr-container, .fr-thumbnails, .fr-thumbnails-wrapper", this._delegateOverlayCloseHandler), 2320 this._showHandler && 2321 (Window.element.off("mouseenter", ".fr-content", this._showHandler).off("mouseleave", ".fr-content", this._hideHandler).off("mousemove", ".fr-content", this._mousemoveHandler), 2322 Window._pages.off("mousemove", ".fr-info, .fr-close"), 2323 Window._pages.off("mousemove", ".fr-info"), 2324 Window._pages.off("mousemove", ".fr-content-element", this._onMouseMoveHandler).off("mouseleave", ".fr-content", this._onMouseLeaveHandler).off("mouseenter", ".fr-content", this._onMouseEnterHandler), 2325 Window.element.off("mouseenter", ".fr-side", this._onSideMouseEnterHandler).off("mouseleave", ".fr-side", this._onSideMouseLeaveHandler), 2326 $(window).off("scroll", this._onScrollHandler), 2327 (this._showHandler = null))); 2328 }, 2329 reset: function () { 2330 Window.timers.clear("ui-fullclick"), (this._x = -1), (this._y = -1), (this._scrollLeft = -1), (this._hoveringSide = !1), this._onMouseLeave(); 2331 }, 2332 adjustPrevNext: function (i) { 2333 i && i();
2334 }, 2335 _onScroll: function () { 2336 this._scrollLeft = $(window).scrollLeft(); 2337 }, 2338 _delegateOverlayClose: function (i) { 2339 var e = Pages.page; 2340 (e && e.view.options.overlay && !e.view.options.overlay.close) || ($(i.target).is(".fr-container, .fr-thumbnails, .fr-thumbnails-wrapper") && (i.preventDefault(), i.stopPropagation(), Window.hide())); 2341 }, 2342 _onMouseMove: function (i) { 2343 if (!Support.mobileTouch) { 2344 var e = this._getEventSide(i), 2345 t = _.String.capitalize(e), 2346 s = !!e && Window["may" + t](); 2347 if (((1 === Pages.pages.length || (Pages.page && "close" === Pages.page.view.options.onClick)) && (e = !1), e !== this._hoveringSide || s !== this._mayClickHoveringSide)) 2348 if (((this._hoveringSide = e), (this._mayClickHoveringSide = s), e)) 2349 switch ((Window._box[(s ? "add" : "remove") + "Class"]("fr-hovering-clickable"), e)) { 2350 case "previous": 2351 Window._box.addClass("fr-hovering-previous").removeClass("fr-hovering-next"); 2352 break; 2353 case "next": 2354 Window._box.addClass("fr-hovering-next").removeClass("fr-hovering-previous"); 2355 } 2356 else Window._box.removeClass("fr-hovering-clickable fr-hovering-previous fr-hovering-next"); 2357 } 2358 }, 2359 _onMouseLeave: function (i) { 2360 Window._box.removeClass("fr-hovering-clickable fr-hovering-previous fr-hovering-next"), (this._hoveringSide = !1); 2361 }, 2362 _onMouseUp: function (i) { 2363 if (!(1 < i.which) && $(i.target).is(UI._validClickTargetSelector)) 2364 if (1 === Pages.pages.length || (Pages.page && "close" === Pages.page.view.options.onClick)) Window.hide(); 2365 else { 2366 var e = this._getEventSide(i); 2367 Window[e](), this._onMouseMove(i); 2368 } 2369 }, 2370 _onMouseEnter: function (i) { 2371 this._onMouseMove(i); 2372 }, 2373 _getEventSide: function (i) { 2374 -1 < this._scrollLeft ? this._scrollLeft : (this._scrollLeft = $(window).scrollLeft()); 2375 return i.pageX - Window._boxPosition.left - this._scrollLeft < 0.5 * Window._boxDimensions.width ? "previous" : "next"; 2376 }, 2377 _onSideMouseEnter: function (i) { 2378 (this._hoveringSideButton = !0), (this._hoveringSide = this._getEventSide(i)), (this._mayClickHoveringSide = Window["may" + _.String.capitalize(this._hoveringSide)]()), this.clearTimer(); 2379 }, 2380 _onSideMouseLeave: function (i) { 2381 (this._hoveringSideButton = !1), (this._hoveringSide = !1), (this._mayClickHoveringSide = !1), this.startTimer(); 2382 }, 2383 show: function (i) { 2384 if (this._visible) return this.startTimer(), void ("function" === $.type(i) && i()); 2385 (this._visible = !0), this.startTimer(), Window.element.addClass("fr-visible-inside-ui").removeClass("fr-hidden-inside-ui"), "function" === $.type(i) && i(); 2386 }, 2387 hide: function (i) { 2388 this._visible && ((this._visible = !1), Window.element.removeClass("fr-visible-inside-ui").addClass("fr-hidden-inside-ui")), "function" === $.type(i) && i(); 2389 }, 2390 clearTimer: function () { 2391 Support.mobileTouch || Window.timers.clear("ui-inside"); 2392 }, 2393 startTimer: function () { 2394 Support.mobileTouch || 2395 (this.clearTimer(), 2396 Window.timers.set( 2397 "ui-inside", 2398 $.proxy(function () { 2399 this.hide(); 2400 }, this), 2401 Window.view ? Window.view.options.uiDelay : 0 2402 )); 2403 }, 2404 }), 2405 (UI.outside = { 2406 initialize: function () { 2407 this.build(), (this._scrollLeft = -1); 2408 }, 2409 build: function () { 2410 Window._box 2411 .append( 2412 (this._previous = $("<div>") 2413 .addClass("fr-side fr-side-previous fr-side-previous-outside") 2414 .append($("<div>").addClass("fr-side-button").append($("<div>").addClass("fr-side-button-background")).append($("<div>").addClass("fr-side-button-icon")))) 2415 ) 2416 .append( 2417 (this._next = $("<div>") 2418 .addClass("fr-side fr-side-next fr-side-next-outside") 2419 .append($("<div>").addClass("fr-side-button").append($("<div>").addClass("fr-side-button-background")).append($("<div>").addClass("fr-side-button-icon")))) 2420 ) 2421 .append((this._close = $("<div>").addClass("fr-close fr-close-outside").append($("<div>").addClass("fr-close-background")).append($("<div>").addClass("fr-close-icon")))), 2422 Browser.IE && Browser.IE <= 7 && this._previous.add(this._next).add(this._close).hide(), 2423 this._close.on( 2424 "click", 2425 $.proxy(function (i) { 2426 i.preventDefault(), Window.hide(); 2427 }, this) 2428 ), 2429 this._previous.on( 2430 "click", 2431 $.proxy(function (i) { 2432 Window.previous(), this._onMouseMove(i); 2433 }, this) 2434 ), 2435 this._next.on( 2436 "click", 2437 $.proxy(function (i) { 2438 Window.next(), this._onMouseMove(i); 2439 }, this) 2440 ); 2441 }, 2442 enable: function () { 2443 this.bind(); 2444 }, 2445 disable: function () { 2446 this.unbind(); 2447 }, 2448 reset: function () { 2449 Window.timers.clear("ui-outside"), (this._x = -1), (this._y = -1), (this._scrollLeft = -1), this._onMouseLeave(); 2450 }, 2451 bind: function () { 2452 this._onMouseUpHandler || 2453 (this.unbind(), 2454 Window.element.on("mouseup", ".fr-content", (this._onMouseUpHandler = $.proxy(this._onMouseUp, this))), 2455 Window.element.on("click", ".fr-container, .fr-thumbnails, .fr-thumbnails-wrapper", (this._delegateOverlayCloseHandler = $.proxy(this._delegateOverlayClose, this))), 2456 Support.mobileTouch || 2457 (Window._pages 2458 .on("mousemove", ".fr-content", (this._onMouseMoveHandler = $.proxy(this._onMouseMove, this))) 2459 .on("mouseleave", ".fr-content", (this._onMouseLeaveHandler = $.proxy(this._onMouseLeave, this))) 2460 .on("mouseenter", ".fr-content", (this._onMouseEnterHandler = $.proxy(this._onMouseEnter, this))), 2461 Window.element 2462 .on("mouseenter", ".fr-side", (this._onSideMouseEnterHandler = $.proxy(this._onSideMouseEnter, this))) 2463 .on("mouseleave", ".fr-side", (this._onSideMouseLeaveHandler = $.proxy(this._onSideMouseLeave, this))), 2464 $(window).on("scroll", (this._onScrollHandler = $.proxy(this._onScroll, this))))); 2465 }, 2466 unbind: function () { 2467 this._onMouseUpHandler && 2468 (Window.element.off("mouseup", ".fr-content", this._onMouseUpHandler), 2469 (this._onMouseUpHandler = null), 2470 Window.element.off("click", ".fr-container, .fr-thumbnails, .fr-thumbnails-wrapper", this._delegateOverlayCloseHandler), 2471 this._onMouseMoveHandler && 2472 (Window._pages.off("mousemove", ".fr-content", this._onMouseMoveHandler).off("mouseleave", ".fr-content", this._onMouseLeaveHandler).off("mouseenter", ".fr-content", this._onMouseEnterHandler), 2473 Window.element.off("mouseenter", ".fr-side", this._onSideMouseEnterHandler).off("mouseleave", ".fr-side", this._onSideMouseLeaveHandler), 2474 $(window).off("scroll", this._onScrollHandler), 2475 (this._onMouseMoveHandler = null))); 2476 }, 2477 adjustPrevNext: function (i, e) { 2478 var t = Pages.page; 2479 if (t) { 2480 var s = this._previous.add(this._next); 2481 this._previous[(Window.mayPrevious() ? "remove" : "add") + "Class"]("fr-side-disabled"), 2482 this._next[(Window.mayNext() ? "remove" : "add") + "Class"]("fr-side-disabled"), 2483 s[(t._total < 2 ? "add" : "remove") + "Class"]("fr-side-hidden"), 2484 i && i();
2485 } else i && i(); 2486 }, 2487 _onScroll: function () { 2488 this._scrollLeft = $(window).scrollLeft(); 2489 }, 2490 _delegateOverlayClose: function (i) { 2491 var e = Pages.page; 2492 (e && e.view.options.overlay && !e.view.options.overlay.close) || ($(i.target).is(".fr-container, .fr-thumbnails, .fr-thumbnails-wrapper") && (i.preventDefault(), i.stopPropagation(), Window.hide())); 2493 }, 2494 _onMouseMove: function (i) { 2495 if (!Support.mobileTouch) { 2496 var e = this._getEventSide(i), 2497 t = _.String.capitalize(e), 2498 s = !!e && Window["may" + t](); 2499 if (((1 === Pages.pages.length || (Pages.page && "close" === Pages.page.view.options.onClick)) && (e = !1), e !== this._hoveringSide || s !== this._mayClickHoveringSide)) 2500 if (((this._hoveringSide = e), (this._mayClickHoveringSide = s), e)) 2501 switch ((Window._box[(s ? "add" : "remove") + "Class"]("fr-hovering-clickable"), e)) { 2502 case "previous": 2503 Window._box.addClass("fr-hovering-previous").removeClass("fr-hovering-next"); 2504 break; 2505 case "next": 2506 Window._box.addClass("fr-hovering-next").removeClass("fr-hovering-previous"); 2507 } 2508 else Window._box.removeClass("fr-hovering-clickable fr-hovering-previous fr-hovering-next"); 2509 } 2510 }, 2511 _onMouseLeave: function (i) { 2512 Window._box.removeClass("fr-hovering-clickable fr-hovering-previous fr-hovering-next"), (this._hoveringSide = !1); 2513 }, 2514 _onMouseUp: function (i) { 2515 if (!(1 < i.which) && $(i.target).is(UI._validClickTargetSelector)) 2516 if (1 === Pages.pages.length || (Pages.page && "close" === Pages.page.view.options.onClick)) Window.hide(); 2517 else { 2518 var e = this._getEventSide(i); 2519 Window[e](), this._onMouseMove(i); 2520 } 2521 }, 2522 _onMouseEnter: function (i) { 2523 this._onMouseMove(i); 2524 }, 2525 _getEventSide: function (i) { 2526 -1 < this._scrollLeft ? this._scrollLeft : (this._scrollLeft = $(window).scrollLeft()); 2527 return i.pageX - Window._boxPosition.left - this._scrollLeft < 0.5 * Window._boxDimensions.width ? "previous" : "next"; 2528 }, 2529 show: function () { 2530 Browser.IE && Browser.IE <= 7 && this._previous.add(this._next).add(this._close).show(); 2531 }, 2532 hide: function () {}, 2533 _onSideMouseEnter: function (i) { 2534 (this._hoveringSideButton = !0), (this._hoveringSide = this._getEventSide(i)), (this._mayClickHoveringSide = Window["may" + _.String.capitalize(this._hoveringSide)]()); 2535 }, 2536 _onSideMouseLeave: function (i) { 2537 (this._hoveringSideButton = !1), (this._hoveringSide = !1), (this._mayClickHoveringSide = !1); 2538 }, 2539 clearTimer: function () {}, 2540 }), 2541 $(document).ready(function (i) { 2542 _Fresco.initialize(); 2543 }), 2544 Fresco 2545 ); 2546});
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.