imageviewer
Advanced tools
Comparing version 1.0.0-alpha to 1.0.0-beta
# Changelog | ||
## 1.0.0-beta (Mar 15, 2018) | ||
- Upgrade Viewer.js to 1.0.0-rc.1. | ||
## 1.0.0-alpha (Mar 11, 2018) | ||
@@ -4,0 +8,0 @@ |
/*! | ||
* Viewer v1.0.0-alpha | ||
* Viewer v1.0.0-beta | ||
* https://github.com/fengyuanchen/viewer | ||
@@ -8,4 +8,4 @@ * | ||
* | ||
* Date: 2018-03-11T04:59:30.721Z | ||
* Date: 2018-03-15T14:11:04.644Z | ||
*/ | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],i):i(t.jQuery)}(this,function(d){"use strict";d=d&&d.hasOwnProperty("default")?d.default:d;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},t="undefined"!=typeof window?window:{},p="viewer",l="move",c="switch",u="zoom",f=p+"-active",w=p+"-fade",b=p+"-fixed",o=p+"-fullscreen-exit",y=p+"-hide",i=p+"-hide-md-down",e=p+"-hide-sm-down",s=p+"-hide-xs-down",m=p+"-in",x=p+"-invisible",v=p+"-loading",a=p+"-open",g=p+"-show",D=p+"-transition",z="ready",r="show",h="shown",k="hide",E="hidden",S="view",I="viewed",T="click",L="dragstart",C="keydown",M="load",N=t.PointerEvent?"pointerdown":"touchstart mousedown",q=t.PointerEvent?"pointermove":"mousemove touchmove",Y=t.PointerEvent?"pointerup pointercancel":"touchend touchcancel mouseup",X="resize",R="transitionend",O="wheel mousewheel DOMMouseScroll",F=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"],W="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},P=function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")},A=function(){function n(t,i){for(var e=0;e<i.length;e++){var n=i[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(t,i,e){return i&&n(t.prototype,i),e&&n(t,e),t}}();function j(t){return"string"==typeof t}var H=Number.isNaN||t.isNaN;function B(t){return"number"==typeof t&&!H(t)}function V(t){return void 0===t}function K(t){return"object"===(void 0===t?"undefined":W(t))&&null!==t}var U=Object.prototype.hasOwnProperty;function Z(t){if(!K(t))return!1;try{var i=t.constructor,e=i.prototype;return i&&e&&U.call(e,"isPrototypeOf")}catch(t){return!1}}function $(t){return"function"==typeof t}function _(i,e){if(i&&$(e))if(Array.isArray(i)||B(i.length)){var t=i.length,n=void 0;for(n=0;n<t&&!1!==e.call(i,i[n],n,i);n+=1);}else K(i)&&Object.keys(i).forEach(function(t){e.call(i,i[t],t,i)});return i}var Q=Object.assign||function(e){for(var t=arguments.length,i=Array(1<t?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return K(e)&&0<i.length&&i.forEach(function(i){K(i)&&Object.keys(i).forEach(function(t){e[t]=i[t]})}),e},G=/^(?:width|height|left|top|marginLeft|marginTop)$/;function J(t,i){var e=t.style;_(i,function(t,i){G.test(i)&&B(t)&&(t+="px"),e[i]=t})}function tt(t,i){return t.classList?t.classList.contains(i):-1<t.className.indexOf(i)}function it(t,i){if(i)if(B(t.length))_(t,function(t){it(t,i)});else if(t.classList)t.classList.add(i);else{var e=t.className.trim();e?e.indexOf(i)<0&&(t.className=e+" "+i):t.className=i}}function et(t,i){i&&(B(t.length)?_(t,function(t){et(t,i)}):t.classList?t.classList.remove(i):0<=t.className.indexOf(i)&&(t.className=t.className.replace(i,"")))}function nt(t,i,e){i&&(B(t.length)?_(t,function(t){nt(t,i,e)}):e?it(t,i):et(t,i))}var st=/([a-z\d])([A-Z])/g;function ot(t){return t.replace(st,"$1-$2").toLowerCase()}function at(t,i){return K(t[i])?t[i]:t.dataset?t.dataset[i]:t.getAttribute("data-"+ot(i))}function rt(t,i,e){K(e)?t[i]=e:t.dataset?t.dataset[i]=e:t.setAttribute("data-"+ot(i),e)}var ht,lt,dt,ct=/\s\s*/,ut=(ht=!1,lt=function(){},dt=Object.defineProperty({},"once",{get:function(){return ht=!0}}),t.addEventListener("test",lt,dt),t.removeEventListener("test",lt,dt),ht);function ft(e,t,n){var s=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},o=n;t.trim().split(ct).forEach(function(t){if(!ut){var i=e.listeners;i&&i[t]&&i[t][n]&&(o=i[t][n],delete i[t][n],0===Object.keys(i[t]).length&&delete i[t],0===Object.keys(i).length&&delete e.listeners)}e.removeEventListener(t,o,s)})}function mt(o,t,a){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},h=a;t.trim().split(ct).forEach(function(n){if(r.once&&!ut){var t=o.listeners,s=void 0===t?{}:t;h=function(){for(var t=arguments.length,i=Array(t),e=0;e<t;e++)i[e]=arguments[e];delete s[n][a],o.removeEventListener(n,h,r),a.apply(o,i)},s[n]||(s[n]={}),s[n][a]&&o.removeEventListener(n,s[n][a],r),s[n][a]=h,o.listeners=s}o.addEventListener(n,h,r)})}function vt(t,i,e){var n=void 0;return $(Event)&&$(CustomEvent)?n=new CustomEvent(i,{detail:e,bubbles:!0,cancelable:!0}):(n=document.createEvent("CustomEvent")).initCustomEvent(i,!0,!0,e),t.dispatchEvent(n)}function gt(t){var i=t.rotate,e=t.scaleX,n=t.scaleY,s=t.translateX,o=t.translateY,a=[];B(s)&&0!==s&&a.push("translateX("+s+"px)"),B(o)&&0!==o&&a.push("translateY("+o+"px)"),B(i)&&0!==i&&a.push("rotate("+i+"deg)"),B(e)&&1!==e&&a.push("scaleX("+e+")"),B(n)&&1!==n&&a.push("scaleY("+n+")");var r=a.length?a.join(" "):"none";return{WebkitTransform:r,msTransform:r,transform:r}}var pt=t.navigator&&/(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(t.navigator.userAgent);function wt(t,i){var e=document.createElement("img");if(t.naturalWidth&&!pt)return i(t.naturalWidth,t.naturalHeight),e;var n=document.body||document.documentElement;return e.onload=function(){i(e.width,e.height),pt||n.removeChild(e)},e.src=t.src,pt||(e.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",n.appendChild(e)),e}function bt(t){switch(t){case 2:return s;case 3:return e;case 4:return i;default:return""}}function yt(t,i){var e=t.pageX,n=t.pageY,s={endX:e,endY:n};return i?s:Q({startX:e,startY:n},s)}var xt={render:function(){this.initContainer(),this.initViewer(),this.initList(),this.renderViewer()},initContainer:function(){this.containerData={width:window.innerWidth,height:window.innerHeight}},initViewer:function(){var t=this.options,i=this.parent,e=void 0;t.inline&&(e={width:Math.max(i.offsetWidth,t.minWidth),height:Math.max(i.offsetHeight,t.minHeight)},this.parentData=e),!this.fulled&&e||(e=this.containerData),this.viewerData=Q({},e)},renderViewer:function(){this.options.inline&&!this.fulled&&J(this.viewer,this.viewerData)},initList:function(){var a=this,t=this.element,r=this.options,i=this.list,h=[];_(this.images,function(t,i){var e,n=t.src,s=t.alt||(j(e=n)?e.replace(/^.*\//,"").replace(/[?&#].*$/,""):""),o=r.url;j(o)?o=t.getAttribute(o):$(o)&&(o=o.call(a,t)),(n||o)&&h.push('<li><img src="'+(n||o)+'" role="button" data-action="view" data-index="'+i+'" data-original-url="'+(o||n)+'" alt="'+s+'"></li>')}),i.innerHTML=h.join(""),this.items=i.getElementsByTagName("li"),_(this.items,function(i){var t=i.firstElementChild;rt(t,"filled",!0),r.loading&&it(i,v),mt(t,M,function(t){r.loading&&et(i,v),a.loadImage(t)},{once:!0})}),r.transition&&mt(t,I,function(){it(i,D)},{once:!0})},renderList:function(t){var i=t||this.index,e=this.items[i].offsetWidth||30,n=e+1;J(this.list,Q({width:n*this.length},gt({translateX:(this.viewerData.width-e)/2-n*i})))},resetList:function(){var t=this.list;t.innerHTML="",et(t,D),J(t,gt({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=wt(t,function(t,i){var e=t/i,n=d,s=c;h.imageInitializing=!1,d<c*e?s=d/e:n=c*e;var o={naturalWidth:t,naturalHeight:i,aspectRatio:e,ratio:(n=Math.min(.9*n,t))/t,width:n,height:s=Math.min(.9*s,i),left:(d-n)/2,top:(c-s)/2},a=Q({},o);l.rotatable&&(o.rotate=u.rotate||0,a.rotate=0),l.scalable&&(o.scaleX=u.scaleX||1,o.scaleY=u.scaleY||1,a.scaleX=1,a.scaleY=1),h.imageData=o,h.initialImageData=a,r&&r()})},renderImage:function(t){var i=this,e=this.image,n=this.imageData;if(J(e,Q({width:n.width,height:n.height,marginLeft:n.left,marginTop:n.top},gt(n))),t)if(this.viewing&&this.options.transition){var s=function(){i.imageRendering=!1,t()};this.imageRendering={abort:function(){ft(e,R,s)}},mt(e,R,s,{once:!0})}else t()},resetImage:function(){if(this.viewing||this.viewed){var t=this.image;this.viewing&&this.viewing.abort(),t.parentNode.removeChild(t),this.image=null}}},Dt={bind:function(){var t=this.element,i=this.viewer;mt(i,T,this.onClick=this.click.bind(this)),mt(i,O,this.onWheel=this.wheel.bind(this)),mt(i,L,this.onDragStart=this.dragstart.bind(this)),mt(this.canvas,N,this.onPointerDown=this.pointerdown.bind(this)),mt(t.ownerDocument,q,this.onPointerMove=this.pointermove.bind(this)),mt(t.ownerDocument,Y,this.onPointerUp=this.pointerup.bind(this)),mt(t.ownerDocument,C,this.onKeyDown=this.keydown.bind(this)),mt(window,X,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,i=this.viewer;ft(i,T,this.onClick),ft(i,O,this.onWheel),ft(i,L,this.onDragStart),ft(this.canvas,N,this.onPointerDown),ft(t.ownerDocument,q,this.onPointerMove),ft(t.ownerDocument,Y,this.onPointerUp),ft(t.ownerDocument,C,this.onKeyDown),ft(window,X,this.onResize)}},zt={click:function(t){var i=t.target,e=this.options,n=this.imageData;switch(at(i,"action")){case"mix":this.played?this.stop():e.inline?this.fulled?this.exit():this.full():this.hide();break;case"hide":this.hide();break;case"view":this.view(at(i,"index"));break;case"zoom-in":this.zoom(.1,!0);break;case"zoom-out":this.zoom(-.1,!0);break;case"one-to-one":this.toggle();break;case"reset":this.reset();break;case"prev":this.prev(e.loop);break;case"play":this.play(e.fullscreen);break;case"next":this.next(e.loop);break;case"rotate-left":this.rotate(-90);break;case"rotate-right":this.rotate(90);break;case"flip-horizontal":this.scaleX(-n.scaleX||-1);break;case"flip-vertical":this.scaleY(-n.scaleY||-1);break;default:this.played&&this.stop()}},load:function(){var t=this;this.timeout&&(clearTimeout(this.timeout),this.timeout=!1);var i=this.element,e=this.options,n=this.image,s=this.index,o=this.viewerData;et(n,x),e.loading&&et(this.canvas,v),n.style.cssText="height:0;margin-left:"+o.width/2+"px;margin-top:"+o.height/2+"px;max-width:none!important;position:absolute;width:0;",this.initImage(function(){nt(n,"viewer-move",e.movable),nt(n,D,e.transition),t.renderImage(function(){t.viewed=!0,t.viewing=!1,$(e.viewed)&&mt(i,I,e.viewed,{once:!0}),vt(i,I,{originalImage:t.images[s],index:s,image:n})})})},loadImage:function(t){var o=t.target,i=o.parentNode,a=i.offsetWidth||30,r=i.offsetHeight||50,h=!!at(o,"filled");wt(o,function(t,i){var e=t/i,n=a,s=r;a<r*e?h?n=r*e:s=a/e:h?s=a/e:n=r*e,J(o,Q({width:n,height:s},gt({translateX:(a-n)/2,translateY:(r-s)/2})))})},keydown:function(t){var i=this.options;if(this.fulled&&i.keyboard)switch(t.keyCode||t.which||t.charCode){case 27:this.played?this.stop():i.inline?this.fulled&&this.exit():this.hide();break;case 32:this.played&&this.stop();break;case 37:this.prev(i.loop);break;case 38:t.preventDefault(),this.zoom(i.zoomRatio,!0);break;case 39:this.next(i.loop);break;case 40:t.preventDefault(),this.zoom(-i.zoomRatio,!0);break;case 48:case 49:t.ctrlKey&&(t.preventDefault(),this.toggle())}},dragstart:function(t){"img"===t.target.tagName.toLowerCase()&&t.preventDefault()},pointerdown:function(t){var i=this.options,e=this.pointers;if(this.viewed&&!this.showing&&!this.viewing&&!this.hiding){t.changedTouches?_(t.changedTouches,function(t){e[t.identifier]=yt(t)}):e[t.pointerId||0]=yt(t);var n=!!i.movable&&l;1<Object.keys(e).length?n=u:"touch"!==t.pointerType&&"touchstart"!==t.type||!this.isSwitchable()||(n=c),this.action=n}},pointermove:function(t){var i=this.options,e=this.pointers,n=this.action,s=this.image;this.viewed&&n&&(t.preventDefault(),t.changedTouches?_(t.changedTouches,function(t){Q(e[t.identifier],yt(t,!0))}):Q(e[t.pointerId||0],yt(t,!0)),n===l&&i.transition&&tt(s,D)&&et(s,D),this.change(t))},pointerup:function(t){var i=this.action,e=this.pointers;t.changedTouches?_(t.changedTouches,function(t){delete e[t.identifier]}):delete e[t.pointerId||0],i&&(i===l&&this.options.transition&&it(this.image,D),this.action=!1)},resize:function(){var i=this;if(this.isShown&&!this.hiding&&(this.initContainer(),this.initViewer(),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){i.renderImage()}),this.played)){if(this.options.fullscreen&&this.fulled&&!document.fullscreenElement&&!document.mozFullScreenElement&&!document.webkitFullscreenElement&&!document.msFullscreenElement)return void this.stop();_(this.player.getElementsByTagName("img"),function(t){mt(t,M,i.loadImage.bind(i),{once:!0}),vt(t,M)})}},wheel:function(t){var i=this;if(this.viewed&&(t.preventDefault(),!this.wheeling)){this.wheeling=!0,setTimeout(function(){i.wheeling=!1},50);var e=Number(this.options.zoomRatio)||.1,n=1;t.deltaY?n=0<t.deltaY?1:-1:t.wheelDelta?n=-t.wheelDelta/120:t.detail&&(n=0<t.detail?1:-1),this.zoom(-n*e,!0,t)}}},kt={show:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=this.element,e=this.options;if(e.inline||this.showing||this.isShown||this.showing)return this;if(!this.ready)return this.build(),this.ready&&this.show(t),this;if($(e.show)&&mt(i,r,e.show,{once:!0}),!1===vt(i,r)||!this.ready)return this;this.hiding&&this.transitioning.abort(),this.showing=!0,this.open();var n=this.viewer;if(et(n,y),e.transition&&!t){var s=this.shown.bind(this);this.transitioning={abort:function(){ft(n,R,s),et(n,m)}},it(n,D),n.offsetWidth,mt(n,R,s,{once:!0}),it(n,m)}else it(n,m),this.shown();return this},hide:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=this.element,e=this.options;if(e.inline||this.hiding||!this.isShown&&!this.showing)return this;if($(e.hide)&&mt(i,k,e.hide,{once:!0}),!1===vt(i,k))return this;this.showing&&this.transitioning.abort(),this.hiding=!0,this.played?this.stop():this.viewing&&this.viewing.abort();var n=this.viewer;if(e.transition&&!t){var s=this.hidden.bind(this),o=function(){mt(n,R,s,{once:!0}),et(n,m)};this.transitioning={abort:function(){this.viewed?ft(this.image,R,o):ft(n,R,s)}},this.viewed?(mt(this.image,R,o,{once:!0}),this.zoomTo(0,!1,!1,!0)):o()}else et(n,m),this.hidden();return this},view:function(){var i=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;if(t=Number(t)||0,!this.isShown)return this.index=t,this.show();if(this.hiding||this.played||t<0||t>=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=at(r,"originalUrl"),l=r.getAttribute("alt"),d=document.createElement("img");if(d.src=h,d.alt=l,$(n.view)&&mt(e,S,n.view,{once:!0}),!1===vt(e,S,{originalImage:this.images[t],index:t,image:d})||!this.isShown||this.hiding||this.played)return this;this.image=d,et(this.items[this.index],f),it(a,f),this.viewed=!1,this.index=t,this.imageData={},it(d,x),n.loading&&it(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 mt(e,I,c,{once:!0}),this.viewing={abort:function(){ft(e,I,c),d.complete?this.imageRendering?this.imageRendering.abort():this.imageInitializing&&this.imageInitializing.abort():(ft(d,M,u),this.timeout&&clearTimeout(this.timeout))}},d.complete?this.load():(mt(d,M,u=this.load.bind(this),{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){et(d,x),i.timeout=!1},1e3)),this},prev:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=this.index-1;return i<0&&(i=t?this.length-1:0),this.view(i),this},next:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=this.length-1,e=this.index+1;return i<e&&(e=t?0:i),this.view(e),this},move:function(t,i){var e=this.imageData;return this.moveTo(V(t)?t:e.left+Number(t),V(i)?i:e.top+Number(i)),this},moveTo:function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,e=this.imageData;if(t=Number(t),i=Number(i),this.viewed&&!this.played&&this.options.movable){var n=!1;B(t)&&(e.left=t,n=!0),B(i)&&(e.top=i,n=!0),n&&this.renderImage()}return this},zoom:function(t){var i=1<arguments.length&&void 0!==arguments[1]&&arguments[1],e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=this.imageData;return t=(t=Number(t))<0?1/(1-t):1+t,this.zoomTo(n.width*t/n.naturalWidth,i,e),this},zoomTo:function(t){var n,s,o,i,e,a=1<arguments.length&&void 0!==arguments[1]&&arguments[1],r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,h=3<arguments.length&&void 0!==arguments[3]&&arguments[3],l=this.options,d=this.pointers,c=this.imageData;if(B(t=Math.max(0,t))&&this.viewed&&!this.played&&(h||l.zoomable)){if(!h){var u=Math.max(.01,l.minZoomRatio),f=Math.min(100,l.maxZoomRatio);t=Math.min(Math.max(t,u),f)}r&&.95<t&&t<1.05&&(t=1);var m=c.naturalWidth*t,v=c.naturalHeight*t;if(r){var g=(i=this.viewer,{left:(e=i.getBoundingClientRect()).left+(window.pageXOffset-document.documentElement.clientLeft),top:e.top+(window.pageYOffset-document.documentElement.clientTop)}),p=d&&Object.keys(d).length?(o=s=n=0,_(d,function(t){var i=t.startX,e=t.startY;n+=i,s+=e,o+=1}),{pageX:n/=o,pageY:s/=o}):{pageX:r.pageX,pageY:r.pageY};c.left-=(m-c.width)*((p.pageX-g.left-c.left)/c.width),c.top-=(v-c.height)*((p.pageY-g.top-c.top)/c.height)}else c.left-=(m-c.width)/2,c.top-=(v-c.height)/2;c.width=m,c.height=v,c.ratio=t,this.renderImage(),a&&this.tooltip()}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t)),this},rotateTo:function(t){var i=this.imageData;return B(t=Number(t))&&this.viewed&&!this.played&&this.options.rotatable&&(i.rotate=t,this.renderImage()),this},scaleX:function(t){return this.scale(t,this.imageData.scaleY),this},scaleY:function(t){return this.scale(this.imageData.scaleX,t),this},scale:function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,e=this.imageData;if(t=Number(t),i=Number(i),this.viewed&&!this.played&&this.options.scalable){var n=!1;B(t)&&(e.scaleX=t,n=!0),B(i)&&(e.scaleY=i,n=!0),n&&this.renderImage()}return this},play:function(){var i=this,t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];if(!this.isShown||this.played)return this;var s=this.options,o=this.player,a=this.loadImage.bind(this),r=[],h=0,l=0;if(this.played=!0,this.onLoadWhenPlay=a,t&&this.requestFullscreen(),it(o,g),_(this.items,function(t,i){var e=t.querySelector("img"),n=document.createElement("img");n.src=at(e,"originalUrl"),n.alt=e.getAttribute("alt"),h+=1,it(n,w),nt(n,D,s.transition),tt(t,f)&&(it(n,m),l=i),r.push(n),mt(n,M,a,{once:!0}),o.appendChild(n)}),B(s.interval)&&0<s.interval){var e=function t(){i.playing=setTimeout(function(){et(r[l],m),it(r[l=(l+=1)<h?l:0],m),t()},s.interval)};1<h&&e()}return this},stop:function(){var i=this;if(!this.played)return this;var t=this.player;return this.played=!1,clearTimeout(this.playing),_(t.getElementsByTagName("img"),function(t){ft(t,M,i.onLoadWhenPlay)}),et(t,g),t.innerHTML="",this.exitFullscreen(),this},full:function(){var t=this,i=this.options,e=this.viewer,n=this.image,s=this.list;return!this.isShown||this.played||this.fulled||!i.inline||(this.fulled=!0,this.open(),it(this.button,o),i.transition&&(et(s,D),this.viewed&&et(n,D)),it(e,b),e.setAttribute("style",""),J(e,{zIndex:i.zIndex}),this.initContainer(),this.viewerData=Q({},this.containerData),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage(function(){i.transition&&setTimeout(function(){it(n,D),it(s,D)},0)})})),this},exit:function(){var t=this,i=this.options,e=this.viewer,n=this.image,s=this.list;return this.isShown&&!this.played&&this.fulled&&i.inline&&(this.fulled=!1,this.close(),et(this.button,o),i.transition&&(et(s,D),this.viewed&&et(n,D)),et(e,b),J(e,{zIndex:i.zIndexInline}),this.viewerData=Q({},this.parentData),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage(function(){i.transition&&setTimeout(function(){it(n,D),it(s,D)},0)})})),this},tooltip:function(){var t=this,i=this.options,e=this.tooltipBox,n=this.imageData;return this.viewed&&!this.played&&i.tooltip&&(e.textContent=Math.round(100*n.ratio)+"%",this.tooltipping?clearTimeout(this.tooltipping):i.transition?(this.fading&&vt(e,R),it(e,g),it(e,w),it(e,D),e.offsetWidth,it(e,m)):it(e,g),this.tooltipping=setTimeout(function(){i.transition?(mt(e,R,function(){et(e,g),et(e,w),et(e,D),t.fading=!1},{once:!0}),et(e,m),t.fading=!0):et(e,g),t.tooltipping=!1},1e3)),this},toggle:function(){return 1===this.imageData.ratio?this.zoomTo(this.initialImageData.ratio,!0):this.zoomTo(1,!0),this},reset:function(){return this.viewed&&!this.played&&(this.imageData=Q({},this.initialImageData),this.renderImage()),this},update:function(){var t=this.element,i=this.options,e=this.isImg,s=[];if(e&&!t.parentNode)return this.destroy();var o=[];if(_(e?[t]:t.querySelectorAll("img"),function(t){i.filter?i.filter(t)&&o.push(t):o.push(t)}),this.images=o,this.length=o.length,this.ready&&(_(this.items,function(t,i){var e=t.querySelector("img"),n=o[i];n?n.src!==e.src&&s.push(i):s.push(i)}),J(this.list,{width:"auto"}),this.initList(),this.isShown))if(this.length){if(this.viewed){var n=s.indexOf(this.index);0<=n?(this.viewed=!1,this.view(Math.max(this.index-(n+1),0))):it(this.items[this.index],f)}}else this.image=null,this.viewed=!1,this.index=0,this.imageData=null,this.canvas.innerHTML="",this.title.innerHTML="";return this},destroy:function(){var t=this.element,i=this.options;return at(t,p)&&(this.destroyed=!0,this.ready?(this.played&&this.stop(),i.inline?(this.fulled&&this.exit(),this.unbind()):this.isShown?(this.viewing&&(this.imageRendering?this.imageRendering.abort():this.imageInitializing&&this.imageInitializing.abort()),this.hiding&&this.transitioning.abort(),this.hidden()):this.showing&&(this.transitioning.abort(),this.hidden()),this.ready=!1,this.viewer.parentNode.removeChild(this.viewer)):i.inline&&(this.delaying?this.delaying.abort():this.initializing&&this.initializing.abort()),i.inline||ft(t,T,this.onStart),function(i,e){if(K(i[e]))try{delete i[e]}catch(t){i[e]=void 0}else if(i.dataset)try{delete i.dataset[e]}catch(t){i.dataset[e]=void 0}else i.removeAttribute("data-"+ot(e))}(t,p)),this}},Et={open:function(){var t=this.body;it(t,a),t.style.paddingRight=this.scrollbarWidth+(parseFloat(this.initialBodyPaddingRight)||0)+"px"},close:function(){var t=this.body;et(t,a),t.style.paddingRight=this.initialBodyPaddingRight},shown:function(){var t=this.element,i=this.options;this.fulled=!0,this.isShown=!0,this.render(),this.bind(),this.showing=!1,$(i.shown)&&mt(t,h,i.shown,{once:!0}),!1!==vt(t,h)&&this.ready&&this.isShown&&!this.hiding&&this.view(this.index)},hidden:function(){var t=this.element,i=this.options;this.fulled=!1,this.viewed=!1,this.isShown=!1,this.close(),this.unbind(),it(this.viewer,y),this.resetList(),this.resetImage(),this.hiding=!1,this.destroyed||($(i.hidden)&&mt(t,E,i.hidden,{once:!0}),vt(t,E))},requestFullscreen:function(){var t=this.element.ownerDocument;if(this.fulled&&!t.fullscreenElement&&!t.mozFullScreenElement&&!t.webkitFullscreenElement&&!t.msFullscreenElement){var i=t.documentElement;i.requestFullscreen?i.requestFullscreen():i.msRequestFullscreen?i.msRequestFullscreen():i.mozRequestFullScreen?i.mozRequestFullScreen():i.webkitRequestFullscreen&&i.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}},exitFullscreen:function(){if(this.fulled){var t=this.element.ownerDocument;t.exitFullscreen?t.exitFullscreen():t.msExitFullscreen?t.msExitFullscreen():t.mozCancelFullScreen?t.mozCancelFullScreen():t.webkitExitFullscreen&&t.webkitExitFullscreen()}},change:function(t){var i,e,h,n=this.options,s=this.pointers,o=s[Object.keys(s)[0]],a=o.endX-o.startX,r=o.endY-o.startY;switch(this.action){case l:this.move(a,r);break;case u:this.zoom((e=Q({},i=s),h=[],_(i,function(r,t){delete e[t],_(e,function(t){var i=Math.abs(r.startX-t.startX),e=Math.abs(r.startY-t.startY),n=Math.abs(r.endX-t.endX),s=Math.abs(r.endY-t.endY),o=Math.sqrt(i*i+e*e),a=(Math.sqrt(n*n+s*s)-o)/o;h.push(a)})}),h.sort(function(t,i){return Math.abs(t)<Math.abs(i)}),h[0]),!1,t);break;case c:this.action="switched",Math.abs(a)>Math.abs(r)&&(1<a?this.prev(n.loop):a<-1&&this.next(n.loop))}_(s,function(t){t.startX=t.endX,t.startY=t.endY})},isSwitchable:function(){var t=this.imageData,i=this.viewerData;return 1<this.length&&0<=t.left&&0<=t.top&&t.width<=i.width&&t.height<=i.height}},St=t.Viewer,It=function(){function e(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(P(this,e),!t||1!==t.nodeType)throw new Error("The first argument is required and must be an element.");this.element=t,this.options=Q({},n,Z(i)&&i),this.action=!1,this.fading=!1,this.fulled=!1,this.hiding=!1,this.index=0,this.isImg=!1,this.length=0,this.played=!1,this.playing=!1,this.pointers={},this.ready=!1,this.showing=!1,this.timeout=!1,this.tooltipping=!1,this.viewed=!1,this.viewing=!1,this.isShown=!1,this.wheeling=!1,this.init()}return A(e,[{key:"init",value:function(){var e=this,t=this.element,i=this.options;if(!at(t,p)){rt(t,p,this);var n="img"===t.tagName.toLowerCase(),s=[];if(_(n?[t]:t.querySelectorAll("img"),function(t){$(i.filter)?i.filter.call(e,t)&&s.push(t):s.push(t)}),s.length){this.isImg=n,this.length=s.length,this.images=s;var o=t.ownerDocument,a=o.body||o.documentElement;if(this.body=a,this.scrollbarWidth=window.innerWidth-o.documentElement.clientWidth,this.initialBodyPaddingRight=window.getComputedStyle(a).paddingRight,V(document.createElement(p).style.transition)&&(i.transition=!1),i.inline){var r=0,h=function(){if((r+=1)===e.length){var t=void 0;e.initializing=!1,e.delaying={abort:function(){clearTimeout(t)}},t=setTimeout(function(){e.delaying=!1,e.build()},0)}};this.initializing={abort:function(){_(s,function(t){t.complete||ft(t,M,h)})}},_(s,function(t){t.complete?h():mt(t,M,h,{once:!0})})}else mt(t,T,this.onStart=function(t){var i=t.target;"img"===i.tagName.toLowerCase()&&e.view(e.images.indexOf(i))})}}}},{key:"build",value:function(){if(!this.ready){var t=this.element,h=this.options,i=t.parentNode,e=document.createElement("div");e.innerHTML='<div class="viewer-container" touch-action="none"><div class="viewer-canvas"></div><div class="viewer-footer"><div class="viewer-title"></div><div class="viewer-toolbar"></div><div class="viewer-navbar"><ul class="viewer-list"></ul></div></div><div class="viewer-tooltip"></div><div role="button" class="viewer-button" data-action="mix"></div><div class="viewer-player"></div></div>';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"),it(s,h.title?bt(h.title):y),it(a,h.navbar?bt(h.navbar):y),nt(r,y,!h.button),h.backdrop&&(it(n,p+"-backdrop"),h.inline||!0!==h.backdrop||rt(l,"action","hide")),h.toolbar){var d=document.createElement("ul"),c=Z(h.toolbar),u=F.slice(0,3),f=F.slice(7,9),m=F.slice(9);c||it(o,bt(h.toolbar)),_(c?h.toolbar:F,function(t,i){var e=c&&Z(t),n=c?ot(i):t,s=e&&!V(t.show)?t.show:t;if(s&&(h.zoomable||-1===u.indexOf(n))&&(h.rotatable||-1===f.indexOf(n))&&(h.scalable||-1===m.indexOf(n))){var o=e&&!V(t.size)?t.size:t,a=e&&!V(t.click)?t.click:t,r=document.createElement("li");r.setAttribute("role","button"),it(r,p+"-"+n),$(a)||rt(r,"action",n),B(s)&&it(r,bt(s)),-1!==["small","large"].indexOf(o)?it(r,p+"-"+o):"play"===n&&it(r,p+"-large"),$(a)&&mt(r,T,a),d.appendChild(r)}}),o.appendChild(d)}else it(o,y);if(!h.rotatable){var v=o.querySelectorAll('li[class*="rotate"]');it(v,x),_(v,function(t){o.appendChild(t)})}if(h.inline)it(r,"viewer-fullscreen"),J(n,{zIndex:h.zIndexInline}),"static"===window.getComputedStyle(i).position&&J(i,{position:"relative"}),i.insertBefore(n,t.nextSibling);else{it(r,"viewer-close"),it(n,b),it(n,w),it(n,y),J(n,{zIndex:h.zIndex});var g=h.container;j(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,$(h.ready)&&mt(t,z,h.ready,{once:!0}),!1!==vt(t,z)?this.ready&&h.inline&&this.view():this.ready=!1}}}],[{key:"noConflict",value:function(){return window.Viewer=St,e}},{key:"setDefaults",value:function(t){Q(n,Z(t)&&t)}}]),e}();if(Q(It.prototype,xt,Dt,zt,kt,Et),d.fn){var Tt=d.fn.viewer,Lt="viewer";d.fn.viewer=function(r){for(var t=arguments.length,h=Array(1<t?t-1:0),i=1;i<t;i++)h[i-1]=arguments[i];var l=void 0;return this.each(function(t,i){var e=d(i),n="destroy"===r,s=e.data(Lt);if(!s){if(n)return;var o=d.extend({},e.data(),d.isPlainObject(r)&&r);s=new It(i,o),e.data(Lt,s)}if("string"==typeof r){var a=s[r];d.isFunction(a)&&((l=a.apply(s,h))===s&&(l=void 0),n&&e.removeData(Lt))}}),void 0===l?this:l},d.fn.viewer.Constructor=It,d.fn.viewer.setDefaults=It.setDefaults,d.fn.viewer.noConflict=function(){return d.fn.viewer=Tt,this}}}); | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?i(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],i):i(t.jQuery)}(this,function(d){"use strict";d=d&&d.hasOwnProperty("default")?d.default:d;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},t="undefined"!=typeof window?window:{},p="viewer",l="move",c="switch",u="zoom",f=p+"-active",w=p+"-fade",b=p+"-fixed",o=p+"-fullscreen-exit",y=p+"-hide",i=p+"-hide-md-down",e=p+"-hide-sm-down",s=p+"-hide-xs-down",m=p+"-in",x=p+"-invisible",v=p+"-loading",a=p+"-open",g=p+"-show",D=p+"-transition",z="ready",r="show",h="shown",k="hide",E="hidden",S="view",I="viewed",T="click",L="dragstart",C="keydown",M="load",N=t.PointerEvent?"pointerdown":"touchstart mousedown",q=t.PointerEvent?"pointermove":"touchmove mousemove",Y=t.PointerEvent?"pointerup pointercancel":"touchend touchcancel mouseup",X="resize",R="transitionend",O="wheel mousewheel DOMMouseScroll",F=["zoom-in","zoom-out","one-to-one","reset","prev","play","next","rotate-left","rotate-right","flip-horizontal","flip-vertical"],W="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},P=function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")},A=function(){function n(t,i){for(var e=0;e<i.length;e++){var n=i[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(t,i,e){return i&&n(t.prototype,i),e&&n(t,e),t}}();function j(t){return"string"==typeof t}var H=Number.isNaN||t.isNaN;function B(t){return"number"==typeof t&&!H(t)}function V(t){return void 0===t}function K(t){return"object"===(void 0===t?"undefined":W(t))&&null!==t}var U=Object.prototype.hasOwnProperty;function Z(t){if(!K(t))return!1;try{var i=t.constructor,e=i.prototype;return i&&e&&U.call(e,"isPrototypeOf")}catch(t){return!1}}function $(t){return"function"==typeof t}function _(i,e){if(i&&$(e))if(Array.isArray(i)||B(i.length)){var t=i.length,n=void 0;for(n=0;n<t&&!1!==e.call(i,i[n],n,i);n+=1);}else K(i)&&Object.keys(i).forEach(function(t){e.call(i,i[t],t,i)});return i}var Q=Object.assign||function(e){for(var t=arguments.length,i=Array(1<t?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return K(e)&&0<i.length&&i.forEach(function(i){K(i)&&Object.keys(i).forEach(function(t){e[t]=i[t]})}),e},G=/^(?:width|height|left|top|marginLeft|marginTop)$/;function J(t,i){var e=t.style;_(i,function(t,i){G.test(i)&&B(t)&&(t+="px"),e[i]=t})}function tt(t,i){return t.classList?t.classList.contains(i):-1<t.className.indexOf(i)}function it(t,i){if(i)if(B(t.length))_(t,function(t){it(t,i)});else if(t.classList)t.classList.add(i);else{var e=t.className.trim();e?e.indexOf(i)<0&&(t.className=e+" "+i):t.className=i}}function et(t,i){i&&(B(t.length)?_(t,function(t){et(t,i)}):t.classList?t.classList.remove(i):0<=t.className.indexOf(i)&&(t.className=t.className.replace(i,"")))}function nt(t,i,e){i&&(B(t.length)?_(t,function(t){nt(t,i,e)}):e?it(t,i):et(t,i))}var st=/([a-z\d])([A-Z])/g;function ot(t){return t.replace(st,"$1-$2").toLowerCase()}function at(t,i){return K(t[i])?t[i]:t.dataset?t.dataset[i]:t.getAttribute("data-"+ot(i))}function rt(t,i,e){K(e)?t[i]=e:t.dataset?t.dataset[i]=e:t.setAttribute("data-"+ot(i),e)}var ht,lt,dt,ct,ut=/\s\s*/,ft=(lt=ht=!1,dt=function(){},ct=Object.defineProperty({},"once",{get:function(){return ht=!0,lt},set:function(t){lt=t}}),t.addEventListener("test",dt,ct),t.removeEventListener("test",dt,ct),ht);function mt(e,t,n){var s=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},o=n;t.trim().split(ut).forEach(function(t){if(!ft){var i=e.listeners;i&&i[t]&&i[t][n]&&(o=i[t][n],delete i[t][n],0===Object.keys(i[t]).length&&delete i[t],0===Object.keys(i).length&&delete e.listeners)}e.removeEventListener(t,o,s)})}function vt(o,t,a){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{},h=a;t.trim().split(ut).forEach(function(n){if(r.once&&!ft){var t=o.listeners,s=void 0===t?{}:t;h=function(){for(var t=arguments.length,i=Array(t),e=0;e<t;e++)i[e]=arguments[e];delete s[n][a],o.removeEventListener(n,h,r),a.apply(o,i)},s[n]||(s[n]={}),s[n][a]&&o.removeEventListener(n,s[n][a],r),s[n][a]=h,o.listeners=s}o.addEventListener(n,h,r)})}function gt(t,i,e){var n=void 0;return $(Event)&&$(CustomEvent)?n=new CustomEvent(i,{detail:e,bubbles:!0,cancelable:!0}):(n=document.createEvent("CustomEvent")).initCustomEvent(i,!0,!0,e),t.dispatchEvent(n)}function pt(t){var i=t.rotate,e=t.scaleX,n=t.scaleY,s=t.translateX,o=t.translateY,a=[];B(s)&&0!==s&&a.push("translateX("+s+"px)"),B(o)&&0!==o&&a.push("translateY("+o+"px)"),B(i)&&0!==i&&a.push("rotate("+i+"deg)"),B(e)&&1!==e&&a.push("scaleX("+e+")"),B(n)&&1!==n&&a.push("scaleY("+n+")");var r=a.length?a.join(" "):"none";return{WebkitTransform:r,msTransform:r,transform:r}}var wt=t.navigator&&/(Macintosh|iPhone|iPod|iPad).*AppleWebKit/i.test(t.navigator.userAgent);function bt(t,i){var e=document.createElement("img");if(t.naturalWidth&&!wt)return i(t.naturalWidth,t.naturalHeight),e;var n=document.body||document.documentElement;return e.onload=function(){i(e.width,e.height),wt||n.removeChild(e)},e.src=t.src,wt||(e.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",n.appendChild(e)),e}function yt(t){switch(t){case 2:return s;case 3:return e;case 4:return i;default:return""}}function xt(t,i){var e=t.pageX,n=t.pageY,s={endX:e,endY:n};return i?s:Q({startX:e,startY:n},s)}var Dt={render:function(){this.initContainer(),this.initViewer(),this.initList(),this.renderViewer()},initContainer:function(){this.containerData={width:window.innerWidth,height:window.innerHeight}},initViewer:function(){var t=this.options,i=this.parent,e=void 0;t.inline&&(e={width:Math.max(i.offsetWidth,t.minWidth),height:Math.max(i.offsetHeight,t.minHeight)},this.parentData=e),!this.fulled&&e||(e=this.containerData),this.viewerData=Q({},e)},renderViewer:function(){this.options.inline&&!this.fulled&&J(this.viewer,this.viewerData)},initList:function(){var a=this,t=this.element,r=this.options,i=this.list,h=[];_(this.images,function(t,i){var e,n=t.src,s=t.alt||(j(e=n)?e.replace(/^.*\//,"").replace(/[?&#].*$/,""):""),o=r.url;j(o)?o=t.getAttribute(o):$(o)&&(o=o.call(a,t)),(n||o)&&h.push('<li><img src="'+(n||o)+'" role="button" data-action="view" data-index="'+i+'" data-original-url="'+(o||n)+'" alt="'+s+'"></li>')}),i.innerHTML=h.join(""),this.items=i.getElementsByTagName("li"),_(this.items,function(i){var t=i.firstElementChild;rt(t,"filled",!0),r.loading&&it(i,v),vt(t,M,function(t){r.loading&&et(i,v),a.loadImage(t)},{once:!0})}),r.transition&&vt(t,I,function(){it(i,D)},{once:!0})},renderList:function(t){var i=t||this.index,e=this.items[i].offsetWidth||30,n=e+1;J(this.list,Q({width:n*this.length},pt({translateX:(this.viewerData.width-e)/2-n*i})))},resetList:function(){var t=this.list;t.innerHTML="",et(t,D),J(t,pt({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=bt(t,function(t,i){var e=t/i,n=d,s=c;h.imageInitializing=!1,d<c*e?s=d/e:n=c*e;var o={naturalWidth:t,naturalHeight:i,aspectRatio:e,ratio:(n=Math.min(.9*n,t))/t,width:n,height:s=Math.min(.9*s,i),left:(d-n)/2,top:(c-s)/2},a=Q({},o);l.rotatable&&(o.rotate=u.rotate||0,a.rotate=0),l.scalable&&(o.scaleX=u.scaleX||1,o.scaleY=u.scaleY||1,a.scaleX=1,a.scaleY=1),h.imageData=o,h.initialImageData=a,r&&r()})},renderImage:function(t){var i=this,e=this.image,n=this.imageData;if(J(e,Q({width:n.width,height:n.height,marginLeft:n.left,marginTop:n.top},pt(n))),t)if(this.viewing&&this.options.transition){var s=function(){i.imageRendering=!1,t()};this.imageRendering={abort:function(){mt(e,R,s)}},vt(e,R,s,{once:!0})}else t()},resetImage:function(){if(this.viewing||this.viewed){var t=this.image;this.viewing&&this.viewing.abort(),t.parentNode.removeChild(t),this.image=null}}},zt={bind:function(){var t=this.element,i=this.viewer;vt(i,T,this.onClick=this.click.bind(this)),vt(i,O,this.onWheel=this.wheel.bind(this)),vt(i,L,this.onDragStart=this.dragstart.bind(this)),vt(this.canvas,N,this.onPointerDown=this.pointerdown.bind(this)),vt(t.ownerDocument,q,this.onPointerMove=this.pointermove.bind(this)),vt(t.ownerDocument,Y,this.onPointerUp=this.pointerup.bind(this)),vt(t.ownerDocument,C,this.onKeyDown=this.keydown.bind(this)),vt(window,X,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,i=this.viewer;mt(i,T,this.onClick),mt(i,O,this.onWheel),mt(i,L,this.onDragStart),mt(this.canvas,N,this.onPointerDown),mt(t.ownerDocument,q,this.onPointerMove),mt(t.ownerDocument,Y,this.onPointerUp),mt(t.ownerDocument,C,this.onKeyDown),mt(window,X,this.onResize)}},kt={click:function(t){var i=t.target,e=this.options,n=this.imageData;switch(at(i,"action")){case"mix":this.played?this.stop():e.inline?this.fulled?this.exit():this.full():this.hide();break;case"hide":this.hide();break;case"view":this.view(at(i,"index"));break;case"zoom-in":this.zoom(.1,!0);break;case"zoom-out":this.zoom(-.1,!0);break;case"one-to-one":this.toggle();break;case"reset":this.reset();break;case"prev":this.prev(e.loop);break;case"play":this.play(e.fullscreen);break;case"next":this.next(e.loop);break;case"rotate-left":this.rotate(-90);break;case"rotate-right":this.rotate(90);break;case"flip-horizontal":this.scaleX(-n.scaleX||-1);break;case"flip-vertical":this.scaleY(-n.scaleY||-1);break;default:this.played&&this.stop()}},load:function(){var t=this;this.timeout&&(clearTimeout(this.timeout),this.timeout=!1);var i=this.element,e=this.options,n=this.image,s=this.index,o=this.viewerData;et(n,x),e.loading&&et(this.canvas,v),n.style.cssText="height:0;margin-left:"+o.width/2+"px;margin-top:"+o.height/2+"px;max-width:none!important;position:absolute;width:0;",this.initImage(function(){nt(n,"viewer-move",e.movable),nt(n,D,e.transition),t.renderImage(function(){t.viewed=!0,t.viewing=!1,$(e.viewed)&&vt(i,I,e.viewed,{once:!0}),gt(i,I,{originalImage:t.images[s],index:s,image:n})})})},loadImage:function(t){var o=t.target,i=o.parentNode,a=i.offsetWidth||30,r=i.offsetHeight||50,h=!!at(o,"filled");bt(o,function(t,i){var e=t/i,n=a,s=r;a<r*e?h?n=r*e:s=a/e:h?s=a/e:n=r*e,J(o,Q({width:n,height:s},pt({translateX:(a-n)/2,translateY:(r-s)/2})))})},keydown:function(t){var i=this.options;if(this.fulled&&i.keyboard)switch(t.keyCode||t.which||t.charCode){case 27:this.played?this.stop():i.inline?this.fulled&&this.exit():this.hide();break;case 32:this.played&&this.stop();break;case 37:this.prev(i.loop);break;case 38:t.preventDefault(),this.zoom(i.zoomRatio,!0);break;case 39:this.next(i.loop);break;case 40:t.preventDefault(),this.zoom(-i.zoomRatio,!0);break;case 48:case 49:t.ctrlKey&&(t.preventDefault(),this.toggle())}},dragstart:function(t){"img"===t.target.tagName.toLowerCase()&&t.preventDefault()},pointerdown:function(t){var i=this.options,e=this.pointers;if(this.viewed&&!this.showing&&!this.viewing&&!this.hiding){t.changedTouches?_(t.changedTouches,function(t){e[t.identifier]=xt(t)}):e[t.pointerId||0]=xt(t);var n=!!i.movable&&l;1<Object.keys(e).length?n=u:"touch"!==t.pointerType&&"touchstart"!==t.type||!this.isSwitchable()||(n=c),this.action=n}},pointermove:function(t){var i=this.options,e=this.pointers,n=this.action,s=this.image;this.viewed&&n&&(t.preventDefault(),t.changedTouches?_(t.changedTouches,function(t){Q(e[t.identifier],xt(t,!0))}):Q(e[t.pointerId||0],xt(t,!0)),n===l&&i.transition&&tt(s,D)&&et(s,D),this.change(t))},pointerup:function(t){var i=this.action,e=this.pointers;t.changedTouches?_(t.changedTouches,function(t){delete e[t.identifier]}):delete e[t.pointerId||0],i&&(i===l&&this.options.transition&&it(this.image,D),this.action=!1)},resize:function(){var i=this;if(this.isShown&&!this.hiding&&(this.initContainer(),this.initViewer(),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){i.renderImage()}),this.played)){if(this.options.fullscreen&&this.fulled&&!document.fullscreenElement&&!document.mozFullScreenElement&&!document.webkitFullscreenElement&&!document.msFullscreenElement)return void this.stop();_(this.player.getElementsByTagName("img"),function(t){vt(t,M,i.loadImage.bind(i),{once:!0}),gt(t,M)})}},wheel:function(t){var i=this;if(this.viewed&&(t.preventDefault(),!this.wheeling)){this.wheeling=!0,setTimeout(function(){i.wheeling=!1},50);var e=Number(this.options.zoomRatio)||.1,n=1;t.deltaY?n=0<t.deltaY?1:-1:t.wheelDelta?n=-t.wheelDelta/120:t.detail&&(n=0<t.detail?1:-1),this.zoom(-n*e,!0,t)}}},Et={show:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=this.element,e=this.options;if(e.inline||this.showing||this.isShown||this.showing)return this;if(!this.ready)return this.build(),this.ready&&this.show(t),this;if($(e.show)&&vt(i,r,e.show,{once:!0}),!1===gt(i,r)||!this.ready)return this;this.hiding&&this.transitioning.abort(),this.showing=!0,this.open();var n=this.viewer;if(et(n,y),e.transition&&!t){var s=this.shown.bind(this);this.transitioning={abort:function(){mt(n,R,s),et(n,m)}},it(n,D),n.offsetWidth,vt(n,R,s,{once:!0}),it(n,m)}else it(n,m),this.shown();return this},hide:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=this.element,e=this.options;if(e.inline||this.hiding||!this.isShown&&!this.showing)return this;if($(e.hide)&&vt(i,k,e.hide,{once:!0}),!1===gt(i,k))return this;this.showing&&this.transitioning.abort(),this.hiding=!0,this.played?this.stop():this.viewing&&this.viewing.abort();var n=this.viewer;if(e.transition&&!t){var s=this.hidden.bind(this),o=function(){vt(n,R,s,{once:!0}),et(n,m)};this.transitioning={abort:function(){this.viewed?mt(this.image,R,o):mt(n,R,s)}},this.viewed?(vt(this.image,R,o,{once:!0}),this.zoomTo(0,!1,!1,!0)):o()}else et(n,m),this.hidden();return this},view:function(){var i=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;if(t=Number(t)||0,!this.isShown)return this.index=t,this.show();if(this.hiding||this.played||t<0||t>=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=at(r,"originalUrl"),l=r.getAttribute("alt"),d=document.createElement("img");if(d.src=h,d.alt=l,$(n.view)&&vt(e,S,n.view,{once:!0}),!1===gt(e,S,{originalImage:this.images[t],index:t,image:d})||!this.isShown||this.hiding||this.played)return this;this.image=d,et(this.items[this.index],f),it(a,f),this.viewed=!1,this.index=t,this.imageData={},it(d,x),n.loading&&it(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 vt(e,I,c,{once:!0}),this.viewing={abort:function(){mt(e,I,c),d.complete?this.imageRendering?this.imageRendering.abort():this.imageInitializing&&this.imageInitializing.abort():(mt(d,M,u),this.timeout&&clearTimeout(this.timeout))}},d.complete?this.load():(vt(d,M,u=this.load.bind(this),{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){et(d,x),i.timeout=!1},1e3)),this},prev:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=this.index-1;return i<0&&(i=t?this.length-1:0),this.view(i),this},next:function(){var t=0<arguments.length&&void 0!==arguments[0]&&arguments[0],i=this.length-1,e=this.index+1;return i<e&&(e=t?0:i),this.view(e),this},move:function(t,i){var e=this.imageData;return this.moveTo(V(t)?t:e.left+Number(t),V(i)?i:e.top+Number(i)),this},moveTo:function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,e=this.imageData;if(t=Number(t),i=Number(i),this.viewed&&!this.played&&this.options.movable){var n=!1;B(t)&&(e.left=t,n=!0),B(i)&&(e.top=i,n=!0),n&&this.renderImage()}return this},zoom:function(t){var i=1<arguments.length&&void 0!==arguments[1]&&arguments[1],e=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,n=this.imageData;return t=(t=Number(t))<0?1/(1-t):1+t,this.zoomTo(n.width*t/n.naturalWidth,i,e),this},zoomTo:function(t){var n,s,o,i,e,a=1<arguments.length&&void 0!==arguments[1]&&arguments[1],r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,h=3<arguments.length&&void 0!==arguments[3]&&arguments[3],l=this.options,d=this.pointers,c=this.imageData;if(B(t=Math.max(0,t))&&this.viewed&&!this.played&&(h||l.zoomable)){if(!h){var u=Math.max(.01,l.minZoomRatio),f=Math.min(100,l.maxZoomRatio);t=Math.min(Math.max(t,u),f)}r&&.95<t&&t<1.05&&(t=1);var m=c.naturalWidth*t,v=c.naturalHeight*t;if(r){var g=(i=this.viewer,{left:(e=i.getBoundingClientRect()).left+(window.pageXOffset-document.documentElement.clientLeft),top:e.top+(window.pageYOffset-document.documentElement.clientTop)}),p=d&&Object.keys(d).length?(o=s=n=0,_(d,function(t){var i=t.startX,e=t.startY;n+=i,s+=e,o+=1}),{pageX:n/=o,pageY:s/=o}):{pageX:r.pageX,pageY:r.pageY};c.left-=(m-c.width)*((p.pageX-g.left-c.left)/c.width),c.top-=(v-c.height)*((p.pageY-g.top-c.top)/c.height)}else c.left-=(m-c.width)/2,c.top-=(v-c.height)/2;c.width=m,c.height=v,c.ratio=t,this.renderImage(),a&&this.tooltip()}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t)),this},rotateTo:function(t){var i=this.imageData;return B(t=Number(t))&&this.viewed&&!this.played&&this.options.rotatable&&(i.rotate=t,this.renderImage()),this},scaleX:function(t){return this.scale(t,this.imageData.scaleY),this},scaleY:function(t){return this.scale(this.imageData.scaleX,t),this},scale:function(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:t,e=this.imageData;if(t=Number(t),i=Number(i),this.viewed&&!this.played&&this.options.scalable){var n=!1;B(t)&&(e.scaleX=t,n=!0),B(i)&&(e.scaleY=i,n=!0),n&&this.renderImage()}return this},play:function(){var i=this,t=0<arguments.length&&void 0!==arguments[0]&&arguments[0];if(!this.isShown||this.played)return this;var s=this.options,o=this.player,a=this.loadImage.bind(this),r=[],h=0,l=0;if(this.played=!0,this.onLoadWhenPlay=a,t&&this.requestFullscreen(),it(o,g),_(this.items,function(t,i){var e=t.querySelector("img"),n=document.createElement("img");n.src=at(e,"originalUrl"),n.alt=e.getAttribute("alt"),h+=1,it(n,w),nt(n,D,s.transition),tt(t,f)&&(it(n,m),l=i),r.push(n),vt(n,M,a,{once:!0}),o.appendChild(n)}),B(s.interval)&&0<s.interval){var e=function t(){i.playing=setTimeout(function(){et(r[l],m),it(r[l=(l+=1)<h?l:0],m),t()},s.interval)};1<h&&e()}return this},stop:function(){var i=this;if(!this.played)return this;var t=this.player;return this.played=!1,clearTimeout(this.playing),_(t.getElementsByTagName("img"),function(t){mt(t,M,i.onLoadWhenPlay)}),et(t,g),t.innerHTML="",this.exitFullscreen(),this},full:function(){var t=this,i=this.options,e=this.viewer,n=this.image,s=this.list;return!this.isShown||this.played||this.fulled||!i.inline||(this.fulled=!0,this.open(),it(this.button,o),i.transition&&(et(s,D),this.viewed&&et(n,D)),it(e,b),e.setAttribute("style",""),J(e,{zIndex:i.zIndex}),this.initContainer(),this.viewerData=Q({},this.containerData),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage(function(){i.transition&&setTimeout(function(){it(n,D),it(s,D)},0)})})),this},exit:function(){var t=this,i=this.options,e=this.viewer,n=this.image,s=this.list;return this.isShown&&!this.played&&this.fulled&&i.inline&&(this.fulled=!1,this.close(),et(this.button,o),i.transition&&(et(s,D),this.viewed&&et(n,D)),et(e,b),J(e,{zIndex:i.zIndexInline}),this.viewerData=Q({},this.parentData),this.renderViewer(),this.renderList(),this.viewed&&this.initImage(function(){t.renderImage(function(){i.transition&&setTimeout(function(){it(n,D),it(s,D)},0)})})),this},tooltip:function(){var t=this,i=this.options,e=this.tooltipBox,n=this.imageData;return this.viewed&&!this.played&&i.tooltip&&(e.textContent=Math.round(100*n.ratio)+"%",this.tooltipping?clearTimeout(this.tooltipping):i.transition?(this.fading&>(e,R),it(e,g),it(e,w),it(e,D),e.offsetWidth,it(e,m)):it(e,g),this.tooltipping=setTimeout(function(){i.transition?(vt(e,R,function(){et(e,g),et(e,w),et(e,D),t.fading=!1},{once:!0}),et(e,m),t.fading=!0):et(e,g),t.tooltipping=!1},1e3)),this},toggle:function(){return 1===this.imageData.ratio?this.zoomTo(this.initialImageData.ratio,!0):this.zoomTo(1,!0),this},reset:function(){return this.viewed&&!this.played&&(this.imageData=Q({},this.initialImageData),this.renderImage()),this},update:function(){var t=this.element,i=this.options,e=this.isImg,s=[];if(e&&!t.parentNode)return this.destroy();var o=[];if(_(e?[t]:t.querySelectorAll("img"),function(t){i.filter?i.filter(t)&&o.push(t):o.push(t)}),this.images=o,this.length=o.length,this.ready&&(_(this.items,function(t,i){var e=t.querySelector("img"),n=o[i];n?n.src!==e.src&&s.push(i):s.push(i)}),J(this.list,{width:"auto"}),this.initList(),this.isShown))if(this.length){if(this.viewed){var n=s.indexOf(this.index);0<=n?(this.viewed=!1,this.view(Math.max(this.index-(n+1),0))):it(this.items[this.index],f)}}else this.image=null,this.viewed=!1,this.index=0,this.imageData=null,this.canvas.innerHTML="",this.title.innerHTML="";return this},destroy:function(){var t=this.element,i=this.options;return at(t,p)&&(this.destroyed=!0,this.ready?(this.played&&this.stop(),i.inline?(this.fulled&&this.exit(),this.unbind()):this.isShown?(this.viewing&&(this.imageRendering?this.imageRendering.abort():this.imageInitializing&&this.imageInitializing.abort()),this.hiding&&this.transitioning.abort(),this.hidden()):this.showing&&(this.transitioning.abort(),this.hidden()),this.ready=!1,this.viewer.parentNode.removeChild(this.viewer)):i.inline&&(this.delaying?this.delaying.abort():this.initializing&&this.initializing.abort()),i.inline||mt(t,T,this.onStart),function(i,e){if(K(i[e]))try{delete i[e]}catch(t){i[e]=void 0}else if(i.dataset)try{delete i.dataset[e]}catch(t){i.dataset[e]=void 0}else i.removeAttribute("data-"+ot(e))}(t,p)),this}},St={open:function(){var t=this.body;it(t,a),t.style.paddingRight=this.scrollbarWidth+(parseFloat(this.initialBodyPaddingRight)||0)+"px"},close:function(){var t=this.body;et(t,a),t.style.paddingRight=this.initialBodyPaddingRight},shown:function(){var t=this.element,i=this.options;this.fulled=!0,this.isShown=!0,this.render(),this.bind(),this.showing=!1,$(i.shown)&&vt(t,h,i.shown,{once:!0}),!1!==gt(t,h)&&this.ready&&this.isShown&&!this.hiding&&this.view(this.index)},hidden:function(){var t=this.element,i=this.options;this.fulled=!1,this.viewed=!1,this.isShown=!1,this.close(),this.unbind(),it(this.viewer,y),this.resetList(),this.resetImage(),this.hiding=!1,this.destroyed||($(i.hidden)&&vt(t,E,i.hidden,{once:!0}),gt(t,E))},requestFullscreen:function(){var t=this.element.ownerDocument;if(this.fulled&&!t.fullscreenElement&&!t.mozFullScreenElement&&!t.webkitFullscreenElement&&!t.msFullscreenElement){var i=t.documentElement;i.requestFullscreen?i.requestFullscreen():i.msRequestFullscreen?i.msRequestFullscreen():i.mozRequestFullScreen?i.mozRequestFullScreen():i.webkitRequestFullscreen&&i.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}},exitFullscreen:function(){if(this.fulled){var t=this.element.ownerDocument;t.exitFullscreen?t.exitFullscreen():t.msExitFullscreen?t.msExitFullscreen():t.mozCancelFullScreen?t.mozCancelFullScreen():t.webkitExitFullscreen&&t.webkitExitFullscreen()}},change:function(t){var i,e,h,n=this.options,s=this.pointers,o=s[Object.keys(s)[0]],a=o.endX-o.startX,r=o.endY-o.startY;switch(this.action){case l:this.move(a,r);break;case u:this.zoom((e=Q({},i=s),h=[],_(i,function(r,t){delete e[t],_(e,function(t){var i=Math.abs(r.startX-t.startX),e=Math.abs(r.startY-t.startY),n=Math.abs(r.endX-t.endX),s=Math.abs(r.endY-t.endY),o=Math.sqrt(i*i+e*e),a=(Math.sqrt(n*n+s*s)-o)/o;h.push(a)})}),h.sort(function(t,i){return Math.abs(t)<Math.abs(i)}),h[0]),!1,t);break;case c:this.action="switched",this.pointers={},Math.abs(a)>Math.abs(r)&&(1<a?this.prev(n.loop):a<-1&&this.next(n.loop))}_(s,function(t){t.startX=t.endX,t.startY=t.endY})},isSwitchable:function(){var t=this.imageData,i=this.viewerData;return 1<this.length&&0<=t.left&&0<=t.top&&t.width<=i.width&&t.height<=i.height}},It=t.Viewer,Tt=function(){function e(t){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(P(this,e),!t||1!==t.nodeType)throw new Error("The first argument is required and must be an element.");this.element=t,this.options=Q({},n,Z(i)&&i),this.action=!1,this.fading=!1,this.fulled=!1,this.hiding=!1,this.index=0,this.isImg=!1,this.length=0,this.played=!1,this.playing=!1,this.pointers={},this.ready=!1,this.showing=!1,this.timeout=!1,this.tooltipping=!1,this.viewed=!1,this.viewing=!1,this.isShown=!1,this.wheeling=!1,this.init()}return A(e,[{key:"init",value:function(){var e=this,t=this.element,i=this.options;if(!at(t,p)){rt(t,p,this);var n="img"===t.tagName.toLowerCase(),s=[];if(_(n?[t]:t.querySelectorAll("img"),function(t){$(i.filter)?i.filter.call(e,t)&&s.push(t):s.push(t)}),s.length){this.isImg=n,this.length=s.length,this.images=s;var o=t.ownerDocument,a=o.body||o.documentElement;if(this.body=a,this.scrollbarWidth=window.innerWidth-o.documentElement.clientWidth,this.initialBodyPaddingRight=window.getComputedStyle(a).paddingRight,V(document.createElement(p).style.transition)&&(i.transition=!1),i.inline){var r=0,h=function(){if((r+=1)===e.length){var t=void 0;e.initializing=!1,e.delaying={abort:function(){clearTimeout(t)}},t=setTimeout(function(){e.delaying=!1,e.build()},0)}};this.initializing={abort:function(){_(s,function(t){t.complete||mt(t,M,h)})}},_(s,function(t){t.complete?h():vt(t,M,h,{once:!0})})}else vt(t,T,this.onStart=function(t){var i=t.target;"img"===i.tagName.toLowerCase()&&e.view(e.images.indexOf(i))})}}}},{key:"build",value:function(){if(!this.ready){var t=this.element,h=this.options,i=t.parentNode,e=document.createElement("div");e.innerHTML='<div class="viewer-container" touch-action="none"><div class="viewer-canvas"></div><div class="viewer-footer"><div class="viewer-title"></div><div class="viewer-toolbar"></div><div class="viewer-navbar"><ul class="viewer-list"></ul></div></div><div class="viewer-tooltip"></div><div role="button" class="viewer-button" data-action="mix"></div><div class="viewer-player"></div></div>';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"),it(s,h.title?yt(h.title):y),it(a,h.navbar?yt(h.navbar):y),nt(r,y,!h.button),h.backdrop&&(it(n,p+"-backdrop"),h.inline||!0!==h.backdrop||rt(l,"action","hide")),h.toolbar){var d=document.createElement("ul"),c=Z(h.toolbar),u=F.slice(0,3),f=F.slice(7,9),m=F.slice(9);c||it(o,yt(h.toolbar)),_(c?h.toolbar:F,function(t,i){var e=c&&Z(t),n=c?ot(i):t,s=e&&!V(t.show)?t.show:t;if(s&&(h.zoomable||-1===u.indexOf(n))&&(h.rotatable||-1===f.indexOf(n))&&(h.scalable||-1===m.indexOf(n))){var o=e&&!V(t.size)?t.size:t,a=e&&!V(t.click)?t.click:t,r=document.createElement("li");r.setAttribute("role","button"),it(r,p+"-"+n),$(a)||rt(r,"action",n),B(s)&&it(r,yt(s)),-1!==["small","large"].indexOf(o)?it(r,p+"-"+o):"play"===n&&it(r,p+"-large"),$(a)&&vt(r,T,a),d.appendChild(r)}}),o.appendChild(d)}else it(o,y);if(!h.rotatable){var v=o.querySelectorAll('li[class*="rotate"]');it(v,x),_(v,function(t){o.appendChild(t)})}if(h.inline)it(r,"viewer-fullscreen"),J(n,{zIndex:h.zIndexInline}),"static"===window.getComputedStyle(i).position&&J(i,{position:"relative"}),i.insertBefore(n,t.nextSibling);else{it(r,"viewer-close"),it(n,b),it(n,w),it(n,y),J(n,{zIndex:h.zIndex});var g=h.container;j(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,$(h.ready)&&vt(t,z,h.ready,{once:!0}),!1!==gt(t,z)?this.ready&&h.inline&&this.view():this.ready=!1}}}],[{key:"noConflict",value:function(){return window.Viewer=It,e}},{key:"setDefaults",value:function(t){Q(n,Z(t)&&t)}}]),e}();if(Q(Tt.prototype,Dt,zt,kt,Et,St),d.fn){var Lt=d.fn.viewer,Ct="viewer";d.fn.viewer=function(r){for(var t=arguments.length,h=Array(1<t?t-1:0),i=1;i<t;i++)h[i-1]=arguments[i];var l=void 0;return this.each(function(t,i){var e=d(i),n="destroy"===r,s=e.data(Ct);if(!s){if(n)return;var o=d.extend({},e.data(),d.isPlainObject(r)&&r);s=new Tt(i,o),e.data(Ct,s)}if("string"==typeof r){var a=s[r];d.isFunction(a)&&((l=a.apply(s,h))===s&&(l=void 0),n&&e.removeData(Ct))}}),void 0!==l?l:this},d.fn.viewer.Constructor=Tt,d.fn.viewer.setDefaults=Tt.setDefaults,d.fn.viewer.noConflict=function(){return d.fn.viewer=Lt,this}}}); |
{ | ||
"name": "imageviewer", | ||
"description": "A simple jQuery image viewing plugin.", | ||
"version": "1.0.0-alpha", | ||
"version": "1.0.0-beta", | ||
"main": "dist/viewer.common.js", | ||
@@ -51,3 +51,3 @@ "module": "dist/viewer.esm.js", | ||
"dependencies": { | ||
"viewerjs": "^1.0.0-rc" | ||
"viewerjs": "^1.0.0-rc.1" | ||
}, | ||
@@ -85,7 +85,7 @@ "devDependencies": { | ||
"rollup-plugin-babel": "^3.0.3", | ||
"rollup-plugin-commonjs": "^9.0.0", | ||
"rollup-plugin-commonjs": "^9.1.0", | ||
"rollup-plugin-node-resolve": "^3.0.3", | ||
"rollup-watch": "^4.3.1", | ||
"stylefmt": "^6.0.0", | ||
"uglify-js": "^3.3.14" | ||
"uglify-js": "^3.3.15" | ||
}, | ||
@@ -92,0 +92,0 @@ "peerDependencies": { |
@@ -9,3 +9,3 @@ # Viewer | ||
- [Viewer.js](https://github.com/fengyuanchen/viewerjs) - JavaScript image viewer (**recommended**) | ||
- [viewer](https://github.com/fengyuanchen/viewer) - A jQuery plugin wrapper for Viewer.js (**recommended** for jQuery users to use this instead of Viewer) | ||
- [jquery-viewer](https://github.com/fengyuanchen/jquery-viewer) - A jQuery plugin wrapper for Viewer.js (**recommended** for jQuery users to use this instead of Viewer) | ||
@@ -29,3 +29,3 @@ ## Main | ||
```shell | ||
npm install imageviewer | ||
npm install imageviewer jquery | ||
``` | ||
@@ -32,0 +32,0 @@ |
@@ -44,3 +44,3 @@ import $ from 'jquery'; | ||
return typeof result === 'undefined' ? this : result; | ||
return result !== undefined ? result : this; | ||
}; | ||
@@ -47,0 +47,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
286333
7687
1
Updatedviewerjs@^1.0.0-rc.1