Hexo个人博客
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
812 B

7 months ago
- const fbSDKVer = 'v16.0'
- const fbSDK = theme.messenger.enable ? `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk/xfbml.customerchat.js#xfbml=1&version=${fbSDKVer}` : `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk.js#xfbml=1&version=${fbSDKVer}`
script.
(()=>{
function loadFBComment () {
if (typeof FB === 'object') FB.XFBML.parse(document.getElementById('recent-posts'))
else {
let ele = document.createElement('script')
ele.setAttribute('src','!{fbSDK}')
ele.setAttribute('async', 'true')
ele.setAttribute('defer', 'true')
ele.setAttribute('crossorigin', 'anonymous')
document.body.appendChild(ele)
}
}
window.pjax ? loadFBComment() : window.addEventListener('load', loadFBComment)
})()