mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-08 12:07:06 +08:00
breaking changes: waline 適配 V2
breaking changes: waline 的 visitor 改為 pageview feat: algolia 搜索增加文章內容顯示和高亮 feat: 搜索內容顯示區域變大
This commit is contained in:
61
.github/ISSUE_TEMPLATE/bug_report.md
vendored
61
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,61 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!-- Do not delete the template (不要刪除模板) -->
|
||||
|
||||
<!--
|
||||
IMPORTANT: Please follow the template to create a new issue.
|
||||
重要:請依照該模板來提交。
|
||||
|
||||
If you upgrade from the old version, and an error occurs when running, please copy the new content in the config to the butterfly.yml
|
||||
如果你是由舊版本升級到新版,執行時出現報錯,請首先把config裡新的內容複製到舊的butterfly設定去(如有)
|
||||
|
||||
If you are a problem when visiting the website, please open your browser 'developer tools (shortcut F12)' and check the console if there is an error, include your website address in the feedback
|
||||
如果你是線上訪問出現問題,請檢查瀏覽器‘開發人員工具(快捷鍵F12)’的console是否有報錯,反饋時附上你的網站
|
||||
-->
|
||||
|
||||
|
||||
## I want to create a Bug report <!-- 我想要建立一個 Bug report -->
|
||||
|
||||
<!-- Check all with "x" especially FAQ & Documentation!! (使用 "x" 選擇) -->
|
||||
<!-- 請確認是否都已經翻閲過如下的資料, 尤其是安裝文件!! -->
|
||||
- [] Yes, I have read [Hexo Docs page](https://hexo.io/docs/), especially [Templates](https://hexo.io/docs/templates.html), [Variables](https://hexo.io/docs/variables.html), [Helpers](https://hexo.io/docs/helpers.html) and [Troubleshooting](https://hexo.io/docs/troubleshooting.html).
|
||||
- [] Yes, I have read [Butterfly Documentation](https://butterfly.js.org/posts/21cfbf15/).
|
||||
- [] And yes, I already searched for current [issues](https://github.com/jerryc127/hexo-theme-butterfly/issues?utf8=%E2%9C%93&q=is%3Aissue) and this did not help me.
|
||||
|
||||
## Butterfly Information
|
||||
|
||||
<!-- Butterfly的版本 -->
|
||||
<!-- 檢視主題的package.json -->
|
||||
**Butterfly Version:**
|
||||
|
||||
<!-- Windows/macOS/Linux/Android/iOS -->
|
||||
**Platform:**
|
||||
|
||||
<!-- Chrome/Safari/FireFox/.. -->
|
||||
**Browser:**
|
||||
|
||||
## Expected behavior <!-- (預期行為) -->
|
||||
|
||||
## Actual behavior <!-- (實際行為) -->
|
||||
|
||||
## Steps to reproduce the behavior <!-- (重現步驟) -->
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
<!-- If applicable, add screenshots to help explain your problem -->
|
||||
<!-- 請儘量提供截圖來定位問題 -->
|
||||
## Screenshots <!-- (截圖) -->
|
||||
|
||||
<!-- Provide your website to find the issues -->
|
||||
## Website
|
||||
|
||||
## Describe the bug
|
||||
63
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
63
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
name: Bug report
|
||||
description: Create a report to help us improve
|
||||
title: '[Bug]: '
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
重要:請依照該模板來提交
|
||||
Please follow the template to create a new issue
|
||||
- type: input
|
||||
id: butterfly-ver
|
||||
attributes:
|
||||
label: 使用的 Butterfly 版本? | What version of Butterfly are you use?
|
||||
description: 檢視主題的 package.json | Check the theme's package.json
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: browser
|
||||
attributes:
|
||||
label: 使用的瀏覽器? || What browse are you using?
|
||||
options:
|
||||
- Chrome
|
||||
- Edge
|
||||
- Safari
|
||||
- Opera
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: platform
|
||||
attributes:
|
||||
label: 使用的系統? || What operating system are you using?
|
||||
options:
|
||||
- Windows
|
||||
- macOS
|
||||
- Linux
|
||||
- Android
|
||||
- iOS
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: 問題描述 | Describe the bug
|
||||
description: 請描述你的問題現象 | A clear and concise description of what the bug is.
|
||||
placeholder: 請儘量提供截圖來定位問題 | If applicable, add screenshots to help explain your problem
|
||||
value:
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
id: website
|
||||
attributes:
|
||||
label: 出現問題網站 | Website
|
||||
description: 請提供下可復現網站地址 | Please supply a website url which can reproduce problem.
|
||||
placeholder:
|
||||
validations:
|
||||
required: true
|
||||
22
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
22
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Questions about Butterfly
|
||||
url: https://github.com/jerryc127/hexo-theme-butterfly/discussions
|
||||
about: 一些使用問題請到 Discussion 詢問。 Please ask questions in Discussion.
|
||||
|
||||
- name: Butterfly Q&A
|
||||
url: https://butterfly.js.org/posts/98d20436/
|
||||
about: Butterfly Q&A
|
||||
|
||||
- name: Telegram
|
||||
url: https://t.me/bu2fly
|
||||
about: 'Official Telegram Group'
|
||||
|
||||
- name: QQ 1群
|
||||
url: https://jq.qq.com/?_wv=1027&k=KU9105XR
|
||||
about: '群號 1070540070,不要兩個Q群都添加'
|
||||
|
||||
- name: QQ 2群
|
||||
url: https://jq.qq.com/?_wv=1027&k=r1nK0DQz
|
||||
about: '群號 978221020,不要兩個Q群都添加'
|
||||
|
||||
9
.github/ISSUE_TEMPLATE/custom.md
vendored
9
.github/ISSUE_TEMPLATE/custom.md
vendored
@@ -1,9 +0,0 @@
|
||||
---
|
||||
name: Custom issue template
|
||||
about: Describe this issue template's purpose here.
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
|
||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,20 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
14
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
14
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
name: Feature request
|
||||
description: Suggest an idea for this project
|
||||
title: '[Feature]: '
|
||||
|
||||
body:
|
||||
- type: textarea
|
||||
id: feature-request
|
||||
attributes:
|
||||
label: 想要的功能 | What feature do you want?
|
||||
description: 请描述你需要的新功能 | A clear and concise description of what the feature is.
|
||||
placeholder:
|
||||
value:
|
||||
validations:
|
||||
require: true
|
||||
@@ -313,7 +313,7 @@ valine:
|
||||
waline:
|
||||
serverURL: # Waline server address url
|
||||
bg: # waline background
|
||||
visitor: false
|
||||
pageview: false
|
||||
option:
|
||||
|
||||
# utterances
|
||||
@@ -860,7 +860,8 @@ CDN:
|
||||
# disqusjs:
|
||||
# disqusjs_css:
|
||||
# twikoo:
|
||||
# waline:
|
||||
# waline_js:
|
||||
# waline_css:
|
||||
# sharejs:
|
||||
# sharejs_css:
|
||||
# mathjax:
|
||||
|
||||
@@ -43,7 +43,6 @@ search:
|
||||
hits_stats: '${hits} results found in ${time} ms'
|
||||
|
||||
local_search:
|
||||
label: Local search
|
||||
input_placeholder: Search for Posts
|
||||
hits_empty: "We didn't find any results for the search: ${query}"
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ search:
|
||||
hits_stats: '${hits} results found in ${time} ms'
|
||||
|
||||
local_search:
|
||||
label: Local search
|
||||
input_placeholder: Search for Posts
|
||||
hits_empty: "We didn't find any results for the search: ${query}"
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ search:
|
||||
hits_stats: '找到 ${hits} 条结果,用时 ${time} 毫秒'
|
||||
|
||||
local_search:
|
||||
label: 本地搜索
|
||||
input_placeholder: 搜索文章
|
||||
hits_empty: '找不到您查询的内容:${query}'
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@ search:
|
||||
hits_stats: '找到 ${hits} 條結果,用時 ${time} 毫秒'
|
||||
|
||||
local_search:
|
||||
label: 本地搜尋
|
||||
input_placeholder: 搜尋文章
|
||||
hits_empty: '找不到您查詢的內容:${query}'
|
||||
|
||||
|
||||
@@ -61,16 +61,24 @@
|
||||
if block
|
||||
block
|
||||
|
||||
if theme.busuanzi.page_pv
|
||||
- const commentUse = comments.use
|
||||
if commentUse && !comments.lazyload
|
||||
case commentUse[0]
|
||||
when 'Valine'
|
||||
if theme.valine.visitor
|
||||
+pvBlock(url_for(page.path),'leancloud_visitors',page.title)
|
||||
span.leancloud-visitors-count
|
||||
when 'Waline'
|
||||
if theme.waline.pageview
|
||||
+pvBlock('','','')
|
||||
span.waline-pageview-count(data-path=url_for(page.path))
|
||||
when 'Twikoo'
|
||||
if theme.twikoo.visitor
|
||||
+pvBlock('','','')
|
||||
span#twikoo_visitors
|
||||
else if theme.busuanzi.page_pv
|
||||
+pvBlock('','post-meta-pv-cv','')
|
||||
span#busuanzi_value_page_pv
|
||||
else if comments.use && !comments.lazyload
|
||||
if (comments.use.includes('Valine') && theme.valine.visitor) || (comments.use.includes('Waline') && theme.waline.visitor)
|
||||
+pvBlock(url_for(page.path),'leancloud_visitors',page.title)
|
||||
span.leancloud-visitors-count
|
||||
else if (comments.use.includes('Twikoo') && theme.twikoo.visitor)
|
||||
+pvBlock('','','')
|
||||
span#twikoo_visitors
|
||||
|
||||
if comments.count && !comments.lazyload && page.comments !== false && comments.use
|
||||
- var whichCount = comments.use[0]
|
||||
@@ -96,7 +104,7 @@
|
||||
when 'Waline'
|
||||
+countBlock
|
||||
a(href=url_for(page.path) + '#post-comment')
|
||||
span.waline-comment-count(id=url_for(page.path))
|
||||
span.waline-comment-count(data-path=url_for(page.path))
|
||||
when 'Gitalk'
|
||||
+countBlock
|
||||
a(href=url_for(page.path) + '#post-comment')
|
||||
|
||||
@@ -5,12 +5,13 @@ script.
|
||||
let initData = {
|
||||
el: null,
|
||||
serverURL: '!{theme.waline.serverURL}',
|
||||
comment: true
|
||||
}
|
||||
const waline = new Waline(initData)
|
||||
const waline = Waline.init(initData)
|
||||
}
|
||||
|
||||
if (typeof Waline === 'function') initWaline()
|
||||
else getScript('!{url_for(theme.asset.waline)}').then(initWaline)
|
||||
else getScript('!{url_for(theme.asset.waline_js)}').then(initWaline)
|
||||
}
|
||||
|
||||
window.pjax ? loadWaline() : window.addEventListener('load', loadWaline)
|
||||
|
||||
28
layout/includes/third-party/comments/waline.pug
vendored
28
layout/includes/third-party/comments/waline.pug
vendored
@@ -1,23 +1,35 @@
|
||||
- const { serverURL, visitor, option } = theme.waline
|
||||
- const { serverURL, option, pageview } = theme.waline
|
||||
- const { lazyload, count, use } = theme.comments
|
||||
|
||||
script.
|
||||
function loadWaline () {
|
||||
function insertCSS () {
|
||||
const link = document.createElement("link")
|
||||
link.rel = "stylesheet"
|
||||
link.href = "!{url_for(theme.asset.waline_css)}"
|
||||
document.head.appendChild(link)
|
||||
}
|
||||
|
||||
function initWaline () {
|
||||
const waline = new Waline(Object.assign({
|
||||
const waline = Waline.init(Object.assign({
|
||||
el: '#waline-wrap',
|
||||
serverURL: '!{serverURL}',
|
||||
path: location.pathname,
|
||||
visitor: !{visitor},
|
||||
dark: 'html[data-theme="dark"]'
|
||||
pageview: !{lazyload ? false : pageview},
|
||||
dark: 'html[data-theme="dark"]',
|
||||
path: window.location.pathname,
|
||||
comment: !{lazyload ? false : count},
|
||||
}, !{JSON.stringify(option)}))
|
||||
}
|
||||
|
||||
if (typeof Waline === 'function') initWaline()
|
||||
else getScript('!{url_for(theme.asset.waline)}').then(initWaline)
|
||||
else {
|
||||
insertCSS()
|
||||
getScript('!{url_for(theme.asset.waline_js)}').then(initWaline)
|
||||
}
|
||||
}
|
||||
|
||||
if ('!{theme.comments.use[0]}' === 'Waline' || !!{theme.comments.lazyload}) {
|
||||
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('waline-wrap'),loadWaline)
|
||||
if ('!{use[0]}' === 'Waline' || !!{lazyload}) {
|
||||
if (!{lazyload}) btf.loadComment(document.getElementById('waline-wrap'),loadWaline)
|
||||
else setTimeout(loadWaline, 0)
|
||||
} else {
|
||||
function loadOtherComment () {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
- let { avatar,avatarCDN } = theme.waline
|
||||
|
||||
script.
|
||||
window.addEventListener('load', () => {
|
||||
const changeContent = (content) => {
|
||||
@@ -45,11 +43,11 @@ script.
|
||||
|
||||
const getComment = () => {
|
||||
const loadWaline = () => {
|
||||
Waline.Widget.RecentComments({
|
||||
Waline.RecentComments({
|
||||
serverURL: '!{theme.waline.serverURL}',
|
||||
count: !{theme.newest_comments.limit}
|
||||
}).then(res => {
|
||||
const walineArray = res.comments.map(e => {
|
||||
}).then(({comments}) => {
|
||||
const walineArray = comments.map(e => {
|
||||
return {
|
||||
'content': changeContent(e.comment),
|
||||
'avatar': e.avatar,
|
||||
@@ -67,7 +65,7 @@ script.
|
||||
}
|
||||
|
||||
if (typeof Waline === 'function') loadWaline()
|
||||
else getScript('!{url_for(theme.asset.waline)}').then(loadWaline)
|
||||
else getScript('!{url_for(theme.asset.waline_js)}').then(loadWaline)
|
||||
}
|
||||
|
||||
const newestCommentInit = () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#algolia-search
|
||||
.search-dialog
|
||||
nav.search-nav
|
||||
span.search-dialog-title= 'Algolia'
|
||||
span.search-dialog-title= _p('search.title')
|
||||
button.search-close-button
|
||||
i.fas.fa-times
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#algolia-search-results
|
||||
#algolia-hits
|
||||
#algolia-pagination
|
||||
#algolia-stats
|
||||
#algolia-info
|
||||
.algolia-stats
|
||||
.algolia-poweredBy
|
||||
|
||||
#search-mask
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#local-search
|
||||
.search-dialog
|
||||
nav.search-nav
|
||||
span.search-dialog-title=_p("search.local_search.label")
|
||||
span.search-dialog-title= _p('search.title')
|
||||
span#loading-status
|
||||
button.search-close-button
|
||||
i.fas.fa-times
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hexo-theme-butterfly",
|
||||
"version": "4.2.0-b2",
|
||||
"version": "4.2.0",
|
||||
"description": "A Simple and Card UI Design theme for Hexo",
|
||||
"main": "package.json",
|
||||
"scripts": {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
'use strict'
|
||||
|
||||
const { version } = require('../../package.json')
|
||||
const path = require('path')
|
||||
|
||||
hexo.extend.filter.register('before_generate', () => {
|
||||
const themeConfig = hexo.theme.config
|
||||
@@ -15,206 +16,70 @@ hexo.extend.filter.register('before_generate', () => {
|
||||
/**
|
||||
* Merge CDN
|
||||
*/
|
||||
const internalData = {
|
||||
main_css: {
|
||||
cdn: '/css/index.css',
|
||||
local: '/css/index.css'
|
||||
},
|
||||
main: {
|
||||
cdn: `https://cdn.jsdelivr.net/npm/hexo-theme-butterfly@${version}/source/js/main.min.js`,
|
||||
local: '/js/main.js'
|
||||
},
|
||||
utils: {
|
||||
cdn: `https://cdn.jsdelivr.net/npm/hexo-theme-butterfly@${version}/source/js/utils.min.js`,
|
||||
local: '/js/utils.js'
|
||||
},
|
||||
translate: {
|
||||
cdn: `https://cdn.jsdelivr.net/npm/hexo-theme-butterfly@${version}/source/js/tw_cn.min.js`,
|
||||
local: '/js/tw_cn.js'
|
||||
},
|
||||
local_search: {
|
||||
cdn: `https://cdn.jsdelivr.net/npm/hexo-theme-butterfly@${version}/source/js/search/local-search.min.js`,
|
||||
local: '/js/search/local-search.js'
|
||||
},
|
||||
algolia_js: {
|
||||
cdn: `https://cdn.jsdelivr.net/npm/hexo-theme-butterfly@${version}/source/js/search/algolia.min.js`,
|
||||
local: '/js/search/algolia.js'
|
||||
}
|
||||
|
||||
const internalSrcCDN = {
|
||||
main_css: '/css/index.css',
|
||||
main: `https://cdn.jsdelivr.net/npm/hexo-theme-butterfly@${version}/source/js/main.min.js`,
|
||||
utils: `https://cdn.jsdelivr.net/npm/hexo-theme-butterfly@${version}/source/js/utils.min.js`,
|
||||
translate: `https://cdn.jsdelivr.net/npm/hexo-theme-butterfly@${version}/source/js/tw_cn.min.js`,
|
||||
local_search: `https://cdn.jsdelivr.net/npm/hexo-theme-butterfly@${version}/source/js/search/local-search.min.js`,
|
||||
algolia_js: `https://cdn.jsdelivr.net/npm/hexo-theme-butterfly@${version}/source/js/search/algolia.min.js`,
|
||||
}
|
||||
|
||||
const data = {
|
||||
algolia_search_v4: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js',
|
||||
local: '/js/lib/algolia/algoliasearch-lite.umd.js'
|
||||
},
|
||||
instantsearch_v4: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js',
|
||||
local: '/js/lib/algolia/instantsearch.production.min.js'
|
||||
},
|
||||
pjax: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/pjax/pjax.min.js',
|
||||
local: '/js/lib/pjax/pjax.min.js'
|
||||
},
|
||||
gitalk: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.js',
|
||||
local: '/js/lib/gitalk/gitalk.min.js'
|
||||
},
|
||||
gitalk_css: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/gitalk/dist/gitalk.min.css',
|
||||
local: '/js/lib/gitalk/gitalk.css'
|
||||
},
|
||||
blueimp_md5: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/blueimp-md5/js/md5.min.js',
|
||||
local: '/js/lib/blueimp-md5/md5.min.js'
|
||||
},
|
||||
valine: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js',
|
||||
local: '/js/lib/valine/Valine.min.js'
|
||||
},
|
||||
disqusjs: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/disqusjs@1/dist/disqus.js',
|
||||
local: '/js/lib/disqusjs/disqus.js'
|
||||
},
|
||||
disqusjs_css: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/disqusjs@1/dist/disqusjs.css',
|
||||
local: '/js/lib/disqusjs/disqusjs.css'
|
||||
},
|
||||
twikoo: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/twikoo@1/dist/twikoo.all.min.js',
|
||||
local: '/js/lib/twikoo/twikoo.all.min.js'
|
||||
},
|
||||
waline: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/@waline/client/dist/Waline.min.js',
|
||||
local: '/js/lib/waline/Waline.min.js'
|
||||
},
|
||||
sharejs: {
|
||||
cdn: 'https://cdn.jsdelivr.net/gh/overtrue/share.js@master/dist/js/social-share.min.js',
|
||||
local: '/js/lib/social-share.js/dist/social-share.min.js'
|
||||
},
|
||||
sharejs_css: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css',
|
||||
local: '/js/lib/social-share.js/dist/share.min.css'
|
||||
},
|
||||
mathjax: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js',
|
||||
local: '/js/lib/mathjax/tex-mml-chtml.js'
|
||||
},
|
||||
katex: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css',
|
||||
local: '/js/lib/katex/katex.min.css'
|
||||
},
|
||||
katex_copytex: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/katex@latest/dist/contrib/copy-tex.min.js',
|
||||
local: '/js/lib/katex/copy-tex.min.js'
|
||||
},
|
||||
katex_copytex_css: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/katex@latest/dist/contrib/copy-tex.css',
|
||||
local: '/js/lib/katex/copy-tex.css'
|
||||
},
|
||||
mermaid: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js',
|
||||
local: '/js/lib/mermaid/mermaid.min.js'
|
||||
},
|
||||
canvas_ribbon: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-ribbon.min.js',
|
||||
local: '/js/lib/effect/canvas-ribbon.min.js'
|
||||
},
|
||||
canvas_fluttering_ribbon: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js',
|
||||
local: '/js/lib/effect/canvas-fluttering-ribbon.min.js'
|
||||
},
|
||||
canvas_nest: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-nest.min.js',
|
||||
local: '/js/lib/effect/canvas-nest.min.js'
|
||||
},
|
||||
activate_power_mode: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/activate-power-mode.min.js',
|
||||
local: '/js/lib/effect/activate-power-mode.min.js'
|
||||
},
|
||||
fireworks: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/fireworks.min.js',
|
||||
local: '/js/lib/effect/fireworks.min.js'
|
||||
},
|
||||
click_heart: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-heart.min.js',
|
||||
local: '/js/lib/effect/click-heart.min.js'
|
||||
},
|
||||
ClickShowText: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-show-text.min.js',
|
||||
local: '/js/lib/effect/click-show-text.min.js'
|
||||
},
|
||||
lazyload: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js',
|
||||
local: '/js/lib/vanilla-lazyload/lazyload.iife.min.js'
|
||||
},
|
||||
instantpage: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/instant.page@5/instantpage.min.js',
|
||||
local: '/js/lib/instant.page/instantpage.min.js'
|
||||
},
|
||||
typed: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js',
|
||||
local: '/js/lib/typed.js/typed.min.js'
|
||||
},
|
||||
pangu: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/pangu@4/dist/browser/pangu.min.js',
|
||||
local: '/js/lib/pangu/pangu.min.js'
|
||||
},
|
||||
fancybox_css_v4: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css',
|
||||
local: '/js/lib/fancyapps/fancybox.css'
|
||||
},
|
||||
fancybox_v4: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.js',
|
||||
local: '/js/lib/fancyapps/fancybox.umd.js'
|
||||
},
|
||||
medium_zoom: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/medium-zoom/dist/medium-zoom.min.js',
|
||||
local: '/js/lib/medium-zoom/medium-zoom.min.js'
|
||||
},
|
||||
snackbar_css: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css',
|
||||
local: '/js/lib/node-snackbar/snackbar.min.css'
|
||||
},
|
||||
snackbar: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js',
|
||||
local: '/js/lib/node-snackbar/snackbar.min.js'
|
||||
},
|
||||
fontawesomeV6: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/css/all.min.css',
|
||||
local: '/js/lib/fontawesome-free/dist/all.min.css'
|
||||
},
|
||||
flickr_justified_gallery_js: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.js',
|
||||
local: '/js/lib/flickr-justified-gallery/fjGallery.min.js'
|
||||
},
|
||||
flickr_justified_gallery_css: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.css',
|
||||
local: '/js/lib/flickr-justified-gallery/fjGallery.min.css'
|
||||
},
|
||||
aplayer_css: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/aplayer@1/dist/APlayer.min.css',
|
||||
local: '/js/lib/aplayer/APlayer.min.css'
|
||||
},
|
||||
aplayer_js: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/aplayer@1/dist/APlayer.min.js',
|
||||
local: '/js/lib/aplayer/APlayer.min.js'
|
||||
},
|
||||
meting_js: {
|
||||
cdn: 'https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js',
|
||||
local: '/js/lib/aplayer/Meting.min.js'
|
||||
},
|
||||
prismjs_js: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/prismjs@1/prism.min.js',
|
||||
local: '/js/lib/prismjs/prism.min.js'
|
||||
},
|
||||
prismjs_lineNumber_js: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/prismjs@1/plugins/line-numbers/prism-line-numbers.min.js',
|
||||
local: '/js/lib/prismjs/prism-line-numbers.min.js'
|
||||
},
|
||||
prismjs_autoloader: {
|
||||
cdn: 'https://cdn.jsdelivr.net/npm/prismjs@1/plugins/autoloader/prism-autoloader.min.js',
|
||||
local: '/js/lib/prismjs/prism-autoloader.min.js'
|
||||
}
|
||||
const internalSrcLocal = {
|
||||
main_css: '/css/index.css',
|
||||
main: '/js/main.js',
|
||||
utils: '/js/utils.js',
|
||||
translate: '/js/tw_cn.js',
|
||||
local_search: '/js/search/local-search.js',
|
||||
algolia_js: '/js/search/algolia.js',
|
||||
}
|
||||
|
||||
const thirdPartySrcCDN = {
|
||||
algolia_search_v4: 'https://cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js',
|
||||
instantsearch_v4: 'https://cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js',
|
||||
pjax: 'https://cdn.jsdelivr.net/npm/pjax/pjax.min.js',
|
||||
gitalk: 'https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.js',
|
||||
gitalk_css: 'https://cdn.jsdelivr.net/npm/gitalk/dist/gitalk.min.css',
|
||||
blueimp_md5: 'https://cdn.jsdelivr.net/npm/blueimp-md5/js/md5.min.js',
|
||||
valine: 'https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js',
|
||||
disqusjs: 'https://cdn.jsdelivr.net/npm/disqusjs@1/dist/disqus.js',
|
||||
disqusjs_css: 'https://cdn.jsdelivr.net/npm/disqusjs@1/dist/disqusjs.css',
|
||||
twikoo: 'https://cdn.jsdelivr.net/npm/twikoo@1/dist/twikoo.all.min.js',
|
||||
waline_js: 'https://cdn.jsdelivr.net/npm/@waline/client/dist/waline.js',
|
||||
waline_css: 'https://cdn.jsdelivr.net/npm/@waline/client/dist/waline.css',
|
||||
sharejs: 'https://cdn.jsdelivr.net/gh/overtrue/share.js@master/dist/js/social-share.min.js',
|
||||
sharejs_css: 'https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css',
|
||||
mathjax: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js',
|
||||
katex: 'https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css',
|
||||
katex_copytex: 'https://cdn.jsdelivr.net/npm/katex@latest/dist/contrib/copy-tex.min.js',
|
||||
katex_copytex_css: 'https://cdn.jsdelivr.net/npm/katex@latest/dist/contrib/copy-tex.css',
|
||||
mermaid: 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js',
|
||||
canvas_ribbon: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-ribbon.min.js',
|
||||
canvas_fluttering_ribbon: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js',
|
||||
canvas_nest: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-nest.min.js',
|
||||
activate_power_mode: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/activate-power-mode.min.js',
|
||||
fireworks: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/fireworks.min.js',
|
||||
click_heart: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-heart.min.js',
|
||||
ClickShowText: 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-show-text.min.js',
|
||||
lazyload: 'https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js',
|
||||
instantpage: 'https://cdn.jsdelivr.net/npm/instant.page@5/instantpage.min.js',
|
||||
typed: 'https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js',
|
||||
pangu: 'https://cdn.jsdelivr.net/npm/pangu@4/dist/browser/pangu.min.js',
|
||||
fancybox_css_v4: 'https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css',
|
||||
fancybox_v4: 'https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.js',
|
||||
medium_zoom: 'https://cdn.jsdelivr.net/npm/medium-zoom/dist/medium-zoom.min.js',
|
||||
snackbar_css: 'https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css',
|
||||
snackbar: 'https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js',
|
||||
fontawesomeV6: 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/css/all.min.css',
|
||||
flickr_justified_gallery_js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.js',
|
||||
flickr_justified_gallery_css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.css',
|
||||
aplayer_css: 'https://cdn.jsdelivr.net/npm/aplayer@1/dist/APlayer.min.css',
|
||||
aplayer_js: 'https://cdn.jsdelivr.net/npm/aplayer@1/dist/APlayer.min.js',
|
||||
meting_js: 'https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js',
|
||||
prismjs_js: 'https://cdn.jsdelivr.net/npm/prismjs@1/prism.min.js',
|
||||
prismjs_lineNumber_js: 'https://cdn.jsdelivr.net/npm/prismjs@1/plugins/line-numbers/prism-line-numbers.min.js',
|
||||
prismjs_autoloader: 'https://cdn.jsdelivr.net/npm/prismjs@1/plugins/autoloader/prism-autoloader.min.js',
|
||||
}
|
||||
|
||||
// delete null value
|
||||
@@ -227,16 +92,28 @@ hexo.extend.filter.register('before_generate', () => {
|
||||
}
|
||||
|
||||
const defaultVal = (obj, choose) => {
|
||||
const str = choose === 'local' ? 'local' : 'cdn'
|
||||
|
||||
for (const i in obj) {
|
||||
obj[i] = obj[i][str]
|
||||
if (obj === 'internal') {
|
||||
if (choose === 'local') return internalSrcLocal
|
||||
else return internalSrcCDN
|
||||
}
|
||||
|
||||
if (obj === 'external') {
|
||||
if (choose === 'local') {
|
||||
let result = {}
|
||||
try {
|
||||
const data = path.join(hexo.plugin_dir,'hexo-butterfly-extjs/plugins.yml')
|
||||
result = hexo.render.renderSync({ path: data, engine: 'yaml'})
|
||||
Object.keys(result).map(key => {
|
||||
result[key] = 'pluginsSrc/' + result[key]
|
||||
})
|
||||
} catch (e) {}
|
||||
return result
|
||||
} else return thirdPartySrcCDN
|
||||
}
|
||||
return obj
|
||||
}
|
||||
|
||||
themeConfig.asset = Object.assign(defaultVal(internalData, CDN.internal_provider),
|
||||
defaultVal(data, CDN.third_party_provider), deleteNullValue(CDN.option))
|
||||
themeConfig.asset = Object.assign(defaultVal('internal', CDN.internal_provider),
|
||||
defaultVal('external', CDN.third_party_provider), deleteNullValue(CDN.option))
|
||||
|
||||
/**
|
||||
* Capitalize the first letter of comment name
|
||||
|
||||
@@ -76,6 +76,13 @@
|
||||
+maxWidth768()
|
||||
height: calc(100vh - 260px)
|
||||
|
||||
#algolia-info
|
||||
div
|
||||
display: inline
|
||||
|
||||
.algolia-poweredBy
|
||||
float: right
|
||||
|
||||
.apple
|
||||
#algolia-search
|
||||
#algolia-hits
|
||||
|
||||
@@ -90,7 +90,6 @@ window.addEventListener('load', () => {
|
||||
container: '#algolia-hits',
|
||||
templates: {
|
||||
item(data) {
|
||||
console.log(data);
|
||||
const link = data.permalink ? data.permalink : (GLOBAL_CONFIG.root + data.path)
|
||||
return `
|
||||
<a href="${link}" class="algolia-hit-item-link">
|
||||
@@ -109,20 +108,23 @@ window.addEventListener('load', () => {
|
||||
})
|
||||
|
||||
const stats = instantsearch.widgets.stats({
|
||||
container: '#algolia-stats',
|
||||
container: '#algolia-info > .algolia-stats',
|
||||
templates: {
|
||||
text: function (data) {
|
||||
const icon = '<svg viewBox="0 0 1366 362" xmlns="http://www.w3.org/2000/svg"><linearGradient id="a" x1="428.26" x2="434.14" y1="404.15" y2="409.85" gradientTransform="matrix(94.045 0 0 -94.072 -40382 38480)" gradientUnits="userSpaceOnUse"><stop stop-color="#00aeff" offset="0"/><stop stop-color="#3369e7" offset="1"/></linearGradient><path d="M61.8 15.4h242.8c23.9 0 43.4 19.4 43.4 43.4v242.9c0 23.9-19.4 43.4-43.4 43.4H61.8c-23.9 0-43.4-19.4-43.4-43.4v-243c0-23.9 19.4-43.3 43.4-43.3z" fill="url(#a)"/><path d="M187 98.7c-51.4 0-93.1 41.7-93.1 93.2S135.6 285 187 285s93.1-41.7 93.1-93.2-41.6-93.1-93.1-93.1zm0 158.8c-36.2 0-65.6-29.4-65.6-65.6s29.4-65.6 65.6-65.6 65.6 29.4 65.6 65.6-29.3 65.6-65.6 65.6zm0-117.8v48.9c0 1.4 1.5 2.4 2.8 1.7l43.4-22.5c1-.5 1.3-1.7.8-2.7-9-15.8-25.7-26.6-45-27.3-1 0-2 .8-2 1.9zm-60.8-35.9l-5.7-5.7c-5.6-5.6-14.6-5.6-20.2 0l-6.8 6.8c-5.6 5.6-5.6 14.6 0 20.2l5.6 5.6c.9.9 2.2.7 3-.2 3.3-4.5 6.9-8.8 10.9-12.8 4.1-4.1 8.3-7.7 12.9-11 1-.6 1.1-2 .3-2.9zM217.5 89V77.7c0-7.9-6.4-14.3-14.3-14.3h-33.3c-7.9 0-14.3 6.4-14.3 14.3v11.6c0 1.3 1.2 2.2 2.5 1.9 9.3-2.7 19.1-4.1 29-4.1 9.5 0 18.9 1.3 28 3.8 1.2.3 2.4-.6 2.4-1.9z" fill="#FFF"/><path d="m842.5 267.6c0 26.7-6.8 46.2-20.5 58.6s-34.6 18.6-62.8 18.6c-10.3 0-31.7-2-48.8-5.8l6.3-31c14.3 3 33.2 3.8 43.1 3.8 15.7 0 26.9-3.2 33.6-9.6s10-15.9 10-28.5v-6.4c-3.9 1.9-9 3.8-15.3 5.8-6.3 1.9-13.6 2.9-21.8 2.9-10.8 0-20.6-1.7-29.5-5.1s-16.6-8.4-22.9-15-11.3-14.9-14.8-24.8-5.3-27.6-5.3-40.6c0-12.2 1.9-27.5 5.6-37.7 3.8-10.2 9.2-19 16.5-26.3 7.2-7.3 16-12.9 26.3-17s22.4-6.7 35.5-6.7c12.7 0 24.4 1.6 35.8 3.5s21.1 3.9 29 6.1v155.2zm-108.7-77.2c0 16.4 3.6 34.6 10.8 42.2s16.5 11.4 27.9 11.4c6.2 0 12.1-0.9 17.6-2.6s9.9-3.7 13.4-6.1v-97.1c-2.8-0.6-14.5-3-25.8-3.3-14.2-0.4-25 5.4-32.6 14.7-7.5 9.3-11.3 25.6-11.3 40.8zm294.3 0c0 13.2-1.9 23.2-5.8 34.1s-9.4 20.2-16.5 27.9-15.6 13.7-25.6 17.9-25.4 6.6-33.1 6.6c-7.7-0.1-23-2.3-32.9-6.6s-18.4-10.2-25.5-17.9-12.6-17-16.6-27.9-6-20.9-6-34.1 1.8-25.9 5.8-36.7 9.6-20 16.8-27.7 15.8-13.6 25.6-17.8c9.9-4.2 20.8-6.2 32.6-6.2s22.7 2.1 32.7 6.2c10 4.2 18.6 10.1 25.6 17.8 7.1 7.7 12.6 16.9 16.6 27.7 4.2 10.8 6.3 23.5 6.3 36.7zm-40 0.1c0-16.9-3.7-31-10.9-40.8-7.2-9.9-17.3-14.8-30.2-14.8s-23 4.9-30.2 14.8-10.7 23.9-10.7 40.8c0 17.1 3.6 28.6 10.8 38.5 7.2 10 17.3 14.9 30.2 14.9s23-5 30.2-14.9c7.2-10 10.8-21.4 10.8-38.5zm127.1 86.4c-64.1 0.3-64.1-51.8-64.1-60.1l-0.1-184.8 39.1-6.2v183.6c0 4.7 0 34.5 25.1 34.6v32.9zm68.9 0h-39.3v-168.8l39.3-6.2v175zm-19.7-193.5c13.1 0 23.8-10.6 23.8-23.7s-10.6-23.7-23.8-23.7-23.8 10.6-23.8 23.7 10.7 23.7 23.8 23.7zm117.4 18.6c12.9 0 23.8 1.6 32.6 4.8s15.9 7.7 21.1 13.4 8.9 13.5 11.1 21.7c2.3 8.2 3.4 17.2 3.4 27.1v100.6c-6 1.3-15.1 2.8-27.3 4.6s-25.9 2.7-41.1 2.7c-10.1 0-19.4-1-27.7-2.9-8.4-1.9-15.5-5-21.5-9.3-5.9-4.3-10.5-9.8-13.9-16.6-3.3-6.8-5-16.4-5-26.4 0-9.6 1.9-15.7 5.6-22.3 3.8-6.6 8.9-12 15.3-16.2 6.5-4.2 13.9-7.2 22.4-9s17.4-2.7 26.6-2.7c4.3 0 8.8 0.3 13.6 0.8s9.8 1.4 15.2 2.7v-6.4c0-4.5-0.5-8.8-1.6-12.8-1.1-4.1-3-7.6-5.6-10.7-2.7-3.1-6.2-5.5-10.6-7.2s-10-3-16.7-3c-9 0-17.2 1.1-24.7 2.4s-13.7 2.8-18.4 4.5l-4.7-32.1c4.9-1.7 12.2-3.4 21.6-5.1s19.5-2.6 30.3-2.6zm3.3 141.9c12 0 20.9-0.7 27.1-1.9v-39.8c-2.2-0.6-5.3-1.3-9.4-1.9s-8.6-1-13.6-1c-4.3 0-8.7 0.3-13.1 1-4.4 0.6-8.4 1.8-11.9 3.5s-6.4 4.1-8.5 7.2c-2.2 3.1-3.2 4.9-3.2 9.6 0 9.2 3.2 14.5 9 18 5.9 3.6 13.7 5.3 23.6 5.3zm-772.2-140.9c12.9 0 23.8 1.6 32.6 4.8s15.9 7.7 21.1 13.4c5.3 5.8 8.9 13.5 11.1 21.7 2.3 8.2 3.4 17.2 3.4 27.1v100.6c-6 1.3-15.1 2.8-27.3 4.6s-25.9 2.7-41.1 2.7c-10.1 0-19.4-1-27.7-2.9-8.4-1.9-15.5-5-21.5-9.3-5.9-4.3-10.5-9.8-13.9-16.6-3.3-6.8-5-16.4-5-26.4 0-9.6 1.9-15.7 5.6-22.3 3.8-6.6 8.9-12 15.3-16.2 6.5-4.2 13.9-7.2 22.4-9s17.4-2.7 26.6-2.7c4.3 0 8.8 0.3 13.6 0.8 4.7 0.5 9.8 1.4 15.2 2.7v-6.4c0-4.5-0.5-8.8-1.6-12.8-1.1-4.1-3-7.6-5.6-10.7-2.7-3.1-6.2-5.5-10.6-7.2s-10-3-16.7-3c-9 0-17.2 1.1-24.7 2.4s-13.7 2.8-18.4 4.5l-4.7-32.1c4.9-1.7 12.2-3.4 21.6-5.1 9.4-1.8 19.5-2.6 30.3-2.6zm3.4 142c12 0 20.9-0.7 27.1-1.9v-39.8c-2.2-0.6-5.3-1.3-9.4-1.9s-8.6-1-13.6-1c-4.3 0-8.7 0.3-13.1 1-4.4 0.6-8.4 1.8-11.9 3.5s-6.4 4.1-8.5 7.2c-2.2 3.1-3.2 4.9-3.2 9.6 0 9.2 3.2 14.5 9 18s13.7 5.3 23.6 5.3zm158.5 31.9c-64.1 0.3-64.1-51.8-64.1-60.1l-0.1-184.8 39.1-6.2v183.6c0 4.7 0 34.5 25.1 34.6v32.9z" fill="#182359"/></svg>'
|
||||
const stats = GLOBAL_CONFIG.algolia.languages.hits_stats
|
||||
.replace(/\$\{hits}/, data.nbHits)
|
||||
.replace(/\$\{time}/, data.processingTimeMS)
|
||||
return (
|
||||
`<hr>${stats}<span class="algolia-logo pull-right">${icon}</span>`
|
||||
`<hr>${stats}`
|
||||
)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const powerBy = instantsearch.widgets.poweredBy({
|
||||
container: '#algolia-info > .algolia-poweredBy',
|
||||
})
|
||||
|
||||
const pagination = instantsearch.widgets.pagination({
|
||||
container: '#algolia-pagination',
|
||||
totalPages: 5,
|
||||
@@ -135,7 +137,7 @@ window.addEventListener('load', () => {
|
||||
})
|
||||
|
||||
|
||||
search.addWidgets([configure,searchBox,hits,stats,pagination]) // add the widgets to the instantsearch instance
|
||||
search.addWidgets([configure,searchBox,hits,stats,powerBy,pagination]) // add the widgets to the instantsearch instance
|
||||
|
||||
search.start()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user