react-vimeo
Advanced tools
Comparing version 0.2.2 to 1.0.0
@@ -1,2 +0,1 @@ | ||
# API | ||
@@ -6,19 +5,26 @@ | ||
Interface props { | ||
videoId: String, | ||
className?: String = 'vimeo', | ||
playerOptions?: Object = { autoplay: 1 }, | ||
playButton?: ReactElement = <PlayButton />, | ||
onReady?(data?: Object) => Void, | ||
onCuechange?(data?: Object) => Void, | ||
onError?(data?: Object) => Void, | ||
onFinish?(data?: Object) => Void, | ||
onLoadProgress?(data?: Object) => Void, | ||
onPause?(data?: Object) => Void, | ||
onPlay?(data?: Object) => Void, | ||
onPlayProgress?(data?: Object) => Void, | ||
onSeek?(data?: Object) => Void, | ||
autoplay?: Boolean = false, | ||
autoplay?: Boolean = false, | ||
videoId: String, | ||
className?: String = 'vimeo', | ||
playerOptions?: Object = { autoplay: 1 }, | ||
playButton?: ReactElement = <PlayButton />, | ||
onCueChange?(data?: Object) => Void, | ||
onEnded?(data?: Object) => Void, | ||
onError?(data?: Object) => Void, | ||
onLoaded?(data?: Object) => Void, | ||
onPause?(data?: Object) => Void, | ||
onPlay?(data?: Object) => Void, | ||
onProgress?(data?: Object) => Void, | ||
onReady?(data?: Object) => Void, | ||
onSeeked?(data?: Object) => Void, | ||
onTextTrackChanged?(data?: Object) => Void, | ||
onTimeUpdate?(data?: Object) => Void, | ||
onVolumeChange?(data?: Object) => Void | ||
}; | ||
``` | ||
## autoplay?: Boolean = false | ||
If true, video will automatically play | ||
## videoId: String | ||
@@ -38,10 +44,10 @@ The Vimeo video ID. This property is required | ||
## onReady?(data: Object) => Void | ||
Called when video has loaded and is ready to play. | ||
Other event functions will not be called before this one other than onError | ||
## onCueChange?(data: Object) => Void | ||
Called when the active cue for the current text track changes. | ||
It also fires when the active text track changes. | ||
There may be multiple cues active. | ||
## onEnded?(data: Object) => Void | ||
Called when video reaches the end | ||
## onCuechange?(data: Object) => Void | ||
Called when the player que changes. | ||
## onError?(data: Object) => Void | ||
@@ -51,8 +57,5 @@ Called in the event that there is an error. | ||
## onFinish?(data: Object) => Void | ||
Called when video completes | ||
## onLoaded?(data: Object) => Void | ||
Called when a new video is loaded in the player. | ||
## onLoadProgress?(data: Object) => Void | ||
Called when part of video has loaded | ||
## onPause?(data: Object) => Void | ||
@@ -64,11 +67,24 @@ Called when video is paused | ||
## onPlayProgress?(data: Object) => Void | ||
Called when video play has progressed | ||
## onProgress?(data: Object) => Void | ||
Called as the video is loaded. | ||
Reports back the amount of the video that has been buffered. | ||
## onSeek?(data: Object) => Void | ||
Called when user seeks ahead in video | ||
## onReady?(data: Object) => Void | ||
Called when video has loaded and is ready to play. | ||
Other event functions will not be called before this one other than onError | ||
## autoplay?: Boolean = false | ||
If true, video will automatically play | ||
## onSeeked?(data: Object) => Void | ||
Called when the player seeks to a specific time. | ||
`onTimeUpdate` will also be called at the same time. | ||
Interactive api (play/pause actions, seek to `n`, etc..) to come in future versions | ||
## onTextTrackChanged?(data: Object) => Void | ||
Triggered when the active text track (captions/subtitles) changes. | ||
The values will be null if text tracks are turned off. | ||
## onTimeUpdate?(data: Object) => Void | ||
Called as the current time of the video updates. It generally fires every 250ms, but it may vary depending on the browser. | ||
## onVolumeChange?(data: Object) => Void | ||
Triggered when the volume in the player changes. | ||
Some devices do not support setting the volume of the video independently from the system volume, | ||
so this event will never fire on those devices. |
@@ -13,2 +13,6 @@ 'use strict'; | ||
/* | ||
* React component for Vimeo Loading Spinner created and rendered. | ||
* SVG Path is used for creating the spinner. | ||
*/ | ||
exports.default = _react2.default.createClass({ | ||
@@ -15,0 +19,0 @@ displayName: 'Spinner', |
/* | ||
* React-Vimeo - React component to load video from Vimeo | ||
* @version v0.2.2 | ||
* @version v1.0.0 | ||
* @link https://github.com/freecodecamp/react-vimeo | ||
@@ -75,3 +75,3 @@ * @license MIT | ||
var _keymirror = __webpack_require__(10); | ||
var _keymirror = __webpack_require__(7); | ||
@@ -84,11 +84,11 @@ var _keymirror2 = _interopRequireDefault(_keymirror); | ||
var _debug = __webpack_require__(4); | ||
var _debug = __webpack_require__(2); | ||
var _debug2 = _interopRequireDefault(_debug); | ||
var _PlayButton = __webpack_require__(2); | ||
var _PlayButton = __webpack_require__(3); | ||
var _PlayButton2 = _interopRequireDefault(_PlayButton); | ||
var _Spinner = __webpack_require__(3); | ||
var _Spinner = __webpack_require__(4); | ||
@@ -102,13 +102,16 @@ var _Spinner2 = _interopRequireDefault(_Spinner); | ||
var playerEvents = (0, _keymirror2.default)({ | ||
cuechange: null, | ||
finish: null, | ||
loadProgress: null, | ||
cueChange: null, | ||
ended: null, | ||
loaded: null, | ||
pause: null, | ||
play: null, | ||
playProgress: null, | ||
seek: null | ||
progress: null, | ||
seeked: null, | ||
textTrackChange: null, | ||
timeUpdate: null, | ||
volumeChange: null | ||
}); | ||
function capitalize() { | ||
var str = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; | ||
var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; | ||
@@ -135,17 +138,22 @@ return str.charAt(0).toUpperCase() + str.substring(1); | ||
propTypes: { | ||
autoplay: _react.PropTypes.bool, | ||
className: _react.PropTypes.string, | ||
loading: _react.PropTypes.element, | ||
onCuechange: _react.PropTypes.func, | ||
playButton: _react.PropTypes.node, | ||
playerOptions: _react.PropTypes.object, | ||
videoId: _react.PropTypes.string.isRequired, | ||
// event callbacks | ||
onCueChange: _react.PropTypes.func, | ||
onEnded: _react.PropTypes.func, | ||
onError: _react.PropTypes.func, | ||
onFinish: _react.PropTypes.func, | ||
onLoadProgress: _react.PropTypes.func, | ||
onLoaded: _react.PropTypes.func, | ||
onPause: _react.PropTypes.func, | ||
onPlay: _react.PropTypes.func, | ||
onPlayProgress: _react.PropTypes.func, | ||
onProgress: _react.PropTypes.func, | ||
onReady: _react.PropTypes.func, | ||
onSeek: _react.PropTypes.func, | ||
playButton: _react.PropTypes.node, | ||
videoId: _react.PropTypes.string.isRequired, | ||
playerOptions: _react.PropTypes.object, | ||
autoplay: _react.PropTypes.bool | ||
onSeeked: _react.PropTypes.func, | ||
onTextTrackChanged: _react.PropTypes.func, | ||
onTimeUpdate: _react.PropTypes.func, | ||
onVolumeChange: _react.PropTypes.func | ||
}, | ||
@@ -208,4 +216,4 @@ | ||
onMessage: function onMessage(_ref) { | ||
var origin = _ref.origin; | ||
var data = _ref.data; | ||
var origin = _ref.origin, | ||
data = _ref.data; | ||
var onReady = this.props.onReady; | ||
@@ -242,3 +250,7 @@ var playerOrigin = this.state.playerOrigin; | ||
} | ||
if (!data.event) { | ||
// we get messages when the first event callbacks are added to the frame | ||
return; | ||
} | ||
debug('firing event: ', data.event); | ||
getFuncForEvent(data.event, this.props)(data); | ||
@@ -250,3 +262,3 @@ }, | ||
Object.keys(playerEvents).forEach(function (event) { | ||
var err = post('addEventListener', event, player, playerOrigin); | ||
var err = post('addEventListener', event.toLowerCase(), player, playerOrigin); | ||
if (err) { | ||
@@ -376,88 +388,3 @@ _this.onError(err); | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _react = __webpack_require__(1); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.default = _react2.default.createClass({ | ||
displayName: 'PlayButton', | ||
propTypes: { | ||
onClick: _react2.default.PropTypes.func | ||
}, | ||
render: function render() { | ||
return _react2.default.createElement( | ||
'button', | ||
{ | ||
className: 'vimeo-play-button', | ||
onClick: this.props.onClick, | ||
type: 'button' }, | ||
_react2.default.createElement( | ||
'svg', | ||
{ | ||
version: '1.1', | ||
viewBox: '0 0 100 100', | ||
xmlns: 'http://www.w3.org/2000/svg' }, | ||
_react2.default.createElement('path', { d: 'M79.674,53.719c2.59-2.046,2.59-5.392,0-7.437L22.566,1.053C19.977-0.993,18,0.035,18,3.335v93.331c0,3.3,1.977,4.326,4.566,2.281L79.674,53.719z' }) | ||
) | ||
); | ||
} | ||
}); /* eslint-disable max-len */ | ||
module.exports = exports['default']; | ||
/***/ }, | ||
/* 3 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _react = __webpack_require__(1); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.default = _react2.default.createClass({ | ||
displayName: 'Spinner', | ||
render: function render() { | ||
return _react2.default.createElement( | ||
'div', | ||
{ className: 'vimeo-loading' }, | ||
_react2.default.createElement( | ||
'svg', | ||
{ | ||
height: '32', | ||
viewBox: '0 0 32 32', | ||
width: '32', | ||
xmlns: 'http://www.w3.org/2000/svg' }, | ||
_react2.default.createElement('path', { | ||
d: 'M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4', | ||
opacity: '.25' }), | ||
_react2.default.createElement('path', { d: 'M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z' }) | ||
) | ||
); | ||
} | ||
}); /* eslint-disable max-len */ | ||
module.exports = exports['default']; | ||
/***/ }, | ||
/* 4 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
/* WEBPACK VAR INJECTION */(function(process) { | ||
/** | ||
@@ -503,3 +430,4 @@ * This is the web browser implementation of `debug()`. | ||
// is webkit? http://stackoverflow.com/a/16459606/376773 | ||
return ('WebkitAppearance' in document.documentElement.style) || | ||
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 | ||
return (typeof document !== 'undefined' && 'WebkitAppearance' in document.documentElement.style) || | ||
// is firebug? http://stackoverflow.com/a/398120/376773 | ||
@@ -517,3 +445,7 @@ (window.console && (console.firebug || (console.exception && console.table))) || | ||
exports.formatters.j = function(v) { | ||
return JSON.stringify(v); | ||
try { | ||
return JSON.stringify(v); | ||
} catch (err) { | ||
return '[UnexpectedJSONParseError]: ' + err.message; | ||
} | ||
}; | ||
@@ -605,5 +537,9 @@ | ||
try { | ||
r = exports.storage.debug; | ||
return exports.storage.debug; | ||
} catch(e) {} | ||
return r; | ||
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG | ||
if (typeof process !== 'undefined' && 'env' in process) { | ||
return process.env.DEBUG; | ||
} | ||
} | ||
@@ -634,4 +570,94 @@ | ||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(9))) | ||
/***/ }, | ||
/* 3 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _react = __webpack_require__(1); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.default = _react2.default.createClass({ | ||
displayName: 'PlayButton', | ||
propTypes: { | ||
onClick: _react2.default.PropTypes.func | ||
}, | ||
render: function render() { | ||
return _react2.default.createElement( | ||
'button', | ||
{ | ||
className: 'vimeo-play-button', | ||
onClick: this.props.onClick, | ||
type: 'button' }, | ||
_react2.default.createElement( | ||
'svg', | ||
{ | ||
version: '1.1', | ||
viewBox: '0 0 100 100', | ||
xmlns: 'http://www.w3.org/2000/svg' }, | ||
_react2.default.createElement('path', { d: 'M79.674,53.719c2.59-2.046,2.59-5.392,0-7.437L22.566,1.053C19.977-0.993,18,0.035,18,3.335v93.331c0,3.3,1.977,4.326,4.566,2.281L79.674,53.719z' }) | ||
) | ||
); | ||
} | ||
}); /* eslint-disable max-len */ | ||
module.exports = exports['default']; | ||
/***/ }, | ||
/* 4 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
var _react = __webpack_require__(1); | ||
var _react2 = _interopRequireDefault(_react); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* | ||
* React component for Vimeo Loading Spinner created and rendered. | ||
* SVG Path is used for creating the spinner. | ||
*/ | ||
exports.default = _react2.default.createClass({ | ||
displayName: 'Spinner', | ||
render: function render() { | ||
return _react2.default.createElement( | ||
'div', | ||
{ className: 'vimeo-loading' }, | ||
_react2.default.createElement( | ||
'svg', | ||
{ | ||
height: '32', | ||
viewBox: '0 0 32 32', | ||
width: '32', | ||
xmlns: 'http://www.w3.org/2000/svg' }, | ||
_react2.default.createElement('path', { | ||
d: 'M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4', | ||
opacity: '.25' }), | ||
_react2.default.createElement('path', { d: 'M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z' }) | ||
) | ||
); | ||
} | ||
}); /* eslint-disable max-len */ | ||
module.exports = exports['default']; | ||
/***/ }, | ||
/* 5 */ | ||
@@ -648,3 +674,3 @@ /***/ function(module, exports, __webpack_require__) { | ||
exports = module.exports = debug; | ||
exports = module.exports = debug.debug = debug; | ||
exports.coerce = coerce; | ||
@@ -654,3 +680,3 @@ exports.disable = disable; | ||
exports.enabled = enabled; | ||
exports.humanize = __webpack_require__(11); | ||
exports.humanize = __webpack_require__(8); | ||
@@ -727,3 +753,6 @@ /** | ||
var args = Array.prototype.slice.call(arguments); | ||
var args = new Array(arguments.length); | ||
for (var i = 0; i < args.length; i++) { | ||
args[i] = arguments[i]; | ||
} | ||
@@ -755,5 +784,5 @@ args[0] = exports.coerce(args[0]); | ||
if ('function' === typeof exports.formatArgs) { | ||
args = exports.formatArgs.apply(self, args); | ||
} | ||
// apply env-specific formatting | ||
args = exports.formatArgs.apply(self, args); | ||
var logFn = enabled.log || exports.log || console.log.bind(console); | ||
@@ -787,3 +816,3 @@ logFn.apply(self, args); | ||
if (!split[i]) continue; // ignore empty strings | ||
namespaces = split[i].replace(/\*/g, '.*?'); | ||
namespaces = split[i].replace(/[\\^$+?.()|[\]{}]/g, '\\$&').replace(/\*/g, '.*?'); | ||
if (namespaces[0] === '-') { | ||
@@ -852,3 +881,3 @@ exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); | ||
var debug = __webpack_require__(7)('jsonp'); | ||
var debug = __webpack_require__(2)('jsonp'); | ||
@@ -950,518 +979,5 @@ /** | ||
/* 7 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
/** | ||
* This is the web browser implementation of `debug()`. | ||
* | ||
* Expose `debug()` as the module. | ||
*/ | ||
exports = module.exports = __webpack_require__(8); | ||
exports.log = log; | ||
exports.formatArgs = formatArgs; | ||
exports.save = save; | ||
exports.load = load; | ||
exports.useColors = useColors; | ||
/** | ||
* Use chrome.storage.local if we are in an app | ||
*/ | ||
var storage; | ||
if (typeof chrome !== 'undefined' && typeof chrome.storage !== 'undefined') | ||
storage = chrome.storage.local; | ||
else | ||
storage = localstorage(); | ||
/** | ||
* Colors. | ||
*/ | ||
exports.colors = [ | ||
'lightseagreen', | ||
'forestgreen', | ||
'goldenrod', | ||
'dodgerblue', | ||
'darkorchid', | ||
'crimson' | ||
]; | ||
/** | ||
* Currently only WebKit-based Web Inspectors, Firefox >= v31, | ||
* and the Firebug extension (any Firefox version) are known | ||
* to support "%c" CSS customizations. | ||
* | ||
* TODO: add a `localStorage` variable to explicitly enable/disable colors | ||
*/ | ||
function useColors() { | ||
// is webkit? http://stackoverflow.com/a/16459606/376773 | ||
return ('WebkitAppearance' in document.documentElement.style) || | ||
// is firebug? http://stackoverflow.com/a/398120/376773 | ||
(window.console && (console.firebug || (console.exception && console.table))) || | ||
// is firefox >= v31? | ||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages | ||
(navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); | ||
} | ||
/** | ||
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. | ||
*/ | ||
exports.formatters.j = function(v) { | ||
return JSON.stringify(v); | ||
}; | ||
/** | ||
* Colorize log arguments if enabled. | ||
* | ||
* @api public | ||
*/ | ||
function formatArgs() { | ||
var args = arguments; | ||
var useColors = this.useColors; | ||
args[0] = (useColors ? '%c' : '') | ||
+ this.namespace | ||
+ (useColors ? ' %c' : ' ') | ||
+ args[0] | ||
+ (useColors ? '%c ' : ' ') | ||
+ '+' + exports.humanize(this.diff); | ||
if (!useColors) return args; | ||
var c = 'color: ' + this.color; | ||
args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); | ||
// the final "%c" is somewhat tricky, because there could be other | ||
// arguments passed either before or after the %c, so we need to | ||
// figure out the correct index to insert the CSS into | ||
var index = 0; | ||
var lastC = 0; | ||
args[0].replace(/%[a-z%]/g, function(match) { | ||
if ('%%' === match) return; | ||
index++; | ||
if ('%c' === match) { | ||
// we only are interested in the *last* %c | ||
// (the user may have provided their own) | ||
lastC = index; | ||
} | ||
}); | ||
args.splice(lastC, 0, c); | ||
return args; | ||
} | ||
/** | ||
* Invokes `console.log()` when available. | ||
* No-op when `console.log` is not a "function". | ||
* | ||
* @api public | ||
*/ | ||
function log() { | ||
// this hackery is required for IE8/9, where | ||
// the `console.log` function doesn't have 'apply' | ||
return 'object' === typeof console | ||
&& console.log | ||
&& Function.prototype.apply.call(console.log, console, arguments); | ||
} | ||
/** | ||
* Save `namespaces`. | ||
* | ||
* @param {String} namespaces | ||
* @api private | ||
*/ | ||
function save(namespaces) { | ||
try { | ||
if (null == namespaces) { | ||
storage.removeItem('debug'); | ||
} else { | ||
storage.debug = namespaces; | ||
} | ||
} catch(e) {} | ||
} | ||
/** | ||
* Load `namespaces`. | ||
* | ||
* @return {String} returns the previously persisted debug modes | ||
* @api private | ||
*/ | ||
function load() { | ||
var r; | ||
try { | ||
r = storage.debug; | ||
} catch(e) {} | ||
return r; | ||
} | ||
/** | ||
* Enable namespaces listed in `localStorage.debug` initially. | ||
*/ | ||
exports.enable(load()); | ||
/** | ||
* Localstorage attempts to return the localstorage. | ||
* | ||
* This is necessary because safari throws | ||
* when a user disables cookies/localstorage | ||
* and you attempt to access it. | ||
* | ||
* @return {LocalStorage} | ||
* @api private | ||
*/ | ||
function localstorage(){ | ||
try { | ||
return window.localStorage; | ||
} catch (e) {} | ||
} | ||
/***/ }, | ||
/* 8 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
/** | ||
* This is the common logic for both the Node.js and web browser | ||
* implementations of `debug()`. | ||
* | ||
* Expose `debug()` as the module. | ||
*/ | ||
exports = module.exports = debug; | ||
exports.coerce = coerce; | ||
exports.disable = disable; | ||
exports.enable = enable; | ||
exports.enabled = enabled; | ||
exports.humanize = __webpack_require__(9); | ||
/** | ||
* The currently active debug mode names, and names to skip. | ||
*/ | ||
exports.names = []; | ||
exports.skips = []; | ||
/** | ||
* Map of special "%n" handling functions, for the debug "format" argument. | ||
* | ||
* Valid key names are a single, lowercased letter, i.e. "n". | ||
*/ | ||
exports.formatters = {}; | ||
/** | ||
* Previously assigned color. | ||
*/ | ||
var prevColor = 0; | ||
/** | ||
* Previous log timestamp. | ||
*/ | ||
var prevTime; | ||
/** | ||
* Select a color. | ||
* | ||
* @return {Number} | ||
* @api private | ||
*/ | ||
function selectColor() { | ||
return exports.colors[prevColor++ % exports.colors.length]; | ||
} | ||
/** | ||
* Create a debugger with the given `namespace`. | ||
* | ||
* @param {String} namespace | ||
* @return {Function} | ||
* @api public | ||
*/ | ||
function debug(namespace) { | ||
// define the `disabled` version | ||
function disabled() { | ||
} | ||
disabled.enabled = false; | ||
// define the `enabled` version | ||
function enabled() { | ||
var self = enabled; | ||
// set `diff` timestamp | ||
var curr = +new Date(); | ||
var ms = curr - (prevTime || curr); | ||
self.diff = ms; | ||
self.prev = prevTime; | ||
self.curr = curr; | ||
prevTime = curr; | ||
// add the `color` if not set | ||
if (null == self.useColors) self.useColors = exports.useColors(); | ||
if (null == self.color && self.useColors) self.color = selectColor(); | ||
var args = Array.prototype.slice.call(arguments); | ||
args[0] = exports.coerce(args[0]); | ||
if ('string' !== typeof args[0]) { | ||
// anything else let's inspect with %o | ||
args = ['%o'].concat(args); | ||
} | ||
// apply any `formatters` transformations | ||
var index = 0; | ||
args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { | ||
// if we encounter an escaped % then don't increase the array index | ||
if (match === '%%') return match; | ||
index++; | ||
var formatter = exports.formatters[format]; | ||
if ('function' === typeof formatter) { | ||
var val = args[index]; | ||
match = formatter.call(self, val); | ||
// now we need to remove `args[index]` since it's inlined in the `format` | ||
args.splice(index, 1); | ||
index--; | ||
} | ||
return match; | ||
}); | ||
if ('function' === typeof exports.formatArgs) { | ||
args = exports.formatArgs.apply(self, args); | ||
} | ||
var logFn = enabled.log || exports.log || console.log.bind(console); | ||
logFn.apply(self, args); | ||
} | ||
enabled.enabled = true; | ||
var fn = exports.enabled(namespace) ? enabled : disabled; | ||
fn.namespace = namespace; | ||
return fn; | ||
} | ||
/** | ||
* Enables a debug mode by namespaces. This can include modes | ||
* separated by a colon and wildcards. | ||
* | ||
* @param {String} namespaces | ||
* @api public | ||
*/ | ||
function enable(namespaces) { | ||
exports.save(namespaces); | ||
var split = (namespaces || '').split(/[\s,]+/); | ||
var len = split.length; | ||
for (var i = 0; i < len; i++) { | ||
if (!split[i]) continue; // ignore empty strings | ||
namespaces = split[i].replace(/\*/g, '.*?'); | ||
if (namespaces[0] === '-') { | ||
exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); | ||
} else { | ||
exports.names.push(new RegExp('^' + namespaces + '$')); | ||
} | ||
} | ||
} | ||
/** | ||
* Disable debug output. | ||
* | ||
* @api public | ||
*/ | ||
function disable() { | ||
exports.enable(''); | ||
} | ||
/** | ||
* Returns true if the given mode name is enabled, false otherwise. | ||
* | ||
* @param {String} name | ||
* @return {Boolean} | ||
* @api public | ||
*/ | ||
function enabled(name) { | ||
var i, len; | ||
for (i = 0, len = exports.skips.length; i < len; i++) { | ||
if (exports.skips[i].test(name)) { | ||
return false; | ||
} | ||
} | ||
for (i = 0, len = exports.names.length; i < len; i++) { | ||
if (exports.names[i].test(name)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
/** | ||
* Coerce `val`. | ||
* | ||
* @param {Mixed} val | ||
* @return {Mixed} | ||
* @api private | ||
*/ | ||
function coerce(val) { | ||
if (val instanceof Error) return val.stack || val.message; | ||
return val; | ||
} | ||
/***/ }, | ||
/* 9 */ | ||
/***/ function(module, exports) { | ||
/** | ||
* Helpers. | ||
*/ | ||
var s = 1000; | ||
var m = s * 60; | ||
var h = m * 60; | ||
var d = h * 24; | ||
var y = d * 365.25; | ||
/** | ||
* Parse or format the given `val`. | ||
* | ||
* Options: | ||
* | ||
* - `long` verbose formatting [false] | ||
* | ||
* @param {String|Number} val | ||
* @param {Object} options | ||
* @return {String|Number} | ||
* @api public | ||
*/ | ||
module.exports = function(val, options){ | ||
options = options || {}; | ||
if ('string' == typeof val) return parse(val); | ||
return options.long | ||
? long(val) | ||
: short(val); | ||
}; | ||
/** | ||
* Parse the given `str` and return milliseconds. | ||
* | ||
* @param {String} str | ||
* @return {Number} | ||
* @api private | ||
*/ | ||
function parse(str) { | ||
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); | ||
if (!match) return; | ||
var n = parseFloat(match[1]); | ||
var type = (match[2] || 'ms').toLowerCase(); | ||
switch (type) { | ||
case 'years': | ||
case 'year': | ||
case 'yrs': | ||
case 'yr': | ||
case 'y': | ||
return n * y; | ||
case 'days': | ||
case 'day': | ||
case 'd': | ||
return n * d; | ||
case 'hours': | ||
case 'hour': | ||
case 'hrs': | ||
case 'hr': | ||
case 'h': | ||
return n * h; | ||
case 'minutes': | ||
case 'minute': | ||
case 'mins': | ||
case 'min': | ||
case 'm': | ||
return n * m; | ||
case 'seconds': | ||
case 'second': | ||
case 'secs': | ||
case 'sec': | ||
case 's': | ||
return n * s; | ||
case 'milliseconds': | ||
case 'millisecond': | ||
case 'msecs': | ||
case 'msec': | ||
case 'ms': | ||
return n; | ||
} | ||
} | ||
/** | ||
* Short format for `ms`. | ||
* | ||
* @param {Number} ms | ||
* @return {String} | ||
* @api private | ||
*/ | ||
function short(ms) { | ||
if (ms >= d) return Math.round(ms / d) + 'd'; | ||
if (ms >= h) return Math.round(ms / h) + 'h'; | ||
if (ms >= m) return Math.round(ms / m) + 'm'; | ||
if (ms >= s) return Math.round(ms / s) + 's'; | ||
return ms + 'ms'; | ||
} | ||
/** | ||
* Long format for `ms`. | ||
* | ||
* @param {Number} ms | ||
* @return {String} | ||
* @api private | ||
*/ | ||
function long(ms) { | ||
return plural(ms, d, 'day') | ||
|| plural(ms, h, 'hour') | ||
|| plural(ms, m, 'minute') | ||
|| plural(ms, s, 'second') | ||
|| ms + ' ms'; | ||
} | ||
/** | ||
* Pluralization helper. | ||
*/ | ||
function plural(ms, n, name) { | ||
if (ms < n) return; | ||
if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; | ||
return Math.ceil(ms / n) + ' ' + name + 's'; | ||
} | ||
/***/ }, | ||
/* 10 */ | ||
/***/ function(module, exports) { | ||
/** | ||
* Copyright 2013-2014 Facebook, Inc. | ||
@@ -1522,3 +1038,3 @@ * | ||
/***/ }, | ||
/* 11 */ | ||
/* 8 */ | ||
/***/ function(module, exports) { | ||
@@ -1530,7 +1046,7 @@ | ||
var s = 1000; | ||
var m = s * 60; | ||
var h = m * 60; | ||
var d = h * 24; | ||
var y = d * 365.25; | ||
var s = 1000 | ||
var m = s * 60 | ||
var h = m * 60 | ||
var d = h * 24 | ||
var y = d * 365.25 | ||
@@ -1546,2 +1062,3 @@ /** | ||
* @param {Object} options | ||
* @throws {Error} throw an error if val is not a non-empty string or a number | ||
* @return {String|Number} | ||
@@ -1551,9 +1068,14 @@ * @api public | ||
module.exports = function(val, options){ | ||
options = options || {}; | ||
if ('string' == typeof val) return parse(val); | ||
return options.long | ||
? long(val) | ||
: short(val); | ||
}; | ||
module.exports = function (val, options) { | ||
options = options || {} | ||
var type = typeof val | ||
if (type === 'string' && val.length > 0) { | ||
return parse(val) | ||
} else if (type === 'number' && isNaN(val) === false) { | ||
return options.long ? | ||
fmtLong(val) : | ||
fmtShort(val) | ||
} | ||
throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val)) | ||
} | ||
@@ -1569,8 +1091,12 @@ /** | ||
function parse(str) { | ||
str = '' + str; | ||
if (str.length > 10000) return; | ||
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); | ||
if (!match) return; | ||
var n = parseFloat(match[1]); | ||
var type = (match[2] || 'ms').toLowerCase(); | ||
str = String(str) | ||
if (str.length > 10000) { | ||
return | ||
} | ||
var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str) | ||
if (!match) { | ||
return | ||
} | ||
var n = parseFloat(match[1]) | ||
var type = (match[2] || 'ms').toLowerCase() | ||
switch (type) { | ||
@@ -1582,7 +1108,7 @@ case 'years': | ||
case 'y': | ||
return n * y; | ||
return n * y | ||
case 'days': | ||
case 'day': | ||
case 'd': | ||
return n * d; | ||
return n * d | ||
case 'hours': | ||
@@ -1593,3 +1119,3 @@ case 'hour': | ||
case 'h': | ||
return n * h; | ||
return n * h | ||
case 'minutes': | ||
@@ -1600,3 +1126,3 @@ case 'minute': | ||
case 'm': | ||
return n * m; | ||
return n * m | ||
case 'seconds': | ||
@@ -1607,3 +1133,3 @@ case 'second': | ||
case 's': | ||
return n * s; | ||
return n * s | ||
case 'milliseconds': | ||
@@ -1614,3 +1140,5 @@ case 'millisecond': | ||
case 'ms': | ||
return n; | ||
return n | ||
default: | ||
return undefined | ||
} | ||
@@ -1627,8 +1155,16 @@ } | ||
function short(ms) { | ||
if (ms >= d) return Math.round(ms / d) + 'd'; | ||
if (ms >= h) return Math.round(ms / h) + 'h'; | ||
if (ms >= m) return Math.round(ms / m) + 'm'; | ||
if (ms >= s) return Math.round(ms / s) + 's'; | ||
return ms + 'ms'; | ||
function fmtShort(ms) { | ||
if (ms >= d) { | ||
return Math.round(ms / d) + 'd' | ||
} | ||
if (ms >= h) { | ||
return Math.round(ms / h) + 'h' | ||
} | ||
if (ms >= m) { | ||
return Math.round(ms / m) + 'm' | ||
} | ||
if (ms >= s) { | ||
return Math.round(ms / s) + 's' | ||
} | ||
return ms + 'ms' | ||
} | ||
@@ -1644,8 +1180,8 @@ | ||
function long(ms) { | ||
return plural(ms, d, 'day') | ||
|| plural(ms, h, 'hour') | ||
|| plural(ms, m, 'minute') | ||
|| plural(ms, s, 'second') | ||
|| ms + ' ms'; | ||
function fmtLong(ms) { | ||
return plural(ms, d, 'day') || | ||
plural(ms, h, 'hour') || | ||
plural(ms, m, 'minute') || | ||
plural(ms, s, 'second') || | ||
ms + ' ms' | ||
} | ||
@@ -1658,8 +1194,198 @@ | ||
function plural(ms, n, name) { | ||
if (ms < n) return; | ||
if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; | ||
return Math.ceil(ms / n) + ' ' + name + 's'; | ||
if (ms < n) { | ||
return | ||
} | ||
if (ms < n * 1.5) { | ||
return Math.floor(ms / n) + ' ' + name | ||
} | ||
return Math.ceil(ms / n) + ' ' + name + 's' | ||
} | ||
/***/ }, | ||
/* 9 */ | ||
/***/ function(module, exports) { | ||
// shim for using process in browser | ||
var process = module.exports = {}; | ||
// cached from whatever global is present so that test runners that stub it | ||
// don't break things. But we need to wrap it in a try catch in case it is | ||
// wrapped in strict mode code which doesn't define any globals. It's inside a | ||
// function because try/catches deoptimize in certain engines. | ||
var cachedSetTimeout; | ||
var cachedClearTimeout; | ||
function defaultSetTimout() { | ||
throw new Error('setTimeout has not been defined'); | ||
} | ||
function defaultClearTimeout () { | ||
throw new Error('clearTimeout has not been defined'); | ||
} | ||
(function () { | ||
try { | ||
if (typeof setTimeout === 'function') { | ||
cachedSetTimeout = setTimeout; | ||
} else { | ||
cachedSetTimeout = defaultSetTimout; | ||
} | ||
} catch (e) { | ||
cachedSetTimeout = defaultSetTimout; | ||
} | ||
try { | ||
if (typeof clearTimeout === 'function') { | ||
cachedClearTimeout = clearTimeout; | ||
} else { | ||
cachedClearTimeout = defaultClearTimeout; | ||
} | ||
} catch (e) { | ||
cachedClearTimeout = defaultClearTimeout; | ||
} | ||
} ()) | ||
function runTimeout(fun) { | ||
if (cachedSetTimeout === setTimeout) { | ||
//normal enviroments in sane situations | ||
return setTimeout(fun, 0); | ||
} | ||
// if setTimeout wasn't available but was latter defined | ||
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { | ||
cachedSetTimeout = setTimeout; | ||
return setTimeout(fun, 0); | ||
} | ||
try { | ||
// when when somebody has screwed with setTimeout but no I.E. maddness | ||
return cachedSetTimeout(fun, 0); | ||
} catch(e){ | ||
try { | ||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | ||
return cachedSetTimeout.call(null, fun, 0); | ||
} catch(e){ | ||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error | ||
return cachedSetTimeout.call(this, fun, 0); | ||
} | ||
} | ||
} | ||
function runClearTimeout(marker) { | ||
if (cachedClearTimeout === clearTimeout) { | ||
//normal enviroments in sane situations | ||
return clearTimeout(marker); | ||
} | ||
// if clearTimeout wasn't available but was latter defined | ||
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { | ||
cachedClearTimeout = clearTimeout; | ||
return clearTimeout(marker); | ||
} | ||
try { | ||
// when when somebody has screwed with setTimeout but no I.E. maddness | ||
return cachedClearTimeout(marker); | ||
} catch (e){ | ||
try { | ||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | ||
return cachedClearTimeout.call(null, marker); | ||
} catch (e){ | ||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. | ||
// Some versions of I.E. have different rules for clearTimeout vs setTimeout | ||
return cachedClearTimeout.call(this, marker); | ||
} | ||
} | ||
} | ||
var queue = []; | ||
var draining = false; | ||
var currentQueue; | ||
var queueIndex = -1; | ||
function cleanUpNextTick() { | ||
if (!draining || !currentQueue) { | ||
return; | ||
} | ||
draining = false; | ||
if (currentQueue.length) { | ||
queue = currentQueue.concat(queue); | ||
} else { | ||
queueIndex = -1; | ||
} | ||
if (queue.length) { | ||
drainQueue(); | ||
} | ||
} | ||
function drainQueue() { | ||
if (draining) { | ||
return; | ||
} | ||
var timeout = runTimeout(cleanUpNextTick); | ||
draining = true; | ||
var len = queue.length; | ||
while(len) { | ||
currentQueue = queue; | ||
queue = []; | ||
while (++queueIndex < len) { | ||
if (currentQueue) { | ||
currentQueue[queueIndex].run(); | ||
} | ||
} | ||
queueIndex = -1; | ||
len = queue.length; | ||
} | ||
currentQueue = null; | ||
draining = false; | ||
runClearTimeout(timeout); | ||
} | ||
process.nextTick = function (fun) { | ||
var args = new Array(arguments.length - 1); | ||
if (arguments.length > 1) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
args[i - 1] = arguments[i]; | ||
} | ||
} | ||
queue.push(new Item(fun, args)); | ||
if (queue.length === 1 && !draining) { | ||
runTimeout(drainQueue); | ||
} | ||
}; | ||
// v8 likes predictible objects | ||
function Item(fun, array) { | ||
this.fun = fun; | ||
this.array = array; | ||
} | ||
Item.prototype.run = function () { | ||
this.fun.apply(null, this.array); | ||
}; | ||
process.title = 'browser'; | ||
process.browser = true; | ||
process.env = {}; | ||
process.argv = []; | ||
process.version = ''; // empty string to avoid regexp issues | ||
process.versions = {}; | ||
function noop() {} | ||
process.on = noop; | ||
process.addListener = noop; | ||
process.once = noop; | ||
process.off = noop; | ||
process.removeListener = noop; | ||
process.removeAllListeners = noop; | ||
process.emit = noop; | ||
process.binding = function (name) { | ||
throw new Error('process.binding is not supported'); | ||
}; | ||
process.cwd = function () { return '/' }; | ||
process.chdir = function (dir) { | ||
throw new Error('process.chdir is not supported'); | ||
}; | ||
process.umask = function() { return 0; }; | ||
/***/ } | ||
@@ -1666,0 +1392,0 @@ /******/ ]) |
/* | ||
* React-Vimeo - React component to load video from Vimeo | ||
* @version v0.2.2 | ||
* @version v1.0.0 | ||
* @link https://github.com/freecodecamp/react-vimeo | ||
@@ -8,2 +8,2 @@ * @license MIT | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactVimeo=t(require("react")):e.ReactVimeo=t(e.React)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(){var e=arguments.length<=0||void 0===arguments[0]?"":arguments[0];return e.charAt(0).toUpperCase()+e.substring(1)}function s(e,t){return t["on"+o(e)]||function(){}}function a(e,t,n,r){try{n.contentWindow.postMessage({method:e,value:t},r)}catch(o){return o}return null}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),c=r(i),u=n(10),l=r(u),f=n(6),p=r(f),d=n(4),m=r(d),h=n(2),g=r(h),y=n(3),v=r(y),b=(0,m["default"])("vimeo:player"),w=function(){},x=(0,l["default"])({cuechange:null,finish:null,loadProgress:null,pause:null,play:null,playProgress:null,seek:null});t["default"]=c["default"].createClass({displayName:"Vimeo",propTypes:{className:i.PropTypes.string,loading:i.PropTypes.element,onCuechange:i.PropTypes.func,onError:i.PropTypes.func,onFinish:i.PropTypes.func,onLoadProgress:i.PropTypes.func,onPause:i.PropTypes.func,onPlay:i.PropTypes.func,onPlayProgress:i.PropTypes.func,onReady:i.PropTypes.func,onSeek:i.PropTypes.func,playButton:i.PropTypes.node,videoId:i.PropTypes.string.isRequired,playerOptions:i.PropTypes.object,autoplay:i.PropTypes.bool},getDefaultProps:function(){var e=Object.keys(x).concat(["ready"]).reduce(function(e,t){return e["on"+o(t)]=w,e},{});return e.className="vimeo",e.playerOptions={autoplay:1},e.autoplay=!1,e},getInitialState:function(){return{imageLoaded:!1,playerOrigin:"*",showingVideo:this.props.autoplay,thumb:null}},componentWillReceiveProps:function(e){e.videoId!==this.props.videoId&&this.setState({thumb:null,imageLoaded:!1,showingVideo:!1})},componentDidMount:function(){this.fetchVimeoData()},componentDidUpdate:function(){this.fetchVimeoData()},componentWillUnmount:function(){var e,t="undefined"!=typeof window?(e=window).removeEventListener.bind(e):w;t("message",this.onMessage)},addMessageListener:function(){var e,t="undefined"!=typeof window?(e=window).addEventListener.bind(e):w;t("message",this.onMessage)},onError:function(e){throw this.props.onError&&this.props.onError(e),e},onMessage:function(e){var t=e.origin,n=e.data,r=this.props.onReady,o=this.state.playerOrigin;if("*"===o&&this.setState({playerOrigin:t}),!/^https?:\/\/player.vimeo.com/.test(t))return!1;if("string"==typeof n)try{n=JSON.parse(n)}catch(a){b("error parsing message",a),n={event:""}}if("ready"===n.event){var i=this.refs.player;return b("player ready"),this.onReady(i,"*"===o?t:o),r(n)}s(n.event,this.props)(n)},onReady:function(e,t){var n=this;Object.keys(x).forEach(function(r){var o=a("addEventListener",r,e,t);o&&n.onError(o)})},playVideo:function(e){e.preventDefault(),this.setState({showingVideo:!0})},getIframeUrl:function(){var e=this.props.videoId,t=this.getIframeUrlQuery();return"//player.vimeo.com/video/"+e+"?"+t},getIframeUrlQuery:function(){var e=this,t=[];return Object.keys(this.props.playerOptions).forEach(function(n){t.push(n+"="+e.props.playerOptions[n])}),t.join("&")},fetchVimeoData:function(){var e=this;if(!this.state.imageLoaded){var t=this.props.videoId;(0,p["default"])("//vimeo.com/api/v2/video/"+t+".json",{prefix:"vimeo"},function(t,n){t&&(b("jsonp err: ",t.message),e.onError(t)),b("jsonp response",n),e.setState({thumb:n[0].thumbnail_large,imageLoaded:!0})})}},renderImage:function(){if(!this.state.showingVideo&&this.state.imageLoaded){var e={backgroundImage:"url("+this.state.thumb+")",display:this.state.showingVideo?"none":"block",height:"100%",width:"100%"},t=this.props.playButton?(0,i.cloneElement)(this.props.playButton,{onClick:this.playVideo}):c["default"].createElement(g["default"],{onClick:this.playVideo});return c["default"].createElement("div",{className:"vimeo-image",style:e},t)}},renderIframe:function(){if(this.state.showingVideo){this.addMessageListener();var e={display:this.state.showingVideo?"block":"none",height:"100%",width:"100%"};return c["default"].createElement("div",{className:"vimeo-embed",style:e},c["default"].createElement("iframe",{frameBorder:"0",ref:"player",src:this.getIframeUrl()}))}},renderLoading:function(e,t){if(!e)return t?t:c["default"].createElement(v["default"],null)},render:function(){return c["default"].createElement("div",{className:this.props.className},this.renderLoading(this.state.imageLoaded,this.props.loading),this.renderImage(),this.renderIframe())}}),e.exports=t["default"]},function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),s=r(o);t["default"]=s["default"].createClass({displayName:"PlayButton",propTypes:{onClick:s["default"].PropTypes.func},render:function(){return s["default"].createElement("button",{className:"vimeo-play-button",onClick:this.props.onClick,type:"button"},s["default"].createElement("svg",{version:"1.1",viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg"},s["default"].createElement("path",{d:"M79.674,53.719c2.59-2.046,2.59-5.392,0-7.437L22.566,1.053C19.977-0.993,18,0.035,18,3.335v93.331c0,3.3,1.977,4.326,4.566,2.281L79.674,53.719z"})))}}),e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),s=r(o);t["default"]=s["default"].createClass({displayName:"Spinner",render:function(){return s["default"].createElement("div",{className:"vimeo-loading"},s["default"].createElement("svg",{height:"32",viewBox:"0 0 32 32",width:"32",xmlns:"http://www.w3.org/2000/svg"},s["default"].createElement("path",{d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4",opacity:".25"}),s["default"].createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}}),e.exports=t["default"]},function(e,t,n){function r(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function o(){var e=arguments,n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var o=0,s=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(o++,"%c"===e&&(s=o))}),e.splice(s,0,r),e}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(n){}}function i(){var e;try{e=t.storage.debug}catch(n){}return e}function c(){try{return window.localStorage}catch(e){}}t=e.exports=n(5),t.log=s,t.formatArgs=o,t.save=a,t.load=i,t.useColors=r,t.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:c(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){return JSON.stringify(e)},t.enable(i())},function(e,t,n){function r(){return t.colors[l++%t.colors.length]}function o(e){function n(){}function o(){var e=o,n=+new Date,s=n-(u||n);e.diff=s,e.prev=u,e.curr=n,u=n,null==e.useColors&&(e.useColors=t.useColors()),null==e.color&&e.useColors&&(e.color=r());var a=Array.prototype.slice.call(arguments);a[0]=t.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var i=0;a[0]=a[0].replace(/%([a-z%])/g,function(n,r){if("%%"===n)return n;i++;var o=t.formatters[r];if("function"==typeof o){var s=a[i];n=o.call(e,s),a.splice(i,1),i--}return n}),"function"==typeof t.formatArgs&&(a=t.formatArgs.apply(e,a));var c=o.log||t.log||console.log.bind(console);c.apply(e,a)}n.enabled=!1,o.enabled=!0;var s=t.enabled(e)?o:n;return s.namespace=e,s}function s(e){t.save(e);for(var n=(e||"").split(/[\s,]+/),r=n.length,o=0;o<r;o++)n[o]&&(e=n[o].replace(/\*/g,".*?"),"-"===e[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))}function a(){t.enable("")}function i(e){var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}t=e.exports=o,t.coerce=c,t.disable=a,t.enable=s,t.enabled=i,t.humanize=n(11),t.names=[],t.skips=[],t.formatters={};var u,l=0},function(e,t,n){function r(){}function o(e,t,n){function o(){c.parentNode&&c.parentNode.removeChild(c),window[f]=r,u&&clearTimeout(u)}function i(){window[f]&&o()}"function"==typeof t&&(n=t,t={}),t||(t={});var c,u,l=t.prefix||"__jp",f=t.name||l+a++,p=t.param||"callback",d=null!=t.timeout?t.timeout:6e4,m=encodeURIComponent,h=document.getElementsByTagName("script")[0]||document.head;return d&&(u=setTimeout(function(){o(),n&&n(new Error("Timeout"))},d)),window[f]=function(e){s("jsonp got",e),o(),n&&n(null,e)},e+=(~e.indexOf("?")?"&":"?")+p+"="+m(f),e=e.replace("?&","?"),s('jsonp req "%s"',e),c=document.createElement("script"),c.src=e,h.parentNode.insertBefore(c,h),i}var s=n(7)("jsonp");e.exports=o;var a=0},function(e,t,n){function r(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function o(){var e=arguments,n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var o=0,s=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(o++,"%c"===e&&(s=o))}),e.splice(s,0,r),e}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?u.removeItem("debug"):u.debug=e}catch(t){}}function i(){var e;try{e=u.debug}catch(t){}return e}function c(){try{return window.localStorage}catch(e){}}t=e.exports=n(8),t.log=s,t.formatArgs=o,t.save=a,t.load=i,t.useColors=r;var u;u="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:c(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){return JSON.stringify(e)},t.enable(i())},function(e,t,n){function r(){return t.colors[l++%t.colors.length]}function o(e){function n(){}function o(){var e=o,n=+new Date,s=n-(u||n);e.diff=s,e.prev=u,e.curr=n,u=n,null==e.useColors&&(e.useColors=t.useColors()),null==e.color&&e.useColors&&(e.color=r());var a=Array.prototype.slice.call(arguments);a[0]=t.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var i=0;a[0]=a[0].replace(/%([a-z%])/g,function(n,r){if("%%"===n)return n;i++;var o=t.formatters[r];if("function"==typeof o){var s=a[i];n=o.call(e,s),a.splice(i,1),i--}return n}),"function"==typeof t.formatArgs&&(a=t.formatArgs.apply(e,a));var c=o.log||t.log||console.log.bind(console);c.apply(e,a)}n.enabled=!1,o.enabled=!0;var s=t.enabled(e)?o:n;return s.namespace=e,s}function s(e){t.save(e);for(var n=(e||"").split(/[\s,]+/),r=n.length,o=0;o<r;o++)n[o]&&(e=n[o].replace(/\*/g,".*?"),"-"===e[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))}function a(){t.enable("")}function i(e){var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}t=e.exports=o,t.coerce=c,t.disable=a,t.enable=s,t.enabled=i,t.humanize=n(9),t.names=[],t.skips=[],t.formatters={};var u,l=0},function(e,t){function n(e){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*u;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*i;case"seconds":case"second":case"secs":case"sec":case"s":return n*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}function r(e){return e>=u?Math.round(e/u)+"d":e>=c?Math.round(e/c)+"h":e>=i?Math.round(e/i)+"m":e>=a?Math.round(e/a)+"s":e+"ms"}function o(e){return s(e,u,"day")||s(e,c,"hour")||s(e,i,"minute")||s(e,a,"second")||e+" ms"}function s(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}var a=1e3,i=60*a,c=60*i,u=24*c,l=365.25*u;e.exports=function(e,t){return t=t||{},"string"==typeof e?n(e):t["long"]?o(e):r(e)}},function(e,t){"use strict";var n=function(e){var t,n={};if(!(e instanceof Object)||Array.isArray(e))throw new Error("keyMirror(...): Argument must be an object.");for(t in e)e.hasOwnProperty(t)&&(n[t]=t);return n};e.exports=n},function(e,t){function n(e){if(e=""+e,!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*u;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*i;case"seconds":case"second":case"secs":case"sec":case"s":return n*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function r(e){return e>=u?Math.round(e/u)+"d":e>=c?Math.round(e/c)+"h":e>=i?Math.round(e/i)+"m":e>=a?Math.round(e/a)+"s":e+"ms"}function o(e){return s(e,u,"day")||s(e,c,"hour")||s(e,i,"minute")||s(e,a,"second")||e+" ms"}function s(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}var a=1e3,i=60*a,c=60*i,u=24*c,l=365.25*u;e.exports=function(e,t){return t=t||{},"string"==typeof e?n(e):t["long"]?o(e):r(e)}}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactVimeo=t(require("react")):e.ReactVimeo=t(e.React)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e.charAt(0).toUpperCase()+e.substring(1)}function a(e,t){return t["on"+o(e)]||function(){}}function s(e,t,n,r){try{n.contentWindow.postMessage({method:e,value:t},r)}catch(e){return e}return null}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),u=r(i),c=n(7),l=r(c),f=n(6),d=r(f),p=n(2),m=r(p),h=n(3),y=r(h),g=n(4),v=r(g),w=(0,m.default)("vimeo:player"),b=function(){},T=(0,l.default)({cueChange:null,ended:null,loaded:null,pause:null,play:null,progress:null,seeked:null,textTrackChange:null,timeUpdate:null,volumeChange:null});t.default=u.default.createClass({displayName:"Vimeo",propTypes:{autoplay:i.PropTypes.bool,className:i.PropTypes.string,loading:i.PropTypes.element,playButton:i.PropTypes.node,playerOptions:i.PropTypes.object,videoId:i.PropTypes.string.isRequired,onCueChange:i.PropTypes.func,onEnded:i.PropTypes.func,onError:i.PropTypes.func,onLoaded:i.PropTypes.func,onPause:i.PropTypes.func,onPlay:i.PropTypes.func,onProgress:i.PropTypes.func,onReady:i.PropTypes.func,onSeeked:i.PropTypes.func,onTextTrackChanged:i.PropTypes.func,onTimeUpdate:i.PropTypes.func,onVolumeChange:i.PropTypes.func},getDefaultProps:function(){var e=Object.keys(T).concat(["ready"]).reduce(function(e,t){return e["on"+o(t)]=b,e},{});return e.className="vimeo",e.playerOptions={autoplay:1},e.autoplay=!1,e},getInitialState:function(){return{imageLoaded:!1,playerOrigin:"*",showingVideo:this.props.autoplay,thumb:null}},componentWillReceiveProps:function(e){e.videoId!==this.props.videoId&&this.setState({thumb:null,imageLoaded:!1,showingVideo:!1})},componentDidMount:function(){this.fetchVimeoData()},componentDidUpdate:function(){this.fetchVimeoData()},componentWillUnmount:function(){var e,t="undefined"!=typeof window?(e=window).removeEventListener.bind(e):b;t("message",this.onMessage)},addMessageListener:function(){var e,t="undefined"!=typeof window?(e=window).addEventListener.bind(e):b;t("message",this.onMessage)},onError:function(e){throw this.props.onError&&this.props.onError(e),e},onMessage:function(e){var t=e.origin,n=e.data,r=this.props.onReady,o=this.state.playerOrigin;if("*"===o&&this.setState({playerOrigin:t}),!/^https?:\/\/player.vimeo.com/.test(t))return!1;if("string"==typeof n)try{n=JSON.parse(n)}catch(e){w("error parsing message",e),n={event:""}}if("ready"===n.event){var s=this.refs.player;return w("player ready"),this.onReady(s,"*"===o?t:o),r(n)}n.event&&(w("firing event: ",n.event),a(n.event,this.props)(n))},onReady:function(e,t){var n=this;Object.keys(T).forEach(function(r){var o=s("addEventListener",r.toLowerCase(),e,t);o&&n.onError(o)})},playVideo:function(e){e.preventDefault(),this.setState({showingVideo:!0})},getIframeUrl:function(){var e=this.props.videoId,t=this.getIframeUrlQuery();return"//player.vimeo.com/video/"+e+"?"+t},getIframeUrlQuery:function(){var e=this,t=[];return Object.keys(this.props.playerOptions).forEach(function(n){t.push(n+"="+e.props.playerOptions[n])}),t.join("&")},fetchVimeoData:function(){var e=this;if(!this.state.imageLoaded){var t=this.props.videoId;(0,d.default)("//vimeo.com/api/v2/video/"+t+".json",{prefix:"vimeo"},function(t,n){t&&(w("jsonp err: ",t.message),e.onError(t)),w("jsonp response",n),e.setState({thumb:n[0].thumbnail_large,imageLoaded:!0})})}},renderImage:function(){if(!this.state.showingVideo&&this.state.imageLoaded){var e={backgroundImage:"url("+this.state.thumb+")",display:this.state.showingVideo?"none":"block",height:"100%",width:"100%"},t=this.props.playButton?(0,i.cloneElement)(this.props.playButton,{onClick:this.playVideo}):u.default.createElement(y.default,{onClick:this.playVideo});return u.default.createElement("div",{className:"vimeo-image",style:e},t)}},renderIframe:function(){if(this.state.showingVideo){this.addMessageListener();var e={display:this.state.showingVideo?"block":"none",height:"100%",width:"100%"};return u.default.createElement("div",{className:"vimeo-embed",style:e},u.default.createElement("iframe",{frameBorder:"0",ref:"player",src:this.getIframeUrl()}))}},renderLoading:function(e,t){if(!e)return t?t:u.default.createElement(v.default,null)},render:function(){return u.default.createElement("div",{className:this.props.className},this.renderLoading(this.state.imageLoaded,this.props.loading),this.renderImage(),this.renderIframe())}}),e.exports=t.default},function(t,n){t.exports=e},function(e,t,n){(function(r){function o(){return"undefined"!=typeof document&&"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function a(){var e=arguments,n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var o=0,a=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(o++,"%c"===e&&(a=o))}),e.splice(a,0,r),e}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function i(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}}function u(){try{return t.storage.debug}catch(e){}if("undefined"!=typeof r&&"env"in r)return r.env.DEBUG}function c(){try{return window.localStorage}catch(e){}}t=e.exports=n(5),t.log=s,t.formatArgs=a,t.save=i,t.load=u,t.useColors=o,t.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:c(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(u())}).call(t,n(9))},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),a=r(o);t.default=a.default.createClass({displayName:"PlayButton",propTypes:{onClick:a.default.PropTypes.func},render:function(){return a.default.createElement("button",{className:"vimeo-play-button",onClick:this.props.onClick,type:"button"},a.default.createElement("svg",{version:"1.1",viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg"},a.default.createElement("path",{d:"M79.674,53.719c2.59-2.046,2.59-5.392,0-7.437L22.566,1.053C19.977-0.993,18,0.035,18,3.335v93.331c0,3.3,1.977,4.326,4.566,2.281L79.674,53.719z"})))}}),e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),a=r(o);t.default=a.default.createClass({displayName:"Spinner",render:function(){return a.default.createElement("div",{className:"vimeo-loading"},a.default.createElement("svg",{height:"32",viewBox:"0 0 32 32",width:"32",xmlns:"http://www.w3.org/2000/svg"},a.default.createElement("path",{d:"M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4",opacity:".25"}),a.default.createElement("path",{d:"M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z"})))}}),e.exports=t.default},function(e,t,n){function r(){return t.colors[l++%t.colors.length]}function o(e){function n(){}function o(){var e=o,n=+new Date,a=n-(c||n);e.diff=a,e.prev=c,e.curr=n,c=n,null==e.useColors&&(e.useColors=t.useColors()),null==e.color&&e.useColors&&(e.color=r());for(var s=new Array(arguments.length),i=0;i<s.length;i++)s[i]=arguments[i];s[0]=t.coerce(s[0]),"string"!=typeof s[0]&&(s=["%o"].concat(s));var u=0;s[0]=s[0].replace(/%([a-z%])/g,function(n,r){if("%%"===n)return n;u++;var o=t.formatters[r];if("function"==typeof o){var a=s[u];n=o.call(e,a),s.splice(u,1),u--}return n}),s=t.formatArgs.apply(e,s);var l=o.log||t.log||console.log.bind(console);l.apply(e,s)}n.enabled=!1,o.enabled=!0;var a=t.enabled(e)?o:n;return a.namespace=e,a}function a(e){t.save(e);for(var n=(e||"").split(/[\s,]+/),r=n.length,o=0;o<r;o++)n[o]&&(e=n[o].replace(/[\\^$+?.()|[\]{}]/g,"\\$&").replace(/\*/g,".*?"),"-"===e[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))}function s(){t.enable("")}function i(e){var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1}function u(e){return e instanceof Error?e.stack||e.message:e}t=e.exports=o.debug=o,t.coerce=u,t.disable=s,t.enable=a,t.enabled=i,t.humanize=n(8),t.names=[],t.skips=[],t.formatters={};var c,l=0},function(e,t,n){function r(){}function o(e,t,n){function o(){u.parentNode&&u.parentNode.removeChild(u),window[f]=r,c&&clearTimeout(c)}function i(){window[f]&&o()}"function"==typeof t&&(n=t,t={}),t||(t={});var u,c,l=t.prefix||"__jp",f=t.name||l+s++,d=t.param||"callback",p=null!=t.timeout?t.timeout:6e4,m=encodeURIComponent,h=document.getElementsByTagName("script")[0]||document.head;return p&&(c=setTimeout(function(){o(),n&&n(new Error("Timeout"))},p)),window[f]=function(e){a("jsonp got",e),o(),n&&n(null,e)},e+=(~e.indexOf("?")?"&":"?")+d+"="+m(f),e=e.replace("?&","?"),a('jsonp req "%s"',e),u=document.createElement("script"),u.src=e,h.parentNode.insertBefore(u,h),i}var a=n(2)("jsonp");e.exports=o;var s=0},function(e,t){"use strict";var n=function(e){var t,n={};if(!(e instanceof Object)||Array.isArray(e))throw new Error("keyMirror(...): Argument must be an object.");for(t in e)e.hasOwnProperty(t)&&(n[t]=t);return n};e.exports=n},function(e,t){function n(e){if(e=String(e),!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*c;case"hours":case"hour":case"hrs":case"hr":case"h":return n*u;case"minutes":case"minute":case"mins":case"min":case"m":return n*i;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function r(e){return e>=c?Math.round(e/c)+"d":e>=u?Math.round(e/u)+"h":e>=i?Math.round(e/i)+"m":e>=s?Math.round(e/s)+"s":e+"ms"}function o(e){return a(e,c,"day")||a(e,u,"hour")||a(e,i,"minute")||a(e,s,"second")||e+" ms"}function a(e,t,n){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}var s=1e3,i=60*s,u=60*i,c=24*u,l=365.25*c;e.exports=function(e,t){t=t||{};var a=typeof e;if("string"===a&&e.length>0)return n(e);if("number"===a&&isNaN(e)===!1)return t.long?o(e):r(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(l===setTimeout)return setTimeout(e,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(e,0);try{return l(e,0)}catch(t){try{return l.call(null,e,0)}catch(t){return l.call(this,e,0)}}}function a(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function s(){h&&p&&(h=!1,p.length?m=p.concat(m):y=-1,m.length&&i())}function i(){if(!h){var e=o(s);h=!0;for(var t=m.length;t;){for(p=m,m=[];++y<t;)p&&p[y].run();y=-1,t=m.length}p=null,h=!1,a(e)}}function u(e,t){this.fun=e,this.array=t}function c(){}var l,f,d=e.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(e){l=n}try{f="function"==typeof clearTimeout?clearTimeout:r}catch(e){f=r}}();var p,m=[],h=!1,y=-1;d.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];m.push(new u(e,t)),1!==m.length||h||o(i)},u.prototype.run=function(){this.fun.apply(null,this.array)},d.title="browser",d.browser=!0,d.env={},d.argv=[],d.version="",d.versions={},d.on=c,d.addListener=c,d.once=c,d.off=c,d.removeListener=c,d.removeAllListeners=c,d.emit=c,d.binding=function(e){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(e){throw new Error("process.chdir is not supported")},d.umask=function(){return 0}}])}); |
@@ -36,13 +36,16 @@ 'use strict'; | ||
var playerEvents = (0, _keymirror2.default)({ | ||
cuechange: null, | ||
finish: null, | ||
loadProgress: null, | ||
cueChange: null, | ||
ended: null, | ||
loaded: null, | ||
pause: null, | ||
play: null, | ||
playProgress: null, | ||
seek: null | ||
progress: null, | ||
seeked: null, | ||
textTrackChange: null, | ||
timeUpdate: null, | ||
volumeChange: null | ||
}); | ||
function capitalize() { | ||
var str = arguments.length <= 0 || arguments[0] === undefined ? '' : arguments[0]; | ||
var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; | ||
@@ -69,17 +72,22 @@ return str.charAt(0).toUpperCase() + str.substring(1); | ||
propTypes: { | ||
autoplay: _react.PropTypes.bool, | ||
className: _react.PropTypes.string, | ||
loading: _react.PropTypes.element, | ||
onCuechange: _react.PropTypes.func, | ||
playButton: _react.PropTypes.node, | ||
playerOptions: _react.PropTypes.object, | ||
videoId: _react.PropTypes.string.isRequired, | ||
// event callbacks | ||
onCueChange: _react.PropTypes.func, | ||
onEnded: _react.PropTypes.func, | ||
onError: _react.PropTypes.func, | ||
onFinish: _react.PropTypes.func, | ||
onLoadProgress: _react.PropTypes.func, | ||
onLoaded: _react.PropTypes.func, | ||
onPause: _react.PropTypes.func, | ||
onPlay: _react.PropTypes.func, | ||
onPlayProgress: _react.PropTypes.func, | ||
onProgress: _react.PropTypes.func, | ||
onReady: _react.PropTypes.func, | ||
onSeek: _react.PropTypes.func, | ||
playButton: _react.PropTypes.node, | ||
videoId: _react.PropTypes.string.isRequired, | ||
playerOptions: _react.PropTypes.object, | ||
autoplay: _react.PropTypes.bool | ||
onSeeked: _react.PropTypes.func, | ||
onTextTrackChanged: _react.PropTypes.func, | ||
onTimeUpdate: _react.PropTypes.func, | ||
onVolumeChange: _react.PropTypes.func | ||
}, | ||
@@ -142,4 +150,4 @@ | ||
onMessage: function onMessage(_ref) { | ||
var origin = _ref.origin; | ||
var data = _ref.data; | ||
var origin = _ref.origin, | ||
data = _ref.data; | ||
var onReady = this.props.onReady; | ||
@@ -176,3 +184,7 @@ var playerOrigin = this.state.playerOrigin; | ||
} | ||
if (!data.event) { | ||
// we get messages when the first event callbacks are added to the frame | ||
return; | ||
} | ||
debug('firing event: ', data.event); | ||
getFuncForEvent(data.event, this.props)(data); | ||
@@ -184,3 +196,3 @@ }, | ||
Object.keys(playerEvents).forEach(function (event) { | ||
var err = post('addEventListener', event, player, playerOrigin); | ||
var err = post('addEventListener', event.toLowerCase(), player, playerOrigin); | ||
if (err) { | ||
@@ -187,0 +199,0 @@ _this.onError(err); |
{ | ||
"name": "react-vimeo", | ||
"version": "0.2.2", | ||
"version": "1.0.0", | ||
"description": "React component to load video from Vimeo", | ||
@@ -47,3 +47,3 @@ "author": { | ||
"babel-core": "^6.10.4", | ||
"babel-eslint": "^6.1.2", | ||
"babel-eslint": "^7.1.1", | ||
"babel-loader": "^6.2.4", | ||
@@ -50,0 +50,0 @@ "babel-plugin-add-module-exports": "^0.2.1", |
@@ -24,3 +24,3 @@ # React Vimeo | ||
React.render( | ||
<Video onError={ onError } videoId={ videoId } /> | ||
<Vimeo onError={ onError } videoId={ videoId } /> | ||
document.querySelector('#your-div') | ||
@@ -36,3 +36,3 @@ ); | ||
React.render( | ||
<Vimeo videoId={ videoId } autoplay='true' />, | ||
<Vimeo videoId={ videoId } autoplay={true} />, | ||
$mountNode | ||
@@ -42,3 +42,3 @@ ); | ||
## Behind the Scene | ||
## Behind the Scenes | ||
@@ -45,0 +45,0 @@ There are some things that you should know about the component. The first one is the structure created inside by the component if you wish to stylize it. |
/* eslint-disable max-len */ | ||
import React from 'react'; | ||
/* | ||
* React component for Vimeo Loading Spinner created and rendered. | ||
* SVG Path is used for creating the spinner. | ||
*/ | ||
export default React.createClass({ | ||
@@ -5,0 +9,0 @@ displayName: 'Spinner', |
@@ -12,9 +12,12 @@ import React, { PropTypes, cloneElement } from 'react'; | ||
const playerEvents = keyMirror({ | ||
cuechange: null, | ||
finish: null, | ||
loadProgress: null, | ||
cueChange: null, | ||
ended: null, | ||
loaded: null, | ||
pause: null, | ||
play: null, | ||
playProgress: null, | ||
seek: null | ||
progress: null, | ||
seeked: null, | ||
textTrackChange: null, | ||
timeUpdate: null, | ||
volumeChange: null | ||
}); | ||
@@ -43,17 +46,22 @@ | ||
propTypes: { | ||
autoplay: PropTypes.bool, | ||
className: PropTypes.string, | ||
loading: PropTypes.element, | ||
onCuechange: PropTypes.func, | ||
playButton: PropTypes.node, | ||
playerOptions: PropTypes.object, | ||
videoId: PropTypes.string.isRequired, | ||
// event callbacks | ||
onCueChange: PropTypes.func, | ||
onEnded: PropTypes.func, | ||
onError: PropTypes.func, | ||
onFinish: PropTypes.func, | ||
onLoadProgress: PropTypes.func, | ||
onLoaded: PropTypes.func, | ||
onPause: PropTypes.func, | ||
onPlay: PropTypes.func, | ||
onPlayProgress: PropTypes.func, | ||
onProgress: PropTypes.func, | ||
onReady: PropTypes.func, | ||
onSeek: PropTypes.func, | ||
playButton: PropTypes.node, | ||
videoId: PropTypes.string.isRequired, | ||
playerOptions: PropTypes.object, | ||
autoplay: PropTypes.bool | ||
onSeeked: PropTypes.func, | ||
onTextTrackChanged: PropTypes.func, | ||
onTimeUpdate: PropTypes.func, | ||
onVolumeChange: PropTypes.func | ||
}, | ||
@@ -158,3 +166,7 @@ | ||
} | ||
if (!data.event) { | ||
// we get messages when the first event callbacks are added to the frame | ||
return; | ||
} | ||
debug('firing event: ', data.event); | ||
getFuncForEvent(data.event, this.props)(data); | ||
@@ -165,3 +177,8 @@ }, | ||
Object.keys(playerEvents).forEach(event => { | ||
var err = post('addEventListener', event, player, playerOrigin); | ||
var err = post( | ||
'addEventListener', | ||
event.toLowerCase(), | ||
player, | ||
playerOrigin | ||
); | ||
if (err) { | ||
@@ -168,0 +185,0 @@ this.onError(err); |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances 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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
88947
1933
3