mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2025-09-15 12:58:48 +08:00
feat: 本地搜索,點擊文章內容也會跳轉到相應頁面 feat: 添加 docsearch feat: 標籤頁支持配置 orderby 和 order 參數 feat: card_tags 可配置 orderby 和 order 參數 fix: 修復本地搜索,輸入 ?d 報錯的 bug closed #1192 fix: 修復 waline 在 pjax 模式下 css 沒有加載的 bug fix: 修復 artalk 最新評論無法加載 closed #1191 fix: 修復 card_author 和 card_announcement 設為 false 後,aside 卡片沒有間距的 bug closed #1174 improvement: getCSS 重構
39 lines
1.1 KiB
Plaintext
39 lines
1.1 KiB
Plaintext
- const { serverURL, option, pageview } = theme.waline
|
|
- const { lazyload, count, use } = theme.comments
|
|
|
|
script.
|
|
function loadWaline () {
|
|
function initWaline () {
|
|
const waline = Waline.init(Object.assign({
|
|
el: '#waline-wrap',
|
|
serverURL: '!{serverURL}',
|
|
pageview: !{lazyload ? false : pageview},
|
|
dark: 'html[data-theme="dark"]',
|
|
path: window.location.pathname,
|
|
comment: !{lazyload ? false : count},
|
|
}, !{JSON.stringify(option)}))
|
|
}
|
|
|
|
const walineCSSLoad = document.getElementById('waline-css')
|
|
|
|
if (typeof Waline === 'object') {
|
|
walineCSSLoad ? initWaline() : getCSS('!{url_for(theme.asset.waline_css)}','waline-css').then(initWaline)
|
|
}
|
|
else {
|
|
getCSS('!{url_for(theme.asset.waline_css)}','waline-css').then(() => {
|
|
getScript('!{url_for(theme.asset.waline_js)}').then(initWaline)
|
|
})
|
|
}
|
|
}
|
|
|
|
if ('!{use[0]}' === 'Waline' || !!{lazyload}) {
|
|
if (!{lazyload}) btf.loadComment(document.getElementById('waline-wrap'),loadWaline)
|
|
else setTimeout(loadWaline, 0)
|
|
} else {
|
|
function loadOtherComment () {
|
|
loadWaline()
|
|
}
|
|
}
|
|
|
|
|