bigscreen-player
Advanced tools
Comparing version 3.18.0 to 3.18.1
{ | ||
"name": "bigscreen-player", | ||
"version": "3.18.0", | ||
"version": "3.18.1", | ||
"description": "Simplified media playback for bigscreen devices.", | ||
@@ -5,0 +5,0 @@ "main": "script/bigscreenplayer.js", |
@@ -25,2 +25,19 @@ define('bigscreenplayer/captions', | ||
/** | ||
* Safely checks if an attribute exists on an element. | ||
* Browsers < DOM Level 2 do not have 'hasAttribute' | ||
* | ||
* The interesting case - can be null when it isn't there or "", but then can also return "" when there is an attribute with no value. | ||
* For subs this is good enough. There should not be attributes without values. | ||
* @param {Element} el HTML Element | ||
* @param {String} attribute attribute to check for | ||
*/ | ||
var hasAttribute = function (el, attribute) { | ||
return !!el.getAttribute(attribute); | ||
}; | ||
function hasNestedTime (element) { | ||
return (!hasAttribute(element, 'begin') || !hasAttribute(element, 'end')); | ||
} | ||
var Captions = function (id, uri, media) { | ||
@@ -170,3 +187,12 @@ var timedItems = []; | ||
for (var k = 0, m = ps.length; k < m; k++) { | ||
items.push(TimedPiece(ps[k], elementToStyle)); | ||
if (hasNestedTime(ps[k])) { | ||
var tag = ps[k]; | ||
for (var index = 0; index < tag.childNodes.length; index++) { | ||
if (hasAttribute(tag.childNodes[index], 'begin') && hasAttribute(tag.childNodes[index], 'end')) { | ||
items.push(TimedPiece(tag.childNodes[index], elementToStyle)); | ||
} | ||
} | ||
} else { | ||
items.push(TimedPiece(ps[k], elementToStyle)); | ||
} | ||
} | ||
@@ -332,2 +358,9 @@ | ||
var localName = source.localName || source.tagName; | ||
// We lose line breaks with nested TimePieces, so this provides similar layout | ||
var parentNodeLocalName = source.parentNode.localName || source.parentNode.tagName; | ||
if (localName === 'span' && parentNodeLocalName === 'p' && hasNestedTime(source.parentNode)) { | ||
localName = 'p'; | ||
} | ||
var html = document.createElement(localName); | ||
@@ -334,0 +367,0 @@ var style = toStyleFunc(source); |
define('bigscreenplayer/version', | ||
function () { | ||
return '3.18.0'; | ||
return '3.18.1'; | ||
} | ||
); |
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
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
651347
14265