]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#t612] processing.js loading fixes, now both working at once
authorScottDowne <sdowne@learn.senecac.on.ca>
Fri, 24 Jun 2011 18:50:20 +0000 (14:50 -0400)
committerScottDowne <sdowne@learn.senecac.on.ca>
Fri, 24 Jun 2011 18:50:20 +0000 (14:50 -0400)
plugins/gml/popcorn.gml.js
plugins/processing/popcorn.processing.js

index 03e027c7bafc262ff26309e70f6e3d4d33dffdcc..f0b54b4005817e1e22ede80df38f0ab50ff77eab 100755 (executable)
@@ -2,10 +2,7 @@
 
 (function (Popcorn) {
 
-  var processingLoader = {
-        readyState: 0
-      },
-      gmlPlayer = function( $p ) {
+  var gmlPlayer = function( $p ) {
 
         var _stroke = 0,
             onPt = 0, 
 
       document.getElementById( options.target ) && document.getElementById( options.target ).appendChild( options.container );
 
-      if ( processingLoader.readyState === 0 ) {
+      if ( !window.Processing ) {
 
-        processingLoader.readyState = 1;
-
-        if ( !window.Processing ) {
-
-          Popcorn.getScript( "http://processingjs.org/content/download/processing-js-1.2.1/processing-1.2.1.min.js", function() {
-
-            processingLoader.readyState = 2;
-          });
-        } else {
-
-          processingLoader.readyState = 2;
-        }
+        Popcorn.getScript( "http://processingjs.org/content/download/processing-js-1.2.1/processing-1.2.1.min.js" );
       }
 
       // makes sure both processing.js and the gml data are loaded
       var readyCheck = function() {
 
-        if ( processingLoader.readyState === 2 ) {
+        if ( window.Processing ) {
 
           Popcorn.getJSONP( "http://000000book.com/data/" + options.gmltag + ".json?callback=", function( data ) {
 
index bfb52f4e4c95e5e1e1c64ce1be315463624def31..560e4ff1ea8af97c4e315255a062d71e86e9aa1b 100644 (file)
 
 (function ( Popcorn ) {
 
-  var processingLoader = {
-        readyState: 0
-      },
-      toggle = function( on, options ) {
+  var toggle = function( on, options ) {
         var instance = options.pjsInstance,
             canvas = options.canvas;
             
       var initProcessing,
         canvas;
 
-      if ( processingLoader.readyState === 0 ) {
-
-        processingLoader.readyState = 1;
-
-        if ( !window.Processing ) {
-
-          Popcorn.getScript( "http://processingjs.org/content/download/processing-js-1.2.1/processing-1.2.1.min.js", function() {
+      if ( !window.Processing ) {
 
-            processingLoader.readyState = 2;
-          });
-        } else {
-
-          processingLoader.readyState = 2;
-        }
+        Popcorn.getScript( "http://processingjs.org/content/download/processing-js-1.2.1/processing-1.2.1.min.js" );
       }
 
       options.parentTarget = document.getElementById( options.target );
@@ -91,7 +77,7 @@
           });
         };
         
-        if ( options.codeReady && processingLoader.readyState === 2 ) {
+        if ( options.codeReady && window.Processing ) {
           options.pjsInstance = new Processing( options.canvas, options.processingCode );
           options.pjsInstance.noLoop();
           context.listen( "seeking", function() {