1 ! 2function(i) { 3 "function" == typeof define && define.amd ? define("viewer", ["jquery"], i) : i("object" == typeof exports ? require("jquery") : jQuery) 4} (function(i) { 5 "use strict"; 6 function t(i) { 7 return "string" == typeof i 8 } 9 function e(i) { 10 return "number" == typeof i && !isNaN(i) 11 } 12 function s(i) { 13 return "undefined" == typeof i 14 } 15 function n(i, t) { 16 var s = []; 17 return e(t) && s.push(t), 18 s.slice.apply(i, s) 19 } 20 function o(i, t) { 21 var e = n(arguments, 2); 22 return function() { 23 return i.apply(t, e.concat(n(arguments))) 24 } 25 } 26 function a(i) { 27 var t = [], 28 s = i.rotate, 29 n = i.scaleX, 30 o = i.scaleY; 31 return e(s) && t.push("rotate(" + s + "deg)"), 32 e(n) && e(o) && t.push("scale(" + n + "," + o + ")"), 33 t.length ? t.join(" ") : "none" 34 } 35 function h(i) { 36 return i.offsetWidth 37 } 38 function r(i) { 39 return t(i) ? i.replace(/^.*\//, "").replace(/[\?&#].*$/, "") : "" 40 } 41 function l(i, t) { 42 var e; 43 return i.naturalWidth ? t(i.naturalWidth, i.naturalHeight) : (e = document.createElement("img"), e.onload = function() { 44 t(this.width, this.height) 45 }, 46 void(e.src = i.src)) 47 } 48 function d(t) { 49 var e = t.length, 50 s = 0, 51 n = 0; 52 return e && (i.each(t, 53 function(i, t) { 54 s += t.pageX, 55 n += t.pageY 56 }), s /= e, n /= e), 57 { 58 pageX: s, 59 pageY: n 60 } 61 } 62 function c(i) { 63 switch (i) { 64 case 2: 65 return x; 66 case 3: 67 return $; 68 case 4: 69 return C 70 } 71 } 72 function u(t, e) { 73 this.$element = i(t), 74 this.options = i.extend({}, 75 u.DEFAULTS, i.isPlainObject(e) && e), 76 this.isImg = !1, 77 this.isBuilt = !1, 78 this.isShown = !1, 79 this.isViewed = !1, 80 this.isFulled = !1, 81 this.isPlayed = !1, 82 this.wheeling = !1, 83 this.playing = !1, 84 this.fading = !1, 85 this.tooltiping = !1, 86 this.transitioning = !1, 87 this.action = !1, 88 this.target = !1, 89 this.timeout = !1, 90 this.index = 0, 91 this.length = 0, 92 this.init() 93 } 94 var m = i(window), 95 v = i(document), 96 f = "viewer", 97 g = document.createElement(f), 98 w = "viewer-fixed", 99 p = "viewer-open", 100 b = "viewer-show", 101 y = "viewer-hide", 102 x = "viewer-hide-xs-down", 103 $ = "viewer-hide-sm-down", 104 C = "viewer-hide-md-down", 105 z = "viewer-fade", 106 F = "viewer-in", 107 Y = "viewer-move", 108 k = "viewer-active", 109 I = "viewer-invisible", 110 X = "viewer-transition", 111 P = "viewer-fullscreen", 112 T = "viewer-fullscreen-exit", 113 V = "viewer-close", 114 E = "img", 115 S = "mousedown touchstart pointerdown MSPointerDown", 116 D = "mousemove touchmove pointermove MSPointerMove", 117 L = "mouseup touchend touchcancel pointerup pointercancel MSPointerUp MSPointerCancel", 118 q = "wheel mousewheel DOMMouseScroll", 119 R = "transitionend", 120 M = "load." + f, 121 W = "keydown." + f, 122 _ = "click." + f, 123 j = "resize." + f, 124 A = "build." + f, 125 B = "built." + f, 126 H = "show." + f, 127 U = "shown." + f, 128 N = "hide." + f, 129 O = "hidden." + f, 130 Z = "view." + f, 131 K = "viewed." + f, 132 Q = "undefined" != typeof g.style.transition, 133 G = Math.round, 134 J = Math.sqrt, 135 ii = Math.abs, 136 ti = Math.min, 137 ei = Math.max, 138 si = Number; 139 u.prototype = { 140 constructor: u, 141 init: function() { 142 var t = this.options, 143 e = this.$element, 144 s = e.is(E), 145 n = s ? e: e.find(E), 146 o = n.length, 147 a = i.proxy(this.ready, this); 148 o && (i.isFunction(t.build) && e.one(A, t.build), this.trigger(A).isDefaultPrevented() || (Q || (t.transition = !1), this.isImg = s, this.length = o, this.count = 0, this.$images = n, this.$body = i("body"), t.inline ? (e.one(B, i.proxy(function() { 149 this.view() 150 }, 151 this)), n.each(function() { 152 this.complete ? a() : i(this).one(M, a) 153 })) : e.on(_, i.proxy(this.start, this)))) 154 }, 155 ready: function() { 156 this.count++, 157 this.count === this.length && this.build() 158 }, 159 build: function() {
160 var t, e, s, n, o, a, h = this.options, 161 r = this.$element; 162 this.isBuilt || (this.$parent = t = r.parent(), this.$viewer = e = i(u.TEMPLATE),this.$img = e.find("img"), this.$canvas = e.find(".viewer-canvas"),this.$indexNumber = e.find(".viewer-number"), this.$footer = e.find(".viewer-footer"), this.$title = s = e.find(".viewer-title"), this.$toolbar = n = e.find(".viewer-toolbar"), this.$navbar = o = e.find(".viewer-navbar"), this.$button = a = e.find(".viewer-button"), this.$tooltip = e.find(".viewer-tooltip"), this.$player = e.find(".viewer-player"), this.$list = e.find(".viewer-list"), s.addClass(h.title ? c(h.title) : y), n.children().addClass(h.toolbar ? c(h.toolbar) : y), n.find("li[class*=zoom]").toggleClass(I, !h.zoomable), n.find("li[class*=flip]").toggleClass(I, !h.scalable), h.rotatable || n.find("li[class*=rotate]").addClass(I).appendTo(n), o.addClass(h.navbar ? c(h.navbar) : y), h.inline ? (a.addClass(P), e.css("z-index", h.zIndexInline), "static" === t.css("position") && t.css("position", "relative")) : (a.addClass(V), e.css("z-index", h.zIndex).addClass([w, z, y].join(" "))), i("body").after(e), h.inline && (this.render(), this.bind(), this.isShown = !0), this.isBuilt = !0, i.isFunction(h.built) && r.one(B, h.built), this.trigger(B)) 163 }, 164 unbuild: function() { 165 var i = this.options, 166 t = this.$element; 167 this.isBuilt && (i.inline && t.removeClass(y), this.$viewer.remove()) 168 }, 169 bind: function() { 170 var t = this.options, 171 e = this.$element; 172 i.isFunction(t.view) && e.on(Z, t.view), 173 i.isFunction(t.viewed) && e.on(K, t.viewed), 174 this.$viewer.on(_, i.proxy(this.click, this)).on(q, i.proxy(this.wheel, this)), 175 this.$canvas.on(S, i.proxy(this.mousedown, this)), 176 v.on(D, this._mousemove = o(this.mousemove, this)).on(L, this._mouseup = o(this.mouseup, this)).on(W, this._keydown = o(this.keydown, this)), 177 m.on(j, this._resize = o(this.resize, this)); 178 179 180 // e.find('img').on(this.dblclick) 181 // console.log(this.$img) 182 }, 183 unbind: function() { 184 var t = this.options, 185 e = this.$element; 186 i.isFunction(t.view) && e.off(Z, t.view), 187 i.isFunction(t.viewed) && e.off(K, t.viewed), 188 this.$viewer.off(_, this.click).off(q, this.wheel), 189 this.$canvas.off(S, this.mousedown), 190 v.off(D, this._mousemove).off(L, this._mouseup).off(W, this._keydown), 191 m.off(j, this._resize) 192 }, 193 render: function() { 194 this.initContainer(), 195 this.initViewer(), 196 this.initList(), 197 this.renderViewer() 198 }, 199 initContainer: function() { 200 this.container = { 201 width: m.innerWidth(), 202 height: m.innerHeight() 203 } 204 }, 205 initViewer: function() { 206 var t, e = this.options, 207 s = this.$parent; 208 e.inline && (this.parent = t = { 209 width: ei(s.width(), e.minWidth), 210 height: ei(s.height(), e.minHeight) 211 }), 212 (this.isFulled || !t) && (t = this.container), 213 this.viewer = i.extend({}, 214 t) 215 }, 216 renderViewer: function() { 217 this.options.inline && !this.isFulled && this.$viewer.css(this.viewer) 218 }, 219 initList: function() { 220 var e = this.options, 221 s = this.$element, 222 n = this.$list, 223 o = []; 224 this.$images.each(function(s) { 225 var n = this.src, 226 a = this.alt || r(n), 227 h = e.url; 228 n && (t(h) ? h = this.getAttribute(h) : i.isFunction(h) && (h = h.call(this, this)), o.push('<li><img src="' + n + '" data-action="view" data-index="' + s + '" data-original-url="' + (h || n) + '" alt="' + a + '"></li>')) 229 console.log(o) 230 }), 231 n.html(o.join("")).find(E).one(M, { 232 filled: !0 233 }, 234 i.proxy(this.loadImage, this)), 235 this.$items = n.children(), 236 e.transition && s.one(K, 237 function() { 238 n.addClass(X) 239 }) 240 }, 241 renderList: function(i) { 242 var t = i || this.index, 243 e = this.$items.eq(t).outerWidth(), 244 s = e + 6; 245 246 //console.log(s +'----'+ e +'----'+t +'---'+this.options.subView) 247 248 this.$list.css({ 249 width: s * this.length, 250 marginLeft: (this.viewer.width - e) / 2 - s * t 251 }); 252 var _ht = '<span>'+(t+1)+'</span>/<i>'+this.length+'</i>'; 253 this.$indexNumber.html(_ht); 254 255 }, 256 resetList: function() { 257 this.$list.empty().removeClass(X).css("margin-left", 0) 258 }, 259 initImage: function(t) { 260 var e = this.options, 261 s = this.$image, 262 n = this.viewer, 263 o = this.$footer.height(), 264 a = n.width, 265 h = ei(n.height - o, o), 266 r = this.image || {}; 267 l(s[0], i.proxy(function(s, n) { 268 var o, l, d = s / n, 269 c = a, 270 u = h; 271 h * d > a ? u = a / d: c = h * d, 272 c = ti(.9 * c, s), 273 u = ti(.9 * u, n), 274 l = {
275 naturalWidth: s, 276 naturalHeight: n, 277 aspectRatio: d, 278 ratio: c / s, 279 width: c, 280 height: u, 281 left: (a - c) / 2, 282 top: (h - u) / 2 283 }, 284 o = i.extend({}, 285 l), 286 e.rotatable && (l.rotate = r.rotate || 0, o.rotate = 0), 287 e.scalable && (l.scaleX = r.scaleX || 1, l.scaleY = r.scaleY || 1, o.scaleX = 1, o.scaleY = 1), 288 this.image = l, 289 this.initialImage = o, 290 i.isFunction(t) && t() 291 }, 292 this)) 293 }, 294 renderImage: function(t) { 295 var e = this.image, 296 s = this.$image; 297 s.css({ 298 width: e.width, 299 height: e.height, 300 marginLeft: e.left, 301 marginTop: e.top, 302 transform: a(e) 303 }), 304 i.isFunction(t) && (this.transitioning ? s.one(R, t) : t()) 305 }, 306 resetImage: function() { 307 this.$image.remove(), 308 this.$image = null 309 }, 310 start: function(t) { 311 var e = t.target; 312 i(e).is("img") && (this.target = e, this.show()) 313 }, 314 click: function(t) { 315 var e = i(t.target), 316 s = e.data("action"), 317 n = this.image; 318 switch (s) { 319 case "mix": 320 this.isPlayed ? this.stop() : this.options.inline ? this.isFulled ? this.exit() : this.full() : this.hide(); 321 break; 322 case "view": 323 this.view(e.data("index")); 324 break; 325 case "zoom-in": 326 this.zoom(.1, !0); 327 break; 328 case "zoom-out": 329 this.zoom( - .1, !0); 330 break; 331 case "one-to-one": 332 this.toggle(); 333 break; 334 case "reset": 335 this.reset(); 336 break; 337 case "prev": 338 this.prev(); 339 break; 340 case "play": 341 this.play(); 342 break; 343 case "next": 344 this.next(); 345 break; 346 case "rotate-left": 347 this.rotate( - 90); 348 break; 349 case "rotate-right": 350 this.rotate(90); 351 break; 352 case "flip-horizontal": 353 this.scaleX( - n.scaleX || -1); 354 break; 355 case "flip-vertical": 356 this.scaleY( - n.scaleY || -1); 357 break; 358 default: 359 this.isPlayed && this.stop() 360 } 361 }, 362 dblclick:function(){ 363 // this.image.dblclick(function(){ 364 // alert(11111) 365 // }); 366 //alert(11111) 367 }, 368 load: function() { 369 var t = this.options, 370 e = this.viewer, 371 s = this.$image; 372 this.timeout && (clearTimeout(this.timeout), this.timeout = !1), 373 s.removeClass(I).css("cssText", "width:0;height:0;margin-left:" + e.width / 2 + "px;margin-top:" + e.height / 2 + "px;max-width:none!important;visibility:visible;"), 374 this.initImage(i.proxy(function() { 375 s.toggleClass(X, t.transition).toggleClass(Y, t.movable), 376 this.renderImage(i.proxy(function() { 377 this.isViewed = !0, 378 this.trigger(K) 379 }, 380 this)) 381 }, 382 this)) 383 }, 384 loadImage: function(t) { 385 var e = t.target, 386 s = i(e), 387 n = s.parent(), 388 o = n.width(), 389 a = n.height(), 390 h = t.data && t.data.filled; 391 l(e, 392 function(i, t) { 393 var e = i / t, 394 n = o, 395 r = a; 396 a * e > o ? h ? n = a * e: r = o / e: h ? r = o / e: n = a * e, 397 s.css({ 398 width: n, 399 height: r, 400 marginLeft: (o - n) / 2, 401 marginTop: (a - r) / 2 402 }) 403 }) 404 }, 405 resize: function() { 406 this.initContainer(), 407 this.initViewer(), 408 this.renderViewer(), 409 this.renderList(), 410 this.initImage(i.proxy(function() { 411 this.renderImage() 412 }, 413 this)), 414 this.isPlayed && this.$player.find(E).one(M, i.proxy(this.loadImage, this)).trigger(M) 415 }, 416 wheel: function(t) { 417 var e = t.originalEvent || t, 418 s = si(this.options.zoomRatio) || .1, 419 n = 1; 420 this.isViewed && (t.preventDefault(), this.wheeling || (this.wheeling = !0, setTimeout(i.proxy(function() { 421 this.wheeling = !1 422 }, 423 this), 50), e.deltaY ? n = e.deltaY > 0 ? 1 : -1 : e.wheelDelta ? n = -e.wheelDelta / 120 : e.detail && (n = e.detail > 0 ? 1 : -1), this.zoom( - n * s, !0, t))) 424 }, 425 keydown: function(i) { 426 var t = this.options, 427 e = i.which; 428 if (this.isFulled && t.keyboard) switch (e) { 429 case 27: 430 this.isPlayed ? this.stop() : t.inline ? this.isFulled && this.exit() : this.hide(); 431 break; 432 case 32: 433 this.isPlayed && this.stop(); 434 break; 435 case 37: 436 this.prev(); 437 break; 438 case 38: 439 i.preventDefault(), 440 this.zoom(t.zoomRatio, !0); 441 break; 442 case 39: 443 this.next(); 444 break; 445 case 40: 446 i.preventDefault(), 447 this.zoom( - t.zoomRatio, !0); 448 break; 449 case 48: 450 case 49: 451 (i.ctrlKey || i.shiftKey) && (i.preventDefault(), this.toggle()) 452 } 453 }, 454 mousedown: function(i) { 455 var t, e = this.options, 456 s = i.originalEvent, 457 n = s && s.touches, 458 o = i, 459 a = e.movable ? "move": !1; 460 if (this.isViewed) { 461 if (n) { 462 if (t = n.length, t > 1) { 463 if (!e.zoomable || 2 !== t) return; 464 o = n[1], 465 this.startX2 = o.pageX, 466 this.startY2 = o.pageY, 467 a = "zoom" 468 } else this.isSwitchable() && (a = "switch"); 469 o = n[0] 470 } 471 a && (i.preventDefault(), this.action = a, this.startX = o.pageX || s && s.pageX, this.startY = o.pageY || s && s.pageY) 472 } 473 }, 474 mousemove: function(i) { 475 var t, e = this.options, 476 s = this.action, 477 n = this.$image, 478 o = i.originalEvent, 479 a = o && o.touches, 480 h = i; 481 if (this.isViewed) { 482 if (a) { 483 if (t = a.length, t > 1) { 484 if (!e.zoomable || 2 !== t) return; 485 h = a[1], 486 this.endX2 = h.pageX, 487 this.endY2 = h.pageY 488 } 489 h = a[0] 490 } 491 s && (i.preventDefault(), "move" === s && e.transition && n.hasClass(X) && n.removeClass(X), this.endX = h.pageX || o && o.pageX, this.endY = h.pageY || o && o.pageY, this.change(i)) 492 } 493 }, 494 mouseup: function(i) { 495 var t = this.action; 496 t && (i.preventDefault(), "move" === t && this.options.transition && this.$image.addClass(X), this.action = !1) 497 }, 498 show: function() { 499 var t, e = this.options; 500 e.inline || this.transitioning || (this.isBuilt || this.build(), i.isFunction(e.show) && this.$element.one(H, e.show), this.trigger(H).isDefaultPrevented() || (this.$body.addClass(p), t = this.$viewer.removeClass(y), this.$element.one(U, i.proxy(function() { 501 this.view(this.target ? this.$images.index(this.target) : this.index), 502 this.target = !1 503 }, 504 this)), e.transition ? (this.transitioning = !0, t.addClass(X), h(t[0]), t.one(R, i.proxy(this.shown, this)).addClass(F)) : (t.addClass(F), this.shown()))) 505 }, 506 hide: function() { 507 var t = this.options, 508 e = this.$viewer; 509 t.inline || this.transitioning || !this.isShown || (i.isFunction(t.hide) && this.$element.one(N, t.hide), this.trigger(N).isDefaultPrevented() || (this.isViewed && t.transition ? (this.transitioning = !0, this.$image.one(R, i.proxy(function() { 510 e.one(R, i.proxy(this.hidden, this)).removeClass(F) 511 }, 512 this)), this.zoomTo(0, !1, !1, !0)) : (e.removeClass(F), this.hidden()))) 513 }, 514 view: function(t) {
515 var e, s, n, o, a, h = this.$title; 516 t = Number(t) || 0, 517 !this.isShown || this.isPlayed || 0 > t || t >= this.length || this.isViewed && t === this.index || this.trigger(Z).isDefaultPrevented() || (s = this.$items.eq(t), n = s.find(E), o = n.data("originalUrl"), a = n.attr("alt"), this.$image = e = i('<img src="' + o + '" alt="' + a + '">'), this.isViewed && this.$items.eq(this.index).removeClass(k), s.addClass(k), this.isViewed = !1, this.index = t, this.image = null, this.$canvas.html(e.addClass(I)), this.renderList(), h.empty(), this.$element.one(K, i.proxy(function() { 518 var i = this.image, 519 t = i.naturalWidth, 520 e = i.naturalHeight; 521 //h.html(a + " (" + t + " × " + e + ")") 522 h.html(a) 523 }, 524 this)), e[0].complete ? this.load() : (e.one(M, i.proxy(this.load, this)), this.timeout && clearTimeout(this.timeout), this.timeout = setTimeout(i.proxy(function() { 525 e.removeClass(I), 526 this.timeout = !1 527 }, 528 this), 1e3))) 529 }, 530 prev: function() { 531 this.view(ei(this.index - 1, 0)) 532 }, 533 next: function() { 534 this.view(ti(this.index + 1, this.length - 1)) 535 }, 536 move: function(i, t) { 537 var e = this.image; 538 this.moveTo(s(i) ? i: e.left + si(i), s(t) ? t: e.top + si(t)) 539 }, 540 moveTo: function(i, t) { 541 var n = this.image, 542 o = !1; 543 s(t) && (t = i), 544 i = si(i), 545 t = si(t), 546 this.isViewed && !this.isPlayed && this.options.movable && (e(i) && (n.left = i, o = !0), e(t) && (n.top = t, o = !0), o && this.renderImage()) 547 }, 548 zoom: function(i, t, e) { 549 var s = this.image; 550 i = si(i), 551 i = 0 > i ? 1 / (1 - i) : 1 + i, 552 this.zoomTo(s.width * i / s.naturalWidth, t, e) 553 }, 554 zoomTo: function(i, t, s, n) { 555 var o, a, h, r, l, c = this.options, 556 u = .01, 557 m = 100, 558 v = this.image, 559 f = v.width, 560 g = v.height; 561 i = ei(0, i), 562 e(i) && this.isViewed && !this.isPlayed && (n || c.zoomable) && (n || (u = ei(u, c.minZoomRatio), m = ti(m, c.maxZoomRatio), i = ti(ei(i, u), m)), i > .95 && 1.05 > i && (i = 1), a = v.naturalWidth * i, h = v.naturalHeight * i, s && (o = s.originalEvent) ? (r = this.$viewer.offset(), l = o.touches ? d(o.touches) : { 563 pageX: s.pageX || o.pageX || 0, 564 pageY: s.pageY || o.pageY || 0 565 }, 566 v.left -= (a - f) * ((l.pageX - r.left - v.left) / f), v.top -= (h - g) * ((l.pageY - r.top - v.top) / g)) : (v.left -= (a - f) / 2, v.top -= (h - g) / 2), v.width = a, v.height = h, v.ratio = i, this.renderImage(), t && this.tooltip()) 567 }, 568 rotate: function(i) { 569 this.rotateTo((this.image.rotate || 0) + si(i)) 570 }, 571 rotateTo: function(i) { 572 var t = this.image; 573 i = si(i), 574 e(i) && this.isViewed && !this.isPlayed && this.options.rotatable && (t.rotate = i, this.renderImage()) 575 }, 576 scale: function(i, t) { 577 var n = this.image, 578 o = !1; 579 s(t) && (t = i), 580 i = si(i), 581 t = si(t), 582 this.isViewed && !this.isPlayed && this.options.scalable && (e(i) && (n.scaleX = i, o = !0), e(t) && (n.scaleY = t, o = !0), o && this.renderImage()) 583 }, 584 scaleX: function(i) { 585 this.scale(i, this.image.scaleY) 586 }, 587 scaleY: function(i) { 588 this.scale(this.image.scaleX, i) 589 }, 590 play: function() { 591 var t, s = this.options, 592 n = this.$player, 593 o = i.proxy(this.loadImage, this), 594 a = [], 595 h = 0, 596 r = 0; 597 this.isShown && !this.isPlayed && (s.fullscreen && this.requestFullscreen(), this.isPlayed = !0, n.addClass(b), this.$items.each(function(t) { 598 var e = i(this), 599 l = e.find(E), 600 d = i('<img src="' + l.data("originalUrl") + '" alt="' + l.attr("alt") + '">'); 601 h++, 602 d.addClass(z).toggleClass(X, s.transition), 603 e.hasClass(k) && (d.addClass(F), r = t), 604 a.push(d), 605 d.one(M, { 606 filled: !1 607 }, 608 o), 609 n.append(d) 610 }), e(s.interval) && s.interval > 0 && (t = i.proxy(function() { 611 this.playing = setTimeout(function() { 612 a[r].removeClass(F), 613 r++, 614 r = h > r ? r: 0, 615 a[r].addClass(F), 616 t() 617 }, 618 s.interval) 619 }, 620 this), h > 1 && t())) 621 }, 622 stop: function() { 623 this.isPlayed && (this.options.fullscreen && this.exitFullscreen(), this.isPlayed = !1, clearTimeout(this.playing), this.$player.removeClass(b).empty()) 624 }, 625 full: function() { 626 var t = this.options, 627 e = this.$image, 628 s = this.$list; 629 this.isShown && !this.isPlayed && !this.isFulled && t.inline && (this.isFulled = !0, this.$body.addClass(p), this.$button.addClass(T), t.transition && (e.removeClass(X), s.removeClass(X)), this.$viewer.addClass(w).removeAttr("style").css("z-index", t.zIndex), this.initContainer(), this.viewer = i.extend({}, 630 this.container), this.renderList(), this.initImage(i.proxy(function() { 631 this.renderImage(function() { 632 t.transition && setTimeout(function() { 633 e.addClass(X), 634 s.addClass(X) 635 }, 636 0) 637 }) 638 }, 639 this))) 640 }, 641 exit: function() { 642 var t = this.options, 643 e = this.$image, 644 s = this.$list; 645 this.isFulled && (this.isFulled = !1, this.$body.removeClass(p), this.$button.removeClass(T), t.transition && (e.removeClass(X), s.removeClass(X)), this.$viewer.removeClass(w).css("z-index", t.zIndexInline), this.viewer = i.extend({}, 646 this.parent), this.renderViewer(), this.renderList(), this.initImage(i.proxy(function() { 647 this.renderImage(function() { 648 t.transition && setTimeout(function() { 649 e.addClass(X), 650 s.addClass(X) 651 }, 652 0) 653 }) 654 }, 655 this))) 656 }, 657 tooltip: function() { 658 var t = this.options, 659 e = this.$tooltip, 660 s = this.image, 661 n = [b, z, X].join(" "); 662 this.isViewed && !this.isPlayed && t.tooltip && (e.text(G(100 * s.ratio) + "%"), this.tooltiping ? clearTimeout(this.tooltiping) : t.transition ? (this.fading && e.trigger(R), e.addClass(n), h(e[0]), e.addClass(F)) : e.addClass(b), this.tooltiping = setTimeout(i.proxy(function() { 663 t.transition ? (e.one(R, i.proxy(function() { 664 e.removeClass(n), 665 this.fading = !1 666 }, 667 this)).removeClass(F), this.fading = !0) : e.removeClass(b), 668 this.tooltiping = !1 669 }, 670 this), 1e3)) 671 }, 672 toggle: function() { 673 1 === this.image.ratio ? this.zoomTo(this.initialImage.ratio, !0) : this.zoomTo(1, !0) 674 }, 675 reset: function() { 676 this.isViewed && !this.isPlayed && (this.image = i.extend({}, 677 this.initialImage), this.renderImage()) 678 }, 679 update: function() { 680 var t, e = this.$element, 681 s = this.$images, 682 n = []; 683 if (this.isImg) { 684 if (!e.parent().length) return this.destroy() 685 } else this.$images = s = e.find(E), 686 this.length = s.length; 687 this.isBuilt && (i.each(this.$items, 688 function(t) { 689 var e = i(this).find("img")[0], 690 o = s[t]; 691 o ? o.src !== e.src && n.push(t) : n.push(t) 692 }), this.$list.width("auto"), this.initList(), this.isShown && (this.length ? this.isViewed && (t = i.inArray(this.index, n), t >= 0 ? (this.isViewed = !1, this.view(ei(this.index - (t + 1), 0))) : this.$items.eq(this.index).addClass(k)) : (this.$image = null, this.isViewed = !1, this.index = 0, this.image = null, this.$canvas.empty(), this.$title.empty()))) 693 }, 694 destroy: function() { 695 var i = this.$element; 696 this.options.inline ? this.unbind() : (this.isShown && this.unbind(), i.off(_, this.start)), 697 this.unbuild(), 698 i.removeData(f) 699 }, 700 trigger: function(t, e) { 701 var s = i.Event(t, e); 702 return this.$element.trigger(s), 703 s 704 }, 705 shown: function() { 706 var t = this.options; 707 this.transitioning = !1, 708 this.isFulled = !0, 709 this.isShown = !0, 710 this.isVisible = !0, 711 this.render(), 712 this.bind(), 713 i.isFunction(t.shown) && this.$element.one(U, t.shown), 714 this.trigger(U) 715 }, 716 hidden: function() { 717 var t = this.options; 718 this.transitioning = !1, 719 this.isViewed = !1, 720 this.isFulled = !1, 721 this.isShown = !1, 722 this.isVisible = !1, 723 this.unbind(), 724 this.$body.removeClass(p), 725 this.$viewer.addClass(y), 726 this.resetList(), 727 this.resetImage(), 728 i.isFunction(t.hidden) && this.$element.one(O, t.hidden), 729 this.trigger(O) 730 }, 731 requestFullscreen: function() { 732 var i = document.documentElement; ! this.isFulled || document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement || (i.requestFullscreen ? i.requestFullscreen() : i.msRequestFullscreen ? i.msRequestFullscreen() : i.mozRequestFullScreen ? i.mozRequestFullScreen() : i.webkitRequestFullscreen && i.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)) 733 }, 734 exitFullscreen: function() { 735 this.isFulled && (document.exitFullscreen ? document.exitFullscreen() : document.msExitFullscreen ? document.msExitFullscreen() : document.mozCancelFullScreen ? document.mozCancelFullScreen() : document.webkitExitFullscreen && document.webkitExitFullscreen()) 736 }, 737 change: function(i) { 738 var t = this.endX - this.startX, 739 e = this.endY - this.startY; 740 switch (this.action) { 741 case "move": 742 this.move(t, e); 743 break; 744 case "zoom": 745 this.zoom(function(i, t, e, s) {
746 var n = J(i * i + t * t), 747 o = J(e * e + s * s); 748 return (o - n) / n 749 } (ii(this.startX - this.startX2), ii(this.startY - this.startY2), ii(this.endX - this.endX2), ii(this.endY - this.endY2)), !1, i), 750 this.startX2 = this.endX2, 751 this.startY2 = this.endY2; 752 break; 753 case "switch": 754 this.action = "switched", 755 ii(t) > ii(e) && (t > 1 ? this.prev() : -1 > t && this.next()) 756 } 757 this.startX = this.endX, 758 this.startY = this.endY 759 }, 760 isSwitchable: function() { 761 var i = this.image, 762 t = this.viewer; 763 return i.left >= 0 && i.top >= 0 && i.width <= t.width && i.height <= t.height 764 } 765 }, 766 u.DEFAULTS = { 767 inline: !1, 768 button: !0, 769 navbar: !0, 770 title: !0, 771 toolbar: !0, 772 tooltip: !0, 773 movable: !0, 774 zoomable: !0, 775 rotatable: !0, 776 scalable: !0, 777 transition: !0, 778 fullscreen: !0, 779 keyboard: !0, 780 interval: 5e3, 781 minWidth: 200, 782 minHeight: 100, 783 zoomRatio: .1, 784 minZoomRatio: .01, 785 maxZoomRatio: 100, 786 zIndex: 2015, 787 zIndexInline: 0, 788 //url: "src", 789 subView: 8, 790 build: null, 791 built: null, 792 show: null, 793 shown: null, 794 hide: null, 795 hidden: null, 796 view: null, 797 viewed: null 798 }, 799 u.TEMPLATE = '<div class="viewer-container aykj-viewer"><div class="aykj-prev" data-action="prev"></div><div class="aykj-next" data-action="next"></div><div class="viewer-canvas"></div><div class="headBox"><div class="viewer-title"></div><div class="viewer-button" data-action="mix"></div><ul class="viewer-toolbar"><li class="viewer-zoom-in" data-action="zoom-in"></li><li class="viewer-zoom-out" data-action="zoom-out"></li><li class="viewer-one-to-one" data-action="one-to-one"></li><li class="viewer-reset" data-action="reset"></li><li class="viewer-prev" data-action="prev"></li><li class="viewer-play" data-action="play"></li><li class="viewer-next" data-action="next"></li><li class="viewer-rotate-left" data-action="rotate-left"></li><li class="viewer-rotate-right" data-action="rotate-right"></li><li class="viewer-flip-horizontal" data-action="flip-horizontal"></li><li class="viewer-flip-vertical" data-action="flip-vertical"></li></ul></div><div class="viewer-footer"><div class="viewer-number"></div><div class="viewer-navbar"><div class="viewer-navbar-div"><ul class="viewer-list"></ul></div></div></div><div class="viewer-tooltip"></div><div class="viewer-player"></div></div>', 800 u.other = i.fn.viewer, 801 i.fn.viewer = function(e) { 802 var o, a = n(arguments, 1); 803 return this.each(function() { 804 var s, n = i(this), 805 h = n.data(f); 806 if (!h) { 807 if (/destroy|hide|exit|stop|reset/.test(e)) return; 808 n.data(f, h = new u(this, e)) 809 } 810 t(e) && i.isFunction(s = h[e]) && (o = s.apply(h, a)) 811 }), 812 s(o) ? this: o 813 }, 814 i.fn.viewer.Constructor = u, 815 i.fn.viewer.setDefaults = u.setDefaults, 816 i.fn.viewer.noConflict = function() { 817 return i.fn.viewer = u.other, 818 this 819 } 820});
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.