-
-
Save ngryman/5266324 to your computer and use it in GitHub Desktop.
Revisions
-
ngryman revised this gist
Mar 28, 2013 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,10 +6,10 @@ */ (function(d, u) { var s = d.scripts[0], i = u.length, g; while (i--) { g = d.createElement('script'); g.src = '//' + u[i] + '.js'; s.parentNode.insertBefore(g, s); } -
ngryman revised this gist
Mar 28, 2013 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,9 +8,9 @@ (function(d, u) { var g = d.createElement('script'), s = d.scripts[0], i = u.length; while (i--) { g.src = '//' + u[i] + '.js'; s.parentNode.insertBefore(g, s); } }(document, [ -
ngryman revised this gist
Mar 28, 2013 . 1 changed file with 18 additions and 20 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,23 +5,21 @@ * N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function. */ (function(d, u) { var g = d.createElement('script'), s = d.scripts[0], l = u.length; while (l--) { g.src = '//' + u + '.js'; s.parentNode.insertBefore(g, s); } }(document, [ // Google Analytics 'google-analytics.com/ga', // Google+ button 'apis.google.com/js/plusone', // Facebook SDK 'connect.facebook.net/en_US/all', // Twitter SDK 'platform.twitter.com/widgets' ])); -
ngryman revised this gist
Mar 28, 2013 . 1 changed file with 7 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,12 +6,14 @@ */ (function(d) { (function(u) { var g = d.createElement('script'), s = d.scripts[0], l = u.length; while (l--) { g.src = '//' + u + '.js'; s.parentNode.insertBefore(g, s); } }([ // Google Analytics 'google-analytics.com/ga', -
ngryman revised this gist
Mar 28, 2013 . 1 changed file with 18 additions and 20 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,23 +5,21 @@ * N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function. */ (function(d) { var g, s = d.scripts[0]; (function(u) { g = d.createElement(script); g.src = '//' + u + '.js'; s.parentNode.insertBefore(g, s); }([ // Google Analytics 'google-analytics.com/ga', // Google+ button 'apis.google.com/js/plusone', // Facebook SDK 'connect.facebook.net/en_US/all', // Twitter SDK 'platform.twitter.com/widgets' ])); }(document)); -
Nicolas Gallagher revised this gist
Feb 20, 2012 . 1 changed file with 3 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,21 +1,19 @@ /* * Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/ * Better handling of scripts without supplied ids. * * N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function. */ (function(doc, script) { var js, fjs = doc.getElementsByTagName(script)[0], add = function(url, id) { if (doc.getElementById(id)) {return;} js = doc.createElement(script); js.src = url; id && (js.id = id); fjs.parentNode.insertBefore(js, fjs); }; // Google Analytics @@ -25,7 +23,5 @@ // Facebook SDK add('//connect.facebook.net/en_US/all.js', 'facebook-jssdk'); // Twitter SDK add('//platform.twitter.com/widgets.js', 'twitter-wjs'); }(document, 'script')); -
necolas revised this gist
Nov 22, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ if (doc.getElementById(id)) {return;} js = doc.createElement(script); js.src = url; id && (js.id = id); frag.appendChild( js ); }; -
necolas revised this gist
Oct 16, 2011 . 2 changed files with 28 additions and 36 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,30 +1,31 @@ /* * Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/ * but retaining the use of a document fragment to minimise the number of times objects are * written to the DOM. Also, better handling of scripts without supplied ids. * * N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function. */ (function(doc, script) { var js, fjs = doc.getElementsByTagName(script)[0], frag = doc.createDocumentFragment(), add = function(url, id) { if (doc.getElementById(id)) {return;} js = doc.createElement(script); js.src = url; js.id = id || null; frag.appendChild( js ); }; // Google Analytics add(('https:' == location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js', 'ga'); // Google+ button add('https://apis.google.com/js/plusone.js'); // Facebook SDK add('//connect.facebook.net/en_US/all.js', 'facebook-jssdk'); // Twitter SDK add('//platform.twitter.com/widgets.js'); fjs.parentNode.insertBefore(frag, fjs); }(document, 'script')); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +0,0 @@ -
necolas revised this gist
Jun 15, 2011 . 2 changed files with 29 additions and 17 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,27 +1,30 @@ ( function ( win, doc ) { // Google Analytics global variable win._gaq = [ ['_setAccount','UA-XXXXX-X'], ['_trackPageview'], ['_trackPageLoadTime'] ]; // Array of cross-domain script urls var urls = [ '//connect.facebook.net/en_US/all.js', // Facebook SDK '//platform.twitter.com/widgets.js', // Twitter Widgets 'https://apis.google.com/js/plusone.js', // Google +1 Button ('https:' == location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js' // Google Analytics ], length = urls.length, nodeName = 'script', fragment = doc.createDocumentFragment(), // create container for DOM nodes elem = doc.createElement( nodeName ), // create script element temp; while ( length -- ) { temp = elem.cloneNode( false ); temp.src = urls[ length ]; temp.async = true; fragment.appendChild( temp ); } // insert documentFragment before first script element ( temp = doc.getElementsByTagName( nodeName )[0] ).parentNode.insertBefore( fragment, temp ); } ( this, document ) ); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ (function(w,d){ w._gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview'],['_trackPageLoadTime']]; var u=[ '//connect.facebook.net/en_US/all.js', // Facebook SDK '//platform.twitter.com/widgets.js', // Twitter Widgets 'https://apis.google.com/js/plusone.js', // Google +1 Button ('https:' == location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js' // Google Analytics ],i=u.length,n='script',f=d.createDocumentFragment(),e=d.createElement(n),t;while(i--){t=e.cloneNode(false);t.async=t.src=u[i];f.appendChild(t);}(t=d.getElementsByTagName(n)[0]).parentNode.insertBefore(f,t); }(this,document)); -
necolas revised this gist
Jun 15, 2011 . 1 changed file with 15 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,23 +1,27 @@ // Google Analytics variable var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview'],['_trackPageLoadTime']]; // Cross-domain scripts (function(d,e){ var u = [ '//connect.facebook.net/en_US/all.js', // Facebook JS SDK '//platform.twitter.com/widgets.js', // Twitter Widgets 'https://apis.google.com/js/plusone.js', // Google +1 Button ('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js' // Google Analytics ], i = u.length, f = d.createDocumentFragment(), s = d.createElement(e), t; while (i--) { t = s.cloneNode(false); t.async = t.src = u[i]; f.appendChild(t); } (t = d.getElementsByTagName(e)[0]).parentNode.insertBefore(f, t); }(document,'script')); -
necolas created this gist
Jun 14, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ (function(d,e){ var u = [ ('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js', // Google Analytics 'https://apis.google.com/js/plusone.js', // Google +1 Button '//connect.facebook.net/en_US/all.js' // Facebook JS SDK ], f = d.createDocumentFragment(), s = d.createElement(e), t = d.getElementsByTagName(e)[0], i = u.length, z; while(i--){ z = s.cloneNode(true); z.src = u[i]; z.async = 1; f.appendChild(z); } t.parentNode.insertBefore(f,t); }(document,'script'));