Compare commits

...

81 Commits
3.8.2 ... 4.3.0

Author SHA1 Message Date
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
Jerry
31f17d1c64 label 4.0.0 2022-01-15 00:34:35 +08:00
Jerry
18d9d652a0 feat: 美化 firefox 瀏覽器滾動條
fix: Utterances 評論區在多個頁面顯示的是同一個評論區
fix: 修復評論配置爲 Livere 和 Facebook Comments 時,最新評論模塊仍然顯示的 bug
improvement: blueimp_md5 CDN 可配置
improvement: timeline 優化
improvement: css優化
improvement: 友情鏈接優化
2022-01-15 00:30:01 +08:00
Jerry
850c825fcf feat: toc 間隔調整, 直接子元素增加豎線辨識 closed #723
fix: 修復 toc 在小設備上顯示出屏幕外的 bug
fix: 修復在打賞按鈕周圍也會觸發打賞彈窗的 bug
fix: Waline 最近評論的時間只顯示 "剛剛" 的問題 (以docker的方式執行) #730
fix: 修復點擊右下角顯示按鈕時,按鈕沒有出現的 bug
remove: 移除 button 的 hover 效果
2021-12-22 22:39:27 +08:00
Jerry Wong
36d85c4c23 Merge pull request #730 from nitezs/dev
fix: 修復 Waline 最近評論的時間只顯示 "剛剛" 的問題
2021-12-18 21:03:31 +08:00
nitezs
002692886c fix: 修復 Waline 最近評論的時間只顯示 "剛剛" 的問題 2021-12-16 17:19:18 +08:00
Jerry
444081846c fix: 修復沒有配置 comments 的 use 時,會報錯的 bug
fix: 修復首頁置頂和更新時間的分割線間隔顯示問題
2021-11-25 00:03:31 +08:00
Jerry
ffeab5e20c breaking changes: 移除博天api
breaking changes: 移除 waline 的 avatar 和 avatar cdn 配置
feat: anchor 不再限制 post 頁開啟,可以在任何頁面開啟
feat: 文章標題支持點擊跳轉到此標題開始閲讀 closed #653
feat: toc可以設置全部展開 closed #709
feat: 增加 新的評論系統 giscus
feat: 支持新的評論名寫法,主題會處理評論名字大小寫,舊的會兼容
feat: 友情鏈接列表增加 fetch url 獲取
improvement: 鼠標移到最新評論內容,增加 title 顯示
fix: 修復 rightside 遮擋內容,導致內容無法點擊的 bug
fix: 修復 mermaid 在某些頁面(有元素 id 為 mermaid 時) 會無法加載的 bug
fix: 修復 搜索框不會自動 focus 的 bug
2021-11-14 17:50:11 +08:00
Jerry
f7c50586ce breaking changes: algolia 升級至 v4
feat:  本地搜索增加數據庫加載中和搜索中 loading 顯示
feat: 更改文章美化後,列表的顯示效果 closed #693 closed #686
improvement: UI 微調
2021-10-29 14:40:10 +08:00
Jerry
632cb37bc5 improvement: 禁止点击 button 会出现放大的行为 2021-10-12 23:43:47 +08:00
Jerry
cb82bfb7b6 feat: 替換 Justified Gallery 為 flickr-justified-gallery
feat: 完全移除 jquery
feat: 清除配置文件的CDN, 默認 CDN 不再顯示在 config
feat: 切換夜間模式後, mermaid 也會切換夜間主題
feat: 移除騰訊分析
feat: 移除右下角字體調整按鈕
feat: 本地搜索可處理 json
feat: 右下角按鈕自定義順序
feat: 右小角按鈕 UI 微調
improvement: 手機端更改閲讀模式退出按鈕到右下角
improvement: photofigcaption 和 fancybox 的 figcaption 優先顯示 圖片的title屬性,然後是 alt 屬性
improvement: 首頁ui微調
improvement: 禁止一些瀏覽器會出現點擊左下角按鈕出現放大網頁的行為
improvement: js 優化
fix: 修復窗口大小改變時,導航欄的ui 可能會錯亂的 bug
fix: 修復 pjax 下, twikoo 評論獲取是上一篇評論的 bug
fix: 壓縮 html 代碼後, mermaid 顯示正常
2021-10-12 23:27:56 +08:00
Jerry Wong
f5c3dcf327 Merge pull request #684 from Rr210/patch-2
本地搜索使用json替换xml,速度更快
2021-10-06 16:01:49 +08:00
Harry
312a766901 本地搜索使用json替换xml,速度更快
## xml文件格式本地测试
![](https://cdn.jsdelivr.net/gh/Rr210/image@master/hexo/api/20211006095512.png)
## json文件本地测试
![](https://cdn.jsdelivr.net/gh/Rr210/image@master/hexo/api/20211006095847.png)
## json文件线上测试
![](https://cdn.jsdelivr.net/gh/Rr210/image@master/hexo/api/20211006100635.png)
## 模式切换
两种模式 切换 只需要修改全局配置文件的搜索插件文件格式(json/xml)
2021-10-06 14:52:52 +08:00
Jerry
7e729cff79 feat: 新增標籤外掛 timeline closed #644
fix: 自建頁面圖片沒有 blur 效果
improvement: 優化 404 頁面 UI
improvement: lazyload 默認佔位圖改為透明圖片
improvement: 優化 lazyload blur 出現特效
improvement: 優化 css
2021-09-27 00:12:13 +08:00
Jerry
3708fdf569 breaking changes: 移除 html 的 font-size 改為瀏覽器默認大小
feat: 為文章單獨設置 TOC simple_style 顯示 closed #631
feat: page 頁頂部圖增加黑色遮罩 closed #671
feat: 首頁 pagination 更新 UI
fix: 修復使用本地搜索時,搜索插件配置為不搜索文章內容會無法使用搜索 的 bug
fix: 修復開啟 photofigcaption 後,導致inlineImg標籤外掛顯示錯亂的 bug
fix: 修復 字體過大/過小而導致 部分 ui 偏移的 bug
improvement: 主題 css 使用的 rem 改為 em 或 px
improvement: 修改没有顶部图下,文章页的标题大小 closed #669
improvement: 代碼優化
2021-09-20 17:55:20 +08:00
Jerry
de8e35d0d0 fix: 修復開啟 photofigcaption 後,導致 inlineImg 標籤外掛顯示錯亂的 bug close #667
fix: 修復使用本地搜索時,搜索插件配置為不搜索文章內容會無法使用搜索的 bug close #666
fix: 修復可能導致相關文章鏈接出錯的 bug close #549
improvement: 調整代碼框滾動條顏色 close #651
improvement: 當圖片沒有 figcaption 時,不會添加 figcaption 代碼
2021-09-18 22:10:50 +08:00
Jerry
484f036adb breaking changes: 刪除 hide_sidebar_menu_child 配置,改為直接在 menu 配置 close #640
feat: sidebar menu 點擊展開不再限制只能點擊按鈕 #640
feat: TWIKOO 評論圖片添加 lightbox
feat: 升級 facebook comment js 到 v11
fix: 修復可能導致相關文章鏈接出錯的bug #549
improvement: 調整代碼框 ocean theme 下滾動條顏色 close #651
improvement: 當圖片沒有 figcaption 時,不會添加 figcaption 代碼
improvement: 代碼優化
2021-09-01 16:10:39 +08:00
Jerry
7210f5b431 breaking changes: toc 配置更改,頁面支持 toc 顯示 close #636
feat: 代碼框設置高度限制,展開後按鈕不會消失,可點擊再次摺疊 close #637
feat: 增加 no-lightbox class 偵測,可配置 fancybox 和 medium-zoom 不應用於圖片 #636
fix: 修復開啟 lazyload 時, fancybox 的縮略圖顯示 lazyload 加載圖片的 bug
2021-08-18 00:07:31 +08:00
Jerry Wong
b5e3d2c2c3 Merge pull request #634 from Eurkon/dev
fix: 文章 post-info 中发表时间或更新时间 title 属性 undefined 问题
2021-08-12 22:42:07 +08:00
Eurkon
f1d1ae6639 fix: 文章 post-info 中发表时间 title 属性 undefined问题 2021-08-12 14:13:02 +08:00
Jerry
f1bf2413a0 breaking changes: 更新 fancybox 到 4
improvement: 網站資料顯示,但標籤和分類為0時,數量顯示為 0,而不是隱藏
improvement: subtitle 代碼優化, 1.當source設為false,同時sub也沒有配置,將會讀取hexo配置文件的 subtitle,2.無須使用轉義字符
improvement: 禁止ios點擊搜索框,頁面放大的問題
2021-08-08 15:36:22 +08:00
Jerry
45d6ced507 修復 Waline 評論系統 設置 avatarCDN 無效的 bug 2021-07-30 01:09:55 +08:00
Jerry
101cb45b90 fix: Waline 評論系統 設置 avatarCDN 無效的 bug 2021-07-30 01:00:32 +08:00
Jerry
43790dec07 breaking changes: 精簡各評論的配置
fix: 修復footer 在部分瀏覽器沒有顯示在底部的 bug
improvement: 修改配置文件註釋
2021-07-20 23:56:40 +08:00
147 changed files with 3101 additions and 2380 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

2
.github/stale.yml vendored
View File

@@ -10,7 +10,7 @@ exemptLabels:
- enhancement
- documentation
# Label to use when marking an issue as stale
staleLabel: wontfix
staleLabel: stale
# 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

View File

@@ -9,22 +9,22 @@
![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)
![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)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/theme-butterfly-readme.png)
Demo: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [MYW](https://immyw.com/)
Demo: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [CrazyWong](https://crazywong.com/)
Docs: 📖 [Butterfly Docs](https://butterfly.js.org/posts/21cfbf15/)
Based on [hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody) theme.
## Installation
## 💻 Installation
### GIT
> If you are in Mainland China, you can download in [Gitee](https://gitee.com/iamjerryw/hexo-theme-butterfly)
> If you are in Mainland China, you can download in [Gitee](https://gitee.com/immyw/hexo-theme-butterfly.git)
Stable branch [recommend]:
@@ -48,7 +48,7 @@ In Hexo site root directory
npm i hexo-theme-butterfly
```
## Configuration
## Configuration
Set theme in the hexo work folder's root config file `_config.yml`:
@@ -58,7 +58,7 @@ npm i hexo-theme-butterfly
> npm install hexo-renderer-pug hexo-renderer-stylus
## Features
## 🎉 Features
- [x] Card UI Design
- [X] Support sub-menu
@@ -79,7 +79,7 @@ npm i hexo-theme-butterfly
- [x] Related articles
- [x] Displays outdated notice for a post
- [x] Share (AddThis/Sharejs/Addtoany)
- [X] Comment (Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo)
- [X] Comment (Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42)
- [x] Multiple Comment System Support
- [x] Online Chats (Chatra/Tidio/Daovoice/Gitter/Crisp)
- [x] Web analytics
@@ -97,7 +97,13 @@ npm i hexo-theme-butterfly
- [x] Lazyload images
- [x] Instantpage/Pangu/Snackbar notification toast/PWA......
## Screenshots
## ✨ Contributors
<a href="https://github.com/jerryc127/hexo-theme-butterfly/graphs/contributors">
<img src="https://contrib.rocks/image?repo=jerryc127/hexo-theme-butterfly" />
</a>
## 📷 Screenshots
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-1.jpg)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-2.jpg)

View File

@@ -9,22 +9,22 @@
![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)
![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)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/theme-butterfly-readme.png)
預覽: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [MYW](https://immyw.com/)
預覽: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [CrazyWong](https://crazywong.com/)
文檔: 📖 [Butterfly Docs](https://butterfly.js.org/posts/21cfbf15/)
一款基於[hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody)修改的主題
## 安裝
## 💻 安裝
### Git 安裝
> 本倉庫同時上傳到 [Gitee](https://gitee.com/iamjerryw/hexo-theme-butterfly),如果你訪問 Github 緩慢,可從 Gitee 中下載。
> 本倉庫同時上傳到 [Gitee](https://gitee.com/immyw/hexo-theme-butterfly.git),如果你訪問 Github 緩慢,可從 Gitee 中下載。
在博客根目錄裡安裝穩定版【推薦】
@@ -48,7 +48,8 @@ git clone -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/bu
npm i hexo-theme-butterfly
```
## 應用主題
## 應用主題
修改hexo配置文件`_config.yml`,把主題改為`Butterfly`
```
@@ -57,7 +58,7 @@ theme: butterfly
>如果你沒有pug以及stylus的渲染器請下載安裝 npm install hexo-renderer-pug hexo-renderer-stylus --save
## 特色
## 🎉 特色
- [x] 卡片化設計
- [X] 支持二級目錄
@@ -78,7 +79,7 @@ theme: butterfly
- [x] 顯示相關文章
- [x] 過期文章提醒
- [x] 多種分享系統AddThis/Sharejs/Addtoany
- [X] 多種評論系統Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo
- [X] 多種評論系統Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42
- [x] 支持雙評論部署
- [x] 多種在線聊天Chatra/Tidio/Daovoice/Gitter/Crisp
- [x] 多種分析系統
@@ -96,11 +97,17 @@ theme: butterfly
- [x] 圖片懶加載
- [x] Instantpage/Pangu/Snackbar彈窗/PWA......
## 截圖
## ✨ 贡献者
<a href="https://github.com/jerryc127/hexo-theme-butterfly/graphs/contributors">
<img src="https://contrib.rocks/image?repo=jerryc127/hexo-theme-butterfly" />
</a>
## 📷 截圖
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-1.jpg)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-2.jpg)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-3.jpg)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-4.jpg)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-1.png)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-2.png)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-2.png)

View File

@@ -1,11 +1,7 @@
# Main menu navigation (導航目錄)
# see https://butterfly.js.org/posts/4aa8abbe/#導航菜單
# --------------------------------------
# format: name: link || icon
# sub-menu
# name || icon:
# name: link || icon
menu:
# Home: / || fas fa-home
# Archives: /archives/ || fas fa-archive
@@ -17,9 +13,6 @@ menu:
# Link: /link/ || fas fa-link
# About: /about/ || fas fa-heart
# Hide the child menu items in mobile sidebar
hide_sidebar_menu_child: false
# Code Blocks (代碼相關)
# --------------------------------------
@@ -46,6 +39,7 @@ social:
# fas fa-envelope: mailto:xxxxxx@gmail.com || Email
# search (搜索)
# see https://butterfly.js.org/posts/ceeb73f/#搜索系統
# --------------------------------------
# Algolia search
@@ -57,6 +51,8 @@ algolia_search:
# Local search
local_search:
enable: false
preload: false
CDN:
# Math (數學)
# --------------------------------------
@@ -155,6 +151,7 @@ post_meta:
label: true # true or false 顯示描述性文字
# wordcount (字數統計)
# see https://butterfly.js.org/posts/ceeb73f/#字數統計
wordcount:
enable: false
post_wordcount: true
@@ -170,18 +167,25 @@ index_post_content:
method: 3
length: 500 # if you set method to 2 or 3, the length need to config
# anchor
# when you scroll in post, the URL will update according to header id.
anchor: false
# Post
# --------------------------------------
# toc (目錄)
toc:
enable: true
post: true
page: false
number: true
style_simple: false
expand: false
style_simple: false # for post
post_copyright:
enable: true
decode: false
author_href:
license: CC BY-NC-SA 4.0
license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/
@@ -220,10 +224,6 @@ photofigcaption: false
# false: disable pagination
post_pagination: 1
# anchor
# when you scroll in post, the URL will update according to header id.
anchor: false
# Displays outdated notice for a post (文章過期提醒)
noticeOutdate:
enable: false
@@ -259,10 +259,8 @@ addtoany:
comments:
# Up to two comments system, the first will be shown as default
# Choose: Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo
use:
# - Valine
# - Disqus
# Choose: Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42
use: # Valine,Disqus
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.
# If you set it to true, the comment count will be invalid
@@ -281,12 +279,8 @@ disqus:
# https://github.com/SukkaW/DisqusJS
disqusjs:
shortname:
siteName:
apikey:
api:
nocomment: # display when a blog post or an article has no comment attached
admin:
adminLabel:
option:
# livere (來必力)
# https://www.livere.com/
@@ -301,11 +295,6 @@ gitalk:
repo:
owner:
admin:
language: en # en, zh-CN, zh-TW, es-ES, fr, ru
perPage: 10 # Pagination size, with maximum 100.
distractionFreeMode: false # Facebook-like distraction free mode.
pagerDirection: last # Comment sorting direction, available values are last and first.
createIssueManually: false # Gitalk will create a corresponding github issue for your every single page automatically
option:
# valine
@@ -313,17 +302,9 @@ gitalk:
valine:
appId: # leancloud application app id
appKey: # leancloud application app key
pageSize: 10 # comment list page size
avatar: monsterid # gravatar style https://valine.js.org/#/avatar
lang: en # i18n: zh-CN/zh-TW/en/ja
placeholder: Please leave your footprints # valine comment input placeholder (like: Please leave your footprints)
guest_info: nick,mail,link # valine comment header info (nick/mail/link)
recordIP: false # Record reviewer IP
serverURLs: # This configuration is suitable for domestic custom domain name users, overseas version will be automatically detected (no need to manually fill in)
bg: # valine background
emojiCDN: # emoji CDN
enableQQ: false # enable the Nickname box to automatically get QQ Nickname and QQ Avatar
requiredFields: nick,mail # required fields (nick/mail)
visitor: false
option:
@@ -331,10 +312,8 @@ valine:
# https://waline.js.org/
waline:
serverURL: # Waline server address url
avatar: monsterid # gravatar style https://zh-tw.gravatar.com/site/implement/images/#default-image
avatarCDN: # Gravatar CDN baseURL
bg: # waline background
visitor: false
pageview: false
option:
# utterances
@@ -364,6 +343,24 @@ twikoo:
visitor: false
option:
# Giscus
# https://giscus.app/
giscus:
repo:
repo_id:
category_id:
theme:
light: light
dark: dark
option:
# Remark42
# https://remark42.com/docs/configuration/frontend/
remark42:
host: # Your Host URL
siteId: # Your Site ID
option:
# Chat Services
# --------------------------------------
@@ -424,10 +421,6 @@ baidu_analytics:
# https://analytics.google.com/analytics/web/
google_analytics:
# Tencent Analytics ID
# https://mta.qq.com
tencent_analytics:
# CNZZ Analytics
# https://www.umeng.com/
cnzz_analytics:
@@ -486,6 +479,9 @@ site_verification:
# toc_color: "#00c4b6"
# blockquote_padding_color: "#49b1f5"
# blockquote_background_color: "#49b1f5"
# scrollbar_color: "#49b1f5"
# meta_theme_color_light: "ffffff"
# meta_theme_color_dark: "#0d0d0d"
# The top_img settings of home page
# default: top img - full screen, site info - middle (默認top_img全屏site_info在中間)
@@ -580,8 +576,8 @@ display_mode: light
beautify:
enable: false
field: post # site/post
title-prefix-icon: '\f0c1'
title-prefix-icon-color: '#F47466'
title-prefix-icon: # '\f0c1'
title-prefix-icon-color: # '#F47466'
# Global font settings
# Don't modify the following settings unless you know how they work (非必要不要修改)
@@ -610,18 +606,14 @@ subtitle:
effect: true
# loop (循環打字)
loop: true
# source調用第三方服務
# source 調用第三方服務
# source: false 關閉調用
# source: 1 調用搏天api的隨機語錄簡體
# source: 2 調用一言網的一句話(簡體)
# source: 3 調用一句網(簡體)
# source: 4 調用今日詩詞(簡體)
# source: 1 調用一言網的一句話(簡體) https://hitokoto.cn/
# source: 2 調用一句網(簡體) http://yijuzhan.com/
# source: 3 調用今日詩詞(簡體) https://www.jinrishici.com/
# subtitle 會先顯示 source , 再顯示 sub 的內容
source: false
# 如果有英文逗號' , ',請使用轉義字元 &#44;
# 如果有英文雙引號' " ',請使用轉義字元 &quot;
# 開頭不允許轉義字元,如需要,請把整個句子用雙引號包住
# 如果關閉打字效果subtitle只會顯示sub的第一行文字
# 如果關閉打字效果subtitle 只會顯示 sub 的第一行文字
sub:
# Loading Animation (加載動畫)
@@ -636,6 +628,10 @@ aside:
button: true
mobile: true # display on mobile
position: right # left or right
display:
archive: true
tag: true
category: true
card_author:
enable: true
description:
@@ -699,9 +695,6 @@ newest_comments:
# Bottom right button (右下角按鈕)
# --------------------------------------
# Change font size
change_font_size: false
# Conversion between Traditional and Simplified Chinese (簡繁轉換)
translate:
enable: false
@@ -730,6 +723,14 @@ darkmode:
# autoChangeMode: false
autoChangeMode: false
# Don't modify the following settings unless you know how they work (非必要請不要修改 )
# Choose: readmode,translate,darkmode,hideAside,toc,chat,comment
# Don't repeat 不要重複
rightside_item_order:
enable: false
hide: # readmode,translate,darkmode,hideAside
show: # toc,chat,comment
# Lightbox (圖片大圖查看模式)
# --------------------------------------
# You can only choose one, or neither (只能選擇一個 或者 兩個都不選)
@@ -750,7 +751,9 @@ fancybox: true
mermaid:
enable: false
# built-in themes: default/forest/dark/neutral
theme: default
theme:
light: default
dark: dark
# Note (Bootstrap Callout)
note:
@@ -791,7 +794,7 @@ snackbar:
enable: false
position: bottom-left
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/
# prefetch (預加載)
@@ -842,87 +845,70 @@ inject:
# Don't modify the following settings unless you know how they work
# 非必要請不要修改
CDN:
# main
main_css: /css/index.css
jquery: https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js
main: /js/main.js
utils: /js/utils.js
# The CDN provider of internal scripts (主題內部 js 的 cdn 配置)
# option: local/jsdelivr/unpkg/cdnjs/custom
# Dev version can only choose. ( dev版的主題只能設置為 local )
internal_provider: local
# pjax
pjax: https://cdn.jsdelivr.net/npm/pjax/pjax.min.js
# The CDN provider of third party scripts (第三方 js 的 cdn 配置)
# option: local/jsdelivr/unpkg/cdnjs/custom
# when set it to local, you need to install hexo-butterfly-extjs
third_party_provider: jsdelivr
# 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
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
# Add version number to CDN, true or false
version: false
# 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
# Custom format
# For example: https://cdn.staticfile.org/${cdnjs_name}/${version}/${min_cdnjs_file}
custom_format:
# search
local_search: /js/search/local-search.js
algolia_js: /js/search/algolia.js
algolia_search: https://cdn.jsdelivr.net/npm/instantsearch.js@2.10.5/dist/instantsearch.min.js
algolia_search_css: https://cdn.jsdelivr.net/npm/instantsearch.js@2.10.5/dist/instantsearch.min.css
# 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: https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css
fancybox: https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.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
# justifiedGallery
justifiedGallery_js: https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js
justifiedGallery_css: https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.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
option:
# main_css:
# main:
# utils:
# translate:
# local_search:
# algolia_js:
# algolia_search_v4:
# instantsearch_v4:
# pjax:
# gitalk:
# gitalk_css:
# blueimp_md5:
# valine:
# disqusjs:
# disqusjs_css:
# twikoo:
# waline_js:
# waline_css:
# sharejs:
# sharejs_css:
# mathjax:
# katex:
# katex_copytex:
# mermaid:
# canvas_ribbon:
# canvas_fluttering_ribbon:
# canvas_nest:
# lazyload:
# instantpage:
# typed:
# pangu:
# fancybox_css_v4:
# fancybox_v4:
# medium_zoom:
# snackbar_css:
# snackbar:
# activate_power_mode:
# fireworks:
# click_heart:
# ClickShowText:
# fontawesomeV6:
# flickr_justified_gallery_js:
# flickr_justified_gallery_css:
# aplayer_css:
# aplayer_js:
# meting_js:
# prismjs_js:
# prismjs_lineNumber_js:
# prismjs_autoloader:

View File

@@ -34,16 +34,17 @@ post:
recommend: Related Articles
edit: Edited on
search: Search
algolia_search:
input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}."
hits_stats: '${hits} results found in ${time} ms'
search:
title: Search
load_data: Loading the Database
algolia_search:
input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}."
hits_stats: '${hits} results found in ${time} ms'
local_search:
label: Local search
input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}"
local_search:
input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}"
pagination:
prev: Previous Post
@@ -94,8 +95,6 @@ share: Share
rightside:
readmode_title: Read Mode
font_plus_title: Increase font size
font_minus_title: Decrease font size
translate_title: Toggle Between Traditional Chinese And Simplified Chinese
night_mode_title: Toggle Between Light And Dark Mode
back_to_top: Back To Top
@@ -103,6 +102,7 @@ rightside:
scroll_to_comment: Scroll To Comments
setting: Setting
aside: Toggle between single-column and double-column
chat: Chat
copy_copyright:
author: Author
@@ -118,6 +118,4 @@ Snackbar:
loading: Loading...
error404:
error_title: Page not found
back_button: Go back home
error404: Page not found

View File

@@ -34,16 +34,17 @@ post:
recommend: Related Articles
edit: Edited on
search: Search
algolia_search:
input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}."
hits_stats: '${hits} results found in ${time} ms'
search:
title: Search
load_data: Loading the Database
algolia_search:
input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}."
hits_stats: '${hits} results found in ${time} ms'
local_search:
label: Local search
input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}"
local_search:
input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}"
pagination:
prev: Previous Post
@@ -94,8 +95,6 @@ share: Share
rightside:
readmode_title: Read Mode
font_plus_title: Increase font size
font_minus_title: Decrease font size
translate_title: Switch Between Traditional Chinese And Simplified Chinese
night_mode_title: Switch Between Light And Dark Mode
back_to_top: Back To Top
@@ -103,6 +102,7 @@ rightside:
scroll_to_comment: Scroll To Comments
setting: Setting
aside: Toggle between single-column and double-column
chat: Chat
copy_copyright:
author: Author
@@ -118,6 +118,4 @@ Snackbar:
loading: Loading...
error404:
error_title: Page not found
back_button: Go back home
error404: Page not found

View File

@@ -35,16 +35,17 @@ post:
recommend: 相关推荐
edit: 编辑
search: 搜索
algolia_search:
input_placeholder: 搜索文章
hits_empty: '找不到您查询的内容:${query}'
hits_stats: '找到 ${hits} 条结果,用时 ${time} 毫秒'
search:
title: 搜索
load_data: 数据库加载中
algolia_search:
input_placeholder: 搜索文章
hits_empty: '找不到您查询的内容:${query}'
hits_stats: '找到 ${hits} 条结果,用时 ${time} 毫秒'
local_search:
label: 本地搜索
input_placeholder: 搜索文章
hits_empty: '找不到您查询的内容:${query}'
local_search:
input_placeholder: 搜索文章
hits_empty: '找不到您查询的内容:${query}'
pagination:
prev: 上一篇
@@ -95,8 +96,6 @@ share: 分享
rightside:
readmode_title: 阅读模式
font_plus_title: 放大字体
font_minus_title: 缩小字体
translate_title: 简繁转换
night_mode_title: 浅色和深色模式转换
back_to_top: 回到顶部
@@ -104,6 +103,7 @@ rightside:
scroll_to_comment: 直达评论
setting: 设置
aside: 单栏和双栏切换
chat: 聊天
copy_copyright:
author: 作者
@@ -119,6 +119,4 @@ Snackbar:
loading: 加载中...
error404:
error_title: 页面没有找到
back_button: 回到主页
error404: 页面没有找到

View File

@@ -35,16 +35,17 @@ post:
recommend: 相關推薦
edit: 編輯
search: 搜尋
algolia_search:
input_placeholder: 搜尋文章
hits_empty: '找不到您查詢的內容:${query}'
hits_stats: '找到 ${hits} 條結果,用時 ${time} 毫秒'
search:
title: 搜尋
load_data: 資料庫載入中
algolia_search:
input_placeholder: 搜尋文章
hits_empty: '找不到您查詢的內容:${query}'
hits_stats: '找到 ${hits} 條結果,用時 ${time} 毫秒'
local_search:
label: 本地搜尋
input_placeholder: 搜尋文章
hits_empty: '找不到您查詢的內容:${query}'
local_search:
input_placeholder: 搜尋文章
hits_empty: '找不到您查詢的內容:${query}'
pagination:
prev: 上一篇
@@ -65,7 +66,7 @@ aside:
headline: 網站資訊
article_name: 文章數目
runtime:
name: 行時間
name: 行時間
unit:
last_push_date:
name: 最後更新時間
@@ -80,7 +81,7 @@ aside:
zero: 沒有評論
image: 圖片
link: 連結
code:
code: 程式
card_toc: 目錄
date_suffix:
@@ -95,8 +96,6 @@ share: 分享
rightside:
readmode_title: 閱讀模式
font_plus_title: 放大字型
font_minus_title: 縮小字型
translate_title: 簡繁轉換
night_mode_title: 淺色和深色模式轉換
back_to_top: 回到頂部
@@ -104,6 +103,7 @@ rightside:
scroll_to_comment: 直達評論
setting: 設定
aside: 單欄和雙欄切換
chat: 聊天
copy_copyright:
author: 作者
@@ -119,6 +119,4 @@ Snackbar:
loading: 載入中...
error404:
error_title: 頁面沒有找到
back_button: 回到主頁
error404: 頁面沒有找到

View File

@@ -3,6 +3,7 @@ extends includes/layout.pug
block content
include ./includes/mixins/article-sort.pug
#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)
include includes/pagination.pug

View File

@@ -3,9 +3,9 @@ extends includes/layout.pug
block content
if theme.category_ui == 'index'
include ./includes/mixins/post-ui.pug
#recent-posts.recent-posts.category_ui
#recent-posts.recent-posts.category_ui
+postUI
include includes/pagination.pug
include includes/pagination.pug
else
include ./includes/mixins/article-sort.pug
#category

View File

@@ -1,17 +1,12 @@
- var top_img = theme.error_404.background || theme.default_top_img
- var bg_img = `background-image: url('${url_for(top_img)}')`
- var top_img_404 = theme.error_404.background || theme.default_top_img
#body-wrap.error404
div(style='display: none')
include ./header/index.pug
include ./header/index.pug
#error-wrap
.error-content
.error-img(style=bg_img)
.error-img
img(src=url_for(top_img_404) alt='Page not found')
.error-info
h1.error_title= '404'
.error_subtitle= theme.error_404.subtitle
a.button--animated(href=config.root)
i.fas.fa-rocket
= _p('error404.back_button')
.error_subtitle= theme.error_404.subtitle || _p('error404')

View File

@@ -1,38 +1,42 @@
div
script(src=url_for(theme.CDN.utils))
script(src=url_for(theme.CDN.main))
script(src=url_for(theme.asset.utils))
script(src=url_for(theme.asset.main))
if theme.translate.enable
script(src=url_for(theme.CDN.translate))
script(src=url_for(theme.asset.translate))
if theme.medium_zoom
script(src=url_for(theme.CDN.medium_zoom))
script(src=url_for(theme.asset.medium_zoom))
else if theme.fancybox
script(src=url_for(theme.asset.fancybox_v4))
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
script(src=url_for(theme.CDN.lazyload))
script(src=url_for(theme.asset.lazyload))
if theme.snackbar.enable
script(src=url_for(theme.CDN.snackbar))
script(src=url_for(theme.asset.snackbar))
if theme.pangu.enable
!=partial('includes/third-party/pangu.pug', {}, {cache: true})
!= partial("includes/third-party/pangu.pug", {}, { cache: true })
//- search
if theme.algolia_search.enable
script(src=url_for(theme.CDN.algolia_js))
script(src=url_for(theme.asset.algolia_search_v4))
script(src=url_for(theme.asset.instantsearch_v4))
script(src=url_for(theme.asset.algolia_js))
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
!=partial('includes/loading/loading-js', {}, {cache: true})
!= partial("includes/loading/loading-js", {}, { cache: true })
.js-pjax
if needLoadCountJs
!=partial('includes/third-party/card-post-count/index', {}, {cache: true})
!= partial("includes/third-party/card-post-count/index", {}, { cache: true })
if loadSubJs
include ./third-party/subtitle.pug
@@ -41,20 +45,20 @@ div
if commentsJsLoad
include ./third-party/comments/js.pug
!=partial('includes/third-party/prismjs', {}, {cache: true})
!= partial("includes/third-party/prismjs", {}, { cache: true })
if theme.aside.enable && theme.newest_comments.enable
if theme.pjax.enable
!=partial('includes/third-party/newest-comments/index', {}, {cache: true})
!= partial("includes/third-party/newest-comments/index", {}, { cache: true })
else if (!is_post() && page.aside !== false)
!=partial('includes/third-party/newest-comments/index', {}, {cache: true})
!= partial("includes/third-party/newest-comments/index", {}, { cache: true })
!=fragment_cache('injectBottom', function(){return injectHtml(theme.inject.bottom)})
!= fragment_cache('injectBottom', function(){return injectHtml(theme.inject.bottom)})
!=partial('includes/third-party/effect', {}, {cache: true})
!= partial("includes/third-party/effect", {}, { cache: true })
!= partial("includes/third-party/chat/index", {}, { cache: true })
!=partial('includes/third-party/chat/index', {}, {cache: true})
if theme.aplayerInject && theme.aplayerInject.enable
if theme.pjax.enable || theme.aplayerInject.per_page
include ./third-party/aplayer.pug
@@ -62,7 +66,7 @@ div
include ./third-party/aplayer.pug
if theme.pjax.enable
!=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
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

@@ -4,7 +4,7 @@
- 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.error_title')
- else if (is_current('/404.html', [strict])) pageTitle = _p('error404')
- else pageTitle = page.title || config.title || ''
- var isSubtitle = config.subtitle ? ' - ' + config.subtitle : ''
@@ -16,11 +16,13 @@
- else pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords
- var pageAuthor = config.email ? config.author + ',' + config.email : 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(http-equiv="X-UA-Compatible" content="IE=edge")
meta(name="viewport" content="width=device-width,initial-scale=1")
meta(name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no")
title= tabTitle
if pageKeywords
meta(name="keywords" content=pageKeywords)
@@ -46,15 +48,14 @@ if (theme.pwa && theme.pwa.enable)
!=partial('includes/head/pwa', {}, {cache: true})
//- main css
link(rel='stylesheet', href=url_for(theme.CDN.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.main_css))
link(rel='stylesheet', href=url_for(theme.asset.fontawesomeV6) media="print" onload="this.media='all'")
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.algolia_search.enable
link(rel='stylesheet' href=url_for(theme.CDN.algolia_search_css) media="print" onload="this.media='all'")
script(src=url_for(theme.CDN.algolia_search) defer)
if theme.fancybox
link(rel='stylesheet' href=url_for(theme.asset.fancybox_css_v4) media="print" onload="this.media='all'")
//- google_adsense
!=partial('includes/head/google_adsense', {}, {cache: true})

View File

@@ -16,18 +16,6 @@ if theme.google_analytics
gtag('js', new Date());
gtag('config', '!{theme.google_analytics}');
if theme.tencent_analytics
script.
var _mtac = {};
(function() {
var mta = document.createElement("script");
mta.src = "//pingjs.qq.com/h5/stats.js?v2.0.4";
mta.setAttribute("name", "MTAH5");
mta.setAttribute("sid", "!{theme.tencent_analytics}");
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(mta, s);
})();
if theme.cnzz_analytics
script(async data-pjax src=`https://s4.cnzz.com/z_stat.php?id=${theme.cnzz_analytics}&web_id=${theme.cnzz_analytics}`)

View File

@@ -9,9 +9,9 @@
hits: theme.algolia_search.hits,
// search languages
languages: {
input_placeholder: _p("algolia_search.input_placeholder"),
hits_empty: _p("algolia_search.hits_empty"),
hits_stats: _p("algolia_search.hits_stats")
input_placeholder: _p("search.algolia_search.input_placeholder"),
hits_empty: _p("search.algolia_search.hits_empty"),
hits_stats: _p("search.algolia_search.hits_stats"),
}
})
}
@@ -19,10 +19,11 @@
let localSearch = 'undefined';
if (theme.local_search && theme.local_search.enable) {
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: {
// search languages
hits_empty: _p("local_search.hits_empty")
hits_empty: _p("search.local_search.hits_empty"),
}
})
}
@@ -112,17 +113,12 @@ script.
lightbox: '!{ theme.medium_zoom ? "mediumZoom" : (theme.fancybox ? "fancybox" : "null" )}',
Snackbar: !{Snackbar},
source: {
jQuery: '!{url_for(theme.CDN.jquery)}',
justifiedGallery: {
js: '!{url_for(theme.CDN.justifiedGallery_js)}',
css: '!{url_for(theme.CDN.justifiedGallery_css)}'
},
fancybox: {
js: '!{url_for(theme.CDN.fancybox)}',
css: '!{url_for(theme.CDN.fancybox_css)}'
js: '!{url_for(theme.asset.flickr_justified_gallery_js)}',
css: '!{url_for(theme.asset.flickr_justified_gallery_css)}'
}
},
isPhotoFigcaption: !{theme.photofigcaption},
islazyload: !{theme.lazyload.enable},
isanchor: !{theme.anchor}
isAnchor: !{theme.anchor}
}

View File

@@ -1,13 +1,22 @@
-
const titleVal = pageTitle.replace(/'/ig,"\\'")
let isHighlightShrink
if (theme.highlight_shrink == 'none') isHighlightShrink = 'undefined'
else if (page.highlight_shrink === true || page.highlight_shrink === false) isHighlightShrink = page.highlight_shrink
else isHighlightShrink = theme.highlight_shrink
var pageToc = page.toc === true || page.toc === false ? page.toc : theme.toc.enable
var showToc = is_post() && theme.aside.enable && pageToc && (toc(page.content) !== '' || page.encrypt == true )
let titleVal = pageTitle.replace(/'/ig,"\\'")
var showToc = false
if (theme.aside.enable && page.aside !== false) {
let tocEnable = false
if (is_post()) {
if (theme.toc.post) tocEnable = true
} else if (is_page()) {
if (theme.toc.page) tocEnable = true
}
const pageToc = page.toc === true || page.toc === false ? page.toc : tocEnable
showToc = pageToc && (toc(page.content) !== '' || page.encrypt == true )
}
-
script#config-diff.

View File

@@ -6,9 +6,6 @@ if theme.google_analytics
if theme.baidu_analytics
link(rel="preconnect" href="//hm.baidu.com")
if theme.tencent_analytics
link(rel="preconnect" href="//pingjs.qq.com")
if theme.cnzz_analytics
link(rel="preconnect" href="//s4.cnzz.com")

View File

@@ -19,7 +19,7 @@ if !theme.disable_top_img && page.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 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 = is_archive() ? findArchivesTitle(page, theme.menu, date) : page.title || page.tag || page.category || config.title
- var isHomeClass = is_home() ? 'full_page' : 'not-home-page'
- is_post() ? isHomeClass = 'post-bg' : isHomeClass
else

View File

@@ -1,26 +1,27 @@
if theme.menu
//- for mobile sidebar
- let sidebarChildHide = theme.hide_sidebar_menu_child ? 'hide' : ''
.menus_items
each value, label in theme.menu
if typeof value !== 'object'
.menus_item
a.site-page(href=url_for(trim(value.split('||')[0])))
if value.split('||')[1]
i.fa-fw(class=trim(value.split('||')[1]))
- const valueArray = value.split('||')
a.site-page(href=url_for(trim(valueArray[0])))
if valueArray[1]
i.fa-fw(class=trim(valueArray[1]))
span=' '+label
else
.menus_item
a.site-page(href='javascript:void(0);')
if label.split('||')[1]
i.fa-fw(class=trim(label.split('||')[1]))
span=' '+ trim(label.split('||')[0])
i.fas.fa-chevron-down.expand(class=sidebarChildHide)
- const labelArray = label.split('||')
- const hideClass = labelArray[2] && trim(labelArray[2]) === 'hide' ? 'hide' : ''
a.site-page.group(class=`${hideClass}` href='javascript:void(0);')
if labelArray[1]
i.fa-fw(class=trim(labelArray[1]))
span=' '+ trim(labelArray[0])
i.fas.fa-chevron-down
ul.menus_item_child
each val,lab in value
- const valArray = val.split('||')
li
a.site-page.child(href=url_for(trim(val.split('||')[0])))
if val.split('||')[1]
i.fa-fw(class=trim(val.split('||')[1]))
a.site-page.child(href=url_for(trim(valArray[0])))
if valArray[1]
i.fa-fw(class=trim(valArray[1]))
span=' '+ lab

View File

@@ -7,7 +7,7 @@ nav#nav
#search-button
a.site-page.social-icon.search
i.fas.fa-search.fa-fw
span=' '+_p('search')
span=' '+_p('search.title')
!=partial('includes/header/menu_item', {}, {cache: true})
#toggle-menu

View File

@@ -21,9 +21,9 @@
- let data_type_update = theme.post_meta.post.date_type === 'updated'
- let date_type = data_type_update ? 'updated' : 'date'
- let date_icon = data_type_update ? 'fas fa-history' :'far fa-calendar-alt'
- let data_info = data_type_update ? _p('post.updated') : _p('post.created')
- let date_title = data_type_update ? _p('post.updated') : _p('post.created')
i.fa-fw.post-meta-icon(class=date_icon)
span.post-meta-label= data_info
span.post-meta-label= date_title
time(datetime=date_xml(page[date_type]) title=date_title + ' ' + full_date(page[date_type]))=date(page[date_type], config.date_format)
if (theme.post_meta.post.categories && page.categories.data.length > 0)
span.post-meta-categories
@@ -61,16 +61,28 @@
if block
block
if theme.busuanzi.page_pv
+pvBlock('','post-meta-pv-cv','')
span#busuanzi_value_page_pv
else if comments.use && !comments.lazyload
if (comments.use.includes('Valine') && theme.valine.visitor) || (comments.use.includes('Waline') && theme.waline.visitor)
- const commentUse = comments.use
if commentUse && !comments.lazyload
if commentUse[0] === 'Valine' && theme.valine.visitor
+pvBlock(url_for(page.path),'leancloud_visitors',page.title)
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('','','')
span#twikoo_visitors
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
- var whichCount = comments.use[0]
@@ -85,27 +97,42 @@
case whichCount
when 'Disqus'
when 'Disqusjs'
+countBlock
span.disqus-comment-count
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'
+countBlock
a(href=url_for(page.path) + '#post-comment' itemprop="discussionUrl")
span.valine-comment-count(data-xid=url_for(page.path) itemprop="commentCount")
i.fa-solid.fa-spinner.fa-spin
when 'Waline'
+countBlock
a(href=url_for(page.path) + '#post-comment')
span.waline-comment-count(id=url_for(page.path))
span.waline-comment-count(data-path=url_for(page.path))
i.fa-solid.fa-spinner.fa-spin
when 'Gitalk'
+countBlock
a(href=url_for(page.path) + '#post-comment')
span.gitalk-comment-count
i.fa-solid.fa-spinner.fa-spin
when 'Twikoo'
+countBlock
a(href=url_for(page.path) + '#post-comment')
span#twikoo-count
i.fa-solid.fa-spinner.fa-spin
when 'Facebook Comments'
+countBlock
a(href=url_for(page.path) + '#post-comment')
span.fb-comments-count(data-href=urlNoIndex())
span.fb-comments-count(data-href=urlNoIndex())
i.fa-solid.fa-spinner.fa-spin
when 'Remark42'
+countBlock
a(href=url_for(page.path) + '#post-comment')
span.remark42__counter(data-url=urlNoIndex())
i.fa-solid.fa-spinner.fa-spin

View File

@@ -1,4 +1,5 @@
- 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 pageType = is_post() ? 'post' : 'page'

View File

@@ -1,14 +1,19 @@
mixin postUI(posts)
each article , index in page.posts.data
.recent-post-item
- let link = article.link || article.path
- let title = article.title || _p('no_title')
- let leftOrRight = index%2 == 0 ? 'left_radius' : 'right_radius'
- let post_cover = article.cover
- let no_cover = article.cover === false || !theme.cover.index_enable ? 'no-cover' : ''
-
let link = article.link || article.path
let title = article.title || _p('no_title')
const position = theme.cover.position
let leftOrRight = position === 'both'
? index%2 == 0 ? 'left' : 'right'
: position === 'left' ? 'left' : 'right'
let post_cover = article.cover
let no_cover = article.cover === false || !theme.cover.index_enable ? 'no-cover' : ''
-
if post_cover && theme.cover.index_enable
.post_cover(class=leftOrRight)
a(href=url_for(link) title=title)
a(href=url_for(link) title=title)
img.post_bg(src=url_for(post_cover) onerror=`this.onerror=null;this.src='`+ url_for(theme.error_img.post_page) + `'` alt=title)
.recent-post-info(class=no_cover)
a.article-title(href=url_for(link) title=title)= title
@@ -17,14 +22,14 @@ mixin postUI(posts)
span.article-meta
i.fas.fa-thumbtack.sticky
span.sticky= _p('sticky')
span.article-meta__separator |
span.article-meta-separator |
if (theme.post_meta.page.date_type)
span.post-meta-date
if (theme.post_meta.page.date_type === 'both')
if (theme.post_meta.page.date_type === 'both')
i.far.fa-calendar-alt
span.article-meta-label=_p('post.created')
time.post-meta-date-created(datetime=date_xml(article.date) title=_p('post.created') + ' ' + full_date(article.date))=date(article.date, config.date_format)
span.article-meta__separator |
span.article-meta-separator |
i.fas.fa-history
span.article-meta-label=_p('post.updated')
time.post-meta-date-updated(datetime=date_xml(article.updated) title=_p('post.updated') + ' ' + full_date(article.updated))=date(article.updated, config.date_format)
@@ -38,25 +43,25 @@ mixin postUI(posts)
time(datetime=date_xml(article[date_type]) title=date_title + ' ' + full_date(article[date_type]))=date(article[date_type], config.date_format)
if (theme.post_meta.page.categories && article.categories.data.length > 0)
span.article-meta
span.article-meta__separator |
span.article-meta-separator |
i.fas.fa-inbox
each item, index in article.categories.data
a(href=url_for(item.path)).article-meta__categories #[=item.name]
if (index < article.categories.data.length - 1)
i.fas.fa-angle-right
i.fas.fa-angle-right.article-meta-link
if (theme.post_meta.page.tags && article.tags.data.length > 0)
span.article-meta.tags
span.article-meta__separator |
span.article-meta-separator |
i.fas.fa-tag
each item, index in article.tags.data
a(href=url_for(item.path)).article-meta__tags #[=item.name]
if (index < article.tags.data.length - 1)
span.article-meta__link #[='•']
span.article-meta-link #[='•']
mixin countBlockInIndex
- needLoadCountJs = true
span.article-meta
span.article-meta__separator |
span.article-meta-separator |
i.fas.fa-comments
if block
block
@@ -65,24 +70,38 @@ mixin postUI(posts)
if theme.comments.card_post_count
case theme.comments.use[0]
when 'Disqus'
when 'Disqusjs'
+countBlockInIndex
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'
+countBlockInIndex
a(href=url_for(link) + '#post-comment' itemprop="discussionUrl")
span.valine-comment-count(data-xid=url_for(link) itemprop="commentCount")
a(href=url_for(link) + '#post-comment')
span.valine-comment-count(data-xid=url_for(link))
i.fa-solid.fa-spinner.fa-spin
when 'Waline'
+countBlockInIndex
a(href=url_for(link) + '#post-comment')
span.waline-comment-count(id=url_for(link))
i.fa-solid.fa-spinner.fa-spin
when 'Twikoo'
+countBlockInIndex
a.twikoo-count(href=url_for(link) + '#post-comment')
i.fa-solid.fa-spinner.fa-spin
when 'Facebook Comments'
+countBlockInIndex
a(href=url_for(link) + '#post-comment')
span.fb-comments-count(data-href=urlNoIndex(article.permalink))
i.fa-solid.fa-spinner.fa-spin
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
//- Display the article introduction on homepage
case theme.index_post_content.method

View File

@@ -1,5 +1 @@
.category-lists
.category-title.is-center= _p('page.category')
| -
span.category-amount= site.categories.length
div!= list_categories()
.category-lists!= list_categories()

View File

@@ -1,4 +1,2 @@
#article-container
if top_img === false
h1.page-title= page.title
!= page.content

View File

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

View File

@@ -1,5 +1,2 @@
.tag-cloud-title.is-center= _p('page.tag')
| -
span.tag-cloud-amount= site.tags.length
.tag-cloud-list.is-center
!=cloudTags({source: site.tags, minfontsize: 1.2, maxfontsize: 2.1, limit: 0, unit: 'em'})

View File

@@ -1,8 +1,8 @@
if theme.post_copyright.enable && page.copyright !== false
- let author = page.copyright_author ? page.copyright_author : config.author
- let authorHref = page.copyright_author_href ? page.copyright_author_href : `mailto:${config.email}`
- let url = page.copyright_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 author = page.copyright_author || config.author
- let authorHref = page.copyright_author_href || theme.post_copyright.author_href || config.url
- let url = page.copyright_url || page.permalink
- 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__author
span.post-copyright-meta= _p('post.copyright.author') + ": "

View File

@@ -1,5 +1,5 @@
.post-reward
.reward-button.button--animated
.reward-button
i.fas.fa-qrcode
= ' ' + _p('donate')
.reward-main

View File

@@ -1,38 +1,60 @@
- const { readmode, translate, darkmode, aside, chat_btn } = theme
mixin rightsideItem(array)
each item in array
case item
when 'readmode'
if is_post() && readmode
button#readmode(type="button" title=_p('rightside.readmode_title'))
i.fas.fa-book-open
when 'translate'
if translate.enable
button#translateLink(type="button" title=_p('rightside.translate_title'))= translate.default
when 'darkmode'
if darkmode.enable && darkmode.button
button#darkmode(type="button" title=_p('rightside.night_mode_title'))
i.fas.fa-adjust
when 'hideAside'
if aside.enable && aside.button && page.aside !== false
button#hide-aside-btn(type="button" title=_p('rightside.aside'))
i.fas.fa-arrows-alt-h
when 'toc'
if showToc
button#mobile-toc-button.close(type="button" title=_p("rightside.toc"))
i.fas.fa-list-ul
when 'chat'
if chat_btn
button#chat_btn(type="button" title=_p("rightside.chat"))
i.fas.fa-sms
when 'comment'
if commentsJsLoad
a#to_comment(href="#post-comment" title=_p("rightside.scroll_to_comment"))
i.fas.fa-comments
#rightside
- const { enable, hide, show } = theme.rightside_item_order
- const hideArray = enable ? hide && hide.split(',') : ['readmode','translate','darkmode','hideAside']
- const showArray = enable ? show && show.split(',') : ['toc','chat','comment']
#rightside-config-hide
if is_post() && theme.readmode
button#readmode(type="button" title=_p('rightside.readmode_title'))
i.fas.fa-book-open
if theme.change_font_size
button#font-plus(type="button" title=_p('rightside.font_plus_title'))
i.fas.fa-plus
button#font-minus(type="button" title=_p('rightside.font_minus_title'))
i.fas.fa-minus
if theme.translate.enable
button#translateLink(type="button" title=_p('rightside.translate_title'))= theme.translate.default
if theme.darkmode.enable && theme.darkmode.button
button#darkmode(type="button" title=_p('rightside.night_mode_title'))
i.fas.fa-adjust
if theme.aside.enable && theme.aside.button && page.aside !== false
button#hide-aside-btn(type="button" title=_p('rightside.aside'))
i.fas.fa-arrows-alt-h
if hideArray
+rightsideItem(hideArray)
#rightside-config-show
if is_post()
if (theme.readmode || theme.translate.enable || (theme.darkmode.enable && theme.darkmode.button) || theme.change_font_size)
if enable
if hide
button#rightside_config(type="button" title=_p("rightside.setting"))
i.fas.fa-cog.fa-spin
else
if is_post()
if (readmode || translate.enable || (darkmode.enable && darkmode.button))
button#rightside_config(type="button" title=_p("rightside.setting"))
i.fas.fa-cog.fa-spin
else if translate.enable || (darkmode.enable && darkmode.button)
button#rightside_config(type="button" title=_p("rightside.setting"))
i.fas.fa-cog.fa-spin
if showToc
button#mobile-toc-button.close(type="button" title=_p("rightside.toc"))
i.fas.fa-list-ul
else if theme.translate.enable || (theme.darkmode.enable && theme.darkmode.button) || theme.change_font_size
button#rightside_config(type="button" title=_p("rightside.setting"))
i.fas.fa-cog.fa-spin
if theme.chat_btn
button#chat_btn(type="button" title=_p("rightside.chat_btn"))
i.fas.fa-sms
if commentsJsLoad
a#to_comment(href="#post-comment" title=_p("rightside.scroll_to_comment"))
i.fas.fa-comments
if showArray
+rightsideItem(showArray)
button#go-up(type="button" title=_p("rightside.back_to_top"))
i.fas.fa-arrow-up

View File

@@ -3,26 +3,16 @@
#sidebar-menus
.avatar-img.is-center
img(src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar")
.site-data
if site.posts.length
.data-item.is-center
.data-item-link
a(href=url_for(config.archive_dir) + '/')
.headline= _p('aside.articles')
.length-num= site.posts.length
.sidebar-site-data.site-data.is-center
a(href=url_for(config.archive_dir) + '/')
.headline= _p('aside.articles')
.length-num= site.posts.length
a(href=url_for(config.tag_dir) + '/' )
.headline= _p('aside.tags')
.length-num= site.tags.length
a(href=url_for(config.category_dir) + '/')
.headline= _p('aside.categories')
.length-num= site.categories.length
if site.tags.length
.data-item.is-center
.data-item-link
a(href=url_for(config.tag_dir) + '/' )
.headline= _p('aside.tags')
.length-num= site.tags.length
if site.categories.length
.data-item.is-center
.data-item-link
a(href=url_for(config.category_dir) + '/')
.headline= _p('aside.categories')
.length-num= site.categories.length
hr
!=partial('includes/header/menu_item', {}, {cache: true})

View File

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

View File

@@ -9,4 +9,6 @@ case theme.comments.use[0]
when 'Waline'
include ./waline.pug
when 'Facebook Comments'
include ./fb.pug
include ./fb.pug
when 'Remark42'
include ./remark42.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') {
runTwikoo()
} else {
getScript('!{theme.CDN.twikoo}').then(runTwikoo)
getScript('!{url_for(theme.asset.twikoo)}').then(runTwikoo)
}
}

View File

@@ -6,13 +6,14 @@ script.
el: '#vcomment',
appId: '#{theme.valine.appId}',
appKey: '#{theme.valine.appKey}',
serverURLs: '#{theme.valine.serverURLs}'
}
const valine = new Valine(initData)
}
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)

