aboutsummaryrefslogtreecommitdiffstats
path: root/docs/src/js
diff options
context:
space:
mode:
authorSam Potts <me@sampotts.me>2016-01-19 17:15:50 +1100
committerSam Potts <me@sampotts.me>2016-01-19 17:15:50 +1100
commit84a1b03d7d2a4788b4c25fa4b3cea0b62b90f2d1 (patch)
tree8e7d68fd09cdd77f287e1d418f823db8caf081a6 /docs/src/js
parentb9177e78923b8d17dffbb69775405cd4fa6734af (diff)
downloadplyr-84a1b03d7d2a4788b4c25fa4b3cea0b62b90f2d1.tar.lz
plyr-84a1b03d7d2a4788b4c25fa4b3cea0b62b90f2d1.tar.xz
plyr-84a1b03d7d2a4788b4c25fa4b3cea0b62b90f2d1.zip
Docs update
Diffstat (limited to 'docs/src/js')
-rw-r--r--docs/src/js/docs.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/docs/src/js/docs.js b/docs/src/js/docs.js
index d2cef452..9828654e 100644
--- a/docs/src/js/docs.js
+++ b/docs/src/js/docs.js
@@ -82,10 +82,13 @@ shr.setup({
// Set a new source
function newSource(type) {
- if(!(type in types)) {
+
+ // Bail if new type isn't known, it's the current type, or current type is empty (video is default) and new type is video
+ if(!(type in types) || type == currentType || (!currentType.length && type == types.video)) {
return;
}
+ // Get plyr instance
var player = document.querySelector('.js-media-player').plyr;
switch(type) {
@@ -106,7 +109,7 @@ shr.setup({
kind: 'captions',
label: 'English',
srclang:'en',
- src: 'https://cdn.selz.com/plyr/1.0/example_captions_en.vtt',
+ src: 'https://cdn.selz.com/plyr/1.5/View_From_A_Blue_Moon_Trailer-HD.vtt',
default: true
}]
});
@@ -150,12 +153,15 @@ shr.setup({
break;
}
+ // Set the current type for next time
currentType = type;
+ // Remove active classes
for (var x = buttons.length - 1; x >= 0; x--) {
toggleClass(buttons[x].parentElement, 'active', false);
}
+ // Set active on parent
toggleClass(document.querySelector('[data-source="'+ type +'"]').parentElement, 'active', true);
}
})();