mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-10 21:17:07 +08:00
Compare commits
219 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c5d587f64 | ||
|
|
ee6b137e94 | ||
|
|
e5e3998950 | ||
|
|
d9829167aa | ||
|
|
097ea40a4a | ||
|
|
6ebe51e971 | ||
|
|
6a99a80758 | ||
|
|
b409207978 | ||
|
|
bf14e665d9 | ||
|
|
63fb690d02 | ||
|
|
805afb2e70 | ||
|
|
7923a15e17 | ||
|
|
0d40e75589 | ||
|
|
f9a2ad70ce | ||
|
|
deccde649b | ||
|
|
775942ae3e | ||
|
|
b6e02432fe | ||
|
|
7dded29438 | ||
|
|
347f605def | ||
|
|
c67b4304d2 | ||
|
|
37646cd831 | ||
|
|
be40690613 | ||
|
|
c90b00f3dd | ||
|
|
507780ebd6 | ||
|
|
5d52302a38 | ||
|
|
d943a01db3 | ||
|
|
5944ffd811 | ||
|
|
0066457cf0 | ||
|
|
f12ae8fbb3 | ||
|
|
90a923eb4b | ||
|
|
ed5ba1d5a9 | ||
|
|
16ae63d0c4 | ||
|
|
7bef2fa7cd | ||
|
|
3e1fdf52d4 | ||
|
|
759e63b643 | ||
|
|
6e0b29080d | ||
|
|
28d1744b9b | ||
|
|
52441b6bf5 | ||
|
|
0342df6ed7 | ||
|
|
096973ecce | ||
|
|
4e99420568 | ||
|
|
496234c8ad | ||
|
|
a2f02a0b80 | ||
|
|
8d5ca45948 | ||
|
|
04e36c8d8a | ||
|
|
5c2894d3d5 | ||
|
|
63353566d2 | ||
|
|
f0588a3967 | ||
|
|
0834720d32 | ||
|
|
183d01b9eb | ||
|
|
7e8d666bf7 | ||
|
|
49b6c7436c | ||
|
|
1e24c62f70 | ||
|
|
5e30032a5f | ||
|
|
47214b5a7c | ||
|
|
d62f047073 | ||
|
|
5a13f01649 | ||
|
|
09b7342882 | ||
|
|
4c9395666d | ||
|
|
f4d0687750 | ||
|
|
e80ecb43ef | ||
|
|
93f7461d28 | ||
|
|
841fbb0c5e | ||
|
|
247e62a418 | ||
|
|
8199e25215 | ||
|
|
b34eeb0425 | ||
|
|
63dc605794 | ||
|
|
a7d6d0fb80 | ||
|
|
768d9e370b | ||
|
|
a3e46f757b | ||
|
|
9d22bb82c6 | ||
|
|
431b5fa7ce | ||
|
|
8a50b80527 | ||
|
|
3694ee01df | ||
|
|
c579dad041 | ||
|
|
5baf759749 | ||
|
|
532b74edde | ||
|
|
062641c8ab | ||
|
|
08fabdc2d1 | ||
|
|
6a50b62869 | ||
|
|
396fb102da | ||
|
|
b019a1fd33 | ||
|
|
929a5608d3 | ||
|
|
9a3b41912a | ||
|
|
0f915f47ef | ||
|
|
e2565a9f39 | ||
|
|
4cd26d183c | ||
|
|
f218a0a14a | ||
|
|
6c7debfd24 | ||
|
|
eb88a5bb4a | ||
|
|
f07823903f | ||
|
|
4bd5edd955 | ||
|
|
ecf4d341e6 | ||
|
|
c6c58f7620 | ||
|
|
5c0d578e4c | ||
|
|
859cd4938b | ||
|
|
21f71cd0f2 | ||
|
|
f775e97548 | ||
|
|
54a4fa381d | ||
|
|
bf3a43e62a | ||
|
|
274a499aff | ||
|
|
48781800f3 | ||
|
|
449fe2f876 | ||
|
|
06ab48f607 | ||
|
|
e0382c80ae | ||
|
|
a1589c0212 | ||
|
|
ff6fc30743 | ||
|
|
fef6dcf6c6 | ||
|
|
5fd171bab0 | ||
|
|
0b0cb38b59 | ||
|
|
65b1ad32c8 | ||
|
|
13cf15c369 | ||
|
|
6b7d0d9806 | ||
|
|
c17b0cb553 | ||
|
|
8ee052e93b | ||
|
|
c866315b87 | ||
|
|
2404eee5c1 | ||
|
|
5e656b7072 | ||
|
|
a405217462 | ||
|
|
8cfa1665b9 | ||
|
|
d12f5be271 | ||
|
|
26f2c1b4e3 | ||
|
|
bb7fc446fc | ||
|
|
49e4903b34 | ||
|
|
91641646a7 | ||
|
|
4b8492a377 | ||
|
|
a36c9ca6d2 | ||
|
|
6361f28328 | ||
|
|
7e83095920 | ||
|
|
dbb31dec99 | ||
|
|
057581b955 | ||
|
|
fba180afaf | ||
|
|
b8b728898e | ||
|
|
91d49fe7a2 | ||
|
|
931a0ba82d | ||
|
|
9a33e23a9c | ||
|
|
945ea89685 | ||
|
|
b4d3ea86bb | ||
|
|
ecebacad37 | ||
|
|
e650f71086 | ||
|
|
6d387eadcc | ||
|
|
860f6c5ef9 | ||
|
|
e56757ac29 | ||
|
|
08b7cd9dbb | ||
|
|
9a86429484 | ||
|
|
6e58f68f0c | ||
|
|
004a27decc | ||
|
|
4df78b1966 | ||
|
|
b1e40b33d7 | ||
|
|
cf38250fa9 | ||
|
|
e3bb904e87 | ||
|
|
cbf52c3053 | ||
|
|
9351413b63 | ||
|
|
1f3f2f471b | ||
|
|
c68e872f0e | ||
|
|
1bc54d6eb3 | ||
|
|
f768d6fce0 | ||
|
|
4dd146f787 | ||
|
|
7187a17896 | ||
|
|
41ac7f170c | ||
|
|
fd21969278 | ||
|
|
060defa475 | ||
|
|
2e133e1cd6 | ||
|
|
aa767f6fb5 | ||
|
|
241f9b5873 | ||
|
|
31f17d1c64 | ||
|
|
de8e35d0d0 | ||
|
|
101cb45b90 | ||
|
|
641fb56b22 | ||
|
|
7c859ef66d | ||
|
|
42bc175718 | ||
|
|
7b520c62f6 | ||
|
|
54c6a509c7 | ||
|
|
f0eaf2d8b0 | ||
|
|
c439930786 | ||
|
|
f4e5cef399 | ||
|
|
637da0702b | ||
|
|
6904850044 | ||
|
|
4c5abe0cc5 | ||
|
|
e8cfc6e083 | ||
|
|
823dc03090 | ||
|
|
24cf0a11e6 | ||
|
|
a7e512d764 | ||
|
|
4a69c623fc | ||
|
|
eb823b0a2d | ||
|
|
8f412c90da | ||
|
|
6a1330de84 | ||
|
|
eb5a356a4e | ||
|
|
f4b07340f7 | ||
|
|
17d8062968 | ||
|
|
d4b69051aa | ||
|
|
59f6ce63e3 | ||
|
|
cd78f639dd | ||
|
|
8e4c20f6d4 | ||
|
|
e984efa35c | ||
|
|
863cf1e780 | ||
|
|
85b8a83371 | ||
|
|
d73960f2a2 | ||
|
|
fcd430902d | ||
|
|
ee45f6517f | ||
|
|
67201ac58d | ||
|
|
315d3b50df | ||
|
|
727a2d97d9 | ||
|
|
54b67987c1 | ||
|
|
26df41c772 | ||
|
|
4e7051ad77 | ||
|
|
955b4bae6a | ||
|
|
95ddf28f3b | ||
|
|
e901f9ad35 | ||
|
|
462422e279 | ||
|
|
bad24849bd | ||
|
|
eb242f0809 | ||
|
|
b1795e3def | ||
|
|
54b212ead3 | ||
|
|
4bbc035f54 | ||
|
|
40ba3bb92f | ||
|
|
e2cb0242bb | ||
|
|
559afab632 | ||
|
|
c134d4fc86 |
13
.github/FUNDING.yml
vendored
Normal file
13
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
custom: ['https://buy.stripe.com/3cs6rP6YA91sbbG5kk','https://jsd.012700.xyz/gh/jerryc127/CDN/Photo/wechat.jpg'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
19
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
19
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -16,6 +16,16 @@ body:
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: modify
|
||||
attributes:
|
||||
label: 是否修改过主题文件? || Has the theme files been modified?
|
||||
options:
|
||||
- 是 (Yes)
|
||||
- 不是 (No)
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: browser
|
||||
attributes:
|
||||
@@ -43,6 +53,15 @@ body:
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: dependencies
|
||||
attributes:
|
||||
label: 依賴插件 | Package dependencies Information
|
||||
description: 在 Hexo 根目錄下執行`npm ls --depth 0` | Run `npm ls --depth 0` in Hexo root directory
|
||||
render: Text
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
|
||||
8
.github/ISSUE_TEMPLATE/config.yml
vendored
8
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -12,11 +12,7 @@ contact_links:
|
||||
url: https://t.me/bu2fly
|
||||
about: 'Official Telegram Group'
|
||||
|
||||
- name: QQ 1群
|
||||
- name: QQ 群
|
||||
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群都添加'
|
||||
about: '群號 1070540070'
|
||||
|
||||
|
||||
20
.github/stale.yml
vendored
20
.github/stale.yml
vendored
@@ -1,20 +0,0 @@
|
||||
# Number of days of inactivity before an issue becomes stale
|
||||
daysUntilStale: 30
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 7
|
||||
# Issues with these labels will never be considered stale
|
||||
exemptLabels:
|
||||
- pinned
|
||||
- security
|
||||
- bug
|
||||
- enhancement
|
||||
- documentation
|
||||
# Label to use when marking an issue as stale
|
||||
staleLabel: 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
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: false
|
||||
19
.github/workflows/stale.yml
vendored
Normal file
19
.github/workflows/stale.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
name: 'Close stale issues and PRs'
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 1 * * *'
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
days-before-issue-stale: 30
|
||||
days-before-pr-stale: -1
|
||||
days-before-close: 7
|
||||
stale-issue-message: 'This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.'
|
||||
close-pr-message: 'This issue has not seen any activity since it was marked stale. Closing.'
|
||||
stale-issue-label: 'Stale'
|
||||
exempt-issue-labels: 'pinned,bug,enhancement,documentation,Plan'
|
||||
operations-per-run: 1000
|
||||
22
README.md
22
README.md
@@ -1,7 +1,5 @@
|
||||
<div align="right">
|
||||
Language:
|
||||
🇺🇸
|
||||
<a title="Chinese" href="/README_CN.md">🇨🇳</a>
|
||||
<a title="Chinese" href="/README_CN.md">中文</a>
|
||||
</div>
|
||||
|
||||
# hexo-theme-butterfly
|
||||
@@ -14,9 +12,9 @@
|
||||
|
||||

|
||||
|
||||
Demo: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [CrazyWong](https://crazywong.com/)
|
||||
📢 Demo: [Butterfly](https://butterfly.js.org/) || [CrazyWong](https://blog.crazywong.com/)
|
||||
|
||||
Docs: 📖 [Butterfly Docs](https://butterfly.js.org/posts/21cfbf15/)
|
||||
📖 Docs: [English](https://butterfly.js.org/en/posts/butterfly-docs-en-get-started/) || [Chinese](https://butterfly.js.org/posts/21cfbf15/)
|
||||
|
||||
Based on [hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody) theme.
|
||||
|
||||
@@ -62,26 +60,26 @@ npm i hexo-theme-butterfly
|
||||
|
||||
- [x] Card UI Design
|
||||
- [X] Support sub-menu
|
||||
- [x] Two Column designs
|
||||
- [x] Two-column layout
|
||||
- [x] Responsive Web Design
|
||||
- [x] Dark Mode
|
||||
- [x] Pjax
|
||||
- [x] Read Mode
|
||||
- [x] Conversion between Traditional and Simplified Chinese
|
||||
- [X] TOC catalog is available for both computers and mobile phones
|
||||
- [X] Color themes (darker/pale night/light/ocean/mac/mac light), support custom colors
|
||||
- [X] Built-in Syntax Highlighting Themes (darker/pale night/light/ocean/mac/mac light), also support customization
|
||||
- [X] Code Blocks (Display code language/close or expand Code Blocks/Copy Button/word wrap)
|
||||
- [X] Disable copy/Add a Copyright Notice to the Copied Text
|
||||
- [X] Search (Algolia SearchZ/Local Search)
|
||||
- [X] Search (Algolia Search/Local Search)
|
||||
- [x] Mathjax and Katex
|
||||
- [x] Built-in 404 page
|
||||
- [x] WordCount
|
||||
- [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/Giscus)
|
||||
- [x] Share (Sharejs/Addtoany)
|
||||
- [X] Comment (Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42/artalk)
|
||||
- [x] Multiple Comment System Support
|
||||
- [x] Online Chats (Chatra/Tidio/Daovoice/Gitter/Crisp)
|
||||
- [x] Online Chats (Chatra/Tidio/Daovoice/Crisp/messenger)
|
||||
- [x] Web analytics
|
||||
- [x] Google AdSense
|
||||
- [x] Webmaster Verification
|
||||
@@ -89,7 +87,7 @@ npm i hexo-theme-butterfly
|
||||
- [x] Typewriter Effect: activate_power_mode
|
||||
- [x] Background effects (Canvas ribbon/canvas_ribbon_piao/canvas_nest)
|
||||
- [x] Mouse click effects (Fireworks/Heart/Text)
|
||||
- [x] Preloader/Loading Animation
|
||||
- [x] Preloader/Loading Animation/pace.js
|
||||
- [x] Busuanzi visitor counter
|
||||
- [x] Medium Zoom/Fancybox
|
||||
- [x] Mermaid
|
||||
|
||||
22
README_CN.md
22
README_CN.md
@@ -1,7 +1,5 @@
|
||||
<div align="right">
|
||||
語言:
|
||||
中文
|
||||
<a title="English" href="/README.md">英文</a>
|
||||
<a title="English" href="/README.md">English</a>
|
||||
</div>
|
||||
|
||||
# hexo-theme-butterfly
|
||||
@@ -14,9 +12,9 @@
|
||||
|
||||

|
||||
|
||||
預覽: 👍 [Butterfly](https://butterfly.js.org/) || 🤞 [CrazyWong](https://crazywong.com/)
|
||||
📢 預覽: [Butterfly](https://butterfly.js.org/) || [CrazyWong](https://blog.crazywong.com/)
|
||||
|
||||
文檔: 📖 [Butterfly Docs](https://butterfly.js.org/posts/21cfbf15/)
|
||||
📖 文檔: [中文](https://butterfly.js.org/posts/21cfbf15/) || [English](https://butterfly.js.org/en/posts/butterfly-docs-en-get-started/)
|
||||
|
||||
一款基於[hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody)修改的主題
|
||||
|
||||
@@ -72,24 +70,24 @@ theme: butterfly
|
||||
- [X] 內置多種代碼配色(darker/pale night/light/ocean/mac/mac light),可自定義代碼配色
|
||||
- [X] 代碼塊顯示代碼語言/關閉或展開代碼塊/代碼複製/代碼自動換行
|
||||
- [X] 可關閉文字複製/可開啟內容複製增加版權信息)
|
||||
- [X] 兩種搜索(Algolia搜索和本地搜索)
|
||||
- [X] 兩種搜索( Algolia 搜索和本地搜索)
|
||||
- [x] Mathjax 和 Katex
|
||||
- [x] 內置404頁面
|
||||
- [x] 顯示字數統計
|
||||
- [x] 顯示相關文章
|
||||
- [x] 過期文章提醒
|
||||
- [x] 多種分享系統(AddThis/Sharejs/Addtoany)
|
||||
- [X] 多種評論系統(Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus)
|
||||
- [x] 多種分享系統(Sharejs/Addtoany)
|
||||
- [X] 多種評論系統(Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42/artalk)
|
||||
- [x] 支持雙評論部署
|
||||
- [x] 多種在線聊天(Chatra/Tidio/Daovoice/Gitter/Crisp)
|
||||
- [x] 多種在線聊天(Chatra/Tidio/Daovoice/Crisp/messenger)
|
||||
- [x] 多種分析系統
|
||||
- [x] 谷歌廣告/手動廣告位置
|
||||
- [x] 各種站長驗證(Google/Bing/Baidu/360/Yandex)
|
||||
- [x] 各種站長驗證
|
||||
- [x] 修改網站配色
|
||||
- [x] 打字特效 activate_power_mode
|
||||
- [x] 多種背景特效(靜止彩帶/動態彩帶/Canvas Nest)
|
||||
- [x] 多種鼠標點擊特效(煙花/文字/愛心)
|
||||
- [x] 內置一種 Preloader 加載動畫
|
||||
- [x] 內置一種 Preloader 加載動畫和 pace.js 加載動畫條
|
||||
- [x] 不蒜子訪問統計
|
||||
- [x] 兩種大圖模式(Medium Zoom/Fancybox)
|
||||
- [x] Mermaid 圖表顯示
|
||||
@@ -97,7 +95,7 @@ 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" />
|
||||
|
||||
610
_config.yml
610
_config.yml
@@ -1,7 +1,13 @@
|
||||
# Main menu navigation (導航目錄)
|
||||
# see https://butterfly.js.org/posts/4aa8abbe/#導航菜單
|
||||
# Navigation bar settings (導航欄設置)
|
||||
# see https://butterfly.js.org/posts/4aa8abbe/##導航欄設置-Navigation-bar-settings
|
||||
# --------------------------------------
|
||||
|
||||
nav:
|
||||
logo: # image
|
||||
display_title: true
|
||||
fixed: false # fixed navigation bar
|
||||
|
||||
# Menu 目錄
|
||||
menu:
|
||||
# Home: / || fas fa-home
|
||||
# Archives: /archives/ || fas fa-archive
|
||||
@@ -23,54 +29,12 @@ highlight_shrink: false # true: shrink the code blocks / false: expand the code
|
||||
highlight_height_limit: false # unit: px
|
||||
code_word_wrap: false
|
||||
|
||||
# copy settings
|
||||
# copyright: Add the copyright information after copied content (複製的內容後面加上版權信息)
|
||||
copy:
|
||||
enable: true
|
||||
copyright:
|
||||
enable: false
|
||||
limit_count: 50
|
||||
|
||||
# social settings (社交圖標設置)
|
||||
# Social Settings (社交圖標設置)
|
||||
# formal:
|
||||
# icon: link || the description
|
||||
# icon: link || the description || color
|
||||
social:
|
||||
# fab fa-github: https://github.com/xxxxx || Github
|
||||
# fas fa-envelope: mailto:xxxxxx@gmail.com || Email
|
||||
|
||||
# search (搜索)
|
||||
# see https://butterfly.js.org/posts/ceeb73f/#搜索系統
|
||||
# --------------------------------------
|
||||
|
||||
# Algolia search
|
||||
algolia_search:
|
||||
enable: false
|
||||
hits:
|
||||
per_page: 6
|
||||
|
||||
# Local search
|
||||
local_search:
|
||||
enable: false
|
||||
preload: false
|
||||
CDN:
|
||||
|
||||
# Math (數學)
|
||||
# --------------------------------------
|
||||
# About the per_page
|
||||
# if you set it to true, it will load mathjax/katex script in each page (true 表示每一頁都加載js)
|
||||
# if you set it to false, it will load mathjax/katex script according to your setting (add the 'mathjax: true' in page's front-matter)
|
||||
# (false 需要時加載,須在使用的 Markdown Front-matter 加上 mathjax: true)
|
||||
|
||||
# MathJax
|
||||
mathjax:
|
||||
enable: false
|
||||
per_page: false
|
||||
|
||||
# KaTeX
|
||||
katex:
|
||||
enable: false
|
||||
per_page: false
|
||||
hide_scrollbar: true
|
||||
# fab fa-github: https://github.com/xxxxx || Github || '#24292e'
|
||||
# fas fa-envelope: mailto:xxxxxx@gmail.com || Email || '#4a7dbe'
|
||||
|
||||
# Image (圖片設置)
|
||||
# --------------------------------------
|
||||
@@ -150,14 +114,6 @@ post_meta:
|
||||
tags: true # true or false 文章頁是否顯示標籤
|
||||
label: true # true or false 顯示描述性文字
|
||||
|
||||
# wordcount (字數統計)
|
||||
# see https://butterfly.js.org/posts/ceeb73f/#字數統計
|
||||
wordcount:
|
||||
enable: false
|
||||
post_wordcount: true
|
||||
min2read: true
|
||||
total_wordcount: true
|
||||
|
||||
# Display the article introduction on homepage
|
||||
# 1: description
|
||||
# 2: both (if the description exists, it will show description, or show the auto_excerpt)
|
||||
@@ -168,8 +124,22 @@ index_post_content:
|
||||
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
|
||||
anchor:
|
||||
# when you scroll, the URL will update according to header id.
|
||||
auto_update: false
|
||||
# Click the headline to scroll and update the anchor
|
||||
click_to_scroll: false
|
||||
|
||||
# figcaption (圖片描述文字)
|
||||
photofigcaption: false
|
||||
|
||||
# copy settings
|
||||
# copyright: Add the copyright information after copied content (複製的內容後面加上版權信息)
|
||||
copy:
|
||||
enable: true
|
||||
copyright:
|
||||
enable: false
|
||||
limit_count: 50
|
||||
|
||||
# Post
|
||||
# --------------------------------------
|
||||
@@ -181,6 +151,7 @@ toc:
|
||||
number: true
|
||||
expand: false
|
||||
style_simple: false # for post
|
||||
scroll_percent: true
|
||||
|
||||
post_copyright:
|
||||
enable: true
|
||||
@@ -192,6 +163,7 @@ post_copyright:
|
||||
# Sponsor/reward
|
||||
reward:
|
||||
enable: false
|
||||
text:
|
||||
QR_code:
|
||||
# - img: /img/wechat.jpg
|
||||
# link:
|
||||
@@ -214,9 +186,6 @@ related_post:
|
||||
limit: 6 # Number of posts displayed
|
||||
date_type: created # or created or updated 文章日期顯示創建日或者更新日
|
||||
|
||||
# figcaption (圖片描述文字)
|
||||
photofigcaption: false
|
||||
|
||||
# post_pagination (分頁)
|
||||
# value: 1 || 2 || false
|
||||
# 1: The 'next post' will link to old post
|
||||
@@ -233,14 +202,189 @@ noticeOutdate:
|
||||
message_prev: It has been
|
||||
message_next: days since the last update, the content of the article may be outdated.
|
||||
|
||||
# Share System (分享功能)
|
||||
# Footer Settings
|
||||
# --------------------------------------
|
||||
footer:
|
||||
owner:
|
||||
enable: true
|
||||
since: 2020
|
||||
custom_text:
|
||||
copyright: true # Copyright of theme and framework
|
||||
|
||||
# aside (側邊欄)
|
||||
# --------------------------------------
|
||||
|
||||
# AddThis
|
||||
# https://www.addthis.com/
|
||||
addThis:
|
||||
aside:
|
||||
enable: true
|
||||
hide: false
|
||||
button: true
|
||||
mobile: true # display on mobile
|
||||
position: right # left or right
|
||||
display:
|
||||
archive: true
|
||||
tag: true
|
||||
category: true
|
||||
card_author:
|
||||
enable: true
|
||||
description:
|
||||
button:
|
||||
enable: true
|
||||
icon: fab fa-github
|
||||
text: Follow Me
|
||||
link: https://github.com/xxxxxx
|
||||
card_announcement:
|
||||
enable: true
|
||||
content: This is my Blog
|
||||
card_recent_post:
|
||||
enable: true
|
||||
limit: 5 # if set 0 will show all
|
||||
sort: date # date or updated
|
||||
sort_order: # Don't modify the setting unless you know how it works
|
||||
card_categories:
|
||||
enable: true
|
||||
limit: 8 # if set 0 will show all
|
||||
expand: none # none/true/false
|
||||
sort_order: # Don't modify the setting unless you know how it works
|
||||
card_tags:
|
||||
enable: true
|
||||
limit: 40 # if set 0 will show all
|
||||
color: false
|
||||
orderby: random # Order of tags, random/name/length
|
||||
order: 1 # Sort of order. 1, asc for ascending; -1, desc for descending
|
||||
sort_order: # Don't modify the setting unless you know how it works
|
||||
card_archives:
|
||||
enable: true
|
||||
type: monthly # yearly or monthly
|
||||
format: MMMM YYYY # eg: YYYY年MM月
|
||||
order: -1 # Sort of order. 1, asc for ascending; -1, desc for descending
|
||||
limit: 8 # if set 0 will show all
|
||||
sort_order: # Don't modify the setting unless you know how it works
|
||||
card_webinfo:
|
||||
enable: true
|
||||
post_count: true
|
||||
last_push_date: true
|
||||
sort_order: # Don't modify the setting unless you know how it works
|
||||
card_post_series:
|
||||
enable: true
|
||||
series_title: false # The title shows the series name
|
||||
orderBy: 'date' # Order by title or date
|
||||
order: -1 # Sort of order. 1, asc for ascending; -1, desc for descending
|
||||
|
||||
# busuanzi count for PV / UV in site
|
||||
# 訪問人數
|
||||
busuanzi:
|
||||
site_uv: true
|
||||
site_pv: true
|
||||
page_pv: true
|
||||
|
||||
# Time difference between publish date and now (網頁運行時間)
|
||||
# Formal: Month/Day/Year Time or Year/Month/Day Time
|
||||
runtimeshow:
|
||||
enable: false
|
||||
pubid:
|
||||
publish_date:
|
||||
|
||||
# Aside widget - Newest Comments
|
||||
newest_comments:
|
||||
enable: false
|
||||
sort_order: # Don't modify the setting unless you know how it works
|
||||
limit: 6
|
||||
storage: 10 # unit: mins, save data to localStorage
|
||||
avatar: true
|
||||
|
||||
# Bottom right button (右下角按鈕)
|
||||
# --------------------------------------
|
||||
|
||||
# Conversion between Traditional and Simplified Chinese (簡繁轉換)
|
||||
translate:
|
||||
enable: false
|
||||
# The text of a button
|
||||
default: 繁
|
||||
# the language of website (1 - Traditional Chinese/ 2 - Simplified Chinese)
|
||||
defaultEncoding: 2
|
||||
# Time delay
|
||||
translateDelay: 0
|
||||
# The text of the button when the language is Simplified Chinese
|
||||
msgToTraditionalChinese: '繁'
|
||||
# The text of the button when the language is Traditional Chinese
|
||||
msgToSimplifiedChinese: '簡'
|
||||
|
||||
# Read Mode (閲讀模式)
|
||||
readmode: true
|
||||
|
||||
# dark mode
|
||||
darkmode:
|
||||
enable: true
|
||||
# Toggle Button to switch dark/light mode
|
||||
button: true
|
||||
# Switch dark/light mode automatically (自動切換 dark mode和 light mode)
|
||||
# autoChangeMode: 1 Following System Settings, if the system doesn't support dark mode, it will switch dark mode between 6 pm to 6 am
|
||||
# autoChangeMode: 2 Switch dark mode between 6 pm to 6 am
|
||||
# autoChangeMode: false
|
||||
autoChangeMode: false
|
||||
# Set the light mode time. The value is between 0 and 24. If not set, the default value is 6 and 18
|
||||
start: # 8
|
||||
end: # 22
|
||||
|
||||
# show scroll percent in scroll-to-top button
|
||||
rightside_scroll_percent: 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
|
||||
|
||||
# Math (數學)
|
||||
# --------------------------------------
|
||||
# About the per_page
|
||||
# if you set it to true, it will load mathjax/katex script in each page (true 表示每一頁都加載js)
|
||||
# if you set it to false, it will load mathjax/katex script according to your setting (add the 'mathjax: true' in page's front-matter)
|
||||
# (false 需要時加載,須在使用的 Markdown Front-matter 加上 mathjax: true)
|
||||
|
||||
# MathJax
|
||||
mathjax:
|
||||
enable: false
|
||||
per_page: false
|
||||
|
||||
# KaTeX
|
||||
katex:
|
||||
enable: false
|
||||
per_page: false
|
||||
hide_scrollbar: true
|
||||
|
||||
# search (搜索)
|
||||
# see https://butterfly.js.org/posts/ceeb73f/#搜索系統
|
||||
# --------------------------------------
|
||||
|
||||
# Algolia search
|
||||
algolia_search:
|
||||
enable: false
|
||||
hits:
|
||||
per_page: 6
|
||||
|
||||
# Local search
|
||||
local_search:
|
||||
enable: false
|
||||
# Preload the search data when the page loads.
|
||||
preload: false
|
||||
# Show top n results per article, show all results by setting to -1
|
||||
top_n_per_article: 1
|
||||
# Unescape html strings to the readable one.
|
||||
unescape: false
|
||||
CDN:
|
||||
|
||||
# Docsearch
|
||||
docsearch:
|
||||
enable: false
|
||||
appId:
|
||||
apiKey:
|
||||
indexName:
|
||||
option:
|
||||
|
||||
# Share System (分享)
|
||||
# --------------------------------------
|
||||
|
||||
# Share.js
|
||||
# https://github.com/overtrue/share.js
|
||||
@@ -259,7 +403,7 @@ 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/Giscus
|
||||
# Choose: Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus/Remark42/Artalk
|
||||
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.
|
||||
@@ -333,7 +477,7 @@ facebook_comments:
|
||||
user_id: # optional
|
||||
pageSize: 10 # The number of comments to show
|
||||
order_by: social # social/time/reverse_time
|
||||
lang: en_US # Language en_US/zh_CN/zh_TW and so on
|
||||
lang: zh_TW # Language en_US/zh_CN/zh_TW and so on
|
||||
|
||||
# Twikoo
|
||||
# https://github.com/imaegoo/twikoo
|
||||
@@ -354,6 +498,21 @@ giscus:
|
||||
dark: dark
|
||||
option:
|
||||
|
||||
# Remark42
|
||||
# https://remark42.com/docs/configuration/frontend/
|
||||
remark42:
|
||||
host: # Your Host URL
|
||||
siteId: # Your Site ID
|
||||
option:
|
||||
|
||||
# Artalk
|
||||
# https://artalk.js.org/guide/frontend/config.html
|
||||
artalk:
|
||||
server:
|
||||
site:
|
||||
visitor: false
|
||||
option:
|
||||
|
||||
# Chat Services
|
||||
# --------------------------------------
|
||||
|
||||
@@ -377,31 +536,23 @@ tidio:
|
||||
public_key:
|
||||
|
||||
# daovoice
|
||||
# http://daovoice.io/
|
||||
# http://dashboard.daovoice.io/app
|
||||
daovoice:
|
||||
enable: false
|
||||
app_id:
|
||||
|
||||
# gitter
|
||||
# https://gitter.im/
|
||||
gitter:
|
||||
enable: false
|
||||
room:
|
||||
|
||||
# crisp
|
||||
# https://crisp.chat/en/
|
||||
crisp:
|
||||
enable: false
|
||||
website_id:
|
||||
|
||||
# Footer Settings
|
||||
# --------------------------------------
|
||||
footer:
|
||||
owner:
|
||||
enable: true
|
||||
since: 2020
|
||||
custom_text:
|
||||
copyright: true # Copyright of theme and framework
|
||||
# messenger
|
||||
# https://developers.facebook.com/docs/messenger-platform/discovery/facebook-chat-plugin/
|
||||
messenger:
|
||||
enable: false
|
||||
pageID:
|
||||
lang: zh_TW # Language en_US/zh_CN/zh_TW and so on
|
||||
|
||||
# Analysis
|
||||
# --------------------------------------
|
||||
@@ -414,10 +565,6 @@ baidu_analytics:
|
||||
# https://analytics.google.com/analytics/web/
|
||||
google_analytics:
|
||||
|
||||
# CNZZ Analytics
|
||||
# https://www.umeng.com/
|
||||
cnzz_analytics:
|
||||
|
||||
# Cloudflare Analytics
|
||||
# https://www.cloudflare.com/zh-tw/web-analytics/
|
||||
cloudflare_analytics:
|
||||
@@ -489,6 +636,9 @@ index_top_img_height:
|
||||
category_ui: # 留空或 index
|
||||
tag_ui: # 留空或 index
|
||||
|
||||
# Stretches the lines so that each line has equal width(文字向兩側對齊,對最後一行無效)
|
||||
text_align_justify: false
|
||||
|
||||
# Website Background (設置網站背景)
|
||||
# can set it to color or image (可設置圖片 或者 顔色)
|
||||
# The formal of image: url(http://xxxxxx.com/xxx.jpg)
|
||||
@@ -497,12 +647,25 @@ background:
|
||||
# Footer Background
|
||||
footer_bg: false
|
||||
|
||||
# Add mask to header or footer (为 header 或 footer 添加黑色半透遮罩)
|
||||
mask:
|
||||
header: true
|
||||
footer: true
|
||||
|
||||
# the position of bottom right button/default unit: px (右下角按鈕距離底部的距離/默認單位為px)
|
||||
rightside-bottom:
|
||||
rightside_bottom:
|
||||
|
||||
# Enter transitions (開啓網頁進入效果)
|
||||
enter_transitions: true
|
||||
|
||||
# Typewriter Effect (打字效果)
|
||||
# https://github.com/disjukr/activate-power-mode
|
||||
activate_power_mode:
|
||||
enable: false
|
||||
colorful: true # open particle animation (冒光特效)
|
||||
shake: true # open shake (抖動特效)
|
||||
mobile: false
|
||||
|
||||
# Background effects (背景特效)
|
||||
# --------------------------------------
|
||||
|
||||
@@ -531,14 +694,6 @@ canvas_nest:
|
||||
count: 99 # the number of lines, default: 99.
|
||||
mobile: false
|
||||
|
||||
# Typewriter Effect (打字效果)
|
||||
# https://github.com/disjukr/activate-power-mode
|
||||
activate_power_mode:
|
||||
enable: false
|
||||
colorful: true # open particle animation (冒光特效)
|
||||
shake: true # open shake (抖動特效)
|
||||
mobile: false
|
||||
|
||||
# Mouse click effects: fireworks (鼠標點擊效果: 煙火特效)
|
||||
fireworks:
|
||||
enable: false
|
||||
@@ -551,7 +706,7 @@ click_heart:
|
||||
mobile: false
|
||||
|
||||
# Mouse click effects: words (鼠標點擊效果: 文字)
|
||||
ClickShowText:
|
||||
clickShowText:
|
||||
enable: false
|
||||
text:
|
||||
# - I
|
||||
@@ -597,12 +752,13 @@ subtitle:
|
||||
enable: false
|
||||
# Typewriter Effect (打字效果)
|
||||
effect: true
|
||||
# loop (循環打字)
|
||||
loop: true
|
||||
# Customize typed.js (配置typed.js)
|
||||
# https://github.com/mattboldt/typed.js/#customization
|
||||
typed_option:
|
||||
# source 調用第三方服務
|
||||
# source: false 關閉調用
|
||||
# source: 1 調用一言網的一句話(簡體) https://hitokoto.cn/
|
||||
# source: 2 調用一句網(簡體) http://yijuzhan.com/
|
||||
# source: 2 調用一句網(簡體) https://yijuzhan.com/
|
||||
# source: 3 調用今日詩詞(簡體) https://www.jinrishici.com/
|
||||
# subtitle 會先顯示 source , 再顯示 sub 的內容
|
||||
source: false
|
||||
@@ -610,116 +766,22 @@ subtitle:
|
||||
sub:
|
||||
|
||||
# Loading Animation (加載動畫)
|
||||
preloader: false
|
||||
|
||||
# aside (側邊欄)
|
||||
# --------------------------------------
|
||||
|
||||
aside:
|
||||
enable: true
|
||||
hide: false
|
||||
button: true
|
||||
mobile: true # display on mobile
|
||||
position: right # left or right
|
||||
archives: true
|
||||
card_author:
|
||||
enable: true
|
||||
description:
|
||||
button:
|
||||
enable: true
|
||||
icon: fab fa-github
|
||||
text: Follow Me
|
||||
link: https://github.com/xxxxxx
|
||||
card_announcement:
|
||||
enable: true
|
||||
content: This is my Blog
|
||||
card_recent_post:
|
||||
enable: true
|
||||
limit: 5 # if set 0 will show all
|
||||
sort: date # date or updated
|
||||
sort_order: # Don't modify the setting unless you know how it works
|
||||
card_categories:
|
||||
enable: true
|
||||
limit: 8 # if set 0 will show all
|
||||
expand: none # none/true/false
|
||||
sort_order: # Don't modify the setting unless you know how it works
|
||||
card_tags:
|
||||
enable: true
|
||||
limit: 40 # if set 0 will show all
|
||||
color: false
|
||||
sort_order: # Don't modify the setting unless you know how it works
|
||||
card_archives:
|
||||
enable: true
|
||||
type: monthly # yearly or monthly
|
||||
format: MMMM YYYY # eg: YYYY年MM月
|
||||
order: -1 # Sort of order. 1, asc for ascending; -1, desc for descending
|
||||
limit: 8 # if set 0 will show all
|
||||
sort_order: # Don't modify the setting unless you know how it works
|
||||
card_webinfo:
|
||||
enable: true
|
||||
post_count: true
|
||||
last_push_date: true
|
||||
sort_order: # Don't modify the setting unless you know how it works
|
||||
|
||||
# busuanzi count for PV / UV in site
|
||||
# 訪問人數
|
||||
busuanzi:
|
||||
site_uv: true
|
||||
site_pv: true
|
||||
page_pv: true
|
||||
|
||||
# Time difference between publish date and now (網頁運行時間)
|
||||
# Formal: Month/Day/Year Time or Year/Month/Day Time
|
||||
runtimeshow:
|
||||
preloader:
|
||||
enable: false
|
||||
publish_date:
|
||||
# source
|
||||
# 1. fullpage-loading
|
||||
# 2. pace (progress bar)
|
||||
source: 1
|
||||
# pace theme (see https://codebyzach.github.io/pace/)
|
||||
pace_css_url:
|
||||
|
||||
# Aside widget - Newest Comments
|
||||
newest_comments:
|
||||
# wordcount (字數統計)
|
||||
# see https://butterfly.js.org/posts/ceeb73f/#字數統計
|
||||
wordcount:
|
||||
enable: false
|
||||
sort_order: # Don't modify the setting unless you know how it works
|
||||
limit: 6
|
||||
storage: 10 # unit: mins, save data to localStorage
|
||||
avatar: true
|
||||
|
||||
# Bottom right button (右下角按鈕)
|
||||
# --------------------------------------
|
||||
|
||||
# Conversion between Traditional and Simplified Chinese (簡繁轉換)
|
||||
translate:
|
||||
enable: false
|
||||
# The text of a button
|
||||
default: 繁
|
||||
# the language of website (1 - Traditional Chinese/ 2 - Simplified Chinese)
|
||||
defaultEncoding: 2
|
||||
# Time delay
|
||||
translateDelay: 0
|
||||
# The text of the button when the language is Simplified Chinese
|
||||
msgToTraditionalChinese: '繁'
|
||||
# The text of the button when the language is Traditional Chinese
|
||||
msgToSimplifiedChinese: '簡'
|
||||
|
||||
# Read Mode (閲讀模式)
|
||||
readmode: true
|
||||
|
||||
# dark mode
|
||||
darkmode:
|
||||
enable: true
|
||||
# Toggle Button to switch dark/light mode
|
||||
button: true
|
||||
# Switch dark/light mode automatically (自動切換 dark mode和 light mode)
|
||||
# autoChangeMode: 1 Following System Settings, if the system doesn't support dark mode, it will switch dark mode between 6 pm to 6 am
|
||||
# autoChangeMode: 2 Switch dark mode between 6 pm to 6 am
|
||||
# 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
|
||||
post_wordcount: true
|
||||
min2read: true
|
||||
total_wordcount: true
|
||||
|
||||
# Lightbox (圖片大圖查看模式)
|
||||
# --------------------------------------
|
||||
@@ -730,12 +792,25 @@ rightside_item_order:
|
||||
medium_zoom: false
|
||||
|
||||
# fancybox
|
||||
# http://fancyapps.com/fancybox/3/
|
||||
# https://fancyapps.com/fancybox/
|
||||
fancybox: true
|
||||
|
||||
# Tag Plugins settings (標籤外掛)
|
||||
# --------------------------------------
|
||||
|
||||
# series (系列文章)
|
||||
series:
|
||||
enable: true
|
||||
orderBy: 'title' # Order by title or date
|
||||
order: 1 # Sort of order. 1, asc for ascending; -1, desc for descending
|
||||
number: true
|
||||
|
||||
# abcjs (樂譜渲染)
|
||||
# See https://github.com/paulrosen/abcjs
|
||||
abcjs:
|
||||
enable: false
|
||||
per_page: true
|
||||
|
||||
# mermaid
|
||||
# see https://github.com/mermaid-js/mermaid
|
||||
mermaid:
|
||||
@@ -817,7 +892,16 @@ lazyload:
|
||||
|
||||
# Open graph meta tags
|
||||
# https://developers.facebook.com/docs/sharing/webmasters/
|
||||
Open_Graph_meta: true
|
||||
Open_Graph_meta:
|
||||
enable: true
|
||||
option:
|
||||
# twitter_card:
|
||||
# twitter_image:
|
||||
# twitter_id:
|
||||
# twitter_site:
|
||||
# google_plus:
|
||||
# fb_admins:
|
||||
# fb_app_id:
|
||||
|
||||
# Add the vendor prefixes to ensure compatibility
|
||||
css_prefix: true
|
||||
@@ -836,61 +920,75 @@ inject:
|
||||
# 非必要請不要修改
|
||||
CDN:
|
||||
# The CDN provider of internal scripts (主題內部 js 的 cdn 配置)
|
||||
# option: local/jsdelivr
|
||||
# Dev version cannot choose jsdelivr (dev版的主題不能設置為 jsdelivr)
|
||||
# option: local/jsdelivr/unpkg/cdnjs/custom
|
||||
# Dev version can only choose. ( dev版的主題只能設置為 local )
|
||||
internal_provider: local
|
||||
|
||||
# The CDN provider of third party scripts (第三方 js 的 cdn 配置)
|
||||
# option: local/jsdelivr
|
||||
# option: local/jsdelivr/unpkg/cdnjs/custom
|
||||
# when set it to local, you need to install hexo-butterfly-extjs
|
||||
third_party_provider: jsdelivr
|
||||
|
||||
# Add version number to url, true or false
|
||||
version: true
|
||||
|
||||
# Custom format
|
||||
# For example: https://cdn.staticfile.org/${cdnjs_name}/${version}/${min_cdnjs_file}
|
||||
custom_format:
|
||||
|
||||
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:
|
||||
# katex_copytex_css:
|
||||
# mermaid:
|
||||
# canvas_ribbon:
|
||||
# canvas_fluttering_ribbon:
|
||||
# canvas_nest:
|
||||
# lazyload:
|
||||
# instantpage:
|
||||
# typed:
|
||||
# pangu:
|
||||
# fancybox_css_v4:
|
||||
# fancybox_v4:
|
||||
# medium_zoom:
|
||||
# snackbar_css:
|
||||
# snackbar:
|
||||
# abcjs_basic_js:
|
||||
# activate_power_mode:
|
||||
# fireworks:
|
||||
# click_heart:
|
||||
# ClickShowText:
|
||||
# fontawesomeV6:
|
||||
# flickr_justified_gallery_js:
|
||||
# flickr_justified_gallery_css:
|
||||
# algolia_js:
|
||||
# algolia_search:
|
||||
# aplayer_css:
|
||||
# aplayer_js:
|
||||
# artalk_css:
|
||||
# artalk_js:
|
||||
# blueimp_md5:
|
||||
# busuanzi:
|
||||
# canvas_fluttering_ribbon:
|
||||
# canvas_nest:
|
||||
# canvas_ribbon:
|
||||
# click_heart:
|
||||
# clickShowText:
|
||||
# disqusjs:
|
||||
# disqusjs_css:
|
||||
# docsearch_css:
|
||||
# docsearch_js:
|
||||
# egjs_infinitegrid:
|
||||
# fancybox:
|
||||
# fancybox_css:
|
||||
# fireworks:
|
||||
# fontawesome:
|
||||
# gitalk:
|
||||
# gitalk_css:
|
||||
# giscus:
|
||||
# instantpage:
|
||||
# instantsearch:
|
||||
# katex:
|
||||
# katex_copytex:
|
||||
# lazyload:
|
||||
# local_search:
|
||||
# main:
|
||||
# main_css:
|
||||
# mathjax:
|
||||
# medium_zoom:
|
||||
# mermaid:
|
||||
# meting_js:
|
||||
# pangu:
|
||||
# prismjs_autoloader:
|
||||
# prismjs_js:
|
||||
# prismjs_lineNumber_js:
|
||||
# prismjs_autoloader:
|
||||
# pjax:
|
||||
# sharejs:
|
||||
# sharejs_css:
|
||||
# snackbar:
|
||||
# snackbar_css:
|
||||
# translate:
|
||||
# twikoo:
|
||||
# typed:
|
||||
# utils:
|
||||
# valine:
|
||||
# waline_css:
|
||||
# waline_js:
|
||||
@@ -3,9 +3,9 @@ footer:
|
||||
theme: Theme
|
||||
|
||||
copy:
|
||||
success: Copy successfully
|
||||
error: Copy error
|
||||
noSupport: The browser does not support
|
||||
success: Copy Successful
|
||||
error: Copy Error
|
||||
noSupport: Browser Not Supported
|
||||
|
||||
page:
|
||||
articles: Articles
|
||||
@@ -15,16 +15,15 @@ page:
|
||||
|
||||
card_post_count: comments
|
||||
|
||||
sticky: Sticky
|
||||
no_title: No title
|
||||
no_title: Untitled
|
||||
|
||||
post:
|
||||
created: Created
|
||||
updated: Updated
|
||||
wordcount: Word count
|
||||
min2read: Reading time
|
||||
min2read_unit: min
|
||||
page_pv: Post View
|
||||
wordcount: Word Count
|
||||
min2read: Reading Time
|
||||
min2read_unit: mins
|
||||
page_pv: Post Views
|
||||
comments: Comments
|
||||
copyright:
|
||||
author: Author
|
||||
@@ -45,10 +44,11 @@ search:
|
||||
local_search:
|
||||
input_placeholder: Search for Posts
|
||||
hits_empty: "We didn't find any results for the search: ${query}"
|
||||
hits_stats: '${hits} results found'
|
||||
|
||||
pagination:
|
||||
prev: Previous Post
|
||||
next: Next Post
|
||||
prev: Previous
|
||||
next: Next
|
||||
|
||||
comment: Comment
|
||||
|
||||
@@ -65,32 +65,33 @@ aside:
|
||||
headline: Info
|
||||
article_name: Article
|
||||
runtime:
|
||||
name: Run time
|
||||
name: Runtime
|
||||
unit: days
|
||||
last_push_date:
|
||||
name: Last Push
|
||||
name: Last Update
|
||||
site_wordcount: Total Count
|
||||
site_uv_name: UV
|
||||
site_pv_name: PV
|
||||
more_button: More
|
||||
more_button: View More
|
||||
card_newest_comments:
|
||||
headline: Newest Comments
|
||||
headline: Latest Comments
|
||||
loading_text: loading...
|
||||
error: Unable to get the data, please make sure the settings are correct.
|
||||
zero: No Comment
|
||||
error: Unable to retrieve comments, please check the configuration
|
||||
zero: No comments
|
||||
image: image
|
||||
link: link
|
||||
code: code
|
||||
card_toc: Catalog
|
||||
card_toc: Contents
|
||||
card_post_series: Series
|
||||
|
||||
date_suffix:
|
||||
just: Just
|
||||
just: Just now
|
||||
min: minutes ago
|
||||
hour: hours ago
|
||||
day: days ago
|
||||
month: months ago
|
||||
|
||||
donate: Donate
|
||||
donate: Sponsor
|
||||
share: Share
|
||||
|
||||
rightside:
|
||||
@@ -101,7 +102,7 @@ rightside:
|
||||
toc: Table Of Contents
|
||||
scroll_to_comment: Scroll To Comments
|
||||
setting: Setting
|
||||
aside: Toggle between single-column and double-column
|
||||
aside: Toggle between Single-column and Double-column
|
||||
chat: Chat
|
||||
|
||||
copy_copyright:
|
||||
@@ -111,11 +112,12 @@ copy_copyright:
|
||||
info: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
|
||||
|
||||
Snackbar:
|
||||
chs_to_cht: Traditional Chinese Activated Manually
|
||||
cht_to_chs: Simplified Chinese Activated Manually
|
||||
day_to_night: Dark Mode Activated Manually
|
||||
night_to_day: Light Mode Activated Manually
|
||||
chs_to_cht: You have switched to Traditional Chinese
|
||||
cht_to_chs: You have switched to Simplified Chinese
|
||||
day_to_night: You have switched to Dark Mode
|
||||
night_to_day: You have switched to Light Mode
|
||||
|
||||
loading: Loading...
|
||||
load_more: Load More
|
||||
|
||||
error404: Page not found
|
||||
error404: Page Not Found
|
||||
|
||||
@@ -3,9 +3,9 @@ footer:
|
||||
theme: Theme
|
||||
|
||||
copy:
|
||||
success: Copy successfully
|
||||
error: Copy error
|
||||
noSupport: The browser does not support
|
||||
success: Copy Successful
|
||||
error: Copy Error
|
||||
noSupport: Browser Not Supported
|
||||
|
||||
page:
|
||||
articles: Articles
|
||||
@@ -15,16 +15,15 @@ page:
|
||||
|
||||
card_post_count: comments
|
||||
|
||||
sticky: Sticky
|
||||
no_title: No title
|
||||
no_title: Untitled
|
||||
|
||||
post:
|
||||
created: Created
|
||||
updated: Updated
|
||||
wordcount: Word count
|
||||
min2read: Reading time
|
||||
min2read_unit: min
|
||||
page_pv: Post View
|
||||
wordcount: Word Count
|
||||
min2read: Reading Time
|
||||
min2read_unit: mins
|
||||
page_pv: Post Views
|
||||
comments: Comments
|
||||
copyright:
|
||||
author: Author
|
||||
@@ -45,10 +44,11 @@ search:
|
||||
local_search:
|
||||
input_placeholder: Search for Posts
|
||||
hits_empty: "We didn't find any results for the search: ${query}"
|
||||
hits_stats: '${hits} results found'
|
||||
|
||||
pagination:
|
||||
prev: Previous Post
|
||||
next: Next Post
|
||||
prev: Previous
|
||||
next: Next
|
||||
|
||||
comment: Comment
|
||||
|
||||
@@ -65,43 +65,44 @@ aside:
|
||||
headline: Info
|
||||
article_name: Article
|
||||
runtime:
|
||||
name: Run time
|
||||
name: Runtime
|
||||
unit: days
|
||||
last_push_date:
|
||||
name: Last Push
|
||||
name: Last Update
|
||||
site_wordcount: Total Count
|
||||
site_uv_name: UV
|
||||
site_pv_name: PV
|
||||
more_button: More
|
||||
more_button: View More
|
||||
card_newest_comments:
|
||||
headline: Newest Comments
|
||||
headline: Latest Comments
|
||||
loading_text: loading...
|
||||
error: Unable to get the data, please make sure the settings are correct.
|
||||
zero: No Comment
|
||||
error: Unable to retrieve comments, please check the configuration
|
||||
zero: No comments
|
||||
image: image
|
||||
link: link
|
||||
code: code
|
||||
card_toc: Catalog
|
||||
card_toc: Contents
|
||||
card_post_series: Series
|
||||
|
||||
date_suffix:
|
||||
just: Just
|
||||
just: Just now
|
||||
min: minutes ago
|
||||
hour: hours ago
|
||||
day: days ago
|
||||
month: months ago
|
||||
|
||||
donate: Donate
|
||||
donate: Sponsor
|
||||
share: Share
|
||||
|
||||
rightside:
|
||||
readmode_title: Read Mode
|
||||
translate_title: Switch Between Traditional Chinese And Simplified Chinese
|
||||
night_mode_title: Switch Between Light And Dark Mode
|
||||
translate_title: Toggle Between Traditional Chinese And Simplified Chinese
|
||||
night_mode_title: Toggle Between Light And Dark Mode
|
||||
back_to_top: Back To Top
|
||||
toc: Table Of Contents
|
||||
scroll_to_comment: Scroll To Comments
|
||||
setting: Setting
|
||||
aside: Toggle between single-column and double-column
|
||||
aside: Toggle between Single-column and Double-column
|
||||
chat: Chat
|
||||
|
||||
copy_copyright:
|
||||
@@ -111,11 +112,12 @@ copy_copyright:
|
||||
info: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
|
||||
|
||||
Snackbar:
|
||||
chs_to_cht: Traditional Chinese Activated Manually
|
||||
cht_to_chs: Simplified Chinese Activated Manually
|
||||
day_to_night: Dark Mode Activated Manually
|
||||
night_to_day: Light Mode Activated Manually
|
||||
chs_to_cht: You have switched to Traditional Chinese
|
||||
cht_to_chs: You have switched to Simplified Chinese
|
||||
day_to_night: You have switched to Dark Mode
|
||||
night_to_day: You have switched to Light Mode
|
||||
|
||||
loading: Loading...
|
||||
load_more: Load More
|
||||
|
||||
error404: Page not found
|
||||
error404: Page Not Found
|
||||
@@ -15,7 +15,6 @@ page:
|
||||
|
||||
card_post_count: 条评论
|
||||
|
||||
sticky: 置顶
|
||||
no_title: 无题
|
||||
|
||||
post:
|
||||
@@ -46,6 +45,7 @@ search:
|
||||
local_search:
|
||||
input_placeholder: 搜索文章
|
||||
hits_empty: '找不到您查询的内容:${query}'
|
||||
hits_stats: '共找到 ${hits} 篇文章'
|
||||
|
||||
pagination:
|
||||
prev: 上一篇
|
||||
@@ -83,6 +83,7 @@ aside:
|
||||
link: 链接
|
||||
code: 代码
|
||||
card_toc: 目录
|
||||
card_post_series: 系列文章
|
||||
|
||||
date_suffix:
|
||||
just: 刚刚
|
||||
@@ -91,7 +92,7 @@ date_suffix:
|
||||
day: 天前
|
||||
month: 个月前
|
||||
|
||||
donate: 打赏
|
||||
donate: 赞助
|
||||
share: 分享
|
||||
|
||||
rightside:
|
||||
@@ -112,11 +113,12 @@ copy_copyright:
|
||||
info: 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
|
||||
|
||||
Snackbar:
|
||||
chs_to_cht: 你已切换为繁体
|
||||
cht_to_chs: 你已切换为简体
|
||||
chs_to_cht: 你已切换为繁体中文
|
||||
cht_to_chs: 你已切换为简体中文
|
||||
day_to_night: 你已切换为深色模式
|
||||
night_to_day: 你已切换为浅色模式
|
||||
|
||||
loading: 加载中...
|
||||
load_more: 加载更多
|
||||
|
||||
error404: 页面没有找到
|
||||
|
||||
@@ -15,8 +15,7 @@ page:
|
||||
|
||||
card_post_count: 條評論
|
||||
|
||||
sticky: 置頂
|
||||
no_title: 無題
|
||||
no_title: 無標題
|
||||
|
||||
post:
|
||||
created: 發表於
|
||||
@@ -46,7 +45,8 @@ search:
|
||||
local_search:
|
||||
input_placeholder: 搜尋文章
|
||||
hits_empty: '找不到您查詢的內容:${query}'
|
||||
|
||||
hits_stats: '共找到 ${hits} 篇文章'
|
||||
|
||||
pagination:
|
||||
prev: 上一篇
|
||||
next: 下一篇
|
||||
@@ -83,6 +83,7 @@ aside:
|
||||
link: 連結
|
||||
code: 程式碼
|
||||
card_toc: 目錄
|
||||
card_post_series: 文章系列
|
||||
|
||||
date_suffix:
|
||||
just: 剛剛
|
||||
@@ -91,14 +92,14 @@ date_suffix:
|
||||
day: 天前
|
||||
month: 個月前
|
||||
|
||||
donate: 打賞
|
||||
donate: 贊助
|
||||
share: 分享
|
||||
|
||||
rightside:
|
||||
readmode_title: 閱讀模式
|
||||
translate_title: 簡繁轉換
|
||||
night_mode_title: 淺色和深色模式轉換
|
||||
back_to_top: 回到頂部
|
||||
back_to_top: 返回頂部
|
||||
toc: 目錄
|
||||
scroll_to_comment: 直達評論
|
||||
setting: 設定
|
||||
@@ -109,14 +110,15 @@ copy_copyright:
|
||||
author: 作者
|
||||
link: 連結
|
||||
source: 來源
|
||||
info: 著作權歸作者所有。商業轉載請聯絡作者獲得授權,非商業轉載請註明出處。
|
||||
info: 著作權歸作者所有。商業轉載請聯繫作者獲得授權,非商業轉載請註明出處。
|
||||
|
||||
Snackbar:
|
||||
chs_to_cht: 你已切換為繁體
|
||||
cht_to_chs: 你已切換為簡體
|
||||
chs_to_cht: 你已切換為繁體中文
|
||||
cht_to_chs: 你已切換為簡體中文
|
||||
day_to_night: 你已切換為深色模式
|
||||
night_to_day: 你已切換為淺色模式
|
||||
|
||||
loading: 載入中...
|
||||
load_more: 載入更多
|
||||
|
||||
error404: 頁面沒有找到
|
||||
|
||||
@@ -3,6 +3,6 @@ extends includes/layout.pug
|
||||
block content
|
||||
include ./includes/mixins/article-sort.pug
|
||||
#archive
|
||||
.article-sort-title= _p('page.articles') + ' - ' + site.posts.length
|
||||
.article-sort-title= `${_p('page.articles')} - ${getArchiveLength()}`
|
||||
+articleSort(page.posts)
|
||||
include includes/pagination.pug
|
||||
@@ -8,7 +8,7 @@ div
|
||||
if theme.medium_zoom
|
||||
script(src=url_for(theme.asset.medium_zoom))
|
||||
else if theme.fancybox
|
||||
script(src=url_for(theme.asset.fancybox_v4))
|
||||
script(src=url_for(theme.asset.fancybox))
|
||||
|
||||
if theme.instantpage
|
||||
script(src=url_for(theme.asset.instantpage), type='module')
|
||||
@@ -22,17 +22,6 @@ div
|
||||
if theme.pangu.enable
|
||||
!= partial("includes/third-party/pangu.pug", {}, { cache: true })
|
||||
|
||||
//- search
|
||||
if theme.algolia_search.enable
|
||||
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.asset.local_search))
|
||||
|
||||
if theme.preloader
|
||||
!= partial("includes/loading/loading-js", {}, { cache: true })
|
||||
|
||||
.js-pjax
|
||||
if needLoadCountJs
|
||||
!= partial("includes/third-party/card-post-count/index", {}, { cache: true })
|
||||
@@ -42,6 +31,8 @@ div
|
||||
|
||||
include ./third-party/math/index.pug
|
||||
|
||||
include ./third-party/abcjs/index.pug
|
||||
|
||||
if commentsJsLoad
|
||||
include ./third-party/comments/js.pug
|
||||
|
||||
@@ -69,4 +60,6 @@ div
|
||||
!= 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='//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js')
|
||||
script(async data-pjax src= theme.asset.busuanzi || '//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js')
|
||||
|
||||
!=partial('includes/third-party/search/index', {}, {cache: true})
|
||||
@@ -1,19 +1,12 @@
|
||||
- var pageTitle
|
||||
- if (is_archive()) pageTitle = fragment_cache('findArchivesTitle', function(){return findArchivesTitle(theme.menu);})
|
||||
- else if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag
|
||||
- is_archive() ? page.title = findArchivesTitle(page, theme.menu, date) : ''
|
||||
- if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag
|
||||
- else if (is_category()) pageTitle = _p('page.category') + ': ' + page.category
|
||||
- else if (is_month()) pageTitle += ': ' + page.month + '/' + page.year
|
||||
- else if (is_year()) pageTitle += ': ' + page.year
|
||||
- else if (is_current('/404.html', [strict])) pageTitle = _p('error404')
|
||||
- else pageTitle = page.title || config.title || ''
|
||||
|
||||
- var isSubtitle = config.subtitle ? ' - ' + config.subtitle : ''
|
||||
- var tabTitle = is_home() || !pageTitle ? config.title + isSubtitle : pageTitle + ' | ' + config.title
|
||||
|
||||
- var pageKeywords
|
||||
- if (page.keywords) pageKeywords = Array.isArray(page.keywords) ? (page.keywords).join(',') : ([]).join(',') || page.keywords
|
||||
- else if (page.tags && page.tags.length) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',')
|
||||
- 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 themeColorLight = theme.theme_color && theme.theme_color.enable && theme.theme_color.meta_theme_color_light || '#ffffff'
|
||||
@@ -22,10 +15,8 @@
|
||||
|
||||
meta(charset='UTF-8')
|
||||
meta(http-equiv="X-UA-Compatible" content="IE=edge")
|
||||
meta(name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no")
|
||||
meta(name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover")
|
||||
title= tabTitle
|
||||
if pageKeywords
|
||||
meta(name="keywords" content=pageKeywords)
|
||||
meta(name="author" content=pageAuthor)
|
||||
meta(name="copyright" content=pageCopyright)
|
||||
meta(name ="format-detection" content="telephone=no")
|
||||
@@ -35,7 +26,7 @@ meta(name="theme-color" content=themeColor)
|
||||
include ./head/Open_Graph.pug
|
||||
|
||||
!=favicon_tag(theme.favicon || config.favicon)
|
||||
link(rel="canonical" href=urlNoIndex())
|
||||
link(rel="canonical" href=urlNoIndex(null,config.pretty_urls.trailing_index,config.pretty_urls.trailing_html))
|
||||
|
||||
//- 預解析
|
||||
!=partial('includes/head/preconnect', {}, {cache: true})
|
||||
@@ -49,13 +40,13 @@ if (theme.pwa && theme.pwa.enable)
|
||||
|
||||
//- main css
|
||||
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'")
|
||||
link(rel='stylesheet', href=url_for(theme.asset.fontawesome))
|
||||
|
||||
if (theme.snackbar && theme.snackbar.enable)
|
||||
link(rel='stylesheet', href=url_for(theme.asset.snackbar_css) media="print" onload="this.media='all'")
|
||||
|
||||
if theme.fancybox
|
||||
link(rel='stylesheet' href=url_for(theme.asset.fancybox_css_v4) media="print" onload="this.media='all'")
|
||||
link(rel='stylesheet' href=url_for(theme.asset.fancybox_css) media="print" onload="this.media='all'")
|
||||
|
||||
//- google_adsense
|
||||
!=partial('includes/head/google_adsense', {}, {cache: true})
|
||||
@@ -64,15 +55,14 @@ if theme.fancybox
|
||||
!=partial('includes/head/analytics', {}, {cache: true})
|
||||
|
||||
//- font
|
||||
if theme.blog_title_font && theme.blog_title_font.font_link
|
||||
if theme.blog_title_font && theme.blog_title_font.font_link
|
||||
link(rel='stylesheet' href=url_for(theme.blog_title_font.font_link) media="print" onload="this.media='all'")
|
||||
|
||||
//- global config
|
||||
!=partial('includes/head/config', {}, {cache: true})
|
||||
|
||||
include ./head/config_site.pug
|
||||
include ./head/noscript.pug
|
||||
|
||||
!=fragment_cache('injectHeadJs', function(){return inject_head_js()})
|
||||
|
||||
!=fragment_cache('injectHead', function(){return injectHtml(theme.inject.head)})
|
||||
!=fragment_cache('injectHead', function(){return injectHtml(theme.inject.head)})
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
if theme.Open_Graph_meta
|
||||
- let contentType = is_post() ? 'article' : 'website'
|
||||
- let metaImage = (page.cover || theme.avatar.img) ? full_url_for(page.cover || theme.avatar.img) : ''
|
||||
- let fb_appId = theme.facebook_comments.app_id || ''
|
||||
- let fb_admins = theme.facebook_comments.user_id || ''
|
||||
|
||||
!= open_graph({type: contentType, image: metaImage, fb_admins: fb_admins, fb_app_id: fb_appId})
|
||||
|
||||
if theme.Open_Graph_meta.enable
|
||||
-
|
||||
const coverVal = page.cover_type === 'img' ? page.cover : theme.avatar.img
|
||||
let ogOption = Object.assign({
|
||||
type: is_post() ? 'article' : 'website',
|
||||
image: coverVal ? full_url_for(coverVal) : '',
|
||||
fb_admins: theme.facebook_comments.user_id || '',
|
||||
fb_app_id: theme.facebook_comments.app_id || '',
|
||||
}, theme.Open_Graph_meta.option)
|
||||
-
|
||||
!= open_graph(ogOption)
|
||||
else
|
||||
meta(name="description" content=page_description())
|
||||
|
||||
|
||||
@@ -16,9 +16,6 @@ if theme.google_analytics
|
||||
gtag('js', new Date());
|
||||
gtag('config', '!{theme.google_analytics}');
|
||||
|
||||
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}`)
|
||||
|
||||
if theme.cloudflare_analytics
|
||||
script(defer data-pjax src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon=`{"token": "${theme.cloudflare_analytics}"}`)
|
||||
|
||||
|
||||
@@ -21,9 +21,12 @@
|
||||
localSearch = JSON.stringify({
|
||||
path: theme.local_search.CDN ? theme.local_search.CDN : config.root + config.search.path,
|
||||
preload: theme.local_search.preload,
|
||||
top_n_per_article: theme.local_search.top_n_per_article,
|
||||
unescape: theme.local_search.unescape,
|
||||
languages: {
|
||||
// search languages
|
||||
hits_empty: _p("search.local_search.hits_empty"),
|
||||
hits_stats: _p("search.local_search.hits_stats"),
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -75,9 +78,11 @@
|
||||
}
|
||||
|
||||
let highlight = 'undefined';
|
||||
if ((config.highlight && config.highlight.enable) || (config.prismjs && config.prismjs.enable)) {
|
||||
let syntaxHighlighter = config.syntax_highlighter;
|
||||
let highlightEnable = syntaxHighlighter ? ['highlight.js', 'prismjs'].includes(syntaxHighlighter) : (config.highlight.enable || config.prismjs.enable);
|
||||
if (highlightEnable) {
|
||||
highlight = JSON.stringify({
|
||||
plugin: config.highlight.enable ? 'highlighjs' : 'prismjs',
|
||||
plugin: syntaxHighlighter ? syntaxHighlighter : config.highlight.enable ? 'highlight.js' : 'prismjs',
|
||||
highlightCopy: theme.highlight_copy,
|
||||
highlightLang: theme.highlight_lang,
|
||||
highlightHeightLimit: theme.highlight_height_limit
|
||||
@@ -85,7 +90,7 @@
|
||||
}
|
||||
|
||||
script.
|
||||
const GLOBAL_CONFIG = {
|
||||
const GLOBAL_CONFIG = {
|
||||
root: '!{config.root}',
|
||||
algolia: !{algolia},
|
||||
localSearch: !{localSearch},
|
||||
@@ -102,7 +107,7 @@ script.
|
||||
post: !{theme.post_meta.post.date_format === 'relative'}
|
||||
},
|
||||
runtime: '!{theme.runtimeshow.enable ? _p("aside.card_webinfo.runtime.unit") : ""}',
|
||||
date_suffix: {
|
||||
dateSuffix: {
|
||||
just: '!{_p("date_suffix.just")}',
|
||||
min: '!{_p("date_suffix.min")}',
|
||||
hour: '!{_p("date_suffix.hour")}',
|
||||
@@ -112,13 +117,16 @@ script.
|
||||
copyright: !{copyright},
|
||||
lightbox: '!{ theme.medium_zoom ? "mediumZoom" : (theme.fancybox ? "fancybox" : "null" )}',
|
||||
Snackbar: !{Snackbar},
|
||||
source: {
|
||||
justifiedGallery: {
|
||||
js: '!{url_for(theme.asset.flickr_justified_gallery_js)}',
|
||||
css: '!{url_for(theme.asset.flickr_justified_gallery_css)}'
|
||||
}
|
||||
infinitegrid: {
|
||||
js: '!{url_for(theme.asset.egjs_infinitegrid)}',
|
||||
buttonText: '!{_p("load_more")}'
|
||||
},
|
||||
isPhotoFigcaption: !{theme.photofigcaption},
|
||||
islazyload: !{theme.lazyload.enable},
|
||||
isAnchor: !{theme.anchor}
|
||||
isAnchor: !{theme.anchor.auto_update || false},
|
||||
percent: {
|
||||
toc: !{theme.toc.scroll_percent},
|
||||
rightside: !{theme.rightside_scroll_percent},
|
||||
},
|
||||
autoDarkmode: !{theme.darkmode.enable && theme.darkmode.autoChangeMode === 1}
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
noscript.
|
||||
<style type="text/css">
|
||||
#nav {
|
||||
opacity: 1
|
||||
}
|
||||
.justified-gallery img {
|
||||
opacity: 1
|
||||
}
|
||||
|
||||
#recent-posts time,
|
||||
#post-meta time {
|
||||
display: inline !important
|
||||
}
|
||||
</style>
|
||||
@@ -1,4 +1,20 @@
|
||||
link(rel="preconnect" href="//cdn.jsdelivr.net")
|
||||
-
|
||||
const { internal_provider, third_party_provider, custom_format } = theme.CDN
|
||||
const providers = {
|
||||
'jsdelivr': '//cdn.jsdelivr.net',
|
||||
'cdnjs': '//cdnjs.cloudflare.com',
|
||||
'unpkg': '//unpkg.com',
|
||||
'custom': custom_format && custom_format.match(/^((https?:)?(\/\/[^/]+)|([^/]+))(\/|$)/)[1]
|
||||
}
|
||||
-
|
||||
|
||||
if internal_provider === third_party_provider && internal_provider !== 'local'
|
||||
link(rel="preconnect" href=providers[internal_provider])
|
||||
else
|
||||
if internal_provider !== 'local'
|
||||
link(rel="preconnect" href=providers[internal_provider])
|
||||
if third_party_provider !== 'local'
|
||||
link(rel="preconnect" href=providers[third_party_provider])
|
||||
|
||||
if theme.google_analytics
|
||||
link(rel="preconnect" href="//www.google-analytics.com" crossorigin='')
|
||||
@@ -6,9 +22,6 @@ if theme.google_analytics
|
||||
if theme.baidu_analytics
|
||||
link(rel="preconnect" href="//hm.baidu.com")
|
||||
|
||||
if theme.cnzz_analytics
|
||||
link(rel="preconnect" href="//s4.cnzz.com")
|
||||
|
||||
if theme.cloudflare_analytics
|
||||
link(rel="preconnect" href="//static.cloudflareinsights.com")
|
||||
|
||||
@@ -18,5 +31,5 @@ if theme.microsoft_clarity
|
||||
if theme.blog_title_font && theme.blog_title_font.font_link && theme.blog_title_font.font_link.indexOf('//fonts.googleapis.com') != -1
|
||||
link(rel="preconnect" href="//fonts.googleapis.com" crossorigin='')
|
||||
|
||||
if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv
|
||||
if !theme.asset.busuanzi && (theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv)
|
||||
link(rel="preconnect" href="//busuanzi.ibruce.info")
|
||||
@@ -1,6 +1,6 @@
|
||||
if !theme.disable_top_img && page.top_img !== false
|
||||
if is_post()
|
||||
- var top_img = page.top_img || page.cover || page.randomcover
|
||||
- var top_img = page.top_img || page.cover || theme.default_top_img
|
||||
else if is_page()
|
||||
- var top_img = page.top_img || theme.default_top_img
|
||||
else if is_tag()
|
||||
@@ -17,9 +17,9 @@ if !theme.disable_top_img && page.top_img !== false
|
||||
- var top_img = page.top_img || theme.default_top_img
|
||||
|
||||
if top_img !== false
|
||||
- var imgSource = top_img && top_img.indexOf('/') !== -1 ? `background-image: url('${url_for(top_img)}')` : `background: ${top_img}`
|
||||
- var imgSource = top_img && isImgOrUrl(top_img) ? `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 = page.title || page.tag || page.category || config.title
|
||||
- var isHomeClass = is_home() ? 'full_page' : 'not-home-page'
|
||||
- is_post() ? isHomeClass = 'post-bg' : isHomeClass
|
||||
else
|
||||
@@ -28,7 +28,9 @@ else
|
||||
- var top_img = false
|
||||
- var isHomeClass = 'not-top-img'
|
||||
|
||||
header#page-header(class=isHomeClass style=bg_img)
|
||||
- const isFixedClass = theme.nav.fixed ? ' fixed' : ''
|
||||
|
||||
header#page-header(class=`${isHomeClass+isFixedClass}` style=bg_img)
|
||||
!=partial('includes/header/nav', {}, {cache: true})
|
||||
if top_img !== false
|
||||
if is_post()
|
||||
@@ -42,7 +44,7 @@ header#page-header(class=isHomeClass style=bg_img)
|
||||
span#subtitle
|
||||
if(theme.social)
|
||||
#site_social_icons
|
||||
!=fragment_cache('social', function(){return partial('includes/header/social')})
|
||||
!=partial('includes/header/social', {}, {cache: true})
|
||||
#scroll-down
|
||||
i.fas.fa-angle-down.scroll-down-effects
|
||||
else
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
nav#nav
|
||||
span#blog_name
|
||||
a#site-name(href=url_for('/')) #[=config.title]
|
||||
span#blog-info
|
||||
a(href=url_for('/') title=config.title)
|
||||
if theme.nav.logo
|
||||
img.site-icon(src=url_for(theme.nav.logo))
|
||||
if theme.nav.display_title
|
||||
span.site-name=config.title
|
||||
|
||||
#menus
|
||||
if (theme.algolia_search.enable || theme.local_search.enable)
|
||||
if (theme.algolia_search.enable || theme.local_search.enable || theme.docsearch.enable)
|
||||
#search-button
|
||||
a.site-page.social-icon.search
|
||||
a.site-page.social-icon.search(href="javascript:void(0);")
|
||||
i.fas.fa-search.fa-fw
|
||||
span=' '+_p('search.title')
|
||||
!=partial('includes/header/menu_item', {}, {cache: true})
|
||||
|
||||
#toggle-menu
|
||||
a.site-page
|
||||
a.site-page(href="javascript:void(0);")
|
||||
i.fas.fa-bars.fa-fw
|
||||
|
||||
|
||||
|
||||
@@ -62,23 +62,31 @@
|
||||
block
|
||||
|
||||
- const commentUse = comments.use
|
||||
if commentUse && !comments.lazyload
|
||||
case commentUse[0]
|
||||
when 'Valine'
|
||||
if theme.valine.visitor
|
||||
+pvBlock(url_for(page.path),'leancloud_visitors',page.title)
|
||||
span.leancloud-visitors-count
|
||||
when 'Waline'
|
||||
if theme.waline.pageview
|
||||
+pvBlock('','','')
|
||||
span.waline-pageview-count(data-path=url_for(page.path))
|
||||
when 'Twikoo'
|
||||
if theme.twikoo.visitor
|
||||
+pvBlock('','','')
|
||||
span#twikoo_visitors
|
||||
if page.comments !== false && commentUse && !comments.lazyload
|
||||
if commentUse[0] === 'Valine' && theme.valine.visitor
|
||||
+pvBlock(url_for(page.path),'leancloud_visitors',page.title)
|
||||
span.leancloud-visitors-count
|
||||
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 commentUse[0] === 'Artalk' && theme.artalk.visitor
|
||||
+pvBlock('','','')
|
||||
span#ArtalkPV
|
||||
i.fa-solid.fa-spinner.fa-spin
|
||||
else if theme.busuanzi.page_pv
|
||||
+pvBlock('','post-meta-pv-cv','')
|
||||
span#busuanzi_value_page_pv
|
||||
i.fa-solid.fa-spinner.fa-spin
|
||||
else if theme.busuanzi.page_pv
|
||||
+pvBlock('','post-meta-pv-cv','')
|
||||
span#busuanzi_value_page_pv
|
||||
i.fa-solid.fa-spinner.fa-spin
|
||||
|
||||
if comments.count && !comments.lazyload && page.comments !== false && comments.use
|
||||
- var whichCount = comments.use[0]
|
||||
@@ -93,27 +101,44 @@
|
||||
|
||||
case whichCount
|
||||
when 'Disqus'
|
||||
+countBlock
|
||||
a.disqus-comment-count(href=full_url_for(page.path) + '#post-comment')
|
||||
i.fa-solid.fa-spinner.fa-spin
|
||||
when 'Disqusjs'
|
||||
+countBlock
|
||||
span.disqus-comment-count
|
||||
a(href=full_url_for(page.path) + '#disqus_thread')
|
||||
a.disqusjs-comment-count(href=full_url_for(page.path) + '#post-comment')
|
||||
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(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())
|
||||
when 'Remark42'
|
||||
+countBlock
|
||||
a(href=url_for(page.path) + '#post-comment')
|
||||
span.remark42__counter(data-url=urlNoIndex())
|
||||
i.fa-solid.fa-spinner.fa-spin
|
||||
when 'Artalk'
|
||||
+countBlock
|
||||
a(href=url_for(page.path) + '#post-comment')
|
||||
span#ArtalkCount
|
||||
i.fa-solid.fa-spinner.fa-spin
|
||||
@@ -1,4 +1,4 @@
|
||||
each url, icon in theme.social
|
||||
a.social-icon(href=url_for(trim(url.split('||')[0])) target="_blank"
|
||||
title=url.split('||')[1] === undefined ? '' : trim(url.split('||')[1]))
|
||||
i(class=icon)
|
||||
i(class=icon style=url.split('||')[2] === undefined ? '' : `color: ${trim(url.split('||')[2]).replace(/[\'\"]/g, '')};`)
|
||||
@@ -1,5 +1,5 @@
|
||||
- var htmlClassHideAside = theme.aside.enable && theme.aside.hide ? 'hide-aside' : ''
|
||||
- page.aside = is_archive() ? theme.aside.archives : page.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'
|
||||
|
||||
@@ -8,8 +8,8 @@ html(lang=config.language data-theme=theme.display_mode class=htmlClassHideAside
|
||||
head
|
||||
include ./head.pug
|
||||
body
|
||||
if theme.preloader
|
||||
!=partial('includes/loading/loading', {}, {cache: true})
|
||||
if theme.preloader.enable
|
||||
!=partial('includes/loading/index', {}, {cache: true})
|
||||
|
||||
if theme.background
|
||||
#web_bg
|
||||
@@ -33,7 +33,7 @@ html(lang=config.language data-theme=theme.display_mode class=htmlClassHideAside
|
||||
if (footerBg === true)
|
||||
- var footer_bg = bg_img
|
||||
else
|
||||
- var footer_bg = theme.footer_bg.indexOf('/') !== -1 ? `background-image: url('${url_for(footerBg)}')` : `background: ${footerBg}`
|
||||
- var footer_bg = isImgOrUrl(theme.footer_bg) ? `background-image: url('${url_for(footerBg)}')` : `background: ${footerBg}`
|
||||
else
|
||||
- var footer_bg = ''
|
||||
|
||||
@@ -44,5 +44,4 @@ html(lang=config.language data-theme=theme.display_mode class=htmlClassHideAside
|
||||
include ./404.pug
|
||||
|
||||
include ./rightside.pug
|
||||
!=partial('includes/third-party/search/index', {}, {cache: true})
|
||||
include ./additional-js.pug
|
||||
33
layout/includes/loading/fullpage-loading.pug
Normal file
33
layout/includes/loading/fullpage-loading.pug
Normal file
@@ -0,0 +1,33 @@
|
||||
#loading-box
|
||||
.loading-left-bg
|
||||
.loading-right-bg
|
||||
.spinner-box
|
||||
.configure-border-1
|
||||
.configure-core
|
||||
.configure-border-2
|
||||
.configure-core
|
||||
.loading-word= _p('loading')
|
||||
|
||||
script.
|
||||
(()=>{
|
||||
const $loadingBox = document.getElementById('loading-box')
|
||||
const $body = document.body
|
||||
const preloader = {
|
||||
endLoading: () => {
|
||||
$body.style.overflow = ''
|
||||
$loadingBox.classList.add('loaded')
|
||||
},
|
||||
initLoading: () => {
|
||||
$body.style.overflow = 'hidden'
|
||||
$loadingBox.classList.remove('loaded')
|
||||
}
|
||||
}
|
||||
|
||||
preloader.initLoading()
|
||||
window.addEventListener('load',() => { preloader.endLoading() })
|
||||
|
||||
if (!{theme.pjax && theme.pjax.enable}) {
|
||||
document.addEventListener('pjax:send', () => { preloader.initLoading() })
|
||||
document.addEventListener('pjax:complete', () => { preloader.endLoading() })
|
||||
}
|
||||
})()
|
||||
4
layout/includes/loading/index.pug
Normal file
4
layout/includes/loading/index.pug
Normal file
@@ -0,0 +1,4 @@
|
||||
if theme.preloader.source === 1
|
||||
include ./fullpage-loading.pug
|
||||
else
|
||||
include ./pace.pug
|
||||
@@ -1,13 +0,0 @@
|
||||
script.
|
||||
var preloader = {
|
||||
endLoading: () => {
|
||||
document.body.style.overflow = 'auto';
|
||||
document.getElementById('loading-box').classList.add("loaded")
|
||||
},
|
||||
initLoading: () => {
|
||||
document.body.style.overflow = '';
|
||||
document.getElementById('loading-box').classList.remove("loaded")
|
||||
|
||||
}
|
||||
}
|
||||
window.addEventListener('load',preloader.endLoading())
|
||||
@@ -1,9 +0,0 @@
|
||||
#loading-box
|
||||
.loading-left-bg
|
||||
.loading-right-bg
|
||||
.spinner-box
|
||||
.configure-border-1
|
||||
.configure-core
|
||||
.configure-border-2
|
||||
.configure-core
|
||||
.loading-word= _p('loading')
|
||||
11
layout/includes/loading/pace.pug
Normal file
11
layout/includes/loading/pace.pug
Normal file
@@ -0,0 +1,11 @@
|
||||
script.
|
||||
window.paceOptions = {
|
||||
restartOnPushState: false
|
||||
}
|
||||
|
||||
document.addEventListener('pjax:send', () => {
|
||||
Pace.restart()
|
||||
})
|
||||
|
||||
link(rel="stylesheet", href=url_for(theme.preloader.pace_css_url || theme.asset.pace_default_css))
|
||||
script(src=url_for(theme.asset.pace_js))
|
||||
@@ -11,7 +11,10 @@ mixin articleSort(posts)
|
||||
.article-sort-item(class=no_cover)
|
||||
if article.cover && theme.cover.archives_enable
|
||||
a.article-sort-item-img(href=url_for(article.path) title=title)
|
||||
img(src=url_for(article.cover) alt=title onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'`)
|
||||
if article.cover_type === 'img'
|
||||
img(src=url_for(article.cover) alt=title onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'`)
|
||||
else
|
||||
div(style=`background: ${article.cover}`)
|
||||
.article-sort-item-info
|
||||
.article-sort-item-time
|
||||
i.far.fa-calendar-alt
|
||||
|
||||
@@ -5,7 +5,7 @@ mixin postUI(posts)
|
||||
let link = article.link || article.path
|
||||
let title = article.title || _p('no_title')
|
||||
const position = theme.cover.position
|
||||
let leftOrRight = position === 'both'
|
||||
let leftOrRight = position === 'both'
|
||||
? index%2 == 0 ? 'left' : 'right'
|
||||
: position === 'left' ? 'left' : 'right'
|
||||
let post_cover = article.cover
|
||||
@@ -14,15 +14,16 @@ mixin postUI(posts)
|
||||
if post_cover && theme.cover.index_enable
|
||||
.post_cover(class=leftOrRight)
|
||||
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)
|
||||
if article.cover_type === 'img'
|
||||
img.post-bg(src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title)
|
||||
else
|
||||
div.post-bg(style=`background: ${post_cover}`)
|
||||
.recent-post-info(class=no_cover)
|
||||
a.article-title(href=url_for(link) title=title)= title
|
||||
.article-meta-wrap
|
||||
a.article-title(href=url_for(link) title=title)
|
||||
if (is_home() && (article.top || article.sticky > 0))
|
||||
span.article-meta
|
||||
i.fas.fa-thumbtack.sticky
|
||||
span.sticky= _p('sticky')
|
||||
span.article-meta-separator |
|
||||
i.fas.fa-thumbtack.sticky
|
||||
= title
|
||||
.article-meta-wrap
|
||||
if (theme.post_meta.page.date_type)
|
||||
span.post-meta-date
|
||||
if (theme.post_meta.page.date_type === 'both')
|
||||
@@ -44,16 +45,16 @@ mixin postUI(posts)
|
||||
if (theme.post_meta.page.categories && article.categories.data.length > 0)
|
||||
span.article-meta
|
||||
span.article-meta-separator |
|
||||
i.fas.fa-inbox
|
||||
each item, index in article.categories.data
|
||||
i.fas.fa-inbox
|
||||
a(href=url_for(item.path)).article-meta__categories #[=item.name]
|
||||
if (index < article.categories.data.length - 1)
|
||||
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 |
|
||||
i.fas.fa-tag
|
||||
each item, index in article.tags.data
|
||||
i.fas.fa-tag
|
||||
a(href=url_for(item.path)).article-meta__tags #[=item.name]
|
||||
if (index < article.tags.data.length - 1)
|
||||
span.article-meta-link #[='•']
|
||||
@@ -67,27 +68,41 @@ mixin postUI(posts)
|
||||
block
|
||||
span.article-meta-label= ' ' + _p('card_post_count')
|
||||
|
||||
if theme.comments.card_post_count
|
||||
if theme.comments.card_post_count && theme.comments.use
|
||||
case theme.comments.use[0]
|
||||
when 'Disqus'
|
||||
when 'Disqusjs'
|
||||
+countBlockInIndex
|
||||
a(href=full_url_for(link) + '#disqus_thread')
|
||||
a.disqus-count(href=full_url_for(link) + '#post-comment')
|
||||
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))
|
||||
span.waline-comment-count(data-path=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))
|
||||
when 'Remark42'
|
||||
+countBlockInIndex
|
||||
a(href=url_for(link) + '#post-comment')
|
||||
span.remark42__counter(data-url=urlNoIndex(article.permalink))
|
||||
i.fa-solid.fa-spinner.fa-spin
|
||||
when 'Artalk'
|
||||
+countBlockInIndex
|
||||
a(href=url_for(link) + '#post-comment')
|
||||
span.artalk-count(data-page-key=url_for(link))
|
||||
i.fa-solid.fa-spinner.fa-spin
|
||||
|
||||
//- Display the article introduction on homepage
|
||||
case theme.index_post_content.method
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#article-container
|
||||
.flink
|
||||
if page.flink_url
|
||||
- let { content, random, flink_url } = page
|
||||
- let pageContent = content
|
||||
|
||||
if flink_url || random
|
||||
- const linkData = flink_url ? false : site.data.link || false
|
||||
script.
|
||||
(()=>{
|
||||
const replaceSymbol = (str) => {
|
||||
@@ -8,34 +12,45 @@
|
||||
}
|
||||
|
||||
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>`
|
||||
}
|
||||
const add = (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>` : ""
|
||||
|
||||
result += `${className}${classDesc} <div class="flink-list">${listResult}</div>`
|
||||
let listResult = ""
|
||||
const lists = str[i].link_list
|
||||
if (!{random === true}) {
|
||||
lists.sort(() => Math.random() - 0.5)
|
||||
}
|
||||
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>`
|
||||
}
|
||||
|
||||
document.querySelector(".flink").insertAdjacentHTML("afterbegin", result)
|
||||
})
|
||||
result += `${className}${classDesc} <div class="flink-list">${listResult}</div>`
|
||||
}
|
||||
|
||||
document.querySelector(".flink").insertAdjacentHTML("afterbegin", result)
|
||||
window.lazyLoadInstance && window.lazyLoadInstance.update()
|
||||
}
|
||||
|
||||
const linkData = !{JSON.stringify(linkData)}
|
||||
if (!{Boolean(flink_url)}) {
|
||||
fetch("!{url_for(flink_url)}")
|
||||
.then(response => response.json())
|
||||
.then(add)
|
||||
} else if (linkData) {
|
||||
add(linkData)
|
||||
}
|
||||
})()
|
||||
|
||||
else
|
||||
@@ -63,6 +78,5 @@
|
||||
|
||||
- result += `${className}${classDesc} <div class="flink-list">${listResult}</div>`
|
||||
|
||||
- page.content = result + page.content
|
||||
!= page.content
|
||||
|
||||
- pageContent = result + pageContent
|
||||
!= pageContent
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
.tag-cloud-list.is-center
|
||||
!=cloudTags({source: site.tags, minfontsize: 1.2, maxfontsize: 2.1, limit: 0, unit: 'em'})
|
||||
!=cloudTags({source: site.tags, orderby: page.orderby || 'random', order: page.order || 1, minfontsize: 1.2, maxfontsize: 2.1, limit: 0, unit: 'em'})
|
||||
@@ -13,19 +13,23 @@ if is_post()
|
||||
if(prev)
|
||||
- var hasPageNext = next ? 'pull-left' : 'pull-full'
|
||||
.prev-post(class=hasPageNext)
|
||||
- var pagination_cover = prev.cover === false ? prev.randomcover : prev.cover
|
||||
a(href=url_for(prev.path))
|
||||
img.prev-cover(src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of previous post')
|
||||
a(href=url_for(prev.path) title=prev.title)
|
||||
if prev.cover_type === 'img'
|
||||
img.cover(src=url_for(prev.cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of previous post')
|
||||
else
|
||||
.cover(style=`background: ${prev.cover || 'var(--default-bg-color)'}`)
|
||||
.pagination-info
|
||||
.label=_p('pagination.prev')
|
||||
.prev_info=prev.title
|
||||
|
||||
if(next)
|
||||
- var hasPagePrev = prev ? 'pull-right' : 'pull-full'
|
||||
- var pagination_cover = next.cover == false ? next.randomcover : next.cover
|
||||
.next-post(class=hasPagePrev)
|
||||
a(href=url_for(next.path))
|
||||
img.next-cover(src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of next post')
|
||||
a(href=url_for(next.path) title=next.title)
|
||||
if next.cover_type === 'img'
|
||||
img.cover(src=url_for(next.cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` alt='cover of next post')
|
||||
else
|
||||
.cover(style=`background: ${next.cover || 'var(--default-bg-color)'}`)
|
||||
.pagination-info
|
||||
.label=_p('pagination.next')
|
||||
.next_info=next.title
|
||||
|
||||
@@ -5,13 +5,19 @@ if theme.post_copyright.enable && page.copyright !== false
|
||||
- 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') + ": "
|
||||
span.post-copyright-meta
|
||||
i.fas.fa-circle-user.fa-fw
|
||||
= _p('post.copyright.author') + ": "
|
||||
span.post-copyright-info
|
||||
a(href=authorHref)=author
|
||||
.post-copyright__type
|
||||
span.post-copyright-meta= _p('post.copyright.link') + ": "
|
||||
span.post-copyright-meta
|
||||
i.fas.fa-square-arrow-up-right.fa-fw
|
||||
= _p('post.copyright.link') + ": "
|
||||
span.post-copyright-info
|
||||
a(href=url_for(url))= theme.post_copyright.decode ? decodeURI(url) : url
|
||||
.post-copyright__notice
|
||||
span.post-copyright-meta= _p('post.copyright.copyright_notice') + ": "
|
||||
span.post-copyright-meta
|
||||
i.fas.fa-circle-exclamation.fa-fw
|
||||
= _p('post.copyright.copyright_notice') + ": "
|
||||
span.post-copyright-info!= info
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.post-reward
|
||||
.reward-button
|
||||
i.fas.fa-qrcode
|
||||
= ' ' + _p('donate')
|
||||
= theme.reward.text || _p('donate')
|
||||
.reward-main
|
||||
ul.reward-all
|
||||
each item in theme.reward.QR_code
|
||||
|
||||
@@ -23,7 +23,7 @@ mixin rightsideItem(array)
|
||||
i.fas.fa-list-ul
|
||||
when 'chat'
|
||||
if chat_btn
|
||||
button#chat_btn(type="button" title=_p("rightside.chat"))
|
||||
button#chat-btn(type="button" title=_p("rightside.chat"))
|
||||
i.fas.fa-sms
|
||||
when 'comment'
|
||||
if commentsJsLoad
|
||||
@@ -42,19 +42,20 @@ mixin rightsideItem(array)
|
||||
#rightside-config-show
|
||||
if enable
|
||||
if hide
|
||||
button#rightside_config(type="button" title=_p("rightside.setting"))
|
||||
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"))
|
||||
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"))
|
||||
button#rightside-config(type="button" title=_p("rightside.setting"))
|
||||
i.fas.fa-cog.fa-spin
|
||||
|
||||
if showArray
|
||||
+rightsideItem(showArray)
|
||||
|
||||
button#go-up(type="button" title=_p("rightside.back_to_top"))
|
||||
span.scroll-percent
|
||||
i.fas.fa-arrow-up
|
||||
@@ -14,5 +14,5 @@
|
||||
.headline= _p('aside.categories')
|
||||
.length-num= site.categories.length
|
||||
|
||||
hr
|
||||
hr.custom-hr
|
||||
!=partial('includes/header/menu_item', {}, {cache: true})
|
||||
|
||||
15
layout/includes/third-party/abcjs/abcjs.pug
vendored
Normal file
15
layout/includes/third-party/abcjs/abcjs.pug
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
script.
|
||||
(() => {
|
||||
const abcjsInit = () => {
|
||||
const abcjsFn = () => {
|
||||
document.querySelectorAll(".abc-music-sheet").forEach(ele => {
|
||||
ABCJS.renderAbc(ele, ele.innerHTML, {responsive: 'resize'})
|
||||
})
|
||||
}
|
||||
|
||||
typeof ABCJS === 'object' ? abcjsFn()
|
||||
: getScript('!{url_for(theme.asset.abcjs_basic_js)}').then(abcjsFn)
|
||||
}
|
||||
|
||||
window.pjax ? abcjsInit() : window.addEventListener('load', abcjsInit)
|
||||
})()
|
||||
6
layout/includes/third-party/abcjs/index.pug
vendored
Normal file
6
layout/includes/third-party/abcjs/index.pug
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
if theme.abcjs && theme.abcjs.enable
|
||||
if theme.abcjs.per_page
|
||||
if is_post() || is_page()
|
||||
include ./abcjs.pug
|
||||
else if page.abcjs
|
||||
include ./abcjs.pug
|
||||
31
layout/includes/third-party/card-post-count/artalk.pug
vendored
Normal file
31
layout/includes/third-party/card-post-count/artalk.pug
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
- const { server, site } = theme.artalk
|
||||
|
||||
script.
|
||||
(() => {
|
||||
const getArtalkCount = async() => {
|
||||
try {
|
||||
const eleGroup = document.querySelectorAll('#recent-posts .artalk-count')
|
||||
const keyArray = Array.from(eleGroup).map(i => i.getAttribute('data-page-key'))
|
||||
|
||||
const headerList = {
|
||||
method: 'GET',
|
||||
}
|
||||
|
||||
const searchParams = new URLSearchParams({
|
||||
'site_name': '!{site}',
|
||||
'page_keys': keyArray
|
||||
})
|
||||
|
||||
const res = await fetch(`!{server}/api/v2/stats/page_comment?${searchParams}`, headerList)
|
||||
const result = await res.json()
|
||||
|
||||
keyArray.forEach((key, index) => {
|
||||
eleGroup[index].textContent = result.data[key] || 0
|
||||
})
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
window.pjax ? getArtalkCount() : window.addEventListener('load', getArtalkCount)
|
||||
})()
|
||||
@@ -1,16 +1,25 @@
|
||||
- const { shortname, apikey } = theme.disqus
|
||||
script.
|
||||
(() => {
|
||||
const getCount = () => {
|
||||
if (window.DISQUSWIDGETS === undefined) {
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = 'https://!{theme.disqus.shortname}.disqus.com/count.js';
|
||||
s.id = 'dsq-count-scr';
|
||||
(d.head || d.body).appendChild(s);
|
||||
} else {
|
||||
DISQUSWIDGETS.getCount({reset: true});
|
||||
const getCount = async () => {
|
||||
try {
|
||||
const eleGroup = document.querySelectorAll('#recent-posts .disqus-count')
|
||||
const cleanedLinks = Array.from(eleGroup).map(i => `thread:link=${i.href.replace(/#post-comment$/, '')}`);
|
||||
|
||||
const res = await fetch(`https://disqus.com/api/3.0/threads/set.json?forum=!{shortname}&api_key=!{apikey}&${cleanedLinks.join('&')}`,{
|
||||
method: 'GET'
|
||||
})
|
||||
const result = await res.json()
|
||||
|
||||
eleGroup.forEach(i => {
|
||||
const cleanedLink = i.href.replace(/#post-comment$/, '')
|
||||
const urlData = result.response.find(data => data.link === cleanedLink) || { posts: 0 }
|
||||
i.textContent = urlData.posts
|
||||
})
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
window.pjax ? getCount() : window.addEventListener('load', getCount)
|
||||
|
||||
})()
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
- const fbSDKVer = 'v16.0'
|
||||
- const fbSDK = theme.messenger.enable ? `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk/xfbml.customerchat.js#xfbml=1&version=${fbSDKVer}` : `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk.js#xfbml=1&version=${fbSDKVer}`
|
||||
|
||||
script.
|
||||
(()=>{
|
||||
function loadFBComment () {
|
||||
if (typeof FB === 'object') FB.XFBML.parse()
|
||||
if (typeof FB === 'object') FB.XFBML.parse(document.getElementById('recent-posts'))
|
||||
else {
|
||||
let ele = document.createElement('script')
|
||||
ele.setAttribute('src','https://connect.facebook.net/!{theme.facebook_comments.lang}/sdk.js#xfbml=1&version=v9.0')
|
||||
ele.setAttribute('src','!{fbSDK}')
|
||||
ele.setAttribute('async', 'true')
|
||||
ele.setAttribute('defer', 'true')
|
||||
ele.setAttribute('crossorigin', 'anonymous')
|
||||
|
||||
@@ -9,4 +9,8 @@ case theme.comments.use[0]
|
||||
when 'Waline'
|
||||
include ./waline.pug
|
||||
when 'Facebook Comments'
|
||||
include ./fb.pug
|
||||
include ./fb.pug
|
||||
when 'Remark42'
|
||||
include ./remark42.pug
|
||||
when 'Artalk'
|
||||
include ./artalk.pug
|
||||
18
layout/includes/third-party/card-post-count/remark42.pug
vendored
Normal file
18
layout/includes/third-party/card-post-count/remark42.pug
vendored
Normal 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)
|
||||
})()
|
||||
@@ -18,7 +18,7 @@ script.
|
||||
includeReply: false
|
||||
}).then(function (res) {
|
||||
document.querySelectorAll('#recent-posts .twikoo-count').forEach((item,index) => {
|
||||
item.innerText = res[index].count
|
||||
item.textContent = res[index].count
|
||||
})
|
||||
}).catch(function (err) {
|
||||
console.log(err)
|
||||
@@ -28,7 +28,7 @@ script.
|
||||
if (typeof twikoo === 'object') {
|
||||
runTwikoo()
|
||||
} else {
|
||||
getScript('!{theme.asset.twikoo}').then(runTwikoo)
|
||||
getScript('!{url_for(theme.asset.twikoo)}').then(runTwikoo)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ script.
|
||||
el: '#vcomment',
|
||||
appId: '#{theme.valine.appId}',
|
||||
appKey: '#{theme.valine.appKey}',
|
||||
serverURLs: '#{theme.valine.serverURLs}'
|
||||
}
|
||||
|
||||
const valine = new Valine(initData)
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
- const serverURL = theme.waline.serverURL.replace(/\/$/, '')
|
||||
script.
|
||||
(() => {
|
||||
function loadWaline () {
|
||||
function initWaline () {
|
||||
let initData = {
|
||||
el: null,
|
||||
serverURL: '!{theme.waline.serverURL}',
|
||||
comment: true
|
||||
}
|
||||
const waline = Waline.init(initData)
|
||||
}
|
||||
async function loadWaline () {
|
||||
try {
|
||||
const eleGroup = document.querySelectorAll('#recent-posts .waline-comment-count')
|
||||
const keyArray = Array.from(eleGroup).map(i => i.getAttribute('data-path'))
|
||||
|
||||
if (typeof Waline === 'function') initWaline()
|
||||
else getScript('!{url_for(theme.asset.waline_js)}').then(initWaline)
|
||||
const res = await fetch(`!{serverURL}/api/comment?type=count&url=${keyArray}`, { method: 'GET' })
|
||||
const result = await res.json()
|
||||
|
||||
result.data.forEach((count, index) => {
|
||||
eleGroup[index].textContent = count
|
||||
})
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
window.pjax ? loadWaline() : window.addEventListener('load', loadWaline)
|
||||
|
||||
63
layout/includes/third-party/chat/chatra.pug
vendored
63
layout/includes/third-party/chat/chatra.pug
vendored
@@ -1,33 +1,50 @@
|
||||
//- https://chatra.io/help/api/
|
||||
script.
|
||||
(function(d, w, c) {
|
||||
w.ChatraID = '#{theme.chatra.id}';
|
||||
var s = d.createElement('script');
|
||||
w[c] = w[c] || function() {
|
||||
(w[c].q = w[c].q || []).push(arguments);
|
||||
};
|
||||
s.async = true;
|
||||
s.src = 'https://call.chatra.io/chatra.js';
|
||||
if (d.head) d.head.appendChild(s);
|
||||
})(document, window, 'Chatra');
|
||||
(() => {
|
||||
const isChatBtn = !{theme.chat_btn}
|
||||
const isChatHideShow = !{theme.chat_hide_show}
|
||||
|
||||
if (!{theme.chat_btn}) {
|
||||
var chatBtnFn = () => {
|
||||
var chatBtn = document.getElementById("chat_btn")
|
||||
chatBtn.addEventListener("click", function(){
|
||||
Chatra('openChat')
|
||||
});
|
||||
}
|
||||
chatBtnFn()
|
||||
} else {
|
||||
if (!{theme.chat_hide_show}) {
|
||||
function chatBtnHide () {
|
||||
if (isChatBtn) {
|
||||
const close = () => {
|
||||
Chatra('minimizeWidget')
|
||||
Chatra('hide')
|
||||
}
|
||||
function chatBtnShow () {
|
||||
|
||||
const open = () => {
|
||||
Chatra('openChat', true)
|
||||
Chatra('show')
|
||||
}
|
||||
|
||||
window.ChatraSetup = {
|
||||
startHidden: true
|
||||
}
|
||||
|
||||
window.chatBtnFn = () => {
|
||||
const isShow = document.getElementById('chatra').classList.contains('chatra--expanded')
|
||||
isShow ? close() : open()
|
||||
}
|
||||
} else if (isChatHideShow) {
|
||||
window.chatBtn = {
|
||||
hide: () => {
|
||||
Chatra('hide')
|
||||
},
|
||||
show: () => {
|
||||
Chatra('show')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(function(d, w, c) {
|
||||
w.ChatraID = '#{theme.chatra.id}'
|
||||
var s = d.createElement('script')
|
||||
w[c] = w[c] || function() {
|
||||
(w[c].q = w[c].q || []).push(arguments)
|
||||
}
|
||||
s.async = true
|
||||
s.src = 'https://call.chatra.io/chatra.js'
|
||||
if (d.head) d.head.appendChild(s)
|
||||
})(document, window, 'Chatra')
|
||||
|
||||
})()
|
||||
|
||||
|
||||
|
||||
63
layout/includes/third-party/chat/crisp.pug
vendored
63
layout/includes/third-party/chat/crisp.pug
vendored
@@ -1,36 +1,45 @@
|
||||
script.
|
||||
window.$crisp = [];
|
||||
window.CRISP_WEBSITE_ID = "!{theme.crisp.website_id}";
|
||||
(function () {
|
||||
d = document;
|
||||
s = d.createElement("script");
|
||||
s.src = "https://client.crisp.chat/l.js";
|
||||
s.async = 1;
|
||||
d.getElementsByTagName("head")[0].appendChild(s);
|
||||
})();
|
||||
$crisp.push(["safe", true])
|
||||
(() => {
|
||||
window.$crisp = [];
|
||||
window.CRISP_WEBSITE_ID = "!{theme.crisp.website_id}";
|
||||
(function () {
|
||||
d = document;
|
||||
s = d.createElement("script");
|
||||
s.src = "https://client.crisp.chat/l.js";
|
||||
s.async = 1;
|
||||
d.getElementsByTagName("head")[0].appendChild(s);
|
||||
})();
|
||||
$crisp.push(["safe", true])
|
||||
|
||||
if (!{theme.chat_btn}) {
|
||||
$crisp.push(["do", "chat:hide"])
|
||||
$crisp.push(["on", "chat:closed", function() {
|
||||
$crisp.push(["do", "chat:hide"])
|
||||
}])
|
||||
var chatBtnFn = () => {
|
||||
var chatBtn = document.getElementById("chat_btn")
|
||||
chatBtn.addEventListener("click", function(){
|
||||
const isChatBtn = !{theme.chat_btn}
|
||||
const isChatHideShow = !{theme.chat_hide_show}
|
||||
|
||||
if (isChatBtn) {
|
||||
const open = () => {
|
||||
$crisp.push(["do", "chat:show"])
|
||||
$crisp.push(["do", "chat:open"])
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
chatBtnFn()
|
||||
} else {
|
||||
if (!{theme.chat_hide_show}) {
|
||||
function chatBtnHide () {
|
||||
const close = () => {
|
||||
$crisp.push(["do", "chat:hide"])
|
||||
}
|
||||
function chatBtnShow () {
|
||||
$crisp.push(["do", "chat:show"])
|
||||
|
||||
close()
|
||||
$crisp.push(["on", "chat:closed", function() {
|
||||
close()
|
||||
}])
|
||||
|
||||
window.chatBtnFn = () => {
|
||||
$crisp.is("chat:visible") ? close() : open()
|
||||
}
|
||||
} else if (isChatHideShow) {
|
||||
window.chatBtn = {
|
||||
hide: () => {
|
||||
$crisp.push(["do", "chat:hide"])
|
||||
},
|
||||
show: () => {
|
||||
$crisp.push(["do", "chat:show"])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})()
|
||||
66
layout/includes/third-party/chat/daovoice.pug
vendored
66
layout/includes/third-party/chat/daovoice.pug
vendored
@@ -1,40 +1,40 @@
|
||||
//- https://guide.daocloud.io/daovoice/javascript-api-5869833.html
|
||||
script.
|
||||
(function(i,s,o,g,r,a,m){i["DaoVoiceObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;a.charset="utf-8";m.parentNode.insertBefore(a,m)})(window,document,"script",('https:' == document.location.protocol ? 'https:' : 'http:') + "//widget.daovoice.io/widget/!{theme.daovoice.app_id}.js","daovoice")
|
||||
(() => {
|
||||
(function(i,s,o,g,r,a,m){i["DaoVoiceObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;a.charset="utf-8";m.parentNode.insertBefore(a,m)})(window,document,"script",('https:' == document.location.protocol ? 'https:' : 'http:') + "//widget.daovoice.io/widget/!{theme.daovoice.app_id}.js","daovoice")
|
||||
|
||||
script.
|
||||
var isChatBtn = !{theme.chat_btn}
|
||||
daovoice('init', {
|
||||
app_id: '!{theme.daovoice.app_id}',},{
|
||||
launcher: {
|
||||
disableLauncherIcon: isChatBtn // 悬浮 ICON 是否显示
|
||||
},
|
||||
});
|
||||
daovoice('update');
|
||||
const isChatBtn = !{theme.chat_btn}
|
||||
const isChatHideShow = !{theme.chat_hide_show}
|
||||
|
||||
if (isChatBtn) {
|
||||
var chatBtnFn = () => {
|
||||
var chatBtn = document.getElementById("chat_btn")
|
||||
chatBtn.addEventListener("click", function(){
|
||||
daovoice('show')
|
||||
});
|
||||
}
|
||||
chatBtnFn()
|
||||
} else {
|
||||
if (!{theme.chat_hide_show}) {
|
||||
function chatBtnHide () {
|
||||
daovoice('update', {},{
|
||||
launcher: {
|
||||
disableLauncherIcon: true // 悬浮 ICON 是否显示
|
||||
},
|
||||
});
|
||||
daovoice('init', {
|
||||
app_id: '!{theme.daovoice.app_id}',},{
|
||||
launcher: {
|
||||
disableLauncherIcon: isChatBtn
|
||||
},
|
||||
});
|
||||
daovoice('update');
|
||||
|
||||
if (isChatBtn) {
|
||||
window.chatBtnFn = () => {
|
||||
const isShow = document.getElementById('daodream-messenger').classList.contains('daodream-messenger-active')
|
||||
isShow ? daovoice('hide') : daovoice('show')
|
||||
}
|
||||
function chatBtnShow () {
|
||||
daovoice('update', {},{
|
||||
launcher: {
|
||||
disableLauncherIcon: false // 悬浮 ICON 是否显示
|
||||
},
|
||||
});
|
||||
} else if (isChatHideShow) {
|
||||
window.chatBtn = {
|
||||
hide: () => {
|
||||
daovoice('update', {},{
|
||||
launcher: {
|
||||
disableLauncherIcon: true
|
||||
}
|
||||
})
|
||||
},
|
||||
show: () => {
|
||||
daovoice('update', {}, {
|
||||
launcher: {
|
||||
disableLauncherIcon: false
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})()
|
||||
43
layout/includes/third-party/chat/gitter.pug
vendored
43
layout/includes/third-party/chat/gitter.pug
vendored
@@ -1,43 +0,0 @@
|
||||
if theme.chat_btn
|
||||
script.
|
||||
((window.gitter = {}).chat = {}).options = {
|
||||
disableDefaultChat: true,
|
||||
};
|
||||
document.addEventListener('gitter-sidecar-ready', (e) => {
|
||||
const GitterChat = e.detail.Chat
|
||||
let chat
|
||||
|
||||
function initGitter () {
|
||||
chat = new GitterChat({
|
||||
room: '#{theme.gitter.room}',
|
||||
activationElement: '#chat_btn'
|
||||
});
|
||||
}
|
||||
|
||||
initGitter()
|
||||
|
||||
if (!{theme.pjax.enable}) {
|
||||
document.addEventListener('pjax:complete', () => {
|
||||
chat.destroy()
|
||||
initGitter()
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
else
|
||||
script.
|
||||
((window.gitter = {}).chat = {}).options = {
|
||||
room: '#{theme.gitter.room}',
|
||||
};
|
||||
|
||||
if (!{theme.chat_hide_show}) {
|
||||
function chatBtnHide () {
|
||||
document.getElementsByClassName('gitter-open-chat-button')[0].style.display= 'none'
|
||||
}
|
||||
|
||||
function chatBtnShow () {
|
||||
document.getElementsByClassName('gitter-open-chat-button')[0].style.display= 'block'
|
||||
}
|
||||
}
|
||||
|
||||
script(src="https://sidecar.gitter.im/dist/sidecar.v1.js" async defer)
|
||||
6
layout/includes/third-party/chat/index.pug
vendored
6
layout/includes/third-party/chat/index.pug
vendored
@@ -4,7 +4,7 @@ else if theme.tidio && theme.tidio.enable
|
||||
include ./tidio.pug
|
||||
else if theme.daovoice && theme.daovoice.enable
|
||||
include ./daovoice.pug
|
||||
else if theme.gitter && theme.gitter.enable
|
||||
include ./gitter.pug
|
||||
else if theme.crisp && theme.crisp.enable
|
||||
include ./crisp.pug
|
||||
include ./crisp.pug
|
||||
else if theme.messenger && theme.messenger.enable
|
||||
include ./messenger.pug
|
||||
44
layout/includes/third-party/chat/messenger.pug
vendored
Normal file
44
layout/includes/third-party/chat/messenger.pug
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
- let { pageID, lang } = theme.messenger
|
||||
- lang = theme.comments.use && theme.comments.use.includes('Facebook Comments') ? theme.facebook_comments.lang : lang
|
||||
|
||||
#fb-customer-chat.fb-customerchat(page_id=pageID attribution='biz_inbox')
|
||||
|
||||
script.
|
||||
(() => {
|
||||
document.getElementById('fb-root') ? '' : document.body.insertAdjacentHTML('afterend', '<div id="fb-root"></div>')
|
||||
|
||||
window.fbAsyncInit = function() {
|
||||
FB.init({
|
||||
xfbml: true,
|
||||
version: 'v16.0'
|
||||
});
|
||||
};
|
||||
|
||||
(function(d, s, id) {
|
||||
var js, fjs = d.getElementsByTagName(s)[0];
|
||||
if (d.getElementById(id)) return;
|
||||
js = d.createElement(s); js.id = id;
|
||||
js.src = 'https://connect.facebook.net/!{lang}/sdk/xfbml.customerchat.js';
|
||||
fjs.parentNode.insertBefore(js, fjs);
|
||||
}(document, 'script', 'facebook-jssdk'));
|
||||
|
||||
const isChatBtn = !{theme.chat_btn}
|
||||
const isChatHideShow = !{theme.chat_hide_show}
|
||||
|
||||
if (isChatBtn) {
|
||||
window.chatBtnFn = () => {
|
||||
const isShow = document.querySelector('.fb_customer_chat_bounce_in_v2')
|
||||
isShow ? FB.CustomerChat.hide() : FB.CustomerChat.show()
|
||||
}
|
||||
} else if (isChatHideShow) {
|
||||
window.chatBtn = {
|
||||
hide: () => {
|
||||
FB.CustomerChat.hide()
|
||||
},
|
||||
show: () => {
|
||||
FB.CustomerChat.show(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
})()
|
||||
|
||||
72
layout/includes/third-party/chat/tidio.pug
vendored
72
layout/includes/third-party/chat/tidio.pug
vendored
@@ -1,41 +1,45 @@
|
||||
script(src=`//code.tidio.co/${theme.tidio.public_key}.js` async)
|
||||
script.
|
||||
(() => {
|
||||
const isChatBtn = !{theme.chat_btn}
|
||||
const isChatHideShow = !{theme.chat_hide_show}
|
||||
|
||||
if theme.chat_btn
|
||||
script.
|
||||
function onTidioChatApiReady() {
|
||||
window.tidioChatApi.hide();
|
||||
window.tidioChatApi.on("close", function() {
|
||||
window.tidioChatApi.hide();
|
||||
});
|
||||
}
|
||||
if (window.tidioChatApi) {
|
||||
window.tidioChatApi.on("ready", onTidioChatApiReady);
|
||||
} else {
|
||||
document.addEventListener("tidioChat-ready", onTidioChatApiReady);
|
||||
}
|
||||
if (isChatBtn) {
|
||||
let isShow = false
|
||||
const close = () => {
|
||||
window.tidioChatApi.hide()
|
||||
isShow = false
|
||||
}
|
||||
|
||||
const open = () => {
|
||||
window.tidioChatApi.open()
|
||||
window.tidioChatApi.show()
|
||||
isShow = true
|
||||
}
|
||||
|
||||
var chatBtnFn = () => {
|
||||
document.getElementById("chat_btn").addEventListener("click", function(){
|
||||
window.tidioChatApi.show();
|
||||
window.tidioChatApi.open();
|
||||
});
|
||||
}
|
||||
chatBtnFn()
|
||||
|
||||
else if theme.chat_hide_show
|
||||
script.
|
||||
function chatBtnHide () {
|
||||
const onTidioChatApiReady = () => {
|
||||
window.tidioChatApi.hide()
|
||||
window.tidioChatApi.on("close", close)
|
||||
}
|
||||
if (window.tidioChatApi) {
|
||||
//- window.tidioChatApi.hide();
|
||||
document.getElementById('tidio-chat').style.display= 'none'
|
||||
window.tidioChatApi.on("ready", onTidioChatApiReady)
|
||||
} else {
|
||||
document.addEventListener("tidioChat-ready", onTidioChatApiReady)
|
||||
}
|
||||
|
||||
window.chatBtnFn = () => {
|
||||
if (!window.tidioChatApi) return
|
||||
isShow ? close() : open()
|
||||
}
|
||||
} else if (isChatHideShow) {
|
||||
window.chatBtn = {
|
||||
hide: () => {
|
||||
window.tidioChatApi && window.tidioChatApi.hide()
|
||||
},
|
||||
show: () => {
|
||||
window.tidioChatApi && window.tidioChatApi.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function chatBtnShow () {
|
||||
if (window.tidioChatApi) {
|
||||
//- window.tidioChatApi.show();
|
||||
document.getElementById('tidio-chat').style.display= 'block'
|
||||
}
|
||||
}
|
||||
|
||||
})()
|
||||
|
||||
|
||||
55
layout/includes/third-party/comments/artalk.pug
vendored
Normal file
55
layout/includes/third-party/comments/artalk.pug
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
- const { server, site, option } = theme.artalk
|
||||
- const { use, lazyload } = theme.comments
|
||||
|
||||
script.
|
||||
(() => {
|
||||
let artalkItem = null
|
||||
const initArtalk = () => {
|
||||
artalkItem = Artalk.init(Object.assign({
|
||||
el: '#artalk-wrap',
|
||||
server: '!{server}',
|
||||
site: '!{site}',
|
||||
pageKey: location.pathname,
|
||||
darkMode: document.documentElement.getAttribute('data-theme') === 'dark',
|
||||
},!{JSON.stringify(option)}))
|
||||
|
||||
if (GLOBAL_CONFIG.lightbox === 'null') return
|
||||
artalkItem.on('list-loaded', () => {
|
||||
artalkItem.ctx.get('list').getCommentNodes().forEach(comment => {
|
||||
const $content = comment.getRender().$content
|
||||
btf.loadLightbox($content.querySelectorAll('img:not([atk-emoticon])'))
|
||||
})
|
||||
})
|
||||
|
||||
const destroyArtalk = () => {
|
||||
artalkItem.destroy()
|
||||
}
|
||||
|
||||
btf.addGlobalFn('pjax', destroyArtalk, 'destroyArtalk')
|
||||
}
|
||||
|
||||
const loadArtalk = async () => {
|
||||
if (typeof Artalk === 'object') initArtalk()
|
||||
else {
|
||||
await getCSS('!{theme.asset.artalk_css}')
|
||||
await getScript('!{theme.asset.artalk_js}')
|
||||
initArtalk()
|
||||
}
|
||||
}
|
||||
|
||||
const artalkChangeMode = theme => {
|
||||
const artalkWrap = document.getElementById('artalk-wrap')
|
||||
if (!(artalkWrap && artalkWrap.children.length)) return
|
||||
const isDark = theme === 'dark'
|
||||
artalkItem.setDarkMode(isDark)
|
||||
}
|
||||
|
||||
btf.addGlobalFn('themeChange', artalkChangeMode, 'artalk')
|
||||
|
||||
if ('!{use[0]}' === 'Artalk' || !!{lazyload}) {
|
||||
if (!{lazyload}) btf.loadComment(document.getElementById('artalk-wrap'), loadArtalk)
|
||||
else loadArtalk()
|
||||
} else {
|
||||
window.loadOtherComment = loadArtalk
|
||||
}
|
||||
})()
|
||||
76
layout/includes/third-party/comments/disqus.pug
vendored
76
layout/includes/third-party/comments/disqus.pug
vendored
@@ -1,47 +1,59 @@
|
||||
- let disqusPageTitle = page.title.replace(/'/ig,"\\'")
|
||||
- const disqusPageTitle = page.title.replace(/'/ig,"\\'")
|
||||
- const { shortname, apikey } = theme.disqus
|
||||
- const { use, lazyload, count } = theme.comments
|
||||
|
||||
script.
|
||||
function loadDisqus () {
|
||||
var disqus_config = function () {
|
||||
(() => {
|
||||
const disqus_config = function () {
|
||||
this.page.url = '!{ page.permalink }'
|
||||
this.page.identifier = '!{ page.path }'
|
||||
this.page.identifier = '!{ url_for(page.path) }'
|
||||
this.page.title = '!{ disqusPageTitle }'
|
||||
};
|
||||
}
|
||||
|
||||
window.disqusReset = () => {
|
||||
DISQUS.reset({
|
||||
const disqusReset = () => {
|
||||
window.DISQUS && window.DISQUS.reset({
|
||||
reload: true,
|
||||
config: disqus_config
|
||||
})
|
||||
}
|
||||
|
||||
if (window.DISQUS) disqusReset()
|
||||
else {
|
||||
(function() {
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = 'https://!{theme.disqus.shortname}.disqus.com/embed.js';
|
||||
s.setAttribute('data-timestamp', +new Date());
|
||||
(d.head || d.body).appendChild(s);
|
||||
})();
|
||||
}
|
||||
}
|
||||
btf.addGlobalFn('themeChange', disqusReset, 'disqus')
|
||||
|
||||
if ('!{theme.comments.use[0]}' === 'Disqus' || !!{theme.comments.lazyload}) {
|
||||
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('disqus_thread'), loadDisqus)
|
||||
else loadDisqus()
|
||||
} else {
|
||||
function loadOtherComment () {
|
||||
loadDisqus()
|
||||
const loadDisqus = () =>{
|
||||
if (window.DISQUS) disqusReset()
|
||||
else {
|
||||
const script = document.createElement('script')
|
||||
script.src = 'https://!{shortname}.disqus.com/embed.js'
|
||||
script.setAttribute('data-timestamp', +new Date())
|
||||
document.head.appendChild(script)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if is_post() && !theme.comments.lazyload && theme.comments.count && theme.comments.use[0] === 'Disqus'
|
||||
script.
|
||||
if (window.DISQUSWIDGETS === undefined) {
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = 'https://!{theme.disqus.shortname}.disqus.com/count.js';
|
||||
s.id = 'dsq-count-scr';
|
||||
(d.head || d.body).appendChild(s);
|
||||
const getCount = async() => {
|
||||
try {
|
||||
const eleGroup = document.querySelector('#post-meta .disqus-comment-count')
|
||||
if (!eleGroup) return
|
||||
const cleanedLinks = eleGroup.href.replace(/#post-comment$/, '')
|
||||
|
||||
const res = await fetch(`https://disqus.com/api/3.0/threads/set.json?forum=!{shortname}&api_key=!{apikey}&thread:link=${cleanedLinks}`,{
|
||||
method: 'GET'
|
||||
})
|
||||
const result = await res.json()
|
||||
|
||||
const count = result.response.length ? result.response[0].posts : 0
|
||||
eleGroup.textContent = count
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
if ('!{use[0]}' === 'Disqus' || !!{lazyload}) {
|
||||
if (!{lazyload}) btf.loadComment(document.getElementById('disqus_thread'), loadDisqus)
|
||||
else {
|
||||
loadDisqus()
|
||||
!{ count ? 'GLOBAL_CONFIG_SITE.isPost && getCount()' : '' }
|
||||
}
|
||||
} else {
|
||||
DISQUSWIDGETS.getCount({reset: true});
|
||||
window.loadOtherComment = loadDisqus
|
||||
}
|
||||
})()
|
||||
|
||||
@@ -1,55 +1,64 @@
|
||||
- let disqusjsPageTitle = page.title.replace(/'/ig,"\\'")
|
||||
- const { shortname:dqShortname, apikey:dqApikey, option:dqOption } = theme.disqusjs
|
||||
|
||||
script.
|
||||
function loadDisqusjs () {
|
||||
function addDisqusjsCSS () {
|
||||
const ele = document.createElement('link')
|
||||
ele.rel = 'stylesheet'
|
||||
ele.href= '!{url_for(theme.asset.disqusjs_css)}'
|
||||
document.getElementsByTagName('head')[0].appendChild(ele)
|
||||
}
|
||||
|
||||
function initDisqusjs () {
|
||||
window.DISQUS = null
|
||||
new DisqusJS(Object.assign({
|
||||
shortname: '!{theme.disqusjs.shortname}',
|
||||
identifier: '!{ page.path }',
|
||||
(() => {
|
||||
const initDisqusjs = () => {
|
||||
window.disqusjs = null
|
||||
disqusjs = new DisqusJS(Object.assign({
|
||||
shortname: '!{dqShortname}',
|
||||
identifier: '!{ url_for(page.path) }',
|
||||
url: '!{ page.permalink }',
|
||||
title: '!{ disqusjsPageTitle }',
|
||||
apikey: '!{theme.disqusjs.apikey}',
|
||||
},!{JSON.stringify(theme.disqusjs.option)}))
|
||||
apikey: '!{dqApikey}',
|
||||
},!{JSON.stringify(dqOption)}))
|
||||
|
||||
disqusjs.render(document.getElementById('disqusjs-wrap'))
|
||||
}
|
||||
|
||||
|
||||
window.disqusReset = initDisqusjs
|
||||
|
||||
if (window.disqusJsLoad) initDisqusjs()
|
||||
else {
|
||||
addDisqusjsCSS()
|
||||
getScript('!{url_for(theme.asset.disqusjs)}').then(initDisqusjs)
|
||||
window.disqusJsLoad = true
|
||||
const themeChange = () => {
|
||||
const ele = document.getElementById('disqus_thread')
|
||||
if(!ele) return
|
||||
disqusjs.destroy()
|
||||
initDisqusjs()
|
||||
}
|
||||
}
|
||||
|
||||
if ('!{theme.comments.use[0]}' === 'Disqusjs' || !!{theme.comments.lazyload}) {
|
||||
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('disqus_thread'), loadDisqusjs)
|
||||
else loadDisqusjs()
|
||||
}
|
||||
else {
|
||||
function loadOtherComment () {
|
||||
loadDisqusjs()
|
||||
btf.addGlobalFn('themeChange', themeChange, 'disqusjs')
|
||||
|
||||
const loadDisqusjs = async() => {
|
||||
if (window.disqusJsLoad) initDisqusjs()
|
||||
else {
|
||||
await getCSS('!{url_for(theme.asset.disqusjs_css)}')
|
||||
await getScript('!{url_for(theme.asset.disqusjs)}')
|
||||
initDisqusjs()
|
||||
window.disqusJsLoad = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getCount = async() => {
|
||||
try {
|
||||
const eleGroup = document.querySelector('#post-meta .disqusjs-comment-count')
|
||||
if (!eleGroup) return
|
||||
const cleanedLinks = eleGroup.href.replace(/#post-comment$/, '')
|
||||
|
||||
if is_post() && !theme.comments.lazyload && theme.comments.count && theme.comments.use[0] === 'Disqusjs'
|
||||
script.
|
||||
if (window.DISQUSWIDGETS === undefined) {
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = 'https://!{theme.disqus.shortname}.disqus.com/count.js';
|
||||
s.id = 'dsq-count-scr';
|
||||
(d.head || d.body).appendChild(s);
|
||||
const res = await fetch(`https://disqus.com/api/3.0/threads/set.json?forum=!{dqShortname}&api_key=!{dqApikey}&thread:link=${cleanedLinks}`,{
|
||||
method: 'GET'
|
||||
})
|
||||
const result = await res.json()
|
||||
const count = result.response.length ? result.response[0].posts : 0
|
||||
eleGroup.textContent = count
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
if ('!{theme.comments.use[0]}' === 'Disqusjs' || !!{theme.comments.lazyload}) {
|
||||
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('disqusjs-wrap'), loadDisqusjs)
|
||||
else {
|
||||
loadDisqusjs()
|
||||
!{ theme.comments.count ? 'GLOBAL_CONFIG_SITE.isPost && getCount()' : '' }
|
||||
}
|
||||
} else {
|
||||
DISQUSWIDGETS.getCount({reset: true});
|
||||
window.loadOtherComment = loadDisqusjs
|
||||
}
|
||||
|
||||
})()
|
||||
@@ -1,26 +1,46 @@
|
||||
#fb-root
|
||||
- const fbSDKVer = 'v16.0'
|
||||
- const fbSDK = theme.messenger.enable ? `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk/xfbml.customerchat.js#xfbml=1&version=${fbSDKVer}` : `https://connect.facebook.net/${theme.facebook_comments.lang}/sdk.js#xfbml=1&version=${fbSDKVer}`
|
||||
|
||||
script.
|
||||
function loadFBComment () {
|
||||
var themeNow = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'
|
||||
document.getElementsByClassName('fb-comments')[0].setAttribute('data-colorscheme',themeNow)
|
||||
(()=>{
|
||||
const loadFBComment = () => {
|
||||
document.getElementById('fb-root') ? '' : document.body.insertAdjacentHTML('afterend', '<div id="fb-root"></div>')
|
||||
|
||||
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=v13.0&appId=!{theme.facebook_comments.app_id}&autoLogAppEvents=1')
|
||||
ele.setAttribute('async', 'true')
|
||||
ele.setAttribute('defer', 'true')
|
||||
ele.setAttribute('crossorigin', 'anonymous')
|
||||
document.getElementById('fb-root').insertAdjacentElement('afterbegin',ele)
|
||||
}
|
||||
}
|
||||
const themeNow = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'
|
||||
const $fbComment = document.getElementsByClassName('fb-comments')[0]
|
||||
$fbComment.setAttribute('data-colorscheme',themeNow)
|
||||
$fbComment.setAttribute('data-href', '!{urlNoIndex(page.permalink)}')
|
||||
|
||||
if ('!{theme.comments.use[0]}' === 'Facebook Comments' || !!{theme.comments.lazyload}) {
|
||||
if (!{theme.comments.lazyload}) btf.loadComment(document.querySelector('#post-comment .fb-comments'), loadFBComment)
|
||||
else loadFBComment()
|
||||
} else {
|
||||
function loadOtherComment () {
|
||||
loadFBComment()
|
||||
if (typeof FB === 'object') {
|
||||
FB.XFBML.parse(document.getElementsByClassName('post-meta-commentcount')[0])
|
||||
FB.XFBML.parse(document.getElementById('post-comment'))
|
||||
}
|
||||
else {
|
||||
let ele = document.createElement('script')
|
||||
ele.setAttribute('src','!{fbSDK}')
|
||||
ele.setAttribute('async', 'true')
|
||||
ele.setAttribute('defer', 'true')
|
||||
ele.setAttribute('crossorigin', 'anonymous')
|
||||
ele.setAttribute('id', 'facebook-jssdk')
|
||||
document.getElementById('fb-root').insertAdjacentElement('afterbegin',ele)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const fbModeChange = theme => {
|
||||
const $fbComment = document.getElementsByClassName('fb-comments')[0]
|
||||
if ($fbComment && typeof FB === 'object') {
|
||||
$fbComment.setAttribute('data-colorscheme',theme)
|
||||
FB.XFBML.parse(document.getElementById('post-comment'))
|
||||
}
|
||||
}
|
||||
|
||||
btf.addGlobalFn('themeChange', fbModeChange, 'facebook_comments')
|
||||
|
||||
if ('!{theme.comments.use[0]}' === 'Facebook Comments' || !!{theme.comments.lazyload}) {
|
||||
if (!{theme.comments.lazyload}) btf.loadComment(document.querySelector('#post-comment .fb-comments'), loadFBComment)
|
||||
else loadFBComment()
|
||||
} else {
|
||||
window.loadOtherComment = loadFBComment
|
||||
}
|
||||
})()
|
||||
|
||||
|
||||
93
layout/includes/third-party/comments/giscus.pug
vendored
93
layout/includes/third-party/comments/giscus.pug
vendored
@@ -1,49 +1,54 @@
|
||||
- const { repo, repo_id, category_id, option } = theme.giscus
|
||||
- const themes = theme.giscus.theme
|
||||
- const { repo, repo_id, category_id, theme:themes, option } = theme.giscus
|
||||
- const giscusUrl = theme.asset.giscus || 'https://giscus.app/client.js'
|
||||
- const giscusOriginUrl = new URL(giscusUrl).origin
|
||||
- const { use, lazyload } = theme.comments
|
||||
|
||||
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');
|
||||
(()=>{
|
||||
const getGiscusTheme = theme => {
|
||||
return theme === 'dark' ? '!{themes.dark}' : '!{themes.light}'
|
||||
}
|
||||
|
||||
sendMessage({
|
||||
setConfig: {
|
||||
theme: theme
|
||||
const loadGiscus = () => {
|
||||
const config = Object.assign({
|
||||
src: '!{giscusUrl}',
|
||||
'data-repo': '!{repo}',
|
||||
'data-repo-id': '!{repo_id}',
|
||||
'data-category-id': '!{category_id}',
|
||||
'data-mapping': 'pathname',
|
||||
'data-theme': getGiscusTheme(document.documentElement.getAttribute('data-theme')),
|
||||
'data-reactions-enabled': '1',
|
||||
crossorigin: 'anonymous',
|
||||
async: true
|
||||
},!{JSON.stringify(option)})
|
||||
|
||||
const ele = document.createElement('script')
|
||||
for (let key in config) {
|
||||
ele.setAttribute(key, config[key])
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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()
|
||||
document.getElementById('giscus-wrap').appendChild(ele)
|
||||
}
|
||||
}
|
||||
|
||||
const changeGiscusTheme = theme => {
|
||||
const sendMessage = message => {
|
||||
const iframe = document.querySelector('iframe.giscus-frame')
|
||||
if (!iframe) return
|
||||
iframe.contentWindow.postMessage({ giscus: message }, '!{giscusOriginUrl}')
|
||||
}
|
||||
|
||||
sendMessage({
|
||||
setConfig: {
|
||||
theme: getGiscusTheme(theme)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
btf.addGlobalFn('themeChange', changeGiscusTheme, 'giscus')
|
||||
|
||||
if ('!{use[0]}' === 'Giscus' || !!{lazyload}) {
|
||||
if (!{lazyload}) btf.loadComment(document.getElementById('giscus-wrap'), loadGiscus)
|
||||
else loadGiscus()
|
||||
} else {
|
||||
window.loadOtherComment= loadGiscus
|
||||
}
|
||||
})()
|
||||
|
||||
64
layout/includes/third-party/comments/gitalk.pug
vendored
64
layout/includes/third-party/comments/gitalk.pug
vendored
@@ -1,48 +1,44 @@
|
||||
script.
|
||||
function addGitalkSource () {
|
||||
const ele = document.createElement('link')
|
||||
ele.rel = 'stylesheet'
|
||||
ele.href= '!{url_for(theme.asset.gitalk_css)}'
|
||||
document.getElementsByTagName('head')[0].appendChild(ele)
|
||||
}
|
||||
- const { client_id, client_secret, repo, owner, admin, option } = theme.gitalk
|
||||
|
||||
function loadGitalk () {
|
||||
function initGitalk () {
|
||||
var gitalk = new Gitalk(Object.assign({
|
||||
clientID: '!{theme.gitalk.client_id}',
|
||||
clientSecret: '!{theme.gitalk.client_secret}',
|
||||
repo: '!{theme.gitalk.repo}',
|
||||
owner: '!{theme.gitalk.owner}',
|
||||
admin: ['!{theme.gitalk.admin}'],
|
||||
script.
|
||||
(() => {
|
||||
const initGitalk = () => {
|
||||
const gitalk = new Gitalk(Object.assign({
|
||||
clientID: '!{client_id}',
|
||||
clientSecret: '!{client_secret}',
|
||||
repo: '!{repo}',
|
||||
owner: '!{owner}',
|
||||
admin: ['!{admin}'],
|
||||
id: '!{md5(page.path)}',
|
||||
updateCountCallback: commentCount
|
||||
},!{JSON.stringify(theme.gitalk.option)}))
|
||||
},!{JSON.stringify(option)}))
|
||||
|
||||
gitalk.render('gitalk-container')
|
||||
}
|
||||
|
||||
if (typeof Gitalk === 'function') initGitalk()
|
||||
else {
|
||||
addGitalkSource()
|
||||
getScript('!{url_for(theme.asset.gitalk)}').then(initGitalk)
|
||||
const loadGitalk = async() => {
|
||||
if (typeof Gitalk === 'function') initGitalk()
|
||||
else {
|
||||
await getCSS('!{url_for(theme.asset.gitalk_css)}')
|
||||
await getScript('!{url_for(theme.asset.gitalk)}')
|
||||
initGitalk()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function commentCount(n){
|
||||
let isCommentCount = document.querySelector('#post-meta .gitalk-comment-count')
|
||||
if (isCommentCount) {
|
||||
isCommentCount.innerHTML= n
|
||||
|
||||
const commentCount = n => {
|
||||
const isCommentCount = document.querySelector('#post-meta .gitalk-comment-count')
|
||||
if (isCommentCount) {
|
||||
isCommentCount.textContent= n
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ('!{theme.comments.use[0]}' === 'Gitalk' || !!{theme.comments.lazyload}) {
|
||||
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('gitalk-container'), loadGitalk)
|
||||
else loadGitalk()
|
||||
} else {
|
||||
function loadOtherComment () {
|
||||
loadGitalk()
|
||||
if ('!{theme.comments.use[0]}' === 'Gitalk' || !!{theme.comments.lazyload}) {
|
||||
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('gitalk-container'), loadGitalk)
|
||||
else loadGitalk()
|
||||
} else {
|
||||
window.loadOtherComment = loadGitalk
|
||||
}
|
||||
}
|
||||
})()
|
||||
|
||||
|
||||
|
||||
|
||||
12
layout/includes/third-party/comments/index.pug
vendored
12
layout/includes/third-party/comments/index.pug
vendored
@@ -1,5 +1,5 @@
|
||||
- let defaultComment = theme.comments.use[0]
|
||||
hr
|
||||
hr.custom-hr
|
||||
#post-comment
|
||||
.comment-head
|
||||
.comment-headline
|
||||
@@ -7,9 +7,9 @@ hr
|
||||
span= ' ' + _p('comment')
|
||||
|
||||
if theme.comments.use.length > 1
|
||||
#comment-switch
|
||||
.comment-switch
|
||||
span.first-comment=defaultComment
|
||||
span.switch-btn
|
||||
span#switch-btn
|
||||
span.second-comment=theme.comments.use[1]
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ hr
|
||||
when 'Valine'
|
||||
#vcomment.vcomment
|
||||
when 'Disqusjs'
|
||||
#disqus_thread
|
||||
#disqusjs-wrap
|
||||
when 'Livere'
|
||||
#lv-container(data-id="city" data-uid=theme.livere.uid)
|
||||
when 'Gitalk'
|
||||
@@ -40,3 +40,7 @@ hr
|
||||
data-numposts= theme.facebook_comments.pageSize || 10
|
||||
data-order-by= theme.facebook_comments.order_by || 'social'
|
||||
data-width="100%")
|
||||
when 'Remark42'
|
||||
#remark42
|
||||
when 'Artalk'
|
||||
#artalk-wrap
|
||||
|
||||
6
layout/includes/third-party/comments/js.pug
vendored
6
layout/includes/third-party/comments/js.pug
vendored
@@ -19,4 +19,8 @@ each name in theme.comments.use
|
||||
when 'Giscus'
|
||||
!=partial('includes/third-party/comments/giscus', {}, {cache: true})
|
||||
when 'Facebook Comments'
|
||||
!=partial('includes/third-party/comments/facebook_comments', {}, {cache: true})
|
||||
include ./facebook_comments.pug
|
||||
when 'Remark42'
|
||||
!=partial('includes/third-party/comments/remark42', {}, {cache: true})
|
||||
when 'Artalk'
|
||||
!=partial('includes/third-party/comments/artalk', {}, {cache: true})
|
||||
47
layout/includes/third-party/comments/livere.pug
vendored
47
layout/includes/third-party/comments/livere.pug
vendored
@@ -1,26 +1,25 @@
|
||||
script.
|
||||
function loadLivere () {
|
||||
if (typeof LivereTower === 'object') {
|
||||
window.LivereTower.init()
|
||||
}
|
||||
else {
|
||||
(function(d, s) {
|
||||
var j, e = d.getElementsByTagName(s)[0];
|
||||
if (typeof LivereTower === 'function') { return; }
|
||||
j = d.createElement(s);
|
||||
j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
|
||||
j.async = true;
|
||||
e.parentNode.insertBefore(j, e);
|
||||
})(document, 'script');
|
||||
}
|
||||
}
|
||||
- const { use, lazyload } = theme.comments
|
||||
|
||||
if ('!{theme.comments.use[0]}' === 'Livere' || !!{theme.comments.lazyload}) {
|
||||
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('lv-container'), loadLivere)
|
||||
else loadLivere()
|
||||
}
|
||||
else {
|
||||
function loadOtherComment () {
|
||||
loadLivere()
|
||||
script.
|
||||
(()=>{
|
||||
const loadLivere = () => {
|
||||
if (typeof LivereTower === 'object') window.LivereTower.init()
|
||||
else {
|
||||
(function(d, s) {
|
||||
var j, e = d.getElementsByTagName(s)[0];
|
||||
if (typeof LivereTower === 'function') { return; }
|
||||
j = d.createElement(s);
|
||||
j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
|
||||
j.async = true;
|
||||
e.parentNode.insertBefore(j, e);
|
||||
})(document, 'script');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ('!{use[0]}' === 'Livere' || !!{lazyload}) {
|
||||
if (!{lazyload}) btf.loadComment(document.getElementById('lv-container'), loadLivere)
|
||||
else loadLivere()
|
||||
} else {
|
||||
window.loadOtherComment = loadLivere
|
||||
}
|
||||
})()
|
||||
68
layout/includes/third-party/comments/remark42.pug
vendored
Normal file
68
layout/includes/third-party/comments/remark42.pug
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
- 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()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function remarkChangeMode (theme) {
|
||||
if (!window.REMARK42) return
|
||||
window.REMARK42.changeTheme(theme)
|
||||
}
|
||||
|
||||
btf.addGlobalFn('themeChange', remarkChangeMode, 'remark42')
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
48
layout/includes/third-party/comments/twikoo.pug
vendored
48
layout/includes/third-party/comments/twikoo.pug
vendored
@@ -2,50 +2,44 @@
|
||||
- const { use, lazyload, count } = theme.comments
|
||||
|
||||
script.
|
||||
(()=>{
|
||||
const init = () => {
|
||||
twikoo.init(Object.assign({
|
||||
el: '#twikoo-wrap',
|
||||
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: '!{envId}',
|
||||
region: '!{region}',
|
||||
urls: [window.location.pathname],
|
||||
includeReply: false
|
||||
}).then(function (res) {
|
||||
document.getElementById('twikoo-count').innerText = res[0].count
|
||||
}).catch(function (err) {
|
||||
console.error(err);
|
||||
});
|
||||
}).then(res => {
|
||||
countELement.textContent = res[0].count
|
||||
}).catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
|
||||
const runFn = () => {
|
||||
init()
|
||||
const init = () => {
|
||||
twikoo.init(Object.assign({
|
||||
el: '#twikoo-wrap',
|
||||
envId: '!{envId}',
|
||||
region: '!{region}',
|
||||
onCommentLoaded: () => {
|
||||
btf.loadLightbox(document.querySelectorAll('#twikoo .tk-content img:not(.tk-owo-emotion)'))
|
||||
}
|
||||
}, !{JSON.stringify(option)}))
|
||||
|
||||
!{count ? 'GLOBAL_CONFIG_SITE.isPost && getCount()' : ''}
|
||||
}
|
||||
|
||||
const loadTwikoo = () => {
|
||||
if (typeof twikoo === 'object') {
|
||||
setTimeout(runFn,0)
|
||||
return
|
||||
}
|
||||
getScript('!{theme.asset.twikoo}').then(runFn)
|
||||
if (typeof twikoo === 'object') setTimeout(init,0)
|
||||
else getScript('!{url_for(theme.asset.twikoo)}').then(init)
|
||||
}
|
||||
|
||||
if ('!{use[0]}' === 'Twikoo' || !!{lazyload}) {
|
||||
if (!{lazyload}) btf.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo)
|
||||
else loadTwikoo()
|
||||
} else {
|
||||
window.loadOtherComment = () => {
|
||||
loadTwikoo()
|
||||
}
|
||||
window.loadOtherComment = loadTwikoo
|
||||
}
|
||||
})()
|
||||
@@ -1,34 +1,39 @@
|
||||
- const { use, lazyload } = theme.comments
|
||||
- const { repo, issue_term, light_theme, dark_theme } = theme.utterances
|
||||
|
||||
script.
|
||||
function loadUtterances () {
|
||||
let ele = document.createElement('script')
|
||||
ele.setAttribute('id', 'utterances_comment')
|
||||
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}'
|
||||
ele.setAttribute('theme', nowTheme)
|
||||
ele.setAttribute('crossorigin', 'anonymous')
|
||||
ele.setAttribute('async', 'true')
|
||||
document.getElementById('utterances-wrap').insertAdjacentElement('afterbegin',ele)
|
||||
}
|
||||
|
||||
function utterancesTheme () {
|
||||
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
|
||||
};
|
||||
iframe.contentWindow.postMessage(message, 'https://utteranc.es');
|
||||
(() => {
|
||||
const loadUtterances = () => {
|
||||
let ele = document.createElement('script')
|
||||
ele.id = 'utterances_comment'
|
||||
ele.src = 'https://utteranc.es/client.js'
|
||||
ele.setAttribute('repo', '!{repo}')
|
||||
ele.setAttribute('issue-term', '!{issue_term}')
|
||||
const nowTheme = document.documentElement.getAttribute('data-theme') === 'dark' ? '#{dark_theme}' : '#{light_theme}'
|
||||
ele.setAttribute('theme', nowTheme)
|
||||
ele.crossOrigin = 'anonymous'
|
||||
ele.async = true
|
||||
document.getElementById('utterances-wrap').appendChild(ele)
|
||||
}
|
||||
}
|
||||
|
||||
if ('!{theme.comments.use[0]}' === 'Utterances' || !!{theme.comments.lazyload}) {
|
||||
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('utterances-wrap'), loadUtterances)
|
||||
else loadUtterances()
|
||||
} else {
|
||||
function loadOtherComment () {
|
||||
loadUtterances()
|
||||
const utterancesTheme = theme => {
|
||||
const iframe = document.querySelector('.utterances-frame')
|
||||
if (iframe) {
|
||||
const theme = theme === 'dark' ? '#{dark_theme}' : '#{light_theme}'
|
||||
const message = {
|
||||
type: 'set-theme',
|
||||
theme: theme
|
||||
};
|
||||
iframe.contentWindow.postMessage(message, 'https://utteranc.es');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
btf.addGlobalFn('themeChange', utterancesTheme, 'utterances')
|
||||
|
||||
if ('!{use[0]}' === 'Utterances' || !!{lazyload}) {
|
||||
if (!{lazyload}) btf.loadComment(document.getElementById('utterances-wrap'), loadUtterances)
|
||||
else loadUtterances()
|
||||
} else {
|
||||
window.loadOtherComment = loadUtterances
|
||||
}
|
||||
})()
|
||||
45
layout/includes/third-party/comments/valine.pug
vendored
45
layout/includes/third-party/comments/valine.pug
vendored
@@ -1,33 +1,38 @@
|
||||
- const { use, lazyload } = theme.comments
|
||||
- const { appId, appKey, avatar, serverURLs, visitor, option } = theme.valine
|
||||
|
||||
- let emojiMaps = '""'
|
||||
if site.data.valine
|
||||
- emojiMaps = JSON.stringify(site.data.valine)
|
||||
|
||||
script.
|
||||
function loadValine () {
|
||||
function initValine () {
|
||||
(() => {
|
||||
const initValine = () => {
|
||||
const valine = new Valine(Object.assign({
|
||||
el: '#vcomment',
|
||||
appId: '#{theme.valine.appId}',
|
||||
appKey: '#{theme.valine.appKey}',
|
||||
avatar: '#{theme.valine.avatar}',
|
||||
serverURLs: '#{theme.valine.serverURLs}',
|
||||
appId: '#{appId}',
|
||||
appKey: '#{appKey}',
|
||||
avatar: '#{avatar}',
|
||||
serverURLs: '#{serverURLs}',
|
||||
emojiMaps: !{emojiMaps},
|
||||
path: window.location.pathname,
|
||||
visitor: #{theme.valine.visitor}
|
||||
}, !{JSON.stringify(theme.valine.option)}))
|
||||
visitor: #{visitor}
|
||||
}, !{JSON.stringify(option)}))
|
||||
}
|
||||
|
||||
if (typeof Valine === 'function') initValine()
|
||||
else getScript('!{url_for(theme.asset.valine)}').then(initValine)
|
||||
}
|
||||
|
||||
if ('!{theme.comments.use[0]}' === 'Valine' || !!{theme.comments.lazyload}) {
|
||||
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('vcomment'),loadValine)
|
||||
else setTimeout(loadValine, 0)
|
||||
} else {
|
||||
function loadOtherComment () {
|
||||
loadValine()
|
||||
const loadValine = async () => {
|
||||
if (typeof Valine === 'function') initValine()
|
||||
else {
|
||||
await getScript('!{url_for(theme.asset.valine)}')
|
||||
initValine()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ('!{use[0]}' === 'Valine' || !!{lazyload}) {
|
||||
if (!{lazyload}) btf.loadComment(document.getElementById('vcomment'),loadValine)
|
||||
else setTimeout(loadValine, 0)
|
||||
} else {
|
||||
window.loadOtherComment = loadValine
|
||||
}
|
||||
})()
|
||||
|
||||
|
||||
47
layout/includes/third-party/comments/waline.pug
vendored
47
layout/includes/third-party/comments/waline.pug
vendored
@@ -2,16 +2,11 @@
|
||||
- const { lazyload, count, use } = theme.comments
|
||||
|
||||
script.
|
||||
function loadWaline () {
|
||||
function insertCSS () {
|
||||
const link = document.createElement("link")
|
||||
link.rel = "stylesheet"
|
||||
link.href = "!{url_for(theme.asset.waline_css)}"
|
||||
document.head.appendChild(link)
|
||||
}
|
||||
(() => {
|
||||
let initFn = window.walineFn || null
|
||||
|
||||
function initWaline () {
|
||||
const waline = Waline.init(Object.assign({
|
||||
const initWaline = (Fn) => {
|
||||
const waline = Fn(Object.assign({
|
||||
el: '#waline-wrap',
|
||||
serverURL: '!{serverURL}',
|
||||
pageview: !{lazyload ? false : pageview},
|
||||
@@ -19,22 +14,30 @@ script.
|
||||
path: window.location.pathname,
|
||||
comment: !{lazyload ? false : count},
|
||||
}, !{JSON.stringify(option)}))
|
||||
|
||||
const destroyWaline = () => {
|
||||
waline.destroy()
|
||||
}
|
||||
|
||||
btf.addGlobalFn('pjax', destroyWaline, 'destroyWaline')
|
||||
}
|
||||
|
||||
if (typeof Waline === 'function') initWaline()
|
||||
else {
|
||||
insertCSS()
|
||||
getScript('!{url_for(theme.asset.waline_js)}').then(initWaline)
|
||||
const loadWaline = async () => {
|
||||
if (initFn) initWaline(initFn)
|
||||
else {
|
||||
await getCSS('!{url_for(theme.asset.waline_css)}')
|
||||
const { init } = await import('!{url_for(theme.asset.waline_js)}')
|
||||
initFn = init || Waline.init
|
||||
initWaline(initFn)
|
||||
window.walineFn = initFn
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ('!{use[0]}' === 'Waline' || !!{lazyload}) {
|
||||
if (!{lazyload}) btf.loadComment(document.getElementById('waline-wrap'),loadWaline)
|
||||
else setTimeout(loadWaline, 0)
|
||||
} else {
|
||||
function loadOtherComment () {
|
||||
loadWaline()
|
||||
if ('!{use[0]}' === 'Waline' || !!{lazyload}) {
|
||||
if (!{lazyload}) btf.loadComment(document.getElementById('waline-wrap'),loadWaline)
|
||||
else setTimeout(loadWaline, 0)
|
||||
} else {
|
||||
window.loadOtherComment = loadWaline
|
||||
}
|
||||
}
|
||||
|
||||
})()
|
||||
|
||||
|
||||
12
layout/includes/third-party/effect.pug
vendored
12
layout/includes/third-party/effect.pug
vendored
@@ -24,12 +24,12 @@ if theme.activate_power_mode.enable
|
||||
if theme.click_heart && theme.click_heart.enable
|
||||
script#click-heart(src=url_for(theme.asset.click_heart) async mobile=`${theme.click_heart.mobile}`)
|
||||
|
||||
if theme.ClickShowText && theme.ClickShowText.enable
|
||||
if theme.clickShowText && theme.clickShowText.enable
|
||||
script#click-show-text(
|
||||
src= url_for(theme.asset.ClickShowText)
|
||||
data-mobile= `${theme.ClickShowText.mobile}`
|
||||
data-text= theme.ClickShowText.text.join(",")
|
||||
data-fontsize= theme.ClickShowText.fontSize
|
||||
data-random= `${theme.ClickShowText.random}`
|
||||
src= url_for(theme.asset.clickShowText)
|
||||
data-mobile= `${theme.clickShowText.mobile}`
|
||||
data-text= theme.clickShowText.text.join(",")
|
||||
data-fontsize= theme.clickShowText.fontSize
|
||||
data-random= `${theme.clickShowText.random}`
|
||||
async
|
||||
)
|
||||
3
layout/includes/third-party/math/katex.pug
vendored
3
layout/includes/third-party/math/katex.pug
vendored
@@ -1,6 +1,5 @@
|
||||
link(rel="stylesheet" type="text/css" href=theme.asset.katex)
|
||||
link(rel="stylesheet" type="text/css" href=url_for(theme.asset.katex))
|
||||
script(src=url_for(theme.asset.katex_copytex))
|
||||
link(rel="stylesheet" type="text/css" href=theme.asset.katex_copytex_css)
|
||||
script.
|
||||
(() => {
|
||||
document.querySelectorAll('#article-container span.katex-display').forEach(item => {
|
||||
|
||||
20
layout/includes/third-party/math/mathjax.pug
vendored
20
layout/includes/third-party/math/mathjax.pug
vendored
@@ -3,11 +3,11 @@ script.
|
||||
if (!window.MathJax) {
|
||||
window.MathJax = {
|
||||
tex: {
|
||||
inlineMath: [ ['$','$'], ["\\(","\\)"]],
|
||||
inlineMath: [['$', '$'], ['\\(', '\\)']],
|
||||
tags: 'ams'
|
||||
},
|
||||
chtml: {
|
||||
scale: 1.2
|
||||
scale: 1.1
|
||||
},
|
||||
options: {
|
||||
renderActions: {
|
||||
@@ -21,28 +21,18 @@ script.
|
||||
math.end = {node: text, delim: '', n: 0}
|
||||
doc.math.push(math)
|
||||
}
|
||||
}, ''],
|
||||
insertScript: [200, () => {
|
||||
document.querySelectorAll('mjx-container:not\([display]\)').forEach(node => {
|
||||
const target = node.parentNode
|
||||
if (target.nodeName.toLowerCase() === 'li') {
|
||||
target.parentNode.classList.add('has-jax')
|
||||
} else {
|
||||
target.classList.add('has-jax')
|
||||
}
|
||||
});
|
||||
}, '', false]
|
||||
}, '']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const script = document.createElement('script')
|
||||
script.src = '!{theme.asset.mathjax}'
|
||||
script.src = '!{url_for(theme.asset.mathjax)}'
|
||||
script.id = 'MathJax-script'
|
||||
script.async = true
|
||||
document.head.appendChild(script)
|
||||
} else {
|
||||
MathJax.startup.document.state(0)
|
||||
MathJax.texReset()
|
||||
MathJax.typeset()
|
||||
MathJax.typesetPromise()
|
||||
}
|
||||
48
layout/includes/third-party/math/mermaid.pug
vendored
48
layout/includes/third-party/math/mermaid.pug
vendored
@@ -1,26 +1,38 @@
|
||||
script.
|
||||
(() => {
|
||||
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}'
|
||||
const $mermaid = document.querySelectorAll('#article-container .mermaid-wrap')
|
||||
if ($mermaid.length === 0) return
|
||||
const 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)
|
||||
Array.from($mermaid).forEach((item, index) => {
|
||||
const mermaidSrc = item.firstElementChild
|
||||
const mermaidThemeConfig = '%%{init:{ \'theme\':\'' + theme + '\'}}%%\n'
|
||||
const mermaidID = 'mermaid-' + index
|
||||
const mermaidDefinition = mermaidThemeConfig + mermaidSrc.textContent
|
||||
|
||||
const renderFn = mermaid.render(mermaidID, mermaidDefinition)
|
||||
|
||||
const renderV10 = () => {
|
||||
renderFn.then(({svg}) => {
|
||||
mermaidSrc.insertAdjacentHTML('afterend', svg)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const loadMermaid = () => {
|
||||
window.loadMermaid ? runMermaid() : getScript('!{theme.asset.mermaid}').then(runMermaid)
|
||||
}
|
||||
const renderV9 = svg => {
|
||||
mermaidSrc.insertAdjacentHTML('afterend', svg)
|
||||
}
|
||||
|
||||
window.pjax ? loadMermaid() : document.addEventListener('DOMContentLoaded', loadMermaid)
|
||||
typeof renderFn === 'string' ? renderV9(renderFn) : renderV10()
|
||||
})
|
||||
}
|
||||
|
||||
const loadMermaid = () => {
|
||||
window.loadMermaid ? runMermaid() : getScript('!{url_for(theme.asset.mermaid)}').then(runMermaid)
|
||||
}
|
||||
|
||||
btf.addGlobalFn('themeChange', runMermaid, 'mermaid')
|
||||
|
||||
window.pjax ? loadMermaid() : document.addEventListener('DOMContentLoaded', loadMermaid)
|
||||
})()
|
||||
106
layout/includes/third-party/newest-comments/artalk.pug
vendored
Normal file
106
layout/includes/third-party/newest-comments/artalk.pug
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
- const { server, site, option } = theme.artalk
|
||||
- const avatarCdn = option !== null && option.gravatar && option.gravatar.mirror
|
||||
- const avatarDefault = option !== null && option.gravatar && (option.gravatar.params || option.gravatar.default)
|
||||
|
||||
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 && ($dom && ($dom.innerHTML= result))
|
||||
window.lazyLoadInstance && window.lazyLoadInstance.update()
|
||||
window.pjax && window.pjax.refresh($dom)
|
||||
}
|
||||
|
||||
const getSetting = async () => {
|
||||
try {
|
||||
const res = await fetch('!{server}/api/v2/conf', { method: 'GET' })
|
||||
return await res.json()
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
}
|
||||
|
||||
const headerList = {
|
||||
method: 'GET',
|
||||
}
|
||||
|
||||
const searchParams = new URLSearchParams({
|
||||
'site_name': '!{site}',
|
||||
'limit': '!{theme.newest_comments.limit}',
|
||||
})
|
||||
|
||||
const getComment = async () => {
|
||||
try {
|
||||
const res = await fetch(`!{server}/api/v2/stats/latest_comments?${searchParams}`, headerList)
|
||||
const result = await res.json()
|
||||
const avatarStr = await getSetting()
|
||||
const { mirror, params, default:defaults } = avatarStr.frontend_conf.gravatar
|
||||
const avatarCdn = !{avatarCdn} || mirror
|
||||
let avatarDefault = !{avatarDefault} || params || defaults
|
||||
avatarDefault = avatarDefault.startsWith('d=') ? avatarDefault : `d=${avatarDefault}`
|
||||
const artalk = result.data.map(function (e) {
|
||||
return {
|
||||
'avatar': `${avatarCdn}${e.email_encrypted}?${avatarDefault}`,
|
||||
'content': changeContent(e.content_marked),
|
||||
'nick': e.nick,
|
||||
'url': e.page_url,
|
||||
'date': e.date,
|
||||
}
|
||||
})
|
||||
saveToLocal.set('artalk-newest-comments', JSON.stringify(artalk), !{theme.newest_comments.storage}/(60*24))
|
||||
generateHtml(artalk)
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
const $dom = document.querySelector('#card-newest-comments .aside-list')
|
||||
$dom.textContent= "!{_p('aside.card_newest_comments.error')}"
|
||||
}
|
||||
}
|
||||
|
||||
const newestCommentInit = () => {
|
||||
if (document.querySelector('#card-newest-comments .aside-list')) {
|
||||
const data = saveToLocal.get('artalk-newest-comments')
|
||||
if (data) {
|
||||
generateHtml(JSON.parse(data))
|
||||
} else {
|
||||
getComment()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
newestCommentInit()
|
||||
document.addEventListener('pjax:complete', newestCommentInit)
|
||||
})
|
||||
@@ -32,7 +32,7 @@ script.
|
||||
generateHtml(disqusArray)
|
||||
}).catch(e => {
|
||||
const $dom = document.querySelector('#card-newest-comments .aside-list')
|
||||
$dom.innerHTML= "!{_p('aside.card_newest_comments.error')}"
|
||||
$dom.textContent= "!{_p('aside.card_newest_comments.error')}"
|
||||
})
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ script.
|
||||
}
|
||||
|
||||
let $dom = document.querySelector('#card-newest-comments .aside-list')
|
||||
$dom.innerHTML= result
|
||||
$dom && ($dom.innerHTML= result)
|
||||
window.lazyLoadInstance && window.lazyLoadInstance.update()
|
||||
window.pjax && window.pjax.refresh($dom)
|
||||
}
|
||||
|
||||
@@ -17,7 +17,10 @@ script.
|
||||
const findTrueUrl = (array) => {
|
||||
Promise.all(array.map(item =>
|
||||
fetch(item.url).then(resp => resp.json()).then(data => {
|
||||
const urlArray = data.body.match(/(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?/ig)
|
||||
let urlArray = data.body ? data.body.match(/(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?/ig) : []
|
||||
if (!Array.isArray(urlArray) || urlArray.length === 0) {
|
||||
urlArray = [`${data.html_url}`]
|
||||
}
|
||||
if (data.user.login === 'utterances-bot') {
|
||||
return urlArray.pop()
|
||||
} else {
|
||||
@@ -48,7 +51,7 @@ script.
|
||||
const githubArray = data.map(item => {
|
||||
return {
|
||||
'avatar': item.user.avatar_url,
|
||||
'content': changeContent(item.body_html),
|
||||
'content': changeContent(item.body_html || item.body),
|
||||
'nick': item.user.login,
|
||||
'url': item.issue_url,
|
||||
'date': item.updated_at,
|
||||
@@ -58,7 +61,7 @@ script.
|
||||
findTrueUrl(githubArray)
|
||||
}).catch(e => {
|
||||
const $dom = document.querySelector('#card-newest-comments .aside-list')
|
||||
$dom.innerHTML= "!{_p('aside.card_newest_comments.error')}"
|
||||
$dom.textContent= "!{_p('aside.card_newest_comments.error')}"
|
||||
})
|
||||
}
|
||||
|
||||
@@ -84,7 +87,7 @@ script.
|
||||
}
|
||||
|
||||
let $dom = document.querySelector('#card-newest-comments .aside-list')
|
||||
$dom.innerHTML= result
|
||||
$dom && ($dom.innerHTML= result)
|
||||
window.lazyLoadInstance && window.lazyLoadInstance.update()
|
||||
window.pjax && window.pjax.refresh($dom)
|
||||
}
|
||||
|
||||
@@ -23,4 +23,8 @@ 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
|
||||
when 'Artalk'
|
||||
include ./artalk.pug
|
||||
80
layout/includes/third-party/newest-comments/remark42.pug
vendored
Normal file
80
layout/includes/third-party/newest-comments/remark42.pug
vendored
Normal 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 && ($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.textContent= "!{_p('aside.card_newest_comments.error')}"
|
||||
})
|
||||
}
|
||||
|
||||
const newestCommentInit = () => {
|
||||
if (document.querySelector('#card-newest-comments .aside-list')) {
|
||||
const data = saveToLocal.get('remark42-newest-comments')
|
||||
if (data) {
|
||||
generateHtml(JSON.parse(data))
|
||||
} else {
|
||||
getComment()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
newestCommentInit()
|
||||
document.addEventListener('pjax:complete', newestCommentInit)
|
||||
})
|
||||
@@ -36,14 +36,14 @@ script.
|
||||
generateHtml(twikooArray)
|
||||
}).catch(function (err) {
|
||||
const $dom = document.querySelector('#card-newest-comments .aside-list')
|
||||
$dom.innerHTML= "!{_p('aside.card_newest_comments.error')}"
|
||||
$dom.textContent= "!{_p('aside.card_newest_comments.error')}"
|
||||
})
|
||||
}
|
||||
|
||||
if (typeof twikoo === 'object') {
|
||||
runTwikoo()
|
||||
} else {
|
||||
getScript('!{theme.asset.twikoo}').then(runTwikoo)
|
||||
getScript('!{url_for(theme.asset.twikoo)}').then(runTwikoo)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ script.
|
||||
}
|
||||
|
||||
let $dom = document.querySelector('#card-newest-comments .aside-list')
|
||||
$dom.innerHTML= result
|
||||
$dom && ($dom.innerHTML= result)
|
||||
window.lazyLoadInstance && window.lazyLoadInstance.update()
|
||||
window.pjax && window.pjax.refresh($dom)
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ script.
|
||||
}
|
||||
|
||||
let $dom = document.querySelector('#card-newest-comments .aside-list')
|
||||
$dom.innerHTML= result
|
||||
$dom && ($dom.innerHTML= result)
|
||||
window.lazyLoadInstance && window.lazyLoadInstance.update()
|
||||
window.pjax && window.pjax.refresh($dom)
|
||||
}
|
||||
@@ -79,7 +79,7 @@ script.
|
||||
generateHtml(valineArray)
|
||||
}).catch(e => {
|
||||
const $dom = document.querySelector('#card-newest-comments .aside-list')
|
||||
$dom.innerHTML= "!{_p('aside.card_newest_comments.error')}"
|
||||
$dom.textContent= "!{_p('aside.card_newest_comments.error')}"
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
- const serverURL = theme.waline.serverURL.replace(/\/$/, '')
|
||||
|
||||
script.
|
||||
window.addEventListener('load', () => {
|
||||
const changeContent = (content) => {
|
||||
const changeContent = content => {
|
||||
if (content === '') return content
|
||||
|
||||
content = content.replace(/<img.*?src="(.*?)"?[^\>]+>/ig, '[!{_p("aside.card_newest_comments.image")}]') // replace image link
|
||||
@@ -36,36 +38,31 @@ script.
|
||||
}
|
||||
|
||||
let $dom = document.querySelector('#card-newest-comments .aside-list')
|
||||
$dom.innerHTML= result
|
||||
$dom && ($dom.innerHTML= result)
|
||||
window.lazyLoadInstance && window.lazyLoadInstance.update()
|
||||
window.pjax && window.pjax.refresh($dom)
|
||||
}
|
||||
|
||||
const getComment = () => {
|
||||
const loadWaline = () => {
|
||||
Waline.RecentComments({
|
||||
serverURL: '!{theme.waline.serverURL}',
|
||||
count: !{theme.newest_comments.limit}
|
||||
}).then(({comments}) => {
|
||||
const walineArray = comments.map(e => {
|
||||
return {
|
||||
'content': changeContent(e.comment),
|
||||
'avatar': e.avatar,
|
||||
'nick': e.nick,
|
||||
'url': e.url + '#' + e.objectId,
|
||||
'date': e.insertedAt,
|
||||
}
|
||||
})
|
||||
saveToLocal.set('waline-newest-comments', JSON.stringify(walineArray), !{theme.newest_comments.storage}/(60*24))
|
||||
generateHtml(walineArray)
|
||||
}).catch(e => {
|
||||
const $dom = document.querySelector('#card-newest-comments .aside-list')
|
||||
$dom.innerHTML= "!{_p('aside.card_newest_comments.error')}"
|
||||
})
|
||||
const getComment = async () => {
|
||||
try {
|
||||
const res = await fetch('!{serverURL}/api/comment?type=recent&count=!{theme.newest_comments.limit}', { method: 'GET' })
|
||||
const result = await res.json()
|
||||
const walineArray = result.data.map(e => {
|
||||
return {
|
||||
'content': changeContent(e.comment),
|
||||
'avatar': e.avatar,
|
||||
'nick': e.nick,
|
||||
'url': e.url + '#' + e.objectId,
|
||||
'date': e.time || e.insertedAt
|
||||
}
|
||||
})
|
||||
saveToLocal.set('waline-newest-comments', JSON.stringify(walineArray), !{theme.newest_comments.storage}/(60*24))
|
||||
generateHtml(walineArray)
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
const $dom = document.querySelector('#card-newest-comments .aside-list')
|
||||
$dom.textContent= "!{_p('aside.card_newest_comments.error')}"
|
||||
}
|
||||
|
||||
if (typeof Waline === 'function') loadWaline()
|
||||
else getScript('!{url_for(theme.asset.waline_js)}').then(loadWaline)
|
||||
}
|
||||
|
||||
const newestCommentInit = () => {
|
||||
|
||||
21
layout/includes/third-party/pjax.pug
vendored
21
layout/includes/third-party/pjax.pug
vendored
@@ -3,11 +3,11 @@ if theme.pjax.exclude
|
||||
each val in theme.pjax.exclude
|
||||
- pjaxExclude = pjaxExclude + `:not([href="${val}"])`
|
||||
|
||||
- let pjaxSelectors = ['title','#config-diff','#body-wrap','#rightside-config-hide','#rightside-config-show','.js-pjax']
|
||||
- let pjaxSelectors = ['head > title','#config-diff','#body-wrap','#rightside-config-hide','#rightside-config-show','.js-pjax']
|
||||
|
||||
- let choose = theme.comments.use
|
||||
if choose
|
||||
if theme.Open_Graph_meta && (choose.includes('Livere') || choose.includes('Utterances') || choose.includes('Giscus'))
|
||||
if theme.Open_Graph_meta.enable && (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"]')
|
||||
@@ -26,12 +26,11 @@ script.
|
||||
|
||||
document.addEventListener('pjax:send', function () {
|
||||
|
||||
// removeEventListener scroll
|
||||
window.tocScrollFn && window.removeEventListener('scroll', window.tocScrollFn)
|
||||
window.scrollCollect && window.removeEventListener('scroll', scrollCollect)
|
||||
// removeEventListener
|
||||
btf.removeGlobalFnEvent('pjax')
|
||||
btf.removeGlobalFnEvent('themeChange')
|
||||
|
||||
typeof preloader === 'object' && preloader.initLoading()
|
||||
document.getElementById('rightside').style.cssText = "opacity: ''; transform: ''"
|
||||
document.getElementById('rightside').classList.remove('rightside-show')
|
||||
|
||||
if (window.aplayers) {
|
||||
for (let i = 0; i < window.aplayers.length; i++) {
|
||||
@@ -47,6 +46,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 () {
|
||||
@@ -62,7 +62,6 @@ script.
|
||||
|
||||
GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()
|
||||
|
||||
typeof chatBtnFn === 'function' && chatBtnFn()
|
||||
typeof panguInit === 'function' && panguInit()
|
||||
|
||||
// google analytics
|
||||
@@ -75,12 +74,10 @@ script.
|
||||
|
||||
// prismjs
|
||||
typeof Prism === 'object' && Prism.highlightAll()
|
||||
|
||||
typeof preloader === 'object' && preloader.endLoading()
|
||||
})
|
||||
|
||||
document.addEventListener('pjax:error', (e) => {
|
||||
document.addEventListener('pjax:error', e => {
|
||||
if (e.request.status === 404) {
|
||||
pjax.loadUrl('/404.html')
|
||||
pjax.loadUrl('!{url_for("/404.html")}')
|
||||
}
|
||||
})
|
||||
|
||||
@@ -16,3 +16,7 @@
|
||||
.algolia-poweredBy
|
||||
|
||||
#search-mask
|
||||
|
||||
script(src=url_for(theme.asset.algolia_search))
|
||||
script(src=url_for(theme.asset.instantsearch))
|
||||
script(src=url_for(theme.asset.algolia_js))
|
||||
28
layout/includes/third-party/search/docsearch.pug
vendored
Normal file
28
layout/includes/third-party/search/docsearch.pug
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
- const { appId, apiKey, indexName, option } = theme.docsearch
|
||||
|
||||
.docsearch-wrap
|
||||
#docsearch(style="display:none")
|
||||
link(rel="stylesheet" href=url_for(theme.asset.docsearch_css))
|
||||
script(src=url_for(theme.asset.docsearch_js))
|
||||
script.
|
||||
(() => {
|
||||
docsearch(Object.assign({
|
||||
appId: '!{appId}',
|
||||
apiKey: '!{apiKey}',
|
||||
indexName: '!{indexName}',
|
||||
container: '#docsearch',
|
||||
}, !{JSON.stringify(option)}))
|
||||
|
||||
const handleClick = () => {
|
||||
document.querySelector('.DocSearch-Button').click()
|
||||
}
|
||||
|
||||
const searchClickFn = () => {
|
||||
btf.addEventListenerPjax(document.querySelector('#search-button > .search'), 'click', handleClick)
|
||||
}
|
||||
|
||||
searchClickFn()
|
||||
window.addEventListener('pjax:complete', searchClickFn)
|
||||
})()
|
||||
|
||||
|
||||
4
layout/includes/third-party/search/index.pug
vendored
4
layout/includes/third-party/search/index.pug
vendored
@@ -1,4 +1,6 @@
|
||||
if theme.algolia_search.enable
|
||||
include ./algolia.pug
|
||||
else if theme.local_search.enable
|
||||
include ./local-search.pug
|
||||
include ./local-search.pug
|
||||
else if theme.docsearch.enable
|
||||
include ./docsearch.pug
|
||||
@@ -16,5 +16,7 @@
|
||||
input(placeholder=_p("search.local_search.input_placeholder") type="text").local-search-box--input
|
||||
hr
|
||||
#local-search-results
|
||||
#local-search-stats-wrap
|
||||
#search-mask
|
||||
|
||||
#search-mask
|
||||
script(src=url_for(theme.asset.local_search))
|
||||
@@ -1,2 +0,0 @@
|
||||
.addthis_inline_share_toolbox
|
||||
script(src=`//s7.addthis.com/js/300/addthis_widget.js#pubid=${theme.addThis.pubid}` async)
|
||||
4
layout/includes/third-party/share/index.pug
vendored
4
layout/includes/third-party/share/index.pug
vendored
@@ -1,7 +1,5 @@
|
||||
.post_share
|
||||
if theme.addThis.enable
|
||||
!=partial('includes/third-party/share/add-this', {}, {cache: true})
|
||||
else if theme.sharejs.enable
|
||||
if theme.sharejs.enable
|
||||
include ./share-js.pug
|
||||
else if theme.addtoany.enable
|
||||
!=partial('includes/third-party/share/addtoany', {}, {cache: true})
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
.social-share(data-image=url_for(page.cover|| theme.avatar.img) data-sites= theme.sharejs.sites)
|
||||
- const coverVal = page.cover_type === 'img' ? page.cover : theme.avatar.img
|
||||
.social-share(data-image=url_for(coverVal) data-sites= theme.sharejs.sites)
|
||||
link(rel='stylesheet' href=url_for(theme.asset.sharejs_css) media="print" onload="this.media='all'")
|
||||
script(src=url_for(theme.asset.sharejs) defer)
|
||||
112
layout/includes/third-party/subtitle.pug
vendored
112
layout/includes/third-party/subtitle.pug
vendored
@@ -1,6 +1,30 @@
|
||||
- const { effect,loop,source,sub } = theme.subtitle
|
||||
- const { effect,source,sub,typed_option } = theme.subtitle
|
||||
- let subContent = sub || new Array()
|
||||
|
||||
script.
|
||||
window.typedJSFn = {
|
||||
init: (str) => {
|
||||
window.typed = new Typed('#subtitle', Object.assign({
|
||||
strings: str,
|
||||
startDelay: 300,
|
||||
typeSpeed: 150,
|
||||
loop: true,
|
||||
backSpeed: 50,
|
||||
}, !{JSON.stringify(typed_option)}))
|
||||
},
|
||||
run: (subtitleType) => {
|
||||
if (!{effect}) {
|
||||
if (typeof Typed === 'function') {
|
||||
subtitleType()
|
||||
} else {
|
||||
getScript('!{url_for(theme.asset.typed)}').then(subtitleType)
|
||||
}
|
||||
} else {
|
||||
subtitleType()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case source
|
||||
when 1
|
||||
script.
|
||||
@@ -12,28 +36,13 @@ case source
|
||||
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: !{loop},
|
||||
backSpeed: 50,
|
||||
})
|
||||
typedJSFn.init(sub)
|
||||
} else {
|
||||
document.getElementById('subtitle').innerHTML = data.hitokoto
|
||||
document.getElementById('subtitle').textContent = data.hitokoto
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (!{effect}) {
|
||||
if (typeof Typed === 'function') {
|
||||
subtitleType()
|
||||
} else {
|
||||
getScript('!{url_for(theme.asset.typed)}').then(subtitleType)
|
||||
}
|
||||
} else {
|
||||
subtitleType()
|
||||
}
|
||||
typedJSFn.run(subtitleType)
|
||||
|
||||
when 2
|
||||
script.
|
||||
@@ -44,28 +53,13 @@ case source
|
||||
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: !{loop},
|
||||
backSpeed: 50,
|
||||
})
|
||||
typedJSFn.init(sub)
|
||||
} else {
|
||||
document.getElementById('subtitle').innerHTML = con
|
||||
document.getElementById('subtitle').textContent = con
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (!{effect}) {
|
||||
if (typeof Typed === 'function') {
|
||||
subtitleType()
|
||||
} else {
|
||||
getScript('!{url_for(theme.asset.typed)}').then(subtitleType)
|
||||
}
|
||||
} else {
|
||||
subtitleType()
|
||||
}
|
||||
typedJSFn.run(subtitleType)
|
||||
|
||||
when 3
|
||||
script.
|
||||
@@ -76,53 +70,23 @@ case source
|
||||
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: !{loop},
|
||||
backSpeed: 50,
|
||||
})
|
||||
typedJSFn.init(sub)
|
||||
} else {
|
||||
document.getElementById('subtitle').innerHTML = result.data.content
|
||||
document.getElementById('subtitle').textContent = result.data.content
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
if (!{effect}) {
|
||||
if (typeof Typed === 'function') {
|
||||
subtitleType()
|
||||
} else {
|
||||
getScript('!{url_for(theme.asset.typed)}').then(subtitleType)
|
||||
}
|
||||
} else {
|
||||
subtitleType()
|
||||
}
|
||||
typedJSFn.run(subtitleType)
|
||||
|
||||
default
|
||||
- subContent = subContent.length ? subContent : new Array(config.subtitle)
|
||||
script.
|
||||
function subtitleType () {
|
||||
if (!{effect}) {
|
||||
window.typed = new Typed("#subtitle", {
|
||||
strings: !{JSON.stringify(subContent)},
|
||||
startDelay: 300,
|
||||
typeSpeed: 150,
|
||||
loop: !{loop},
|
||||
backSpeed: 50
|
||||
})
|
||||
if (!{effect}) {
|
||||
typedJSFn.init(!{JSON.stringify(subContent)})
|
||||
} else {
|
||||
document.getElementById("subtitle").innerHTML = '!{subContent[0]}'
|
||||
document.getElementById("subtitle").textContent = !{JSON.stringify(subContent[0])}
|
||||
}
|
||||
}
|
||||
|
||||
if (!{effect}) {
|
||||
if (typeof Typed === 'function') {
|
||||
subtitleType()
|
||||
} else {
|
||||
getScript('!{url_for(theme.asset.typed)}').then(subtitleType)
|
||||
}
|
||||
} else {
|
||||
subtitleType()
|
||||
}
|
||||
typedJSFn.run(subtitleType)
|
||||
@@ -24,4 +24,4 @@ if theme.aside.card_author.enable
|
||||
|
||||
if(theme.social)
|
||||
.card-info-social-icons.is-center
|
||||
!=fragment_cache('social', function(){return partial('includes/header/social')})
|
||||
!=partial('includes/header/social', {}, {cache: true})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
if theme.newest_comments.enable && !['Livere','Facebook Comments','Giscus'].includes(theme.comments.use[0])
|
||||
if theme.newest_comments.enable && theme.comments.use && !['Livere','Facebook Comments','Giscus'].includes(theme.comments.use[0])
|
||||
.card-widget#card-newest-comments
|
||||
.item-headline
|
||||
i.fas.fa-comment-dots
|
||||
|
||||
21
layout/includes/widget/card_post_series.pug
Normal file
21
layout/includes/widget/card_post_series.pug
Normal file
@@ -0,0 +1,21 @@
|
||||
if theme.aside.card_post_series.enable
|
||||
- const array = fragment_cache('seriesArr', groupPosts)
|
||||
.card-widget.card-post-series
|
||||
.item-headline
|
||||
i.fa-solid.fa-layer-group
|
||||
span= theme.aside.card_post_series.series_title ? page.series : _p('aside.card_post_series')
|
||||
.aside-list
|
||||
each item in array[page.series]
|
||||
- const { path, title = _p('no_title'), cover, cover_type, date:dateA } = item
|
||||
- let link = url_for(path)
|
||||
- let no_cover = cover === false || !theme.cover.aside_enable ? 'no-cover' : ''
|
||||
.aside-list-item(class=no_cover)
|
||||
if cover && theme.cover.aside_enable
|
||||
a.thumbnail(href=link title=title)
|
||||
if cover_type === 'img'
|
||||
img(src=url_for(cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title)
|
||||
else
|
||||
div(style=`background: ${cover}`)
|
||||
.content
|
||||
a.title(href=link title=title)= title
|
||||
time(datetime=date_xml(dateA) title=_p('post.created') + ' ' + full_date(dateA)) #[=date(dateA, config.date_format)]
|
||||
@@ -1,5 +1,5 @@
|
||||
- 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 tocNumber = typeof page.toc_number === 'boolean' ? page.toc_number : theme.toc.number
|
||||
- let tocExpand = typeof page.toc_expand === 'boolean' ? page.toc_expand : theme.toc.expand
|
||||
- let tocExpandClass = tocExpand ? 'is-expand' : ''
|
||||
|
||||
#card-toc.card-widget
|
||||
|
||||
@@ -14,7 +14,10 @@ if theme.aside.card_recent_post.enable
|
||||
.aside-list-item(class=no_cover)
|
||||
if post_cover && theme.cover.aside_enable
|
||||
a.thumbnail(href=url_for(link) title=title)
|
||||
img(src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title)
|
||||
if article.cover_type === 'img'
|
||||
img(src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title)
|
||||
else
|
||||
div(style=`background: ${post_cover}`)
|
||||
.content
|
||||
a.title(href=url_for(link) title=title)= title
|
||||
if theme.aside.card_recent_post.sort === 'updated'
|
||||
|
||||
@@ -5,8 +5,10 @@ if theme.aside.card_tags.enable
|
||||
i.fas.fa-tags
|
||||
span= _p('aside.card_tags')
|
||||
|
||||
- let tagLimit = theme.aside.card_tags.limit === 0 ? 0 : theme.aside.card_tags.limit || 40
|
||||
- let { limit, orderby, order } = theme.aside.card_tags
|
||||
- limit = limit === 0 ? 0 : limit || 40
|
||||
|
||||
if theme.aside.card_tags.color
|
||||
.card-tag-cloud!= cloudTags({source: site.tags, minfontsize: 1.15, maxfontsize: 1.45, limit: tagLimit, unit: 'em'})
|
||||
.card-tag-cloud!= cloudTags({source: site.tags, orderby: orderby, order: order, minfontsize: 1.15, maxfontsize: 1.45, limit: limit, unit: 'em'})
|
||||
else
|
||||
.card-tag-cloud!= tagcloud({min_font: 1.1, max_font: 1.5, amount: tagLimit , color: true, start_color: '#999', end_color: '#99a9bf', unit: 'em'})
|
||||
.card-tag-cloud!= tagcloud({orderby: orderby, order: order, min_font: 1.1, max_font: 1.5, amount: limit , color: true, start_color: '#999', end_color: '#99a9bf', unit: 'em'})
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -13,13 +13,15 @@
|
||||
.sticky_layout
|
||||
if showToc
|
||||
include ./card_post_toc.pug
|
||||
if page.series
|
||||
include ./card_post_series.pug
|
||||
!=partial('includes/widget/card_recent_post', {}, {cache: true})
|
||||
!=partial('includes/widget/card_ad', {}, {cache: true})
|
||||
else
|
||||
//- page
|
||||
!=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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hexo-theme-butterfly",
|
||||
"version": "4.2.1",
|
||||
"version": "4.13.0",
|
||||
"description": "A Simple and Card UI Design theme for Hexo",
|
||||
"main": "package.json",
|
||||
"scripts": {
|
||||
@@ -23,7 +23,7 @@
|
||||
"email": "my@crazywong.com"
|
||||
},
|
||||
"dependencies": {
|
||||
"hexo-renderer-stylus": "^2.0.1",
|
||||
"hexo-renderer-stylus": "^3.0.1",
|
||||
"hexo-renderer-pug": "^3.0.0"
|
||||
},
|
||||
"homepage": "https://butterfly.js.org/",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user