feat: twikoo 增加 option 配置

feat: aside widget 增加排序(只對page頁和sticky內的有效)
feat: aside 增加自定義 widget
improvement: readmode 優化
improvement: html結構優化
This commit is contained in:
Jerry
2020-12-24 01:29:09 +08:00
Unverified
parent 25cf081250
commit d5d5681981
25 changed files with 242 additions and 169 deletions

View File

@@ -32,7 +32,7 @@ hr
when 'Twikoo'
#twikoo-wrap
when 'Waline'
#waline
#waline-wrap
when 'Facebook Comments'
.fb-comments(data-colorscheme = theme.display_mode === 'dark' ? 'dark' : 'light'
data-numposts= theme.facebook_comments.pageSize || 10

View File

@@ -1,16 +1,25 @@
- let option = theme.twikoo.option ? JSON.stringify(theme.twikoo.option) : false
script.
(()=>{
const $countDom = document.getElementById('twikoo-count')
const init = () => {
twikoo.init({
envId: '!{theme.twikoo}',
let initData = {
envId: '!{theme.twikoo.envId}',
el: '#twikoo-wrap'
})
}
if (!{Boolean(option)}) {
const otherData = !{option}
initData = Object.assign(initData, otherData)
}
twikoo.init(initData)
}
const getCount = () => {
twikoo.getCommentsCount({
envId: '!{theme.twikoo}',
envId: '!{theme.twikoo.envId}',
urls: [window.location.pathname],
includeReply: false
}).then(function (res) {

View File

@@ -29,7 +29,7 @@ script.
if (!{Boolean(option)}) {
const otherData = !{option}
initData = Object.assign({}, initData, otherData)
initData = Object.assign(initData, otherData)
}
const valine = new Valine(initData)
@@ -40,7 +40,7 @@ script.
}
if ('!{theme.comments.use[0]}' === 'Valine' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) btf.loadComment(document.querySelector('#vcomment'),loadValine)
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('vcomment'),loadValine)
else setTimeout(loadValine, 0)
} else {
function loadOtherComment () {

View File

@@ -4,7 +4,7 @@ script.
function loadWaline () {
function initWaline () {
let initData = {
el: '#waline',
el: '#waline-wrap',
serverURL: '!{theme.waline.serverURL}',
avatar: '#{theme.waline.avatar}',
path: location.pathname,
@@ -12,7 +12,7 @@ script.
if (!{Boolean(option)}) {
const otherData = !{option}
initData = Object.assign({}, initData, otherData)
initData = Object.assign(initData, otherData)
}
const waline = new Waline(initData)
@@ -23,7 +23,7 @@ script.
}
if ('!{theme.comments.use[0]}' === 'Waline' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) btf.loadComment(document.querySelector('#waline'),loadWaline)
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('waline-wrap'),loadWaline)
else setTimeout(loadWaline, 0)
} else {
function loadOtherComment () {

View File

@@ -16,7 +16,7 @@ script.
const getComment = () => {
const runTwikoo = () => {
twikoo.getRecentComments({
envId: '!{theme.twikoo}',
envId: '!{theme.twikoo.envId}',
pageSize: !{theme.newest_comments.limit},
includeReply: true
}).then(function (res) {