mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2025-09-15 12:58:48 +08:00
feat: 升級facebook comment js 到 v10 fix: 修復當內容過少時, footer 沒有底部靠攏的bug improvement: 404頁面不再顯示 rightside
27 lines
1018 B
Plaintext
27 lines
1018 B
Plaintext
#fb-root
|
|
script.
|
|
function loadFBComment () {
|
|
var themeNow = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'
|
|
document.getElementsByClassName('fb-comments')[0].setAttribute('data-colorscheme',themeNow)
|
|
|
|
if (typeof FB === 'object') FB.XFBML.parse()
|
|
else {
|
|
let ele = document.createElement('script')
|
|
ele.setAttribute('src','https://connect.facebook.net/!{theme.facebook_comments.lang}/sdk.js#xfbml=1&version=v10.0')
|
|
ele.setAttribute('async', 'true')
|
|
ele.setAttribute('defer', 'true')
|
|
ele.setAttribute('crossorigin', 'anonymous')
|
|
document.getElementById('fb-root').insertAdjacentElement('afterbegin',ele)
|
|
}
|
|
}
|
|
|
|
if ('!{theme.comments.use[0]}' === 'Facebook Comments' || !!{theme.comments.lazyload}) {
|
|
if (!{theme.comments.lazyload}) btf.loadComment(document.querySelector('#post-comment .fb-comments'), loadFBComment)
|
|
else loadFBComment()
|
|
} else {
|
|
function loadOtherComment () {
|
|
loadFBComment()
|
|
}
|
|
}
|
|
|