Skip to content

Commit

Permalink
feat: add custom prop
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoshi0207 committed Aug 19, 2021
1 parent c678c16 commit 4dcc641
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 11 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,26 @@ new ModalVideo('.js-modal-btn');
new ModalVideo('.js-modal-btn', {channel: 'vimeo'});
```

### MP4

```html
<button class="js-modal-btn" data-video-url="https://developer.a-blogcms.jp/themes/developer/movies/280.mp4">Open Video</button>
```

```js
new ModalVideo('.js-modal-btn');
```

OR

```html
<button class="js-modal-btn" data-channel="custom">Open Video</button>
```

```js
new ModalVideo('.js-modal-btn', {url: 'https://developer.a-blogcms.jp/themes/developer/movies/280.mp4'});
```

## Options

About YouTube options, please refer to https://developers.google.com/youtube/player_parameters?hl=en
Expand Down Expand Up @@ -219,6 +239,11 @@ About Vimeo options, please refer to https://developer.vimeo.com/apis/oembed
<td>width</td>
<td>null</td>
</tr>
<tr>
<td rowspan="1">custom</td>
<td>url</td>
<td>MP4 URL</td>
</tr>
<tr>
<td>xhtml</td>
<td>false</td>
Expand Down
6 changes: 4 additions & 2 deletions js/jquery-modal-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*
* custom-event-polyfill:
* license: MIT (http://opensource.org/licenses/MIT)
* author: NO AUTHOR!
* contributors: Frank Panetta (http://www.savvi.io), Mikhail Reenko <[email protected]>, Joscha Feth <joscha@feth.com> (http://www.feth.com)
* contributors: Frank Panetta, Mikhail Reenko <[email protected]>, Joscha Feth <[email protected]>
* homepage: https://github.com/krambuhl/custom-event-polyfill#readme
* version: 0.3.0
*
* es6-object-assign:
Expand Down Expand Up @@ -348,6 +348,8 @@ var ModalVideo = function () {
return this.getVimeoUrl(opt.vimeo, videoId);
} else if (channel === 'facebook') {
return this.getFacebookUrl(opt.facebook, videoId);
} else if (channel === 'custom') {
return opt.url;
}
return '';
}
Expand Down
6 changes: 3 additions & 3 deletions js/jquery-modal-video.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions js/modal-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
*
* custom-event-polyfill:
* license: MIT (http://opensource.org/licenses/MIT)
* author: NO AUTHOR!
* contributors: Frank Panetta (http://www.savvi.io), Mikhail Reenko <[email protected]>, Joscha Feth <joscha@feth.com> (http://www.feth.com)
* contributors: Frank Panetta, Mikhail Reenko <[email protected]>, Joscha Feth <[email protected]>
* homepage: https://github.com/krambuhl/custom-event-polyfill#readme
* version: 0.3.0
*
* es6-object-assign:
Expand Down Expand Up @@ -323,6 +323,8 @@ var ModalVideo = function () {
return this.getVimeoUrl(opt.vimeo, videoId);
} else if (channel === 'facebook') {
return this.getFacebookUrl(opt.facebook, videoId);
} else if (channel === 'custom') {
return opt.url;
}
return '';
}
Expand Down
Loading

0 comments on commit 4dcc641

Please sign in to comment.