bigscreen-player
Advanced tools
Comparing version 3.9.0 to 3.10.0
{ | ||
"name": "bigscreen-player", | ||
"version": "3.9.0", | ||
"version": "3.10.0", | ||
"description": "Simplified media playback for bigscreen devices.", | ||
@@ -5,0 +5,0 @@ "main": "script/bigscreenplayer.js", |
define('bigscreenplayer/captions', | ||
[ | ||
'bigscreenplayer/debugger/debugtool' | ||
'bigscreenplayer/debugger/debugtool', | ||
'bigscreenplayer/domhelpers' | ||
], | ||
function (DebugTool) { | ||
function (DebugTool, DOMHelpers) { | ||
'use strict'; | ||
@@ -98,6 +99,12 @@ | ||
function isEBUDistribution (metadata) { | ||
return metadata === 'urn:ebu:tt:distribution:2014-01' || metadata === 'urn:ebu:tt:distribution:2018-04'; | ||
} | ||
function transformXML (xml) { | ||
// Use .getElementsByTagNameNS() when parsing XML as some implementations of .getElementsByTagName() will lowercase its argument before proceding | ||
var conformsToStandardElements = xml.getElementsByTagNameNS('urn:ebu:tt:metadata', 'conformsToStandard')[0]; | ||
var isEBUTTD = conformsToStandardElements && conformsToStandardElements.textContent === 'urn:ebu:tt:distribution:2014-01'; | ||
var conformsToStandardElements = Array.prototype.slice.call(xml.getElementsByTagNameNS('urn:ebu:tt:metadata', 'conformsToStandard')); | ||
var isEBUTTD = conformsToStandardElements && conformsToStandardElements.some(function (node) { | ||
return isEBUDistribution(node.textContent); | ||
}); | ||
@@ -169,2 +176,14 @@ var captionValues = { | ||
function rgbWithOpacity (value) { | ||
if (DOMHelpers.isRGBA(value)) { | ||
var opacity = parseInt(value.slice(7, 9), 16) / 255; | ||
if (isNaN(opacity)) { | ||
opacity = 1.0; | ||
} | ||
value = DOMHelpers.rgbaToRGB(value); | ||
value += '; opacity: ' + opacity + ';'; | ||
} | ||
return value; | ||
} | ||
function elementToStyle (el) { | ||
@@ -190,6 +209,12 @@ var stringStyle = ''; | ||
} | ||
if (map.attribute === 'tts:backgroundColor') { | ||
value = rgbWithOpacity(value); | ||
value += ' 2px 2px 1px'; | ||
} | ||
if (map.attribute === 'tts:color') { | ||
value = rgbWithOpacity(value); | ||
} | ||
stringStyle += map.property + ': ' + value + '; '; | ||
@@ -196,0 +221,0 @@ } |
@@ -28,8 +28,26 @@ define( | ||
function isRGBATuple (rgbaString) { | ||
return new RegExp('^#([A-Fa-f0-9]{8})$').test(rgbaString); | ||
} | ||
/** | ||
* Checks that the string is an RGBA tuple and returns a RGB Tripple. | ||
* A string that isn't an RGBA tuple will be returned to the caller. | ||
* @param {String} rgbaString | ||
*/ | ||
function rgbaToRGB (rgbaString) { | ||
if (isRGBATuple(rgbaString)) { | ||
rgbaString = rgbaString.slice(0, 7); | ||
} | ||
return rgbaString; | ||
} | ||
return { | ||
addClass: addClass, | ||
removeClass: removeClass, | ||
hasClass: hasClass | ||
hasClass: hasClass, | ||
rgbaToRGB: rgbaToRGB, | ||
isRGBA: isRGBATuple | ||
}; | ||
} | ||
); |
define('bigscreenplayer/version', | ||
function () { | ||
return '3.9.0'; | ||
return '3.10.0'; | ||
} | ||
); |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
7626114
106
69883
29