Compare commits

...

74 Commits
4.0.0 ... 4.4.0

Author SHA1 Message Date
Jerry
8ee052e93b Merge branch 'dev' 2022-08-18 00:39:29 +08:00
Jerry
c866315b87 feat: update 4.4.0 2022-08-18 00:38:09 +08:00
Jerry
2404eee5c1 fix 2022-08-18 00:31:53 +08:00
Jerry
5e656b7072 feat: update plugins.yml 2022-08-18 00:27:09 +08:00
Jerry Wong
a405217462 Merge pull request #1013 from dlinedev/dev
feat: Support typewriter effect speed options of Subtitle in _config.yml
2022-08-13 13:01:00 +08:00
Jerry Wong
8cfa1665b9 Update subtitle.pug 2022-08-13 12:59:53 +08:00
Dylan Lin
d12f5be271 docs: add default Effect Speed Options of Subtitle in _config.yml 2022-08-13 02:29:20 +08:00
Dylan Lin
26f2c1b4e3 feat: Support typewriter effect speed options of Subtitle in _config.yml 2022-08-12 17:15:32 +08:00
Jerry Wong
bb7fc446fc Merge pull request #965 from KiritaniAyaka/patch-1
fix: fix a minor problem about header border-radius style
2022-07-19 16:35:24 +08:00
Jerry Wong
49e4903b34 Merge pull request #977 from kkfive/dev
fix: artalk评论option无效
2022-07-19 16:21:03 +08:00
DreamyTZK
91641646a7 fix: artalk评论option无效 2022-07-17 14:31:24 +08:00
DreamyTZK
4b8492a377 Merge pull request #13 from jerryc127/dev
[pull] dev from jerryc127:dev
2022-07-17 14:28:32 +08:00
Jerry
a36c9ca6d2 feat: 在綫聊天新增facebook洽談外掛程式 closed #918
feat: 添加artalk評論 closed #933
fix: 修復 開啟 archor 後, facebook評論加載不正確的 bug
fix: 修復 facebook 評論數無法加載的 bug
2022-07-17 01:14:41 +08:00
Ayaka
6361f28328 Update head.styl 2022-07-08 17:42:09 +08:00
Jerry
7e83095920 Merge branch 'dev' 2022-06-27 01:27:45 +08:00
Jerry
dbb31dec99 fix: 當設置 comments 為 false 時,如果設置了顯示評論提供的閲讀數,閲讀數無法顯示的 bug
fix: findArchivesTitle bug
2022-06-27 01:23:35 +08:00
Jerry
057581b955 fix merge conflict 2022-06-24 02:10:04 +08:00
Jerry
fba180afaf update 4.3.0 2022-06-24 02:08:26 +08:00
Jerry Wong
b8b728898e Merge pull request #942 from ccknbc-forked/dev
fix:侧边栏归档卡片自定义排序异常
2022-06-19 21:55:30 +08:00
CC康纳百川
91d49fe7a2 fix:侧边栏归档卡片自定义排序异常 2022-06-18 18:35:31 +08:00
Jerry
931a0ba82d breaking changes: archives 隱藏 aside 設置更改
feat: tag 和 category 頁面可設置隱藏 aside
feat: 子歸檔頁面顯示的文章數量不再顯示總文章數量,而是對應的子歸檔文章數量
feat: 為一些數據加載增加 loading 顯示
improvement: 修改 note 圖標 class 名字,避免第三方圖標覆蓋主題樣式
2022-06-17 01:01:46 +08:00
Jerry
9a33e23a9c feat: 移除 katex copy-tex.css
feat: CDN可配置 cdnjs
feat: cdn可設置 version 和 custom format
feat: 點擊歸檔日期跳轉到頁面,標題顯示日期而不是‘歸檔’二字 closed #925
fix: Algolia搜索沒有結果 closed #923
2022-06-12 01:07:09 +08:00
Jerry Wong
945ea89685 Merge branch 'dev' of https://github.com/jerryc127/hexo-theme-butterfly into dev 2022-05-22 16:22:26 +08:00
Jerry Wong
b4d3ea86bb feat: CDN 可配置為 unpkg
fix: 評論系統開啟時 busuanzi 的 page_pv 不顯示
2022-05-22 16:20:49 +08:00
Jerry Wong
ecebacad37 Merge pull request #917 from jerryc127/revert-914-dev
Revert "Feat: 添加系列文章目录"
2022-05-22 00:02:43 +08:00
Jerry Wong
e650f71086 Revert "Feat: 添加系列文章目录" 2022-05-22 00:02:14 +08:00
Jerry Wong
6d387eadcc Merge pull request #894 from pai233/dev
Feat: 添加Remark42评论系统支持
2022-05-22 00:01:59 +08:00
Jerry Wong
860f6c5ef9 Merge pull request #914 from qsgy-edge/dev
Feat: 添加系列文章目录
2022-05-21 23:59:42 +08:00
pai233
e56757ac29 Merge branch 'jerryc127:dev' into dev 2022-05-21 08:26:46 +08:00
qsgy-edge
08b7cd9dbb 添加系列文章目录 2022-05-20 16:55:51 +08:00
Jerry Wong
9a86429484 breaking changes: 適配 disqusjs 3.0
fix: 修復首頁文章 valine 評論數只顯示第一篇的 bug
fix: 修復子目錄下,第三方插件本地資源無法加載的 bug closed #908
fix: 評論系統開啟時 busuanzi 的 page_pv 不顯示的 bug closed #902
fix: 修復 pjax 下,使用 mermaid 跳轉會重新加載的 bug
2022-05-19 16:45:30 +08:00
Jerry Wong
6e58f68f0c fix: 修復首頁文章 valine 評論數只顯示第一篇的 bug
fix: 修復子目錄下,第三方插件本地資源無法加載的 bug closed #908
fix: 評論系統開啟時 busuanzi 的 page_pv 不顯示的 bug closed #902
fix: 修復 pjax 下,使用 mermaid 跳轉會重新加載的 bug
2022-05-19 16:37:01 +08:00
Jerry Wong
004a27decc Merge branch 'dev' 2022-05-19 15:39:05 +08:00
Jerry Wong
4df78b1966 fix pjax 2022-05-17 16:03:25 +08:00
Jerry Wong
b1e40b33d7 Merge pull request #897 from kkfive/patch-1
perf: 优化twikoo评论,无评论数容器时不调用API获取
2022-05-16 01:49:53 +08:00
DreamyTZK
cf38250fa9 perf: 优化twikoo评论,无评论数容器时不调用API获取 2022-05-15 14:18:10 +08:00
pai233
e3bb904e87 Merge branch 'dev' of https://github.com/pai233/hexo-theme-butterfly into dev 2022-05-13 10:22:46 +08:00
pai233
cbf52c3053 feat: Remark42支持显示最新评论 2022-05-13 10:22:16 +08:00
pai233
9351413b63 Update index.pug 2022-05-12 20:56:46 +08:00
pai233
1f3f2f471b feat: Remark42评论支持显示文章评论数 2022-05-12 08:39:56 +08:00
pai233
c68e872f0e feat: 将Remark42的可选配置归入option 2022-05-11 13:47:54 +08:00
pai233
1bc54d6eb3 Merge branch 'dev' of https://github.com/pai233/hexo-theme-butterfly into dev 2022-05-11 09:36:37 +08:00
pai233
f768d6fce0 删除不必要的空格 2022-05-11 09:35:39 +08:00
pai233
4dd146f787 Merge branch 'jerryc127:dev' into dev 2022-05-11 09:33:49 +08:00
pai233
7187a17896 feat: 添加Remark42配置说明 2022-05-11 09:31:51 +08:00
pai233
41ac7f170c feat: 增加Remark42评论系统主题色适应
feat: 增加Remark42主题评论系统自定义显示评论数
2022-05-11 09:27:21 +08:00
Jerry
fd21969278 Merge branch 'dev' 2022-05-11 00:20:35 +08:00
Jerry
9479f8a704 Merge branch 'dev' of https://github.com/jerryc127/hexo-theme-butterfly into dev 2022-05-11 00:19:37 +08:00
Jerry
793e004a3a fix: CDN配置為 local 時 mathjax 字體缺失的 bug close #893 2022-05-11 00:18:19 +08:00
Jerry Wong
b3e5b7c30d Merge pull request #888 from kkfive/dev
perf: 调整本地搜索结果间距
2022-05-07 00:06:36 +08:00
pai233
060defa475 feat: 添加Remark42评论支持 2022-05-04 12:44:39 +08:00
DreamyTZK
c2c199bd16 perf: 调整本地搜索结果间距 2022-05-03 22:19:34 +08:00
Jerry
2e133e1cd6 Merge branch 'dev' 2022-05-03 19:06:55 +08:00
Jerry
3e30f301a0 update 2022-05-03 19:03:34 +08:00
Jerry
5b1473c2c8 breaking changes: waline 適配 V2
breaking changes: waline 的 visitor 改為 pageview
feat: algolia 搜索增加文章內容顯示和高亮
feat: 搜索內容顯示區域變大
2022-05-03 18:57:59 +08:00
Jerry
ec78f66470 fix merge failed 2022-04-14 00:39:19 +08:00
Jerry
a33602e023 feat: 本地搜索增加preload,cdn 配置 closed #859
feat: 搜索內容顯示區域變大
feat: algolia 搜索增加文章內容顯示和高亮
feat: 搜索內容增加 ... 縮略辨識
fix: algolia 第一次進入時會自動搜索
fix: mathjax 顯示不完全的 bug
2022-04-14 00:32:25 +08:00
Jerry Wong
ee3c143424 Merge pull request #836 from Android-KitKat/fix-related-post
fix: 标题中带有 HTML 关键字时,会破坏相关推荐的渲染。
2022-03-18 21:41:32 +08:00
Android
4461473aa6 fix: 标题中带有 HTML 关键字时,会破坏相关推荐的渲染。 2022-03-13 00:12:05 +08:00
Jerry
3cb2120630 Merge branch 'dev' of https://github.com/jerryc127/hexo-theme-butterfly into dev 2022-03-08 18:03:02 +08:00
Jerry
df678dfde2 feat: 可配置文章版權模塊的作者超鏈接
feat: 歸檔頁面的側邊欄支持隱藏
improvement: 更新social-share cdn 版本
improvement: 調整分享按鈕導致的間距問題
improvement: html/css 優化
2022-03-08 18:00:22 +08:00
Jerry Wong
34bb030345 Merge pull request #807 from ImCa0/dev
新增 head 标签内 theme-color 的配置项
2022-03-08 17:49:08 +08:00
ImCaO
0726c2263f 添加缺省值 2022-02-28 09:48:51 +08:00
ImCaO
7ebed025f0 新增head标签内theme-color的配置项 2022-02-25 19:55:45 +08:00
Jerry
4248103024 Merge branch 'dev' of https://github.com/jerryc127/hexo-theme-butterfly into dev 2022-02-19 00:43:57 +08:00
Jerry
ab6672429f breaking changes: cdn 可一鍵設置 本地文件/可單獨配置主題文件,第三方文件的 cdn
breaking changes: 移除 utterances,giscus, addtoany, busuanzi 的 cdn 配置
2022-02-19 00:43:01 +08:00
Jerry Wong
ca4c0e2a6b Merge pull request #799 from Gahotx/dev
fix: twikoo 评论区表情包去除灯箱渲染
2022-02-15 23:58:33 +08:00
Gahotx
26e8c618d8 fix: twikoo 评论区表情包去除灯箱渲染
improvement: 搜索和字数统计两个功能添加相应文档地址注释 (太多新人因为这两报错然后到群里问了)
2022-02-14 23:49:20 +08:00
Jerry
aa767f6fb5 Merge branch 'dev' 2022-02-13 15:27:10 +08:00
Jerry
c1ac4a5e16 breaking changes: 升級 fontawesome 到 v6 #689
feat: snackbar 增加圓角
feat: 增加 flink 標籤外掛
fix: 修復點擊 toc 外圍,控制檯報錯的 bug
fix: Facebook Comments 無法使用 #787
fix: chat_btn 聊天按鈕翻譯缺失 #791
fix: local search 的 content 設爲 false, 搜索無法運行的 bug #764
fix: Mermaid 圖表渲染後元素高度過大 #773
fix: 文章頁分享按鈕另開一行時, 導航頁寬度沒有 100% 的 bug #765
improvement: 語義化 toggle 標籤外掛
improvement: darkmode 下 toc 背景顏色更改
2022-02-13 15:23:13 +08:00
Jerry Wong
e0fd3c9f92 Merge pull request #768 from hsxyhao/dev
fix: QR_code空校验
2022-01-20 18:48:24 +08:00
王浩
96e8d624dc fix: QR_code空校验 2022-01-19 09:53:47 +08:00
Jerry
241f9b5873 improvement: 優化 pjax 下,右下角按鈕的動畫
fix: 修復頁面設置 aside 爲 true 時,js 報錯的 bug
fix: 修復部分頁面右下角按鈕位置遮擋的 bug
fix: 修復壓縮 html 代碼,友情鏈接頁面壓縮會報錯的 bug
fix: 修復safari上滑動側邊菜單欄會收起的 bug
2022-01-16 00:48:03 +08:00
Jerry
84ad5c5dd6 improvement: 優化 pjax 下,右下角按鈕的動畫
fix: 修復頁面設置 aside 爲 true 時,js 報錯的 bug
fix: 修復部分頁面右下角按鈕位置遮擋的 bug
fix: 修復壓縮 html 代碼,友情鏈接頁面壓縮會報錯的 bug
fix: 修復 safari 上滑動側邊菜單欄會收起的 bug
2022-01-16 00:47:05 +08:00
108 changed files with 1701 additions and 821 deletions

View File

@@ -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
View 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
View 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群都添加'

View File

@@ -1,9 +0,0 @@
---
name: Custom issue template
about: Describe this issue template's purpose here.
title: ''
labels: ''
assignees: ''
---

View File

@@ -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.

View 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

20
.github/stale.yml vendored
View File

@@ -1,20 +0,0 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
- bug
- enhancement
- documentation
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false

19
.github/workflows/stale.yml vendored Normal file
View File

@@ -0,0 +1,19 @@
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '30 1 * * *'
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v5
with:
days-before-issue-stale: 30
days-before-pr-stale: -1
days-before-close: 7
stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
close-pr-message: 'This issue has not seen any activity since it was marked stale. Closing.'
stale-issue-label: 'Stale'
exempt-issue-labels: 'pinned,bug,enhancement,documentation,Plan'
operations-per-run: 1000

View File

@@ -9,7 +9,7 @@
![master version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly/master?color=%231ab1ad&label=master) ![master version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly/master?color=%231ab1ad&label=master)
![master version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly/dev?label=dev) ![master version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly/dev?label=dev)
![https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff](https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff) ![https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff](https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff)
![hexo version](https://img.shields.io/badge/hexo-5.0+-0e83c) ![hexo version](https://img.shields.io/badge/hexo-5.3.0+-0e83c)
![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly?color=FF5531) ![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly?color=FF5531)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/theme-butterfly-readme.png) ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/theme-butterfly-readme.png)
@@ -79,9 +79,9 @@ npm i hexo-theme-butterfly
- [x] Related articles - [x] Related articles
- [x] Displays outdated notice for a post - [x] Displays outdated notice for a post
- [x] Share (AddThis/Sharejs/Addtoany) - [x] Share (AddThis/Sharejs/Addtoany)
- [X] Comment (Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus) - [X] Comment (Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42/artalk)
- [x] Multiple Comment System Support - [x] Multiple Comment System Support
- [x] Online Chats (Chatra/Tidio/Daovoice/Gitter/Crisp) - [x] Online Chats (Chatra/Tidio/Daovoice/Gitter/Crisp/messenger)
- [x] Web analytics - [x] Web analytics
- [x] Google AdSense - [x] Google AdSense
- [x] Webmaster Verification - [x] Webmaster Verification

View File

