/*! * Viewer.js v1.0.1 * https://fengyuanchen.github.io/viewerjs * * Copyright 2015-present Chen Fengyuan * Released under the MIT license * * Date: 2018-05-20T09:43:46.347Z */ !function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):t.Viewer=i()}(this,function(){"use strict";var n={inline:!1,button:!0,navbar:!0,title:!0,toolbar:!0,tooltip:!0,movable:!0,zoomable:!0,rotatable:!0,scalable:!0,transition:!0,fullscreen:!0,interval:5e3,keyboard:!0,backdrop:!0,loading:!0,loop:!0,minWidth:200,minHeight:100,zoomRatio:.1,minZoomRatio:.01,maxZoomRatio:100,zIndex:2015,zIndexInline:0,url:"src",container:"body",filter:null,ready:null,show:null,shown:null,hide:null,hidden:null,view:null,viewed:null},s="undefined"!=typeof window,o=s?window:{},p="viewer",d="move",c="switch",u="zoom",m=p+"-active",w=p+"-fade",b=p+"-fixed",a=p+"-fullscreen-exit",y=p+"-hide",f=p+"-in",x=p+"-invisible",v=p+"-loading",i=p+"-open",g=p+"-show",D=p+"-transition",z="ready",r="show",e="shown",h="hide",l="hidden",k="view",E="viewed",S="click",I="dragstart",T="keydown",L="load",C=o.PointerEvent?"pointerdown":"touchstart mousedown",M=o.PointerEvent?"pointermove":"touchmove mousemove",N=o.PointerEvent?"pointerup pointercancel":"touchend touchcancel mouseup",Y="resize",X="transitionend",R="wheel mousewheel DOMMouseScroll",q=p+"Action",F=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"],O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t=function(){function n(t,i){for(var e=0;e'+s+'')}),i.innerHTML=h.join(""),this.items=i.getElementsByTagName("li"),U(this.items,function(i){var t=i.firstElementChild;st(t,"filled",!0),r.loading&&J(i,v),ht(t,L,function(t){r.loading&&Q(i,v),a.loadImage(t)},{once:!0})}),r.transition&&ht(t,E,function(){J(i,D)},{once:!0})},renderList:function(t){var i=t||this.index,e=this.items[i].offsetWidth||30,n=e+1;_(this.list,Z({width:n*this.length},dt({translateX:(this.viewerData.width-e)/2-n*i})))},resetList:function(){var t=this.list;t.innerHTML="",Q(t,D),_(t,dt({translateX:0}))},initImage:function(r){var h=this,l=this.options,t=this.image,i=this.viewerData,e=this.footer.offsetHeight,d=i.width,c=Math.max(i.height-e,e),u=this.imageData||{},n=void 0;this.imageInitializing={abort:function(){n.onload=null}},n=ut(t,function(t,i){var e=t/i,n=d,s=c;h.imageInitializing=!1,d=this.length||this.viewed&&t===this.index)return this;this.viewing&&this.viewing.abort();var e=this.element,n=this.options,s=this.title,o=this.canvas,a=this.items[t],r=a.querySelector("img"),h=nt(r,"originalUrl"),l=r.getAttribute("alt"),d=document.createElement("img");if(d.src=h,d.alt=l,K(n.view)&&ht(e,k,n.view,{once:!0}),!1===lt(e,k,{originalImage:this.images[t],index:t,image:d})||!this.isShown||this.hiding||this.played)return this;this.image=d,Q(this.items[this.index],m),J(a,m),this.viewed=!1,this.index=t,this.imageData={},J(d,x),n.loading&&J(o,v),o.innerHTML="",o.appendChild(d),this.renderList(),s.innerHTML="";var c=function(){var t=i.imageData;s.textContent=l+" ("+t.naturalWidth+" × "+t.naturalHeight+")"},u=void 0;return ht(e,E,c,{once:!0}),this.viewing={abort:function(){rt(e,E,c),d.complete?this.imageRendering?this.imageRendering.abort():this.imageInitializing&&this.imageInitializing.abort():(rt(d,L,u),this.timeout&&clearTimeout(this.timeout))}},d.complete?this.load():(ht(d,L,u=this.load.bind(this),{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){Q(d,x),i.timeout=!1},1e3)),this},prev:function(){var t=0Math.abs(r)&&(this.pointers={},1
';var n=e.querySelector("."+p+"-container"),s=n.querySelector("."+p+"-title"),o=n.querySelector("."+p+"-toolbar"),a=n.querySelector("."+p+"-navbar"),r=n.querySelector("."+p+"-button"),l=n.querySelector("."+p+"-canvas");if(this.parent=i,this.viewer=n,this.title=s,this.toolbar=o,this.navbar=a,this.button=r,this.canvas=l,this.footer=n.querySelector("."+p+"-footer"),this.tooltipBox=n.querySelector("."+p+"-tooltip"),this.player=n.querySelector("."+p+"-player"),this.list=n.querySelector("."+p+"-list"),J(s,h.title?mt(h.title):y),J(a,h.navbar?mt(h.navbar):y),tt(r,y,!h.button),h.backdrop&&(J(n,p+"-backdrop"),h.inline||!0!==h.backdrop||st(l,q,"hide")),h.toolbar){var d=document.createElement("ul"),c=V(h.toolbar),u=F.slice(0,3),m=F.slice(7,9),f=F.slice(9);c||J(o,mt(h.toolbar)),U(c?h.toolbar:F,function(t,i){var e=c&&V(t),n=c?et(i):t,s=e&&!H(t.show)?t.show:t;if(s&&(h.zoomable||-1===u.indexOf(n))&&(h.rotatable||-1===m.indexOf(n))&&(h.scalable||-1===f.indexOf(n))){var o=e&&!H(t.size)?t.size:t,a=e&&!H(t.click)?t.click:t,r=document.createElement("li");r.setAttribute("role","button"),J(r,p+"-"+n),K(a)||st(r,q,n),A(s)&&J(r,mt(s)),-1!==["small","large"].indexOf(o)?J(r,p+"-"+o):"play"===n&&J(r,p+"-large"),K(a)&&ht(r,S,a),d.appendChild(r)}}),o.appendChild(d)}else J(o,y);if(!h.rotatable){var v=o.querySelectorAll('li[class*="rotate"]');J(v,x),U(v,function(t){o.appendChild(t)})}if(h.inline)J(r,"viewer-fullscreen"),_(n,{zIndex:h.zIndexInline}),"static"===window.getComputedStyle(i).position&&_(i,{position:"relative"}),i.insertBefore(n,t.nextSibling);else{J(r,"viewer-close"),J(n,b),J(n,w),J(n,y),_(n,{zIndex:h.zIndex});var g=h.container;W(g)&&(g=t.ownerDocument.querySelector(g)),g||(g=this.body),g.appendChild(n)}h.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,K(h.ready)&&ht(t,z,h.ready,{once:!0}),!1!==lt(t,z)?this.ready&&h.inline&&this.view():this.ready=!1}}}],[{key:"noConflict",value:function(){return window.Viewer=yt,e}},{key:"setDefaults",value:function(t){Z(n,V(t)&&t)}}]),e}();return Z(xt.prototype,vt,gt,pt,wt,bt),xt});