react-image-lightbox
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-modal")):"function"==typeof define&&define.amd?define(["react","react-modal"],t):"object"==typeof exports?exports.ReactImageLightbox=t(require("react"),require("react-modal")):e.ReactImageLightbox=t(e.react,e["react-modal"])}(this,function(e,t){return function(e){function t(o){if(i[o])return i[o].exports;var n=i[o]={exports:{},id:o,loaded:!1};return e[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){"use strict";e.exports=i(2)["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.MIN_ZOOM_LEVEL=0,t.MAX_ZOOM_LEVEL=300,t.ZOOM_RATIO=1.007,t.ZOOM_BUTTON_INCREMENT_SIZE=100,t.WHEEL_MOVE_X_THRESHOLD=200,t.WHEEL_MOVE_Y_THRESHOLD=1,t.KEYS={ESC:27,LEFT_ARROW:37,RIGHT_ARROW:39}},function(e,t,i){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var o=t[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,i,o){return i&&e(t.prototype,i),o&&e(t,o),t}}(),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},u=i(8),h=o(u),d=i(9),c=o(d),m=i(3),p=i(1),f=i(7),g=o(f),v=g["default"];(0,m.getIEVersion)()<10&&(v=l({},v,{toolbarSide:v.toolbarSide+" "+v.toolbarSideNoFlex,toolbarLeftSide:v.toolbarLeftSide+" "+v.toolbarLeftSideNoFlex,toolbarRightSide:v.toolbarRightSide+" "+v.toolbarRightSideNoFlex}));var b=function(e){function t(e){n(this,t);var i=a(this,Object.getPrototypeOf(t).call(this,e));return i.state={isClosing:!e.animationDisabled,shouldAnimate:!1,zoomLevel:p.MIN_ZOOM_LEVEL,offsetX:0,offsetY:0},i.closeIfClickInner=i.closeIfClickInner.bind(i),i.handleImageDoubleClick=i.handleImageDoubleClick.bind(i),i.handleImageMouseWheel=i.handleImageMouseWheel.bind(i),i.handleKeyInput=i.handleKeyInput.bind(i),i.handleMouseUp=i.handleMouseUp.bind(i),i.handleOuterMouseDown=i.handleOuterMouseDown.bind(i),i.handleOuterMouseMove=i.handleOuterMouseMove.bind(i),i.handleOuterMousewheel=i.handleOuterMousewheel.bind(i),i.handleWindowResize=i.handleWindowResize.bind(i),i.handleZoomInButtonClick=i.handleZoomInButtonClick.bind(i),i.handleZoomOutButtonClick=i.handleZoomOutButtonClick.bind(i),i.requestClose=i.requestClose.bind(i),i.requestMoveNext=i.requestMoveNext.bind(i),i.requestMovePrev=i.requestMovePrev.bind(i),i}return s(t,e),r(t,[{key:"componentWillMount",value:function(){this.listenersAttached=!1,this.keyPressed=!1,this.imageCache={},this.lastKeyDownTime=0,this.resizeTimeout=null,this.wheelActionTimeout=null,this.resetScrollTimeout=null,this.scrollX=0,this.scrollY=0,this.isDragging=!1,this.dragStartX=0,this.dragStartY=0,this.dragStartOffsetX=0,this.dragStartOffsetY=0,this.keyCounter=0,this.moveRequested=!1,this.props.animationDisabled||this.setState({isClosing:!1})}},{key:"componentDidMount",value:function(){this.attachListeners(),this.loadAllImages()}},{key:"componentWillReceiveProps",value:function(e){var t=this,i=this.getSrcTypes().some(function(i){return t.props[i.name]!==e[i.name]});(i||this.moveRequested)&&(this.moveRequested=!1,this.loadAllImages(e))}},{key:"componentWillUnmount",value:function(){this.detachListeners()}},{key:"attachListeners",value:function(){this.listenersAttached||(document.addEventListener("keydown",this.handleKeyInput),document.addEventListener("keyup",this.handleKeyInput),window.addEventListener("resize",this.handleWindowResize),window.addEventListener("mouseup",this.handleMouseUp),(0,m.isInIframe)()&&window.top.addEventListener("mouseup",this.handleMouseUp),this.listenersAttached=!0)}},{key:"changeZoom",value:function(e,t,i){var o=(0,m.getWindowWidth)(),n=(0,m.getWindowHeight)(),a=Math.max(p.MIN_ZOOM_LEVEL,Math.min(p.MAX_ZOOM_LEVEL,e));if(a!==this.state.zoomLevel){if(a===p.MIN_ZOOM_LEVEL)return this.setState({zoomLevel:a,offsetX:0,offsetY:0});var s=this.getZoomMultiplier(),r=this.getZoomMultiplier(a),l=("undefined"!=typeof t?t:o/2)/o,u=("undefined"!=typeof i?i:n/2)/n,h=o/s,d=n/s,c=o/r,f=n/r,g=(c-h)*(l-.5),v=(f-d)*(u-.5),b=this.state.offsetX-g,_=this.state.offsetY-v,y=this.getMaxOffsets();this.state.zoomLevel>a&&(b=Math.max(y.minX,Math.min(y.maxX,b)),_=Math.max(y.minY,Math.min(y.maxY,_))),this.setState({zoomLevel:a,offsetX:b,offsetY:_})}}},{key:"closeIfClickInner",value:function(e){e.target.className.search(/\binner\b/)>-1&&this.requestClose(e)}},{key:"detachListeners",value:function(){this.listenersAttached&&(document.removeEventListener("keydown",this.handleKeyInput),document.removeEventListener("keyup",this.handleKeyInput),window.removeEventListener("resize",this.handleWindowResize),window.removeEventListener("mouseup",this.handleMouseUp),(0,m.isInIframe)()&&window.top.removeEventListener("mouseup",this.handleMouseUp),this.listenersAttached=!1)}},{key:"getBestImageForType",value:function(e){var t=this.props[e],i={};if(this.isImageLoaded(t))i=this.getFitSizes(this.imageCache[t].width,this.imageCache[t].height);else{if(!this.isImageLoaded(this.props[e+"Thumbnail"]))return null;t=this.props[e+"Thumbnail"],i=this.getFitSizes(this.imageCache[t].width,this.imageCache[t].height,!0)}return{src:t,height:i.height,width:i.width}}},{key:"getFitSizes",value:function(e,t,i){var o=(0,m.getWindowHeight)(),n=(0,m.getWindowWidth)(),a=o-2*this.props.imagePadding,s=n-2*this.props.imagePadding;i||(a=Math.min(a,t),s=Math.min(s,e));var r=s/a,l=e/t,u={};return r>l?(u.width=e*a/t,u.height=a):(u.width=s,u.height=t*s/e),u}},{key:"getMaxOffsets",value:function(){var e=arguments.length<=0||void 0===arguments[0]?this.state.zoomLevel:arguments[0],t=this.getBestImageForType("mainSrc");if(null===t)return{maxX:0,minX:0,maxY:0,minY:0};var i=(0,m.getWindowWidth)(),o=(0,m.getWindowHeight)(),n=this.getZoomMultiplier(e),a=0;a=t.width-i/n<0?(i/n-t.width)/2:(t.width-i/n)/2;var s=0;return s=t.height-o/n<0?(o/n-t.height)/2:(t.height-o/n)/2,{maxX:a,maxY:s,minX:-1*a,minY:-1*s}}},{key:"getOffsetXFromWindowCenter",value:function(e){var t=(0,m.getWindowWidth)();return t/2-e}},{key:"getOffsetYFromWindowCenter",value:function(e){var t=(0,m.getWindowHeight)();return t/2-e}},{key:"getSrcTypes",value:function(){return[{name:"mainSrc",keyEnding:"i"+this.keyCounter},{name:"mainSrcThumbnail",keyEnding:"t"+this.keyCounter},{name:"nextSrc",keyEnding:"i"+(this.keyCounter+1)},{name:"nextSrcThumbnail",keyEnding:"t"+(this.keyCounter+1)},{name:"prevSrc",keyEnding:"i"+(this.keyCounter-1)},{name:"prevSrcThumbnail",keyEnding:"t"+(this.keyCounter-1)}]}},{key:"getZoomMultiplier",value:function(){var e=arguments.length<=0||void 0===arguments[0]?this.state.zoomLevel:arguments[0];return Math.pow(p.ZOOM_RATIO,e)}},{key:"handleKeyInput",value:function(e){if(e.stopPropagation(),!this.isAnimating()){if("keyup"===e.type)return void(this.lastKeyDownTime-=this.props.keyRepeatKeyupBonus);var t=e.which||e.keyCode,i=new Date;if(!(i.getTime()-this.lastKeyDownTime<this.props.keyRepeatLimit&&t!==p.KEYS.ESC))switch(this.lastKeyDownTime=i.getTime(),t){case p.KEYS.ESC:e.preventDefault(),this.requestClose(e);break;case p.KEYS.LEFT_ARROW:if(!this.props.prevSrc)return;e.preventDefault(),this.keyPressed=!0,this.requestMovePrev(e);break;case p.KEYS.RIGHT_ARROW:if(!this.props.nextSrc)return;e.preventDefault(),this.keyPressed=!0,this.requestMoveNext(e)}}}},{key:"handleOuterMousewheel",value:function(e){var t=this;e.preventDefault(),e.stopPropagation();var i=p.WHEEL_MOVE_X_THRESHOLD,o=0,n=500;if(clearTimeout(this.resetScrollTimeout),this.resetScrollTimeout=setTimeout(function(){t.scrollX=0,t.scrollY=0},300),null===this.wheelActionTimeout&&!this.isAnimating()){if(Math.abs(e.deltaY)<Math.abs(e.deltaX)){this.scrollY=0,this.scrollX+=e.deltaX;var a=i/2;this.scrollX>=i||e.deltaX>=a?(this.requestMoveNext(e),o=n,this.scrollX=0):(this.scrollX<=-1*i||e.deltaX<=-1*a)&&(this.requestMovePrev(e),o=n,this.scrollX=0)}0!==o&&(this.wheelActionTimeout=setTimeout(function(){t.wheelActionTimeout=null},o))}}},{key:"handleImageMouseWheel",value:function(e){e.preventDefault();var t=p.WHEEL_MOVE_Y_THRESHOLD;if(Math.abs(e.deltaY)>=Math.abs(e.deltaX)){if(e.stopPropagation(),Math.abs(e.deltaY)<t)return;this.scrollX=0,this.scrollY+=e.deltaY,this.changeZoom(this.state.zoomLevel-e.deltaY,e.clientX,e.clientY)}}},{key:"handleImageDoubleClick",value:function(e){this.state.zoomLevel>p.MIN_ZOOM_LEVEL?this.changeZoom(p.MIN_ZOOM_LEVEL,e.clientX,e.clientY):this.changeZoom(this.state.zoomLevel+p.ZOOM_BUTTON_INCREMENT_SIZE,e.clientX,e.clientY)}},{key:"handleMouseUp",value:function(){var e=this;if(this.isDragging){this.isDragging=!1;var t=this.getMaxOffsets(),i=Math.max(t.minX,Math.min(t.maxX,this.state.offsetX)),o=Math.max(t.minY,Math.min(t.maxY,this.state.offsetY));i===this.state.offsetX&&o===this.state.offsetY||(this.setState({offsetX:i,offsetY:o,shouldAnimate:!0}),setTimeout(function(){e.setState({shouldAnimate:!1})},this.props.animationDuration))}}},{key:"handleOuterMouseDown",value:function(e){e.preventDefault(),this.state.zoomLevel>p.MIN_ZOOM_LEVEL&&(this.isDragging=!0,this.dragStartX=e.clientX,this.dragStartY=e.clientY,this.dragStartOffsetX=this.state.offsetX,this.dragStartOffsetY=this.state.offsetY)}},{key:"handleOuterMouseMove",value:function(e){if(this.isDragging){var t=this.getZoomMultiplier(),i=(this.dragStartX-e.clientX)/t+this.dragStartOffsetX,o=(this.dragStartY-e.clientY)/t+this.dragStartOffsetY;this.state.offsetX===i&&this.state.offsetY===o||this.setState({offsetX:i,offsetY:o})}}},{key:"handleWindowResize",value:function(){clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(this.forceUpdate.bind(this),100)}},{key:"handleZoomInButtonClick",value:function(){this.changeZoom(this.state.zoomLevel+p.ZOOM_BUTTON_INCREMENT_SIZE)}},{key:"handleZoomOutButtonClick",value:function(){this.changeZoom(this.state.zoomLevel-p.ZOOM_BUTTON_INCREMENT_SIZE)}},{key:"isAnimating",value:function(){return this.state.shouldAnimate||this.state.isClosing}},{key:"isImageLoaded",value:function(e){return e&&e in this.imageCache&&this.imageCache[e].loaded}},{key:"loadImage",value:function(e,t){var i=this;if(this.isImageLoaded(e))return void setTimeout(function(){t(null,i.imageCache[e].width,i.imageCache[e].height)},1);var o=this,n=new Image;n.onerror=function(){t("image load error")},n.onload=function(){o.imageCache[e]={loaded:!0,width:this.width,height:this.height},t(null,this.width,this.height)},n.src=e}},{key:"loadAllImages",value:function(){var e=this,t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],i=function(t,i){return function(o){return o?void(window.console&&window.console.warn(o)):void(e.props[t]===i&&e.forceUpdate())}};this.getSrcTypes().forEach(function(o){var n=o.name;t[n]&&!e.isImageLoaded(t[n])&&e.loadImage(t[n],i(n,t[n]))})}},{key:"requestClose",value:function(e){var t=this,i=function(){return t.props.onCloseRequest(e)};return this.props.animationDisabled||"keydown"===e.type&&!this.props.animationOnKeyInput?i():(this.setState({isClosing:!0}),void setTimeout(i,this.props.animationDuration))}},{key:"requestMove",value:function(e,t){var i=this,o={zoomLevel:p.MIN_ZOOM_LEVEL,offsetX:0,offsetY:0};this.props.animationDisabled||this.keyPressed&&!this.props.animationOnKeyInput||(o.shouldAnimate=!0,setTimeout(function(){return i.setState({shouldAnimate:!1})},this.props.animationDuration)),this.keyPressed=!1,this.moveRequested=!0,"prev"===e?(this.keyCounter--,this.setState(o),this.props.onMovePrevRequest(t)):(this.keyCounter++,this.setState(o),this.props.onMoveNextRequest(t))}},{key:"requestMoveNext",value:function(e){this.requestMove("next",e)}},{key:"requestMovePrev",value:function(e){this.requestMove("prev",e)}},{key:"render",value:function(){var e=this,t={};!this.props.animationDisabled&&this.isAnimating()&&(t=l({},t,{transition:["transform","left","top","right","bottom"].map(function(t){return t+" "+e.props.animationDuration+"ms"}).join(", ")}));var i={};this.getSrcTypes().forEach(function(e){var t=e.name,o=e.keyEnding;i[t]=o});var o=[],n=function(n,a){var s=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(e.props[n]){var r=l({},s,t);e.state.zoomLevel>p.MIN_ZOOM_LEVEL&&(r.cursor="move");var u=e.getBestImageForType(n);if(null===u)return void o.push(h["default"].createElement("div",{className:a+" "+v.image+" not-loaded",style:r,key:e.props[n]+i[n]}));r.width=u.width,r.height=u.height;var d=u.src;e.props.discourageDownloads?(r.backgroundImage="url('"+d+"')",o.push(h["default"].createElement("div",{className:a+" "+v.image+" "+v.imageDiscourager,onDoubleClick:e.handleImageDoubleClick,onWheel:e.handleImageMouseWheel,style:r,key:d+i[n]},h["default"].createElement("div",{className:"download-blocker ${styles.downloadBlocker}"})))):o.push(h["default"].createElement("img",{className:a+" "+v.image,onDoubleClick:e.handleImageDoubleClick,onWheel:e.handleImageMouseWheel,style:r,src:d,key:d+i[n],alt:e.props.imageTitle||(0,m.translate)("Image")}))}},a=this.getZoomMultiplier();n("nextSrc","image-next "+v.imageNext),n("mainSrc","image-current",{transform:"scale3d("+a+", "+a+", 1)",left:-1*a*this.state.offsetX,right:a*this.state.offsetX,top:-1*a*this.state.offsetY,bottom:a*this.state.offsetY}),n("prevSrc","image-prev "+v.imagePrev);var s=function(){},r=[v.toolbarItemChild,v.builtinButton,v.zoomInButton],u=[v.toolbarItemChild,v.builtinButton,v.zoomOutButton],d=this.handleZoomInButtonClick,f=this.handleZoomOutButtonClick;this.state.zoomLevel===p.MAX_ZOOM_LEVEL&&(r.push(v.builtinButtonDisabled),d=s),this.state.zoomLevel===p.MIN_ZOOM_LEVEL&&(u.push(v.builtinButtonDisabled),f=s),this.isAnimating()&&(d=s,f=s);var g={overlay:{zIndex:1e3,backgroundColor:"transparent"},content:{backgroundColor:"transparent",border:"none",borderRadius:0}};return h["default"].createElement(c["default"],{isOpen:!0,onRequestClose:s,style:g},h["default"].createElement("div",{onWheel:this.handleOuterMousewheel,onMouseMove:this.handleOuterMouseMove,onMouseDown:this.handleOuterMouseDown,className:"outer "+v.outer+" "+v.outerAnimating+(this.state.isClosing?" closing "+v.outerClosing:""),style:{transition:"opacity "+this.props.animationDuration+"ms",animationDuration:this.props.animationDuration+"ms",animationDirection:this.state.isClosing?"normal":"reverse"}},h["default"].createElement("div",{className:"inner "+v.inner,onClick:this.props.clickOutsideToClose?this.closeIfClickInner:s},o),this.props.prevSrc?h["default"].createElement("button",{type:"button",className:"prev-button "+v.navButtons+" "+v.navButtonPrev,key:"prev",onClick:this.isAnimating()?s:this.requestMovePrev}):"",this.props.nextSrc?h["default"].createElement("button",{type:"button",className:"next-button "+v.navButtons+" "+v.navButtonNext,key:"next",onClick:this.isAnimating()?s:this.requestMoveNext}):"",h["default"].createElement("div",{className:"toolbar "+v.toolbar},h["default"].createElement("ul",{className:"toolbar-left "+v.toolbarSide+" "+v.toolbarLeftSide},h["default"].createElement("li",{className:v.toolbarItem},h["default"].createElement("span",{className:v.toolbarItemChild},this.props.imageTitle))),h["default"].createElement("ul",{className:"toolbar-right "+v.toolbarSide+" "+v.toolbarRightSide},this.props.toolbarButtons?this.props.toolbarButtons.map(function(e,t){return h["default"].createElement("li",{key:t,className:v.toolbarItem},e)}):"",h["default"].createElement("li",{className:v.toolbarItem},h["default"].createElement("button",{type:"button",key:"zoom-in",className:"zoom-in "+r.join(" "),onClick:d})),h["default"].createElement("li",{className:v.toolbarItem},h["default"].createElement("button",{type:"button",key:"zoom-out",className:"zoom-out "+u.join(" "),onClick:f})),h["default"].createElement("li",{className:v.toolbarItem},h["default"].createElement("button",{type:"button",key:"close",className:"close "+v.toolbarItemChild+(" "+v.builtinButton+" "+v.closeButton),onClick:this.isAnimating()?s:this.requestClose}))))))}}]),t}(u.Component);b.propTypes={mainSrc:u.PropTypes.string.isRequired,prevSrc:u.PropTypes.string,nextSrc:u.PropTypes.string,mainSrcThumbnail:u.PropTypes.string,prevSrcThumbnail:u.PropTypes.string,nextSrcThumbnail:u.PropTypes.string,onCloseRequest:u.PropTypes.func.isRequired,onMovePrevRequest:u.PropTypes.func,onMoveNextRequest:u.PropTypes.func,discourageDownloads:u.PropTypes.bool,animationDisabled:u.PropTypes.bool,animationOnKeyInput:u.PropTypes.bool,animationDuration:u.PropTypes.number,keyRepeatLimit:u.PropTypes.number,keyRepeatKeyupBonus:u.PropTypes.number,imageTitle:u.PropTypes.node,toolbarButtons:u.PropTypes.arrayOf(u.PropTypes.node),imagePadding:u.PropTypes.number,clickOutsideToClose:u.PropTypes.bool},b.defaultProps={onMovePrevRequest:function(){},onMoveNextRequest:function(){},discourageDownloads:!1,animationDisabled:!1,animationOnKeyInput:!1,animationDuration:300,keyRepeatLimit:180,keyRepeatKeyupBonus:40,imagePadding:10,clickOutsideToClose:!0},t["default"]=b},function(e,t){"use strict";function i(){var e=navigator.userAgent.match(/(?:MSIE |Trident\/.*; rv:)(\d+)/);return e?parseInt(e[1],10):void 0}function o(e){var t=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if(!e)return"";var i=e;return t&&Object.keys(t).forEach(function(e){i=i.replace(e,t[e])}),i}function n(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth}function a(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}function s(){try{return window.self!==window.top}catch(e){return!0}}Object.defineProperty(t,"__esModule",{value:!0}),t.getIEVersion=i,t.translate=o,t.getWindowWidth=n,t.getWindowHeight=a,t.isInIframe=s},function(e,t,i){t=e.exports=i(5)(),t.push([e.id,'@-webkit-keyframes closeWindow___2Hlon{0%{opacity:1}to{opacity:0}}@keyframes closeWindow___2Hlon{0%{opacity:1}to{opacity:0}}.outer___2lDXy{background-color:rgba(0,0,0,.85);position:fixed;top:0;left:0;right:0;bottom:0;z-index:1000;width:100%;height:100%}.outerClosing___1EQGK{opacity:0}.inner___1rfRQ{left:0;right:0}.image___2FLq2,.inner___1rfRQ{position:absolute;top:0;bottom:0}.image___2FLq2{margin:auto;max-width:100%;max-height:100%}.imagePrev___F6xVQ{left:-100%;right:100%}.imageNext___1uRqJ{left:100%;right:-100%}.imageDiscourager___3-CUB{background-repeat:no-repeat;background-position:50%;background-size:contain}.navButtons___3kNVF{border:none;position:absolute;top:0;bottom:0;width:20px;height:34px;padding:40px 30px;margin:auto;cursor:pointer;opacity:.7}.navButtons___3kNVF:hover{opacity:1}.navButtons___3kNVF:active{opacity:.7}.navButtonPrev___2vBS8{left:0;background:rgba(0,0,0,.2) url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwIiBoZWlnaHQ9IjM0Ij48cGF0aCBkPSJtIDE5LDMgLTIsLTIgLTE2LDE2IDE2LDE2IDEsLTEgLTE1LC0xNSAxNSwtMTUgeiIgZmlsbD0iI0ZGRiIvPjwvc3ZnPg==") no-repeat 50%}.navButtonNext___30R2i{right:0;background:rgba(0,0,0,.2) url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwIiBoZWlnaHQ9IjM0Ij48cGF0aCBkPSJtIDEsMyAyLC0yIDE2LDE2IC0xNiwxNiAtMSwtMSAxNSwtMTUgLTE1LC0xNSB6IiBmaWxsPSIjRkZGIi8+PC9zdmc+") no-repeat 50%}.downloadBlocker___3rU9-{position:absolute;top:0;left:0;right:0;bottom:0;background-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7");background-size:cover}.toolbar___1xYly{background-color:rgba(0,0,0,.5);position:absolute;left:0;top:0;right:0;height:50px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.toolbarSide___3FYWk{height:50px;margin:0}.toolbarSideNoFlex___KxqgW{height:auto;line-height:50px;max-width:48%;position:absolute;top:0;bottom:0}.toolbarLeftSide___8beAg{padding-left:20px;padding-right:0;-webkit-box-flex:0;-ms-flex:0 1 auto;flex:0 1 auto;overflow:hidden;text-overflow:ellipsis}.toolbarLeftSideNoFlex___3O3cZ{left:0;overflow:visible}.toolbarRightSide___1Sdfc{padding-left:0;padding-right:20px;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto}.toolbarRightSideNoFlex___oa0FT{right:0}.toolbarItem___3WbMb{display:inline-block;line-height:50px;padding:0;color:#fff;font-size:120%;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.toolbarItemChild___2U_MP{vertical-align:middle}.builtinButton___1zqo6{width:40px;height:35px;cursor:pointer;border:none;opacity:.7}.builtinButton___1zqo6:hover{opacity:1}.builtinButton___1zqo6:active{outline:none}.builtinButtonDisabled___3uvqe{cursor:default;opacity:.5}.builtinButtonDisabled___3uvqe:hover{opacity:.5}.closeButton___3BdAF{background:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwIiBoZWlnaHQ9IjIwIj48cGF0aCBkPSJtIDEsMyAxLjI1LC0xLjI1IDcuNSw3LjUgNy41LC03LjUgMS4yNSwxLjI1IC03LjUsNy41IDcuNSw3LjUgLTEuMjUsMS4yNSAtNy41LC03LjUgLTcuNSw3LjUgLTEuMjUsLTEuMjUgNy41LC03LjUgLTcuNSwtNy41IHoiIGZpbGw9IiNGRkYiLz48L3N2Zz4=") no-repeat 50%}.zoomInButton___3xtuX{background:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCI+PGcgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+PHBhdGggZD0iTTEgMTlsNi02Ii8+PHBhdGggZD0iTTkgOGg2Ii8+PHBhdGggZD0iTTEyIDV2NiIvPjwvZz48Y2lyY2xlIGN4PSIxMiIgY3k9IjgiIHI9IjciIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSIyIi8+PC9zdmc+") no-repeat 50%}.zoomOutButton___38PZx{background:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCI+PGcgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+PHBhdGggZD0iTTEgMTlsNi02Ii8+PHBhdGggZD0iTTkgOGg2Ii8+PC9nPjxjaXJjbGUgY3g9IjEyIiBjeT0iOCIgcj0iNyIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjIiLz48L3N2Zz4=") no-repeat 50%}.outerAnimating___2-fZi{-webkit-animation-name:closeWindow___2Hlon;animation-name:closeWindow___2Hlon}',""]),t.locals={outer:"outer___2lDXy",outerClosing:"outerClosing___1EQGK",inner:"inner___1rfRQ",image:"image___2FLq2",imagePrev:"imagePrev___F6xVQ",imageNext:"imageNext___1uRqJ",imageDiscourager:"imageDiscourager___3-CUB",navButtons:"navButtons___3kNVF",navButtonPrev:"navButtonPrev___2vBS8",navButtonNext:"navButtonNext___30R2i",downloadBlocker:"downloadBlocker___3rU9-",toolbar:"toolbar___1xYly",toolbarSide:"toolbarSide___3FYWk",toolbarSideNoFlex:"toolbarSideNoFlex___KxqgW",toolbarLeftSide:"toolbarLeftSide___8beAg",toolbarLeftSideNoFlex:"toolbarLeftSideNoFlex___3O3cZ",toolbarRightSide:"toolbarRightSide___1Sdfc",toolbarRightSideNoFlex:"toolbarRightSideNoFlex___oa0FT",toolbarItem:"toolbarItem___3WbMb",toolbarItemChild:"toolbarItemChild___2U_MP",builtinButton:"builtinButton___1zqo6",builtinButtonDisabled:"builtinButtonDisabled___3uvqe",closeButton:"closeButton___3BdAF",zoomInButton:"zoomInButton___3xtuX",zoomOutButton:"zoomOutButton___38PZx",outerAnimating:"outerAnimating___2-fZi",closeWindow:"closeWindow___2Hlon"}},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var i=this[t];i[2]?e.push("@media "+i[2]+"{"+i[1]+"}"):e.push(i[1])}return e.join("")},e.i=function(t,i){"string"==typeof t&&(t=[[null,t,""]]);for(var o={},n=0;n<this.length;n++){var a=this[n][0];"number"==typeof a&&(o[a]=!0)}for(n=0;n<t.length;n++){var s=t[n];"number"==typeof s[0]&&o[s[0]]||(i&&!s[2]?s[2]=i:i&&(s[2]="("+s[2]+") and ("+i+")"),e.push(s))}},e}},function(e,t,i){function o(e,t){for(var i=0;i<e.length;i++){var o=e[i],n=m[o.id];if(n){n.refs++;for(var a=0;a<n.parts.length;a++)n.parts[a](o.parts[a]);for(;a<o.parts.length;a++)n.parts.push(u(o.parts[a],t))}else{for(var s=[],a=0;a<o.parts.length;a++)s.push(u(o.parts[a],t));m[o.id]={id:o.id,refs:1,parts:s}}}}function n(e){for(var t=[],i={},o=0;o<e.length;o++){var n=e[o],a=n[0],s=n[1],r=n[2],l=n[3],u={css:s,media:r,sourceMap:l};i[a]?i[a].parts.push(u):t.push(i[a]={id:a,parts:[u]})}return t}function a(e,t){var i=g(),o=_[_.length-1];if("top"===e.insertAt)o?o.nextSibling?i.insertBefore(t,o.nextSibling):i.appendChild(t):i.insertBefore(t,i.firstChild),_.push(t);else{if("bottom"!==e.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");i.appendChild(t)}}function s(e){e.parentNode.removeChild(e);var t=_.indexOf(e);t>=0&&_.splice(t,1)}function r(e){var t=document.createElement("style");return t.type="text/css",a(e,t),t}function l(e){var t=document.createElement("link");return t.rel="stylesheet",a(e,t),t}function u(e,t){var i,o,n;if(t.singleton){var a=b++;i=v||(v=r(t)),o=h.bind(null,i,a,!1),n=h.bind(null,i,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(i=l(t),o=c.bind(null,i),n=function(){s(i),i.href&&URL.revokeObjectURL(i.href)}):(i=r(t),o=d.bind(null,i),n=function(){s(i)});return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else n()}}function h(e,t,i,o){var n=i?"":o.css;if(e.styleSheet)e.styleSheet.cssText=y(t,n);else{var a=document.createTextNode(n),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(a,s[t]):e.appendChild(a)}}function d(e,t){var i=t.css,o=t.media;if(o&&e.setAttribute("media",o),e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}function c(e,t){var i=t.css,o=t.sourceMap;o&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var n=new Blob([i],{type:"text/css"}),a=e.href;e.href=URL.createObjectURL(n),a&&URL.revokeObjectURL(a)}var m={},p=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},f=p(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),g=p(function(){return document.head||document.getElementsByTagName("head")[0]}),v=null,b=0,_=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=f()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var i=n(e);return o(i,t),function(e){for(var a=[],s=0;s<i.length;s++){var r=i[s],l=m[r.id];l.refs--,a.push(l)}if(e){var u=n(e);o(u,t)}for(var s=0;s<a.length;s++){var l=a[s];if(0===l.refs){for(var h=0;h<l.parts.length;h++)l.parts[h]();delete m[l.id]}}}};var y=function(){var e=[];return function(t,i){return e[t]=i,e.filter(Boolean).join("\n")}}()},function(e,t,i){var o=i(4);"string"==typeof o&&(o=[[e.id,o,""]]);i(6)(o,{});o.locals&&(e.exports=o.locals)},function(t,i){t.exports=e},function(e,i){e.exports=t}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-modal")):"function"==typeof define&&define.amd?define(["react","react-modal"],t):"object"==typeof exports?exports.ReactImageLightbox=t(require("react"),require("react-modal")):e.ReactImageLightbox=t(e.react,e["react-modal"])}(this,function(e,t){return function(e){function t(o){if(i[o])return i[o].exports;var n=i[o]={exports:{},id:o,loaded:!1};return e[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){"use strict";e.exports=i(2)["default"]},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.MIN_ZOOM_LEVEL=0,t.MAX_ZOOM_LEVEL=300,t.ZOOM_RATIO=1.007,t.ZOOM_BUTTON_INCREMENT_SIZE=100,t.WHEEL_MOVE_X_THRESHOLD=200,t.WHEEL_MOVE_Y_THRESHOLD=1,t.KEYS={ESC:27,LEFT_ARROW:37,RIGHT_ARROW:39}},function(e,t,i){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var i=0;i<t.length;i++){var o=t[i];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,i,o){return i&&e(t.prototype,i),o&&e(t,o),t}}(),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])}return e},u=i(8),h=o(u),d=i(9),c=o(d),m=i(3),p=i(1),f=i(7),g=o(f),v=g["default"];(0,m.getIEVersion)()<10&&(v=l({},v,{toolbarSide:v.toolbarSide+" "+v.toolbarSideNoFlex,toolbarLeftSide:v.toolbarLeftSide+" "+v.toolbarLeftSideNoFlex,toolbarRightSide:v.toolbarRightSide+" "+v.toolbarRightSideNoFlex}));var b=function(e){function t(e){n(this,t);var i=a(this,Object.getPrototypeOf(t).call(this,e));return i.state={isClosing:!e.animationDisabled,shouldAnimate:!1,zoomLevel:p.MIN_ZOOM_LEVEL,offsetX:0,offsetY:0},i.closeIfClickInner=i.closeIfClickInner.bind(i),i.handleImageDoubleClick=i.handleImageDoubleClick.bind(i),i.handleImageMouseWheel=i.handleImageMouseWheel.bind(i),i.handleKeyInput=i.handleKeyInput.bind(i),i.handleMouseUp=i.handleMouseUp.bind(i),i.handleOuterMouseDown=i.handleOuterMouseDown.bind(i),i.handleOuterMouseMove=i.handleOuterMouseMove.bind(i),i.handleOuterMousewheel=i.handleOuterMousewheel.bind(i),i.handleWindowResize=i.handleWindowResize.bind(i),i.handleZoomInButtonClick=i.handleZoomInButtonClick.bind(i),i.handleZoomOutButtonClick=i.handleZoomOutButtonClick.bind(i),i.requestClose=i.requestClose.bind(i),i.requestMoveNext=i.requestMoveNext.bind(i),i.requestMovePrev=i.requestMovePrev.bind(i),i}return s(t,e),r(t,[{key:"componentWillMount",value:function(){this.listenersAttached=!1,this.keyPressed=!1,this.imageCache={},this.lastKeyDownTime=0,this.resizeTimeout=null,this.wheelActionTimeout=null,this.resetScrollTimeout=null,this.scrollX=0,this.scrollY=0,this.isDragging=!1,this.dragStartX=0,this.dragStartY=0,this.dragStartOffsetX=0,this.dragStartOffsetY=0,this.keyCounter=0,this.moveRequested=!1,this.props.animationDisabled||this.setState({isClosing:!1})}},{key:"componentDidMount",value:function(){this.attachListeners(),this.loadAllImages()}},{key:"componentWillReceiveProps",value:function(e){var t=this,i=this.getSrcTypes().some(function(i){return t.props[i.name]!==e[i.name]});(i||this.moveRequested)&&(this.moveRequested=!1,this.loadAllImages(e))}},{key:"componentWillUnmount",value:function(){this.detachListeners()}},{key:"attachListeners",value:function(){this.listenersAttached||(document.addEventListener("keydown",this.handleKeyInput),document.addEventListener("keyup",this.handleKeyInput),window.addEventListener("resize",this.handleWindowResize),window.addEventListener("mouseup",this.handleMouseUp),(0,m.isInIframe)()&&window.top.addEventListener("mouseup",this.handleMouseUp),this.listenersAttached=!0)}},{key:"changeZoom",value:function(e,t,i){var o=(0,m.getWindowWidth)(),n=(0,m.getWindowHeight)(),a=Math.max(p.MIN_ZOOM_LEVEL,Math.min(p.MAX_ZOOM_LEVEL,e));if(a!==this.state.zoomLevel){if(a===p.MIN_ZOOM_LEVEL)return this.setState({zoomLevel:a,offsetX:0,offsetY:0});var s=this.getZoomMultiplier(),r=this.getZoomMultiplier(a),l=("undefined"!=typeof t?t:o/2)/o,u=("undefined"!=typeof i?i:n/2)/n,h=o/s,d=n/s,c=o/r,f=n/r,g=(c-h)*(l-.5),v=(f-d)*(u-.5),b=this.state.offsetX-g,_=this.state.offsetY-v,y=this.getMaxOffsets();this.state.zoomLevel>a&&(b=Math.max(y.minX,Math.min(y.maxX,b)),_=Math.max(y.minY,Math.min(y.maxY,_))),this.setState({zoomLevel:a,offsetX:b,offsetY:_})}}},{key:"closeIfClickInner",value:function(e){e.target.className.search(/\binner\b/)>-1&&this.requestClose(e)}},{key:"detachListeners",value:function(){this.listenersAttached&&(document.removeEventListener("keydown",this.handleKeyInput),document.removeEventListener("keyup",this.handleKeyInput),window.removeEventListener("resize",this.handleWindowResize),window.removeEventListener("mouseup",this.handleMouseUp),(0,m.isInIframe)()&&window.top.removeEventListener("mouseup",this.handleMouseUp),this.listenersAttached=!1)}},{key:"getBestImageForType",value:function(e){var t=this.props[e],i={};if(this.isImageLoaded(t))i=this.getFitSizes(this.imageCache[t].width,this.imageCache[t].height);else{if(!this.isImageLoaded(this.props[e+"Thumbnail"]))return null;t=this.props[e+"Thumbnail"],i=this.getFitSizes(this.imageCache[t].width,this.imageCache[t].height,!0)}return{src:t,height:i.height,width:i.width}}},{key:"getFitSizes",value:function(e,t,i){var o=(0,m.getWindowHeight)(),n=(0,m.getWindowWidth)(),a=o-2*this.props.imagePadding,s=n-2*this.props.imagePadding;i||(a=Math.min(a,t),s=Math.min(s,e));var r=s/a,l=e/t,u={};return r>l?(u.width=e*a/t,u.height=a):(u.width=s,u.height=t*s/e),u}},{key:"getMaxOffsets",value:function(){var e=arguments.length<=0||void 0===arguments[0]?this.state.zoomLevel:arguments[0],t=this.getBestImageForType("mainSrc");if(null===t)return{maxX:0,minX:0,maxY:0,minY:0};var i=(0,m.getWindowWidth)(),o=(0,m.getWindowHeight)(),n=this.getZoomMultiplier(e),a=0;a=t.width-i/n<0?(i/n-t.width)/2:(t.width-i/n)/2;var s=0;return s=t.height-o/n<0?(o/n-t.height)/2:(t.height-o/n)/2,{maxX:a,maxY:s,minX:-1*a,minY:-1*s}}},{key:"getOffsetXFromWindowCenter",value:function(e){var t=(0,m.getWindowWidth)();return t/2-e}},{key:"getOffsetYFromWindowCenter",value:function(e){var t=(0,m.getWindowHeight)();return t/2-e}},{key:"getSrcTypes",value:function(){return[{name:"mainSrc",keyEnding:"i"+this.keyCounter},{name:"mainSrcThumbnail",keyEnding:"t"+this.keyCounter},{name:"nextSrc",keyEnding:"i"+(this.keyCounter+1)},{name:"nextSrcThumbnail",keyEnding:"t"+(this.keyCounter+1)},{name:"prevSrc",keyEnding:"i"+(this.keyCounter-1)},{name:"prevSrcThumbnail",keyEnding:"t"+(this.keyCounter-1)}]}},{key:"getZoomMultiplier",value:function(){var e=arguments.length<=0||void 0===arguments[0]?this.state.zoomLevel:arguments[0];return Math.pow(p.ZOOM_RATIO,e)}},{key:"handleKeyInput",value:function(e){if(e.stopPropagation(),!this.isAnimating()){if("keyup"===e.type)return void(this.lastKeyDownTime-=this.props.keyRepeatKeyupBonus);var t=e.which||e.keyCode,i=new Date;if(!(i.getTime()-this.lastKeyDownTime<this.props.keyRepeatLimit&&t!==p.KEYS.ESC))switch(this.lastKeyDownTime=i.getTime(),t){case p.KEYS.ESC:e.preventDefault(),this.requestClose(e);break;case p.KEYS.LEFT_ARROW:if(!this.props.prevSrc)return;e.preventDefault(),this.keyPressed=!0,this.requestMovePrev(e);break;case p.KEYS.RIGHT_ARROW:if(!this.props.nextSrc)return;e.preventDefault(),this.keyPressed=!0,this.requestMoveNext(e)}}}},{key:"handleOuterMousewheel",value:function(e){var t=this;e.preventDefault(),e.stopPropagation();var i=p.WHEEL_MOVE_X_THRESHOLD,o=0,n=500;if(clearTimeout(this.resetScrollTimeout),this.resetScrollTimeout=setTimeout(function(){t.scrollX=0,t.scrollY=0},300),null===this.wheelActionTimeout&&!this.isAnimating()){if(Math.abs(e.deltaY)<Math.abs(e.deltaX)){this.scrollY=0,this.scrollX+=e.deltaX;var a=i/2;this.scrollX>=i||e.deltaX>=a?(this.requestMoveNext(e),o=n,this.scrollX=0):(this.scrollX<=-1*i||e.deltaX<=-1*a)&&(this.requestMovePrev(e),o=n,this.scrollX=0)}0!==o&&(this.wheelActionTimeout=setTimeout(function(){t.wheelActionTimeout=null},o))}}},{key:"handleImageMouseWheel",value:function(e){e.preventDefault();var t=p.WHEEL_MOVE_Y_THRESHOLD;if(Math.abs(e.deltaY)>=Math.abs(e.deltaX)){if(e.stopPropagation(),Math.abs(e.deltaY)<t)return;this.scrollX=0,this.scrollY+=e.deltaY,this.changeZoom(this.state.zoomLevel-e.deltaY,e.clientX,e.clientY)}}},{key:"handleImageDoubleClick",value:function(e){this.state.zoomLevel>p.MIN_ZOOM_LEVEL?this.changeZoom(p.MIN_ZOOM_LEVEL,e.clientX,e.clientY):this.changeZoom(this.state.zoomLevel+p.ZOOM_BUTTON_INCREMENT_SIZE,e.clientX,e.clientY)}},{key:"handleMouseUp",value:function(){var e=this;if(this.isDragging){this.isDragging=!1;var t=this.getMaxOffsets(),i=Math.max(t.minX,Math.min(t.maxX,this.state.offsetX)),o=Math.max(t.minY,Math.min(t.maxY,this.state.offsetY));i===this.state.offsetX&&o===this.state.offsetY||(this.setState({offsetX:i,offsetY:o,shouldAnimate:!0}),setTimeout(function(){e.setState({shouldAnimate:!1})},this.props.animationDuration))}}},{key:"handleOuterMouseDown",value:function(e){e.preventDefault(),this.state.zoomLevel>p.MIN_ZOOM_LEVEL&&(this.isDragging=!0,this.dragStartX=e.clientX,this.dragStartY=e.clientY,this.dragStartOffsetX=this.state.offsetX,this.dragStartOffsetY=this.state.offsetY)}},{key:"handleOuterMouseMove",value:function(e){if(this.isDragging){var t=this.getZoomMultiplier(),i=(this.dragStartX-e.clientX)/t+this.dragStartOffsetX,o=(this.dragStartY-e.clientY)/t+this.dragStartOffsetY;this.state.offsetX===i&&this.state.offsetY===o||this.setState({offsetX:i,offsetY:o})}}},{key:"handleWindowResize",value:function(){clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(this.forceUpdate.bind(this),100)}},{key:"handleZoomInButtonClick",value:function(){this.changeZoom(this.state.zoomLevel+p.ZOOM_BUTTON_INCREMENT_SIZE)}},{key:"handleZoomOutButtonClick",value:function(){this.changeZoom(this.state.zoomLevel-p.ZOOM_BUTTON_INCREMENT_SIZE)}},{key:"isAnimating",value:function(){return this.state.shouldAnimate||this.state.isClosing}},{key:"isImageLoaded",value:function(e){return e&&e in this.imageCache&&this.imageCache[e].loaded}},{key:"loadImage",value:function(e,t){var i=this;if(this.isImageLoaded(e))return void setTimeout(function(){t(null,i.imageCache[e].width,i.imageCache[e].height)},1);var o=this,n=new Image;n.onerror=function(){t("image load error")},n.onload=function(){o.imageCache[e]={loaded:!0,width:this.width,height:this.height},t(null,this.width,this.height)},n.src=e}},{key:"loadAllImages",value:function(){var e=this,t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],i=function(t,i){return function(o){return o?void(window.console&&window.console.warn(o)):void(e.props[t]===i&&e.forceUpdate())}};this.getSrcTypes().forEach(function(o){var n=o.name;t[n]&&!e.isImageLoaded(t[n])&&e.loadImage(t[n],i(n,t[n]))})}},{key:"requestClose",value:function(e){var t=this,i=function(){return t.props.onCloseRequest(e)};return this.props.animationDisabled||"keydown"===e.type&&!this.props.animationOnKeyInput?i():(this.setState({isClosing:!0}),void setTimeout(i,this.props.animationDuration))}},{key:"requestMove",value:function(e,t){var i=this,o={zoomLevel:p.MIN_ZOOM_LEVEL,offsetX:0,offsetY:0};this.props.animationDisabled||this.keyPressed&&!this.props.animationOnKeyInput||(o.shouldAnimate=!0,setTimeout(function(){return i.setState({shouldAnimate:!1})},this.props.animationDuration)),this.keyPressed=!1,this.moveRequested=!0,"prev"===e?(this.keyCounter--,this.setState(o),this.props.onMovePrevRequest(t)):(this.keyCounter++,this.setState(o),this.props.onMoveNextRequest(t))}},{key:"requestMoveNext",value:function(e){this.requestMove("next",e)}},{key:"requestMovePrev",value:function(e){this.requestMove("prev",e)}},{key:"render",value:function(){var e=this,t={};!this.props.animationDisabled&&this.isAnimating()&&(t=l({},t,{transition:["transform","left","top","right","bottom"].map(function(t){return t+" "+e.props.animationDuration+"ms"}).join(", ")}));var i={};this.getSrcTypes().forEach(function(e){var t=e.name,o=e.keyEnding;i[t]=o});var o=[],n=function(n,a){var s=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(e.props[n]){var r=l({},s,t);e.state.zoomLevel>p.MIN_ZOOM_LEVEL&&(r.cursor="move");var u=e.getBestImageForType(n);if(null===u)return void o.push(h["default"].createElement("div",{className:a+" "+v.image+" not-loaded",style:r,key:e.props[n]+i[n]}));r.width=u.width,r.height=u.height;var d=u.src;e.props.discourageDownloads?(r.backgroundImage="url('"+d+"')",o.push(h["default"].createElement("div",{className:a+" "+v.image+" "+v.imageDiscourager,onDoubleClick:e.handleImageDoubleClick,onWheel:e.handleImageMouseWheel,style:r,key:d+i[n]},h["default"].createElement("div",{className:"download-blocker ${styles.downloadBlocker}"})))):o.push(h["default"].createElement("img",{className:a+" "+v.image,onDoubleClick:e.handleImageDoubleClick,onWheel:e.handleImageMouseWheel,style:r,src:d,key:d+i[n],alt:e.props.imageTitle||(0,m.translate)("Image")}))}},a=this.getZoomMultiplier();n("nextSrc","image-next "+v.imageNext),n("mainSrc","image-current",{transform:"scale3d("+a+", "+a+", 1)",left:-1*a*this.state.offsetX,right:a*this.state.offsetX,top:-1*a*this.state.offsetY,bottom:a*this.state.offsetY}),n("prevSrc","image-prev "+v.imagePrev);var s=function(){},r=[v.toolbarItemChild,v.builtinButton,v.zoomInButton],u=[v.toolbarItemChild,v.builtinButton,v.zoomOutButton],d=this.handleZoomInButtonClick,f=this.handleZoomOutButtonClick;this.state.zoomLevel===p.MAX_ZOOM_LEVEL&&(r.push(v.builtinButtonDisabled),d=s),this.state.zoomLevel===p.MIN_ZOOM_LEVEL&&(u.push(v.builtinButtonDisabled),f=s),this.isAnimating()&&(d=s,f=s);var g={overlay:{zIndex:1e3,backgroundColor:"transparent"},content:{backgroundColor:"transparent",border:"none",borderRadius:0,top:0,left:0,right:0,bottom:0}};return h["default"].createElement(c["default"],{isOpen:!0,onRequestClose:s,style:g},h["default"].createElement("div",{onWheel:this.handleOuterMousewheel,onMouseMove:this.handleOuterMouseMove,onMouseDown:this.handleOuterMouseDown,className:"outer "+v.outer+" "+v.outerAnimating+(this.state.isClosing?" closing "+v.outerClosing:""),style:{transition:"opacity "+this.props.animationDuration+"ms",animationDuration:this.props.animationDuration+"ms",animationDirection:this.state.isClosing?"normal":"reverse"}},h["default"].createElement("div",{className:"inner "+v.inner,onClick:this.props.clickOutsideToClose?this.closeIfClickInner:s},o),this.props.prevSrc?h["default"].createElement("button",{type:"button",className:"prev-button "+v.navButtons+" "+v.navButtonPrev,key:"prev",onClick:this.isAnimating()?s:this.requestMovePrev}):"",this.props.nextSrc?h["default"].createElement("button",{type:"button",className:"next-button "+v.navButtons+" "+v.navButtonNext,key:"next",onClick:this.isAnimating()?s:this.requestMoveNext}):"",h["default"].createElement("div",{className:"toolbar "+v.toolbar},h["default"].createElement("ul",{className:"toolbar-left "+v.toolbarSide+" "+v.toolbarLeftSide},h["default"].createElement("li",{className:v.toolbarItem},h["default"].createElement("span",{className:v.toolbarItemChild},this.props.imageTitle))),h["default"].createElement("ul",{className:"toolbar-right "+v.toolbarSide+" "+v.toolbarRightSide},this.props.toolbarButtons?this.props.toolbarButtons.map(function(e,t){return h["default"].createElement("li",{key:t,className:v.toolbarItem},e)}):"",h["default"].createElement("li",{className:v.toolbarItem},h["default"].createElement("button",{type:"button",key:"zoom-in",className:"zoom-in "+r.join(" "),onClick:d})),h["default"].createElement("li",{className:v.toolbarItem},h["default"].createElement("button",{type:"button",key:"zoom-out",className:"zoom-out "+u.join(" "),onClick:f})),h["default"].createElement("li",{className:v.toolbarItem},h["default"].createElement("button",{type:"button",key:"close",className:"close "+v.toolbarItemChild+(" "+v.builtinButton+" "+v.closeButton),onClick:this.isAnimating()?s:this.requestClose}))))))}}]),t}(u.Component);b.propTypes={mainSrc:u.PropTypes.string.isRequired,prevSrc:u.PropTypes.string,nextSrc:u.PropTypes.string,mainSrcThumbnail:u.PropTypes.string,prevSrcThumbnail:u.PropTypes.string,nextSrcThumbnail:u.PropTypes.string,onCloseRequest:u.PropTypes.func.isRequired,onMovePrevRequest:u.PropTypes.func,onMoveNextRequest:u.PropTypes.func,discourageDownloads:u.PropTypes.bool,animationDisabled:u.PropTypes.bool,animationOnKeyInput:u.PropTypes.bool,animationDuration:u.PropTypes.number,keyRepeatLimit:u.PropTypes.number,keyRepeatKeyupBonus:u.PropTypes.number,imageTitle:u.PropTypes.node,toolbarButtons:u.PropTypes.arrayOf(u.PropTypes.node),imagePadding:u.PropTypes.number,clickOutsideToClose:u.PropTypes.bool},b.defaultProps={onMovePrevRequest:function(){},onMoveNextRequest:function(){},discourageDownloads:!1,animationDisabled:!1,animationOnKeyInput:!1,animationDuration:300,keyRepeatLimit:180,keyRepeatKeyupBonus:40,imagePadding:10,clickOutsideToClose:!0},t["default"]=b},function(e,t){"use strict";function i(){var e=navigator.userAgent.match(/(?:MSIE |Trident\/.*; rv:)(\d+)/);return e?parseInt(e[1],10):void 0}function o(e){var t=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if(!e)return"";var i=e;return t&&Object.keys(t).forEach(function(e){i=i.replace(e,t[e])}),i}function n(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth}function a(){return window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight}function s(){try{return window.self!==window.top}catch(e){return!0}}Object.defineProperty(t,"__esModule",{value:!0}),t.getIEVersion=i,t.translate=o,t.getWindowWidth=n,t.getWindowHeight=a,t.isInIframe=s},function(e,t,i){t=e.exports=i(5)(),t.push([e.id,'@-webkit-keyframes closeWindow___2Hlon{0%{opacity:1}to{opacity:0}}@keyframes closeWindow___2Hlon{0%{opacity:1}to{opacity:0}}.outer___2lDXy{background-color:rgba(0,0,0,.85);position:fixed;top:0;left:0;right:0;bottom:0;z-index:1000;width:100%;height:100%}.outerClosing___1EQGK{opacity:0}.inner___1rfRQ{left:0;right:0}.image___2FLq2,.inner___1rfRQ{position:absolute;top:0;bottom:0}.image___2FLq2{margin:auto;max-width:100%;max-height:100%}.imagePrev___F6xVQ{left:-100%;right:100%}.imageNext___1uRqJ{left:100%;right:-100%}.imageDiscourager___3-CUB{background-repeat:no-repeat;background-position:50%;background-size:contain}.navButtons___3kNVF{border:none;position:absolute;top:0;bottom:0;width:20px;height:34px;padding:40px 30px;margin:auto;cursor:pointer;opacity:.7}.navButtons___3kNVF:hover{opacity:1}.navButtons___3kNVF:active{opacity:.7}.navButtonPrev___2vBS8{left:0;background:rgba(0,0,0,.2) url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwIiBoZWlnaHQ9IjM0Ij48cGF0aCBkPSJtIDE5LDMgLTIsLTIgLTE2LDE2IDE2LDE2IDEsLTEgLTE1LC0xNSAxNSwtMTUgeiIgZmlsbD0iI0ZGRiIvPjwvc3ZnPg==") no-repeat 50%}.navButtonNext___30R2i{right:0;background:rgba(0,0,0,.2) url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwIiBoZWlnaHQ9IjM0Ij48cGF0aCBkPSJtIDEsMyAyLC0yIDE2LDE2IC0xNiwxNiAtMSwtMSAxNSwtMTUgLTE1LC0xNSB6IiBmaWxsPSIjRkZGIi8+PC9zdmc+") no-repeat 50%}.downloadBlocker___3rU9-{position:absolute;top:0;left:0;right:0;bottom:0;background-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7");background-size:cover}.toolbar___1xYly{background-color:rgba(0,0,0,.5);position:absolute;left:0;top:0;right:0;height:50px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.toolbarSide___3FYWk{height:50px;margin:0}.toolbarSideNoFlex___KxqgW{height:auto;line-height:50px;max-width:48%;position:absolute;top:0;bottom:0}.toolbarLeftSide___8beAg{padding-left:20px;padding-right:0;-webkit-box-flex:0;-ms-flex:0 1 auto;flex:0 1 auto;overflow:hidden;text-overflow:ellipsis}.toolbarLeftSideNoFlex___3O3cZ{left:0;overflow:visible}.toolbarRightSide___1Sdfc{padding-left:0;padding-right:20px;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto}.toolbarRightSideNoFlex___oa0FT{right:0}.toolbarItem___3WbMb{display:inline-block;line-height:50px;padding:0;color:#fff;font-size:120%;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.toolbarItemChild___2U_MP{vertical-align:middle}.builtinButton___1zqo6{width:40px;height:35px;cursor:pointer;border:none;opacity:.7}.builtinButton___1zqo6:hover{opacity:1}.builtinButton___1zqo6:active{outline:none}.builtinButtonDisabled___3uvqe{cursor:default;opacity:.5}.builtinButtonDisabled___3uvqe:hover{opacity:.5}.closeButton___3BdAF{background:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwIiBoZWlnaHQ9IjIwIj48cGF0aCBkPSJtIDEsMyAxLjI1LC0xLjI1IDcuNSw3LjUgNy41LC03LjUgMS4yNSwxLjI1IC03LjUsNy41IDcuNSw3LjUgLTEuMjUsMS4yNSAtNy41LC03LjUgLTcuNSw3LjUgLTEuMjUsLTEuMjUgNy41LC03LjUgLTcuNSwtNy41IHoiIGZpbGw9IiNGRkYiLz48L3N2Zz4=") no-repeat 50%}.zoomInButton___3xtuX{background:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCI+PGcgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+PHBhdGggZD0iTTEgMTlsNi02Ii8+PHBhdGggZD0iTTkgOGg2Ii8+PHBhdGggZD0iTTEyIDV2NiIvPjwvZz48Y2lyY2xlIGN4PSIxMiIgY3k9IjgiIHI9IjciIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSIyIi8+PC9zdmc+") no-repeat 50%}.zoomOutButton___38PZx{background:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCI+PGcgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+PHBhdGggZD0iTTEgMTlsNi02Ii8+PHBhdGggZD0iTTkgOGg2Ii8+PC9nPjxjaXJjbGUgY3g9IjEyIiBjeT0iOCIgcj0iNyIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjIiLz48L3N2Zz4=") no-repeat 50%}.outerAnimating___2-fZi{-webkit-animation-name:closeWindow___2Hlon;animation-name:closeWindow___2Hlon}',""]),t.locals={outer:"outer___2lDXy",outerClosing:"outerClosing___1EQGK",inner:"inner___1rfRQ",image:"image___2FLq2",imagePrev:"imagePrev___F6xVQ",imageNext:"imageNext___1uRqJ",imageDiscourager:"imageDiscourager___3-CUB",navButtons:"navButtons___3kNVF",navButtonPrev:"navButtonPrev___2vBS8",navButtonNext:"navButtonNext___30R2i",downloadBlocker:"downloadBlocker___3rU9-",toolbar:"toolbar___1xYly",toolbarSide:"toolbarSide___3FYWk",toolbarSideNoFlex:"toolbarSideNoFlex___KxqgW",toolbarLeftSide:"toolbarLeftSide___8beAg",toolbarLeftSideNoFlex:"toolbarLeftSideNoFlex___3O3cZ",toolbarRightSide:"toolbarRightSide___1Sdfc",toolbarRightSideNoFlex:"toolbarRightSideNoFlex___oa0FT",toolbarItem:"toolbarItem___3WbMb",toolbarItemChild:"toolbarItemChild___2U_MP",builtinButton:"builtinButton___1zqo6",builtinButtonDisabled:"builtinButtonDisabled___3uvqe",closeButton:"closeButton___3BdAF",zoomInButton:"zoomInButton___3xtuX",zoomOutButton:"zoomOutButton___38PZx",outerAnimating:"outerAnimating___2-fZi",closeWindow:"closeWindow___2Hlon"}},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var i=this[t];i[2]?e.push("@media "+i[2]+"{"+i[1]+"}"):e.push(i[1])}return e.join("")},e.i=function(t,i){"string"==typeof t&&(t=[[null,t,""]]);for(var o={},n=0;n<this.length;n++){var a=this[n][0];"number"==typeof a&&(o[a]=!0)}for(n=0;n<t.length;n++){var s=t[n];"number"==typeof s[0]&&o[s[0]]||(i&&!s[2]?s[2]=i:i&&(s[2]="("+s[2]+") and ("+i+")"),e.push(s))}},e}},function(e,t,i){function o(e,t){for(var i=0;i<e.length;i++){var o=e[i],n=m[o.id];if(n){n.refs++;for(var a=0;a<n.parts.length;a++)n.parts[a](o.parts[a]);for(;a<o.parts.length;a++)n.parts.push(u(o.parts[a],t))}else{for(var s=[],a=0;a<o.parts.length;a++)s.push(u(o.parts[a],t));m[o.id]={id:o.id,refs:1,parts:s}}}}function n(e){for(var t=[],i={},o=0;o<e.length;o++){var n=e[o],a=n[0],s=n[1],r=n[2],l=n[3],u={css:s,media:r,sourceMap:l};i[a]?i[a].parts.push(u):t.push(i[a]={id:a,parts:[u]})}return t}function a(e,t){var i=g(),o=_[_.length-1];if("top"===e.insertAt)o?o.nextSibling?i.insertBefore(t,o.nextSibling):i.appendChild(t):i.insertBefore(t,i.firstChild),_.push(t);else{if("bottom"!==e.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");i.appendChild(t)}}function s(e){e.parentNode.removeChild(e);var t=_.indexOf(e);t>=0&&_.splice(t,1)}function r(e){var t=document.createElement("style");return t.type="text/css",a(e,t),t}function l(e){var t=document.createElement("link");return t.rel="stylesheet",a(e,t),t}function u(e,t){var i,o,n;if(t.singleton){var a=b++;i=v||(v=r(t)),o=h.bind(null,i,a,!1),n=h.bind(null,i,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(i=l(t),o=c.bind(null,i),n=function(){s(i),i.href&&URL.revokeObjectURL(i.href)}):(i=r(t),o=d.bind(null,i),n=function(){s(i)});return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else n()}}function h(e,t,i,o){var n=i?"":o.css;if(e.styleSheet)e.styleSheet.cssText=y(t,n);else{var a=document.createTextNode(n),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(a,s[t]):e.appendChild(a)}}function d(e,t){var i=t.css,o=t.media;if(o&&e.setAttribute("media",o),e.styleSheet)e.styleSheet.cssText=i;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(i))}}function c(e,t){var i=t.css,o=t.sourceMap;o&&(i+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var n=new Blob([i],{type:"text/css"}),a=e.href;e.href=URL.createObjectURL(n),a&&URL.revokeObjectURL(a)}var m={},p=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},f=p(function(){return/msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase())}),g=p(function(){return document.head||document.getElementsByTagName("head")[0]}),v=null,b=0,_=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=f()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var i=n(e);return o(i,t),function(e){for(var a=[],s=0;s<i.length;s++){var r=i[s],l=m[r.id];l.refs--,a.push(l)}if(e){var u=n(e);o(u,t)}for(var s=0;s<a.length;s++){var l=a[s];if(0===l.refs){for(var h=0;h<l.parts.length;h++)l.parts[h]();delete m[l.id]}}}};var y=function(){var e=[];return function(t,i){return e[t]=i,e.filter(Boolean).join("\n")}}()},function(e,t,i){var o=i(4);"string"==typeof o&&(o=[[e.id,o,""]]);i(6)(o,{});o.locals&&(e.exports=o.locals)},function(t,i){t.exports=e},function(e,i){e.exports=t}])}); | ||
//# sourceMappingURL=react-image-lightbox.js.map |
{ | ||
"name": "react-image-lightbox", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "A lightbox component for React.js", | ||
@@ -51,3 +51,3 @@ "scripts": { | ||
"eslint": "^2.9.0", | ||
"eslint-config-blue-hour": "0.0.2", | ||
"eslint-config-blue-hour": "0.x.x", | ||
"eslint-plugin-import": "^1.10.2", | ||
@@ -54,0 +54,0 @@ "eslint-plugin-jsx-a11y": "^1.5.5", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
200880