@@ -9,7 +9,7 @@
![master version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly/master?color=%231ab1ad&label=master) ![master version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly/master?color=%231ab1ad&label=master)
![master version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly/dev?label=dev) ![master version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly/dev?label=dev)
![https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff](https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff) ![https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff](https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff)
![hexo version](https://img.shields.io/badge/hexo-5.0+-0e83c) ![hexo version](https://img.shields.io/badge/hexo-5.3.0+-0e83c)
![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly?color=FF5531) ![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly?color=FF5531)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/theme-butterfly-readme.png) ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/theme-butterfly-readme.png)
@@ -79,9 +79,9 @@ theme: butterfly
- [x] 顯示相關文章 - [x] 顯示相關文章
- [x] 過期文章提醒 - [x] 過期文章提醒
- [x] 多種分享系統AddThis/Sharejs/Addtoany - [x] 多種分享系統AddThis/Sharejs/Addtoany
- [X] 多種評論系統Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus - [X] 多種評論系統Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42/artalk
- [x] 支持雙評論部署 - [x] 支持雙評論部署
- [x] 多種在線聊天Chatra/Tidio/Daovoice/Gitter/Crisp - [x] 多種在線聊天Chatra/Tidio/Daovoice/Gitter/Crisp/messenger
- [x] 多種分析系統 - [x] 多種分析系統
- [x] 谷歌廣告/手動廣告位置 - [x] 谷歌廣告/手動廣告位置
- [x] 各種站長驗證Google/Bing/Baidu/360/Yandex - [x] 各種站長驗證Google/Bing/Baidu/360/Yandex

View File

@@ -39,6 +39,7 @@ social:
# fas fa-envelope: mailto:xxxxxx@gmail.com || Email # fas fa-envelope: mailto:xxxxxx@gmail.com || Email
# search (搜索) # search (搜索)
# see https://butterfly.js.org/posts/ceeb73f/#搜索系統
# -------------------------------------- # --------------------------------------
# Algolia search # Algolia search
@@ -50,6 +51,8 @@ algolia_search:
# Local search # Local search
local_search: local_search:
enable: false enable: false
preload: false
CDN:
# Math (數學) # Math (數學)
# -------------------------------------- # --------------------------------------
@@ -148,6 +151,7 @@ post_meta:
label: true # true or false 顯示描述性文字 label: true # true or false 顯示描述性文字
# wordcount (字數統計) # wordcount (字數統計)
# see https://butterfly.js.org/posts/ceeb73f/#字數統計
wordcount: wordcount:
enable: false enable: false
post_wordcount: true post_wordcount: true
@@ -181,6 +185,7 @@ toc:
post_copyright: post_copyright:
enable: true enable: true
decode: false decode: false
author_href:
license: CC BY-NC-SA 4.0 license: CC BY-NC-SA 4.0
license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/ license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/
@@ -254,7 +259,7 @@ addtoany:
comments: comments:
# Up to two comments system, the first will be shown as default # Up to two comments system, the first will be shown as default
# Choose: Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus # Choose: Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42/Artalk
use: # Valine,Disqus use: # Valine,Disqus
text: true # Display the comment name next to the button text: true # Display the comment name next to the button
# lazyload: The comment system will be load when comment element enters the browser's viewport. # lazyload: The comment system will be load when comment element enters the browser's viewport.
@@ -308,7 +313,7 @@ valine:
waline: waline:
serverURL: # Waline server address url serverURL: # Waline server address url
bg: # waline background bg: # waline background
visitor: false pageview: false
option: option:
# utterances # utterances
@@ -328,7 +333,7 @@ facebook_comments:
user_id: # optional user_id: # optional
pageSize: 10 # The number of comments to show pageSize: 10 # The number of comments to show
order_by: social # social/time/reverse_time order_by: social # social/time/reverse_time
lang: en_US # Language en_US/zh_CN/zh_TW and so on lang: zh_TW # Language en_US/zh_CN/zh_TW and so on
# Twikoo # Twikoo
# https://github.com/imaegoo/twikoo # https://github.com/imaegoo/twikoo
@@ -349,6 +354,21 @@ giscus:
dark: dark dark: dark
option: option:
# Remark42
# https://remark42.com/docs/configuration/frontend/
remark42:
host: # Your Host URL
siteId: # Your Site ID
option:
# Artalk
# https://artalk.js.org/guide/frontend/config.html
artalk:
server:
site:
visitor: false
option:
# Chat Services # Chat Services
# -------------------------------------- # --------------------------------------
@@ -389,6 +409,13 @@ crisp:
enable: false enable: false
website_id: website_id:
# messenger
# https://developers.facebook.com/docs/messenger-platform/discovery/facebook-chat-plugin/
messenger:
enable: false
pageID:
lang: zh_TW # Language en_US/zh_CN/zh_TW and so on
# Footer Settings # Footer Settings
# -------------------------------------- # --------------------------------------
footer: footer:
@@ -468,6 +495,8 @@ site_verification:
# blockquote_padding_color: "#49b1f5" # blockquote_padding_color: "#49b1f5"
# blockquote_background_color: "#49b1f5" # blockquote_background_color: "#49b1f5"
# scrollbar_color: "#49b1f5" # scrollbar_color: "#49b1f5"
# meta_theme_color_light: "ffffff"
# meta_theme_color_dark: "#0d0d0d"
# The top_img settings of home page # The top_img settings of home page
# default: top img - full screen, site info - middle (默認top_img全屏site_info在中間) # default: top img - full screen, site info - middle (默認top_img全屏site_info在中間)
@@ -590,6 +619,10 @@ subtitle:
enable: false enable: false
# Typewriter Effect (打字效果) # Typewriter Effect (打字效果)
effect: true effect: true
# Effect Speed Options (打字效果速度參數)
startDelay: 300 # time before typing starts in milliseconds
typeSpeed: 150 # type speed in milliseconds
backSpeed: 50 # backspacing speed in milliseconds
# loop (循環打字) # loop (循環打字)
loop: true loop: true
# source 調用第三方服務 # source 調用第三方服務
@@ -614,6 +647,10 @@ aside:
button: true button: true
mobile: true # display on mobile mobile: true # display on mobile
position: right # left or right position: right # left or right
display:
archive: true
tag: true
category: true
card_author: card_author:
enable: true enable: true
description: description:
@@ -776,7 +813,7 @@ snackbar:
enable: false enable: false
position: bottom-left position: bottom-left
bg_light: '#49b1f5' # The background color of Toast Notification in light mode bg_light: '#49b1f5' # The background color of Toast Notification in light mode
bg_dark: '#121212' # The background color of Toast Notification in dark mode bg_dark: '#1f1f1f' # The background color of Toast Notification in dark mode
# https://instant.page/ # https://instant.page/
# prefetch (預加載) # prefetch (預加載)
@@ -827,88 +864,72 @@ inject:
# Don't modify the following settings unless you know how they work # Don't modify the following settings unless you know how they work
# 非必要請不要修改 # 非必要請不要修改
CDN: CDN:
# main # The CDN provider of internal scripts (主題內部 js 的 cdn 配置)
main_css: # option: local/jsdelivr/unpkg/cdnjs/custom
main: # Dev version can only choose. ( dev版的主題只能設置為 local )
utils: internal_provider: local
# pjax # The CDN provider of third party scripts (第三方 js 的 cdn 配置)
pjax: # option: local/jsdelivr/unpkg/cdnjs/custom
# when set it to local, you need to install hexo-butterfly-extjs
third_party_provider: jsdelivr
# comments # Add version number to CDN, true or false
gitalk: version: false
gitalk_css:
blueimp_md5:
valine:
disqusjs:
disqusjs_css:
utterances:
twikoo:
waline:
giscus:
# share # Custom format
addtoany: # For example: https://cdn.staticfile.org/${cdnjs_name}/${version}/${min_cdnjs_file}
sharejs: custom_format:
sharejs_css:
# search option:
local_search: # main_css:
algolia_js: # main:
algolia_search_v4: # utils:
instantsearch_v4: # translate:
# local_search:
# math # algolia_js:
mathjax: # algolia_search_v4:
katex: # instantsearch_v4:
katex_copytex: # pjax:
katex_copytex_css: # gitalk:
mermaid: # gitalk_css:
# blueimp_md5:
# count # valine:
busuanzi: # disqusjs:
# disqusjs_css:
# background effect # twikoo:
canvas_ribbon: # waline_js:
canvas_fluttering_ribbon: # waline_css:
canvas_nest: # sharejs:
# sharejs_css:
lazyload: # mathjax:
instantpage: # katex:
typed: # katex_copytex:
pangu: # mermaid:
# canvas_ribbon:
# photo # canvas_fluttering_ribbon:
fancybox_css_v4: # canvas_nest:
fancybox_v4: # lazyload:
medium_zoom: # instantpage:
# typed:
# snackbar # pangu:
snackbar_css: # fancybox_css_v4:
snackbar: # fancybox_v4:
# medium_zoom:
# effect # snackbar_css:
activate_power_mode: # snackbar:
fireworks: # activate_power_mode:
click_heart: # fireworks:
ClickShowText: # click_heart:
# ClickShowText:
# fontawesome # fontawesomeV6:
fontawesome: # flickr_justified_gallery_js:
# flickr_justified_gallery_css:
# Conversion between Traditional and Simplified Chinese # aplayer_css:
translate: # aplayer_js:
# meting_js:
# flickr-justified-gallery # prismjs_js:
flickr_justified_gallery_js: # prismjs_lineNumber_js:
flickr_justified_gallery_css: # prismjs_autoloader:
# artalk_js:
# aplayer # artalk_css:
aplayer_css:
aplayer_js:
meting_js:
# Prism.js
prismjs_js:
prismjs_lineNumber_js:
prismjs_autoloader:

View File

@@ -43,7 +43,6 @@ search:
hits_stats: '${hits} results found in ${time} ms' hits_stats: '${hits} results found in ${time} ms'
local_search: local_search:
label: Local search
input_placeholder: Search for Posts input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}" hits_empty: "We didn't find any results for the search: ${query}"
@@ -103,6 +102,7 @@ rightside:
scroll_to_comment: Scroll To Comments scroll_to_comment: Scroll To Comments
setting: Setting setting: Setting
aside: Toggle between single-column and double-column aside: Toggle between single-column and double-column
chat: Chat
copy_copyright: copy_copyright:
author: Author author: Author

View File

@@ -43,7 +43,6 @@ search:
hits_stats: '${hits} results found in ${time} ms' hits_stats: '${hits} results found in ${time} ms'
local_search: local_search:
label: Local search
input_placeholder: Search for Posts input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}" hits_empty: "We didn't find any results for the search: ${query}"
@@ -103,6 +102,7 @@ rightside:
scroll_to_comment: Scroll To Comments scroll_to_comment: Scroll To Comments
setting: Setting setting: Setting
aside: Toggle between single-column and double-column aside: Toggle between single-column and double-column
chat: Chat
copy_copyright: copy_copyright:
author: Author author: Author

View File

@@ -44,7 +44,6 @@ search:
hits_stats: '找到 ${hits} 条结果,用时 ${time} 毫秒' hits_stats: '找到 ${hits} 条结果,用时 ${time} 毫秒'
local_search: local_search:
label: 本地搜索
input_placeholder: 搜索文章 input_placeholder: 搜索文章
hits_empty: '找不到您查询的内容:${query}' hits_empty: '找不到您查询的内容:${query}'
@@ -104,6 +103,7 @@ rightside:
scroll_to_comment: 直达评论 scroll_to_comment: 直达评论
setting: 设置 setting: 设置
aside: 单栏和双栏切换 aside: 单栏和双栏切换
chat: 聊天
copy_copyright: copy_copyright:
author: 作者 author: 作者

View File

@@ -44,7 +44,6 @@ search:
hits_stats: '找到 ${hits} 條結果,用時 ${time} 毫秒' hits_stats: '找到 ${hits} 條結果,用時 ${time} 毫秒'
local_search: local_search:
label: 本地搜尋
input_placeholder: 搜尋文章 input_placeholder: 搜尋文章
hits_empty: '找不到您查詢的內容:${query}' hits_empty: '找不到您查詢的內容:${query}'
@@ -104,6 +103,7 @@ rightside:
scroll_to_comment: 直達評論 scroll_to_comment: 直達評論
setting: 設定 setting: 設定
aside: 單欄和雙欄切換 aside: 單欄和雙欄切換
chat: 聊天
copy_copyright: copy_copyright:
author: 作者 author: 作者

View File

@@ -3,6 +3,7 @@ extends includes/layout.pug
block content block content
include ./includes/mixins/article-sort.pug include ./includes/mixins/article-sort.pug
#archive #archive
.article-sort-title= _p('page.articles') + ' - ' + site.posts.length - const archiveLength = findArchiveLength(fragment_cache)
.article-sort-title= _p('page.articles') + ' - ' + archiveLength
+articleSort(page.posts) +articleSort(page.posts)
include includes/pagination.pug include includes/pagination.pug

View File

@@ -1,34 +1,34 @@
div div
script(src=url_for(theme.CDN.utils)) script(src=url_for(theme.asset.utils))
script(src=url_for(theme.CDN.main)) script(src=url_for(theme.asset.main))
if theme.translate.enable if theme.translate.enable
script(src=url_for(theme.CDN.translate)) script(src=url_for(theme.asset.translate))
if theme.medium_zoom if theme.medium_zoom
script(src=url_for(theme.CDN.medium_zoom)) script(src=url_for(theme.asset.medium_zoom))
else if theme.fancybox else if theme.fancybox
script(src=url_for(theme.CDN.fancybox_v4)) script(src=url_for(theme.asset.fancybox_v4))
if theme.instantpage if theme.instantpage
script(src=url_for(theme.CDN.instantpage), type='module') script(src=url_for(theme.asset.instantpage), type='module')
if theme.lazyload.enable if theme.lazyload.enable
script(src=url_for(theme.CDN.lazyload)) script(src=url_for(theme.asset.lazyload))
if theme.snackbar.enable if theme.snackbar.enable
script(src=url_for(theme.CDN.snackbar)) script(src=url_for(theme.asset.snackbar))
if theme.pangu.enable if theme.pangu.enable
!= partial("includes/third-party/pangu.pug", {}, { cache: true }) != partial("includes/third-party/pangu.pug", {}, { cache: true })
//- search //- search
if theme.algolia_search.enable if theme.algolia_search.enable
script(src=url_for(theme.CDN.algolia_search_v4)) script(src=url_for(theme.asset.algolia_search_v4))
script(src=url_for(theme.CDN.instantsearch_v4)) script(src=url_for(theme.asset.instantsearch_v4))
script(src=url_for(theme.CDN.algolia_js)) script(src=url_for(theme.asset.algolia_js))
else if theme.local_search.enable else if theme.local_search.enable
script(src=url_for(theme.CDN.local_search)) script(src=url_for(theme.asset.local_search))
if theme.preloader if theme.preloader
!= partial("includes/loading/loading-js", {}, { cache: true }) != partial("includes/loading/loading-js", {}, { cache: true })
@@ -69,4 +69,4 @@ div
!= partial("includes/third-party/pjax", {}, { cache: true }) != partial("includes/third-party/pjax", {}, { cache: true })
if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv
script(async data-pjax src=url_for(theme.CDN.busuanzi)) script(async data-pjax src='//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js')

View File

@@ -1,9 +1,7 @@
- var pageTitle - var pageTitle
- if (is_archive()) pageTitle = fragment_cache('findArchivesTitle', function(){return findArchivesTitle(theme.menu);}) - is_archive() ? page.title = findArchivesTitle(page, theme.menu, date) : ''
- else if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag - if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag
- else if (is_category()) pageTitle = _p('page.category') + ': ' + page.category - else if (is_category()) pageTitle = _p('page.category') + ': ' + page.category
- else if (is_month()) pageTitle += ': ' + page.month + '/' + page.year
- else if (is_year()) pageTitle += ': ' + page.year
- else if (is_current('/404.html', [strict])) pageTitle = _p('error404') - else if (is_current('/404.html', [strict])) pageTitle = _p('error404')
- else pageTitle = page.title || config.title || '' - else pageTitle = page.title || config.title || ''
@@ -16,7 +14,9 @@
- else pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords - else pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords
- var pageAuthor = config.email ? config.author + ',' + config.email : config.author - var pageAuthor = config.email ? config.author + ',' + config.email : config.author
- var pageCopyright = config.copyright || config.author - var pageCopyright = config.copyright || config.author
- var themeColor = theme.display_mode === 'dark' ? '#0d0d0d' : '#ffffff' - var themeColorLight = theme.theme_color && theme.theme_color.enable && theme.theme_color.meta_theme_color_light || '#ffffff'
- var themeColorDark = theme.theme_color && theme.theme_color.enable && theme.theme_color.meta_theme_color_dark || '#0d0d0d'
- var themeColor = theme.display_mode === 'dark' ? themeColorDark : themeColorLight
meta(charset='UTF-8') meta(charset='UTF-8')
meta(http-equiv="X-UA-Compatible" content="IE=edge") meta(http-equiv="X-UA-Compatible" content="IE=edge")
@@ -46,14 +46,14 @@ if (theme.pwa && theme.pwa.enable)
!=partial('includes/head/pwa', {}, {cache: true}) !=partial('includes/head/pwa', {}, {cache: true})
//- main css //- main css
link(rel='stylesheet', href=url_for(theme.CDN.main_css)) link(rel='stylesheet', href=url_for(theme.asset.main_css))
link(rel='stylesheet', href=url_for(theme.CDN.fontawesome) media="print" onload="this.media='all'") link(rel='stylesheet', href=url_for(theme.asset.fontawesomeV6) media="print" onload="this.media='all'")
if (theme.snackbar && theme.snackbar.enable) if (theme.snackbar && theme.snackbar.enable)
link(rel='stylesheet', href=url_for(theme.CDN.snackbar_css) media="print" onload="this.media='all'") link(rel='stylesheet', href=url_for(theme.asset.snackbar_css) media="print" onload="this.media='all'")
if theme.fancybox if theme.fancybox
link(rel='stylesheet' href=url_for(theme.CDN.fancybox_css_v4) media="print" onload="this.media='all'") link(rel='stylesheet' href=url_for(theme.asset.fancybox_css_v4) media="print" onload="this.media='all'")
//- google_adsense //- google_adsense
!=partial('includes/head/google_adsense', {}, {cache: true}) !=partial('includes/head/google_adsense', {}, {cache: true})

