mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-12 22:17:06 +08:00
feat: gallery 標籤外掛增加 json 獲取
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 重構
This commit is contained in:
@@ -14,9 +14,13 @@ script.
|
||||
}, !{JSON.stringify(option)}))
|
||||
}
|
||||
|
||||
if (typeof Waline === 'object') initWaline()
|
||||
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)}').then(() => {
|
||||
getCSS('!{url_for(theme.asset.waline_css)}','waline-css').then(() => {
|
||||
getScript('!{url_for(theme.asset.waline_js)}').then(initWaline)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
- const { server, option } = theme.artalk
|
||||
- const { server, site, option } = theme.artalk
|
||||
- const avatarCdn = option !== null && option.gravatar ? option.gravatar.mirror : 'https://sdn.geekzu.org/avatar/'
|
||||
- const avatarDefault = option !== null && option.gravatar ? option.gravatar.default : 'mp'
|
||||
|
||||
@@ -45,8 +45,15 @@ script.
|
||||
window.pjax && window.pjax.refresh($dom)
|
||||
}
|
||||
|
||||
const headerList = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Origin': window.location.origin
|
||||
}
|
||||
}
|
||||
|
||||
const getComment = () => {
|
||||
fetch('!{server}/api/stat?type=latest_comments&limit=!{theme.newest_comments.limit}',{method: "POST"})
|
||||
fetch('!{server}/api/stat?type=latest_comments&limit=!{theme.newest_comments.limit}&site_name=!{site}', headerList)
|
||||
.then(response => response.json())
|
||||
.then(d => {
|
||||
const artalk = d.data.map(function (e) {
|
||||
|
||||
@@ -16,3 +16,7 @@
|
||||
.algolia-poweredBy
|
||||
|
||||
#search-mask
|
||||
|
||||
script(src=url_for(theme.asset.algolia_search_v4))
|
||||
script(src=url_for(theme.asset.instantsearch_v4))
|
||||
script(src=url_for(theme.asset.algolia_js))
|
||||
27
layout/includes/third-party/search/docsearch.pug
vendored
Normal file
27
layout/includes/third-party/search/docsearch.pug
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
- const { appId, apiKey, indexName, option } = theme.docsearch
|
||||
|
||||
.docsearch-wrap
|
||||
#docsearch(style="display:none")
|
||||
link(rel="stylesheet" href=url_for(theme.asset.docsearch_css))
|
||||
script(src=url_for(theme.asset.docsearch_js))
|
||||
script.
|
||||
(() => {
|
||||
docsearch(Object.assign({
|
||||
appId: '!{appId}',
|
||||
apiKey: '!{apiKey}',
|
||||
indexName: '!{indexName}',
|
||||
container: '#docsearch',
|
||||
}, !{JSON.stringify(option)}))
|
||||
|
||||
|
||||
const searchClickFn = () => {
|
||||
document.querySelector('#search-button > .search').addEventListener('click', () => {
|
||||
document.querySelector('.DocSearch-Button').click()
|
||||
})
|
||||
}
|
||||
|
||||
searchClickFn()
|
||||
window.addEventListener('pjax:complete', searchClickFn)
|
||||
})()
|
||||
|
||||
|
||||
4
layout/includes/third-party/search/index.pug
vendored
4
layout/includes/third-party/search/index.pug
vendored
@@ -1,4 +1,6 @@
|
||||
if theme.algolia_search.enable
|
||||
include ./algolia.pug
|
||||
else if theme.local_search.enable
|
||||
include ./local-search.pug
|
||||
include ./local-search.pug
|
||||
else if theme.docsearch.enable
|
||||
include ./docsearch.pug
|
||||
@@ -17,4 +17,6 @@
|
||||
hr
|
||||
#local-search-results
|
||||
|
||||
#search-mask
|
||||
#search-mask
|
||||
|
||||
script(src=url_for(theme.asset.local_search))
|
||||
Reference in New Issue
Block a user