This repository has been archived on 2023-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
Omphaloskepsis/plugins/jetpack/_inc/facebook-embed.js

37 lines
808 B
JavaScript
Raw Normal View History

2018-03-21 18:19:20 +00:00
/* 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 );