blocks
4 years ago
build
4 years ago
fonts
8 years ago
genericons
6 years ago
lib
4 years ago
social-logos
5 years ago
accessible-focus.js
5 years ago
class.jetpack-provision.php
4 years ago
connect-button.js
4 years ago
crowdsignal-shortcode.js
5 years ago
crowdsignal-survey.js
5 years ago
facebook-embed.js
5 years ago
gallery-settings.js
5 years ago
genericons.php
11 years ago
header.php
7 years ago
jetpack-admin.js
5 years ago
jetpack-connection-banner.js
5 years ago
jetpack-deactivate-dialog.js
5 years ago
jetpack-modules.js
5 years ago
jetpack-modules.models.js
6 years ago
jetpack-modules.views.js
5 years ago
jetpack-recommendations-banner.js
5 years ago
jetpack-server-sandbox.php
6 years ago
jquery.jetpack-resize.js
5 years ago
polldaddy-shortcode.js
5 years ago
postmessage.js
5 years ago
social-logos.php
5 years ago
twitter-timeline.js
5 years ago
facebook-embed.js
41 lines
| 1 | /* global FB, jpfbembed */ |
| 2 | ( function ( window ) { |
| 3 | var facebookEmbed = function () { |
| 4 | var fbroot, src, newScript, firstScript; |
| 5 | |
| 6 | if ( 'undefined' !== typeof FB && FB.XFBML ) { |
| 7 | FB.XFBML.parse(); |
| 8 | } else { |
| 9 | fbroot = document.createElement( 'div' ); |
| 10 | fbroot.id = 'fb-root'; |
| 11 | document.getElementsByTagName( 'body' )[ 0 ].appendChild( fbroot ); |
| 12 | |
| 13 | src = '//connect.facebook.net/' + jpfbembed.locale + '/sdk.js#xfbml=1'; |
| 14 | if ( jpfbembed.appid ) { |
| 15 | src += '&appId=' + jpfbembed.appid; |
| 16 | } |
| 17 | src += '&version=v2.3'; |
| 18 | |
| 19 | newScript = document.createElement( 'script' ); |
| 20 | newScript.setAttribute( 'src', src ); |
| 21 | firstScript = document.querySelector( 'script' ); |
| 22 | firstScript.parentNode.insertBefore( newScript, firstScript ); |
| 23 | } |
| 24 | }; |
| 25 | |
| 26 | window.fbAsyncInit = function () { |
| 27 | FB.init( { |
| 28 | appId: jpfbembed.appid, |
| 29 | version: 'v2.3', |
| 30 | } ); |
| 31 | |
| 32 | FB.XFBML.parse(); |
| 33 | }; |
| 34 | |
| 35 | if ( 'undefined' !== typeof infiniteScroll ) { |
| 36 | document.body.addEventListener( 'post-load', facebookEmbed ); |
| 37 | } |
| 38 | |
| 39 | facebookEmbed(); |
| 40 | } )( this ); |
| 41 |