]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
modified to eliminate circular reference, removed trailing whitespace.
authorChristopher De Cairos <cadecairos@India.(none)>
Thu, 16 Jun 2011 16:07:57 +0000 (12:07 -0400)
committerChristopher De Cairos <cadecairos@India.(none)>
Thu, 16 Jun 2011 16:07:57 +0000 (12:07 -0400)
plugins/processing/popcorn.processing.js

index 2a8c4120ce5de57c414826aa82f9c1e4eddca079..7af4d9c04b5058715fd7ac3c4b374c7e39f51c03 100644 (file)
@@ -2,40 +2,39 @@
 /**
 * Processing popcorn plug-in
 */
- 
+
 (function (Popcorn) {
 
   var processingLoaded = false,
-  
+
     toggle = function( on, options ) {
-      var pcorn = options.popcornInstance,
-          instance = options.pjsInstance,
+      var instance = options.pjsInstance,
           canvas = options.canvas;
       if ( canvas && options.isReady ) {
         if ( on ) {
           canvas.style.display = "inline";
-          !pcorn.media.paused && instance.loop();
+          !this.media.paused && instance.loop();
         } else {
           canvas.style.display = "none";
           instance.noLoop();
         }
       } else {
         setTimeout ( function() {
-          toggle ( on, options );
-        }, 10 ); 
+          toggle.call ( this, on, options );
+        }, 10 );
       }
     },
-    
-    load = function() {    
+
+    load = function() {
       Popcorn.getScript( "http://processingjs.org/content/download/processing-js-1.2.1/processing-1.2.1.js", function() {
         processingLoaded = true;
       });
     };
-  
+
   load();
 
   Popcorn.plugin( "processing" , function ( options ) {
-  
+
     var init = function( context ) {
       var popcorn = context,
       initProcessing,
@@ -59,7 +58,7 @@
           initProcessing();
         }
       });
-      
+
       initProcessing = function() {
         if ( codeReady && window.Processing ) {
           options.pjsInstance = new Processing( options.canvas, processingCode );
@@ -79,9 +78,9 @@
         }
       };
     };
-  
+
     return {
-    
+
       manifest: {
         about: {
           name: "Popcorn Processing Plugin",
           func :    { elem: "input", type: "text", label: "Function" }
         }
       },
-      
+
       _setup: function( options ) {
-      
-        var processingCode, 
+
+        var processingCode,
             codeReady = false,
             self = this,
-        
+
         readyCheck = function() {
           if ( !processingLoaded ) {
             load();
-          } 
+          }
         };
         readyCheck();
         init( self );
-        options.popcornInstance = this;
       },
-      
+
       start: function( event, options ) {
-        toggle ( true, options );
+        toggle.call ( this, true, options );
       },
-      
+
       end: function( event, options ) {
-        toggle ( false, options );
+        toggle.call ( this, false, options );
       }
     };
   });