From bc9bb9fc373951bb2a0ff7cb7d8fee4f82ecfdc7 Mon Sep 17 00:00:00 2001 From: David Seifried Date: Wed, 22 Jun 2011 11:44:39 -0400 Subject: [PATCH] [#556] Made some performance changes --- plugins/googlefeed/popcorn.googlefeed.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/plugins/googlefeed/popcorn.googlefeed.js b/plugins/googlefeed/popcorn.googlefeed.js index a52d31c..df44a77 100755 --- a/plugins/googlefeed/popcorn.googlefeed.js +++ b/plugins/googlefeed/popcorn.googlefeed.js @@ -9,12 +9,13 @@ k = 0, links = document.getElementsByTagName( "link" ), len = links.length, - head = document.getElementsByTagName( "head" )[ 0 ], - css = document.createElement( "link" ); + head = document.head || document.getElementsByTagName( "head" )[ 0 ], + css = document.createElement( "link" ), + resource = "http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol."; - if ( typeof GFdynamicFeedControl === "undefined" ) { + if ( !window.GFdynamicFeedControl ) { - Popcorn.getScript( "http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.js", function() { + Popcorn.getScript( resource + "js", function() { scriptLoaded = true; }); @@ -24,7 +25,7 @@ // Checking if the css file is already included for ( ; k < len; k++ ){ - if ( links[ k ].href === "http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.css" ) { + if ( links[ k ].href === resource + "css" ) { dontLoad = true; } } @@ -32,12 +33,12 @@ if ( !dontLoad ) { css.type = "text/css"; css.rel = "stylesheet"; - css.href = "http://www.google.com/uds/solutions/dynamicfeed/gfdynamicfeedcontrol.css"; + css.href = resource + "css"; head.insertBefore( css, head.firstChild ); } }; - if ( typeof google === "undefined" ) { + if ( !window.google ) { Popcorn.getScript( "http://www.google.com/jsapi", function() { -- 2.43.0