aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/plyr.js
diff options
context:
space:
mode:
authorSam <me@sampotts.me>2016-10-23 21:15:19 +1100
committerSam <me@sampotts.me>2016-10-23 21:15:19 +1100
commit90338d96000dcebd89fcb7f10d09afe0522cd1c0 (patch)
tree4d047c224a2dff3b1ba616e43d778aade69fd70b /src/js/plyr.js
parent613c45ede9385ef687ad986264f01b49ec9c4f22 (diff)
downloadplyr-90338d96000dcebd89fcb7f10d09afe0522cd1c0.tar.lz
plyr-90338d96000dcebd89fcb7f10d09afe0522cd1c0.tar.xz
plyr-90338d96000dcebd89fcb7f10d09afe0522cd1c0.zip
Tweaks
Diffstat (limited to 'src/js/plyr.js')
-rw-r--r--src/js/plyr.js25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/js/plyr.js b/src/js/plyr.js
index 2ce6cd3b..711c4555 100644
--- a/src/js/plyr.js
+++ b/src/js/plyr.js
@@ -1064,18 +1064,15 @@
// Get URL of caption file if exists
var captionSources = [],
- captionSrc = '',
- kind,
- children = plyr.media.childNodes;
-
- for (var i = 0; i < children.length; i++) {
- if (children[i].nodeName.toLowerCase() === 'track') {
- kind = children[i].kind;
- if (kind === 'captions' || kind === 'subtitles') {
- captionSources.push(children[i].getAttribute('src'));
+ captionSrc = '';
+
+ plyr.media.childNodes.forEach(function(child) {
+ if (child.nodeName.toLowerCase() === 'track') {
+ if (child.kind === 'captions' || child.kind === 'subtitles') {
+ captionSources.push(child.getAttribute('src'));
}
}
- }
+ });
// Record if caption file exists or not
plyr.captionExists = true;
@@ -1152,18 +1149,18 @@
caption,
req = xhr.responseText;
- //According to webvtt spec, line terminator consists of one of the following
+ // According to webvtt spec, line terminator consists of one of the following
// CRLF (U+000D U+000A), LF (U+000A) or CR (U+000D)
var lineSeparator = '\r\n';
- if(req.indexOf(lineSeparator+lineSeparator) === -1) {
- if(req.indexOf('\r\r') !== -1){
+ if (req.indexOf(lineSeparator + lineSeparator) === -1) {
+ if (req.indexOf('\r\r') !== -1){
lineSeparator = '\r';
} else {
lineSeparator = '\n';
}
}
- captions = req.split(lineSeparator+lineSeparator);
+ captions = req.split(lineSeparator + lineSeparator);
for (var r = 0; r < captions.length; r++) {
caption = captions[r];