From f8208a48aa78df11b8c4b31ee7dbcc4e03a33f08 Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 7 Mar 2011 15:38:06 -0500 Subject: [PATCH] fixed Popcorn.removeInstance and added popcornInstance.id --- popcorn.js | 19 ++++++++++---- test/instanceTester.html | 53 ---------------------------------------- 2 files changed, 14 insertions(+), 58 deletions(-) delete mode 100644 test/instanceTester.html diff --git a/popcorn.js b/popcorn.js index e2df62f..e46d7b4 100644 --- a/popcorn.js +++ b/popcorn.js @@ -23,9 +23,12 @@ }; Popcorn.instances = []; + Popcorn.instanceIds = {}; - Popcorn.removeInstance = function( id ) { + Popcorn.id = null; + + Popcorn.removeInstance = function( popcornInstance ) { // If called prior to any instances being created // Return early to avoid splicing on nothing if ( !Popcorn.instances.length ) { @@ -34,9 +37,9 @@ } - Popcorn.instances.splice( Popcorn.instanceIds[ id ], 1 ); + Popcorn.instances.splice( Popcorn.instanceIds[ popcornInstance.id ], 1 ); - delete Popcorn.instanceIds[ id ]; + delete Popcorn.instanceIds[ popcornInstance.id ]; }; @@ -45,11 +48,17 @@ if ( !popcornInstance.video.id ) { - popcornInstance.video.id = "__popcorn" + Popcorn.instances.length; + popcornInstance.id = "__popcorn" + Popcorn.instances.length; + + } + + else { + + popcornInstance.id = popcornInstance.video.id; } - Popcorn.instanceIds[ popcornInstance.video.id ] = Popcorn.instances.length; + Popcorn.instanceIds[ popcornInstance.id ] = Popcorn.instances.length; Popcorn.instances.push( popcornInstance ); diff --git a/test/instanceTester.html b/test/instanceTester.html deleted file mode 100644 index 39ff91b..0000000 --- a/test/instanceTester.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - Popcorn API - - - - - - - - - - -- 2.43.0