From 5963706770cb08ded76ae4948afda05c8696a502 Mon Sep 17 00:00:00 2001 From: rwldrn Date: Tue, 8 Feb 2011 15:58:30 -0500 Subject: [PATCH] [#310] Changes per review --- popcorn.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/popcorn.js b/popcorn.js index e8ebee7..0c5b01f 100644 --- a/popcorn.js +++ b/popcorn.js @@ -951,7 +951,7 @@ // Exposes Popcorn to global context global.Popcorn = Popcorn; - + document.addEventListener( "DOMContentLoaded", function () { var videos = document.getElementsByTagName( "video" ); @@ -959,17 +959,18 @@ Popcorn.forEach( videos, function ( iter, key ) { var video = videos[ key ], - hasDataSources = false, + hasDataSources = false, dataSources, dataTemp, dataType, parserFn, popcornVideo; - - // Ensure that the DOM has an id, satisfies #310 + + // Ensure that the DOM has an id if ( !video.id ) { + video.id = Popcorn.guid( "__popcorn" ); + } - // Ensure we're looking at a dom node and that it has an id - // otherwise Popcorn won't be able to find the video element - if ( video.nodeType && video.nodeType === 1 && video.id ) { + // Ensure we're looking at a dom node + if ( video.nodeType && video.nodeType === 1 ) { popcornVideo = Popcorn( "#" + video.id ); @@ -982,17 +983,17 @@ dataTemp = source.split( ":" ); dataType = dataTemp[0]; - + if ( dataTemp.length === 1 ) { - + dataTemp = source.split( "." ); - + dataType = dataTemp[ dataTemp.length - 1 ]; - + } - + dataType = dataType.toUpperCase(); - + parserFn = "parse" + dataType; // If the video has data sources and the correct parser is registered, continue to load -- 2.43.0