From: Christopher De Cairos Date: Tue, 13 Sep 2011 18:53:01 +0000 (-0400) Subject: moved googlefeed scriptloading into setup X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=dfc7e5aca490d6808b738158ae01bceafb331384;p=popcorn-js.git moved googlefeed scriptloading into setup --- diff --git a/plugins/googlefeed/popcorn.googlefeed.js b/plugins/googlefeed/popcorn.googlefeed.js index 1a6d1cd..bca1985 100755 --- a/plugins/googlefeed/popcorn.googlefeed.js +++ b/plugins/googlefeed/popcorn.googlefeed.js @@ -17,7 +17,7 @@ Popcorn.getScript( resource + "js", function() { scriptLoaded = true; - }); + }); } else { scriptLoaded = true; @@ -38,23 +38,6 @@ } }; - if ( !window.google ) { - - Popcorn.getScript( "http://www.google.com/jsapi", function() { - - google.load( "feeds", "1", { - - callback: function () { - - dynamicFeedLoad(); - } - }); - }); - - } else { - dynamicFeedLoad(); - } - /** * googlefeed popcorn plug-in * Adds a feed from the specified blog url at the target div @@ -86,9 +69,9 @@ target = document.getElementById( options.target ), initialize = function() { //ensure that the script has been loaded - if ( !scriptLoaded ) { + if ( !scriptLoaded || !window.GFdynamicFeedControl ) { setTimeout( function () { - initialize(); + initialize(); }, 5 ); } else { // Create the feed control using the user entered url and title @@ -117,9 +100,40 @@ } target && target.appendChild( newdiv ); - initialize(); - return { + /** + * @member webpage + * The setup function will be executed when a googlefeed plugin is created. + */ + _setup: function( options ) { + + if ( !window.google ) { + + Popcorn.getScript( "http://www.google.com/jsapi", function() { + + var readyCheck = function() { + + if ( window.google ) { + google.load( "feeds", "1", { + + callback: function () { + + dynamicFeedLoad(); + + } + }); + } else { + setTimeout( readyCheck, 10 ); + } + }; + readyCheck(); + + }); + + } + + initialize(); + }, /** * @member webpage * The start function will be executed when the currentTime @@ -153,32 +167,32 @@ }, options: { start: { - elem: "input", - type: "text", - label: "In" + elem: "input", + type: "text", + label: "In" }, - end: { - elem: "input", - type: "text", - label: "Out" + end: { + elem: "input", + type: "text", + label: "Out" }, target: "feed-container", - url: { - elem: "input", - type: "text", - label: "url" + url: { + elem: "input", + type: "text", + label: "url" }, - title: { - elem: "input", - type: "text", - label: "title" + title: { + elem: "input", + type: "text", + label: "title" }, orientation: { - elem: "select", - options: [ "Vertical","Horizontal" ], - label: "orientation" + elem: "select", + options: [ "Vertical","Horizontal" ], + label: "orientation" } } }); - + })( Popcorn );