]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
Merge branch '0.4' of https://github.com/annasob/popcorn-js into bug95
authorunknown <Venom@.(none)>
Tue, 1 Mar 2011 20:49:40 +0000 (15:49 -0500)
committerunknown <Venom@.(none)>
Tue, 1 Mar 2011 20:49:40 +0000 (15:49 -0500)
Conflicts:
popcorn.js

1  2 
popcorn.js
test/popcorn.unit.js

diff --cc popcorn.js
index ff6dd32b3dae2fb1cb18b7249651f02c9b607df0,17d20e3bed8cea1c427fb6d41c094a0a5e75fa00..e2df62f19dacf6c49355c23fbd641a4b6b2992b1
      //  Return new Popcorn object
      return new Popcorn.p.init( entity );
    };
 +  
 +  Popcorn.instances = [];
 +  Popcorn.instanceIds = {};
 +  
 +  Popcorn.removeInstance = function( id ) {
 +    //  If called prior to any instances being created
 +    //  Return early to avoid splicing on nothing
 +    if ( !Popcorn.instances.length ) {
 +      
 +      return;
 +      
 +    }
 +  
 +    Popcorn.instances.splice( Popcorn.instanceIds[ id ], 1 );
 +
 +    delete Popcorn.instanceIds[ id ];
 +    
 +  };
 +
 +  //  Addes a Popcorn instance to the Popcorn instance array
 +  Popcorn.addInstance = function( popcornInstance ) {
 +  
 +    if ( !popcornInstance.video.id ) { 
 +    
 +      popcornInstance.video.id = "__popcorn" + Popcorn.instances.length;
 +    
 +    }
 +    
 +    Popcorn.instanceIds[ popcornInstance.video.id ] = Popcorn.instances.length;
 +    
 +    Popcorn.instances.push( popcornInstance );
 +    
 +  };
  
-   
-   //  Declare a shortcut (Popcorn.p) to and a definition of 
-   //  the new prototype for our Popcorn constructor 
 +  //  User passes in the name of the Popcorn instance and receive a popcorn object
 +  Popcorn.getInstanceById = function( name ) {
 +  
 +    return Popcorn.instances[ Popcorn.instanceIds[ name ] ];
 +    
 +  };
 +  
+   //  Declare a shortcut (Popcorn.p) to and a definition of
+   //  the new prototype for our Popcorn constructor
    Popcorn.p = Popcorn.prototype = {
  
      init: function( entity ) {
        if ( matches.length && matches[2]  ) {
          elem = document.getElementById(matches[2]);
        }
-       
-       
+ 
+ 
        this.video = elem ? elem : null;
-       
 +      
 +      Popcorn.addInstance(this);
+ 
        this.data = {
          history: [],
          events: {},
index 66e1ce411e359a45306904b33291ee0201be8d74,d2643165f6147d30d3be360ace72fa5d4b94e1c4..f6f0b6cbfcf8455a860496bfeb97e9f6e6a4b7bf
mode 100644,100755..100755