View File

@@ -19,7 +19,8 @@
let localSearch = 'undefined'; let localSearch = 'undefined';
if (theme.local_search && theme.local_search.enable) { if (theme.local_search && theme.local_search.enable) {
localSearch = JSON.stringify({ localSearch = JSON.stringify({
path: config.search.path, path: theme.local_search.CDN ? theme.local_search.CDN : config.root + config.search.path,
preload: theme.local_search.preload,
languages: { languages: {
// search languages // search languages
hits_empty: _p("search.local_search.hits_empty"), hits_empty: _p("search.local_search.hits_empty"),
@@ -113,8 +114,8 @@ script.
Snackbar: !{Snackbar}, Snackbar: !{Snackbar},
source: { source: {
justifiedGallery: { justifiedGallery: {
js: '!{url_for(theme.CDN.flickr_justified_gallery_js)}', js: '!{url_for(theme.asset.flickr_justified_gallery_js)}',
css: '!{url_for(theme.CDN.flickr_justified_gallery_css)}' css: '!{url_for(theme.asset.flickr_justified_gallery_css)}'
} }
}, },
isPhotoFigcaption: !{theme.photofigcaption}, isPhotoFigcaption: !{theme.photofigcaption},

View File

@@ -7,7 +7,7 @@
else isHighlightShrink = theme.highlight_shrink else isHighlightShrink = theme.highlight_shrink
var showToc = false var showToc = false
if (theme.aside.enable) { if (theme.aside.enable && page.aside !== false) {
let tocEnable = false let tocEnable = false
if (is_post()) { if (is_post()) {
if (theme.toc.post) tocEnable = true if (theme.toc.post) tocEnable = true

View File

@@ -19,7 +19,7 @@ if !theme.disable_top_img && page.top_img !== false
if top_img !== false if top_img !== false
- var imgSource = top_img && top_img.indexOf('/') !== -1 ? `background-image: url('${url_for(top_img)}')` : `background: ${top_img}` - var imgSource = top_img && top_img.indexOf('/') !== -1 ? `background-image: url('${url_for(top_img)}')` : `background: ${top_img}`
- var bg_img = top_img ? imgSource : '' - var bg_img = top_img ? imgSource : ''
- var site_title = is_archive() ? fragment_cache('findArchivesTitle', function(){return findArchivesTitle(theme.menu);}) : page.title || page.tag || page.category || config.title - var site_title = page.title || page.tag || page.category || config.title
- var isHomeClass = is_home() ? 'full_page' : 'not-home-page' - var isHomeClass = is_home() ? 'full_page' : 'not-home-page'
- is_post() ? isHomeClass = 'post-bg' : isHomeClass - is_post() ? isHomeClass = 'post-bg' : isHomeClass
else else

View File

@@ -61,16 +61,32 @@
if block if block
block block
if theme.busuanzi.page_pv - const commentUse = comments.use
+pvBlock('','post-meta-pv-cv','') if page.comments !== false && commentUse && !comments.lazyload
span#busuanzi_value_page_pv if commentUse[0] === 'Valine' && theme.valine.visitor
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) +pvBlock(url_for(page.path),'leancloud_visitors',page.title)
span.leancloud-visitors-count span.leancloud-visitors-count
else if (comments.use.includes('Twikoo') && theme.twikoo.visitor) i.fa-solid.fa-spinner.fa-spin
else if commentUse[0] === 'Waline' && theme.waline.pageview
+pvBlock('','','')
span.waline-pageview-count(data-path=url_for(page.path))
i.fa-solid.fa-spinner.fa-spin
else if commentUse[0] === 'Twikoo' && theme.twikoo.visitor
+pvBlock('','','') +pvBlock('','','')
span#twikoo_visitors span#twikoo_visitors
i.fa-solid.fa-spinner.fa-spin
else if commentUse[0] === 'Artalk' && theme.artalk.visitor
+pvBlock('','','')
span#ArtalkPV
i.fa-solid.fa-spinner.fa-spin
else if theme.busuanzi.page_pv
+pvBlock('','post-meta-pv-cv','')
span#busuanzi_value_page_pv
i.fa-solid.fa-spinner.fa-spin
else if theme.busuanzi.page_pv
+pvBlock('','post-meta-pv-cv','')
span#busuanzi_value_page_pv
i.fa-solid.fa-spinner.fa-spin
if comments.count && !comments.lazyload && page.comments !== false && comments.use if comments.count && !comments.lazyload && page.comments !== false && comments.use
- var whichCount = comments.use[0] - var whichCount = comments.use[0]
@@ -85,27 +101,46 @@
case whichCount case whichCount
when 'Disqus' when 'Disqus'
when 'Disqusjs'
+countBlock +countBlock
span.disqus-comment-count span.disqus-comment-count
a(href=full_url_for(page.path) + '#disqus_thread') a(href=full_url_for(page.path) + '#disqus_thread')
i.fa-solid.fa-spinner.fa-spin
when 'Disqusjs'
+countBlock
a(href=full_url_for(page.path) + '#disqusjs')
span.disqus-comment-count(data-disqus-url=full_url_for(page.path))
i.fa-solid.fa-spinner.fa-spin
when 'Valine' when 'Valine'
+countBlock +countBlock
a(href=url_for(page.path) + '#post-comment' itemprop="discussionUrl") a(href=url_for(page.path) + '#post-comment' itemprop="discussionUrl")
span.valine-comment-count(data-xid=url_for(page.path) itemprop="commentCount") span.valine-comment-count(data-xid=url_for(page.path) itemprop="commentCount")
i.fa-solid.fa-spinner.fa-spin
when 'Waline' when 'Waline'
+countBlock +countBlock
a(href=url_for(page.path) + '#post-comment') 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))
i.fa-solid.fa-spinner.fa-spin
when 'Gitalk' when 'Gitalk'
+countBlock +countBlock
a(href=url_for(page.path) + '#post-comment') a(href=url_for(page.path) + '#post-comment')
span.gitalk-comment-count span.gitalk-comment-count
i.fa-solid.fa-spinner.fa-spin
when 'Twikoo' when 'Twikoo'
+countBlock +countBlock
a(href=url_for(page.path) + '#post-comment') a(href=url_for(page.path) + '#post-comment')
span#twikoo-count span#twikoo-count
i.fa-solid.fa-spinner.fa-spin
when 'Facebook Comments' when 'Facebook Comments'
+countBlock +countBlock
a(href=url_for(page.path) + '#post-comment') a(href=url_for(page.path) + '#post-comment')
span.fb-comments-count(data-href=urlNoIndex()) span.fb-comments-count(data-href=urlNoIndex())
when 'Remark42'
+countBlock
a(href=url_for(page.path) + '#post-comment')
span.remark42__counter(data-url=urlNoIndex())
i.fa-solid.fa-spinner.fa-spin
when 'Artalk'
+countBlock
a(href=url_for(page.path) + '#post-comment')
span.artalk-count
i.fa-solid.fa-spinner.fa-spin

View File

@@ -1,4 +1,5 @@
- var htmlClassHideAside = theme.aside.enable && theme.aside.hide ? 'hide-aside' : '' - var htmlClassHideAside = theme.aside.enable && theme.aside.hide ? 'hide-aside' : ''
- page.aside = is_archive() ? theme.aside.display.archive: is_category() ? theme.aside.display.category : is_tag() ? theme.aside.display.tag : page.aside
- var hideAside = !theme.aside.enable || page.aside === false ? 'hide-aside' : '' - var hideAside = !theme.aside.enable || page.aside === false ? 'hide-aside' : ''
- var pageType = is_post() ? 'post' : 'page' - var pageType = is_post() ? 'post' : 'page'

View File

@@ -70,24 +70,42 @@ mixin postUI(posts)
if theme.comments.card_post_count if theme.comments.card_post_count
case theme.comments.use[0] case theme.comments.use[0]
when 'Disqus' when 'Disqus'
when 'Disqusjs'
+countBlockInIndex +countBlockInIndex
a(href=full_url_for(link) + '#disqus_thread') a(href=full_url_for(link) + '#disqus_thread')
i.fa-solid.fa-spinner.fa-spin
when 'Disqusjs'
+countBlockInIndex
a(href=full_url_for(link) + '#disqusjs')
span.disqus-comment-count(data-disqus-url=full_url_for(link))
i.fa-solid.fa-spinner.fa-spin
when 'Valine' when 'Valine'
+countBlockInIndex +countBlockInIndex
a(href=url_for(link) + '#post-comment' itemprop="discussionUrl") a(href=url_for(link) + '#post-comment')
span.valine-comment-count(data-xid=url_for(link) itemprop="commentCount") span.valine-comment-count(data-xid=url_for(link))
i.fa-solid.fa-spinner.fa-spin
when 'Waline' when 'Waline'
+countBlockInIndex +countBlockInIndex
a(href=url_for(link) + '#post-comment') a(href=url_for(link) + '#post-comment')
span.waline-comment-count(id=url_for(link)) span.waline-comment-count(id=url_for(link))
i.fa-solid.fa-spinner.fa-spin
when 'Twikoo' when 'Twikoo'
+countBlockInIndex +countBlockInIndex
a.twikoo-count(href=url_for(link) + '#post-comment') a.twikoo-count(href=url_for(link) + '#post-comment')
i.fa-solid.fa-spinner.fa-spin
when 'Facebook Comments' when 'Facebook Comments'
+countBlockInIndex +countBlockInIndex
a(href=url_for(link) + '#post-comment') a(href=url_for(link) + '#post-comment')
span.fb-comments-count(data-href=urlNoIndex(article.permalink)) span.fb-comments-count(data-href=urlNoIndex(article.permalink))
when 'Remark42'
+countBlockInIndex
a(href=url_for(link) + '#post-comment')
span.remark42__counter(data-url=urlNoIndex(article.permalink))
i.fa-solid.fa-spinner.fa-spin
when 'Artalk'
+countBlockInIndex
a(href=url_for(link) + '#post-comment')
span.artalk-count(data-page-key=url_for(link))
i.fa-solid.fa-spinner.fa-spin
//- Display the article introduction on homepage //- Display the article introduction on homepage
case theme.index_post_content.method case theme.index_post_content.method

View File

@@ -4,64 +4,64 @@
script. script.
(()=>{ (()=>{
const replaceSymbol = (str) => { const replaceSymbol = (str) => {
return str.replace(/[\p{P}\p{S}]/gu, '-') return str.replace(/[\p{P}\p{S}]/gu, "-")
} }
let result = '' let result = ""
fetch('!{url_for(page.flink_url)}') fetch("!{url_for(page.flink_url)}")
.then(response => response.json()) .then(response => response.json())
.then(str => { .then(str => {
for(let i = 0; i < str.length; i++){ for(let i = 0; i < str.length; i++){
const replaceClassName = replaceSymbol(str[i].class_name) const replaceClassName = replaceSymbol(str[i].class_name)
const className = str[i].class_name ? `<h2 id='${replaceClassName}'><a href="#${replaceClassName}" class="headerlink" title="${str[i].class_name}"></a>${str[i].class_name}</h2>` : '' const className = str[i].class_name ? `<h2 id="${replaceClassName}"><a href="#${replaceClassName}" class="headerlink" title="${str[i].class_name}"></a>${str[i].class_name}</h2>` : ""
const classDesc = str[i].class_desc ? `<div class='flink-desc'>${str[i].class_desc}</div>` : '' const classDesc = str[i].class_desc ? `<div class="flink-desc">${str[i].class_desc}</div>` : ""
let listResult = '' let listResult = ""
const lists = str[i].link_list const lists = str[i].link_list
for(let j = 0; j < lists.length; j++){ for(let j = 0; j < lists.length; j++){
listResult += ` listResult += `
<div class="flink-list-item"> <div class="flink-list-item">
<a href='${lists[j].link}' title='${lists[j].name}' target='_blank'> <a href="${lists[j].link}" title="${lists[j].name}" target="_blank">
<div class='flink-item-icon'> <div class="flink-item-icon">
<img class='no-lightbox' src='${lists[j].avatar}' onerror='this.onerror=null;this.src="!{url_for(theme.error_img.flink)}"' alt='${lists[j].name}' /> <img class="no-lightbox" src="${lists[j].avatar}" onerror='this.onerror=null;this.src="!{url_for(theme.error_img.flink)}"' alt="${lists[j].name}" />
</div> </div>
<div class='flink-item-name'>${lists[j].name}</div> <div class="flink-item-name">${lists[j].name}</div>
<div class='flink-item-desc' title='${lists[j].descr}'>${lists[j].descr}</div> <div class="flink-item-desc" title="${lists[j].descr}">${lists[j].descr}</div>
</a> </a>
</div>` </div>`
} }
result += `${className}${classDesc} <div class='flink-list'>${listResult}</div>` result += `${className}${classDesc} <div class="flink-list">${listResult}</div>`
} }
document.querySelector('.flink').insertAdjacentHTML('afterbegin', result) document.querySelector(".flink").insertAdjacentHTML("afterbegin", result)
}) })
})() })()
else else
if site.data.link if site.data.link
- let result = '' - let result = ""
each i in site.data.link each i in site.data.link
- let className = i.class_name ? markdown(`## ${i.class_name}`) : '' - let className = i.class_name ? markdown(`## ${i.class_name}`) : ""
- let classDesc = i.class_desc ? `<div class='flink-desc'>${i.class_desc}</div>` : '' - let classDesc = i.class_desc ? `<div class="flink-desc">${i.class_desc}</div>` : ""
- let listResult = '' - let listResult = ""
each j in i.link_list each j in i.link_list
- -
listResult += ` listResult += `
<div class="flink-list-item"> <div class="flink-list-item">
<a href='${j.link}' title='${j.name}' target='_blank'> <a href="${j.link}" title="${j.name}" target="_blank">
<div class='flink-item-icon'> <div class="flink-item-icon">
<img class='no-lightbox' src='${j.avatar}' onerror='this.onerror=null;this.src="${url_for(theme.error_img.flink)}"' alt='${j.name}' /> <img class="no-lightbox" src="${j.avatar}" onerror='this.onerror=null;this.src="${url_for(theme.error_img.flink)}"' alt="${j.name}" />
</div> </div>
<div class='flink-item-name'>${j.name}</div> <div class="flink-item-name">${j.name}</div>
<div class='flink-item-desc' title='${j.descr}'>${j.descr}</div> <div class="flink-item-desc" title="${j.descr}">${j.descr}</div>
</a> </a>
</div>` </div>`
- -
- result += `${className}${classDesc} <div class='flink-list'>${listResult}</div>` - result += `${className}${classDesc} <div class="flink-list">${listResult}</div>`
- page.content = result + page.content - page.content = result + page.content
!= page.content != page.content

View File

@@ -1,8 +1,8 @@
if theme.post_copyright.enable && page.copyright !== false if theme.post_copyright.enable && page.copyright !== false
- let author = page.copyright_author ? page.copyright_author : config.author - let author = page.copyright_author || config.author
- let authorHref = page.copyright_author_href ? page.copyright_author_href : `mailto:${config.email}` - let authorHref = page.copyright_author_href || theme.post_copyright.author_href || config.url
- let url = page.copyright_url ? page.copyright_url : page.permalink - let url = page.copyright_url || page.permalink
- let info = page.copyright_info ? page.copyright_info : _p('post.copyright.copyright_content', theme.post_copyright.license_url, theme.post_copyright.license, config.url, config.title) - let info = page.copyright_info || _p('post.copyright.copyright_content', theme.post_copyright.license_url, theme.post_copyright.license, config.url, config.title)
.post-copyright .post-copyright
.post-copyright__author .post-copyright__author
span.post-copyright-meta= _p('post.copyright.author') + ": " span.post-copyright-meta= _p('post.copyright.author') + ": "

View File

@@ -23,7 +23,7 @@ mixin rightsideItem(array)
i.fas.fa-list-ul i.fas.fa-list-ul
when 'chat' when 'chat'
if chat_btn if chat_btn
button#chat_btn(type="button" title=_p("rightside.chat_btn")) button#chat_btn(type="button" title=_p("rightside.chat"))
i.fas.fa-sms i.fas.fa-sms
when 'comment' when 'comment'
if commentsJsLoad if commentsJsLoad

View File

@@ -3,18 +3,13 @@
#sidebar-menus #sidebar-menus
.avatar-img.is-center .avatar-img.is-center
img(src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar") img(src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar")
.site-data.is-center .sidebar-site-data.site-data.is-center
.data-item
a(href=url_for(config.archive_dir) + '/') a(href=url_for(config.archive_dir) + '/')
.headline= _p('aside.articles') .headline= _p('aside.articles')
.length-num= site.posts.length .length-num= site.posts.length
.data-item
a(href=url_for(config.tag_dir) + '/' ) a(href=url_for(config.tag_dir) + '/' )
.headline= _p('aside.tags') .headline= _p('aside.tags')
.length-num= site.tags.length .length-num= site.tags.length
.data-item
a(href=url_for(config.category_dir) + '/') a(href=url_for(config.category_dir) + '/')
.headline= _p('aside.categories') .headline= _p('aside.categories')
.length-num= site.categories.length .length-num= site.categories.length

View File

@@ -1,3 +1,3 @@
link(rel='stylesheet' href=url_for(theme.CDN.aplayer_css) media="print" onload="this.media='all'") link(rel='stylesheet' href=url_for(theme.asset.aplayer_css) media="print" onload="this.media='all'")
script(src=url_for(theme.CDN.aplayer_js)) script(src=url_for(theme.asset.aplayer_js))
script(src=url_for(theme.CDN.meting_js)) script(src=url_for(theme.asset.meting_js))

View File

@@ -0,0 +1,20 @@
- const { server, site } = theme.artalk
script.
(() => {
const getArtalkCount = () => {
const runWidget = () => {
Artalk.LoadCountWidget({
server: '!{server}',
site: '!{site}',
countEl: '.artalk-count'
})
}
if (typeof Artalk === 'function') runWidget()
else getScript('!{theme.asset.artalk_js}').then(runWidget)
}
window.pjax ? getArtalkCount() : window.addEventListener('load', getArtalkCount)
})()

View File

@@ -1,10 +1,13 @@
- const fbSDKVer = 'v14.0'
- const fbSDK = theme.messenger.enable ? `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk/xfbml.customerchat.js#xfbml=1&version=${fbSDKVer}` : `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk.js#xfbml=1&version=${fbSDKVer}`
script. script.
(()=>{ (()=>{
function loadFBComment () { function loadFBComment () {
if (typeof FB === 'object') FB.XFBML.parse() if (typeof FB === 'object') FB.XFBML.parse(document.getElementById('recent-posts'))
else { else {
let ele = document.createElement('script') let ele = document.createElement('script')
ele.setAttribute('src','https://connect.facebook.net/!{theme.facebook_comments.lang}/sdk.js#xfbml=1&version=v9.0') ele.setAttribute('src','!{fbSDK}')
ele.setAttribute('async', 'true') ele.setAttribute('async', 'true')
ele.setAttribute('defer', 'true') ele.setAttribute('defer', 'true')
ele.setAttribute('crossorigin', 'anonymous') ele.setAttribute('crossorigin', 'anonymous')

View File

@@ -10,3 +10,7 @@ case theme.comments.use[0]
include ./waline.pug include ./waline.pug
when 'Facebook Comments' when 'Facebook Comments'
include ./fb.pug include ./fb.pug
when 'Remark42'
include ./remark42.pug
when 'Artalk'
include ./artalk.pug

View File

@@ -0,0 +1,18 @@
- const { host, siteId, option } = theme.remark42
script.
(()=>{
window.remark_config = Object.assign({
host: '!{host}',
site_id: '!{siteId}',
},!{JSON.stringify(option)})
function getCount () {
const s = document.createElement('script')
s.src = remark_config.host + '/web/counter.js'
s.defer = true
document.head.appendChild(s)
}
window.pjax ? getCount() : window.addEventListener('load', getCount)
})()

View File

@@ -28,7 +28,7 @@ script.
if (typeof twikoo === 'object') { if (typeof twikoo === 'object') {
runTwikoo() runTwikoo()
} else { } else {
getScript('!{theme.CDN.twikoo}').then(runTwikoo) getScript('!{url_for(theme.asset.twikoo)}').then(runTwikoo)
} }
} }

View File

@@ -6,13 +6,14 @@ script.
el: '#vcomment', el: '#vcomment',
appId: '#{theme.valine.appId}', appId: '#{theme.valine.appId}',
appKey: '#{theme.valine.appKey}', appKey: '#{theme.valine.appKey}',
serverURLs: '#{theme.valine.serverURLs}'
} }
const valine = new Valine(initData) const valine = new Valine(initData)
} }
if (typeof Valine === 'function') initValine() if (typeof Valine === 'function') initValine()
else getScript('!{url_for(theme.CDN.valine)}').then(initValine) else getScript('!{url_for(theme.asset.valine)}').then(initValine)
} }
window.pjax ? loadValine() : window.addEventListener('load', loadValine) window.pjax ? loadValine() : window.addEventListener('load', loadValine)

View File

@@ -5,12 +5,13 @@ script.
let initData = { let initData = {
el: null, el: null,
serverURL: '!{theme.waline.serverURL}', serverURL: '!{theme.waline.serverURL}',
comment: true
} }
const waline = new Waline(initData) const waline = Waline.init(initData)
} }
if (typeof Waline === 'function') initWaline() if (typeof Waline === 'function') initWaline()
else getScript('!{url_for(theme.CDN.waline)}').then(initWaline) else getScript('!{url_for(theme.asset.waline_js)}').then(initWaline)
} }
window.pjax ? loadWaline() : window.addEventListener('load', loadWaline) window.pjax ? loadWaline() : window.addEventListener('load', loadWaline)

View File

@@ -8,3 +8,5 @@ else if theme.gitter && theme.gitter.enable
include ./gitter.pug include ./gitter.pug
else if theme.crisp && theme.crisp.enable else if theme.crisp && theme.crisp.enable
include ./crisp.pug include ./crisp.pug
else if theme.messenger && theme.messenger.enable
include ./messenger.pug

View File

@@ -0,0 +1,42 @@
- let { pageID, lang } = theme.messenger
- lang = theme.comments.use && theme.comments.use.includes('Facebook Comments') ? theme.facebook_comments.lang : lang
#fb-customer-chat.fb-customerchat(page_id=pageID attribution='biz_inbox')
script.
document.getElementById('fb-root') ? '' : document.body.insertAdjacentHTML('afterend', '<div id="fb-root"></div>')
window.fbAsyncInit = function() {
FB.init({
xfbml: true,
version: 'v14.0'
});
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = 'https://connect.facebook.net/!{lang}/sdk/xfbml.customerchat.js';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
if (!{theme.chat_btn}) {
var chatBtnFn = () => {
var chatBtn = document.getElementById("chat_btn")
chatBtn.addEventListener("click", function(){
FB.CustomerChat.show();
});
}
chatBtnFn()
} else {
if (!{theme.chat_hide_show}) {
function chatBtnHide () {
FB.CustomerChat.hide()
}
function chatBtnShow () {
FB.CustomerChat.show(false)
}
}
}

View File

@@ -0,0 +1,45 @@
- const { server, site, option } = theme.artalk
script.
function addArtalkSource () {
const ele = document.createElement('link')
ele.rel = 'stylesheet'
ele.href= '!{theme.asset.artalk_css}'
document.getElementsByTagName('head')[0].appendChild(ele)
}
function loadArtalk () {
function initArtalk () {
window.artalkItem = new Artalk(Object.assign({
el: '#artalk-wrap',
server: '!{server}',
site: '!{site}',
pageKey: location.pathname,
darkMode: document.documentElement.getAttribute('data-theme') === 'dark',
countEl: '.artalk-count'
},!{JSON.stringify(option)}))
}
if (typeof window.artalkItem === 'object') setTimeout(()=>{initArtalk()},200)
else {
addArtalkSource()
typeof Artalk !== 'function' ? getScript('!{theme.asset.artalk_js}').then(initArtalk)
: setTimeout(()=>{initArtalk()},200)
}
}
document.getElementById('darkmode').addEventListener('click',()=> {
if (typeof window.artalkItem !== 'object') return
let isDark = document.documentElement.getAttribute('data-theme') === 'dark'
window.artalkItem.setDarkMode(!isDark)
})
if ('!{theme.comments.use[0]}' === 'Artalk' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('artalk-wrap'), loadArtalk)
else loadArtalk()
} else {
function loadOtherComment () {
loadArtalk()
}
}

View File

@@ -4,7 +4,7 @@ script.
function loadDisqus () { function loadDisqus () {
var disqus_config = function () { var disqus_config = function () {
this.page.url = '!{ page.permalink }' this.page.url = '!{ page.permalink }'
this.page.identifier = '!{ page.path }' this.page.identifier = '!{ url_for(page.path) }'
this.page.title = '!{ disqusPageTitle }' this.page.title = '!{ disqusPageTitle }'
}; };
@@ -24,6 +24,10 @@ script.
(d.head || d.body).appendChild(s); (d.head || d.body).appendChild(s);
})(); })();
} }
document.getElementById('darkmode').addEventListener('click', () => {
setTimeout(() => window.disqusReset(), 200)
})
} }
if ('!{theme.comments.use[0]}' === 'Disqus' || !!{theme.comments.lazyload}) { if ('!{theme.comments.use[0]}' === 'Disqus' || !!{theme.comments.lazyload}) {

View File

@@ -5,34 +5,43 @@ script.
function addDisqusjsCSS () { function addDisqusjsCSS () {
const ele = document.createElement('link') const ele = document.createElement('link')
ele.rel = 'stylesheet' ele.rel = 'stylesheet'
ele.href= '!{url_for(theme.CDN.disqusjs_css)}' ele.href= '!{url_for(theme.asset.disqusjs_css)}'
document.getElementsByTagName('head')[0].appendChild(ele) document.getElementsByTagName('head')[0].appendChild(ele)
} }
function initDisqusjs () { function initDisqusjs () {
window.DISQUS = null window.disqusjs = null
new DisqusJS(Object.assign({ disqusjs = new DisqusJS(Object.assign({
shortname: '!{theme.disqusjs.shortname}', shortname: '!{theme.disqusjs.shortname}',
identifier: '!{ page.path }', identifier: '!{ url_for(page.path) }',
url: '!{ page.permalink }', url: '!{ page.permalink }',
title: '!{ disqusjsPageTitle }', title: '!{ disqusjsPageTitle }',
apikey: '!{theme.disqusjs.apikey}', apikey: '!{theme.disqusjs.apikey}',
},!{JSON.stringify(theme.disqusjs.option)})) },!{JSON.stringify(theme.disqusjs.option)}))
disqusjs.render(document.getElementById('disqusjs'))
}
const themeChange = () => {
const ele = document.getElementById('disqus_thread')
if(!ele) return
disqusjs.destroy()
initDisqusjs()
} }
window.disqusReset = initDisqusjs document.getElementById('darkmode').addEventListener('click', themeChange)
if (window.disqusJsLoad) initDisqusjs() if (window.disqusJsLoad) initDisqusjs()
else { else {
addDisqusjsCSS() addDisqusjsCSS()
getScript('!{url_for(theme.CDN.disqusjs)}').then(initDisqusjs) getScript('!{url_for(theme.asset.disqusjs)}').then(initDisqusjs)
window.disqusJsLoad = true window.disqusJsLoad = true
} }
} }
if ('!{theme.comments.use[0]}' === 'Disqusjs' || !!{theme.comments.lazyload}) { if ('!{theme.comments.use[0]}' === 'Disqusjs' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('disqus_thread'), loadDisqusjs) if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('disqusjs'), loadDisqusjs)
else loadDisqusjs() else loadDisqusjs()
} }
else { else {

View File

@@ -1,16 +1,26 @@
#fb-root - const fbSDKVer = 'v14.0'
- const fbSDK = theme.messenger.enable ? `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk/xfbml.customerchat.js#xfbml=1&version=${fbSDKVer}` : `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk.js#xfbml=1&version=${fbSDKVer}`
script. script.
function loadFBComment () { function loadFBComment () {
var themeNow = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light' document.getElementById('fb-root') ? '' : document.body.insertAdjacentHTML('afterend', '<div id="fb-root"></div>')
document.getElementsByClassName('fb-comments')[0].setAttribute('data-colorscheme',themeNow)
if (typeof FB === 'object') FB.XFBML.parse() const themeNow = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'
const $fbComment = document.getElementsByClassName('fb-comments')[0]
$fbComment.setAttribute('data-colorscheme',themeNow)
$fbComment.setAttribute('data-href', '!{urlNoIndex(page.permalink)}')
if (typeof FB === 'object') {
FB.XFBML.parse(document.getElementsByClassName('post-meta-commentcount')[0])
FB.XFBML.parse(document.getElementById('post-comment'))
}
else { else {
let ele = document.createElement('script') let ele = document.createElement('script')
ele.setAttribute('src','https://connect.facebook.net/!{theme.facebook_comments.lang}/sdk.js#xfbml=1&version=v11.0') ele.setAttribute('src','!{fbSDK}')
ele.setAttribute('async', 'true') ele.setAttribute('async', 'true')
ele.setAttribute('defer', 'true') ele.setAttribute('defer', 'true')
ele.setAttribute('crossorigin', 'anonymous') ele.setAttribute('crossorigin', 'anonymous')
ele.setAttribute('id', 'facebook-jssdk')
document.getElementById('fb-root').insertAdjacentElement('afterbegin',ele) document.getElementById('fb-root').insertAdjacentElement('afterbegin',ele)
} }
} }

View File

@@ -5,7 +5,7 @@ script.
let nowTheme = document.documentElement.getAttribute('data-theme') === 'dark' ? '!{themes.dark}' : '!{themes.light}' let nowTheme = document.documentElement.getAttribute('data-theme') === 'dark' ? '!{themes.dark}' : '!{themes.light}'
const config = Object.assign({ const config = Object.assign({
src: '!{theme.CDN.giscus}', src: 'https://giscus.app/client.js',
'data-repo': '!{repo}', 'data-repo': '!{repo}',
'data-repo-id': '!{repo_id}', 'data-repo-id': '!{repo_id}',
'data-category-id': '!{category_id}', 'data-category-id': '!{category_id}',

View File

@@ -2,7 +2,7 @@ script.
function addGitalkSource () { function addGitalkSource () {
const ele = document.createElement('link') const ele = document.createElement('link')
ele.rel = 'stylesheet' ele.rel = 'stylesheet'
ele.href= '!{url_for(theme.CDN.gitalk_css)}' ele.href= '!{url_for(theme.asset.gitalk_css)}'
document.getElementsByTagName('head')[0].appendChild(ele) document.getElementsByTagName('head')[0].appendChild(ele)
} }
@@ -24,7 +24,7 @@ script.
if (typeof Gitalk === 'function') initGitalk() if (typeof Gitalk === 'function') initGitalk()
else { else {
addGitalkSource() addGitalkSource()
getScript('!{url_for(theme.CDN.gitalk)}').then(initGitalk) getScript('!{url_for(theme.asset.gitalk)}').then(initGitalk)
} }
} }

View File

@@ -22,7 +22,7 @@ hr
when 'Valine' when 'Valine'
#vcomment.vcomment #vcomment.vcomment
when 'Disqusjs' when 'Disqusjs'
#disqus_thread #disqusjs
when 'Livere' when 'Livere'
#lv-container(data-id="city" data-uid=theme.livere.uid) #lv-container(data-id="city" data-uid=theme.livere.uid)
when 'Gitalk' when 'Gitalk'
@@ -40,3 +40,7 @@ hr
data-numposts= theme.facebook_comments.pageSize || 10 data-numposts= theme.facebook_comments.pageSize || 10
data-order-by= theme.facebook_comments.order_by || 'social' data-order-by= theme.facebook_comments.order_by || 'social'
data-width="100%") data-width="100%")
when 'Remark42'
#remark42
when 'Artalk'
#artalk-wrap

View File

@@ -19,4 +19,8 @@ each name in theme.comments.use
when 'Giscus' when 'Giscus'
!=partial('includes/third-party/comments/giscus', {}, {cache: true}) !=partial('includes/third-party/comments/giscus', {}, {cache: true})
when 'Facebook Comments' when 'Facebook Comments'
!=partial('includes/third-party/comments/facebook_comments', {}, {cache: true}) include ./facebook_comments.pug
when 'Remark42'
!=partial('includes/third-party/comments/remark42', {}, {cache: true})
when 'Artalk'
!=partial('includes/third-party/comments/artalk', {}, {cache: true})

View File

@@ -0,0 +1,67 @@
- const { host, siteId, option } = theme.remark42
script.
var remark_config = Object.assign({
host: '!{host}',
site_id: '!{siteId}',
components: ['embed'],
theme: document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'
},!{JSON.stringify(option)})
function addRemark42(){
for (let i = 0; i < remark_config.components.length; i++) {
const s = document.createElement('script')
s.src = remark_config.host + '/web/' + remark_config.components[i] + '.js'
s.defer = true
document.head.appendChild(s)
}
}
function initRemark42() {
if (window.REMARK42) {
if (this.remark42Instance) {
this.remark42Instance.destroy()
}
this.remark42Instance = window.REMARK42.createInstance({
...remark_config
})
}
}
function getCount () {
const ele = document.querySelector('.remark42__counter')
if (ele) {
const s = document.createElement('script')
s.src = remark_config.host + '/web/counter.js'
s.defer = true
document.head.appendChild(s)
}
}
function loadRemark42 () {
if (window.REMARK42) {
this.initRemark42()
getCount()
} else {
addRemark42()
window.addEventListener('REMARK42::ready', () => {
this.initRemark42()
getCount()
})
}
}
document.getElementById('darkmode').addEventListener('click',()=>{
if (!window.REMARK42) return
let theme = document.documentElement.getAttribute('data-theme') === 'dark' ? 'light' : 'dark'
window.REMARK42.changeTheme(theme)
})
if ('!{theme.comments.use[0]}' === 'Remark42' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('remark42'), loadRemark42)
else loadRemark42()
} else {
function loadOtherComment () {
loadRemark42()
}
}

View File

@@ -9,19 +9,21 @@ script.
envId: '!{envId}', envId: '!{envId}',
region: '!{region}', region: '!{region}',
onCommentLoaded: function () { onCommentLoaded: function () {
btf.loadLightbox(document.querySelectorAll('#twikoo .tk-content img:not(.vemoji)')) btf.loadLightbox(document.querySelectorAll('#twikoo .tk-content img:not(.tk-owo-emotion)'))
} }
}, !{JSON.stringify(option)})) }, !{JSON.stringify(option)}))
} }
const getCount = () => { const getCount = () => {
const countELement = document.getElementById('twikoo-count')
if(!countELement) return
twikoo.getCommentsCount({ twikoo.getCommentsCount({
envId: '!{envId}', envId: '!{envId}',
region: '!{region}', region: '!{region}',
urls: [window.location.pathname], urls: [window.location.pathname],
includeReply: false includeReply: false
}).then(function (res) { }).then(function (res) {
document.getElementById('twikoo-count').innerText = res[0].count countELement.innerText = res[0].count
}).catch(function (err) { }).catch(function (err) {
console.error(err); console.error(err);
}); });
@@ -37,7 +39,7 @@ script.
setTimeout(runFn,0) setTimeout(runFn,0)
return return
} }
getScript('!{theme.CDN.twikoo}').then(runFn) getScript('!{url_for(theme.asset.twikoo)}').then(runFn)
} }
if ('!{use[0]}' === 'Twikoo' || !!{lazyload}) { if ('!{use[0]}' === 'Twikoo' || !!{lazyload}) {

View File

@@ -2,7 +2,7 @@ script.
function loadUtterances () { function loadUtterances () {
let ele = document.createElement('script') let ele = document.createElement('script')
ele.setAttribute('id', 'utterances_comment') ele.setAttribute('id', 'utterances_comment')
ele.setAttribute('src', '!{url_for(theme.CDN.utterances)}') ele.setAttribute('src', 'https://utteranc.es/client.js')
ele.setAttribute('repo', '!{theme.utterances.repo}') ele.setAttribute('repo', '!{theme.utterances.repo}')
ele.setAttribute('issue-term', '!{theme.utterances.issue_term}') ele.setAttribute('issue-term', '!{theme.utterances.issue_term}')
let nowTheme = document.documentElement.getAttribute('data-theme') === 'dark' ? '#{theme.utterances.dark_theme}' : '#{theme.utterances.light_theme}' let nowTheme = document.documentElement.getAttribute('data-theme') === 'dark' ? '#{theme.utterances.dark_theme}' : '#{theme.utterances.light_theme}'

View File

@@ -18,7 +18,7 @@ script.
} }
if (typeof Valine === 'function') initValine() if (typeof Valine === 'function') initValine()
else getScript('!{url_for(theme.CDN.valine)}').then(initValine) else getScript('!{url_for(theme.asset.valine)}').then(initValine)
} }
if ('!{theme.comments.use[0]}' === 'Valine' || !!{theme.comments.lazyload}) { if ('!{theme.comments.use[0]}' === 'Valine' || !!{theme.comments.lazyload}) {

View File

@@ -1,23 +1,35 @@
- const { serverURL, visitor, option } = theme.waline - const { serverURL, option, pageview } = theme.waline
- const { lazyload, count, use } = theme.comments
script. script.
function loadWaline () { 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 () { function initWaline () {
const waline = new Waline(Object.assign({ const waline = Waline.init(Object.assign({
el: '#waline-wrap', el: '#waline-wrap',
serverURL: '!{serverURL}', serverURL: '!{serverURL}',
path: location.pathname, pageview: !{lazyload ? false : pageview},
visitor: !{visitor}, dark: 'html[data-theme="dark"]',
dark: 'html[data-theme="dark"]' path: window.location.pathname,
comment: !{lazyload ? false : count},
}, !{JSON.stringify(option)})) }, !{JSON.stringify(option)}))
} }
if (typeof Waline === 'function') initWaline() if (typeof Waline === 'function') initWaline()
else getScript('!{url_for(theme.CDN.waline)}').then(initWaline) else {
insertCSS()
getScript('!{url_for(theme.asset.waline_js)}').then(initWaline)
}
} }
if ('!{theme.comments.use[0]}' === 'Waline' || !!{theme.comments.lazyload}) { if ('!{use[0]}' === 'Waline' || !!{lazyload}) {
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('waline-wrap'),loadWaline) if (!{lazyload}) btf.loadComment(document.getElementById('waline-wrap'),loadWaline)
else setTimeout(loadWaline, 0) else setTimeout(loadWaline, 0)
} else { } else {
function loadOtherComment () { function loadOtherComment () {

View File

@@ -1,19 +1,19 @@
if theme.fireworks && theme.fireworks.enable if theme.fireworks && theme.fireworks.enable
canvas.fireworks(mobile=`${theme.fireworks.mobile}`) canvas.fireworks(mobile=`${theme.fireworks.mobile}`)
script(src=url_for(theme.CDN.fireworks)) script(src=url_for(theme.asset.fireworks))
if (theme.canvas_ribbon && theme.canvas_ribbon.enable) if (theme.canvas_ribbon && theme.canvas_ribbon.enable)
script(defer id="ribbon" src=url_for(theme.CDN.canvas_ribbon) size=theme.canvas_ribbon.size script(defer id="ribbon" src=url_for(theme.asset.canvas_ribbon) size=theme.canvas_ribbon.size
alpha=theme.canvas_ribbon.alpha zIndex=theme.canvas_ribbon.zIndex mobile=`${theme.canvas_ribbon.mobile}` data-click=`${theme.canvas_ribbon.click_to_change}`) alpha=theme.canvas_ribbon.alpha zIndex=theme.canvas_ribbon.zIndex mobile=`${theme.canvas_ribbon.mobile}` data-click=`${theme.canvas_ribbon.click_to_change}`)
if (theme.canvas_fluttering_ribbon && theme.canvas_fluttering_ribbon.enable) if (theme.canvas_fluttering_ribbon && theme.canvas_fluttering_ribbon.enable)
script(defer id="fluttering_ribbon" mobile=`${theme.canvas_fluttering_ribbon.mobile}` src=url_for(theme.CDN.canvas_fluttering_ribbon)) script(defer id="fluttering_ribbon" mobile=`${theme.canvas_fluttering_ribbon.mobile}` src=url_for(theme.asset.canvas_fluttering_ribbon))
if (theme.canvas_nest && theme.canvas_nest.enable) if (theme.canvas_nest && theme.canvas_nest.enable)
script#canvas_nest(defer color=theme.canvas_nest.color opacity=theme.canvas_nest.opacity zIndex=theme.canvas_nest.zIndex count=theme.canvas_nest.count mobile=`${theme.canvas_nest.mobile}` src=url_for(theme.CDN.canvas_nest)) script#canvas_nest(defer color=theme.canvas_nest.color opacity=theme.canvas_nest.opacity zIndex=theme.canvas_nest.zIndex count=theme.canvas_nest.count mobile=`${theme.canvas_nest.mobile}` src=url_for(theme.asset.canvas_nest))
if theme.activate_power_mode.enable if theme.activate_power_mode.enable
script(src=url_for(theme.CDN.activate_power_mode)) script(src=url_for(theme.asset.activate_power_mode))
script. script.
POWERMODE.colorful = !{theme.activate_power_mode.colorful}; POWERMODE.colorful = !{theme.activate_power_mode.colorful};
POWERMODE.shake = !{theme.activate_power_mode.shake}; POWERMODE.shake = !{theme.activate_power_mode.shake};
@@ -22,11 +22,11 @@ if theme.activate_power_mode.enable
//- 鼠標特效 //- 鼠標特效
if theme.click_heart && theme.click_heart.enable if theme.click_heart && theme.click_heart.enable
script#click-heart(src=url_for(theme.CDN.click_heart) async mobile=`${theme.click_heart.mobile}`) script#click-heart(src=url_for(theme.asset.click_heart) async mobile=`${theme.click_heart.mobile}`)
if theme.ClickShowText && theme.ClickShowText.enable if theme.ClickShowText && theme.ClickShowText.enable
script#click-show-text( script#click-show-text(
src= url_for(theme.CDN.ClickShowText) src= url_for(theme.asset.ClickShowText)
data-mobile= `${theme.ClickShowText.mobile}` data-mobile= `${theme.ClickShowText.mobile}`
data-text= theme.ClickShowText.text.join(",") data-text= theme.ClickShowText.text.join(",")
data-fontsize= theme.ClickShowText.fontSize data-fontsize= theme.ClickShowText.fontSize

View File

@@ -1,6 +1,5 @@
link(rel="stylesheet" type="text/css" href=theme.CDN.katex) link(rel="stylesheet" type="text/css" href=url_for(theme.asset.katex))
script(src=url_for(theme.CDN.katex_copytex)) script(src=url_for(theme.asset.katex_copytex))
link(rel="stylesheet" type="text/css" href=theme.CDN.katex_copytex_css)
script. script.
(() => { (() => {
document.querySelectorAll('#article-container span.katex-display').forEach(item => { document.querySelectorAll('#article-container span.katex-display').forEach(item => {

View File

@@ -37,7 +37,7 @@ script.
} }
const script = document.createElement('script') const script = document.createElement('script')
script.src = '!{theme.CDN.mathjax}' script.src = '!{url_for(theme.asset.mathjax)}'
script.id = 'MathJax-script' script.id = 'MathJax-script'
script.async = true script.async = true
document.head.appendChild(script) document.head.appendChild(script)

View File

@@ -18,7 +18,7 @@ script.
} }
const loadMermaid = () => { const loadMermaid = () => {
window.loadMermaid ? runMermaid() : getScript('!{theme.CDN.mermaid}').then(runMermaid) window.loadMermaid ? runMermaid() : getScript('!{url_for(theme.asset.mermaid)}').then(runMermaid)
} }
window.pjax ? loadMermaid() : document.addEventListener('DOMContentLoaded', loadMermaid) window.pjax ? loadMermaid() : document.addEventListener('DOMContentLoaded', loadMermaid)

View File

@@ -0,0 +1,82 @@
- const { server, 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'
script.
window.addEventListener('load', () => {
const changeContent = (content) => {
if (content === '') return content
content = content.replace(/<img.*?src="(.*?)"?[^\>]+>/ig, '[!{_p("aside.card_newest_comments.image")}]') // replace image link
content = content.replace(/<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, '[!{_p("aside.card_newest_comments.link")}]') // replace url
content = content.replace(/<pre><code>.*?<\/pre>/gi, '[!{_p("aside.card_newest_comments.code")}]') // replace code
content = content.replace(/<[^>]+>/g,"") // remove html tag
if (content.length > 150) {
content = content.substring(0,150) + '...'
}
return content
}
const generateHtml = array => {
let result = ''
if (array.length) {
for (let i = 0; i < array.length; i++) {
result += '<div class=\'aside-list-item\'>'
if (!{theme.newest_comments.avatar}) {
const name = '!{theme.lazyload.enable ? "data-lazy-src" : "src"}'
result += `<a href='${array[i].url}' class='thumbnail'><img ${name}='${array[i].avatar}' alt='${array[i].nick}'></a>`
}
result += `<div class='content'>
<a class='comment' href='${array[i].url}' title='${array[i].content}'>${array[i].content}</a>
<div class='name'><span>${array[i].nick} / </span><time datetime="${array[i].date}">${btf.diffDate(array[i].date, true)}</time></div>
</div></div>`
}
} else {
result += '!{_p("aside.card_newest_comments.zero")}'
}
let $dom = document.querySelector('#card-newest-comments .aside-list')
$dom.innerHTML= result
window.lazyLoadInstance && window.lazyLoadInstance.update()
window.pjax && window.pjax.refresh($dom)
}
const getComment = () => {
fetch('!{server}/api/stat?type=latest_comments&limit=!{theme.newest_comments.limit}',{method: "POST"})
.then(response => response.json())
.then(d => {
const artalk = d.data.map(function (e) {
return {
'avatar': '!{avatarCdn}' + e.email_encrypted + '?d=!{avatarDefault}',
'content': changeContent(e.content_marked),
'nick': e.nick,
'url': e.page_url,
'date': e.date,
}
})
saveToLocal.set('artalk-newest-comments', JSON.stringify(artalk), !{theme.newest_comments.storage}/(60*24))
generateHtml(artalk)
}).catch(e => {
const $dom = document.querySelector('#card-newest-comments .aside-list')
$dom.innerHTML= "!{_p('aside.card_newest_comments.error')}"
})
}
const newestCommentInit = () => {
if (document.querySelector('#card-newest-comments .aside-list')) {
const data = saveToLocal.get('artalk-newest-comments')
if (data) {
generateHtml(JSON.parse(data))
} else {
getComment()
}
}
}
newestCommentInit()
document.addEventListener('pjax:complete', newestCommentInit)
})

View File

@@ -24,3 +24,7 @@ if use
when 'Utterances' when 'Utterances'
- userRepo = theme.utterances.repo - userRepo = theme.utterances.repo
include ./github-issues.pug include ./github-issues.pug
when 'Remark42'
include ./remark42.pug
when 'Artalk'
include ./artalk.pug

View File

@@ -0,0 +1,80 @@
- const { host, siteId } = theme.remark42
script.
window.addEventListener('load', () => {
const changeContent = (content) => {
if (content === '') return content
content = content.replace(/<img.*?src="(.*?)"?[^\>]+>/ig, '[!{_p("aside.card_newest_comments.image")}]') // replace image link
content = content.replace(/<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, '[!{_p("aside.card_newest_comments.link")}]') // replace url
content = content.replace(/<pre><code>.*?<\/pre>/gi, '[!{_p("aside.card_newest_comments.code")}]') // replace code
content = content.replace(/<[^>]+>/g,"") // remove html tag
if (content.length > 150) {
content = content.substring(0,150) + '...'
}
return content
}
const generateHtml = array => {
let result = ''
if (array.length) {
for (let i = 0; i < array.length; i++) {
result += '<div class=\'aside-list-item\'>'
if (!{theme.newest_comments.avatar}) {
const name = '!{theme.lazyload.enable ? "data-lazy-src" : "src"}'
result += `<a href='${array[i].url}' class='thumbnail'><img ${name}='${array[i].avatar}' alt='${array[i].nick}'></a>`
}
result += `<div class='content'>
<a class='comment' href='${array[i].url}' title='${array[i].content}'>${array[i].content}</a>
<div class='name'><span>${array[i].nick} / </span><time datetime="${array[i].date}">${btf.diffDate(array[i].date, true)}</time></div>
</div></div>`
}
} else {
result += '!{_p("aside.card_newest_comments.zero")}'
}
let $dom = document.querySelector('#card-newest-comments .aside-list')
$dom.innerHTML= result
window.lazyLoadInstance && window.lazyLoadInstance.update()
window.pjax && window.pjax.refresh($dom)
}
const getComment = () => {
fetch('!{host}/api/v1/last/!{theme.newest_comments.limit}?site=!{siteId}')
.then(response => response.json())
.then(data => {
const remark42 = data.map(function (e) {
return {
'avatar': e.user.picture,
'content': changeContent(e.text),
'nick': e.user.name,
'url': e.locator.url,
'date': e.time,
}
})
saveToLocal.set('remark42-newest-comments', JSON.stringify(remark42), !{theme.newest_comments.storage}/(60*24))
generateHtml(remark42)
}).catch(e => {
const $dom = document.querySelector('#card-newest-comments .aside-list')
$dom.innerHTML= "!{_p('aside.card_newest_comments.error')}"
})
}
const newestCommentInit = () => {
if (document.querySelector('#card-newest-comments .aside-list')) {
const data = saveToLocal.get('remark42-newest-comments')
if (data) {
generateHtml(JSON.parse(data))
} else {
getComment()
}
}
}
newestCommentInit()
document.addEventListener('pjax:complete', newestCommentInit)
})

View File

@@ -43,7 +43,7 @@ script.
if (typeof twikoo === 'object') { if (typeof twikoo === 'object') {
runTwikoo() runTwikoo()
} else { } else {
getScript('!{theme.CDN.twikoo}').then(runTwikoo) getScript('!{url_for(theme.asset.twikoo)}').then(runTwikoo)
} }
} }

View File

@@ -1,6 +1,6 @@
- let default_avatar = theme.valine.avatar - let default_avatar = theme.valine.avatar
script(src=url_for(theme.CDN.blueimp_md5)) script(src=url_for(theme.asset.blueimp_md5))
script. script.
window.addEventListener('load', () => { window.addEventListener('load', () => {
const changeContent = (content) => { const changeContent = (content) => {

View File

@@ -1,5 +1,3 @@
- let { avatar,avatarCDN } = theme.waline
script. script.
window.addEventListener('load', () => { window.addEventListener('load', () => {
const changeContent = (content) => { const changeContent = (content) => {
@@ -45,11 +43,11 @@ script.
const getComment = () => { const getComment = () => {
const loadWaline = () => { const loadWaline = () => {
Waline.Widget.RecentComments({ Waline.RecentComments({
serverURL: '!{theme.waline.serverURL}', serverURL: '!{theme.waline.serverURL}',
count: !{theme.newest_comments.limit} count: !{theme.newest_comments.limit}
}).then(res => { }).then(({comments}) => {
const walineArray = res.comments.map(e => { const walineArray = comments.map(e => {
return { return {
'content': changeContent(e.comment), 'content': changeContent(e.comment),
'avatar': e.avatar, 'avatar': e.avatar,
@@ -67,7 +65,7 @@ script.
} }
if (typeof Waline === 'function') loadWaline() if (typeof Waline === 'function') loadWaline()
else getScript('!{url_for(theme.CDN.waline)}').then(loadWaline) else getScript('!{url_for(theme.asset.waline_js)}').then(loadWaline)
} }
const newestCommentInit = () => { const newestCommentInit = () => {

View File

@@ -2,7 +2,7 @@ script.
function panguFn () { function panguFn () {
if (typeof pangu === 'object') pangu.autoSpacingPage() if (typeof pangu === 'object') pangu.autoSpacingPage()
else { else {
getScript('!{url_for(theme.CDN.pangu)}') getScript('!{url_for(theme.asset.pangu)}')
.then(() => { .then(() => {
pangu.autoSpacingPage() pangu.autoSpacingPage()
}) })

View File

@@ -3,7 +3,7 @@ if theme.pjax.exclude
each val in theme.pjax.exclude each val in theme.pjax.exclude
- pjaxExclude = pjaxExclude + `:not([href="${val}"])` - pjaxExclude = pjaxExclude + `:not([href="${val}"])`
- let pjaxSelectors = ['title','#config-diff','#body-wrap','#rightside-config-hide','#rightside-config-show','.js-pjax'] - let pjaxSelectors = ['head > title','#config-diff','#body-wrap','#rightside-config-hide','#rightside-config-show','.js-pjax']
- let choose = theme.comments.use - let choose = theme.comments.use
if choose if choose
@@ -12,7 +12,7 @@ if choose
if choose.includes('Utterances') || choose.includes('Giscus') if choose.includes('Utterances') || choose.includes('Giscus')
- pjaxSelectors.unshift('link[rel="canonical"]') - pjaxSelectors.unshift('link[rel="canonical"]')
script(src=url_for(theme.CDN.pjax)) script(src=url_for(theme.asset.pjax))
script. script.
let pjaxSelectors = !{JSON.stringify(pjaxSelectors)} let pjaxSelectors = !{JSON.stringify(pjaxSelectors)}
@@ -27,10 +27,11 @@ script.
document.addEventListener('pjax:send', function () { document.addEventListener('pjax:send', function () {
// removeEventListener scroll // removeEventListener scroll
window.removeEventListener('scroll', window.tocScrollFn) window.tocScrollFn && window.removeEventListener('scroll', window.tocScrollFn)
window.removeEventListener('scroll', scrollCollect) window.scrollCollect && window.removeEventListener('scroll', scrollCollect)
typeof preloader === 'object' && preloader.initLoading() typeof preloader === 'object' && preloader.initLoading()
document.getElementById('rightside').style.cssText = "opacity: ''; transform: ''"
if (window.aplayers) { if (window.aplayers) {
for (let i = 0; i < window.aplayers.length; i++) { for (let i = 0; i < window.aplayers.length; i++) {
@@ -46,6 +47,7 @@ script.
const $bodyClassList = document.body.classList const $bodyClassList = document.body.classList
$bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode') $bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')
typeof disqusjs === 'object' && disqusjs.destroy()
}) })
document.addEventListener('pjax:complete', function () { document.addEventListener('pjax:complete', function () {

View File

@@ -1,5 +1,5 @@
if config.prismjs && config.prismjs.enable && !config.prismjs.preprocess if config.prismjs && config.prismjs.enable && !config.prismjs.preprocess
script(src=url_for(theme.CDN.prismjs_js)) script(src=url_for(theme.asset.prismjs_js))
script(src=url_for(theme.CDN.prismjs_autoloader)) script(src=url_for(theme.asset.prismjs_autoloader))
if config.prismjs.line_number if config.prismjs.line_number
script(src=url_for(theme.CDN.prismjs_lineNumber_js)) script(src=url_for(theme.asset.prismjs_lineNumber_js))

View File

@@ -1,7 +1,7 @@
#algolia-search #algolia-search
.search-dialog .search-dialog
nav.search-nav nav.search-nav
span.search-dialog-title= 'Algolia' span.search-dialog-title= _p('search.title')
button.search-close-button button.search-close-button
i.fas.fa-times i.fas.fa-times
@@ -11,6 +11,8 @@
#algolia-search-results #algolia-search-results
#algolia-hits #algolia-hits
#algolia-pagination #algolia-pagination
#algolia-stats #algolia-info
.algolia-stats
.algolia-poweredBy
#search-mask #search-mask

View File

@@ -1,7 +1,7 @@
#local-search #local-search
.search-dialog .search-dialog
nav.search-nav nav.search-nav
span.search-dialog-title=_p("search.local_search.label") span.search-dialog-title= _p('search.title')
span#loading-status span#loading-status
button.search-close-button button.search-close-button
i.fas.fa-times i.fas.fa-times

View File

@@ -5,6 +5,6 @@
a(class="a2a_button_" + name) a(class="a2a_button_" + name)
a.a2a_dd(href="https://www.addtoany.com/share") a.a2a_dd(href="https://www.addtoany.com/share")
script(async src=url_for(theme.CDN.addtoany)) script(async src='https://static.addtoany.com/menu/page.js')

View File

@@ -1,3 +1,3 @@
.social-share(data-image=url_for(page.cover|| theme.avatar.img) data-sites= theme.sharejs.sites) .social-share(data-image=url_for(page.cover|| theme.avatar.img) data-sites= theme.sharejs.sites)
link(rel='stylesheet' href=url_for(theme.CDN.sharejs_css) media="print" onload="this.media='all'") link(rel='stylesheet' href=url_for(theme.asset.sharejs_css) media="print" onload="this.media='all'")
script(src=url_for(theme.CDN.sharejs) defer) script(src=url_for(theme.asset.sharejs) defer)

View File

@@ -1,4 +1,4 @@
- const { effect,loop,source,sub } = theme.subtitle - const { effect,loop,source,sub,startDelay,typeSpeed,backSpeed } = theme.subtitle
- let subContent = sub || new Array() - let subContent = sub || new Array()
case source case source
@@ -14,10 +14,10 @@ case source
sub.unshift(data.hitokoto, from) sub.unshift(data.hitokoto, from)
window.typed = new Typed('#subtitle', { window.typed = new Typed('#subtitle', {
strings: sub, strings: sub,
startDelay: 300, startDelay: !{startDelay},
typeSpeed: 150, typeSpeed: !{typeSpeed},
loop: !{loop}, loop: !{loop},
backSpeed: 50, backSpeed: !{backSpeed},
}) })
} else { } else {
document.getElementById('subtitle').innerHTML = data.hitokoto document.getElementById('subtitle').innerHTML = data.hitokoto
@@ -29,7 +29,7 @@ case source
if (typeof Typed === 'function') { if (typeof Typed === 'function') {
subtitleType() subtitleType()
} else { } else {
getScript('!{url_for(theme.CDN.typed)}').then(subtitleType) getScript('!{url_for(theme.asset.typed)}').then(subtitleType)
} }
} else { } else {
subtitleType() subtitleType()
@@ -46,10 +46,10 @@ case source
sub.unshift(con, from) sub.unshift(con, from)
window.typed = new Typed('#subtitle', { window.typed = new Typed('#subtitle', {
strings: sub, strings: sub,
startDelay: 300, startDelay: !{startDelay},
typeSpeed: 150, typeSpeed: !{typeSpeed},
loop: !{loop}, loop: !{loop},
backSpeed: 50, backSpeed: !{backSpeed},
}) })
} else { } else {
document.getElementById('subtitle').innerHTML = con document.getElementById('subtitle').innerHTML = con
@@ -61,7 +61,7 @@ case source
if (typeof Typed === 'function') { if (typeof Typed === 'function') {
subtitleType() subtitleType()
} else { } else {
getScript('!{url_for(theme.CDN.typed)}').then(subtitleType) getScript('!{url_for(theme.asset.typed)}').then(subtitleType)
} }
} else { } else {
subtitleType() subtitleType()
@@ -78,10 +78,10 @@ case source
sub.unshift(content) sub.unshift(content)
window.typed = new Typed('#subtitle', { window.typed = new Typed('#subtitle', {
strings: sub, strings: sub,
startDelay: 300, startDelay: !{startDelay},
typeSpeed: 150, typeSpeed: !{typeSpeed},
loop: !{loop}, loop: !{loop},
backSpeed: 50, backSpeed: !{backSpeed},
}) })
} else { } else {
document.getElementById('subtitle').innerHTML = result.data.content document.getElementById('subtitle').innerHTML = result.data.content
@@ -94,7 +94,7 @@ case source
if (typeof Typed === 'function') { if (typeof Typed === 'function') {
subtitleType() subtitleType()
} else { } else {
getScript('!{url_for(theme.CDN.typed)}').then(subtitleType) getScript('!{url_for(theme.asset.typed)}').then(subtitleType)
} }
} else { } else {
subtitleType() subtitleType()
@@ -107,10 +107,10 @@ case source
if (!{effect}) { if (!{effect}) {
window.typed = new Typed("#subtitle", { window.typed = new Typed("#subtitle", {
strings: !{JSON.stringify(subContent)}, strings: !{JSON.stringify(subContent)},
startDelay: 300, startDelay: !{startDelay},
typeSpeed: 150, typeSpeed: !{typeSpeed},
loop: !{loop}, loop: !{loop},
backSpeed: 50 backSpeed: !{backSpeed}
}) })
} else { } else {
document.getElementById("subtitle").innerHTML = '!{subContent[0]}' document.getElementById("subtitle").innerHTML = '!{subContent[0]}'
@@ -121,7 +121,7 @@ case source
if (typeof Typed === 'function') { if (typeof Typed === 'function') {
subtitleType() subtitleType()
} else { } else {
getScript('!{url_for(theme.CDN.typed)}').then(subtitleType) getScript('!{url_for(theme.asset.typed)}').then(subtitleType)
} }
} else { } else {
subtitleType() subtitleType()

View File

@@ -1,6 +1,6 @@
if theme.aside.card_announcement.enable if theme.aside.card_announcement.enable
.card-widget.card-announcement .card-widget.card-announcement
.item-headline .item-headline
i.fas.fa-bullhorn.card-announcement-animation i.fas.fa-bullhorn.fa-shake
span= _p('aside.card_announcement') span= _p('aside.card_announcement')
.announcement_content!= theme.aside.card_announcement.content .announcement_content!= theme.aside.card_announcement.content

View File

@@ -6,18 +6,13 @@ if theme.aside.card_author.enable
.author-info__name= config.author .author-info__name= config.author
.author-info__description!= theme.aside.card_author.description || config.description .author-info__description!= theme.aside.card_author.description || config.description
.card-info-data.is-center .card-info-data.site-data.is-center
.card-info-data-item
a(href=url_for(config.archive_dir) + '/') a(href=url_for(config.archive_dir) + '/')
.headline= _p('aside.articles') .headline= _p('aside.articles')
.length-num= site.posts.length .length-num= site.posts.length
.card-info-data-item
a(href=url_for(config.tag_dir) + '/') a(href=url_for(config.tag_dir) + '/')
.headline= _p('aside.tags') .headline= _p('aside.tags')
.length-num= site.tags.length .length-num= site.tags.length
.card-info-data-item
a(href=url_for(config.category_dir) + '/') a(href=url_for(config.category_dir) + '/')
.headline= _p('aside.categories') .headline= _p('aside.categories')
.length-num= site.categories.length .length-num= site.categories.length

View File

@@ -12,6 +12,7 @@ if theme.aside.card_webinfo.enable
.webinfo-item .webinfo-item
.item-name= _p('aside.card_webinfo.runtime.name') + " :" .item-name= _p('aside.card_webinfo.runtime.name') + " :"
.item-count#runtimeshow(data-publishDate=date_xml(theme.runtimeshow.publish_date)) .item-count#runtimeshow(data-publishDate=date_xml(theme.runtimeshow.publish_date))
i.fa-solid.fa-spinner.fa-spin
if theme.wordcount.enable && theme.wordcount.total_wordcount if theme.wordcount.enable && theme.wordcount.total_wordcount
.webinfo-item .webinfo-item
.item-name=_p('aside.card_webinfo.site_wordcount') + " :" .item-name=_p('aside.card_webinfo.site_wordcount') + " :"
@@ -20,12 +21,15 @@ if theme.aside.card_webinfo.enable
.webinfo-item .webinfo-item
.item-name= _p('aside.card_webinfo.site_uv_name') + " :" .item-name= _p('aside.card_webinfo.site_uv_name') + " :"
.item-count#busuanzi_value_site_uv .item-count#busuanzi_value_site_uv
i.fa-solid.fa-spinner.fa-spin
if theme.busuanzi.site_pv if theme.busuanzi.site_pv
.webinfo-item .webinfo-item
.item-name= _p('aside.card_webinfo.site_pv_name') + " :" .item-name= _p('aside.card_webinfo.site_pv_name') + " :"
.item-count#busuanzi_value_site_pv .item-count#busuanzi_value_site_pv
i.fa-solid.fa-spinner.fa-spin
if theme.aside.card_webinfo.last_push_date if theme.aside.card_webinfo.last_push_date
.webinfo-item .webinfo-item
.item-name= _p('aside.card_webinfo.last_push_date.name') + " :" .item-name= _p('aside.card_webinfo.last_push_date.name') + " :"
.item-count#last-push-date(data-lastPushDate=date_xml(Date.now())) .item-count#last-push-date(data-lastPushDate=date_xml(Date.now()))
i.fa-solid.fa-spinner.fa-spin

View File

@@ -14,7 +14,7 @@ block content
a(href=url_for(item.path)).post-meta__tags #[=item.name] a(href=url_for(item.path)).post-meta__tags #[=item.name]
include includes/third-party/share/index.pug include includes/third-party/share/index.pug
if theme.reward.enable if theme.reward.enable && theme.reward.QR_code
!=partial('includes/post/reward', {}, {cache: true}) !=partial('includes/post/reward', {}, {cache: true})
//- ad //- ad

View File

@@ -1,6 +1,6 @@
{ {
"name": "hexo-theme-butterfly", "name": "hexo-theme-butterfly",
"version": "4.0.0", "version": "4.4.0",
"description": "A Simple and Card UI Design theme for Hexo", "description": "A Simple and Card UI Design theme for Hexo",
"main": "package.json", "main": "package.json",
"scripts": { "scripts": {
@@ -23,8 +23,8 @@
"email": "my@crazywong.com" "email": "my@crazywong.com"
}, },
"dependencies": { "dependencies": {
"hexo-renderer-stylus": "^2.0.1", "hexo-renderer-stylus": "^2.1.0",
"hexo-renderer-pug": "^2.0.0" "hexo-renderer-pug": "^3.0.0"
}, },
"homepage": "https://butterfly.js.org/", "homepage": "https://butterfly.js.org/",
"author": "Jerry <my@crazywong.com>", "author": "Jerry <my@crazywong.com>",

190
plugins.yml Normal file
View File

@@ -0,0 +1,190 @@
algolia_search_v4:
name: algoliasearch
file: dist/algoliasearch-lite.umd.js
version: 4.14.2
instantsearch_v4:
name: instantsearch.js
file: dist/instantsearch.production.min.js
version: 4.44.0
pjax:
name: pjax
file: pjax.min.js
version: 0.2.8
gitalk:
name: gitalk
file: dist/gitalk.min.js
version: 1.7.2
gitalk_css:
name: gitalk
file: dist/gitalk.css
version: 1.7.2
blueimp_md5:
name: blueimp-md5
file: js/md5.min.js
version: 2.19.0
valine:
name: valine
file: dist/Valine.min.js
version: 1.5.1
disqusjs:
name: disqusjs
file: dist/browser/disqusjs.es2015.umd.min.js
version: 3.0.1
disqusjs_css:
name: disqusjs
file: dist/browser/styles/disqusjs.css
version: 3.0.1
twikoo:
name: twikoo
file: dist/twikoo.all.min.js
version: 1.6.5
waline_js:
name: '@waline/client'
file: dist/waline.js
other_name: waline
version: 2.6.3
waline_css:
name: '@waline/client'
file: dist/waline.css
other_name: waline
version: 2.6.3
sharejs:
name: butterfly-extsrc
file: sharejs/dist/js/social-share.min.js
version: 1.1.3
sharejs_css:
name: butterfly-extsrc
file: sharejs/dist/css/share.min.css
version: 1.1.3
mathjax:
name: mathjax
file: es5/tex-mml-chtml.js
version: 3.2.2
katex:
name: katex
file: dist/katex.min.css
other_name: KaTeX
version: 0.16.0
katex_copytex:
name: katex
file: dist/contrib/copy-tex.min.js
other_name: KaTeX
version: 0.16.0
mermaid:
name: mermaid
file: dist/mermaid.min.js
version: 9.1.5
canvas_ribbon:
name: butterfly-extsrc
file: dist/canvas-ribbon.min.js
version: 1.1.3
canvas_fluttering_ribbon:
name: butterfly-extsrc
file: dist/canvas-fluttering-ribbon.min.js
version: 1.1.3
canvas_nest:
name: butterfly-extsrc
file: dist/canvas-nest.min.js
version: 1.1.3
activate_power_mode:
name: butterfly-extsrc
file: dist/activate-power-mode.min.js
version: 1.1.3
fireworks:
name: butterfly-extsrc
file: dist/fireworks.min.js
version: 1.1.3
click_heart:
name: butterfly-extsrc
file: dist/click-heart.min.js
version: 1.1.3
ClickShowText:
name: butterfly-extsrc
file: dist/click-show-text.min.js
version: 1.1.3
lazyload:
name: vanilla-lazyload
file: dist/lazyload.iife.min.js
version: 17.3.1
instantpage:
name: instant.page
file: instantpage.js
version: 5.1.1
typed:
name: typed.js
file: lib/typed.min.js
version: 2.0.12
pangu:
name: pangu
file: dist/browser/pangu.min.js
version: 4.0.7
fancybox_css_v4:
name: '@fancyapps/ui'
file: dist/fancybox.css
version: 4.0.31
other_name: fancyapps-ui
fancybox_v4:
name: '@fancyapps/ui'
file: dist/fancybox.umd.js
version: 4.0.31
other_name: fancyapps-ui
medium_zoom:
name: medium-zoom
file: dist/medium-zoom.min.js
version: 1.0.6
snackbar_css:
name: node-snackbar
file: dist/snackbar.min.css
version: 0.1.16
snackbar:
name: node-snackbar
file: dist/snackbar.min.js
version: 0.1.16
fontawesomeV6:
name: '@fortawesome/fontawesome-free'
file: css/all.min.css
other_name: font-awesome
version: 6.1.2
flickr_justified_gallery_js:
name: flickr-justified-gallery
file: dist/fjGallery.min.js
version: 2.1.2
flickr_justified_gallery_css:
name: flickr-justified-gallery
file: dist/fjGallery.css
version: 2.1.2
aplayer_css:
name: aplayer
file: dist/APlayer.min.css
version: 1.10.1
aplayer_js:
name: aplayer
file: dist/APlayer.min.js
version: 1.10.1
meting_js:
name: butterfly-extsrc
file: metingjs/dist/Meting.min.js
version: 1.1.3
prismjs_js:
name: prismjs
file: prism.js
other_name: prism
version: 1.28.0
prismjs_lineNumber_js:
name: prismjs
file: plugins/line-numbers/prism-line-numbers.min.js
other_name: prism
version: 1.28.0
prismjs_autoloader:
name: prismjs
file: plugins/autoloader/prism-autoloader.min.js
other_name: prism
version: 1.28.0
artalk_js:
name: artalk
file: dist/Artalk.js
version: 2.3.4
artalk_css:
name: artalk
file: dist/Artalk.css
version: 2.3.4

94
scripts/events/cdn.js Normal file
View File

@@ -0,0 +1,94 @@
/**
* Butterfly
* Merge CDN
*/
'use strict'
const { version } = require('../../package.json')
const path = require('path')
hexo.extend.filter.register('before_generate', () => {
const themeConfig = hexo.theme.config
const { CDN } = themeConfig
const thirdPartySrc = hexo.render.renderSync({ path: path.join(hexo.theme_dir,'/plugins.yml'), engine: 'yaml'})
const internalSrc = {
main: {
name: 'hexo-theme-butterfly',
file: 'js/main.js',
version
},
utils: {
name: 'hexo-theme-butterfly',
file: 'js/utils.js',
version
},
translate: {
name: 'hexo-theme-butterfly',
file: 'js/tw_cn.js',
version
},
local_search: {
name: 'hexo-theme-butterfly',
file: 'js/search/local-search.js',
version
},
algolia_js: {
name: 'hexo-theme-butterfly',
file: 'js/search/algolia.js',
version
}
}
const minFile = (file) => {
return file.replace(/(?<!\.min)\.(js|css)$/g, ext => '.min' + ext)
}
const createCDNLink = (data, type, cond = '') => {
Object.keys(data).map(key => {
let { name, version, file, other_name } = data[key]
const min_file = minFile(file)
const cdnjs_name = other_name || name
const cdnjs_file = file.replace(/^[lib|dist]*\/|browser\//g, '')
const min_cdnjs_file = minFile(cdnjs_file)
if (cond === 'internal') file = `source/${file}`
const verType = CDN.version ? `@${version}` : ''
const value = {
version,
name,
file,
cdnjs_file,
min_file,
min_cdnjs_file,
cdnjs_name
}
const cdnSource = {
local: cond === 'internal' ? cdnjs_file : `/pluginsSrc/${name}/${file}`,
jsdelivr: `https://cdn.jsdelivr.net/npm/${name}${verType}/${min_file}`,
unpkg: `https://unpkg.com/${name}${verType}/${file}`,
cdnjs: `https://cdnjs.cloudflare.com/ajax/libs/${cdnjs_name}/${version}/${min_cdnjs_file}`,
custom: (CDN.custom_format || '').replace(/\$\{(.+?)\}/g, (match, $1) => value[$1])
}
data[key] = cdnSource[type]
})
if (cond === 'internal') data['main_css'] = 'css/index.css'
return data
}
// delete null value
const deleteNullValue = obj => {
if (!obj) return
for (const i in obj) {
obj[i] === null && delete obj[i]
}
return obj
}
themeConfig.asset = Object.assign(createCDNLink(internalSrc,CDN.internal_provider,'internal'),
createCDNLink(thirdPartySrc,CDN.third_party_provider), deleteNullValue(CDN.option))
})

14
scripts/events/comment.js Normal file
View File

@@ -0,0 +1,14 @@
/**
* Capitalize the first letter of comment name
*/
hexo.extend.filter.register('before_generate', () => {
const themeConfig = hexo.theme.config
let { use } = themeConfig.comments
if (!use) return
if (typeof use === 'string') {
use = use.split(',')
}
const newArray = use.map(item => item.toLowerCase().replace(/\b[a-z]/g, s => s.toUpperCase()))
themeConfig.comments.use = newArray
})

View File

@@ -1,128 +0,0 @@
/**
* Butterfly
* 1. Merge CDN
* 2. Capitalize the first letter of comment name
*/
'use strict'
hexo.extend.filter.register('before_generate', () => {
const themeConfig = hexo.theme.config
/**
* Merge CDN
*/
const defaultCDN = {
main_css: '/css/index.css',
main: '/js/main.js',
utils: '/js/utils.js',
// pjax
pjax: 'https://cdn.jsdelivr.net/npm/pjax/pjax.min.js',
// comments
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',
utterances: 'https://utteranc.es/client.js',
twikoo: 'https://cdn.jsdelivr.net/npm/twikoo/dist/twikoo.all.min.js',
waline: 'https://cdn.jsdelivr.net/npm/@waline/client/dist/Waline.min.js',
giscus: 'https://giscus.app/client.js',
// share
addtoany: 'https://static.addtoany.com/menu/page.js',
sharejs: 'https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js',
sharejs_css: 'https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css',
// search
local_search: '/js/search/local-search.js',
algolia_js: '/js/search/algolia.js',
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',
// math
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',
// count
busuanzi: '//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js',
// background effect
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',
lazyload: 'https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js',
instantpage: 'https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js',
typed: 'https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js',
pangu: 'https://cdn.jsdelivr.net/npm/pangu/dist/browser/pangu.min.js',
// photo
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
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',
// effect
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',
// fontawesome
fontawesome: 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css',
// Conversion between Traditional and Simplified Chinese
translate: '/js/tw_cn.js',
// flickr-justified-gallery
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
aplayer_css: 'https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css',
aplayer_js: 'https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js',
meting_js: 'https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js',
// Prism.js
prismjs_js: 'https://cdn.jsdelivr.net/npm/prismjs/prism.min.js',
prismjs_lineNumber_js: 'https://cdn.jsdelivr.net/npm/prismjs/plugins/line-numbers/prism-line-numbers.min.js',
prismjs_autoloader: 'https://cdn.jsdelivr.net/npm/prismjs/plugins/autoloader/prism-autoloader.min.js'
}
// delete null value
const deleteNullValue = obj => {
for (const i in obj) {
obj[i] === null && delete obj[i]
}
return obj
}
themeConfig.CDN = Object.assign(defaultCDN, deleteNullValue(themeConfig.CDN))
/**
* Capitalize the first letter of comment name
*/
let { use } = themeConfig.comments
if (!use) return
if (typeof use === 'string') {
use = use.split(',')
}
const newArray = use.map(item => item.toLowerCase().replace(/^\S/, s => s.toUpperCase()))
themeConfig.comments.use = newArray
})

View File

@@ -4,9 +4,9 @@ hexo.extend.filter.register('before_generate', () => {
// Get first two digits of the Hexo version number // Get first two digits of the Hexo version number
const hexoVer = hexo.version.replace(/(^.*\..*)\..*/, '$1') const hexoVer = hexo.version.replace(/(^.*\..*)\..*/, '$1')
if (hexoVer < 5) { if (hexoVer < 5.3) {
logger.error('Please update Hexo to V5.0.0 or higher!') logger.error('Please update Hexo to V5.3.0 or higher!')
logger.error('請把 Hexo 升級到 V5.0.0 或更高的版本!') logger.error('請把 Hexo 升級到 V5.3.0 或更高的版本!')
process.exit(-1) process.exit(-1)
} }

View File

@@ -0,0 +1,58 @@
hexo.extend.helper.register('findArchiveLength', function (func) {
const allPostsLength = this.site.posts.length;
if (hexo.config.archive_generator && hexo.config.archive_generator.enable === false ) return allPostsLength
const { yearly, monthly, daily } = hexo.config.archive_generator
const { year, month, day } = this.page
if (yearly === false || !year) return allPostsLength
const posts = this.site.posts.sort('date')
const compareFunc = (type,y1,m1,d1,y2,m2,d2) => {
if (type === 'year') {
return y1 === y2
} else if (type === 'month') {
return y1 === y2 && m1 === m2
} else if (type === 'day') {
return y1 === y2 && m1 === m2 && d1 === d2
}
}
const generateDateObj = (type) => {
let dateObj = []
let length = 0
posts.forEach(post => {
let date = post.date.clone()
const year = date.year()
const month = date.month() + 1
const day = date.date()
let lastData = dateObj[length - 1]
if (!lastData || !compareFunc(type, lastData.year, lastData.month, lastData.day, year, month, day)) {
const name = type === 'year' ? year : type === 'month' ? `${year}-${month}` : `${year}-${month}-${day}`
length = dateObj.push({
name,
year,
month,
day,
count: 1
})
} else {
lastData.count++
}
});
return dateObj
}
const data = func('createArchiveObj', ()=> {
const yearObj = yearly ? generateDateObj('year') : []
const monthObj = monthly ? generateDateObj('month') : []
const dayObj = daily ? generateDateObj('day') : []
const fullObj = [...yearObj, ...monthObj, ...dayObj]
return fullObj
})
const name = month ? day ? `${year}-${month}-${day}` : `${year}-${month}` : year
return data.find(item => item.name === name).count
})

View File

@@ -8,6 +8,10 @@
hexo.extend.helper.register('inject_head_js', function () { hexo.extend.helper.register('inject_head_js', function () {
const { darkmode, aside } = this.theme const { darkmode, aside } = this.theme
const { theme_color } = hexo.theme.config
const themeColorLight = theme_color && theme_color.enable && theme_color.meta_theme_color_light || '#ffffff'
const themeColorDark = theme_color && theme_color.enable && theme_color.meta_theme_color_dark || '#0d0d0d'
const localStore = ` const localStore = `
win.saveToLocal = { win.saveToLocal = {
set: function setWithExpiry(key, value, ttl) { set: function setWithExpiry(key, value, ttl) {
@@ -62,13 +66,13 @@ hexo.extend.helper.register('inject_head_js', function () {
win.activateDarkMode = function () { win.activateDarkMode = function () {
document.documentElement.setAttribute('data-theme', 'dark') document.documentElement.setAttribute('data-theme', 'dark')
if (document.querySelector('meta[name="theme-color"]') !== null) { if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d') document.querySelector('meta[name="theme-color"]').setAttribute('content', '${themeColorDark}')
} }
} }
win.activateLightMode = function () { win.activateLightMode = function () {
document.documentElement.setAttribute('data-theme', 'light') document.documentElement.setAttribute('data-theme', 'light')
if (document.querySelector('meta[name="theme-color"]') !== null) { if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff') document.querySelector('meta[name="theme-color"]').setAttribute('content', '${themeColorLight}')
} }
} }
const t = saveToLocal.get('theme') const t = saveToLocal.get('theme')

View File

@@ -71,7 +71,13 @@ hexo.extend.helper.register('injectHtml', function (data) {
return result return result
}) })
hexo.extend.helper.register('findArchivesTitle', function (menu) { hexo.extend.helper.register('findArchivesTitle', function (page, menu, date) {
if (page.year) {
const dateStr = page.month ? `${page.year}-${page.month}` : `${page.year}`
const date_format = page.month ? hexo.theme.config.aside.card_archives.format : 'YYYY'
return date(dateStr, date_format)
}
const defaultTitle = this._p('page.archives') const defaultTitle = this._p('page.archives')
if (!menu) return defaultTitle if (!menu) return defaultTitle

View File

@@ -54,14 +54,15 @@ hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
relatedPosts[i].cover === false relatedPosts[i].cover === false
? relatedPosts[i].randomcover ? relatedPosts[i].randomcover
: relatedPosts[i].cover : relatedPosts[i].cover
result += `<div><a href="${this.url_for(relatedPosts[i].path)}" title="${relatedPosts[i].title}">` const title = this.escape_html(relatedPosts[i].title)
result += `<div><a href="${this.url_for(relatedPosts[i].path)}" title="${title}">`
result += `<img class="cover" src="${this.url_for(cover)}" alt="cover">` result += `<img class="cover" src="${this.url_for(cover)}" alt="cover">`
if (dateType === 'created') { if (dateType === 'created') {
result += `<div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> ${this.date(relatedPosts[i].created, hexoConfig.date_format)}</div>` result += `<div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> ${this.date(relatedPosts[i].created, hexoConfig.date_format)}</div>`
} else { } else {
result += `<div class="content is-center"><div class="date"><i class="fas fa-history fa-fw"></i> ${this.date(relatedPosts[i].updated, hexoConfig.date_format)}</div>` result += `<div class="content is-center"><div class="date"><i class="fas fa-history fa-fw"></i> ${this.date(relatedPosts[i].updated, hexoConfig.date_format)}</div>`
} }
result += `<div class="title">${relatedPosts[i].title}</div>` result += `<div class="title">${title}</div>`
result += '</div></a></div>' result += '</div></a></div>'
} }

39
scripts/tag/flink.js Normal file
View File

@@ -0,0 +1,39 @@
/**
* flink
*/
'use strict'
const urlFor = require('hexo-util').url_for.bind(hexo)
const flinkFn = (args, content) => {
content = hexo.render.renderSync({ text: content, engine: 'yaml' })
let result = ''
content.forEach(i => {
const className = i.class_name ? `<div class="flink-name">${i.class_name}</div>` : ''
const classDesc = i.class_desc ? `<div class="flink-desc">${i.class_desc}</div>` : ''
let listResult = ''
i.link_list.forEach(j => {
listResult += `
<div class="flink-list-item">
<a href="${j.link}" title="${j.name}" target="_blank">
<div class="flink-item-icon">
<img class="no-lightbox" src="${j.avatar}" onerror='this.onerror=null;this.src="${urlFor(hexo.theme.config.error_img.flink)}"' alt="${j.name}" />
</div>
<div class="flink-item-name">${j.name}</div>
<div class="flink-item-desc" title="${j.descr}">${j.descr}</div>
</a>
</div>`
})
result += `${className}${classDesc} <div class="flink-list">${listResult}</div>`
})
return `<div class="flink">${result}</div>`
}
hexo.extend.tag.register('flink', flinkFn, { ends: true })

View File

@@ -62,8 +62,7 @@ function hideToggle (args, content) {
if (color) group += `color: ${color}` if (color) group += `color: ${color}`
group += '"' group += '"'
return `<div class="hide-toggle" ${border}><div class="hide-button toggle-title" ${group}><i class="fas fa-caret-right fa-fw"></i><span>${display}</span></div> return `<details class="toggle" ${border}><summary class="toggle-button" ${group}>${display}</summary><div class="toggle-content">${hexo.render.renderSync({ text: content, engine: 'markdown' })}</div></details>`
<div class="hide-content">${hexo.render.renderSync({ text: content, engine: 'markdown' })}</div></div>`
} }
hexo.extend.tag.register('hideInline', hideInline) hexo.extend.tag.register('hideInline', hideInline)

View File

@@ -17,7 +17,7 @@ function postNote (args, content) {
const iconArray = args[args.length - 2] const iconArray = args[args.length - 2]
if (iconArray && iconArray.startsWith('fa')) { if (iconArray && iconArray.startsWith('fa')) {
icon = `<i class="note-icon ${iconArray}"></i>` icon = `<i class="note-icon ${iconArray}"></i>`
args[args.length - 2] = 'icon' args[args.length - 2] = 'icon-padding'
} }
return `<div class="note ${args.join(' ')}">${icon + hexo.render.renderSync({ text: content, engine: 'markdown' })}</div>` return `<div class="note ${args.join(' ')}">${icon + hexo.render.renderSync({ text: content, engine: 'markdown' })}</div>`

View File

@@ -11,9 +11,7 @@
.fontawesomeIcon .fontawesomeIcon
display: inline-block display: inline-block
font-weight: 600 font-weight: 600
font-style: normal font-family: 'Font Awesome 6 Free'
font-variant: normal
font-family: 'Font Awesome 5 Free'
text-rendering: auto text-rendering: auto
-webkit-font-smoothing: antialiased -webkit-font-smoothing: antialiased
@@ -55,7 +53,7 @@
li li
position: relative position: relative
padding 0.12em 0.4em 0.12em 1.4em padding: .12em .4em .12em 1.4em
&:hover &:hover
&:before &:before
@@ -135,10 +133,6 @@ if hexo-config('enter_transitions')
> :nth-child({i}) > :nth-child({i})
animation: sidebarItem (i / 5)s animation: sidebarItem (i / 5)s
.card-announcement-animation
color: #FF0000
animation: announ_animation .8s linear infinite
.scroll-down-effects .scroll-down-effects
animation: scroll-down-effect 1.5s infinite animation: scroll-down-effect 1.5s infinite
@@ -251,14 +245,6 @@ if hexo-config('avatar.effect') == true
opacity: 1 opacity: 1
transform: translateY(0) transform: translateY(0)
@keyframes announ_animation
0%,
to
transform: scale(1)
50%
transform: scale(1.2)
@keyframes sidebarItem @keyframes sidebarItem
0% 0%
transform: translateX(200px) transform: translateX(200px)

View File

@@ -96,7 +96,7 @@ $code-block
transition: transform .3s transition: transform .3s
& + .code-lang & + .code-lang
left: 1.6em left: 1.7em
&.closed &.closed
transition: all .3s transition: all .3s
@@ -112,7 +112,7 @@ $code-block
.copy-notice .copy-notice
position: absolute position: absolute
right: 2.1em right: 2.4em
opacity: 0 opacity: 0
transition: opacity .4s transition: opacity .4s
@@ -160,7 +160,7 @@ $code-block
transform: rotate(90deg) !important transform: rotate(90deg) !important
& ~ .copy-notice & ~ .copy-notice
right: 3.3em right: 3.45em
& ~ .copy-button & ~ .copy-button
right: 2.1em right: 2.1em

View File

@@ -38,24 +38,7 @@
margin-top: -.42em margin-top: -.42em
.card-info-data .card-info-data
display: table
margin: 14px 0 4px margin: 14px 0 4px
width: 100%
table-layout: fixed
& > .card-info-data-item
display: table-cell
a
.headline
@extend .limit-one-line
color: var(--font-color)
font-size: 1em
.length-num
margin-top: -.42em
color: var(--text-highlight-color)
font-size: 1.4em
.card-info-social-icons .card-info-social-icons
margin: 6px 0 -6px margin: 6px 0 -6px
@@ -319,6 +302,11 @@
&:hover &:hover
animation: more-btn-move 1s infinite animation: more-btn-move 1s infinite
.card-announcement
.item-headline
i
color: #FF0000
.avatar-img .avatar-img
overflow: hidden overflow: hidden
margin: 0 auto margin: 0 auto
@@ -335,6 +323,30 @@
&:hover &:hover
transform: rotate(360deg) transform: rotate(360deg)
.site-data
display: table
width: 100%
table-layout: fixed
& > a
display: table-cell
div
transition: all .3s
&:hover
div
color: $theme-color !important
.headline
@extend .limit-one-line
color: var(--font-color)
.length-num
margin-top: -.32em
color: var(--text-highlight-color)
font-size: 1.4em
@keyframes more-btn-move @keyframes more-btn-move
0%, 0%,
100% 100%
@@ -391,7 +403,7 @@
if hexo-config('aside.card_archives.sort_order') if hexo-config('aside.card_archives.sort_order')
.card-archives .card-archives
order: hexo-config('aside.card-archives.sort_order') order: hexo-config('aside.card_archives.sort_order')
if hexo-config('aside.card_webinfo.sort_order') if hexo-config('aside.card_webinfo.sort_order')
.card-webinfo .card-webinfo

View File

@@ -6,3 +6,12 @@ if hexo-config('chat_btn') == true && hexo-config('chatra.enable')
height: 1px !important height: 1px !important
opacity: 0 !important opacity: 0 !important
pointer-events: none pointer-events: none
if hexo-config('chat_btn') == true && hexo-config('messenger.enable')
.fb_dialog,
.fb-customerchat
visibility: hidden !important
width: 1px !important
height: 1px !important
opacity: 0 !important
pointer-events: none

View File

@@ -301,10 +301,10 @@
margin-top: 8px margin-top: 8px
padding: 0 padding: 0
width: max-content width: max-content
border-radius: 5px
background-color: var(--sidebar-bg) background-color: var(--sidebar-bg)
box-shadow: 0 5px 20px -4px rgba($dark-black, .5) box-shadow: 0 5px 20px -4px rgba($dark-black, .5)
animation: sub_menus .3s .1s ease both animation: sub_menus .3s .1s ease both
border-radius: 5px
&:before &:before
position: absolute position: absolute
@@ -321,9 +321,13 @@
background: var(--text-bg-hover) background: var(--text-bg-hover)
&:first-child &:first-child
border-radius: 5px 5px 0 0 border-top-left-radius: 5px
border-top-right-radius: 5px
&:last-child &:last-child
border-radius: 0 0 5px 5px border-bottom-right-radius: 5px
border-bottom-left-radius: 5px
a a
display: inline-block display: inline-block
padding: 8px 16px padding: 8px 16px

View File

@@ -51,6 +51,7 @@
&.pagination-post &.pagination-post
overflow: hidden overflow: hidden
margin-top: 40px margin-top: 40px
width: 100%
background: $dark-black background: $dark-black
.layout .layout

View File

@@ -152,6 +152,11 @@ beautify()
#post #post
.tag_share .tag_share
&:after
display: block
clear: both
content: ''
.post-meta .post-meta
&__tag-list &__tag-list
display: inline-block display: inline-block
@@ -174,7 +179,7 @@ beautify()
.post_share .post_share
display: inline-block display: inline-block
float: right float: right
margin: 8px 0 margin: 8px 0 0
width: fit-content width: fit-content
.social-share .social-share

View File

@@ -25,24 +25,8 @@
& > .avatar-img & > .avatar-img
margin: 20px auto margin: 20px auto
.site-data .sidebar-site-data
display: table
padding: 0 10px padding: 0 10px
width: 100%
table-layout: fixed
.data-item
display: table-cell
& > a > div
@extend .limit-one-line
.length-num
color: var(--text-highlight-color)
font-size: 1.28em
.headline
color: var(--font-color)
hr hr
margin: 20px auto margin: 20px auto

View File

@@ -65,6 +65,9 @@ if hexo-config('waline.bg')
margin: 0 0 20px margin: 0 0 20px
text-align: center text-align: center
& > svg
height: 100%
.utterances, .utterances,
.fb-comments iframe .fb-comments iframe
width: 100% !important width: 100% !important
@@ -86,6 +89,7 @@ mjx-container[display],
.has-jax .has-jax
overflow-x: auto overflow-x: auto
overflow-y: hidden overflow-y: hidden
line-height: normal !important
.aplayer .aplayer
color: $font-black color: $font-black
@@ -106,3 +110,6 @@ mjx-container[display],
&:before &:before
content: none content: none
.snackbar-css
border-radius: 5px !important

View File

@@ -118,8 +118,10 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
fill: alpha(#FFFFFF, .9) !important fill: alpha(#FFFFFF, .9) !important
// Disqusjs // Disqusjs
#disqus_thread #disqusjs
#dsqjs #dsqjs
&:hover,
&:focus,
.dsqjs-tab-active, .dsqjs-tab-active,
.dsqjs-no-comment .dsqjs-no-comment
color: alpha(#FFFFFF, .7) color: alpha(#FFFFFF, .7)
@@ -142,3 +144,7 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
#operare_artitalk .c2 #operare_artitalk .c2
background: #121212 background: #121212
#card-toc
+maxWidth900()
background: lighten(#121212, 5)

View File

@@ -1,5 +1,7 @@
#article-container #article-container
.flink .flink
margin-bottom: 20px
.flink-list .flink-list
overflow: auto overflow: auto
padding: 10px 10px 0 padding: 10px 10px 0
@@ -23,8 +25,9 @@
width: calc(100% - 15px) !important width: calc(100% - 15px) !important
&:hover &:hover
img .flink-item-icon
transform: rotate(360deg) margin-left: -10px
width: 0
&:before &:before
position: absolute position: absolute
@@ -54,12 +57,13 @@
width: 60px width: 60px
height: 60px height: 60px
border-radius: 35px border-radius: 35px
transition: width .3s ease-out
img img
width: 100% width: 100%
height: 100% height: 100%
transition: filter 375ms ease-in .2s, transform .3s
object-fit: cover object-fit: cover
transition: filter 375ms ease-in 0.2s, transform .3s
.img-alt .img-alt
display: none display: none
@@ -76,3 +80,8 @@
padding: 16px 10px 16px 0 padding: 16px 10px 16px 0
height: 50px height: 50px
font-size: .93em font-size: .93em
.flink-name
margin-bottom: 5px
font-weight: bold
font-size: 1.5em

View File

@@ -82,6 +82,9 @@
i i
margin: 0 4px 0 0 margin: 0 4px 0 0
.fa-spinner
margin: 0
.article-meta-label .article-meta-label
if hexo-config('post_meta.page.label') if hexo-config('post_meta.page.label')
padding-right: 4px padding-right: 4px

View File

@@ -11,7 +11,8 @@
color: var(--search-input-color) color: var(--search-input-color)
.ais-Hits-list .ais-Hits-list
padding-left: 24px margin: 0
padding: 0
@extend .list-beauty @extend .list-beauty
a a
@@ -25,12 +26,17 @@
color: $search-keyword-highlight color: $search-keyword-highlight
font-weight: bold font-weight: bold
.algolia-hit-item-content
margin: 0 0 8px
word-break: break-all
.ais-Pagination .ais-Pagination
margin: 16px 0 0 margin: 20px 0 0
padding: 0 padding: 0
text-align: center text-align: center
.ais-Pagination-list .ais-Pagination-list
margin: 0
padding: 0 padding: 0
list-style: none list-style: none
@@ -52,7 +58,34 @@
color: #eee color: #eee
cursor: default cursor: default
.ais-Pagination-item--disabled
visibility: hidden
.algolia-logo .algolia-logo
padding-top: 2px padding-top: 2px
width: 80px width: 80px
height: 30px height: 30px
#algolia-hits
> div
overflow-y: scroll
+minWidth768()
max-height: calc(80vh - 240px)
+maxWidth768()
height: calc(100vh - 260px)
#algolia-info
div
display: inline
.algolia-poweredBy
float: right
.apple
#algolia-search
#algolia-hits
> div
+maxWidth768()
height: calc(90vh - 260px)

View File

@@ -1,6 +1,6 @@
.search-dialog .search-dialog
position: fixed position: fixed
top: 100px top: 10%
left: 50% left: 50%
z-index: 1001 z-index: 1001
display: none display: none

Some files were not shown because too many files have changed in this diff Show More