/*! * viewer.js v0.3.1 * https://github.com/fengyuanchen/viewerjs * * copyright (c) 2015-2016 fengyuan chen * released under the mit license * * date: 2016-02-02t11:35:52.542z */ ! function(e, t) { "object" == typeof module && "object" == typeof module.exports ? module.exports = e.document ? t(e, !0) : function(e) { if (!e.document) throw new error("viewer requires a window with a document"); return t(e) } : t(e) }("undefined" != typeof window ? window : this, function(e, t) { "use strict"; function i(e) { return ae.call(e).slice(8, -1).tolowercase() } function n(e) { return "string" == typeof e } function a(e) { return "number" == typeof e && !isnan(e) } function o(e) { return "undefined" == typeof e } function r(e) { return "object" == typeof e && null !== e } function s(e) { var t, i; if (!r(e)) return !1; try { return t = e.constructor, i = t.prototype, t && i && ce.call(i, "isprototypeof") } catch (n) { return !1 } } function l(e) { return "function" === i(e) } function u(e) { return array.isarray ? array.isarray(e) : "array" === i(e) } function c(e, t) { return t = t >= 0 ? t : 0, array.from ? array.from(e).slice(t) : _e.call(e, t) } function d(e, t) { var i = -1; return t.indexof ? t.indexof(e) : (f(t, function(t, n) { return t === e ? (i = n, !1) : void 0 }), i) } function m(e) { return n(e) && (e = e.trim ? e.trim() : e.replace(le, "1")), e } function f(e, t) { var i, n; if (e && l(t)) if (u(e) || a(e.length)) for (n = 0, i = e.length; i > n && t.call(e, e[n], n, e) !== !1; n++); else if (r(e)) for (n in e) if (e.hasownproperty(n) && t.call(e, e[n], n, e) === !1) break; return e } function h(e) { var t; if (arguments.length > 1) { if (t = c(arguments), object.assign) return object.assign.apply(object, t); t.shift(), f(t, function(t) { f(t, function(t, i) { e[i] = t }) }) } return e } function v(e, t) { var i = c(arguments, 2); return function() { return e.apply(t, i.concat(c(arguments))) } } function g(e, t) { var i = e.style; f(t, function(e, t) { ie.test(t) && a(e) && (e += "px"), i[t] = e }) } function w(t) { return e.getcomputedstyle ? e.getcomputedstyle(t, null) : t.currentstyle } function p(e, t) { return e.classlist ? e.classlist.contains(t) : e.classname.indexof(t) > -1 } function b(e, t) { var i; if (t) { if (a(e.length)) return f(e, function(e) { b(e, t) }); if (e.classlist) return e.classlist.add(t); i = m(e.classname), i ? i.indexof(t) < 0 && (e.classname = i + " " + t) : e.classname = t } } function y(e, t) { return t ? a(e.length) ? f(e, function(e) { y(e, t) }) : e.classlist ? e.classlist.remove(t) : void(e.classname.indexof(t) >= 0 && (e.classname = e.classname.replace(t, ""))) : void 0 } function x(e, t, i) { return a(e.length) ? f(e, function(e) { x(e, t, i) }) : void(i ? b(e, t) : y(e, t)) } function z(e, t) { return r(e[t]) ? e[t] : e.dataset ? e.dataset[t] : e.getattribute("data-" + t) } function d(e, t, i) { r(i) && o(e[t]) ? e[t] = i : e.dataset ? e.dataset[t] = i : e.setattribute("data-" + t, i) } function e(e, t) { r(e[t]) ? delete e[t] : e.dataset ? delete e.dataset[t] : e.removeattribute("data-" + t) } function k(e, t, i, n) { var a = m(t).split(te), o = i; return a.length > 1 ? f(a, function(t) { k(e, t, i) }) : (n && (i = function() { return i(e, t, i), o.apply(e, arguments) }), void(e.addeventlistener ? e.addeventlistener(t, i, !1) : e.attachevent && e.attachevent("on" + t, i))) } function i(e, t, i) { var n = m(t).split(te); return n.length > 1 ? f(n, function(t) { i(e, t, i) }) : void(e.removeeventlistener ? e.removeeventlistener(t, i, !1) : e.detachevent && e.detachevent("on" + t, i)) } function l(e, t) { var i; return e.dispatchevent ? (l(h) ? i = new h(t, { bubbles: !0, cancelable: !0 }) : (i = w.createevent("event"), i.initevent(t, !0, !0)), e.dispatchevent(i)) : e.fireevent ? e.fireevent("on" + t) : void 0 } function t(e) { e.preventdefault ? e.preventdefault() : e.returnvalue = !1 } function y(t) { var i, n = t || e.event; return n.target || (n.target = n.srcelement || w), a(n.pagex) || (i = w.documentelement, n.pagex = n.clientx + (e.scrollx || i && i.scrollleft || 0) - (i && i.clientleft || 0), n.pagey = n.clienty + (e.scrolly || i && i.scrolltop || 0) - (i && i.clienttop || 0)), n } function f(t) { var i = w.documentelement, n = t.getboundingclientrect(); return { left: n.left + (e.scrollx || i && i.scrollleft || 0) - (i && i.clientleft || 0), top: n.top + (e.scrolly || i && i.scrolltop || 0) - (i && i.clienttop || 0) } } function x(e) { var t = e.length, i = 0, n = 0; return t && (f(e, function(e) { i += e.pagex, n += e.pagey }), i /= t, n /= t), { pagex: i, pagey: n } } function s(e, t) { return e.getelementsbytagname(t) } function v(e, t) { return e.getelementsbyclassname ? e.getelementsbyclassname(t) : e.queryselectorall("." + t) } function n(e, t) { return t.length ? f(t, function(t) { n(e, t) }) : void e.appendchild(t) } function p(e) { e.parentnode && e.parentnode.removechild(e) } function a(e) { for (; e.firstchild;) e.removechild(e.firstchild) } function c(e, t) { o(e.textcontent) ? e.innertext = t : e.textcontent = t } function _(e) { return e.offsetwidth } function r(e) { return n(e) ? e.replace(/^.*\//, "").replace(/[\?].*$/, "") : "" } function q(e, t) { var i; return e.naturalwidth ? t(e.naturalwidth, e.naturalheight) : (i = w.createelement("img"), i.onload = function() { t(this.width, this.height) }, void(i.src = e.src)) } function m(e) { var t = [], i = e.rotate, n = e.scalex, o = e.scaley; return a(i) && t.push("rotate(" + i + "deg)"), a(n) && a(o) && t.push("scale(" + n + "," + o + ")"), t.length ? t.join( " ") : "none" } function b(e) { switch (e) { case 2: return g; case 3: return j; case 4: return q } } function o(e, t) { var i = this; i.element = e, i.options = h({}, o.defaults, s(t) && t), i.isimg = !1, i.isbuilt = !1, i.isshown = !1, i.isviewed = ! 1, i.isfulled = !1, i.isplayed = !1, i.wheeling = !1, i.playing = !1, i.fading = !1, i.tooltiping = !1, i.transitioning = ! 1, i.action = !1, i.target = !1, i.timeout = !1, i.index = 0, i.length = 0, i.init() } var w = e.document, h = e.event, j = "viewer", u = j + "-fixed", z = j + "-open", k = j + "-show", $ = j + "-hide", g = "viewer-hide-xs-down", j = "viewer-hide-sm-down", q = "viewer-hide-md-down", ee = j + "-fade", te = j + "-in", ie = j + "-move", ne = j + "-active", ae = j + "-invisible", oe = j + "-transition", re = j + "-fullscreen", se = j + "-fullscreen-exit", le = j + "-close", ue = "mousedown touchstart pointerdown mspointerdown", ce = "mousemove touchmove pointermove mspointermove", de = "mouseup touchend touchcancel pointerup pointercancel mspointerup mspointercancel", me = "wheel mousewheel dommousescroll", fe = "transitionend", he = "load", ve = "keydown", ge = "click", we = "resize", pe = "build", be = "built", ye = "show", xe = "shown", ze = "hide", de = "hidden", ee = "view", ke = "viewed", ie = /width|height|left|top|marginleft|margintop/, le = /^\s+(.*)\s+$/, te = /\s+/, ye = "undefined" != typeof w.createelement(j).style.transition, fe = math.min, xe = math.max, se = math.abs, ve = math.sqrt, ne = math.round, pe = object.prototype, ae = pe.tostring, ce = pe.hasownproperty, _e = array.prototype.slice; o.prototype = { constructor: o, init: function() { var e = this, t = e.options, i = e.element, n = "img" === i.tagname.tolowercase(), a = n ? [i] : s(i, "img"), o = a.length, r = v(e.ready, e); z(i, j) || (d(i, j, e), o && (l(t.build) && k(i, pe, t.build, !0), l(i, pe) !== !1 && (ye || (t.transition = !1), e.isimg = n, e.length = o, e.count = 0, e.images = a, e.body = w.body, t.inline ? (k(i, be, function() { e.view() }, !0), f(a, function(e) { e.complete ? r() : k(e, he, r, !0) })) : k(i, ge, e._start = v(e.start, e))))) }, ready: function() { var e = this; e.count++, e.count === e.length && e.build() }, build: function() { var e, t, i, n, a, o, r, s, u = this, c = u.options, d = u.element; u.isbuilt || (e = w.createelement("div"), e.innerhtml = o.template, u.parent = t = d.parentnode, u.viewer = i = v( e, "viewer-container")[0], u.canvas = v(i, "viewer-canvas")[0], u.footer = v(i, "viewer-footer")[0], u.title = r = v(i, "viewer-title")[0], u.toolbar = a = v(i, "viewer-toolbar")[0], u.navbar = o = v(i, "viewer-navbar")[0], u.button = n = v(i, "viewer-button")[0], u.tooltipbox = v(i, "viewer-tooltip")[0], u.player = v(i, "viewer-player")[0], u.list = v(i, "viewer-list")[0], b(r, c.title ? b(c.title) : $), b(a, c.toolbar ? b(c.toolbar) : $), b(o, c.navbar ? b(c.navbar) : $), x(n, $, !c.button), x(a.queryselectorall("li[class*=zoom]"), ae, !c.zoomable), x(a.queryselectorall("li[class*=flip]"), ae, !c.scalable), c.rotatable || (s = a.queryselectorall( "li[class*=rotate]"), b(s, ae), n(a, s)), c.inline ? (b(n, re), g(i, { zindex: c.zindexinline }), "static" === w(t).position && g(t, { position: "relative" })) : (b(n, le), b(i, u), b(i, ee), b(i, $), g(i, { zindex: c.zindex })), document.body.appendchild(i, d.nextsibling), c.inline && (u.render(), u.bind(), u.isshown = !0), u.isbuilt = !0, l(c.built) && k(d, be, c.built, !0), l(d, be)) }, unbuild: function() { var e = this; e.isbuilt && (e.isbuilt = !1, p(e.viewer)) }, bind: function() { var t = this, i = t.options, n = t.element, a = t.viewer; l(i.view) && k(n, ee, i.view), l(i.viewed) && k(n, ke, i.viewed), k(a, ge, t._click = v(t.click, t)), k(a, me, t._wheel = v(t.wheel, t)), k(t.canvas, ue, t._mousedown = v(t.mousedown, t)), k(w, ce, t._mousemove = v(t.mousemove, t)), k(w, de, t._mouseup = v(t.mouseup, t)), k(w, ve, t._keydown = v(t.keydown, t)), k(e, we, t._resize = v(t.resize, t)) }, unbind: function() { var t = this, i = t.options, n = t.element, a = t.viewer; l(i.view) && i(n, ee, i.view), l(i.viewed) && i(n, ke, i.viewed), i(a, ge, t._click), i(a, me, t._wheel), i(t.canvas, ue, t._mousedown), i(w, ce, t._mousemove), i(w, de, t._mouseup), i(w, ve, t._keydown), i(e, we, t._resize) }, render: function() { var e = this; e.initcontainer(), e.initviewer(), e.initlist(), e.renderviewer() }, initcontainer: function() { var t = this; t.containerdata = { width: e.innerwidth, height: e.innerheight } }, initviewer: function() { var e, t = this, i = t.options, n = t.parent; i.inline && (t.parentdata = e = { width: xe(n.offsetwidth, i.minwidth), height: xe(n.offsetheight, i.minheight) }), (t.isfulled || !e) && (e = t.containerdata), t.viewerdata = h({}, e) }, renderviewer: function() { var e = this; e.options.inline && !e.isfulled && g(e.viewer, e.viewerdata) }, initlist: function() { var e = this, t = e.options, i = e.element, a = e.list, o = []; f(e.images, function(a, r) { var s = a.src, u = a.alt || r(s), c = t.url; s && (n(c) ? c = a.getattribute(c) : l(c) && (c = c.call(i, e)), o.push('
')) }), a.innerhtml = o.join(""), f(s(a, "img"), function(t) { d(t, "filled", !0), k(t, he, v(e.loadimage, e), !0) }), e.items = s(a, "li"), t.transition && k(i, ke, function() { b(a, oe) }, !0) }, renderlist: function(e) { var t = this, i = e || t.index, n = t.items[i].offsetwidth || 30, a = n + 1; g(t.list, { width: a * t.length, marginleft: (t.viewerdata.width - n) / 2 - a * i }) }, resetlist: function() { var e = this; a(e.list), y(e.list, oe), g({ marginleft: 0 }) }, initimage: function(e) { var t = this, i = t.options, n = t.image, a = t.viewerdata, o = t.footer.offsetheight, r = a.width, s = xe(a.height - o, o), u = t.imagedata || {}; q(n, function(n, a) { var o, c, d = n / a, m = r, f = s; s * d > r ? f = r / d : m = s * d, m = fe(.9 * m, n), f = fe(.9 * f, a), c = { naturalwidth: n, naturalheight: a, aspectratio: d, ratio: m / n, width: m, height: f, left: (r - m) / 2, top: (s - f) / 2 }, o = h({}, c), i.rotatable && (c.rotate = u.rotate || 0, o.rotate = 0), i.scalable && (c.scalex = u.scalex || 1, c.scaley = u.scaley || 1, o.scalex = 1, o.scaley = 1), t.imagedata = c, t.initialimagedata = o, l(e) && e() }) }, renderimage: function(e) { var t = this, i = t.image, n = t.imagedata, a = m(n); g(i, { width: n.width, height: n.height, marginleft: n.left, margintop: n.top, webkittransform: a, mstransform: a, transform: a }), l(e) && (t.transitioning ? k(i, fe, e, !0) : e()) }, resetimage: function() { var e = this; e.image && (p(e.image), e.image = null) }, start: function(e) { var t = this, i = y(e), n = i.target; "img" === n.tagname.tolowercase() && (t.target = n, t.show()) }, click: function(e) { var t = this, i = y(e), n = i.target, a = z(n, "action"), o = t.imagedata; switch (a) { case "mix": t.isplayed ? t.stop() : t.options.inline ? t.isfulled ? t.exit() : t.full() : t.hide(); break; case "view": t.view(z(n, "index")); break; case "zoom-in": t.zoom(.1, !0); break; case "zoom-out": t.zoom(-.1, !0); break; case "one-to-one": t.toggle(); break; case "reset": t.reset(); break; case "prev": t.prev(); break; case "play": t.play(); break; case "next": t.next(); break; case "rotate-left": t.rotate(-90); break; case "rotate-right": t.rotate(90); break; case "flip-horizontal": t.scalex(-o.scalex || -1); break; case "flip-vertical": t.scaley(-o.scaley || -1); break; default: t.isplayed && t.stop() } }, load: function() { var e = this, t = e.options, i = e.image, n = e.viewerdata; e.timeout && (cleartimeout(e.timeout), e.timeout = !1), y(i, ae), i.style.csstext = "width:0;height:0;margin-left:" + n.width / 2 + "px;margin-top:" + n.height / 2 + "px;max-width:none!important;visibility:visible;", e.initimage(function() { x(i, oe, t.transition), x(i, ie, t.movable), e.renderimage(function() { e.isviewed = !0, l(e.element, ke) }) }) }, loadimage: function(e) { var t = y(e), i = t.target, n = i.parentnode, a = n.offsetwidth || 30, o = n.offsetheight || 50, r = !!z(i, "filled"); q(i, function(e, t) { var n = e / t, s = a, l = o; o * n > a ? r ? s = o * n : l = a / n : r ? l = a / n : s = o * n, g(i, { width: s, height: l, marginleft: (a - s) / 2, margintop: (o - l) / 2 }) }) }, resize: function() { var e = this; e.initcontainer(), e.initviewer(), e.renderviewer(), e.renderlist(), e.isviewed && e.initimage(function() { e.renderimage() }), e.isplayed && f(s(e.player, "img"), function(t) { k(t, he, v(e.loadimage, e), !0), l(t, he) }) }, wheel: function(e) { var t = this, i = y(e), n = number(t.options.zoomratio) || .1, a = 1; t.isviewed && (t(i), t.wheeling || (t.wheeling = !0, settimeout(function() { t.wheeling = !1 }, 50), i.deltay ? a = i.deltay > 0 ? 1 : -1 : i.wheeldelta ? a = -i.wheeldelta / 120 : i.detail && (a = i.detail > 0 ? 1 : -1), t.zoom(-a * n, !0, i))) }, keydown: function(e) { var t = this, i = y(e), n = t.options, a = i.keycode || i.which || i.charcode; if (t.isfulled && n.keyboard) switch (a) { case 27: t.isplayed ? t.stop() : n.inline ? t.isfulled && t.exit() : t.hide(); break; case 32: t.isplayed && t.stop(); break; case 37: t.prev(); break; case 38: t(i), t.zoom(n.zoomratio, !0); break; case 39: t.next(); break; case 40: t(i), t.zoom(-n.zoomratio, !0); break; case 48: case 49: (i.ctrlkey || i.shiftkey) && (t(i), t.toggle()) } }, mousedown: function(e) { var t, i, n = this, a = n.options, o = y(e), r = a.movable ? "move" : !1, s = o.touches; if (n.isviewed) { if (s) { if (t = s.length, t > 1) { if (!a.zoomable || 2 !== t) return; i = s[1], n.startx2 = i.pagex, n.starty2 = i.pagey, r = "zoom" } else n.isswitchable() && (r = "switch"); i = s[0] } r && (t(o), n.action = r, n.startx = i ? i.pagex : o.pagex, n.starty = i ? i.pagey : o.pagey) } }, mousemove: function(e) { var t, i, n = this, a = n.options, o = y(e), r = n.action, s = n.image, l = o.touches; if (n.isviewed) { if (l) { if (t = l.length, t > 1) { if (!a.zoomable || 2 !== t) return; i = l[1], n.endx2 = i.pagex, n.endy2 = i.pagey } i = l[0] } r && (t(o), "move" === r && a.transition && p(s, oe) && y(s, oe), n.endx = i ? i.pagex : o.pagex, n.endy = i ? i .pagey : o.pagey, n.change(o)) } }, mouseup: function(e) { var t = this, i = y(e), n = t.action; n && (t(i), "move" === n && t.options.transition && b(t.image, oe), t.action = !1) }, show: function() { var e, t = this, i = t.options, n = t.element; return i.inline || t.transitioning ? t : (t.isbuilt || t.build(), e = t.viewer, l(i.show) && k(n, ye, i.show, !0), l(n, ye) === !1 ? t : (b(t.body, z), y(e, $), k(n, xe, function() { t.view(t.target ? d(t.target, c(t.images)) : t.index), t.target = !1 }, !0), i.transition ? (t.transitioning = !0, b(e, oe), _(e), k(e, fe, v(t.shown, t), !0), b(e, te)) : (b(e, te), t.shown()), t)) }, hide: function() { var e = this, t = e.options, i = e.element, n = e.viewer; return t.inline || e.transitioning || !e.isshown ? e : (l(t.hide) && k(i, ze, t.hide, !0), l(i, ze) === !1 ? e : (e.isviewed && t.transition ? (e.transitioning = !0, k(e.image, fe, function() { k(n, fe, v(e.hidden, e), !0), y(n, te) }, !0), e.zoomto(0, !1, !1, !0)) : (y(n, te), e.hidden()), e)) }, view: function(e) { var t, i, n, a, o, r = this, s = r.element, l = r.title, u = r.canvas; return e = number(e) || 0, !r.isshown || r.isplayed || 0 > e || e >= r.length || r.isviewed && e === r.index ? r : l(s, ee) === !1 ? r : (i = r.items[e], n = s(i, "img")[0], a = z(n, "originalurl"), o = n.getattribute("alt"), t = w.createelement("img"), t.src = a, t.alt = o, r.image = t, r.isviewed && y(r.items[r.index], ne), b(i, ne), r.isviewed = ! 1, r.index = e, r.imagedata = null, b(u, ae), a(u), n(u, t), r.renderlist(), a(l), k(s, ke, function() { var e = r.imagedata, t = e.naturalwidth, i = e.naturalheight; c(l, o + " (" + t + " × " + i + ")") }, !0), t.complete ? r.load() : (k(t, he, v(r.load, r), !0), r.timeout && cleartimeout(r.timeout), r.timeout = settimeout(function() { y(t, ae), r.timeout = !1 }, 1e3)), r) }, prev: function() { var e = this; return e.view(xe(e.index - 1, 0)), e }, next: function() { var e = this; return e.view(fe(e.index + 1, e.length - 1)), e }, move: function(e, t) { var i = this, n = i.imagedata; return i.moveto(o(e) ? e : n.left + number(e), o(t) ? t : n.top + number(t)), i }, moveto: function(e, t) { var i = this, n = i.imagedata, r = !1; return o(t) && (t = e), e = number(e), t = number(t), i.isviewed && !i.isplayed && i.options.movable && (a(e) && (n.left = e, r = !0), a(t) && (n.top = t, r = !0), r && i.renderimage()), i }, zoom: function(e, t, i) { var n = this, a = n.imagedata; return e = number(e), e = 0 > e ? 1 / (1 - e) : 1 + e, n.zoomto(a.width * e / a.naturalwidth, t, i), n }, zoomto: function(e, t, i, n) { var o, r, s, l, u = this, c = u.options, d = .01, m = 100, f = u.imagedata; return e = xe(0, e), a(e) && u.isviewed && !u.isplayed && (n || c.zoomable) && (n || (d = xe(d, c.minzoomratio), m = fe(m, c.maxzoomratio), e = fe(xe(e, d), m)), e > .95 && 1.05 > e && (e = 1), o = f.naturalwidth * e, r = f .naturalheight * e, i ? (s = f(u.viewer), l = i.touches ? x(i.touches) : { pagex: i.pagex, pagey: i.pagey }, f.left -= (o - f.width) * ((l.pagex - s.left - f.left) / f.width), f.top -= (r - f.height) * ((l.pagey - s.top - f.top) / f.height)) : (f.left -= (o - f.width) / 2, f.top -= (r - f.height) / 2), f.width = o, f.height = r, f .ratio = e, u.renderimage(), t && u.tooltip()), u }, rotate: function(e) { var t = this; return t.rotateto((t.imagedata.rotate || 0) + number(e)), t }, rotateto: function(e) { var t = this, i = t.imagedata; return e = number(e), a(e) && t.isviewed && !t.isplayed && t.options.rotatable && (i.rotate = e, t.renderimage()), t }, scale: function(e, t) { var i = this, n = i.imagedata, r = !1; return o(t) && (t = e), e = number(e), t = number(t), i.isviewed && !i.isplayed && i.options.scalable && (a(e) && (n.scalex = e, r = !0), a(t) && (n.scaley = t, r = !0), r && i.renderimage()), i }, scalex: function(e) { var t = this; return t.scale(e, t.imagedata.scaley), t }, scaley: function(e) { var t = this; return t.scale(t.imagedata.scalex, e), t }, play: function() { var e, t = this, i = t.options, n = t.player, o = v(t.loadimage, t), r = [], s = 0, l = 0; return !t.isshown || t.isplayed ? t : (i.fullscreen && t.requestfullscreen(), t.isplayed = !0, b(n, k), f(t.items, function(e, t) { var a = s(e, "img")[0], u = w.createelement("img"); u.src = z(a, "originalurl"), u.alt = a.getattribute("alt"), s++, b(u, ee), x(u, oe, i.transition), p(e, ne) && (b(u, te), l = t), r.push(u), k(u, he, o, !0), n(n, u) }), a(i.interval) && i.interval > 0 && (e = function() { t.playing = settimeout(function() { y(r[l], te), l++, l = s > l ? l : 0, b(r[l], te), e() }, i.interval) }, s > 1 && e()), t) }, stop: function() { var e = this, t = e.player; return e.isplayed ? (e.options.fullscreen && e.exitfullscreen(), e.isplayed = !1, cleartimeout(e.playing), y(t, k), a(t), e) : e }, full: function() { var e = this, t = e.options, i = e.viewer, n = e.image, a = e.list; return !e.isshown || e.isplayed || e.isfulled || !t.inline ? e : (e.isfulled = !0, b(e.body, z), b(e.button, se), t.transition && (y(n, oe), y(a, oe)), b(i, u), i.setattribute("style", ""), g(i, { zindex: t.zindex }), e.initcontainer(), e.viewerdata = h({}, e.containerdata), e.renderlist(), e.initimage(function() { e.renderimage(function() { t.transition && settimeout(function() { b(n, oe), b(a, oe) }, 0) }) }), e) }, exit: function() { var e = this, t = e.options, i = e.viewer, n = e.image, a = e.list; return e.isfulled ? (e.isfulled = !1, y(e.body, z), y(e.button, se), t.transition && (y(n, oe), y(a, oe)), y(i, u), g(i, { zindex: t.zindexinline }), e.viewerdata = h({}, e.parentdata), e.renderviewer(), e.renderlist(), e.initimage(function() { e.renderimage(function() { t.transition && settimeout(function() { b(n, oe), b(a, oe) }, 0) }) }), e) : e }, tooltip: function() { var e = this, t = e.options, i = e.tooltipbox, n = e.imagedata; return e.isviewed && !e.isplayed && t.tooltip ? (c(i, ne(100 * n.ratio) + "%"), e.tooltiping ? cleartimeout(e.tooltiping) : t.transition ? (e.fading && l(i, fe), b(i, k), b(i, ee), b(i, oe), _(i), b(i, te)) : b(i, k), e.tooltiping = settimeout(function() { t.transition ? (k(i, fe, function() { y(i, k), y(i, ee), y(i, oe), e.fading = !1 }, !0), y(i, te), e.fading = !0) : y(i, k), e.tooltiping = !1 }, 1e3), e) : e }, toggle: function() { var e = this; return 1 === e.imagedata.ratio ? e.zoomto(e.initialimagedata.ratio, !0) : e.zoomto(1, !0), e }, reset: function() { var e = this; return e.isviewed && !e.isplayed && (e.imagedata = h({}, e.initialimagedata), e.renderimage()), e }, update: function() { var e, t = this, i = []; return t.isimg && !t.element.parentnode ? t.destroy() : (t.length = t.images.length, t.isbuilt && (f(t.items, function(e, n) { var a = s(e, "img")[0], o = t.images[n]; o ? o.src !== a.src && i.push(n) : i.push(n) }), g(t.list, { width: "auto" }), t.initlist(), t.isshown && (t.length ? t.isviewed && (e = d(t.index, i), e >= 0 ? (t.isviewed = !1, t.view( xe(t.index - (e + 1), 0))) : b(t.items[t.index], ne)) : (t.image = null, t.isviewed = !1, t.index = 0, t.imagedata = null, a(t.canvas), a(t.title)))), t) }, destroy: function() { var e = this, t = e.element; return e.options.inline ? e.unbind() : (e.isshown && e.unbind(), i(t, ge, e._start)), e.unbuild(), e(t, j), e }, shown: function() { var e = this, t = e.options, i = e.element; e.transitioning = !1, e.isfulled = !0, e.isshown = !0, e.isvisible = !0, e.render(), e.bind(), l(t.shown) && k(i, xe, t.shown, !0), l(i, xe) }, hidden: function() { var e = this, t = e.options, i = e.element; e.transitioning = !1, e.isviewed = !1, e.isfulled = !1, e.isshown = !1, e.isvisible = !1, e.unbind(), y(e.body, z), b(e.viewer, $), e.resetlist(), e.resetimage(), l(t.hidden) && k(i, de, t.hidden, !0), l(i, de) }, requestfullscreen: function() { var e = this, t = w.documentelement; !e.isfulled || w.fullscreenelement || w.mozfullscreenelement || w.webkitfullscreenelement || w.msfullscreenelement || (t.requestfullscreen ? t.requestfullscreen() : t.msrequestfullscreen ? t.msrequestfullscreen() : t.mozrequestfullscreen ? t.mozrequestfullscreen() : t.webkitrequestfullscreen && t.webkitrequestfullscreen(element.allow_keyboard_input) ) }, exitfullscreen: function() { var e = this; e.isfulled && (w.exitfullscreen ? w.exitfullscreen() : w.msexitfullscreen ? w.msexitfullscreen() : w.mozcancelfullscreen ? w.mozcancelfullscreen() : w.webkitexitfullscreen && w.webkitexitfullscreen()) }, change: function(e) { var t = this, i = t.endx - t.startx, n = t.endy - t.starty; switch (t.action) { case "move": t.move(i, n); break; case "zoom": t.zoom(function(e, t, i, n) { var a = ve(e * e + t * t), o = ve(i * i + n * n); return (o - a) / a }(se(t.startx - t.startx2), se(t.starty - t.starty2), se(t.endx - t.endx2), se(t.endy - t.endy2)), !1, e), t.startx2 = t.endx2, t.starty2 = t.endy2; break; case "switch": t.action = "switched", se(i) > se(n) && (i > 1 ? t.prev() : -1 > i && t.next()) } t.startx = t.endx, t.starty = t.endy }, isswitchable: function() { var e = this, t = e.imagedata, i = e.viewerdata; return t.left >= 0 && t.top >= 0 && t.width <= i.width && t.height <= i.height } }, o.defaults = { inline: !1, button: !0, navbar: !0, title: !0, toolbar: !0, tooltip: !0, movable: !0, zoomable: !0, rotatable: !0, scalable: !0, transition: !0, fullscreen: !0, keyboard: !0, interval: 5e3, minwidth: 200, minheight: 100, zoomratio: .1, minzoomratio: .01, maxzoomratio: 100, zindex: 2015, zindexinline: 0, url: "src", build: null, built: null, show: null, shown: null, hide: null, hidden: null, view: null, viewed: null }, o.template = '