react-image-lightbox
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -0,1 +1,7 @@ | ||
v1.0.4 - Mon, 15 Feb 2016 06:45:15 GMT | ||
-------------------------------------- | ||
- | ||
v1.0.3 - Mon, 15 Feb 2016 00:55:49 GMT | ||
@@ -2,0 +8,0 @@ -------------------------------------- |
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ReactImageLightbox = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
(function (global){ | ||
/* | ||
@@ -9,7 +10,9 @@ * react-image-lightbox 1.0.0 | ||
var React = (typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null); | ||
var React = (typeof window !== "undefined" ? window['React'] : typeof global !== "undefined" ? global['React'] : null); | ||
var radium = (typeof window !== "undefined" ? window['Radium'] : typeof global !== "undefined" ? global['Radium'] : null); | ||
var styles = require('../helpers/styles.js'); | ||
var styles = require('./styles'); | ||
var ReactImageLightbox = React.createClass({displayName: "ReactImageLightbox", | ||
var ReactImageLightbox = React.createClass({ | ||
displayName: 'ReactImageLightbox', | ||
propTypes: { | ||
@@ -109,24 +112,24 @@ /////////////////////////////// | ||
// Padding (px) between the edge of the window and the lightbox | ||
imagePadding: React.PropTypes.number, | ||
imagePadding: React.PropTypes.number | ||
}, | ||
getDefaultProps: function() { | ||
getDefaultProps: function getDefaultProps() { | ||
return { | ||
onMovePrevRequest: function(){}, | ||
onMoveNextRequest: function(){}, | ||
onMovePrevRequest: function onMovePrevRequest() {}, | ||
onMoveNextRequest: function onMoveNextRequest() {}, | ||
discourageDownloads: false, | ||
animationDisabled : false, | ||
animationOnKeyInput : false, | ||
animationDuration : 300, | ||
animationDisabled: false, | ||
animationOnKeyInput: false, | ||
animationDuration: 300, | ||
keyRepeatLimit : 180, | ||
keyRepeatKeyupBonus : 40, | ||
keyRepeatLimit: 180, | ||
keyRepeatKeyupBonus: 40, | ||
imagePadding: 10, | ||
imagePadding: 10 | ||
}; | ||
}, | ||
getInitialState: function() { | ||
getInitialState: function getInitialState() { | ||
return { | ||
@@ -145,7 +148,7 @@ /////////////////////////////// | ||
// Main image is being replaced by the next image | ||
isMovingToNext: false, | ||
isMovingToNext: false | ||
}; | ||
}, | ||
componentWillMount: function() { | ||
componentWillMount: function componentWillMount() { | ||
// Whether event listeners for keyboard and mouse input have been attached or not | ||
@@ -164,3 +167,3 @@ this.listenersAttached = false; | ||
componentDidMount: function() { | ||
componentDidMount: function componentDidMount() { | ||
this.attachListeners(); | ||
@@ -176,6 +179,6 @@ | ||
componentWillReceiveProps: function(nextProps) { | ||
var sourcesChanged = this.getSrcTypes().some(function(srcType) { | ||
componentWillReceiveProps: function componentWillReceiveProps(nextProps) { | ||
var sourcesChanged = this.getSrcTypes().some((function (srcType) { | ||
return this.props[srcType] != nextProps[srcType]; | ||
}.bind(this)); | ||
}).bind(this)); | ||
@@ -188,10 +191,10 @@ if (sourcesChanged) { | ||
this.setState({ isMovingToPrev: true }); | ||
setTimeout(function() { | ||
setTimeout((function () { | ||
this.setState({ isMovingToPrev: false }); | ||
}.bind(this), this.props.animationDuration); | ||
}).bind(this), this.props.animationDuration); | ||
} else if (this.props.mainSrc == nextProps.prevSrc) { | ||
this.setState({ isMovingToNext: true }); | ||
setTimeout(function() { | ||
setTimeout((function () { | ||
this.setState({ isMovingToNext: false }); | ||
}.bind(this), this.props.animationDuration); | ||
}).bind(this), this.props.animationDuration); | ||
} | ||
@@ -206,3 +209,3 @@ } | ||
componentWillUnmount: function() { | ||
componentWillUnmount: function componentWillUnmount() { | ||
this.detachListeners(); | ||
@@ -212,3 +215,3 @@ }, | ||
// Handle user keyboard actions | ||
handleKeyInput: function(event) { | ||
handleKeyInput: function handleKeyInput(event) { | ||
event.stopPropagation(); | ||
@@ -229,5 +232,5 @@ | ||
var key = { | ||
esc : 27, | ||
leftArrow : 37, | ||
rightArrow : 39, | ||
esc: 27, | ||
leftArrow: 37, | ||
rightArrow: 39 | ||
}; | ||
@@ -238,5 +241,3 @@ | ||
var currentTime = new Date(); | ||
if ((currentTime.getTime() - this.lastKeyDownTime) < this.props.keyRepeatLimit && | ||
keyCode != key.esc | ||
) { | ||
if (currentTime.getTime() - this.lastKeyDownTime < this.props.keyRepeatLimit && keyCode != key.esc) { | ||
return; | ||
@@ -253,4 +254,4 @@ } | ||
} else { | ||
this.requestClose(event); // animated | ||
} | ||
this.requestClose(event); // animated | ||
} | ||
break; | ||
@@ -285,7 +286,7 @@ | ||
// Request that the lightbox be closed | ||
requestClose: function(event) { | ||
var closeLightbox = function() { | ||
requestClose: function requestClose(event) { | ||
var closeLightbox = (function () { | ||
// Call the parent close request | ||
this.props.onCloseRequest(event); | ||
}.bind(this); | ||
}).bind(this); | ||
@@ -304,3 +305,3 @@ if (!this.props.animationDisabled) { | ||
// Request to transition to the previous image | ||
requestMovePrev: function(event) { | ||
requestMovePrev: function requestMovePrev(event) { | ||
this.props.onMovePrevRequest(event); | ||
@@ -310,3 +311,3 @@ }, | ||
// Request to transition to the next image | ||
requestMoveNext: function(event) { | ||
requestMoveNext: function requestMoveNext(event) { | ||
this.props.onMoveNextRequest(event); | ||
@@ -316,3 +317,3 @@ }, | ||
// Attach key and mouse input events | ||
attachListeners: function() { | ||
attachListeners: function attachListeners() { | ||
if (!this.listenersAttached) { | ||
@@ -326,3 +327,3 @@ document.addEventListener('keydown', this.handleKeyInput); | ||
// Detach key and mouse input events | ||
detachListeners: function() { | ||
detachListeners: function detachListeners() { | ||
if (this.listenersAttached) { | ||
@@ -336,19 +337,12 @@ document.removeEventListener('keydown', this.handleKeyInput); | ||
// Get image src types | ||
getSrcTypes: function() { | ||
return [ | ||
'mainSrc', | ||
'mainSrcThumbnail', | ||
'nextSrc', | ||
'nextSrcThumbnail', | ||
'prevSrc', | ||
'prevSrcThumbnail', | ||
]; | ||
getSrcTypes: function getSrcTypes() { | ||
return ['mainSrc', 'mainSrcThumbnail', 'nextSrc', 'nextSrcThumbnail', 'prevSrc', 'prevSrcThumbnail']; | ||
}, | ||
// Get sizing for when an image is larger than the window | ||
getFitSizes: function(width, height) { | ||
getFitSizes: function getFitSizes(width, height) { | ||
var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; | ||
var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; | ||
var maxHeight = Math.min(windowHeight - (this.props.imagePadding * 2), height); | ||
var maxWidth = Math.min(windowWidth - (this.props.imagePadding * 2), width); | ||
var windowWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; | ||
var maxHeight = Math.min(windowHeight - this.props.imagePadding * 2, height); | ||
var maxWidth = Math.min(windowWidth - this.props.imagePadding * 2, width); | ||
@@ -359,7 +353,8 @@ var maxRatio = maxWidth / maxHeight; | ||
var fitSizes = {}; | ||
if (maxRatio > srcRatio) { // height is the constraining dimension of the photo | ||
fitSizes.width = width * maxHeight / height; | ||
if (maxRatio > srcRatio) { | ||
// height is the constraining dimension of the photo | ||
fitSizes.width = width * maxHeight / height; | ||
fitSizes.height = maxHeight; | ||
} else { | ||
fitSizes.width = maxWidth; | ||
fitSizes.width = maxWidth; | ||
fitSizes.height = height * maxWidth / width; | ||
@@ -372,3 +367,3 @@ } | ||
// Detach key and mouse input events | ||
isAnimating: function() { | ||
isAnimating: function isAnimating() { | ||
return this.state.isMovingToNext || this.state.isMovingToPrev || this.state.isClosing; | ||
@@ -378,6 +373,6 @@ }, | ||
// Load image from src and call callback with image width and height on load | ||
loadImage: function(imageSrc, callback) { | ||
loadImage: function loadImage(imageSrc, callback) { | ||
// Return the image info if it is already cached | ||
if (this.isImageLoaded(imageSrc)) { | ||
setTimeout(function() { | ||
setTimeout(function () { | ||
callback(null, this.imageCache[imageSrc].width, this.imageCache[imageSrc].height); | ||
@@ -391,11 +386,11 @@ }, 1); | ||
inMemoryImage.onerror = function() { | ||
inMemoryImage.onerror = function () { | ||
callback('image load error'); | ||
}; | ||
inMemoryImage.onload = function() { | ||
inMemoryImage.onload = function () { | ||
that.imageCache[imageSrc] = { | ||
loaded : true, | ||
width : this.width, | ||
height : this.height, | ||
loaded: true, | ||
width: this.width, | ||
height: this.height | ||
}; | ||
@@ -410,6 +405,6 @@ | ||
// Load all images and their thumbnails | ||
loadAllImages: function(props) { | ||
loadAllImages: function loadAllImages(props) { | ||
props = props || this.props; | ||
var generateImageLoadedCallback = function(srcType, imageSrc) { | ||
return function(err) { | ||
var generateImageLoadedCallback = (function (srcType, imageSrc) { | ||
return (function (err) { | ||
// Give up showing image on error | ||
@@ -427,7 +422,7 @@ if (err) { | ||
this.forceUpdate(); | ||
}.bind(this); | ||
}.bind(this); | ||
}).bind(this); | ||
}).bind(this); | ||
// Load the images | ||
this.getSrcTypes().forEach(function(srcType) { | ||
this.getSrcTypes().forEach((function (srcType) { | ||
// Load unloaded images | ||
@@ -437,11 +432,11 @@ if (props[srcType] && !this.isImageLoaded(props[srcType])) { | ||
} | ||
}.bind(this)); | ||
}).bind(this)); | ||
}, | ||
// Load image from src and call callback with image width and height on load | ||
isImageLoaded: function(imageSrc) { | ||
return imageSrc && (imageSrc in this.imageCache) && this.imageCache[imageSrc].loaded; | ||
isImageLoaded: function isImageLoaded(imageSrc) { | ||
return imageSrc && imageSrc in this.imageCache && this.imageCache[imageSrc].loaded; | ||
}, | ||
render: function() { | ||
render: function render() { | ||
// Transition settings for sliding animations | ||
@@ -455,3 +450,3 @@ var transitionStyle = {}; | ||
var images = []; | ||
var addImage = function(srcType, imageClass, baseStyle) { | ||
var addImage = (function (srcType, imageClass, baseStyle) { | ||
var imageSrc = this.props[srcType]; | ||
@@ -473,9 +468,7 @@ if (!imageSrc) { | ||
// Fall back to loading icon if the thumbnail has not been loaded | ||
images.push( | ||
React.createElement("div", { | ||
className: imageClass + ' not-loaded', | ||
style: imageStyle, | ||
key: imageSrc} | ||
) | ||
); | ||
images.push(React.createElement('div', { | ||
className: imageClass + ' not-loaded', | ||
style: imageStyle, | ||
key: imageSrc | ||
})); | ||
@@ -486,4 +479,4 @@ return; | ||
imageStyle.push({ | ||
width : fitSizes.width, | ||
height : fitSizes.height, | ||
width: fitSizes.width, | ||
height: fitSizes.height | ||
}); | ||
@@ -494,22 +487,20 @@ | ||
imageStyle.push(styles.imageDiscourager); | ||
images.push( | ||
React.createElement("div", { | ||
className: imageClass, | ||
style: imageStyle, | ||
images.push(React.createElement( | ||
'div', | ||
{ | ||
className: imageClass, | ||
style: imageStyle, | ||
key: imageSrc | ||
}, | ||
React.createElement("div", {className: "download-blocker", style: [styles.image.downloadBlocker]}) | ||
) | ||
); | ||
}, | ||
React.createElement('div', { className: 'download-blocker', style: [styles.image.downloadBlocker] }) | ||
)); | ||
} else { | ||
images.push( | ||
React.createElement("img", { | ||
className: imageClass, | ||
style: imageStyle, | ||
src: imageSrc, | ||
key: imageSrc} | ||
) | ||
); | ||
images.push(React.createElement('img', { | ||
className: imageClass, | ||
style: imageStyle, | ||
src: imageSrc, | ||
key: imageSrc | ||
})); | ||
} | ||
}.bind(this); | ||
}).bind(this); | ||
@@ -523,66 +514,71 @@ // Next Image (displayed on the right) | ||
var noop = function(){}; | ||
var noop = function noop() {}; | ||
return ( | ||
React.createElement("div", {// Floating modal with closing animations | ||
className: "outer" + (this.state.isClosing ? ' closing' : ''), | ||
style: [ | ||
styles.outer, | ||
styles.outer.animating(this.props.animationDuration), | ||
this.state.isClosing ? styles.outerClosing : {}, | ||
] | ||
}, | ||
React.createElement("div", {// Image holder | ||
className: "inner", | ||
return React.createElement( | ||
'div', | ||
{ // Floating modal with closing animations | ||
className: "outer" + (this.state.isClosing ? ' closing' : ''), | ||
style: [styles.outer, styles.outer.animating(this.props.animationDuration), this.state.isClosing ? styles.outerClosing : {}] | ||
}, | ||
React.createElement( | ||
'div', | ||
{ // Image holder | ||
className: 'inner', | ||
style: [styles.inner] | ||
}, | ||
images | ||
), | ||
!this.props.prevSrc ? '' : | ||
React.createElement("button", {// Move to previous image button | ||
type: "button", | ||
className: "prev-button", | ||
key: "prev", | ||
style: [styles.navButtons, styles.navButtonPrev], | ||
onClick: !this.isAnimating() ? this.requestMovePrev : noop}// Ignore clicks during animation | ||
), | ||
!this.props.nextSrc ? '' : | ||
React.createElement("button", {// Move to next image button | ||
type: "button", | ||
className: "next-button", | ||
key: "next", | ||
style: [styles.navButtons, styles.navButtonNext], | ||
onClick: !this.isAnimating() ? this.requestMoveNext : noop}// Ignore clicks during animation | ||
), | ||
React.createElement("div", {// Lightbox toolbar | ||
className: "toolbar", | ||
}, | ||
images | ||
), | ||
!this.props.prevSrc ? '' : React.createElement('button', { // Move to previous image button | ||
type: 'button', | ||
className: 'prev-button', | ||
key: 'prev', | ||
style: [styles.navButtons, styles.navButtonPrev], | ||
onClick: !this.isAnimating() ? this.requestMovePrev : noop // Ignore clicks during animation | ||
}), | ||
!this.props.nextSrc ? '' : React.createElement('button', { // Move to next image button | ||
type: 'button', | ||
className: 'next-button', | ||
key: 'next', | ||
style: [styles.navButtons, styles.navButtonNext], | ||
onClick: !this.isAnimating() ? this.requestMoveNext : noop // Ignore clicks during animation | ||
}), | ||
React.createElement( | ||
'div', | ||
{ // Lightbox toolbar | ||
className: 'toolbar', | ||
style: [styles.toolbar] | ||
}, | ||
React.createElement("ul", {className: "toolbar-left", style: [styles.toolbarSide, styles.toolbarLeftSide]}, | ||
React.createElement("li", {style: [styles.toolbarItem]}, | ||
React.createElement("span", {style: [styles.toolbarItemChild]}, this.props.imageTitle) | ||
}, | ||
React.createElement( | ||
'ul', | ||
{ className: 'toolbar-left', style: [styles.toolbarSide, styles.toolbarLeftSide] }, | ||
React.createElement( | ||
'li', | ||
{ style: [styles.toolbarItem] }, | ||
React.createElement( | ||
'span', | ||
{ style: [styles.toolbarItemChild] }, | ||
this.props.imageTitle | ||
) | ||
), | ||
React.createElement("ul", {className: "toolbar-right", style: [styles.toolbarSide, styles.toolbarRightSide]}, | ||
!this.props.toolbarButtons ? '' : this.props.toolbarButtons.map(function(button, i) { | ||
return (React.createElement("li", {key: i, style: [styles.toolbarItem]}, button)); | ||
}), | ||
React.createElement("li", {style: [styles.toolbarItem]}, | ||
React.createElement("button", {// Lightbox close button | ||
type: "button", | ||
className: "close", | ||
style: [styles.toolbarItemChild, styles.closeButton], | ||
onClick: !this.isAnimating() ? this.requestClose : noop}// Ignore clicks during animation | ||
) | ||
) | ||
) | ||
), | ||
React.createElement( | ||
'ul', | ||
{ className: 'toolbar-right', style: [styles.toolbarSide, styles.toolbarRightSide] }, | ||
!this.props.toolbarButtons ? '' : this.props.toolbarButtons.map(function (button, i) { | ||
return React.createElement( | ||
'li', | ||
{ key: i, style: [styles.toolbarItem] }, | ||
button | ||
); | ||
}), | ||
React.createElement( | ||
'li', | ||
{ style: [styles.toolbarItem] }, | ||
React.createElement('button', { // Lightbox close button | ||
type: 'button', | ||
className: 'close', | ||
style: [styles.toolbarItemChild, styles.closeButton], | ||
onClick: !this.isAnimating() ? this.requestClose : noop // Ignore clicks during animation | ||
}) | ||
) | ||
) | ||
@@ -596,64 +592,64 @@ ) | ||
},{"../helpers/styles.js":2}],2:[function(require,module,exports){ | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"./styles":2}],2:[function(require,module,exports){ | ||
'use strict'; | ||
var toolbarHeight = '50px'; | ||
var styles = { | ||
outer: { | ||
backgroundColor : 'rgba(0, 0, 0, 0.85)', | ||
position : 'fixed', | ||
top : 0, | ||
left : 0, | ||
right : 0, | ||
bottom : 0, | ||
zIndex : 1000, | ||
width : '100%', | ||
height : '100%', | ||
backgroundColor: 'rgba(0, 0, 0, 0.85)', | ||
position: 'fixed', | ||
top: 0, | ||
left: 0, | ||
right: 0, | ||
bottom: 0, | ||
zIndex: 1000, | ||
width: '100%', | ||
height: '100%', | ||
animating: function(duration) { | ||
animating: function animating(duration) { | ||
return { | ||
transition: 'opacity ' + String(duration) + 'ms', | ||
transition: 'opacity ' + String(duration) + 'ms' | ||
}; | ||
}, | ||
} | ||
}, | ||
outerClosing: { | ||
opacity: 0, | ||
opacity: 0 | ||
}, | ||
inner: { | ||
position : 'absolute', | ||
top : 0, | ||
left : 0, | ||
right : 0, | ||
bottom : 0, | ||
position: 'absolute', | ||
top: 0, | ||
left: 0, | ||
right: 0, | ||
bottom: 0 | ||
}, | ||
image: { | ||
position : 'absolute', | ||
top : 0, | ||
bottom : 0, | ||
margin : 'auto', | ||
maxWidth : '100%', | ||
maxHeight : '100%', | ||
position: 'absolute', | ||
top: 0, | ||
bottom: 0, | ||
margin: 'auto', | ||
maxWidth: '100%', | ||
maxHeight: '100%' | ||
}, | ||
imagePrev: { | ||
left: '-100%', | ||
right: '100%', | ||
right: '100%' | ||
}, | ||
imageNext: { | ||
left: '100%', | ||
right: '-100%', | ||
right: '-100%' | ||
}, | ||
imageCurrent: { | ||
left: 0, | ||
right: 0, | ||
right: 0 | ||
}, | ||
imageDiscourager: { | ||
backgroundRepeat : 'no-repeat', | ||
backgroundPosition : 'center', | ||
backgroundSize : 'contain', | ||
backgroundRepeat: 'no-repeat', | ||
backgroundPosition: 'center', | ||
backgroundSize: 'contain' | ||
}, | ||
imageAnimating: function(duration) { | ||
imageAnimating: function imageAnimating(duration) { | ||
return { | ||
transition: [ | ||
'left ' + String(duration) + 'ms', | ||
'right ' + String(duration) + 'ms', | ||
].join(', '), | ||
transition: ['left ' + String(duration) + 'ms', 'right ' + String(duration) + 'ms'].join(', ') | ||
}; | ||
@@ -663,97 +659,97 @@ }, | ||
navButtons: { | ||
border : 'none', | ||
position : 'absolute', | ||
top : 0, | ||
bottom : 0, | ||
width : '20px', | ||
height : '34px', | ||
padding : '40px 40px', | ||
margin : 'auto', | ||
cursor : 'pointer', | ||
opacity : 0.7, | ||
border: 'none', | ||
position: 'absolute', | ||
top: 0, | ||
bottom: 0, | ||
width: '20px', | ||
height: '34px', | ||
padding: '40px 40px', | ||
margin: 'auto', | ||
cursor: 'pointer', | ||
opacity: 0.7, | ||
':hover': { | ||
opacity: 1, | ||
opacity: 1 | ||
}, | ||
':active': { | ||
opacity: 0.7, | ||
}, | ||
opacity: 0.7 | ||
} | ||
}, | ||
navButtonPrev: { | ||
left : 0, | ||
background : 'url(\'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwIiBoZWlnaHQ9IjM0Ij48cGF0aCBkPSJtIDE5LDMgLTIsLTIgLTE2LDE2IDE2LDE2IDEsLTEgLTE1LC0xNSAxNSwtMTUgeiIgZmlsbD0iI0ZGRiIvPjwvc3ZnPg==\') no-repeat center', | ||
left: 0, | ||
background: 'url(\'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwIiBoZWlnaHQ9IjM0Ij48cGF0aCBkPSJtIDE5LDMgLTIsLTIgLTE2LDE2IDE2LDE2IDEsLTEgLTE1LC0xNSAxNSwtMTUgeiIgZmlsbD0iI0ZGRiIvPjwvc3ZnPg==\') no-repeat center' | ||
}, | ||
navButtonNext: { | ||
right : 0, | ||
background : 'url(\'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwIiBoZWlnaHQ9IjM0Ij48cGF0aCBkPSJtIDEsMyAyLC0yIDE2LDE2IC0xNiwxNiAtMSwtMSAxNSwtMTUgLTE1LC0xNSB6IiBmaWxsPSIjRkZGIi8+PC9zdmc+\') no-repeat center', | ||
right: 0, | ||
background: 'url(\'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwIiBoZWlnaHQ9IjM0Ij48cGF0aCBkPSJtIDEsMyAyLC0yIDE2LDE2IC0xNiwxNiAtMSwtMSAxNSwtMTUgLTE1LC0xNSB6IiBmaWxsPSIjRkZGIi8+PC9zdmc+\') no-repeat center' | ||
}, | ||
downloadBlocker: { | ||
position : 'absolute', | ||
top : 0, | ||
left : 0, | ||
right : 0, | ||
bottom : 0, | ||
backgroundImage : 'url(\'../img/please-use-download-button.gif\')', | ||
backgroundSize : 'cover', | ||
position: 'absolute', | ||
top: 0, | ||
left: 0, | ||
right: 0, | ||
bottom: 0, | ||
backgroundImage: 'url(\'../img/please-use-download-button.gif\')', | ||
backgroundSize: 'cover' | ||
}, | ||
toolbar: { | ||
backgroundColor : 'rgba(0, 0, 0, 0.5)', | ||
position : 'absolute', | ||
left : 0, | ||
top : 0, | ||
right : 0, | ||
height : toolbarHeight, | ||
backgroundColor: 'rgba(0, 0, 0, 0.5)', | ||
position: 'absolute', | ||
left: 0, | ||
top: 0, | ||
right: 0, | ||
height: toolbarHeight | ||
}, | ||
toolbarSide: { | ||
lineHeight : toolbarHeight, | ||
position : 'absolute', | ||
top : 0, | ||
bottom : 0, | ||
margin : 0, | ||
maxWidth : '48%', | ||
lineHeight: toolbarHeight, | ||
position: 'absolute', | ||
top: 0, | ||
bottom: 0, | ||
margin: 0, | ||
maxWidth: '48%' | ||
}, | ||
toolbarLeftSide: { | ||
paddingLeft : '20px', | ||
paddingRight : 0, | ||
left : 0, | ||
paddingLeft: '20px', | ||
paddingRight: 0, | ||
left: 0 | ||
}, | ||
toolbarRightSide: { | ||
paddingLeft : 0, | ||
paddingRight : '20px', | ||
right : 0, | ||
paddingLeft: 0, | ||
paddingRight: '20px', | ||
right: 0 | ||
}, | ||
toolbarItem: { | ||
display : 'inline-block', | ||
lineHeight : toolbarHeight, | ||
padding : '0 6px', | ||
color : '#FFFFFF', | ||
fontSize : '120%', | ||
maxWidth : '100%', | ||
overflow : 'hidden', | ||
textOverflow : 'ellipsis', | ||
whiteSpace : 'nowrap', | ||
display: 'inline-block', | ||
lineHeight: toolbarHeight, | ||
padding: '0 6px', | ||
color: '#FFFFFF', | ||
fontSize: '120%', | ||
maxWidth: '100%', | ||
overflow: 'hidden', | ||
textOverflow: 'ellipsis', | ||
whiteSpace: 'nowrap' | ||
}, | ||
toolbarItemChild: { | ||
verticalAlign: 'middle', | ||
verticalAlign: 'middle' | ||
}, | ||
closeButton: { | ||
width : '25px', | ||
height : '25px', | ||
cursor : 'pointer', | ||
border : 'none', | ||
background : 'url(\'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwIiBoZWlnaHQ9IjIwIj48cGF0aCBkPSJtIDEsMyAxLjI1LC0xLjI1IDcuNSw3LjUgNy41LC03LjUgMS4yNSwxLjI1IC03LjUsNy41IDcuNSw3LjUgLTEuMjUsMS4yNSAtNy41LC03LjUgLTcuNSw3LjUgLTEuMjUsLTEuMjUgNy41LC03LjUgLTcuNSwtNy41IHoiIGZpbGw9IiNGRkYiLz48L3N2Zz4=\') no-repeat center', | ||
width: '25px', | ||
height: '25px', | ||
cursor: 'pointer', | ||
border: 'none', | ||
background: 'url(\'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwIiBoZWlnaHQ9IjIwIj48cGF0aCBkPSJtIDEsMyAxLjI1LC0xLjI1IDcuNSw3LjUgNy41LC03LjUgMS4yNSwxLjI1IC03LjUsNy41IDcuNSw3LjUgLTEuMjUsMS4yNSAtNy41LC03LjUgLTcuNSw3LjUgLTEuMjUsLTEuMjUgNy41LC03LjUgLTcuNSwtNy41IHoiIGZpbGw9IiNGRkYiLz48L3N2Zz4=\') no-repeat center', | ||
':hover': { | ||
opacity: 0.7, | ||
opacity: 0.7 | ||
}, | ||
':active': { | ||
outline: 'none', | ||
}, | ||
}, | ||
outline: 'none' | ||
} | ||
} | ||
}; | ||
@@ -763,6 +759,3 @@ | ||
},{}],3:[function(require,module,exports){ | ||
module.exports = require('./components/react-image-lightbox.jsx'); | ||
},{"./components/react-image-lightbox.jsx":1}]},{},[3])(3) | ||
},{}]},{},[1])(1) | ||
}); |
@@ -1,6 +0,1 @@ | ||
!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.ReactImageLightbox=f()}}(function(){return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){/* | ||
* react-image-lightbox 1.0.0 | ||
* Copyright 2016 Chris Fritz All rights reserved. | ||
* @license Open source under the MIT License | ||
*/ | ||
"use strict";var React="undefined"!=typeof window?window.React:"undefined"!=typeof global?global.React:null,radium="undefined"!=typeof window?window.Radium:"undefined"!=typeof global?global.Radium:null,styles=require("../helpers/styles.js"),ReactImageLightbox=React.createClass({displayName:"ReactImageLightbox",propTypes:{mainSrc:React.PropTypes.string.isRequired,prevSrc:React.PropTypes.string,nextSrc:React.PropTypes.string,mainSrcThumbnail:React.PropTypes.string,prevSrcThumbnail:React.PropTypes.string,nextSrcThumbnail:React.PropTypes.string,onCloseRequest:React.PropTypes.func.isRequired,onMovePrevRequest:React.PropTypes.func,onMoveNextRequest:React.PropTypes.func,discourageDownloads:React.PropTypes.bool,animationDisabled:React.PropTypes.bool,animationOnKeyInput:React.PropTypes.bool,animationDuration:React.PropTypes.number,keyRepeatLimit:React.PropTypes.number,keyRepeatKeyupBonus:React.PropTypes.number,imageTitle:React.PropTypes.string,toolbarButtons:React.PropTypes.arrayOf(React.PropTypes.node),imagePadding:React.PropTypes.number},getDefaultProps:function(){return{onMovePrevRequest:function(){},onMoveNextRequest:function(){},discourageDownloads:!1,animationDisabled:!1,animationOnKeyInput:!1,animationDuration:300,keyRepeatLimit:180,keyRepeatKeyupBonus:40,imagePadding:10}},getInitialState:function(){return{isClosing:!this.props.animationDisabled,isMovingToPrev:!1,isMovingToNext:!1}},componentWillMount:function(){this.listenersAttached=!1,this.keyPressed=!1,this.imageCache={},this.lastKeyDownTime=0},componentDidMount:function(){this.attachListeners(),this.props.animationDisabled||this.setState({isClosing:!1}),this.loadAllImages()},componentWillReceiveProps:function(nextProps){var sourcesChanged=this.getSrcTypes().some(function(srcType){return this.props[srcType]!=nextProps[srcType]}.bind(this));if(sourcesChanged){if(!this.props.animationDisabled&&(!this.keyPressed||this.props.animationOnKeyInput)){this.props.mainSrc==nextProps.nextSrc;this.props.mainSrc==nextProps.nextSrc?(this.setState({isMovingToPrev:!0}),setTimeout(function(){this.setState({isMovingToPrev:!1})}.bind(this),this.props.animationDuration)):this.props.mainSrc==nextProps.prevSrc&&(this.setState({isMovingToNext:!0}),setTimeout(function(){this.setState({isMovingToNext:!1})}.bind(this),this.props.animationDuration))}this.keyPressed=!1,this.loadAllImages(nextProps)}},componentWillUnmount:function(){this.detachListeners()},handleKeyInput:function(event){if(event.stopPropagation(),!this.isAnimating()){if("keyup"===event.type)return void(this.lastKeyDownTime-=this.props.keyRepeatKeyupBonus);var keyCode=event.which||event.keyCode,key={esc:27,leftArrow:37,rightArrow:39},currentTime=new Date;if(!(currentTime.getTime()-this.lastKeyDownTime<this.props.keyRepeatLimit&&keyCode!=key.esc))switch(this.lastKeyDownTime=currentTime.getTime(),keyCode){case key.esc:event.preventDefault(),this.props.animationDisabled||!this.props.animationOnKeyInput?this.props.onCloseRequest(event):this.requestClose(event);break;case key.leftArrow:if(!this.props.prevSrc)return;event.preventDefault(),this.keyPressed=!0,this.props.onMovePrevRequest(event);break;case key.rightArrow:if(!this.props.nextSrc)return;event.preventDefault(),this.keyPressed=!0,this.props.onMoveNextRequest(event)}}},requestClose:function(event){var closeLightbox=function(){this.props.onCloseRequest(event)}.bind(this);this.props.animationDisabled?closeLightbox():(this.setState({isClosing:!0}),setTimeout(closeLightbox,this.props.animationDuration))},requestMovePrev:function(event){this.props.onMovePrevRequest(event)},requestMoveNext:function(event){this.props.onMoveNextRequest(event)},attachListeners:function(){this.listenersAttached||(document.addEventListener("keydown",this.handleKeyInput),document.addEventListener("keyup",this.handleKeyInput),this.listenersAttached=!0)},detachListeners:function(){this.listenersAttached&&(document.removeEventListener("keydown",this.handleKeyInput),document.removeEventListener("keyup",this.handleKeyInput),this.listenersAttached=!1)},getSrcTypes:function(){return["mainSrc","mainSrcThumbnail","nextSrc","nextSrcThumbnail","prevSrc","prevSrcThumbnail"]},getFitSizes:function(width,height){var windowHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,windowWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,maxHeight=Math.min(windowHeight-2*this.props.imagePadding,height),maxWidth=Math.min(windowWidth-2*this.props.imagePadding,width),maxRatio=maxWidth/maxHeight,srcRatio=width/height,fitSizes={};return maxRatio>srcRatio?(fitSizes.width=width*maxHeight/height,fitSizes.height=maxHeight):(fitSizes.width=maxWidth,fitSizes.height=height*maxWidth/width),fitSizes},isAnimating:function(){return this.state.isMovingToNext||this.state.isMovingToPrev||this.state.isClosing},loadImage:function(imageSrc,callback){if(this.isImageLoaded(imageSrc))return void setTimeout(function(){callback(null,this.imageCache[imageSrc].width,this.imageCache[imageSrc].height)},1);var that=this,inMemoryImage=new Image;inMemoryImage.onerror=function(){callback("image load error")},inMemoryImage.onload=function(){that.imageCache[imageSrc]={loaded:!0,width:this.width,height:this.height},callback(null,this.width,this.height)},inMemoryImage.src=imageSrc},loadAllImages:function(props){props=props||this.props;var generateImageLoadedCallback=function(srcType,imageSrc){return function(err){err||this.props[srcType]==imageSrc&&this.forceUpdate()}.bind(this)}.bind(this);this.getSrcTypes().forEach(function(srcType){props[srcType]&&!this.isImageLoaded(props[srcType])&&this.loadImage(props[srcType],generateImageLoadedCallback(srcType,props[srcType]))}.bind(this))},isImageLoaded:function(imageSrc){return imageSrc&&imageSrc in this.imageCache&&this.imageCache[imageSrc].loaded},render:function(){var transitionStyle={};!this.props.animationDisabled&&this.isAnimating()&&(transitionStyle=styles.imageAnimating(this.props.animationDuration));var images=[],addImage=function(srcType,imageClass,baseStyle){var imageSrc=this.props[srcType];if(imageSrc){var imageStyle=[styles.image,baseStyle,transitionStyle],fitSizes={};if(this.isImageLoaded(imageSrc))fitSizes=this.getFitSizes(this.imageCache[imageSrc].width,this.imageCache[imageSrc].height);else{if(!this.isImageLoaded(this.props[srcType+"Thumbnail"]))return void images.push(React.createElement("div",{className:imageClass+" not-loaded",style:imageStyle,key:imageSrc}));imageSrc=this.props[srcType+"Thumbnail"],fitSizes=this.getFitSizes(this.imageCache[imageSrc].width,this.imageCache[imageSrc].height)}imageStyle.push({width:fitSizes.width,height:fitSizes.height}),this.props.discourageDownloads?(imageStyle.push({backgroundImage:"url('"+imageSrc+"')"}),imageStyle.push(styles.imageDiscourager),images.push(React.createElement("div",{className:imageClass,style:imageStyle,key:imageSrc},React.createElement("div",{className:"download-blocker",style:[styles.image.downloadBlocker]})))):images.push(React.createElement("img",{className:imageClass,style:imageStyle,src:imageSrc,key:imageSrc}))}}.bind(this);addImage("nextSrc","image-next",styles.imageNext),addImage("mainSrc","image-current",styles.imageCurrent),addImage("prevSrc","image-prev",styles.imagePrev);var noop=function(){};return React.createElement("div",{className:"outer"+(this.state.isClosing?" closing":""),style:[styles.outer,styles.outer.animating(this.props.animationDuration),this.state.isClosing?styles.outerClosing:{}]},React.createElement("div",{className:"inner",style:[styles.inner]},images),this.props.prevSrc?React.createElement("button",{type:"button",className:"prev-button",key:"prev",style:[styles.navButtons,styles.navButtonPrev],onClick:this.isAnimating()?noop:this.requestMovePrev}):"",this.props.nextSrc?React.createElement("button",{type:"button",className:"next-button",key:"next",style:[styles.navButtons,styles.navButtonNext],onClick:this.isAnimating()?noop:this.requestMoveNext}):"",React.createElement("div",{className:"toolbar",style:[styles.toolbar]},React.createElement("ul",{className:"toolbar-left",style:[styles.toolbarSide,styles.toolbarLeftSide]},React.createElement("li",{style:[styles.toolbarItem]},React.createElement("span",{style:[styles.toolbarItemChild]},this.props.imageTitle))),React.createElement("ul",{className:"toolbar-right",style:[styles.toolbarSide,styles.toolbarRightSide]},this.props.toolbarButtons?this.props.toolbarButtons.map(function(button,i){return React.createElement("li",{key:i,style:[styles.toolbarItem]},button)}):"",React.createElement("li",{style:[styles.toolbarItem]},React.createElement("button",{type:"button",className:"close",style:[styles.toolbarItemChild,styles.closeButton],onClick:this.isAnimating()?noop:this.requestClose})))))}});module.exports=radium(ReactImageLightbox)},{"../helpers/styles.js":2}],2:[function(require,module,exports){var toolbarHeight="50px",styles={outer:{backgroundColor:"rgba(0, 0, 0, 0.85)",position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e3,width:"100%",height:"100%",animating:function(duration){return{transition:"opacity "+String(duration)+"ms"}}},outerClosing:{opacity:0},inner:{position:"absolute",top:0,left:0,right:0,bottom:0},image:{position:"absolute",top:0,bottom:0,margin:"auto",maxWidth:"100%",maxHeight:"100%"},imagePrev:{left:"-100%",right:"100%"},imageNext:{left:"100%",right:"-100%"},imageCurrent:{left:0,right:0},imageDiscourager:{backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"contain"},imageAnimating:function(duration){return{transition:["left "+String(duration)+"ms","right "+String(duration)+"ms"].join(", ")}},navButtons:{border:"none",position:"absolute",top:0,bottom:0,width:"20px",height:"34px",padding:"40px 40px",margin:"auto",cursor:"pointer",opacity:.7,":hover":{opacity:1},":active":{opacity:.7}},navButtonPrev:{left:0,background:"url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwIiBoZWlnaHQ9IjM0Ij48cGF0aCBkPSJtIDE5LDMgLTIsLTIgLTE2LDE2IDE2LDE2IDEsLTEgLTE1LC0xNSAxNSwtMTUgeiIgZmlsbD0iI0ZGRiIvPjwvc3ZnPg==') no-repeat center"},navButtonNext:{right:0,background:"url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwIiBoZWlnaHQ9IjM0Ij48cGF0aCBkPSJtIDEsMyAyLC0yIDE2LDE2IC0xNiwxNiAtMSwtMSAxNSwtMTUgLTE1LC0xNSB6IiBmaWxsPSIjRkZGIi8+PC9zdmc+') no-repeat center"},downloadBlocker:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundImage:"url('../img/please-use-download-button.gif')",backgroundSize:"cover"},toolbar:{backgroundColor:"rgba(0, 0, 0, 0.5)",position:"absolute",left:0,top:0,right:0,height:toolbarHeight},toolbarSide:{lineHeight:toolbarHeight,position:"absolute",top:0,bottom:0,margin:0,maxWidth:"48%"},toolbarLeftSide:{paddingLeft:"20px",paddingRight:0,left:0},toolbarRightSide:{paddingLeft:0,paddingRight:"20px",right:0},toolbarItem:{display:"inline-block",lineHeight:toolbarHeight,padding:"0 6px",color:"#FFFFFF",fontSize:"120%",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},toolbarItemChild:{verticalAlign:"middle"},closeButton:{width:"25px",height:"25px",cursor:"pointer",border:"none",background:"url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwIiBoZWlnaHQ9IjIwIj48cGF0aCBkPSJtIDEsMyAxLjI1LC0xLjI1IDcuNSw3LjUgNy41LC03LjUgMS4yNSwxLjI1IC03LjUsNy41IDcuNSw3LjUgLTEuMjUsMS4yNSAtNy41LC03LjUgLTcuNSw3LjUgLTEuMjUsLTEuMjUgNy41LC03LjUgLTcuNSwtNy41IHoiIGZpbGw9IiNGRkYiLz48L3N2Zz4=') no-repeat center",":hover":{opacity:.7},":active":{outline:"none"}}};module.exports=styles},{}],3:[function(require,module,exports){module.exports=require("./components/react-image-lightbox.jsx")},{"./components/react-image-lightbox.jsx":1}]},{},[3])(3)}); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.ReactImageLightbox=e()}}(function(){return function e(t,i,n){function o(a,r){if(!i[a]){if(!t[a]){var l="function"==typeof require&&require;if(!r&&l)return l(a,!0);if(s)return s(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var p=i[a]={exports:{}};t[a][0].call(p.exports,function(e){var i=t[a][1][e];return o(i?i:e)},p,p.exports,e,t,i,n)}return i[a].exports}for(var s="function"==typeof require&&require,a=0;a<n.length;a++)o(n[a]);return o}({1:[function(e,t,i){(function(i){"use strict";var n="undefined"!=typeof window?window.React:"undefined"!=typeof i?i.React:null,o="undefined"!=typeof window?window.Radium:"undefined"!=typeof i?i.Radium:null,s=e("./styles"),a=n.createClass({displayName:"ReactImageLightbox",propTypes:{mainSrc:n.PropTypes.string.isRequired,prevSrc:n.PropTypes.string,nextSrc:n.PropTypes.string,mainSrcThumbnail:n.PropTypes.string,prevSrcThumbnail:n.PropTypes.string,nextSrcThumbnail:n.PropTypes.string,onCloseRequest:n.PropTypes.func.isRequired,onMovePrevRequest:n.PropTypes.func,onMoveNextRequest:n.PropTypes.func,discourageDownloads:n.PropTypes.bool,animationDisabled:n.PropTypes.bool,animationOnKeyInput:n.PropTypes.bool,animationDuration:n.PropTypes.number,keyRepeatLimit:n.PropTypes.number,keyRepeatKeyupBonus:n.PropTypes.number,imageTitle:n.PropTypes.string,toolbarButtons:n.PropTypes.arrayOf(n.PropTypes.node),imagePadding:n.PropTypes.number},getDefaultProps:function(){return{onMovePrevRequest:function(){},onMoveNextRequest:function(){},discourageDownloads:!1,animationDisabled:!1,animationOnKeyInput:!1,animationDuration:300,keyRepeatLimit:180,keyRepeatKeyupBonus:40,imagePadding:10}},getInitialState:function(){return{isClosing:!this.props.animationDisabled,isMovingToPrev:!1,isMovingToNext:!1}},componentWillMount:function(){this.listenersAttached=!1,this.keyPressed=!1,this.imageCache={},this.lastKeyDownTime=0},componentDidMount:function(){this.attachListeners(),this.props.animationDisabled||this.setState({isClosing:!1}),this.loadAllImages()},componentWillReceiveProps:function(e){var t=this.getSrcTypes().some(function(t){return this.props[t]!=e[t]}.bind(this));if(t){if(!this.props.animationDisabled&&(!this.keyPressed||this.props.animationOnKeyInput)){this.props.mainSrc==e.nextSrc;this.props.mainSrc==e.nextSrc?(this.setState({isMovingToPrev:!0}),setTimeout(function(){this.setState({isMovingToPrev:!1})}.bind(this),this.props.animationDuration)):this.props.mainSrc==e.prevSrc&&(this.setState({isMovingToNext:!0}),setTimeout(function(){this.setState({isMovingToNext:!1})}.bind(this),this.props.animationDuration))}this.keyPressed=!1,this.loadAllImages(e)}},componentWillUnmount:function(){this.detachListeners()},handleKeyInput: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={esc:27,leftArrow:37,rightArrow:39},n=new Date;if(!(n.getTime()-this.lastKeyDownTime<this.props.keyRepeatLimit&&t!=i.esc))switch(this.lastKeyDownTime=n.getTime(),t){case i.esc:e.preventDefault(),this.props.animationDisabled||!this.props.animationOnKeyInput?this.props.onCloseRequest(e):this.requestClose(e);break;case i.leftArrow:if(!this.props.prevSrc)return;e.preventDefault(),this.keyPressed=!0,this.props.onMovePrevRequest(e);break;case i.rightArrow:if(!this.props.nextSrc)return;e.preventDefault(),this.keyPressed=!0,this.props.onMoveNextRequest(e)}}},requestClose:function(e){var t=function(){this.props.onCloseRequest(e)}.bind(this);this.props.animationDisabled?t():(this.setState({isClosing:!0}),setTimeout(t,this.props.animationDuration))},requestMovePrev:function(e){this.props.onMovePrevRequest(e)},requestMoveNext:function(e){this.props.onMoveNextRequest(e)},attachListeners:function(){this.listenersAttached||(document.addEventListener("keydown",this.handleKeyInput),document.addEventListener("keyup",this.handleKeyInput),this.listenersAttached=!0)},detachListeners:function(){this.listenersAttached&&(document.removeEventListener("keydown",this.handleKeyInput),document.removeEventListener("keyup",this.handleKeyInput),this.listenersAttached=!1)},getSrcTypes:function(){return["mainSrc","mainSrcThumbnail","nextSrc","nextSrcThumbnail","prevSrc","prevSrcThumbnail"]},getFitSizes:function(e,t){var i=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,n=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,o=Math.min(i-2*this.props.imagePadding,t),s=Math.min(n-2*this.props.imagePadding,e),a=s/o,r=e/t,l={};return a>r?(l.width=e*o/t,l.height=o):(l.width=s,l.height=t*s/e),l},isAnimating:function(){return this.state.isMovingToNext||this.state.isMovingToPrev||this.state.isClosing},loadImage:function(e,t){if(this.isImageLoaded(e))return void setTimeout(function(){t(null,this.imageCache[e].width,this.imageCache[e].height)},1);var i=this,n=new Image;n.onerror=function(){t("image load error")},n.onload=function(){i.imageCache[e]={loaded:!0,width:this.width,height:this.height},t(null,this.width,this.height)},n.src=e},loadAllImages:function(e){e=e||this.props;var t=function(e,t){return function(i){i||this.props[e]==t&&this.forceUpdate()}.bind(this)}.bind(this);this.getSrcTypes().forEach(function(i){e[i]&&!this.isImageLoaded(e[i])&&this.loadImage(e[i],t(i,e[i]))}.bind(this))},isImageLoaded:function(e){return e&&e in this.imageCache&&this.imageCache[e].loaded},render:function(){var e={};!this.props.animationDisabled&&this.isAnimating()&&(e=s.imageAnimating(this.props.animationDuration));var t=[],i=function(i,o,a){var r=this.props[i];if(r){var l=[s.image,a,e],u={};if(this.isImageLoaded(r))u=this.getFitSizes(this.imageCache[r].width,this.imageCache[r].height);else{if(!this.isImageLoaded(this.props[i+"Thumbnail"]))return void t.push(n.createElement("div",{className:o+" not-loaded",style:l,key:r}));r=this.props[i+"Thumbnail"],u=this.getFitSizes(this.imageCache[r].width,this.imageCache[r].height)}l.push({width:u.width,height:u.height}),this.props.discourageDownloads?(l.push({backgroundImage:"url('"+r+"')"}),l.push(s.imageDiscourager),t.push(n.createElement("div",{className:o,style:l,key:r},n.createElement("div",{className:"download-blocker",style:[s.image.downloadBlocker]})))):t.push(n.createElement("img",{className:o,style:l,src:r,key:r}))}}.bind(this);i("nextSrc","image-next",s.imageNext),i("mainSrc","image-current",s.imageCurrent),i("prevSrc","image-prev",s.imagePrev);var o=function(){};return n.createElement("div",{className:"outer"+(this.state.isClosing?" closing":""),style:[s.outer,s.outer.animating(this.props.animationDuration),this.state.isClosing?s.outerClosing:{}]},n.createElement("div",{className:"inner",style:[s.inner]},t),this.props.prevSrc?n.createElement("button",{type:"button",className:"prev-button",key:"prev",style:[s.navButtons,s.navButtonPrev],onClick:this.isAnimating()?o:this.requestMovePrev}):"",this.props.nextSrc?n.createElement("button",{type:"button",className:"next-button",key:"next",style:[s.navButtons,s.navButtonNext],onClick:this.isAnimating()?o:this.requestMoveNext}):"",n.createElement("div",{className:"toolbar",style:[s.toolbar]},n.createElement("ul",{className:"toolbar-left",style:[s.toolbarSide,s.toolbarLeftSide]},n.createElement("li",{style:[s.toolbarItem]},n.createElement("span",{style:[s.toolbarItemChild]},this.props.imageTitle))),n.createElement("ul",{className:"toolbar-right",style:[s.toolbarSide,s.toolbarRightSide]},this.props.toolbarButtons?this.props.toolbarButtons.map(function(e,t){return n.createElement("li",{key:t,style:[s.toolbarItem]},e)}):"",n.createElement("li",{style:[s.toolbarItem]},n.createElement("button",{type:"button",className:"close",style:[s.toolbarItemChild,s.closeButton],onClick:this.isAnimating()?o:this.requestClose})))))}});t.exports=o(a)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./styles":2}],2:[function(e,t,i){"use strict";var n="50px",o={outer:{backgroundColor:"rgba(0, 0, 0, 0.85)",position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e3,width:"100%",height:"100%",animating:function(e){return{transition:"opacity "+String(e)+"ms"}}},outerClosing:{opacity:0},inner:{position:"absolute",top:0,left:0,right:0,bottom:0},image:{position:"absolute",top:0,bottom:0,margin:"auto",maxWidth:"100%",maxHeight:"100%"},imagePrev:{left:"-100%",right:"100%"},imageNext:{left:"100%",right:"-100%"},imageCurrent:{left:0,right:0},imageDiscourager:{backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundSize:"contain"},imageAnimating:function(e){return{transition:["left "+String(e)+"ms","right "+String(e)+"ms"].join(", ")}},navButtons:{border:"none",position:"absolute",top:0,bottom:0,width:"20px",height:"34px",padding:"40px 40px",margin:"auto",cursor:"pointer",opacity:.7,":hover":{opacity:1},":active":{opacity:.7}},navButtonPrev:{left:0,background:"url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwIiBoZWlnaHQ9IjM0Ij48cGF0aCBkPSJtIDE5LDMgLTIsLTIgLTE2LDE2IDE2LDE2IDEsLTEgLTE1LC0xNSAxNSwtMTUgeiIgZmlsbD0iI0ZGRiIvPjwvc3ZnPg==') no-repeat center"},navButtonNext:{right:0,background:"url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwIiBoZWlnaHQ9IjM0Ij48cGF0aCBkPSJtIDEsMyAyLC0yIDE2LDE2IC0xNiwxNiAtMSwtMSAxNSwtMTUgLTE1LC0xNSB6IiBmaWxsPSIjRkZGIi8+PC9zdmc+') no-repeat center"},downloadBlocker:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundImage:"url('../img/please-use-download-button.gif')",backgroundSize:"cover"},toolbar:{backgroundColor:"rgba(0, 0, 0, 0.5)",position:"absolute",left:0,top:0,right:0,height:n},toolbarSide:{lineHeight:n,position:"absolute",top:0,bottom:0,margin:0,maxWidth:"48%"},toolbarLeftSide:{paddingLeft:"20px",paddingRight:0,left:0},toolbarRightSide:{paddingLeft:0,paddingRight:"20px",right:0},toolbarItem:{display:"inline-block",lineHeight:n,padding:"0 6px",color:"#FFFFFF",fontSize:"120%",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},toolbarItemChild:{verticalAlign:"middle"},closeButton:{width:"25px",height:"25px",cursor:"pointer",border:"none",background:"url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgd2lkdGg9IjIwIiBoZWlnaHQ9IjIwIj48cGF0aCBkPSJtIDEsMyAxLjI1LC0xLjI1IDcuNSw3LjUgNy41LC03LjUgMS4yNSwxLjI1IC03LjUsNy41IDcuNSw3LjUgLTEuMjUsMS4yNSAtNy41LC03LjUgLTcuNSw3LjUgLTEuMjUsLTEuMjUgNy41LC03LjUgLTcuNSwtNy41IHoiIGZpbGw9IiNGRkYiLz48L3N2Zz4=') no-repeat center",":hover":{opacity:.7},":active":{outline:"none"}}};t.exports=o},{}]},{},[1])(1)}); |
{ | ||
"name": "react-image-lightbox", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "A lightbox component for React.js", | ||
@@ -8,6 +8,3 @@ "scripts": { | ||
}, | ||
"directories": { | ||
"example": "examples" | ||
}, | ||
"main": "./dist/react-image-lightbox", | ||
"main": "lib/ReactImageLightbox.js", | ||
"repository": { | ||
@@ -30,13 +27,7 @@ "type": "git", | ||
"devDependencies": { | ||
"browserify": "^13.0.0", | ||
"browserify-shim": "^3.8.12", | ||
"envify": "3.4.0", | ||
"jsx-loader": "^0.13.2", | ||
"gulp": "^3.9.1", | ||
"react": "^0.14.0", | ||
"react-component-gulp-tasks": "^0.7.7", | ||
"react-dom": "^0.14.0", | ||
"reactify": "^1.1.1", | ||
"rf-release": "^0.4.0", | ||
"uglify-js": "^2.6.1", | ||
"webpack": "^1.12.13", | ||
"webpack-dev-server": "^1.14.1" | ||
"rf-release": "^0.4.0" | ||
}, | ||
@@ -43,0 +34,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
2174362
5
26
27117
8
1