Comments (2)
我将themes\butterfly\layout\includes\third-party\comments\twikoo.pug
改成4.9.0版本的,就可以了,下面是4.9.0版本的代码
- const { envId, region, option } = theme.twikoo
- const { use, lazyload, count } = theme.comments
script.
(() => {
const init = () => {
twikoo.init(Object.assign({
el: '#twikoo-wrap',
envId: '!{envId}',
region: '!{region}',
onCommentLoaded: () => {
btf.loadLightbox(document.querySelectorAll('#twikoo .tk-content img:not(.tk-owo-emotion)'))
}
}, !{JSON.stringify(option)}))
}
const getCount = () => {
const countELement = document.getElementById('twikoo-count')
if(!countELement) return
twikoo.getCommentsCount({
envId: '!{envId}',
region: '!{region}',
urls: [window.location.pathname],
includeReply: false
}).then(res => {
countELement.textContent = res[0].count
}).catch(err => {
console.error(err)
});
}
const runFn = () => {
init()
!{count ? 'GLOBAL_CONFIG_SITE.isPost && getCount()' : ''}
}
const loadTwikoo = () => {
if (typeof twikoo === 'object') {
setTimeout(runFn,0)
return
}
getScript('!{url_for(theme.asset.twikoo)}').then(runFn)
}
if ('!{use[0]}' === 'Twikoo' || !!{lazyload}) {
if (!{lazyload}) btf.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo)
else loadTwikoo()
} else {
window.loadOtherComment = () => {
loadTwikoo()
}
}
})()
from hexo-theme-butterfly.
from hexo-theme-butterfly.
Related Issues (20)
- [Bug]: noticeOutdate报错 HOT 1
- [Bug]: 本地搜索有的无法运行 HOT 4
- [Bug]: build失败 HOT 2
- [Bug]: toc_expand: false不起作用 HOT 4
- [Bug]: 鼠標點擊效果: 文字 设置为true后不生效 HOT 3
- [Bug]: 配置时遇到的bug HOT 2
- [Bug]: HOT 2
- [Bug]: 侧边栏邮箱联系,本地正常,部署之后会自动加上域名导致404 HOT 2
- [Bug]: 有关于左上角图标跳转的bug的问题 HOT 4
- [Feature]: 仅针对特定文章的侧边栏
- [Feature]: 添加多语言支持或配置教程 HOT 4
- [Bug]: [后续][另辟蹊径的解决办法]关于左上角图标跳转bug的问题续篇 HOT 1
- [Feature]: Apply `blur` effect to images in `{% gallery %}` HOT 1
- [Bug]: tabs 渲染不太对 HOT 4
- [Bug]: 最新评论正在加载中 HOT 6
- [Bug]: Waline 评论无法展示 HOT 1
- [Bug]: Artalk无法正常获取评论 HOT 2
- [Bug]:未适配waline 3.0.1,无法显示评论系统 HOT 1
- [Bug]: butterfly对于 无序列表中的代码块渲染出错 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hexo-theme-butterfly.