diff options
Diffstat (limited to 'plugins/jetpack/_inc/facebook-embed.js')
-rw-r--r-- | plugins/jetpack/_inc/facebook-embed.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/plugins/jetpack/_inc/facebook-embed.js b/plugins/jetpack/_inc/facebook-embed.js new file mode 100644 index 00000000..580aef68 --- /dev/null +++ b/plugins/jetpack/_inc/facebook-embed.js @@ -0,0 +1,36 @@ +/* global FB, jpfbembed */ +(function( window ) { + var facebookEmbed = function() { + var fbroot, src; + + if ( 'undefined' !== typeof FB && FB.XFBML ) { + FB.XFBML.parse(); + } else { + fbroot = document.createElement( 'div' ); + fbroot.id = 'fb-root'; + document.getElementsByTagName( 'body' )[0].appendChild( fbroot ); + + src = '//connect.facebook.net/' + jpfbembed.locale + '/sdk.js#xfbml=1'; + if ( jpfbembed.appid ) { + src += '&appId=' + jpfbembed.appid; + } + src += '&version=v2.3'; + jQuery.getScript( src ); + } + }; + + window.fbAsyncInit = function() { + FB.init( { + appId : jpfbembed.appid, + version: 'v2.3' + } ); + + FB.XFBML.parse(); + }; + + if ( 'undefined' !== typeof infiniteScroll ) { + jQuery( document.body ).on( 'post-load', facebookEmbed ); + } + + facebookEmbed(); +})( this ); |