CustomEvent polyfill (Fixes #172)
This commit is contained in:
parent
7a1a5830aa
commit
1bbc47c64f
2
dist/plyr.js
vendored
2
dist/plyr.js
vendored
File diff suppressed because one or more lines are too long
@ -214,7 +214,9 @@ options = {
|
|||||||
|
|
||||||
// If aws is setup
|
// If aws is setup
|
||||||
if("cdn" in aws) {
|
if("cdn" in aws) {
|
||||||
var cdnpath = new RegExp(aws.cdn.bucket + "\/(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)","gi"),
|
var regex = "(\\d+\\.)?(\\d+\\.)?(\\*|\\d+)",
|
||||||
|
cdnpath = new RegExp(aws.cdn.bucket + "\/" + regex, "gi"),
|
||||||
|
semver = new RegExp("v" + regex, "gi"),
|
||||||
localpath = new RegExp("(\.\.\/)?dist", "gi");
|
localpath = new RegExp("(\.\.\/)?dist", "gi");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -244,6 +246,11 @@ gulp.task("docs", function () {
|
|||||||
.pipe(replace(cdnpath, aws.cdn.bucket + "/" + version))
|
.pipe(replace(cdnpath, aws.cdn.bucket + "/" + version))
|
||||||
.pipe(gulp.dest(root));
|
.pipe(gulp.dest(root));
|
||||||
|
|
||||||
|
// Replace versioned files in plyr.js
|
||||||
|
gulp.src(path.join(root, "src/js/plyr.js"))
|
||||||
|
.pipe(replace(semver, "v" + version))
|
||||||
|
.pipe(gulp.dest(path.join(root, "src/js/")));
|
||||||
|
|
||||||
// Replace local file paths with remote paths in docs
|
// Replace local file paths with remote paths in docs
|
||||||
// e.g. "../dist/plyr.js" to "https://cdn.plyr.io/x.x.x/plyr.js"
|
// e.g. "../dist/plyr.js" to "https://cdn.plyr.io/x.x.x/plyr.js"
|
||||||
gulp.src([paths.docs.root + "*.html"])
|
gulp.src([paths.docs.root + "*.html"])
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "plyr",
|
"name": "plyr",
|
||||||
"version": "1.5.14",
|
"version": "1.5.15",
|
||||||
"description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player",
|
"description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player",
|
||||||
"homepage": "http://plyr.io",
|
"homepage": "http://plyr.io",
|
||||||
"main": "src/js/plyr.js",
|
"main": "src/js/plyr.js",
|
||||||
|
10
readme.md
10
readme.md
@ -40,7 +40,7 @@ If you have any cool ideas or features, please let me know by [creating an issue
|
|||||||
|
|
||||||
Check `docs/index.html` and `docs/dist/docs.js` for an example setup.
|
Check `docs/index.html` and `docs/dist/docs.js` for an example setup.
|
||||||
|
|
||||||
**Heads up:** the example `index.html` file needs to be served from a webserver (such as Apache, Nginx, IIS or similar) unless you change the file sources to include http or https. e.g. change `//cdn.plyr.io/1.5.14/plyr.js` to `https://cdn.plyr.io/1.5.14/plyr.js`
|
**Heads up:** the example `index.html` file needs to be served from a webserver (such as Apache, Nginx, IIS or similar) unless you change the file sources to include http or https. e.g. change `//cdn.plyr.io/1.5.15/plyr.js` to `https://cdn.plyr.io/1.5.15/plyr.js`
|
||||||
|
|
||||||
### Node Package Manager (NPM)
|
### Node Package Manager (NPM)
|
||||||
Using NPM, you can grab Plyr:
|
Using NPM, you can grab Plyr:
|
||||||
@ -69,11 +69,11 @@ More info is on [npm](https://www.npmjs.com/package/ember-cli-plyr) and [GitHub]
|
|||||||
If you want to use our CDN, you can use the following:
|
If you want to use our CDN, you can use the following:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<link rel="stylesheet" href="https://cdn.plyr.io/1.5.14/plyr.css">
|
<link rel="stylesheet" href="https://cdn.plyr.io/1.5.15/plyr.css">
|
||||||
<script src="https://cdn.plyr.io/1.5.14/plyr.js"></script>
|
<script src="https://cdn.plyr.io/1.5.15/plyr.js"></script>
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.5.14/sprite.svg`.
|
You can also access the `sprite.svg` file at `https://cdn.plyr.io/1.5.15/sprite.svg`.
|
||||||
|
|
||||||
### CSS & Styling
|
### CSS & Styling
|
||||||
If you want to use the default css, add the `plyr.css` file from `/dist` into your head, or even better use `plyr.less` or `plyr.sass` file included in `/src` in your build to save a request.
|
If you want to use the default css, add the `plyr.css` file from `/dist` into your head, or even better use `plyr.less` or `plyr.sass` file included in `/src` in your build to save a request.
|
||||||
@ -175,7 +175,7 @@ Be sure to [validate your caption files](https://quuz.org/webvtt/)
|
|||||||
Here's an example of a default setup:
|
Here's an example of a default setup:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<script src="https://cdn.plyr.io/1.5.14/plyr.js"></script>
|
<script src="https://cdn.plyr.io/1.5.15/plyr.js"></script>
|
||||||
<script>plyr.setup();</script>
|
<script>plyr.setup();</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
// Plyr
|
// Plyr
|
||||||
|
// plyr.js v1.5.15
|
||||||
// https://github.com/selz/plyr
|
// https://github.com/selz/plyr
|
||||||
// License: The MIT License (MIT)
|
// License: The MIT License (MIT)
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
@ -2832,6 +2833,10 @@
|
|||||||
// Custom event polyfill
|
// Custom event polyfill
|
||||||
// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
|
// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
|
||||||
(function () {
|
(function () {
|
||||||
|
if (typeof window.CustomEvent === 'function') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function CustomEvent (event, params) {
|
function CustomEvent (event, params) {
|
||||||
params = params || { bubbles: false, cancelable: false, detail: undefined };
|
params = params || { bubbles: false, cancelable: false, detail: undefined };
|
||||||
var evt = document.createEvent('CustomEvent');
|
var evt = document.createEvent('CustomEvent');
|
||||||
@ -2841,7 +2846,5 @@
|
|||||||
|
|
||||||
CustomEvent.prototype = window.Event.prototype;
|
CustomEvent.prototype = window.Event.prototype;
|
||||||
|
|
||||||
if(!('CustomEvent' in window)) {
|
|
||||||
window.CustomEvent = CustomEvent;
|
window.CustomEvent = CustomEvent;
|
||||||
}
|
|
||||||
})();
|
})();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user