View File

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

View File

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

View File

@@ -1,4 +1,3 @@
- let disqusjsApi = theme.disqusjs.api || 'https://disqus.skk.moe/disqus/'
- let disqusjsPageTitle = page.title.replace(/'/ig,"\\'")
script.
@@ -6,38 +5,43 @@ script.
function addDisqusjsCSS () {
const ele = document.createElement('link')
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)
}
function initDisqusjs () {
window.DISQUS = null
new DisqusJS({
window.disqusjs = null
disqusjs = new DisqusJS(Object.assign({
shortname: '!{theme.disqusjs.shortname}',
siteName: '!{theme.disqusjs.siteName}',
identifier: '!{ page.path }',
identifier: '!{ url_for(page.path) }',
url: '!{ page.permalink }',
title: '!{ disqusjsPageTitle }',
api: '!{disqusjsApi}',
apikey: '!{theme.disqusjs.apikey}',
nocomment: '!{theme.disqusjs.nocomment}',
admin: '!{theme.disqusjs.admin}',
adminLabel: '!{theme.disqusjs.adminLabel}'
});
},!{JSON.stringify(theme.disqusjs.option)}))
disqusjs.render(document.getElementById('disqusjs'))
}
window.disqusReset = initDisqusjs
const themeChange = () => {
const ele = document.getElementById('disqus_thread')
if(!ele) return
disqusjs.destroy()
initDisqusjs()
}
document.getElementById('darkmode').addEventListener('click', themeChange)
if (window.disqusJsLoad) initDisqusjs()
else {
addDisqusjsCSS()
getScript('!{url_for(theme.CDN.disqusjs)}').then(initDisqusjs)
getScript('!{url_for(theme.asset.disqusjs)}').then(initDisqusjs)
window.disqusJsLoad = true
}
}
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 {

View File

@@ -7,7 +7,7 @@ script.
if (typeof FB === 'object') FB.XFBML.parse()
else {
let ele = document.createElement('script')
ele.setAttribute('src','https://connect.facebook.net/!{theme.facebook_comments.lang}/sdk.js#xfbml=1&version=v10.0')
ele.setAttribute('src','https://connect.facebook.net/!{theme.facebook_comments.lang}/sdk.js#xfbml=1&version=v13.0&appId=!{theme.facebook_comments.app_id}&autoLogAppEvents=1')
ele.setAttribute('async', 'true')
ele.setAttribute('defer', 'true')
ele.setAttribute('crossorigin', 'anonymous')

View File

@@ -0,0 +1,49 @@
- const { repo, repo_id, category_id, option } = theme.giscus
- const themes = theme.giscus.theme
script.
function loadGiscus () {
let nowTheme = document.documentElement.getAttribute('data-theme') === 'dark' ? '!{themes.dark}' : '!{themes.light}'
const config = Object.assign({
src: 'https://giscus.app/client.js',
'data-repo': '!{repo}',
'data-repo-id': '!{repo_id}',
'data-category-id': '!{category_id}',
'data-mapping': 'pathname',
'data-theme': nowTheme,
'data-reactions-enabled': '1',
crossorigin: 'anonymous',
async: true
},!{JSON.stringify(option)})
let ele = document.createElement('script')
for (let key in config) {
ele.setAttribute(key, config[key])
}
document.getElementById('giscus-wrap').insertAdjacentElement('afterbegin',ele)
}
function changeGiscusTheme () {
const theme = document.documentElement.getAttribute('data-theme') === 'dark' ? '!{themes.dark}' : '!{themes.light}'
function sendMessage(message) {
const iframe = document.querySelector('iframe.giscus-frame');
if (!iframe) return;
iframe.contentWindow.postMessage({ giscus: message }, 'https://giscus.app');
}
sendMessage({
setConfig: {
theme: theme
}
});
}
if ('!{theme.comments.use[0]}' === 'Giscus' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('giscus-wrap'), loadGiscus)
else loadGiscus()
} else {
function loadOtherComment () {
loadGiscus()
}
}

View File

@@ -2,7 +2,7 @@ script.
function addGitalkSource () {
const ele = document.createElement('link')
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)
}
@@ -15,11 +15,6 @@ script.
owner: '!{theme.gitalk.owner}',
admin: ['!{theme.gitalk.admin}'],
id: '!{md5(page.path)}',
language: '!{theme.gitalk.language}',
perPage: !{theme.gitalk.perPage},
distractionFreeMode: !{theme.gitalk.distractionFreeMode},
pagerDirection: '!{theme.gitalk.pagerDirection}',
createIssueManually: !{theme.gitalk.createIssueManually},
updateCountCallback: commentCount
},!{JSON.stringify(theme.gitalk.option)}))
@@ -29,7 +24,7 @@ script.
if (typeof Gitalk === 'function') initGitalk()
else {
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'
#vcomment.vcomment
when 'Disqusjs'
#disqus_thread
#disqusjs
when 'Livere'
#lv-container(data-id="city" data-uid=theme.livere.uid)
when 'Gitalk'
@@ -33,8 +33,12 @@ hr
#twikoo-wrap
when 'Waline'
#waline-wrap
when 'Giscus'
#giscus-wrap
when 'Facebook Comments'
.fb-comments(data-colorscheme = theme.display_mode === 'dark' ? 'dark' : 'light'
data-numposts= theme.facebook_comments.pageSize || 10
data-order-by= theme.facebook_comments.order_by || 'social'
data-width="100%")
when 'Remark42'
#remark42

View File

@@ -16,5 +16,9 @@ each name in theme.comments.use
!=partial('includes/third-party/comments/twikoo', {}, {cache: true})
when 'Waline'
!=partial('includes/third-party/comments/waline', {}, {cache: true})
when 'Giscus'
!=partial('includes/third-party/comments/giscus', {}, {cache: true})
when 'Facebook Comments'
!=partial('includes/third-party/comments/facebook_comments', {}, {cache: true})
when 'Remark42'
!=partial('includes/third-party/comments/remark42', {}, {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

@@ -1,42 +1,50 @@
- const { envId, region, option } = theme.twikoo
- const { use, lazyload, count } = theme.comments
script.
(()=>{
const $countDom = document.getElementById('twikoo-count')
const init = () => {
twikoo.init(Object.assign({
el: '#twikoo-wrap',
envId: '!{theme.twikoo.envId}',
region: '!{theme.twikoo.region}'
}, !{JSON.stringify(theme.twikoo.option)}))
envId: '!{envId}',
region: '!{region}',
onCommentLoaded: function () {
btf.loadLightbox(document.querySelectorAll('#twikoo .tk-content img:not(.tk-owo-emotion)'))
}
}, !{JSON.stringify(option)}))
}
const getCount = () => {
const countELement = document.getElementById('twikoo-count')
if(!countELement) return
twikoo.getCommentsCount({
envId: '!{theme.twikoo.envId}',
region: '!{theme.twikoo.region}',
envId: '!{envId}',
region: '!{region}',
urls: [window.location.pathname],
includeReply: false
}).then(function (res) {
$countDom.innerText = res[0].count
countELement.innerText = res[0].count
}).catch(function (err) {
console.error(err);
});
}
const loadTwikoo = (bool = false) => {
if (typeof twikoo === 'object') {
init()
bool && $countDom && setTimeout(getCount,0)
} else {
getScript('!{theme.CDN.twikoo}').then(()=> {
init()
bool && $countDom && setTimeout(getCount,0)
})
}
const runFn = () => {
init()
!{count ? 'GLOBAL_CONFIG_SITE.isPost && getCount()' : ''}
}
if ('!{theme.comments.use[0]}' === 'Twikoo' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo)
else loadTwikoo(true)
const loadTwikoo = () => {
if (typeof twikoo === 'object') {
setTimeout(runFn,0)
return
}
getScript('!{url_for(theme.asset.twikoo)}').then(runFn)
}
if ('!{use[0]}' === 'Twikoo' || !!{lazyload}) {
if (!{lazyload}) btf.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo)
else loadTwikoo()
} else {
window.loadOtherComment = () => {
loadTwikoo()

View File

@@ -2,7 +2,7 @@ script.
function loadUtterances () {
let ele = document.createElement('script')
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('issue-term', '!{theme.utterances.issue_term}')
let nowTheme = document.documentElement.getAttribute('data-theme') === 'dark' ? '#{theme.utterances.dark_theme}' : '#{theme.utterances.light_theme}'
@@ -13,13 +13,13 @@ script.
}
function utterancesTheme () {
if (document.querySelector('.utterances-frame')) {
const iframe = document.querySelector('.utterances-frame')
if (iframe) {
const theme = document.documentElement.getAttribute('data-theme') === 'dark' ? '#{theme.utterances.dark_theme}' : '#{theme.utterances.light_theme}'
const message = {
type: 'set-theme',
theme: theme
};
const iframe = document.querySelector('.utterances-frame');
iframe.contentWindow.postMessage(message, 'https://utteranc.es');
}
}

View File

@@ -9,24 +9,16 @@ script.
el: '#vcomment',
appId: '#{theme.valine.appId}',
appKey: '#{theme.valine.appKey}',
placeholder: '#{theme.valine.placeholder}',
avatar: '#{theme.valine.avatar}',
meta: '#{theme.valine.guest_info }'.split(','),
pageSize: '#{theme.valine.pageSize}',
lang: '#{theme.valine.lang}',
recordIP: #{theme.valine.recordIP},
serverURLs: '#{theme.valine.serverURLs}',
emojiCDN: '#{theme.valine.emojiCDN}',
emojiMaps: !{emojiMaps},
enableQQ: #{theme.valine.enableQQ},
path: window.location.pathname,
requiredFields: [!{theme.valine.requiredFields ? JSON.stringify(theme.valine.requiredFields).split(',') : ''}],
visitor: #{theme.valine.visitor}
}, !{JSON.stringify(theme.valine.option)}))
}
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}) {

View File

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

View File

@@ -1,19 +1,19 @@
if theme.fireworks && theme.fireworks.enable
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)
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}`)
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)
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
script(src=url_for(theme.CDN.activate_power_mode))
script(src=url_for(theme.asset.activate_power_mode))
script.
POWERMODE.colorful = !{theme.activate_power_mode.colorful};
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
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
script#click-show-text(
src= url_for(theme.CDN.ClickShowText)
src= url_for(theme.asset.ClickShowText)
data-mobile= `${theme.ClickShowText.mobile}`
data-text= theme.ClickShowText.text.join(",")
data-fontsize= theme.ClickShowText.fontSize

View File

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

View File

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

View File

@@ -1,15 +1,26 @@
script.
if (document.getElementsByClassName('mermaid').length) {
if (window.mermaidJsLoad) mermaid.init()
else {
getScript('!{theme.CDN.mermaid}').then(() => {
window.mermaidJsLoad = true
mermaid.initialize({
theme: '!{theme.mermaid.theme}',
(() => {
const $mermaidWrap = document.querySelectorAll('#article-container .mermaid-wrap')
if ($mermaidWrap.length) {
window.runMermaid = () => {
window.loadMermaid = true
const theme = document.documentElement.getAttribute('data-theme') === 'dark' ? '!{theme.mermaid.theme.dark}' : '!{theme.mermaid.theme.light}'
Array.from($mermaidWrap).forEach((item, index) => {
const mermaidSrc = item.firstElementChild
const mermaidThemeConfig = '%%{init:{ \'theme\':\'' + theme + '\'}}%%\n'
const mermaidID = 'mermaid-' + index
const mermaidDefinition = mermaidThemeConfig + mermaidSrc.textContent
mermaid.mermaidAPI.render(mermaidID, mermaidDefinition, (svgCode) => {
mermaidSrc.insertAdjacentHTML('afterend', svgCode)
})
})
!{theme.pjax.enable} && mermaid.init()
})
}
const loadMermaid = () => {
window.loadMermaid ? runMermaid() : getScript('!{url_for(theme.asset.mermaid)}').then(runMermaid)
}
window.pjax ? loadMermaid() : document.addEventListener('DOMContentLoaded', loadMermaid)
}
}
})()

View File

@@ -49,7 +49,7 @@ script.
}
result += `<div class='content'>
<a class='comment' href='${array[i].url}'>${array[i].content}</a>
<a class='comment' href='${array[i].url}' title='${array[i].content}'>${array[i].content}</a>
<div class='name'><span>${array[i].nick}</span><time> / ${btf.diffDate(array[i].date, true)}</time></div>
</div></div>`
}

View File

@@ -75,7 +75,7 @@ script.
}
result += `<div class='content'>
<a class='comment' href='${array[i].url}'>${array[i].content}</a>
<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>`
}

View File

@@ -23,4 +23,6 @@ if use
include ./github-issues.pug
when 'Utterances'
- userRepo = theme.utterances.repo
include ./github-issues.pug
include ./github-issues.pug
when 'Remark42'
include ./remark42.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('valine-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') {
runTwikoo()
} else {
getScript('!{theme.CDN.twikoo}').then(runTwikoo)
getScript('!{url_for(theme.asset.twikoo)}').then(runTwikoo)
}
}
@@ -60,7 +60,7 @@ script.
}
result += `<div class='content'>
<a class='comment' href='${array[i].url}'>${array[i].content}</a>
<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>`
}

View File

@@ -1,6 +1,6 @@
- let default_avatar = theme.valine.avatar
script(src="https://cdn.jsdelivr.net/npm/blueimp-md5@2.17.0/js/md5.min.js")
script(src=url_for(theme.asset.blueimp_md5))
script.
window.addEventListener('load', () => {
const changeContent = (content) => {
@@ -37,7 +37,7 @@ script.
}
result += `<div class='content'>
<a class='comment' href='${array[i].url}'>${array[i].content}</a>
<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>`
}

View File

@@ -1,5 +1,3 @@
- let { avatar,avatarCDN } = theme.waline
script.
window.addEventListener('load', () => {
const changeContent = (content) => {
@@ -16,13 +14,6 @@ script.
return content
}
const getIcon = (ava,mail) => {
if (ava) return ava
let defaultIcon = '!{ avatar ? `?d=${avatar}` : ''}'
let iconUrl = "!{avatarCDN ? avatarCDN : 'https://gravatar.loli.net/avatar/'}" + mail + defaultIcon
return iconUrl
}
const generateHtml = array => {
let result = ''
@@ -36,7 +27,7 @@ script.
}
result += `<div class='content'>
<a class='comment' href='${array[i].url}'>${array[i].content}</a>
<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>`
}
@@ -52,17 +43,17 @@ script.
const getComment = () => {
const loadWaline = () => {
Waline.Widget.RecentComments({
Waline.RecentComments({
serverURL: '!{theme.waline.serverURL}',
count: !{theme.newest_comments.limit}
}).then(res => {
const walineArray = res.comments.map(e => {
}).then(({comments}) => {
const walineArray = comments.map(e => {
return {
'content': changeContent(e.comment),
'avatar': getIcon(e.QQAvatar,e.mail),
'avatar': e.avatar,
'nick': e.nick,
'url': e.url + '#' + e.objectId,
'date': e.updatedAt,
'date': e.insertedAt,
}
})
saveToLocal.set('waline-newest-comments', JSON.stringify(walineArray), !{theme.newest_comments.storage}/(60*24))
@@ -74,7 +65,7 @@ script.
}
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 = () => {

View File

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

View File

@@ -3,20 +3,18 @@ if theme.pjax.exclude
each val in theme.pjax.exclude
- pjaxExclude = pjaxExclude + `:not([href="${val}"])`
script(src=url_for(theme.CDN.pjax))
script.
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']
if (!{Boolean(theme.Open_Graph_meta && theme.comments.use && theme.comments.use.includes('Livere'))}) {
pjaxSelectors.unshift('meta[property="og:image"]', 'meta[property="og:title"]', 'meta[property="og:url"]')
}
- let choose = theme.comments.use
if choose
if theme.Open_Graph_meta && (choose.includes('Livere') || choose.includes('Utterances') || choose.includes('Giscus'))
- pjaxSelectors.unshift('meta[property="og:image"]', 'meta[property="og:title"]', 'meta[property="og:url"]')
if choose.includes('Utterances') || choose.includes('Giscus')
- pjaxSelectors.unshift('link[rel="canonical"]')
script(src=url_for(theme.asset.pjax))
script.
let pjaxSelectors = !{JSON.stringify(pjaxSelectors)}
var pjax = new Pjax({
elements: '!{pjaxExclude}',
@@ -29,10 +27,11 @@ script.
document.addEventListener('pjax:send', function () {
// removeEventListener scroll
window.removeEventListener('scroll', window.tocScrollFn)
window.removeEventListener('scroll', scrollCollect)
window.tocScrollFn && window.removeEventListener('scroll', window.tocScrollFn)
window.scrollCollect && window.removeEventListener('scroll', scrollCollect)
typeof preloader === 'object' && preloader.initLoading()
document.getElementById('rightside').style.cssText = "opacity: ''; transform: ''"
if (window.aplayers) {
for (let i = 0; i < window.aplayers.length; i++) {
@@ -48,6 +47,7 @@ script.
const $bodyClassList = document.body.classList
$bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')
typeof disqusjs === 'object' && disqusjs.destroy()
})
document.addEventListener('pjax:complete', function () {
@@ -74,11 +74,6 @@ script.
typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()
// Analytics
if (!{theme.tencent_analytics ? true : false}) {
MtaH5.pgv()
}
// prismjs
typeof Prism === 'object' && Prism.highlightAll()

View File

@@ -1,5 +1,5 @@
if config.prismjs && config.prismjs.enable && !config.prismjs.preprocess
script(src=url_for(theme.CDN.prismjs_js))
script(src=url_for(theme.CDN.prismjs_autoloader))
script(src=url_for(theme.asset.prismjs_js))
script(src=url_for(theme.asset.prismjs_autoloader))
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,13 +1,18 @@
#algolia-search
.search-dialog
#algolia-search-title.search-dialog__title Algolia
#algolia-input-panel
nav.search-nav
span.search-dialog-title= _p('search.title')
button.search-close-button
i.fas.fa-times
.search-wrap
#algolia-search-input
hr
#algolia-search-results
#algolia-hits
#algolia-pagination
#algolia-stats
span.search-close-button
i.fas.fa-times
hr
#algolia-search-results
#algolia-hits
#algolia-pagination
#algolia-info
.algolia-stats
.algolia-poweredBy
#search-mask

View File

@@ -1,12 +1,20 @@
#local-search
.search-dialog
#local-search-title.search-dialog__title=_p("local_search.label")
#local-input-panel
nav.search-nav
span.search-dialog-title= _p('search.title')
span#loading-status
button.search-close-button
i.fas.fa-times
#loading-database.is-center
i.fas.fa-spinner.fa-pulse
span= ' ' + _p("search.load_data")
.search-wrap
#local-search-input
.local-search-box
input(placeholder=_p("local_search.input_placeholder") type="text").local-search-box--input
hr
#local-search-results
span.search-close-button
i.fas.fa-times
input(placeholder=_p("search.local_search.input_placeholder") type="text").local-search-box--input
hr
#local-search-results
#search-mask

View File

@@ -5,6 +5,6 @@
a(class="a2a_button_" + name)
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)
link(rel='stylesheet' href=url_for(theme.CDN.sharejs_css) media="print" onload="this.media='all'")
script(src=url_for(theme.CDN.sharejs) defer)
link(rel='stylesheet' href=url_for(theme.asset.sharejs_css) media="print" onload="this.media='all'")
script(src=url_for(theme.asset.sharejs) defer)

View File

@@ -1,53 +1,22 @@
- let source = theme.subtitle.source
- const { effect,loop,source,sub } = theme.subtitle
- let subContent = sub || new Array()
case source
when 1
script.
function subtitleType () {
fetch('https://api.btstu.cn/yan/api.php?charset=utf-8&encode=json')
.then(response => response.json())
.then(data => {
if (!{theme.subtitle.effect}) {
var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',')
var both = sub.unshift(data.text)
typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
backSpeed: 50,
})
} else {
document.getElementById('subtitle').innerHTML = data.text
}
})
}
if (!{theme.subtitle.effect}) {
if (typeof Typed === 'function') {
subtitleType()
} else {
getScript('!{url_for(theme.CDN.typed)}').then(subtitleType)
}
} else {
subtitleType()
}
when 2
script.
function subtitleType () {
fetch('https://v1.hitokoto.cn')
.then(response => response.json())
.then(data => {
if (!{theme.subtitle.effect}) {
var from = '出自 ' + data.from
var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',')
var both = sub.unshift(data.hitokoto, from)
var typed = new Typed('#subtitle', {
if (!{effect}) {
const from = '出自 ' + data.from
const sub = !{JSON.stringify(subContent)}
sub.unshift(data.hitokoto, from)
window.typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
loop: !{loop},
backSpeed: 50,
})
} else {
@@ -56,30 +25,30 @@ case source
})
}
if (!{theme.subtitle.effect}) {
if (!{effect}) {
if (typeof Typed === 'function') {
subtitleType()
} else {
getScript('!{url_for(theme.CDN.typed)}').then(subtitleType)
getScript('!{url_for(theme.asset.typed)}').then(subtitleType)
}
} else {
subtitleType()
}
when 3
when 2
script.
function subtitleType () {
getScript('https://yijuzhan.com/api/word.php?m=js').then(() => {
var con = str[0]
if (!{theme.subtitle.effect}) {
var from = '出自 ' + str[1]
var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',')
var both = sub.unshift(con, from)
var typed = new Typed('#subtitle', {
const con = str[0]
if (!{effect}) {
const from = '出自 ' + str[1]
const sub = !{JSON.stringify(subContent)}
sub.unshift(con, from)
window.typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
loop: !{loop},
backSpeed: 50,
})
} else {
@@ -88,30 +57,30 @@ case source
})
}
if (!{theme.subtitle.effect}) {
if (!{effect}) {
if (typeof Typed === 'function') {
subtitleType()
} else {
getScript('!{url_for(theme.CDN.typed)}').then(subtitleType)
getScript('!{url_for(theme.asset.typed)}').then(subtitleType)
}
} else {
subtitleType()
}
when 4
when 3
script.
function subtitleType () {
getScript('https://sdk.jinrishici.com/v2/browser/jinrishici.js').then(() => {
jinrishici.load(function (result) {
if (!{theme.subtitle.effect}) {
var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',')
var content = result.data.content
var both = sub.unshift(content)
var typed = new Typed('#subtitle', {
jinrishici.load(result =>{
if (!{effect}) {
const sub = !{JSON.stringify(subContent)}
const content = result.data.content
sub.unshift(content)
window.typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
loop: !{loop},
backSpeed: 50,
})
} else {
@@ -121,37 +90,38 @@ case source
})
}
if (!{theme.subtitle.effect}) {
if (!{effect}) {
if (typeof Typed === 'function') {
subtitleType()
} else {
getScript('!{url_for(theme.CDN.typed)}').then(subtitleType)
getScript('!{url_for(theme.asset.typed)}').then(subtitleType)
}
} else {
subtitleType()
}
default
- subContent = subContent.length ? subContent : new Array(config.subtitle)
script.
function subtitleType () {
if (!{theme.subtitle.effect}) {
var typed = new Typed("#subtitle", {
strings: "!{theme.subtitle.sub}".split(","),
if (!{effect}) {
window.typed = new Typed("#subtitle", {
strings: !{JSON.stringify(subContent)},
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
loop: !{loop},
backSpeed: 50
})
} else {
document.getElementById("subtitle").innerHTML = '!{theme.subtitle.sub[0]}'
document.getElementById("subtitle").innerHTML = '!{subContent[0]}'
}
}
if (!{theme.subtitle.effect}) {
if (!{effect}) {
if (typeof Typed === 'function') {
subtitleType()
} else {
getScript('!{url_for(theme.CDN.typed)}').then(subtitleType)
getScript('!{url_for(theme.asset.typed)}').then(subtitleType)
}
} else {
subtitleType()

View File

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

View File

@@ -6,27 +6,19 @@ if theme.aside.card_author.enable
.author-info__name= config.author
.author-info__description!= theme.aside.card_author.description || config.description
.card-info-data
if site.posts.length
.card-info-data-item.is-center
a(href=url_for(config.archive_dir) + '/')
.headline= _p('aside.articles')
.length-num= site.posts.length
if site.tags.length
.card-info-data-item.is-center
a(href=url_for(config.tag_dir) + '/')
.headline= _p('aside.tags')
.length-num= site.tags.length
if site.categories.length
.card-info-data-item.is-center
a(href=url_for(config.category_dir) + '/')
.headline= _p('aside.categories')
.length-num= site.categories.length
.card-info-data.site-data.is-center
a(href=url_for(config.archive_dir) + '/')
.headline= _p('aside.articles')
.length-num= site.posts.length
a(href=url_for(config.tag_dir) + '/')
.headline= _p('aside.tags')
.length-num= site.tags.length
a(href=url_for(config.category_dir) + '/')
.headline= _p('aside.categories')
.length-num= site.categories.length
if theme.aside.card_author.button.enable
a#card-info-btn.button--animated(href=theme.aside.card_author.button.link)
a#card-info-btn(href=theme.aside.card_author.button.link)
i(class=theme.aside.card_author.button.icon)
span=theme.aside.card_author.button.text

View File

@@ -1,4 +1,4 @@
if theme.newest_comments.enable
if theme.newest_comments.enable && !['Livere','Facebook Comments','Giscus'].includes(theme.comments.use[0])
.card-widget#card-newest-comments
.item-headline
i.fas.fa-comment-dots

View File

@@ -1,12 +1,15 @@
- let tocNumber = page.toc_number !== undefined ? page.toc_number : theme.toc.number
- let tocExpand = page.toc_expand !== undefined ? page.toc_expand : theme.toc.expand
- let tocExpandClass = tocExpand ? 'is-expand' : ''
#card-toc.card-widget
.item-headline
i.fas.fa-stream
span= _p('aside.card_toc')
span.toc-percentage
if (page.encrypt == true)
.toc-content.toc-div-class(style="display:none")!=toc(page.origin, {list_number: tocNumber})
.toc-content.toc-div-class(class=tocExpandClass style="display:none")!=toc(page.origin, {list_number: tocNumber})
else
.toc-content!=toc(page.content, {list_number: tocNumber})
.toc-content(class=tocExpandClass)!=toc(page.content, {list_number: tocNumber})

View File

@@ -12,20 +12,24 @@ if theme.aside.card_webinfo.enable
.webinfo-item
.item-name= _p('aside.card_webinfo.runtime.name') + " :"
.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
.webinfo-item
.item-name=_p('aside.card_webinfo.site_wordcount') + " :"
.item-count=totalcount(site)
if theme.busuanzi.site_uv
if theme.busuanzi.site_uv
.webinfo-item
.item-name= _p('aside.card_webinfo.site_uv_name') + " :"
.item-count#busuanzi_value_site_uv
i.fa-solid.fa-spinner.fa-spin
if theme.busuanzi.site_pv
.webinfo-item
.item-name= _p('aside.card_webinfo.site_pv_name') + " :"
.item-count#busuanzi_value_site_pv
i.fa-solid.fa-spinner.fa-spin
if theme.aside.card_webinfo.last_push_date
.webinfo-item
.item-name= _p('aside.card_webinfo.last_push_date.name') + " :"
.item-count#last-push-date(data-lastPushDate=date_xml(Date.now()))
i.fa-solid.fa-spinner.fa-spin

View File

@@ -1,13 +1,15 @@
#aside-content.aside-content
//- post
if is_post()
if showToc && theme.toc.style_simple
- const tocStyle = page.toc_style_simple
- const tocStyleVal = tocStyle === true || tocStyle === false ? tocStyle : theme.toc.style_simple
if showToc && tocStyleVal
.sticky_layout
include ./card_post_toc.pug
else
!=partial('includes/widget/card_author', {}, {cache: true})
!=partial('includes/widget/card_announcement', {}, {cache: true})
!=partial('includes/widget/card_top_self', {}, {cache: true})
!=partial('includes/widget/card_top_self', {}, {cache: true})
.sticky_layout
if showToc
include ./card_post_toc.pug
@@ -20,6 +22,8 @@
!=partial('includes/widget/card_top_self', {}, {cache: true})
.sticky_layout
if showToc
include ./card_post_toc.pug
!=partial('includes/widget/card_recent_post', {}, {cache: true})
!=partial('includes/widget/card_ad', {}, {cache: true})
!=partial('includes/widget/card_newest_comment', {}, {cache: true})

View File

@@ -2,6 +2,9 @@ extends includes/layout.pug
block content
#page
if top_img === false
h1.page-title= page.title
case page.type
when 'tags'
include includes/page/tags.pug

View File

@@ -14,7 +14,7 @@ block content
a(href=url_for(item.path)).post-meta__tags #[=item.name]
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})
//- ad

View File

@@ -1,6 +1,6 @@
{
"name": "hexo-theme-butterfly",
"version": "3.8.2",
"version": "4.3.0",
"description": "A Simple and Card UI Design theme for Hexo",
"main": "package.json",
"scripts": {
@@ -20,13 +20,13 @@
},
"bugs": {
"url": "https://github.com/jerryc127/hexo-theme-butterfly/issues",
"email": "btf@immyw.com"
"email": "my@crazywong.com"
},
"dependencies": {
"hexo-renderer-stylus": "^2.0.1",
"hexo-renderer-pug": "^2.0.0"
"hexo-renderer-stylus": "^2.1.0",
"hexo-renderer-pug": "^3.0.0"
},
"homepage": "https://butterfly.js.org/",
"author": "Jerry <i@immyw.com>",
"author": "Jerry <my@crazywong.com>",
"license": "Apache-2.0"
}

182
plugins.yml Normal file
View File

@@ -0,0 +1,182 @@
algolia_search_v4:
name: algoliasearch
file: dist/algoliasearch-lite.umd.js
version: 4.13.1
instantsearch_v4:
name: instantsearch.js
file: dist/instantsearch.production.min.js
version: 4.42.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.4.18
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.5.11
waline_js:
name: '@waline/client'
file: dist/waline.js
other_name: waline
version: 2.6.1
waline_css:
name: '@waline/client'
file: dist/waline.css
other_name: waline
version: 2.6.1
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.2
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.0
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.27
other_name: fancyapps-ui
fancybox_v4:
name: '@fancyapps/ui'
file: dist/fancybox.umd.js
version: 4.0.27
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.1
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

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

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

15
scripts/events/stylus.js Normal file
View File

@@ -0,0 +1,15 @@
/**
* stylus
*/
'use strict'
hexo.extend.filter.register('stylus:renderer', function (style) {
const { highlight, prismjs } = hexo.config
style
.define('$highlight_enable', highlight && highlight.enable)
.define('$highlight_line_number', highlight && highlight.line_number)
.define('$prismjs_enable', prismjs && prismjs.enable)
.define('$prismjs_line_number', prismjs && prismjs.line_number)
// .import(this.source_dir.replace(/\\/g, '/') + '_data/css/*')
})

View File

@@ -12,6 +12,6 @@ hexo.on('ready', () => {
# # # # # # # # # # # #
##### #### # # ###### # # # ###### #
${version}
${version}
===================================================================`)
})

