From: ScottDowne Date: Fri, 24 Jun 2011 18:50:20 +0000 (-0400) Subject: [#t612] processing.js loading fixes, now both working at once X-Git-Tag: v0.7^2~5^2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=aa72029eb39b9759b50bbccc19e7d3d15b409609;p=popcorn-js.git [#t612] processing.js loading fixes, now both working at once --- diff --git a/plugins/gml/popcorn.gml.js b/plugins/gml/popcorn.gml.js index 03e027c..f0b54b4 100755 --- a/plugins/gml/popcorn.gml.js +++ b/plugins/gml/popcorn.gml.js @@ -2,10 +2,7 @@ (function (Popcorn) { - var processingLoader = { - readyState: 0 - }, - gmlPlayer = function( $p ) { + var gmlPlayer = function( $p ) { var _stroke = 0, onPt = 0, @@ -162,26 +159,15 @@ 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 ) { diff --git a/plugins/processing/popcorn.processing.js b/plugins/processing/popcorn.processing.js index bfb52f4..560e4ff 100644 --- a/plugins/processing/popcorn.processing.js +++ b/plugins/processing/popcorn.processing.js @@ -26,10 +26,7 @@ (function ( Popcorn ) { - var processingLoader = { - readyState: 0 - }, - toggle = function( on, options ) { + var toggle = function( on, options ) { var instance = options.pjsInstance, canvas = options.canvas; @@ -55,20 +52,9 @@ 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() {