View File

@@ -9,7 +9,7 @@
const urlFor = require('hexo-util').url_for.bind(hexo)
function lazyload (htmlContent) {
const bg = hexo.theme.config.lazyload.placeholder ? urlFor(hexo.theme.config.lazyload.placeholder) : 'data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs='
const bg = hexo.theme.config.lazyload.placeholder ? urlFor(hexo.theme.config.lazyload.placeholder) : 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
return htmlContent.replace(/(<img.*? src=)/ig, `$1 "${bg}" data-lazy-src=`)
}

View File

@@ -39,7 +39,7 @@ function randomCover () {
return cover
}
} else {
cover = theme.default_top_img || 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg'
cover = theme.default_top_img || 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
return cover
}
}

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

@@ -6,7 +6,11 @@
'use strict'
hexo.extend.helper.register('inject_head_js', function () {
const { darkmode, aside, change_font_size, index_img, disable_top_img, pjax} = 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 = `
win.saveToLocal = {
@@ -62,13 +66,13 @@ hexo.extend.helper.register('inject_head_js', function () {
win.activateDarkMode = function () {
document.documentElement.setAttribute('data-theme', 'dark')
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 () {
document.documentElement.setAttribute('data-theme', 'light')
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')
@@ -131,31 +135,14 @@ hexo.extend.helper.register('inject_head_js', function () {
`
}
let changFontAside = ''
if (change_font_size) {
changFontAside = `
const fontSizeVal = saveToLocal.get('global-font-size')
if (fontSizeVal !== undefined) {
document.documentElement.style.setProperty('--global-font-size', fontSizeVal + 'px')
}
`
}
let detectApple = ''
if (!disable_top_img || index_img !== false) {
detectApple = `
const detectApple = `
const detectApple = () => {
if (GLOBAL_CONFIG_SITE.isHome && /iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
document.documentElement.classList.add('apple')
}
}
detectApple()
`
if (pjax.enable) {
detectApple += 'document.addEventListener(\'pjax:complete\', detectApple)'
}
}
return `<script>(win=>{${localStore + getScript + darkmodeJs + asideStatus + changFontAside + detectApple}})(window)</script>`
return `<script>(win=>{${localStore + getScript + darkmodeJs + asideStatus + detectApple}})(window)</script>`
})

View File

@@ -71,7 +71,13 @@ hexo.extend.helper.register('injectHtml', function (data) {
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')
if (!menu) return defaultTitle

View File

@@ -46,11 +46,7 @@ hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
if (relatedPosts.length > 0) {
result += '<div class="relatedPosts">'
result +=
'<div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>' +
' ' +
headlineLang +
'</span></div>'
result += `<div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>${headlineLang}</span></div>`
result += '<div class="relatedPosts-list">'
for (let i = 0; i < Math.min(relatedPosts.length, limitNum); i++) {
@@ -58,32 +54,15 @@ hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
relatedPosts[i].cover === false
? relatedPosts[i].randomcover
: relatedPosts[i].cover
result +=
'<div><a href="' +
hexoConfig.root +
relatedPosts[i].path +
'" title="' +
relatedPosts[i].title +
'">'
result +=
'<img class="cover" src="' +
this.url_for(cover) +
'" alt="cover">'
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">`
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 {
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>'
}

View File

@@ -21,7 +21,7 @@ function btn (args) {
icon = icon.trim()
option = option.trim()
return `<a class="btn-beautify button--animated ${option}" href="${urlFor(url)}"
return `<a class="btn-beautify ${option}" href="${urlFor(url)}"
title="${text}">${icon.length ? `<i class="${icon}"></i>` : ''}${text.length ? `<span>${text}</span>` : ''}</a>`
}

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

@@ -8,7 +8,7 @@
const urlFor = require('hexo-util').url_for.bind(hexo)
function gallery (args, content) {
return `<div class="justified-gallery">${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}
return `<div class="fj-gallery">${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}
</div>`
}
@@ -20,7 +20,7 @@ function galleryGroup (args) {
return `
<figure class="gallery-group">
<img class="gallery-group-img" src='${img}' alt="Group Image Gallery">
<img class="gallery-group-img no-lightbox" src='${img}' alt="Group Image Gallery">
<figcaption>
<div class="gallery-group-name">${name}</div>
<p>${desrc}</p>

View File

@@ -28,7 +28,7 @@ function hideInline (args) {
if (color) group += `color: ${color}`
group += '"'
return `<span class="hide-inline"><button type="button" class="hide-button button--animated" ${group}>${display}
return `<span class="hide-inline"><button type="button" class="hide-button" ${group}>${display}
</button><span class="hide-content">${content}</span></span>`
}
@@ -43,7 +43,7 @@ function hideBlock (args, content) {
if (color) group += `color: ${color}`
group += '"'
return `<div class="hide-block"><button type="button" class="hide-button button--animated" ${group}>${display}
return `<div class="hide-block"><button type="button" class="hide-button" ${group}>${display}
</button><div class="hide-content">${hexo.render.renderSync({ text: content, engine: 'markdown' })}</div></div>`
}
@@ -62,8 +62,7 @@ function hideToggle (args, content) {
if (color) group += `color: ${color}`
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>
<div class="hide-content">${hexo.render.renderSync({ text: content, engine: 'markdown' })}</div></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>`
}
hexo.extend.tag.register('hideInline', hideInline)

View File

@@ -9,7 +9,9 @@
const { escapeHTML } = require('hexo-util')
function mermaid (args, content) {
return `<div class="mermaid">${escapeHTML(content)}</div>`
return `<div class="mermaid-wrap"><pre class="mermaid-src" hidden>
${escapeHTML(content)}
</pre></div>`
}
hexo.extend.tag.register('mermaid', mermaid, { ends: true })

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