Merge branch 'dev' into master

This commit is contained in:
Jerry
2020-08-01 14:44:06 +08:00
Unverified
138 changed files with 3679 additions and 3100 deletions

View File

@@ -1,21 +1,30 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
<!-- <!--
IMPORTANT: Please follow the template to create a new issue. IMPORTANT: Please follow the template to create a new issue.
重要:請依照該模板來提交。 重要:請依照該模板來提交。
If you upgrade from the old version, and an error occurs when running, please copy the new content in the config to the butterfly.yml If you upgrade from the old version, and an error occurs when running, please copy the new content in the config to the butterfly.yml
如果你是由舊版本升級到新版,行時出現報錯請首先把config新的內容複製到舊的butterfly設 如果你是由舊版本升級到新版,行時出現報錯請首先把config新的內容複製到舊的butterfly設
If you are a problem when visit the website, please open your browser 'developer tools (shortcut F12)' and check the console if there is an error, include your website address in the feedback If you are a problem when visit the website, please open your browser 'developer tools (shortcut F12)' and check the console if there is an error, include your website address in the feedback
如果你是線上訪問出現問題請檢查瀏覽器開發人員工具快捷鍵F12的console是否有報錯反饋時附上你的網站 如果你是線上訪問出現問題請檢查瀏覽器開發人員工具快捷鍵F12的console是否有報錯反饋時附上你的網站
--> -->
## I want to create a new issue <!-- 我想要建立一個新的issue --> ## I want to create a Bug report <!-- 我想要建立一個 Bug report -->
<!-- Check all with "x" especially FAQ & Documentation!! (使用 "x" 選擇) --> <!-- Check all with "x" especially FAQ & Documentation!! (使用 "x" 選擇) -->
<!-- 請確認是否都已經翻過如下的資料, 尤其是安裝文 --> <!-- 請確認是否都已經翻過如下的資料, 尤其是安裝文 -->
- [] Yes, I have read [Hexo Docs page](https://hexo.io/docs/), especially [Templates](https://hexo.io/docs/templates.html), [Variables](https://hexo.io/docs/variables.html), [Helpers](https://hexo.io/docs/helpers.html) and [Troubleshooting](https://hexo.io/docs/troubleshooting.html). - [] Yes, I have read [Hexo Docs page](https://hexo.io/docs/), especially [Templates](https://hexo.io/docs/templates.html), [Variables](https://hexo.io/docs/variables.html), [Helpers](https://hexo.io/docs/helpers.html) and [Troubleshooting](https://hexo.io/docs/troubleshooting.html).
- [] Yes, I have read [Hexo-theme-butterfly Documentation](https://jerryc.me/posts/21cfbf15/). - [] Yes, I have read [Butterfly Documentation](https://demo.jerryc.me/posts/21cfbf15/).
- [] And yes, I already searched for current [issues](https://github.com/jerryc127/hexo-theme-butterfly/issues?utf8=%E2%9C%93&q=is%3Aissue) and this did not help me. - [] And yes, I already searched for current [issues](https://github.com/jerryc127/hexo-theme-butterfly/issues?utf8=%E2%9C%93&q=is%3Aissue) and this did not help me.
## Butterfly Information ## Butterfly Information
@@ -34,19 +43,17 @@ If you are a problem when visit the website, please open your browser 'developer
## Actual behavior <!-- (實際行為) --> ## Actual behavior <!-- (實際行為) -->
<!-- Please give me the screenshots to locate the issue -->
<!-- 請儘量提供截圖來定位問題 -->
## Steps to reproduce the behavior <!-- (重現步驟) --> ## Steps to reproduce the behavior <!-- (重現步驟) -->
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
## Feature Request <!-- If applicable, add screenshots to help explain your problem -->
<!-- 請儘量提供截圖來定位問題 -->
## Screenshots <!-- (截圖) -->
<!-- If you have any ideas of theme-butterfly, please write down here and we can have a discussion. --> <!-- Provide your website to find the issues -->
<!-- 如果你有任何關於Butterfly的功能方面的想法可以在這個部分裡寫下來我們一起討論 --> ## Website
--- ## Describe the bug
<!--
Love hexo-theme-butterfly? Please consider starring the repo to support it!
喜歡 hexo-theme-butterfly嗎 考慮一下給它點個star來支援它吧
-->

10
.github/ISSUE_TEMPLATE/custom.md vendored Normal file
View File

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

View File

@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

204
LICENSE
View File

@@ -1,8 +1,202 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -1,11 +1,15 @@
# hexo-theme-butterfly # hexo-theme-butterfly
<a href="https://github.com/jerryc127/hexo-theme-butterfly/releases"><img alt="Version" src="https://img.shields.io/badge/release-3.0.0-blue"/></a> ![version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly)
<a href="https://jerryc.me"><img alt="Author" src="https://img.shields.io/badge/author-JerryC-blur"/></a> ![https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff](https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff)
<a href="https://hexo.io"><img alt="Hexo" src="https://img.shields.io/badge/hexo-4.0+-0e83c"/></a> ![hexo version](https://img.shields.io/badge/hexo-4.0+-0e83c)
<a href="https://nodejs.org/"><img alt="node.js" src="https://img.shields.io/badge/node.js-8.0+-blur"/></a> ![npm download](https://img.shields.io/npm/dw/hexo-theme-butterfly?color=green)
![nodejs version](https://img.shields.io/badge/node.js-8.0+-yellow)
![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly?color=FF5531)
Demo: 👍 [Butterfly](https://demo.jerryc.me/) || 🤞 [JerryC](https://jerryc.me/) Demo: 👍 [Butterfly](https://demo.jerryc.me/) || 🤞 [JerryC](https://jerryc.me/)
Docs: 📖 [Butterfly Docs](https://demo.jerryc.me/posts/21cfbf15/)
Based on [hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody) theme. Based on [hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody) theme.
@@ -33,18 +37,6 @@ git clone -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/bu
> npm install hexo-renderer-pug hexo-renderer-stylus > npm install hexo-renderer-pug hexo-renderer-stylus
## Documentation
Find in [Butterfly Docs](https://demo.jerryc.me/posts/21cfbf15/). it supports `zh-TW` and `zh-CN`
You can also join the Chat Group.
[💬 Join QQ Group [recommend]](https://jq.qq.com/?_wv=1027&k=5KI3Jqb)
[💬 Join Telegram Group](https://t.me/hexo_butterfly)
## Screenshots ## Screenshots
![image](https://user-images.githubusercontent.com/16351105/58887365-1272f780-8718-11e9-9329-3292c6ba20d4.png) ![image](https://user-images.githubusercontent.com/16351105/58887365-1272f780-8718-11e9-9329-3292c6ba20d4.png)

View File

@@ -1,11 +1,16 @@
# hexo-theme-butterfly # hexo-theme-butterfly
<a href="https://github.com/jerryc127/hexo-theme-butterfly/releases"><img alt="Version" src="https://img.shields.io/badge/release-3.0.0-blue"/></a> ![version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly)
<a href="https://jerryc.me"><img alt="Author" src="https://img.shields.io/badge/author-JerryC-blur"/></a> ![https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff](https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff)
<a href="https://hexo.io"><img alt="Hexo" src="https://img.shields.io/badge/hexo-4.0+-0e83c"/></a> ![hexo version](https://img.shields.io/badge/hexo-4.0+-0e83c)
<a href="https://nodejs.org/"><img alt="node.js" src="https://img.shields.io/badge/node.js-8.0+-blur"/></a> ![npm download](https://img.shields.io/npm/dw/hexo-theme-butterfly?color=green)
![nodejs version](https://img.shields.io/badge/node.js-8.0+-yellow)
![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly?color=FF5531)
Demo: 👍 [Butterfly](https://demo.jerryc.me/) || 🤞 [JerryC](https://jerryc.me/)
預覽: 👍 [Butterfly](https://demo.jerryc.me/) || 🤞 [JerryC](https://jerryc.me/)
文檔: 📖 [Butterfly Docs](https://demo.jerryc.me/posts/21cfbf15/)
一款基於[hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody)修改的主題 一款基於[hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody)修改的主題
@@ -30,17 +35,7 @@ git clone -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/bu
theme: butterfly theme: butterfly
``` ```
>如果你沒有pug以及stylus的渲染器請下載安裝 npm install hexo-renderer-pug hexo-renderer-stylus --save or yarn add hexo-renderer-pug hexo-renderer-stylus >如果你沒有pug以及stylus的渲染器請下載安裝 npm install hexo-renderer-pug hexo-renderer-stylus --save
## 文檔
可查看[Butterfly Docs](https://demo.jerryc.me/posts/21cfbf15/)
你也可以加入群組
[ 💬 QQ群 [推薦]](https://jq.qq.com/?_wv=1027&k=5KI3Jqb)
[ 💬 Telegram群](https://t.me/hexo_butterfly)
## 截圖 ## 截圖

View File

@@ -7,20 +7,20 @@
# name || link || icon # name || link || icon
menu: menu:
Home: / || fas fa-home # Home: / || fas fa-home
Archives: /archives/ || fas fa-archive # Archives: /archives/ || fas fa-archive
Tags: /tags/ || fas fa-tags # Tags: /tags/ || fas fa-tags
Categories: /categories/ || fas fa-folder-open # Categories: /categories/ || fas fa-folder-open
List||fas fa-list: # List||fas fa-list:
- Music || /music/ || fas fa-music # - Music || /music/ || fas fa-music
- Movie || /movies/ || fas fa-video # - Movie || /movies/ || fas fa-video
Link: /link/ || fas fa-link # Link: /link/ || fas fa-link
About: /about/ || fas fa-heart # About: /about/ || fas fa-heart
# Code Blocks (代碼相關) # Code Blocks (代碼相關)
# -------------------------------------- # --------------------------------------
highlight_theme: light # default / darker / pale night / light / ocean / mac / false highlight_theme: light # default / darker / pale night / light / ocean / mac / mac light / false
highlight_copy: true # copy button highlight_copy: true # copy button
highlight_lang: true # show the code language highlight_lang: true # show the code language
highlight_shrink: false # true: shrink the code blocks / false: expand the code blocks | none: expand code blocks and hide the button highlight_shrink: false # true: shrink the code blocks / false: expand the code blocks | none: expand code blocks and hide the button
@@ -30,14 +30,16 @@ code_word_wrap: false
# copyright: Add the copyright information after copied content (複製的內容後面加上版權信息) # copyright: Add the copyright information after copied content (複製的內容後面加上版權信息)
copy: copy:
enable: true enable: true
copyright: false copyright:
enable: false
limit_count: 50
# social settings (社交圖標設置) # social settings (社交圖標設置)
# formal: # formal:
# icon: link || the description # icon: link || the description
social: social:
fab fa-github: https://github.com/xxxxx || Github # fab fa-github: https://github.com/xxxxx || Github
fas fa-envelope: mailto:xxxxxx@gmail.com || Email # fas fa-envelope: mailto:xxxxxx@gmail.com || Email
# search (搜索) # search (搜索)
# -------------------------------------- # --------------------------------------
@@ -92,18 +94,18 @@ avatar:
# the banner image of home page # the banner image of home page
index_img: index_img:
# if the banner of page not setting,it will show the top_img # if the banner of page not setting, it will show the top_img
default_top_img: https://i.loli.net/2020/05/01/IuWi8QbHvzjlOPw.jpg default_top_img: https://i.loli.net/2020/05/01/IuWi8QbHvzjlOPw.jpg
# the banner image of archive page # the banner image of archive page
archive_img: archive_img:
# the banner image of tag page # the banner image of tag page
# tag page, look like https://xxxxxxxxx.com/tags/butterfly # note: tag page, not tags page (子標籤頁面的 top_img)
tag_img: tag_img:
# the banner image of category page # the banner image of category page
# category page, look like https://xxxxxxxxx.com/categories/butterfly # note: category page, not categories page (子分類頁面的 top_img)
category_img: category_img:
# If you are using hexo-douban, you can configure it (如果你有使用 hexo-douban,可配置這個) # If you are using hexo-douban, you can configure it (如果你有使用 hexo-douban,可配置這個)
@@ -122,7 +124,7 @@ cover:
# left/right/both # left/right/both
position: both position: both
# When cover is not set, the default cover is displayed (當沒有設置cover時默認的封面顯示) # When cover is not set, the default cover is displayed (當沒有設置cover時默認的封面顯示)
default_cover: default_cover:
- https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg - https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg
# Replace Broken Images (替換無法顯示的圖片) # Replace Broken Images (替換無法顯示的圖片)
@@ -141,10 +143,12 @@ post_meta:
date_type: created # created or updated or both 主頁文章日期是創建日或者更新日或都顯示 date_type: created # created or updated or both 主頁文章日期是創建日或者更新日或都顯示
categories: true # true or false 主頁是否顯示分類 categories: true # true or false 主頁是否顯示分類
tags: false # true or false 主頁是否顯示標籤 tags: false # true or false 主頁是否顯示標籤
label: true # true or false 顯示描述性文字
post: post:
date_type: both # created or updated or both 文章頁日期是創建日或者更新日或都顯示 date_type: both # created or updated or both 文章頁日期是創建日或者更新日或都顯示
categories: true # true or false 文章頁是否顯示分類 categories: true # true or false 文章頁是否顯示分類
tags: true # true or false 文章頁是否顯示標籤 tags: true # true or false 文章頁是否顯示標籤
label: true # true or false 顯示描述性文字
# wordcount (字數統計) # wordcount (字數統計)
wordcount: wordcount:
@@ -155,7 +159,7 @@ wordcount:
# Display the article introduction on homepage # Display the article introduction on homepage
# 1: description # 1: description
# 2: both (if the description exists, it will show description. or show the auto_excerpt) # 2: both (if the description exists, it will show description, or show the auto_excerpt)
# 3: auto_excerpt (default) # 3: auto_excerpt (default)
index_post_content: index_post_content:
method: 3 method: 3
@@ -180,12 +184,12 @@ post_copyright:
reward: reward:
enable: false enable: false
QR_code: QR_code:
- img: /img/wechat.jpg # - img: /img/wechat.jpg
link: # link:
text: wechat # text: wechat
- img: /img/alipay.jpg # - img: /img/alipay.jpg
link: # link:
text: alipay # text: alipay
# Related Articles # Related Articles
related_post: related_post:
@@ -200,6 +204,15 @@ photofigcaption: false
# when you scroll in post, the URL will update according to header id. # when you scroll in post, the URL will update according to header id.
anchor: false anchor: false
# Displays outdated notice for a post (文章過期提醒)
noticeOutdate:
enable: false
style: flat # style: simple/flat
limit_day: 500 # When will it be shown
position: top # position: top/bottom
message_prev: It has been
message_next: days since the last update, the content of the article may be outdated.
# Share System (分享功能) # Share System (分享功能)
# -------------------------------------- # --------------------------------------
@@ -231,18 +244,27 @@ addtoany:
# Comments System # Comments System
# -------------------------------------- # --------------------------------------
comments:
# Up to two comments system, the first will be shown as default
# Choose: Disqus/Disqusjs/Livere/Gitalk/Valine/Utterances/Facebook Comments
use:
# - Valine
# - Disqus
text: true # Display the comment name next to the button
# lazyload: The comment system will be load when comment element enters the browser's viewport.
# If you set it to false, the comment count will be invalid
lazyload: false
count: false # Display comment count in top_img
# disqus # disqus
# https://disqus.com/ # https://disqus.com/
disqus: disqus:
enable: false
shortname: shortname:
count: false # dispaly comment count in top_img
# Alternative Disqus - Render comments with Disqus API # Alternative Disqus - Render comments with Disqus API
# DisqusJS評論系統可以實現在網路審查地區載入 Disqus 評論列表,兼容原版 # DisqusJS 評論系統,可以實現在網路審查地區載入 Disqus 評論列表,兼容原版
# https://github.com/SukkaW/DisqusJS # https://github.com/SukkaW/DisqusJS
disqusjs: disqusjs:
enable: false
shortname: shortname:
siteName: siteName:
apikey: apikey:
@@ -250,18 +272,15 @@ disqusjs:
nocomment: # display when a blog post or an article has no comment attached nocomment: # display when a blog post or an article has no comment attached
admin: admin:
adminLabel: adminLabel:
count: false # dispaly comment count in top_img
# livere(來必力) # livere (來必力)
# https://www.livere.com/ # https://www.livere.com/
livere: livere:
enable: false
uid: uid:
# gitalk # gitalk
# https://github.com/gitalk/gitalk # https://github.com/gitalk/gitalk
gitalk: gitalk:
enable: false
client_id: client_id:
client_secret: client_secret:
repo: repo:
@@ -272,31 +291,27 @@ gitalk:
distractionFreeMode: false # Facebook-like distraction free mode. distractionFreeMode: false # Facebook-like distraction free mode.
pagerDirection: last # Comment sorting direction, available values are last and first. pagerDirection: last # Comment sorting direction, available values are last and first.
createIssueManually: false # Gitalk will create a corresponding github issue for your every single page automatically createIssueManually: false # Gitalk will create a corresponding github issue for your every single page automatically
count: false # dispaly comment count in top_img
# valine # valine
# https://valine.js.org # https://valine.js.org
valine: valine:
enable: false # if you want use valine,please set this value is true
appId: # leancloud application app id appId: # leancloud application app id
appKey: # leancloud application app key appKey: # leancloud application app key
pageSize: 10 # comment list page size pageSize: 10 # comment list page size
avatar: monsterid # gravatar style https://valine.js.org/#/avatar avatar: monsterid # gravatar style https://valine.js.org/#/avatar
lang: en # i18n: zh-CN/zh-TW/en/ja lang: en # i18n: zh-CN/zh-TW/en/ja
placeholder: Please leave your footprints # valine comment input placeholder(like: Please leave your footprints ) placeholder: Please leave your footprints # valine comment input placeholder (like: Please leave your footprints)
guest_info: nick,mail,link #valine comment header info (nick/mail/link) guest_info: nick,mail,link # valine comment header info (nick/mail/link)
recordIP: false # Record reviewer IP recordIP: false # Record reviewer IP
serverURLs: # This configuration is suitable for domestic custom domain name users, overseas version will be automatically detected (no need to manually fill in) serverURLs: # This configuration is suitable for domestic custom domain name users, overseas version will be automatically detected (no need to manually fill in)
bg: # valine background bg: # valine background
emojiCDN: # emoji CDN emojiCDN: # emoji CDN
enableQQ: false # enable the Nickname box to automatically get QQ Nickname and QQ Avatar enableQQ: false # enable the Nickname box to automatically get QQ Nickname and QQ Avatar
requiredFields: nick,mail # required fields (nick/mail) requiredFields: nick,mail # required fields (nick/mail)
count: false # dispaly comment count in top_img
# utterances # utterances
# https://utteranc.es/ # https://utteranc.es/
utterances: utterances:
enable: false
repo: repo:
# Issue Mapping: pathname/url/title/og:title # Issue Mapping: pathname/url/title/og:title
issue_term: pathname issue_term: pathname
@@ -307,13 +322,11 @@ utterances:
# Facebook Comments Plugin # Facebook Comments Plugin
# https://developers.facebook.com/docs/plugins/comments/ # https://developers.facebook.com/docs/plugins/comments/
facebook_comments: facebook_comments:
enable: false
app_id: app_id:
user_id: # optional user_id: # optional
pageSize: 10 # The number of comments to show pageSize: 10 # The number of comments to show
order_by: social # social/time/reverse_time order_by: social # social/time/reverse_time
lang: en_US # Language en_US/zh_CN/zh_TW and so on lang: en_US # Language en_US/zh_CN/zh_TW and so on
count: false
# Chat Services # Chat Services
# -------------------------------------- # --------------------------------------
@@ -349,20 +362,25 @@ gitter:
enable: false enable: false
room: room:
# crisp
# https://crisp.chat/en/
crisp:
enable: false
website_id:
# Footer Settings # Footer Settings
# -------------------------------------- # --------------------------------------
footer:
since: 2020 owner:
enable: true
footer_custom_text: since: 2020
custom_text:
footer_copyright: true copyright: true # Copyright of theme and framework
ICP: # Chinese ICP License
ICP: enable: false
enable: false url:
url: text:
text: icon: /img/icp.png
icon: /img/icp.png
# Analysis # Analysis
# -------------------------------------- # --------------------------------------
@@ -382,6 +400,7 @@ tencent_analytics:
# Google Adsense (谷歌廣告) # Google Adsense (谷歌廣告)
google_adsense: google_adsense:
enable: false enable: false
auto_ads: true
js: https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js js: https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
client: client:
enable_page_level_ads: true enable_page_level_ads: true
@@ -411,6 +430,10 @@ baidu_site_verification:
# see http://zhanzhang.so.com/ # see http://zhanzhang.so.com/
qihu_site_verification: qihu_site_verification:
# Yandex Webmaster tools verification setting
# see https://webmaster.yandex.com/
yandex_site_verification:
# Beautify/Effect (美化/效果) # Beautify/Effect (美化/效果)
# -------------------------------------- # --------------------------------------
@@ -434,7 +457,7 @@ qihu_site_verification:
# The top_img settings of home page # The top_img settings of home page
# default: top img - full screen, site info - middle (默認top_img全屏site_info在中間) # default: top img - full screen, site info - middle (默認top_img全屏site_info在中間)
# The positon of site info, eg: 300px/300em/300rem/10% (主頁標題距離頂部距離) # The position of site info, eg: 300px/300em/300rem/10% (主頁標題距離頂部距離)
index_site_info_top: index_site_info_top:
# The height of top_img, eg: 300px/300em/300rem (主頁top_img高度) # The height of top_img, eg: 300px/300em/300rem (主頁top_img高度)
index_top_img_height: index_top_img_height:
@@ -531,17 +554,17 @@ font:
# 左上角網站名字 主頁居中網站名字 # 左上角網站名字 主頁居中網站名字
blog_title_font: blog_title_font:
font_link: https://fonts.googleapis.com/css?family=Titillium+Web&display=swap font_link: https://fonts.googleapis.com/css?family=Titillium+Web&display=swap
font-family: Titillium Web, 'PingFang SC', 'Hiragino Sans GB', Microsoft YaHei', sans-serif font-family: Titillium Web, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif
# The setting of divider icon (水平分隔線圖標設置) # The setting of divider icon (水平分隔線圖標設置)
hr_icon: hr_icon:
enable: true enable: true
icon: # the unicode value of Font Awesome icon icon: # the unicode value of Font Awesome icon, such as '\3423'
icon-top: icon-top:
# the subtitle on homepage (主頁subtitle) # the subtitle on homepage (主頁subtitle)
subtitle: subtitle:
enable: true enable: false
# Typewriter Effect (打字效果) # Typewriter Effect (打字效果)
effect: true effect: true
# loop (循環打字) # loop (循環打字)
@@ -559,8 +582,6 @@ subtitle:
# 開頭不允許轉義字元,如需要,請把整個句子用雙引號包住 # 開頭不允許轉義字元,如需要,請把整個句子用雙引號包住
# 如果關閉打字效果subtitle只會顯示sub的第一行文字 # 如果關閉打字效果subtitle只會顯示sub的第一行文字
sub: sub:
- 今日事&#44;今日畢
- Never put off till tomorrow what you can do today
# Loading Animation (加載動畫) # Loading Animation (加載動畫)
preloader: false preloader: false
@@ -575,12 +596,17 @@ aside:
card_author: card_author:
enable: true enable: true
description: description:
button:
icon: fab fa-github
text: Follow Me
link: https://github.com/xxxxxx
card_announcement: card_announcement:
enable: true enable: true
content: This is my Blog content: This is my Blog
card_recent_post: card_recent_post:
enable: true enable: true
limit: 5 # if set 0 will show all limit: 5 # if set 0 will show all
sort: date # date or updated
card_categories: card_categories:
enable: true enable: true
limit: 8 # if set 0 will show all limit: 8 # if set 0 will show all
@@ -615,7 +641,7 @@ runtimeshow:
# Conversion between Traditional and Simplified Chinese (簡繁轉換) # Conversion between Traditional and Simplified Chinese (簡繁轉換)
translate: translate:
enable: true enable: false
# The text of a button # The text of a button
default: default:
# the language of website (1 - Traditional Chinese/ 2 - Simplified Chinese # the language of website (1 - Traditional Chinese/ 2 - Simplified Chinese
@@ -680,6 +706,16 @@ note:
# other # other
# -------------------------------------- # --------------------------------------
# Pjax [Beta]
# It may contain bugs and unstable, give feedback when you find the bugs.
# https://github.com/MoOx/pjax
pjax: false
# Inject the css and script (aplayer/meting)
aplayerInject:
enable: false
per_page: true
# Snackbar (Toast Notification 彈窗) # Snackbar (Toast Notification 彈窗)
# https://github.com/polonel/SnackBar # https://github.com/polonel/SnackBar
# position 彈窗位置 # position 彈窗位置
@@ -736,7 +772,7 @@ fragment_cache: true
# 插入代码到头部 </head> 之前 和 底部 </body> 之前 # 插入代码到头部 </head> 之前 和 底部 </body> 之前
inject: inject:
head: head:
# - <link rel="stylesheet" href="/xxx.css"> # - <link rel="stylesheet" href="/xxx.css">
bottom: bottom:
# - <script src="xxxx"></script> # - <script src="xxxx"></script>
@@ -750,8 +786,10 @@ CDN:
main: /js/main.js main: /js/main.js
utils: /js/utils.js utils: /js/utils.js
# pjax
pjax: https://cdn.jsdelivr.net/npm/pjax/pjax.min.js
# comments # comments
blueimp_md5: https://cdn.jsdelivr.net/npm/blueimp-md5/js/md5.min.js
gitalk: https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.js gitalk: https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.js
gitalk_css: https://cdn.jsdelivr.net/npm/gitalk/dist/gitalk.min.css gitalk_css: https://cdn.jsdelivr.net/npm/gitalk/dist/gitalk.min.css
valine: https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js valine: https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js
@@ -771,7 +809,7 @@ CDN:
algolia_search_css: https://cdn.jsdelivr.net/npm/instantsearch.js@2.10.5/dist/instantsearch.min.css algolia_search_css: https://cdn.jsdelivr.net/npm/instantsearch.js@2.10.5/dist/instantsearch.min.css
# math # math
mathjax: https://cdn.jsdelivr.net/npm/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML mathjax: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
katex: https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css katex: https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css
katex_copytex: https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.js katex_copytex: https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.js
katex_copytex_css: https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.css katex_copytex_css: https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.css
@@ -787,7 +825,7 @@ CDN:
lazyload: https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js lazyload: https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js
instantpage: https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js instantpage: https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js
typed: https://cdn.jsdelivr.net/npm/typed.js typed: https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js
pangu: https://cdn.jsdelivr.net/npm/pangu/dist/browser/pangu.min.js pangu: https://cdn.jsdelivr.net/npm/pangu/dist/browser/pangu.min.js
# photo # photo
@@ -819,4 +857,4 @@ CDN:
# aplayer # aplayer
aplayer_css: https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css aplayer_css: https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css
aplayer_js: https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js aplayer_js: https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js
meting_js: https://cdn.jsdelivr.net/npm/meting@1.2.0/dist/Meting.min.js meting_js: https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js

View File

@@ -3,7 +3,7 @@ sidebar:
have_read: You've read have_read: You've read
footer: footer:
driven: Driven framework: Framework
theme: Theme theme: Theme
copy: copy:
@@ -24,7 +24,8 @@ post:
created: Created created: Created
updated: Updated updated: Updated
wordcount: Word count wordcount: Word count
min2read: 'Reading time: %s min' min2read: Reading time
min2read_unit: min
page_pv: Post View page_pv: Post View
comments: Comments comments: Comments
copyright: copyright:
@@ -61,7 +62,6 @@ aside:
card_tags: Tags card_tags: Tags
card_archives: Archives card_archives: Archives
card_recent_post: Recent Post card_recent_post: Recent Post
card_bookmark: Bookmark
card_webinfo: card_webinfo:
headline: Info headline: Info
article_name: Article article_name: Article

View File

@@ -3,7 +3,7 @@ sidebar:
have_read: You've read have_read: You've read
footer: footer:
driven: Driven framework: Framework
theme: Theme theme: Theme
copy: copy:
@@ -24,7 +24,8 @@ post:
created: Created created: Created
updated: Updated updated: Updated
wordcount: Word count wordcount: Word count
min2read: 'Reading time: %s min' min2read: Reading time
min2read_unit: min
page_pv: Post View page_pv: Post View
comments: Comments comments: Comments
copyright: copyright:
@@ -61,7 +62,6 @@ aside:
card_tags: Tags card_tags: Tags
card_archives: Archives card_archives: Archives
card_recent_post: Recent Post card_recent_post: Recent Post
card_bookmark: Bookmark
card_webinfo: card_webinfo:
headline: Info headline: Info
article_name: Article article_name: Article

View File

@@ -3,7 +3,7 @@ sidebar:
have_read: 你已经读了 have_read: 你已经读了
footer: footer:
driven: 驱动 framework: 框架
theme: 主题 theme: 主题
copy: copy:
@@ -24,7 +24,8 @@ post:
created: 发表于 created: 发表于
updated: 更新于 updated: 更新于
wordcount: 字数总计 wordcount: 字数总计
min2read: '阅读时长: %s 分钟' min2read: 阅读时长
min2read_unit: 分钟
page_pv: 阅读量 page_pv: 阅读量
comments: 评论数 comments: 评论数
copyright: copyright:
@@ -38,13 +39,13 @@ post:
search: 搜索 search: 搜索
algolia_search: algolia_search:
input_placeholder: 搜索文章 input_placeholder: 搜索文章
hits_empty: '找不到您查询的内容:${query}' hits_empty: '找不到您查询的内容${query}'
hits_stats: '找到 ${hits} 条结果,用时 ${time} 毫秒' hits_stats: '找到 ${hits} 条结果,用时 ${time} 毫秒'
local_search: local_search:
label: 本地搜索 label: 本地搜索
input_placeholder: 搜索文章 input_placeholder: 搜索文章
hits_empty: '找不到您查询的内容:${query}' hits_empty: '找不到您查询的内容${query}'
powered: '提供支持' powered: '提供支持'
by: by:
@@ -63,7 +64,6 @@ aside:
card_tags: 标签 card_tags: 标签
card_archives: 归档 card_archives: 归档
card_recent_post: 最新文章 card_recent_post: 最新文章
card_bookmark: 加入书签
card_webinfo: card_webinfo:
headline: 网站资讯 headline: 网站资讯
article_name: 文章数目 article_name: 文章数目

View File

@@ -3,8 +3,8 @@ sidebar:
have_read: 你已經讀了 have_read: 你已經讀了
footer: footer:
driven: Power by framework: 框架
theme: Theme theme: 主題
copy: copy:
success: 複製成功 success: 複製成功
@@ -24,7 +24,8 @@ post:
created: 發表於 created: 發表於
updated: 更新於 updated: 更新於
wordcount: 字數總計 wordcount: 字數總計
min2read: '閱讀時長: %s 分鐘' min2read: 閲讀時長
min2read_unit: 分鐘
page_pv: 閱讀量 page_pv: 閱讀量
comments: 評論數 comments: 評論數
copyright: copyright:
@@ -38,13 +39,13 @@ post:
search: 搜尋 search: 搜尋
algolia_search: algolia_search:
input_placeholder: 搜尋文章 input_placeholder: 搜尋文章
hits_empty: '找不到您查詢的內容:${query}' hits_empty: '找不到您查詢的內容${query}'
hits_stats: '找到 ${hits} 條結果,用時 ${time} 毫秒' hits_stats: '找到 ${hits} 條結果,用時 ${time} 毫秒'
local_search: local_search:
label: 本地搜尋 label: 本地搜尋
input_placeholder: 搜尋文章 input_placeholder: 搜尋文章
hits_empty: '找不到您查詢的內容:${query}' hits_empty: '找不到您查詢的內容${query}'
powered: '提供支援' powered: '提供支援'
by: by:
@@ -63,7 +64,6 @@ aside:
card_tags: 標籤 card_tags: 標籤
card_archives: 歸檔 card_archives: 歸檔
card_recent_post: 最新文章 card_recent_post: 最新文章
card_bookmark: 加入書籤
card_webinfo: card_webinfo:
headline: 網站資訊 headline: 網站資訊
article_name: 文章數目 article_name: 文章數目

View File

@@ -26,5 +26,5 @@ html(lang=config.language data-theme=theme.display_mode)
i.fas.fa-rocket i.fas.fa-rocket
= _p('error404.back_button') = _p('error404.back_button')
!=partial('includes/search/index', {}, {cache:theme.fragment_cache}) !=partial('includes/third-party/search/index', {}, {cache:theme.fragment_cache})
include includes/additional-js.pug include includes/additional-js.pug

View File

@@ -11,13 +11,14 @@
.flink-list-item .flink-list-item
a(href=url_for(item.link) title=item.name target="_blank") a(href=url_for(item.link) title=item.name target="_blank")
if theme.lazyload.enable if theme.lazyload.enable
img(data-src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name ) img(data-lazy-src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name )
else else
img(src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name ) img(src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name )
.flink-item-name= item.name span.flink-item-name= item.name
.flink-item-desc= item.descr span.flink-item-desc(title=item.descr)= item.descr
!= page.content != page.content
if page.comments !== false if page.comments !== false && theme.comments && theme.comments.use
include includes/comments/index.pug - var commentsJsLoad = true
!=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache})

View File

@@ -1,76 +1,61 @@
script(src=url_for(theme.CDN.jquery)) div
script(src=url_for(theme.CDN.utils)) script(src=url_for(theme.CDN.jquery))
script(src=url_for(theme.CDN.main)) script(src=url_for(theme.CDN.utils))
script(src=url_for(theme.CDN.main))
if theme.translate && theme.translate.enable if theme.translate && theme.translate.enable
script(src=url_for(theme.CDN.translate)) script(src=url_for(theme.CDN.translate))
if theme.medium_zoom if theme.medium_zoom
script(src=url_for(theme.CDN.medium_zoom)) script(src=url_for(theme.CDN.medium_zoom))
else if theme.fancybox
script(src=url_for(theme.CDN.fancybox))
if theme.fancybox if theme.instantpage
script(src=url_for(theme.CDN.fancybox)) script(src=url_for(theme.CDN.instantpage) type="module" defer)
include ./math/index.pug if theme.lazyload.enable
script(src=url_for(theme.CDN.lazyload) async)
if theme.fireworks && theme.fireworks.enable if (theme.snackbar && theme.snackbar.enable)
script(src=url_for(theme.CDN.anime)) script(src=url_for(theme.CDN.snackbar))
script(src=url_for(theme.CDN.fireworks))
if (theme.snackbar && theme.snackbar.enable) if theme.pangu && theme.pangu.enable
script(src=url_for(theme.CDN.snackbar)) !=partial('includes/third-party/pangu.pug', {}, {cache:theme.fragment_cache})
if (theme.canvas_ribbon && theme.canvas_ribbon.enable) //- search
include ./third-party/canvas-ribbon.pug if theme.algolia_search.enable
script(src=url_for(theme.CDN.algolia_js))
else if theme.local_search.enable
script(src=url_for(theme.CDN.local_search))
if (theme.canvas_ribbon_piao && theme.canvas_ribbon_piao.enable) if theme.preloader
include ./third-party/canvas-ribbon-piao.pug !=partial('includes/loading/loading-js', {}, {cache:theme.fragment_cache})
if (theme.canvas_nest && theme.canvas_nest.enable) .js-pjax
include ./third-party/canvas-nest.pug if is_home() && theme.subtitle.enable
include ./third-party/subtitle.pug
if theme.activate_power_mode.enable include ./third-party/math/index.pug
script(src=url_for(theme.CDN.activate_power_mode))
script.
POWERMODE.colorful = #{theme.activate_power_mode.colorful};
POWERMODE.shake = #{theme.activate_power_mode.shake};
document.body.addEventListener('input', POWERMODE);
if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv if commentsJsLoad
script(async src=url_for(theme.CDN.busuanzi)) include ./third-party/comments/js.pug
if theme.instantpage if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv
script(src=url_for(theme.CDN.instantpage) type="module" defer) script(async src=url_for(theme.CDN.busuanzi))
if theme.lazyload.enable !=fragment_cache('injectBottom', function(){return injectHtml(theme.inject.bottom)})
script(src=url_for(theme.CDN.lazyload) async)
//- 鼠標特效 !=partial('includes/third-party/effect', {}, {cache:theme.fragment_cache})
if theme.click_heart
script(src=url_for(theme.CDN.click_heart))
if theme.ClickShowText && theme.ClickShowText.enable !=partial('includes/third-party/chat/index', {}, {cache:theme.fragment_cache})
script(src=url_for(theme.CDN.ClickShowText))
if theme.pangu && theme.pangu.enable if theme.aplayerInject && theme.aplayerInject.enable
include ./third-party/pangu.pug if theme.pjax || theme.aplayerInject.per_page
include ./head/aplayer.pug
else if page.aplayer
include ./head/aplayer.pug
//- search if theme.pjax
if theme.algolia_search && theme.algolia_search.enable !=partial('includes/third-party/pjax', {}, {cache:theme.fragment_cache})
script(src=url_for(theme.CDN.algolia_js))
else if theme.local_search && theme.local_search.enable
script(src=url_for(theme.CDN.local_search))
//- mermaid
if theme.mermaid.enable
include ./math/mermaid.pug
if is_home()
include ./head/subtitle.pug
!=fragment_cache('injectBottom', function(){return injectHtml(theme.inject.bottom)})
if theme.preloader
!=partial('includes/loading/loading-js', {}, {cache:theme.fragment_cache})
!=partial('includes/chat/index', {}, {cache:theme.fragment_cache})

View File

@@ -1,28 +0,0 @@
//- https://sidecar.gitter.im/
script.
var isChatBtn = !{theme.chat_btn}
if (isChatBtn) {
((window.gitter = {}).chat = {}).options = {
room: '#{theme.gitter.room}',
activationElement: '#chat_btn'
};
} else {
((window.gitter = {}).chat = {}).options = {
room: '#{theme.gitter.room}',
};
if (!{theme.chat_hide_show}) {
var gitterBtn = document.getElementsByClassName('gitter-open-chat-button')
function chatBtnHide () {
gitterBtn[0].style.display= 'none'
}
function chatBtnShow () {
gitterBtn[0].style.display= 'block'
}
}
}
script(src="https://sidecar.gitter.im/dist/sidecar.v1.js" async defer)

View File

@@ -1,39 +0,0 @@
script(src=`//code.tidio.co/${theme.tidio.public_key}.js` async)
if theme.chat_btn
script.
(function() {
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);
}
document.getElementById("chat_btn").addEventListener("click", function(){
window.tidioChatApi.show();
window.tidioChatApi.open();
});
})();
else if theme.chat_hide_show
script.
function chatBtnHide () {
if (window.tidioChatApi) {
window.tidioChatApi.hide();
//- document.getElementById('tidio-chat').style.display= 'none'
}
}
function chatBtnShow () {
if (window.tidioChatApi) {
window.tidioChatApi.show();
//- document.getElementById('tidio-chat').style.display= 'block'
}
}

View File

@@ -1,24 +0,0 @@
#disqus_thread
script.
var disqus_config = function () {
this.page.url = '!{ page.permalink }';
this.page.identifier = '!{ page.path }';
this.page.title = '!{ page.title }';
};
(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);
})();
if is_post() && theme.disqus.count
script.
function getDisqusCount() {
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);
}
window.addEventListener('load', getDisqusCount, false);

View File

@@ -1,25 +0,0 @@
#disqus_thread
script(src=url_for(theme.CDN.disqusjs))
script.
var dsqjs = new DisqusJS({
shortname: '!{theme.disqusjs.shortname}',
siteName: '!{theme.disqusjs.siteName}',
identifier: '!{ page.path }',
url: '!{ page.permalink }',
title: '!{ page.title }',
api: '!{theme.disqusjs.api}',
apikey: '!{theme.disqusjs.apikey}',
nocomment: '!{theme.disqusjs.nocomment}',
admin: '!{theme.disqusjs.admin}',
adminLabel: '!{theme.disqusjs.adminLabel}'
});
if is_post() && theme.disqusjs.count
script.
function getDisqusCount() {
var d = document, s = d.createElement('script');
s.src = 'https://!{theme.disqusjs.shortname}.disqus.com/count.js';
s.id = 'dsq-count-scr';
(d.head || d.body).appendChild(s);
}
window.addEventListener('load', getDisqusCount, false);

View File

@@ -1,12 +0,0 @@
#fb-root
script(async defer crossorigin="anonymous" src=`https://connect.facebook.net/${theme.facebook_comments.lang}/sdk.js#xfbml=1&version=v6.0`)
.fb-comments(data-colorscheme = theme.display_mode === 'dark' ? 'dark' : 'light'
data-href=urlNoIndex()
data-numposts= theme.facebook_comments.pageSize || 10
data-order-by= theme.facebook_comments.order_by || 'social'
data-width="100%")
if theme.darkmode.enable
script.
var themeNow = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'
document.getElementsByClassName('fb-comments')[0].setAttribute('data-colorscheme',themeNow)

View File

@@ -1,27 +0,0 @@
#gitalk-container
script.
var gitalk = new Gitalk({
clientID: '!{theme.gitalk.client_id}',
clientSecret: '!{theme.gitalk.client_secret}',
repo: '!{theme.gitalk.repo}',
owner: '!{theme.gitalk.owner}',
admin: ['!{theme.gitalk.admin}'],
id: md5(decodeURI(location.pathname)),
language: '!{theme.gitalk.language}',
perPage: !{theme.gitalk.perPage},
distractionFreeMode: !{theme.gitalk.distractionFreeMode},
pagerDirection: '!{theme.gitalk.pagerDirection}',
createIssueManually: !{theme.gitalk.createIssueManually},
updateCountCallback: commentCount
})
gitalk.render('gitalk-container')
function commentCount(n){
try {
document.getElementsByClassName('gitalk-comment-count')[0].innerHTML= n
} catch (e) {
return false
}
}

View File

@@ -1,29 +0,0 @@
- var d = theme.disqus && theme.disqus.enable
- var dj = theme.disqusjs && theme.disqusjs.enable
- var l = theme.livere && theme.livere.enable
- var gt = theme.gitalk && theme.gitalk.enable
- var v = theme.valine && theme.valine.enable
- var u = theme.utterances && theme.utterances.enable
- var fb = theme.facebook_comments && theme.facebook_comments.enable
- var isComment = d || dj || l || gt || v || u || fb
if isComment
hr
#post-comment
.comment_headling
i.fas.fa-comments.fa-fw
span= ' ' + _p('comment')
if d
include ./disqus.pug
else if dj
include ./disqusjs.pug
else if l
include ./livere.pug
else if gt
include ./gitalk.pug
else if v
include ./valine.pug
else if u
include ./utterances.pug
else if fb
include ./facebook_comments.pug

View File

@@ -1,21 +0,0 @@
script#utterances_comment(src=theme.CDN.utterances
repo=theme.utterances.repo
issue-term=theme.utterances.issue_term
theme= theme.display_mode === 'dark' ? theme.utterances.dark_theme : theme.utterances.light_theme
crossorigin="anonymous"
async)
if theme.darkmode.enable
script.
var themeNow = document.documentElement.getAttribute('data-theme') === 'dark' ? '#{theme.utterances.dark_theme}' : '#{theme.utterances.light_theme}'
document.getElementById('utterances_comment').setAttribute('theme',themeNow)
function utterancesTheme () {
var theme = document.documentElement.getAttribute('data-theme') === 'dark' ? '#{theme.utterances.dark_theme}' : '#{theme.utterances.light_theme}'
const message = {
type: 'set-theme',
theme: theme
};
const iframe = document.querySelector('.utterances-frame');
iframe.contentWindow.postMessage(message, 'https://utteranc.es');
}

View File

@@ -1,35 +0,0 @@
- let emojiMaps = '""'
if site.data.valine
- emojiMaps = JSON.stringify(site.data.valine)
#vcomment.vcomment
script(src=url_for(theme.CDN.valine))
script.
var requestSetting = function (from,set) {
var from = from
var setting = set.split(',').filter(function(item){
return from.indexOf(item) > -1
});
setting = setting.length == 0 ? from :setting;
return setting
}
var guestInfo = requestSetting(['nick','mail','link'],'#{ theme.valine.guest_info }')
var requiredFields = requestSetting(['nick','mail'],'#{ theme.valine.requiredFields }')
window.valine = new Valine({
el:'#vcomment',
appId: '#{theme.valine.appId}',
appKey: '#{theme.valine.appKey}',
placeholder: '#{theme.valine.placeholder}',
avatar: '#{theme.valine.avatar}',
meta: guestInfo,
pageSize: '#{theme.valine.pageSize}',
lang: '#{theme.valine.lang}',
recordIP: #{theme.valine.recordIP},
serverURLs: '#{theme.valine.serverURLs}',
emojiCDN: '#{theme.valine.emojiCDN}',
emojiMaps: !{emojiMaps},
enableQQ: #{theme.valine.enableQQ},
requiredFields: requiredFields
});

View File

@@ -1,24 +1,23 @@
#footer-wrap #footer-wrap
- var now = new Date() if theme.footer.owner.enable
- var nowYear = now.getFullYear() - var now = new Date()
if theme.since && theme.since != nowYear - var nowYear = now.getFullYear()
.copyright!= `&copy;${theme.since} - ${nowYear} By ${config.author}` if theme.footer.owner.since && theme.footer.owner.since != nowYear
else .copyright!= `&copy;${theme.footer.owner.since} - ${nowYear} By ${config.author}`
.copyright!= `&copy;${nowYear} By ${config.author}` else
if theme.footer_copyright .copyright!= `&copy;${nowYear} By ${config.author}`
if theme.footer.copyright
.framework-info .framework-info
span= _p('footer.driven') + ' ' span= _p('footer.framework') + ' '
a(href='https://hexo.io') a(href='https://hexo.io')= 'Hexo'
span Hexo
span.footer-separator | span.footer-separator |
span= _p('footer.theme') + ' ' span= _p('footer.theme') + ' '
a(href='https://github.com/jerryc127/hexo-theme-butterfly') a(href='https://github.com/jerryc127/hexo-theme-butterfly')= 'Butterfly'
span Butterfly if theme.footer.custom_text
if theme.footer_custom_text .footer_custom_text!=`${theme.footer.custom_text}`
.footer_custom_text!=`${theme.footer_custom_text}` if theme.footer.ICP.enable
if theme.ICP.enable
.icp .icp
a(href=theme.ICP.url) a(href=theme.footer.ICP.url)
if theme.ICP.icon if theme.footer.ICP.icon
img.icp-icon(src=url_for(theme.ICP.icon)) img.icp-icon(src=url_for(theme.footer.ICP.icon))
span=theme.ICP.text span=theme.footer.ICP.text

View File

@@ -35,10 +35,6 @@ if theme.disable_baidu_transformation
meta(http-equiv="Cache-Control" content="no-transform") meta(http-equiv="Cache-Control" content="no-transform")
meta(http-equiv="Cache-Control" content="no-siteapp") meta(http-equiv="Cache-Control" content="no-siteapp")
if theme.douban
if theme.douban.meta && (is_current('/movies/', [strict]) || is_current('/books/', [strict]) || is_current('/games/', [strict]))
meta(name="referrer" content="no-referrer")
//- 預解析 //- 預解析
!=partial('includes/head/preconnect', {}, {cache:theme.fragment_cache}) !=partial('includes/head/preconnect', {}, {cache:theme.fragment_cache})
@@ -48,6 +44,11 @@ if theme.douban
//- Open_Graph //- Open_Graph
include ./head/Open_Graph.pug include ./head/Open_Graph.pug
if theme.facebook_comments.app_id
meta(property="fb:app_id" content=theme.facebook_comments.app_id )
if theme.facebook_comments.user_id
meta(property="fb:admins" content=theme.facebook_comments.user_id)
//- PWA //- PWA
if (theme.pwa && theme.pwa.enable) if (theme.pwa && theme.pwa.enable)
!=partial('includes/head/pwa', {}, {cache:theme.fragment_cache}) !=partial('includes/head/pwa', {}, {cache:theme.fragment_cache})
@@ -65,19 +66,10 @@ if theme.fancybox
if (theme.snackbar && theme.snackbar.enable) if (theme.snackbar && theme.snackbar.enable)
link(rel='stylesheet', href=url_for(theme.CDN.snackbar_css)) link(rel='stylesheet', href=url_for(theme.CDN.snackbar_css))
if is_post()
if(page.prev)
link(rel="prev" title=page.prev.title href=url_for(page.prev.permalink) )
if(page.next)
link(rel="next" title=page.next.title href=url_for(page.next.permalink) )
if theme.algolia_search.enable if theme.algolia_search.enable
link(rel="stylesheet" type="text/css" href=url_for(theme.CDN.algolia_search_css)) link(rel='stylesheet' href=url_for(theme.CDN.algolia_search_css))
script(src=url_for(theme.CDN.algolia_search) defer) script(src=url_for(theme.CDN.algolia_search) defer)
//- comment css
include ./head/comment.pug
//- google_adsense //- google_adsense
!=partial('includes/head/google_adsense', {}, {cache:theme.fragment_cache}) !=partial('includes/head/google_adsense', {}, {cache:theme.fragment_cache})
@@ -96,5 +88,3 @@ include ./head/noscript.pug
!=fragment_cache('injectHead', function(){return injectHtml(theme.inject.head)}) !=fragment_cache('injectHead', function(){return injectHtml(theme.inject.head)})
if page.aplayer
include ./head/aplayer.pug

View File

@@ -9,14 +9,12 @@ if theme.baidu_analytics
})(); })();
if theme.google_analytics if theme.google_analytics
script(async src=`https://www.googletagmanager.com/gtag/js?id=${theme.google_analytics}`)
script. script.
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ window.dataLayer = window.dataLayer || [];
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), function gtag(){dataLayer.push(arguments);}
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) gtag('js', new Date());
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); gtag('config', '!{theme.google_analytics}');
ga('create', '!{theme.google_analytics}', 'auto');
ga('send', 'pageview');
if theme.tencent_analytics if theme.tencent_analytics
script(src=`https://tajs.qq.com/stats?sId=${theme.tencent_analytics}` charset="UTF-8") script(src=`https://tajs.qq.com/stats?sId=${theme.tencent_analytics}` charset="UTF-8" data-pjax)

View File

@@ -1,14 +0,0 @@
if (theme.facebook_comments.enable && page.comments !== false && !is_tag() && !is_category() && !is_archive() && !is_home())
if theme.facebook_comments.app_id
meta(property="fb:app_id" content=theme.facebook_comments.app_id )
if theme.facebook_comments.user_id
meta(property="fb:admins" content=theme.facebook_comments.user_id)
if (theme.disqusjs && theme.disqusjs.enable && page.comments !== false && !is_tag() && !is_category() && !is_archive() && !is_home())
link(rel="stylesheet" type="text/css" href=url_for(theme.CDN.disqusjs_css))
if (theme.gitalk && theme.gitalk.enable && page.comments !== false && !is_tag() && !is_category() && !is_archive() && !is_home())
link(rel="stylesheet" type="text/css" href=url_for(theme.CDN.gitalk_css))
script(src=url_for(theme.CDN.gitalk))
script(src=url_for(theme.CDN.blueimp_md5))

View File

@@ -36,14 +36,15 @@
}) })
} }
var copyright = 'undefined' ; var copyright = 'undefined';
if (theme.copy.enable && theme.copy.copyright){ if (theme.copy.enable && theme.copy.copyright.enable){
copyright = JSON.stringify({ copyright = JSON.stringify({
limitCount: theme.copy.copyright.limit_count,
languages: { languages: {
author: _p("copy_copyright.author") + ': ' + config.author, author: _p("copy_copyright.author") + ': ' + config.author,
link: _p("copy_copyright.link") + ': ', link: _p("copy_copyright.link") + ': ',
source: _p("copy_copyright.source") + ': ' + config.title, source: _p("copy_copyright.source") + ': ' + config.title,
info: _p("copy_copyright.info") info: _p("copy_copyright.info")
} }
}) })
} }
@@ -74,12 +75,23 @@
}) })
} }
var noticeOutdate = 'undefined';
if (theme.noticeOutdate && theme.noticeOutdate.enable) {
noticeOutdate = JSON.stringify({
limitDay: theme.noticeOutdate.limit_day,
position: theme.noticeOutdate.position,
messagePrev: theme.noticeOutdate.message_prev,
messageNext: theme.noticeOutdate.message_next,
})
}
script. script.
var GLOBAL_CONFIG = { var GLOBAL_CONFIG = {
root: '!{config.root}', root: '!{config.root}',
algolia: !{algolia}, algolia: !{algolia},
localSearch: !{localSearch}, localSearch: !{localSearch},
translate: !{translate}, translate: !{translate},
noticeOutdate: !{noticeOutdate},
copy: { copy: {
success: '!{_p("copy.success")}', success: '!{_p("copy.success")}',
error: '!{_p("copy.error")}', error: '!{_p("copy.error")}',

View File

@@ -1,17 +1,19 @@
- -
let isHighlightShrink let isHighlightShrink
if (theme.highlight_shrink == 'none') isHighlightShrink = 'undefined' if (theme.highlight_shrink == 'none') isHighlightShrink = 'undefined'
else if (page.highlight_shrink !== null && page.toc !== undefined ) isHighlightShrink = page.highlight_shrink else if (page.highlight_shrink === true || page.highlight_shrink === false) isHighlightShrink = page.highlight_shrink
else isHighlightShrink = theme.highlight_shrink else isHighlightShrink = theme.highlight_shrink
const pageToc = page.toc !== null && page.toc !== undefined ? page.toc : theme.toc.enable const pageToc = page.toc === true || page.toc === false ? page.toc : theme.toc.enable
const showToc = is_post() && pageToc && (toc(page.content) !== '' || page.encrypt == true ) const showToc = is_post() && pageToc && (toc(page.content) !== '' || page.encrypt == true )
- -
script. script#config_change
var GLOBAL_CONFIG_SITE = { .
isPost: !{is_post()}, var GLOBAL_CONFIG_SITE = {
isHome: !{is_home()}, isPost: !{is_post()},
isHighlightShrink: !{isHighlightShrink}, isHome: !{is_home()},
isSidebar: !{showToc} isHighlightShrink: !{isHighlightShrink},
isSidebar: !{showToc},
postUpdate: '!{full_date(page.updated)}'
} }

View File

@@ -1,7 +1,9 @@
if (theme.google_adsense && theme.google_adsense.enable) if (theme.google_adsense && theme.google_adsense.enable)
script(async src=theme.google_adsense.js) script(async src=theme.google_adsense.js)
script.
(adsbygoogle = window.adsbygoogle || []).push({ if theme.google_adsense.auto_ads
google_ad_client: '!{theme.google_adsense.client}', script.
enable_page_level_ads: '!{theme.google_adsense.enable_page_level_ads}' (adsbygoogle = window.adsbygoogle || []).push({
}); google_ad_client: '!{theme.google_adsense.client}',
enable_page_level_ads: '!{theme.google_adsense.enable_page_level_ads}'
});

View File

@@ -3,7 +3,7 @@ noscript.
#nav { #nav {
opacity: 1 opacity: 1
} }
.justified-gallery img{ .justified-gallery img {
opacity: 1 opacity: 1
} }
</style> </style>

View File

@@ -1,13 +1,13 @@
link(rel="manifest" href=theme.pwa.manifest) link(rel="manifest" href=url_for(theme.pwa.manifest))
if(theme.pwa.theme_color) if(theme.pwa.theme_color)
meta(name="theme-color" content=theme.pwa.theme_color) meta(name="theme-color" content=theme.pwa.theme_color)
if(theme.pwa.theme_color) if(theme.pwa.theme_color)
meta(name="msapplication-TileColor" content=theme.pwa.theme_color) meta(name="msapplication-TileColor" content=theme.pwa.theme_color)
if(theme.pwa.apple_touch_icon) if(theme.pwa.apple_touch_icon)
link(rel="apple-touch-icon" sizes="180x180" href=theme.pwa.apple_touch_icon) link(rel="apple-touch-icon" sizes="180x180" href=url_for(theme.pwa.apple_touch_icon))
if(theme.pwa.favicon_32_32) if(theme.pwa.favicon_32_32)
link(rel="icon" type="image/png" sizes="32x32" href=theme.pwa.favicon_32_32) link(rel="icon" type="image/png" sizes="32x32" href=url_for(theme.pwa.favicon_32_32))
if(theme.pwa.favicon_16_16) if(theme.pwa.favicon_16_16)
link(rel="icon" type="image/png" sizes="16x16" href=theme.pwa.favicon_16_16) link(rel="icon" type="image/png" sizes="16x16" href=url_for(theme.pwa.favicon_16_16))
if(theme.pwa.mask_icon) if(theme.pwa.mask_icon)
link(rel="mask-icon" href=theme.pwa.mask_icon color="#5bbad5") link(rel="mask-icon" href=url_for(theme.pwa.mask_icon) color="#5bbad5")

View File

@@ -9,3 +9,6 @@ if theme.baidu_site_verification
if theme.qihu_site_verification if theme.qihu_site_verification
meta(name="360-site-verification" content=theme.qihu_site_verification) meta(name="360-site-verification" content=theme.qihu_site_verification)
if theme.yandex_site_verification
meta(name="yandex-verification" content=theme.yandex_site_verification)

View File

@@ -1,130 +0,0 @@
if theme.subtitle.enable
- var source = theme.subtitle.source
- var subtitleEffect = theme.subtitle.effect
if subtitleEffect
script(src=url_for(theme.CDN.typed))
if source == '1'
script.
var subtitleType = function () {
var subtitleEffect = !{ subtitleEffect }
fetch('https://api.btstu.cn/yan/api.php?charset=utf-8&encode=json',)
.then(function (res) {
return res.json()
})
.then(function (data) {
if (subtitleEffect) {
var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',')
var both = sub.unshift(data.text)
var typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
backSpeed: 50,
})
} else {
document.getElementById('subtitle').innerHTML = data.text
}
})
.catch(function (err) {
console.error(err)
})
}
window.addEventListener('load', subtitleType)
else if source == '2'
script.
var subtitleType = function () {
var subtitleEffect = !{ subtitleEffect }
fetch('https://v1.hitokoto.cn')
.then(function (res) {
return res.json()
})
.then(function (data) {
if (subtitleEffect) {
var from = '出自 ' + data.from
var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',')
var both = sub.unshift(data.hitokoto, from)
var typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
backSpeed: 50,
})
} else {
document.getElementById('subtitle').innerHTML = data.hitokoto
}
})
.catch(function (err) {
console.error(err)
})
}
window.addEventListener('load', subtitleType)
else if source == '3'
script.
var subtitleType = function () {
loadScript('http://yijuzhan.com/api/word.php?m=js', function () {
var subtitleEffect = !{ subtitleEffect }
var con = str[0]
if (subtitleEffect) {
var from = '出自 ' + str[1]
var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',')
var both = sub.unshift(con, from)
var typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
backSpeed: 50,
})
} else {
document.getElementById('subtitle').innerHTML = con
}
})
}
window.addEventListener('load', subtitleType)
else if source == '4'
script.
var subtitleType = function () {
loadScript('https://sdk.jinrishici.com/v2/browser/jinrishici.js',function () {
var subtitleEffect = !{ subtitleEffect }
jinrishici.load(function (result) {
if (subtitleEffect) {
var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',')
var content = result.data.content
var both = sub.unshift(content)
var typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
backSpeed: 50,
})
} else {
document.getElementById('subtitle').innerHTML = result.data.content
}
})
}
)
}
window.addEventListener('load', subtitleType)
else
script.
var subtitleEffect = !{subtitleEffect}
if (subtitleEffect) {
var typed = new Typed("#subtitle", {
strings: "!{theme.subtitle.sub}".split(","),
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
backSpeed: 50
})
} else {
document.getElementById("subtitle").innerHTML = '!{theme.subtitle.sub[0]}'
}

View File

@@ -1,22 +1,23 @@
.menus_items if theme.menu
each value, label in theme.menu .menus_items
if !Array.isArray(value) each value, label in theme.menu
.menus_item if !Array.isArray(value)
a.site-page(href=url_for(trim(value.split('||')[0]))) .menus_item
if value.split('||')[1] a.site-page(href=url_for(trim(value.split('||')[0])))
i.fa-fw(class=trim(value.split('||')[1])) if value.split('||')[1]
span=' '+label i.fa-fw(class=trim(value.split('||')[1]))
else span=' '+label
.menus_item else
a.site-page .menus_item
if label.split('||')[1] a.site-page(href='javascript:void(0);')
i.fa-fw(class=trim(label.split('||')[1]) ) if label.split('||')[1]
span=' '+ trim(label.split('||')[0]) i.fa-fw(class=trim(label.split('||')[1]))
i.fas.fa-chevron-down.menus-expand span=' '+ trim(label.split('||')[0])
ul.menus_item_child i.fas.fa-chevron-down.expand
each i in value ul.menus_item_child
li each i in value
a.site-page(href=url_for(trim(i.split('||')[1]))) li
if i.split('||')[2] a.site-page(href=url_for(trim(i.split('||')[1])))
i.fa-fw(class=trim(i.split('||')[2])) if i.split('||')[2]
span=' '+trim(i.split('||')[0]) i.fa-fw(class=trim(i.split('||')[2]))
span=' '+trim(i.split('||')[0])

View File

@@ -3,7 +3,7 @@ nav#nav
a#site-name.blog_title(href=url_for('/')) #[=config.title] a#site-name.blog_title(href=url_for('/')) #[=config.title]
span.pull-right.menus span.pull-right.menus
if (theme.algolia_search.enable || theme.local_search && theme.local_search.enable) if (theme.algolia_search.enable || theme.local_search.enable)
#search_button #search_button
a.site-page.social-icon.search a.site-page.social-icon.search
i.fas.fa-search.fa-fw i.fas.fa-search.fa-fw

View File

@@ -5,84 +5,79 @@
#post-meta #post-meta
.meta-firstline .meta-firstline
if (theme.post_meta.post.date_type) if (theme.post_meta.post.date_type)
if (theme.post_meta.post.date_type === 'both') span.post-meta-date
time.post-meta__date if (theme.post_meta.post.date_type === 'both')
span.post-meta__date-created(title= _p('post.created')+' '+full_date(page.date)) i.far.fa-calendar-alt.fa-fw.post-meta-icon
i.far.fa-calendar-alt.fa-fw span.post-meta-label= _p('post.created')
=' '+_p('post.created')+' '+date(page.date, config.date_format) time.post-meta-date-created(datetime=date_xml(page.date) title=_p('post.created') + ' ' + full_date(page.date))=date(page.date, config.date_format)
span.post-meta__separator | span.post-meta-separator |
span.post-meta__date-updated(title= _p('post.updated')+' '+full_date(page.updated)) i.fas.fa-history.fa-fw.post-meta-icon
i.fas.fa-history.fa-fw span.post-meta-label= _p('post.updated')
=' '+_p('post.updated')+' '+date(page.updated, config.date_format) time.post-meta-date-updated(datetime=date_xml(page.updated) title=_p('post.updated') + ' ' + full_date(page.updated))=date(page.updated, config.date_format)
else else
- var data_type_update = theme.post_meta.post.date_type === 'updated' - let data_type_update = theme.post_meta.post.date_type === 'updated'
- var date_type = data_type_update ? 'updated' : 'date' - let date_type = data_type_update ? 'updated' : 'date'
- var date_icon = data_type_update ? 'fas fa-history' :'far fa-calendar-alt' - let date_icon = data_type_update ? 'fas fa-history' :'far fa-calendar-alt'
- var data_info = data_type_update ? _p('post.updated') : _p('post.created') - let data_info = data_type_update ? _p('post.updated') : _p('post.created')
time.post-meta__date(title=data_info + ' ' + full_date(page[date_type])) i.fa-fw.post-meta-icon(class=date_icon)
i.fa-fw(class=date_icon) span.post-meta-label= data_info
=' ' + data_info + ' ' + date(page[date_type], config.date_format) time(datetime=date_xml(page[date_type]) title=date_title + ' ' + full_date(page[date_type]))=date(page[date_type], config.date_format)
if (theme.post_meta.post.categories && page.categories.data.length > 0) if (theme.post_meta.post.categories && page.categories.data.length > 0)
span.post-meta__categories span.post-meta-categories
if (theme.post_meta.post.date_type) if (theme.post_meta.post.date_type)
span.post-meta__separator | span.post-meta-separator |
each item, index in page.categories.data each item, index in page.categories.data
i.fas.fa-inbox.fa-fw.post-meta__icon i.fas.fa-inbox.fa-fw.post-meta-icon
a(href=url_for(item.path)).post-meta__categories #[=item.name] a(href=url_for(item.path)).post-meta-categories #[=item.name]
if (index < page.categories.data.length - 1) if (index < page.categories.data.length - 1)
i.fas.fa-angle-right.post-meta__separator i.fas.fa-angle-right.post-meta-separator
.meta-secondline .meta-secondline
- let postWordcount = theme.wordcount.enable && (theme.wordcount.post_wordcount || theme.wordcount.min2read) - let postWordcount = theme.wordcount.enable && (theme.wordcount.post_wordcount || theme.wordcount.min2read)
if (postWordcount) if (postWordcount)
span.post-meta-separator |
span.post-meta-wordcount span.post-meta-wordcount
if theme.wordcount.post_wordcount if theme.wordcount.post_wordcount
i.far.fa-file-word.fa-fw.post-meta__icon i.far.fa-file-word.fa-fw.post-meta-icon
span= _p('post.wordcount') + ':' span.post-meta-label= _p('post.wordcount') + ':'
span.word-count= wordcount(page.content) span.word-count= wordcount(page.content)
if theme.wordcount.min2read if theme.wordcount.min2read
span.post-meta__separator | span.post-meta-separator |
if theme.wordcount.min2read if theme.wordcount.min2read
i.far.fa-clock.fa-fw.post-meta__icon i.far.fa-clock.fa-fw.post-meta-icon
span= _p('post.min2read', min2read(page.content, {cn: 350, en: 160})) span.post-meta-label= _p('post.min2read') + ':'
span= min2read(page.content, {cn: 350, en: 160}) + _p('post.min2read_unit')
.meta-thirdline if theme.busuanzi.page_pv
span.post-meta-pv-cv span.post-meta-separator |
if (postWordcount && theme.busuanzi.page_pv) span.post-meta-pv-cv
span.post-meta__separator | i.far.fa-eye.fa-fw.post-meta-icon
if theme.busuanzi.page_pv span.post-meta-label=_p('post.page_pv') + ':'
i.far.fa-eye.fa-fw.post-meta__icon
span=_p('post.page_pv') + ':'
span#busuanzi_value_page_pv span#busuanzi_value_page_pv
span.post-meta-commentcount if !theme.comments.lazyload && page.comments !== false && theme.comments.use && theme.comments.count
if ((theme.disqus && theme.disqus.enable && theme.disqus.count && page.comments !== false) || (theme.disqusjs && theme.disqusjs.enable && theme.disqusjs.count && page.comments !== false)) - var whichCount = theme.comments.use[0]
if (postWordcount || theme.busuanzi.page_pv) if whichCount !== 'Livere' && whichCount !== 'Utterances'
span.post-meta__separator | span.post-meta-separator |
i.far.fa-comments.fa-fw.post-meta__icon span.post-meta-commentcount
span= _p('post.comments') + ':' if whichCount === 'Disqus' || whichCount === 'Disqusjs'
span.disqus-comment-count.comment-count i.far.fa-comments.fa-fw.post-meta-icon
a(href=full_url_for(page.path) + '#disqus_thread') span.post-meta-label= _p('post.comments') + ':'
else if (theme.valine && theme.valine.enable && theme.valine.count && page.comments !== false) span.disqus-comment-count.comment-count
if (postWordcount || theme.busuanzi.page_pv) a(href=full_url_for(page.path) + '#disqus_thread')
span.post-meta__separator | else if whichCount === 'Valine'
i.far.fa-comments.fa-fw.post-meta__icon i.far.fa-comments.fa-fw.post-meta-icon
span= _p('post.comments') + ':' span.post-meta-label= _p('post.comments') + ':'
a(href=url_for(page.path) + '#post-comment' itemprop="discussionUrl") a(href=url_for(page.path) + '#post-comment' itemprop="discussionUrl")
span.valine-comment-count.comment-count(data-xid=url_for(page.path) itemprop="commentCount") span.valine-comment-count.comment-count(data-xid=url_for(page.path) itemprop="commentCount")
else if (theme.gitalk && theme.gitalk.enable && theme.gitalk.count && page.comments !== false) else if whichCount === 'Gitalk'
if (postWordcount || theme.busuanzi.page_pv) i.far.fa-comments.fa-fw.post-meta-icon
span.post-meta__separator | span.post-meta-label= _p('post.comments') + ':'
i.far.fa-comments.fa-fw.post-meta__icon a(href=url_for(page.path) + '#post-comment')
span= _p('post.comments') + ':' span.gitalk-comment-count.comment-count
a(href=url_for(page.path) + '#post-comment') else if whichCount === 'Facebook Comments'
span.gitalk-comment-count.comment-count i.far.fa-comments.fa-fw.post-meta-icon
else if theme.facebook_comments.enable && theme.facebook_comments.count && page.comments !== false span.post-meta-label= _p('post.comments') + ':'
if (postWordcount || theme.busuanzi.page_pv) a.comment-count(href=url_for(page.path) + '#post-comment')
span.post-meta__separator | span.fb-comments-count(data-href=urlNoIndex())
i.far.fa-comments.fa-fw.post-meta__icon
span= _p('post.comments') + ':'
a.comment-count(href=url_for(page.path) + '#post-comment')
span.fb-comments-count(data-href=urlNoIndex())

View File

@@ -1,6 +1,4 @@
- var hideAside = !theme.aside.enable || page.aside === false ? 'hide-aside' : '' - var hideAside = !theme.aside.enable || page.aside === false ? 'hide-aside' : ''
- var pageHighlightShrinkSet = page.highlight_shrink !== undefined ? page.highlight_shrink : theme.highlight_shrink
- var pageHighlightShrink = theme.highlight_shrink !== 'none' && pageHighlightShrinkSet ? 'code-close' : ''
doctype html doctype html
html(lang=config.language data-theme=theme.display_mode) html(lang=config.language data-theme=theme.display_mode)
@@ -10,18 +8,14 @@ html(lang=config.language data-theme=theme.display_mode)
if theme.preloader if theme.preloader
!=partial('includes/loading/loading', {}, {cache:theme.fragment_cache}) !=partial('includes/loading/loading', {}, {cache:theme.fragment_cache})
if theme.fireworks && theme.fireworks.enable
canvas.fireworks
!=partial('includes/mobile-sidebar/index', {}, {cache:theme.fragment_cache}) !=partial('includes/mobile-sidebar/index', {}, {cache:theme.fragment_cache})
include ./sidebar.pug #body-wrap
#body-wrap(class=pageHighlightShrink)
if theme.background if theme.background
- var is_photo = theme.background.startsWith('url') ? 'photo':'color' - var is_photo = theme.background.startsWith('url') ? 'photo':'color'
#web_bg(data-type=is_photo) #web_bg(data-type=is_photo)
include ./sidebar.pug
include ./header/index.pug include ./header/index.pug
if (!is_post()) if (!is_post())
@@ -44,5 +38,5 @@ html(lang=config.language data-theme=theme.display_mode)
!=partial('includes/footer', {}, {cache:theme.fragment_cache}) !=partial('includes/footer', {}, {cache:theme.fragment_cache})
include ./rightside.pug include ./rightside.pug
!=partial('includes/search/index', {}, {cache:theme.fragment_cache}) !=partial('includes/third-party/search/index', {}, {cache:theme.fragment_cache})
include ./additional-js.pug include ./additional-js.pug

View File

@@ -1,27 +0,0 @@
script(type="text/x-mathjax-config").
MathJax.Hub.Config({
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
processEscapes: true,
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
},
CommonHTML: {
linebreaks: { automatic: true, width: "90% container" }
},
"HTML-CSS": {
linebreaks: { automatic: true, width: "90% container" }
},
"SVG": {
linebreaks: { automatic: true, width: "90% container" }
}
});
script(type="text/x-mathjax-config").
MathJax.Hub.Queue(function() {
var all = MathJax.Hub.getAllJax(), i;
for (i=0; i < all.length; i += 1) {
all[i].SourceElement().parentNode.className += ' has-jax';
}
});
script(src=theme.CDN.mathjax)

View File

@@ -1,8 +0,0 @@
script.
if (document.getElementsByClassName('mermaid').length) {
loadScript('!{theme.CDN.mermaid}',function () {
mermaid.initialize({
theme: '!{theme.mermaid.theme}',
})
})
}

View File

@@ -2,19 +2,22 @@ mixin articleSort(posts)
.article-sort .article-sort
- var year - var year
- posts.each(function (article) { - posts.each(function (article) {
- var tempYear = date(article.date, 'YYYY') - let tempYear = date(article.date, 'YYYY')
- var no_cover = article.cover === false || !theme.cover.archives_enable ? 'no-article-cover' : '' - let no_cover = article.cover === false || !theme.cover.archives_enable ? 'no-article-cover' : ''
- let title = article.title || _p('no_title')
if tempYear !== year if tempYear !== year
- year = tempYear - year = tempYear
.article-sort-item.year= year .article-sort-item.year= year
.article-sort-item(class=no_cover) .article-sort-item(class=no_cover)
if article.cover && theme.cover.archives_enable if article.cover && theme.cover.archives_enable
.article-sort-img a.article-sort-item-img(href=url_for(article.path) title=title)
a.article-sort-item__img(href=url_for(article.path)) if theme.lazyload.enable
img(src=url_for(article.cover) alt=article.title || 'No Title' onerror=`this.onerror=null;this.src='`+ url_for(theme.error_img.post_page) + `'`) img(data-lazy-src=url_for(article.cover) alt=title onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'`)
.article-sort-post else
a.article-sort-item__post(href=url_for(article.path)) img(src=url_for(article.cover) alt=title onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'`)
.article-sort-item-info
.article-sort-item-time
i.far.fa-calendar-alt i.far.fa-calendar-alt
time.article-sort-item__time(title=_p('post.created') + ' ' + full_date(article.date))= date(article.date, config.date_format) time.post-meta-date-created(datetime=date_xml(article.date) title=_p('post.created') + ' ' + full_date(article.date))= date(article.date, config.date_format)
.article-sort-item__title= article.title || 'No Title' a.article-sort-item-title(href=url_for(article.path) title=title)= title
- }) - })

View File

@@ -1,16 +1,16 @@
mixin postUI(posts) mixin postUI(posts)
each article , index in page.posts.data each article , index in page.posts.data
.recent-post-item .recent-post-item
- var link = article.link || article.path - let link = article.link || article.path
- var title = article.title || _p('no_title') - let title = article.title || _p('no_title')
- var leftOrRight = index%2 == 0 ? 'left_radius' : 'right_radius' - let leftOrRight = index%2 == 0 ? 'left_radius' : 'right_radius'
- var post_cover = article.cover - let post_cover = article.cover
- var no_cover = article.cover === false || !theme.cover.index_enable ? 'no-cover' : '' - let no_cover = article.cover === false || !theme.cover.index_enable ? 'no-cover' : ''
if post_cover && theme.cover.index_enable if post_cover && theme.cover.index_enable
.post_cover(class=leftOrRight) .post_cover(class=leftOrRight)
a(href=url_for(link) title=title) a(href=url_for(link) title=title)
if theme.lazyload.enable if theme.lazyload.enable
img.post_bg(data-src=url_for(post_cover) onerror=`this.onerror=null;this.src='`+ url_for(theme.error_img.post_page) + `'` alt=title) img.post_bg(data-lazy-src=url_for(post_cover) onerror=`this.onerror=null;this.src='`+ url_for(theme.error_img.post_page) + `'` alt=title)
else else
img.post_bg(src=url_for(post_cover) onerror=`this.onerror=null;this.src='`+ url_for(theme.error_img.post_page) + `'` alt=title) img.post_bg(src=url_for(post_cover) onerror=`this.onerror=null;this.src='`+ url_for(theme.error_img.post_page) + `'` alt=title)
.recent-post-info(class=no_cover) .recent-post-info(class=no_cover)
@@ -22,23 +22,23 @@ mixin postUI(posts)
span.sticky= _p('sticky') span.sticky= _p('sticky')
span.article-meta__separator | span.article-meta__separator |
if (theme.post_meta.page.date_type) if (theme.post_meta.page.date_type)
if (theme.post_meta.page.date_type === 'both') span.post-meta-date
time.post-meta__date if (theme.post_meta.page.date_type === 'both')
span.post-meta__date-created(title=_p('post.created') + ' ' + full_date(article.date)) i.far.fa-calendar-alt
i.far.fa-calendar-alt span.article-meta-label=_p('post.created')
=date(article.date, config.date_format) time.post-meta-date-created(datetime=date_xml(article.date) title=_p('post.created') + ' ' + full_date(article.date))=date(article.date, config.date_format)
span.article-meta__separator | span.article-meta__separator |
span.post-meta__date-updated(title=_p('post.updated') + ' ' + full_date(article.updated)) i.fas.fa-history
i.fas.fa-history span.article-meta-label=_p('post.updated')
=date(article.updated, config.date_format) time.post-meta-date-updated(datetime=date_xml(article.updated) title=_p('post.updated') + ' ' + full_date(article.updated))=date(article.updated, config.date_format)
else else
- var data_type_updated = theme.post_meta.page.date_type === 'updated' - let data_type_updated = theme.post_meta.page.date_type === 'updated'
- var date_type = data_type_updated ? 'updated' : 'date' - let date_type = data_type_updated ? 'updated' : 'date'
- var date_icon = data_type_updated ? 'fas fa-history' :'far fa-calendar-alt' - let date_icon = data_type_updated ? 'fas fa-history' :'far fa-calendar-alt'
- var date_title = data_type_updated ? _p('post.updated') : _p('post.created') - let date_title = data_type_updated ? _p('post.updated') : _p('post.created')
time.post-meta__date(title=date_title + ' ' + full_date(article[date_type]))
i(class=date_icon) i(class=date_icon)
=date(article[date_type], config.date_format) span.article-meta-label=date_title
time(datetime=date_xml(article[date_type]) title=date_title + ' ' + full_date(article[date_type]))=date(article[date_type], config.date_format)
if (theme.post_meta.page.categories && article.categories.data.length > 0) if (theme.post_meta.page.categories && article.categories.data.length > 0)
span.article-meta span.article-meta
span.article-meta__separator | span.article-meta__separator |

View File

@@ -1,6 +1,9 @@
#mobile-sidebar-menus #mobile-sidebar-menus
.mobile_author_icon .mobile_author_icon
img.avatar-img(src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar") if theme.lazyload.enable
img.avatar-img(data-lazy-src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar")
else
img.avatar-img(src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar")
.mobile_post_data .mobile_post_data
if site.posts.length if site.posts.length
.mobile_data_item.is-center .mobile_data_item.is-center

View File

@@ -18,7 +18,7 @@ else
- var pagination_cover = page.prev.cover === false ? page.prev.randomcover : page.prev.cover - var pagination_cover = page.prev.cover === false ? page.prev.randomcover : page.prev.cover
a(href=url_for(page.prev.path)) a(href=url_for(page.prev.path))
if theme.lazyload.enable if theme.lazyload.enable
img.prev-cover(data-src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` ) img.prev-cover(data-lazy-src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` )
else else
img.prev-cover(src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` ) img.prev-cover(src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'` )
.pagination-info .pagination-info
@@ -31,7 +31,7 @@ else
.next-post(class=hasPagePrev) .next-post(class=hasPagePrev)
a(href=url_for(page.next.path)) a(href=url_for(page.next.path))
if theme.lazyload.enable if theme.lazyload.enable
img.next-cover(data-src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'`) img.next-cover(data-lazy-src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'`)
else else
img.next-cover(src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'`) img.next-cover(src=url_for(pagination_cover) onerror=`onerror=null;src='${url_for(theme.error_img.post_page)}'`)
.pagination-info .pagination-info

View File

@@ -1,13 +1,17 @@
if (theme.post_copyright && theme.post_copyright.enable && page.copyright != false) if theme.post_copyright.enable && page.copyright !== false
- let author = page.copyright_author ? page.copyright_author : config.author
- let authorHref = page.copyright_author_href ? page.copyright_author_href : `mailto:${config.email}`
- let url = page.copyright_url ? page.copyright_url : page.permalink
- let info = page.copyright_info ? page.copyright_info : _p('post.copyright.copyright_content', theme.post_copyright.license_url, theme.post_copyright.license, config.url, config.title)
.post-copyright .post-copyright
.post-copyright__author .post-copyright__author
span.post-copyright-meta= _p('post.copyright.author') + ": " span.post-copyright-meta= _p('post.copyright.author') + ": "
span.post-copyright-info span.post-copyright-info
a(href=`mailto:${config.email}`) #[=config.author] a(href=authorHref)=author
.post-copyright__type .post-copyright__type
span.post-copyright-meta= _p('post.copyright.link') + ": " span.post-copyright-meta= _p('post.copyright.link') + ": "
span.post-copyright-info span.post-copyright-info
a(href=url_for(page.permalink))= theme.post_copyright.decode ? decodeURI(page.permalink) : page.permalink a(href=url_for(url))= theme.post_copyright.decode ? decodeURI(url) : url
.post-copyright__notice .post-copyright__notice
span.post-copyright-meta= _p('post.copyright.copyright_notice') + ": " span.post-copyright-meta= _p('post.copyright.copyright_notice') + ": "
span.post-copyright-info!= _p('post.copyright.copyright_content', theme.post_copyright.license_url, theme.post_copyright.license, config.url, config.title) span.post-copyright-info!= info

View File

@@ -1,5 +1,5 @@
.post-reward .post-reward
button.reward-button .reward-button
i.fas.fa-qrcode i.fas.fa-qrcode
= ' ' + _p('donate') = ' ' + _p('donate')
.reward-main .reward-main
@@ -7,6 +7,10 @@
each item in theme.reward.QR_code each item in theme.reward.QR_code
- var clickTo = (item.itemlist||item).link ? (item.itemlist||item).link : (item.itemlist||item).img - var clickTo = (item.itemlist||item).link ? (item.itemlist||item).link : (item.itemlist||item).img
li.reward-item li.reward-item
img.post-qr-code__img(src=url_for((item.itemlist||item).img) alt=(item.itemlist||item).text onclick=`window.open('${url_for(clickTo)}')`) a(href=clickTo target='_blank')
.post-qr-code__desc=(item.itemlist||item).text if theme.lazyload.enable
img.post-qr-code-img(data-lazy-src=url_for((item.itemlist||item).img) alt=(item.itemlist||item).text)
else
img.post-qr-code-img(src=url_for((item.itemlist||item).img) alt=(item.itemlist||item).text)
.post-qr-code-desc=(item.itemlist||item).text

View File

@@ -1,32 +1,32 @@
section#rightside.rightside section#rightside
#rightside-config-hide #rightside-config-hide
if is_post() if is_post()
if theme.readmode if theme.readmode
button#readmode(title=_p('rightside.readmode_title')) button#readmode(type="button" title=_p('rightside.readmode_title'))
i.fas.fa-book-open i.fas.fa-book-open
button#font_plus(title=_p('rightside.font_plus_title')) button#font_plus(type="button" title=_p('rightside.font_plus_title'))
i.fas.fa-plus i.fas.fa-plus
button#font_minus(title=_p('rightside.font_minus_title')) button#font_minus(type="button" title=_p('rightside.font_minus_title'))
i.fas.fa-minus i.fas.fa-minus
if theme.translate && theme.translate.enable if theme.translate && theme.translate.enable
button#translateLink.translate_chn_to_cht(title=_p('rightside.translate_title'))= theme.translate.default button#translateLink(type="button" title=_p('rightside.translate_title'))= theme.translate.default
if theme.darkmode.enable && theme.darkmode.button if theme.darkmode.enable && theme.darkmode.button
button#darkmode(title=_p('rightside.night_mode_title')) button#darkmode(type="button" title=_p('rightside.night_mode_title'))
i.fas.fa-adjust i.fas.fa-adjust
#rightside-config-show #rightside-config-show
button#rightside_config(title=_p("rightside.setting")) button#rightside_config(type="button" title=_p("rightside.setting"))
i.fas.fa-cog i.fas.fa-cog
if is_post() && page.comments !== false && isComment if is_post() && page.comments !== false && theme.comments.use
a#to_comment(href="#post-comment" title=_p("rightside.scroll_to_comment")) a#to_comment(href="#post-comment" title=_p("rightside.scroll_to_comment"))
i.scroll_to_comment.fas.fa-comments i.fas.fa-comments
if showToc if showToc
button#mobile-toc-button.close(title=_p("rightside.toc")) button#mobile-toc-button.close(type="button" title=_p("rightside.toc"))
i.fas.fa-list-ul i.fas.fa-list-ul
if theme.chat_btn && (theme.chatra.enable || theme.tidio.enable || theme.daovoice.enable || theme.gitter.enable) if theme.chat_btn
button#chat_btn(title=_p("rightside.chat_btn")) button#chat_btn(type="button" title=_p("rightside.chat_btn"))
i.fas.fa-sms i.fas.fa-sms
button#go-up(title=_p("rightside.back_to_top")) button#go-up(type="button" title=_p("rightside.back_to_top"))
i.fas.fa-arrow-up i.fas.fa-arrow-up

View File

@@ -1,5 +0,0 @@
if (theme.algolia_search.enable)
include ./algolia.pug
if (theme.local_search)
if (!theme.algolia_search.enable && theme.local_search.enable)
include ./local-search.pug

View File

@@ -1,7 +0,0 @@
.post_share
if theme.addThis.enable
include ./add-this.pug
else if theme.sharejs && theme.sharejs.enable
include ./share-js.pug
else if theme.addtoany.enable
include ./addtoany.pug

View File

@@ -1,4 +0,0 @@
if (theme.sharejs && theme.sharejs.enable)
.social-share(data-image=url_for(page.cover|| theme.avatar.img) data-sites= theme.sharejs.sites)
link(rel="stylesheet" href=url_for(theme.CDN.sharejs_css))
script(src=url_for(theme.CDN.sharejs))

View File

@@ -5,8 +5,8 @@
- -
if(showToc) if(showToc)
i.fas.fa-arrow-right#toggle-sidebar(class=autoOpenSidebar)
#sidebar #sidebar
i.fas.fa-arrow-right#toggle-sidebar(class=autoOpenSidebar)
.sidebar-toc .sidebar-toc
div.sidebar-toc__title= _p('sidebar.catalog') div.sidebar-toc__title= _p('sidebar.catalog')
div.sidebar-toc__progress div.sidebar-toc__progress

View File

@@ -1 +0,0 @@
script#canvas_nest(color=theme.canvas_nest.color opacity=theme.canvas_nest.opacity zIndex=theme.canvas_nest.zIndex count=theme.canvas_nest.count mobile=`${theme.canvas_nest.mobile}` src=url_for(theme.CDN.canvas_nest))

View File

@@ -1 +0,0 @@
script(id="ribbon_piao" mobile=`${theme.canvas_ribbon_piao.mobile}` src=url_for(theme.CDN.canvas_ribbon_piao))

View File

@@ -1,3 +0,0 @@
script(defer id="ribbon" src=url_for(theme.CDN.canvas_ribbon) size=theme.canvas_ribbon.size
alpha=theme.canvas_ribbon.alpha zIndex=theme.canvas_ribbon.zIndex mobile=`${theme.canvas_ribbon.mobile}` data-click=`${theme.canvas_ribbon.click_to_change}`)

View File

@@ -12,10 +12,13 @@ script.
})(document, window, 'Chatra'); })(document, window, 'Chatra');
if (!{theme.chat_btn}) { if (!{theme.chat_btn}) {
var chatBtn = document.getElementById("chat_btn") var chatBtnFn = () => {
var chatBtn = document.getElementById("chat_btn")
chatBtn.addEventListener("click", function(){ chatBtn.addEventListener("click", function(){
Chatra('openChat') Chatra('openChat')
}); });
}
chatBtnFn()
} else { } else {
if (!{theme.chat_hide_show}) { if (!{theme.chat_hide_show}) {
function chatBtnHide () { function chatBtnHide () {

View File

@@ -0,0 +1,36 @@
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])
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(){
$crisp.push(["do", "chat:show"])
$crisp.push(["do", "chat:open"])
});
}
chatBtnFn()
} else {
if (!{theme.chat_hide_show}) {
function chatBtnHide () {
$crisp.push(["do", "chat:hide"])
}
function chatBtnShow () {
$crisp.push(["do", "chat:show"])
}
}
}

View File

@@ -13,10 +13,13 @@ script.
daovoice('update'); daovoice('update');
if (isChatBtn) { if (isChatBtn) {
var chatBtn = document.getElementById("chat_btn") var chatBtnFn = () => {
chatBtn.addEventListener("click", function(){ var chatBtn = document.getElementById("chat_btn")
daovoice('show') chatBtn.addEventListener("click", function(){
}); daovoice('show')
});
}
chatBtnFn()
} else { } else {
if (!{theme.chat_hide_show}) { if (!{theme.chat_hide_show}) {
function chatBtnHide () { function chatBtnHide () {

View File

@@ -0,0 +1,43 @@
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}) {
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)

View File

@@ -5,4 +5,6 @@ else if theme.tidio && theme.tidio.enable
else if theme.daovoice && theme.daovoice.enable else if theme.daovoice && theme.daovoice.enable
include ./daovoice.pug include ./daovoice.pug
else if theme.gitter && theme.gitter.enable else if theme.gitter && theme.gitter.enable
include ./gitter.pug include ./gitter.pug
else if theme.crisp && theme.crisp.enable
include ./crisp.pug

View File

@@ -0,0 +1,41 @@
script(src=`//code.tidio.co/${theme.tidio.public_key}.js` async)
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);
}
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 () {
if (window.tidioChatApi) {
//- window.tidioChatApi.hide();
document.getElementById('tidio-chat').style.display= 'none'
}
}
function chatBtnShow () {
if (window.tidioChatApi) {
//- window.tidioChatApi.show();
document.getElementById('tidio-chat').style.display= 'block'
}
}

View File

@@ -0,0 +1,45 @@
script.
function loadDisqus () {
var disqus_config = function () {
this.page.url = '!{ page.permalink }'
this.page.identifier = '!{ page.path }'
this.page.title = '!{ page.title }'
};
window.disqusReset = () => {
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);
})();
}
}
if ('!{theme.comments.use[0]}' === 'Disqus' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.getElementById('disqus_thread'), loadDisqus)
else loadDisqus()
} else {
function loadOtherComment () {
loadDisqus()
}
}
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);
} else {
DISQUSWIDGETS.getCount({reset: true});
}

View File

@@ -0,0 +1,57 @@
script.
function loadDisqusjs () {
function addDisqusjsCSS () {
const ele = document.createElement('link')
ele.rel = 'stylesheet'
ele.href= '!{url_for(theme.CDN.disqusjs_css)}'
document.getElementsByTagName('head')[0].appendChild(ele)
}
function initDisqusjs () {
window.DISQUS = null
new DisqusJS({
shortname: '!{theme.disqusjs.shortname}',
siteName: '!{theme.disqusjs.siteName}',
identifier: '!{ page.path }',
url: '!{ page.permalink }',
title: '!{ page.title }',
api: '!{theme.disqusjs.api}',
apikey: '!{theme.disqusjs.apikey}',
nocomment: '!{theme.disqusjs.nocomment}',
admin: '!{theme.disqusjs.admin}',
adminLabel: '!{theme.disqusjs.adminLabel}'
});
}
window.disqusReset = initDisqusjs
if (window.disqusJsLoad) initDisqusjs()
else {
addDisqusjsCSS()
$.getScript('!{url_for(theme.CDN.disqusjs)}', initDisqusjs)
window.disqusJsLoad = true
}
}
if ('!{theme.comments.use[0]}' === 'Disqusjs' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.getElementById('disqus_thread'), loadDisqusjs)
else loadDisqusjs()
}
else {
function loadOtherComment () {
loadDisqusjs()
}
}
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);
} else {
DISQUSWIDGETS.getCount({reset: true});
}

View File

@@ -0,0 +1,26 @@
#fb-root
script.
function loadFBComment () {
var themeNow = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'
document.getElementsByClassName('fb-comments')[0].setAttribute('data-colorscheme',themeNow)
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=v7.0')
ele.setAttribute('async', 'true')
ele.setAttribute('defer', 'true')
ele.setAttribute('crossorigin', 'anonymous')
document.getElementById('fb-root').insertAdjacentElement('afterbegin',ele)
}
}
if ('!{theme.comments.use[0]}' === 'Facebook Comments' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.querySelector('#post-comment .fb-comments'), loadFBComment)
else loadFBComment()
} else {
function loadOtherComment () {
loadFBComment()
}
}

View File

@@ -0,0 +1,52 @@
script.
function addGitalkSource () {
const ele = document.createElement('link')
ele.rel = 'stylesheet'
ele.href= '!{url_for(theme.CDN.gitalk_css)}'
document.getElementsByTagName('head')[0].appendChild(ele)
}
function loadGitalk () {
function initGitalk () {
var gitalk = new Gitalk({
clientID: '!{theme.gitalk.client_id}',
clientSecret: '!{theme.gitalk.client_secret}',
repo: '!{theme.gitalk.repo}',
owner: '!{theme.gitalk.owner}',
admin: ['!{theme.gitalk.admin}'],
id: '!{md5(page.path)}',
language: '!{theme.gitalk.language}',
perPage: !{theme.gitalk.perPage},
distractionFreeMode: !{theme.gitalk.distractionFreeMode},
pagerDirection: '!{theme.gitalk.pagerDirection}',
createIssueManually: !{theme.gitalk.createIssueManually},
updateCountCallback: commentCount
})
gitalk.render('gitalk-container')
}
if (typeof Gitalk === 'function') initGitalk()
else {
addGitalkSource()
$.getScript('!{url_for(theme.CDN.gitalk)}', initGitalk)
}
}
function commentCount(n){
let isCommentCount = document.querySelector('#post-meta .gitalk-comment-count')
if (isCommentCount) {
isCommentCount.innerHTML= n
}
}
if ('!{theme.comments.use[0]}' === 'Gitalk' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.getElementById('gitalk-container'), loadGitalk)
else loadGitalk()
} else {
function loadOtherComment () {
loadGitalk()
}
}

View File

@@ -0,0 +1,38 @@
- let defaultComment = theme.comments.use[0]
hr
#post-comment
.comment-head
.comment-headline
i.fas.fa-comments.fa-fw
span= ' ' + _p('comment')
if theme.comments.use.length > 1
.comment-switch
span.first-comment=defaultComment
label
input#switch-comments-btn(type="checkbox")
span.slider
span.second-comment=theme.comments.use[1]
.comment-wrap
each name in theme.comments.use
div
case name
when 'Disqus'
#disqus_thread
when 'Valine'
#vcomment.vcomment
when 'Disqusjs'
#disqus_thread
when 'Livere'
#lv-container(data-id="city" data-uid=theme.livere.uid)
when 'Gitalk'
#gitalk-container
when 'Utterances'
#utterances-wrap
when 'Facebook Comments'
.fb-comments(data-colorscheme = theme.display_mode === 'dark' ? 'dark' : 'light'
data-numposts= theme.facebook_comments.pageSize || 10
data-order-by= theme.facebook_comments.order_by || 'social'
data-width="100%")

View File

@@ -0,0 +1,16 @@
each name in theme.comments.use
case name
when 'Valine'
!=partial('includes/third-party/comments/valine', {}, {cache:theme.fragment_cache})
when 'Disqus'
include ./disqus.pug
when 'Disqusjs'
include ./disqusjs.pug
when 'Livere'
!=partial('includes/third-party/comments/livere', {}, {cache:theme.fragment_cache})
when 'Gitalk'
include ./gitalk.pug
when 'Utterances'
!=partial('includes/third-party/comments/utterances', {}, {cache:theme.fragment_cache})
when 'Facebook Comments'
!=partial('includes/third-party/comments/facebook_comments', {}, {cache:theme.fragment_cache})

View File

@@ -1,5 +1,5 @@
#lv-container(data-id="city" data-uid=theme.livere.uid) script.
script. function loadLivere () {
(function(d, s) { (function(d, s) {
var j, e = d.getElementsByTagName(s)[0]; var j, e = d.getElementsByTagName(s)[0];
if (typeof LivereTower === 'function') { return; } if (typeof LivereTower === 'function') { return; }
@@ -8,3 +8,14 @@
j.async = true; j.async = true;
e.parentNode.insertBefore(j, e); e.parentNode.insertBefore(j, e);
})(document, 'script'); })(document, 'script');
}
if ('!{theme.comments.use[0]}' === 'Livere' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.getElementById('lv-container'), loadLivere)
else loadLivere()
}
else {
function loadOtherComment () {
loadLivere()
}
}

View File

@@ -0,0 +1,34 @@
script.
function loadUtterances () {
let ele = document.createElement('script')
ele.setAttribute('id', 'utterances_comment')
ele.setAttribute('src', '!{url_for(theme.CDN.utterances)}')
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 () {
if (document.querySelector('.utterances-frame')) {
const theme = document.documentElement.getAttribute('data-theme') === 'dark' ? '#{theme.utterances.dark_theme}' : '#{theme.utterances.light_theme}'
const message = {
type: 'set-theme',
theme: theme
};
const iframe = document.querySelector('.utterances-frame');
iframe.contentWindow.postMessage(message, 'https://utteranc.es');
}
}
if ('!{theme.comments.use[0]}' === 'Utterances' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.getElementById('utterances-wrap'), loadUtterances)
else loadUtterances()
} else {
function loadOtherComment () {
loadUtterances()
}
}

View File

@@ -0,0 +1,40 @@
- let emojiMaps = '""'
if site.data.valine
- emojiMaps = JSON.stringify(site.data.valine)
script.
function loadValine () {
function initValine () {
window.valine = new Valine({
el: '#vcomment',
appId: '#{theme.valine.appId}',
appKey: '#{theme.valine.appKey}',
placeholder: '#{theme.valine.placeholder}',
avatar: '#{theme.valine.avatar}',
meta: '#{theme.valine.guest_info }'.split(','),
pageSize: '#{theme.valine.pageSize}',
lang: '#{theme.valine.lang}',
recordIP: #{theme.valine.recordIP},
serverURLs: '#{theme.valine.serverURLs}',
emojiCDN: '#{theme.valine.emojiCDN}',
emojiMaps: !{emojiMaps},
enableQQ: #{theme.valine.enableQQ},
path: window.location.pathname,
});
if ('#{theme.valine.requiredFields}') { valine.config.requiredFields= '#{theme.valine.requiredFields}'.split(',') }
}
if (typeof Valine === 'function') initValine()
else $.getScript('!{url_for(theme.CDN.valine)}', initValine)
}
if ('!{theme.comments.use[0]}' === 'Valine' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.querySelector('#vcomment'),loadValine)
else setTimeout(() => loadValine(), 0)
} else {
function loadOtherComment () {
loadValine()
}
}

28
layout/includes/third-party/effect.pug vendored Normal file
View File

@@ -0,0 +1,28 @@
if theme.fireworks && theme.fireworks.enable
canvas.fireworks
script(src=url_for(theme.CDN.anime))
script(src=url_for(theme.CDN.fireworks))
if (theme.canvas_ribbon && theme.canvas_ribbon.enable)
script(defer id="ribbon" src=url_for(theme.CDN.canvas_ribbon) size=theme.canvas_ribbon.size
alpha=theme.canvas_ribbon.alpha zIndex=theme.canvas_ribbon.zIndex mobile=`${theme.canvas_ribbon.mobile}` data-click=`${theme.canvas_ribbon.click_to_change}`)
if (theme.canvas_ribbon_piao && theme.canvas_ribbon_piao.enable)
script(defer id="ribbon_piao" mobile=`${theme.canvas_ribbon_piao.mobile}` src=url_for(theme.CDN.canvas_ribbon_piao))
if (theme.canvas_nest && theme.canvas_nest.enable)
script#canvas_nest(defer color=theme.canvas_nest.color opacity=theme.canvas_nest.opacity zIndex=theme.canvas_nest.zIndex count=theme.canvas_nest.count mobile=`${theme.canvas_nest.mobile}` src=url_for(theme.CDN.canvas_nest))
if theme.activate_power_mode.enable
script(src=url_for(theme.CDN.activate_power_mode))
script.
POWERMODE.colorful = #{theme.activate_power_mode.colorful};
POWERMODE.shake = #{theme.activate_power_mode.shake};
document.body.addEventListener('input', POWERMODE);
//- 鼠標特效
if theme.click_heart
script(src=url_for(theme.CDN.click_heart) async)
if theme.ClickShowText && theme.ClickShowText.enable
script(src=url_for(theme.CDN.ClickShowText) async)

View File

@@ -13,3 +13,6 @@ if theme.katex && theme.katex.enable
else else
if page.katex if page.katex
include ./katex.pug include ./katex.pug
if theme.mermaid.enable
include ./mermaid.pug

View File

@@ -0,0 +1,45 @@
//- Mathjax 3
//- http://docs.mathjax.org/en/latest/upgrading/v2.html#changes-in-the-mathjax-api
//- https://github.com/mathjax/MathJax/issues/2209
//- http://docs.mathjax.org/en/latest/options/input/tex.html#the-configuration-block
//- http://docs.mathjax.org/en/latest/web/typeset.html#resetting-automatic-equation-numbering
script.
if (!window.MathJax) {
window.MathJax = {
loader: {
source: {
'[tex]/amsCd': '[tex]/amscd'
}
},
tex: {
inlineMath: [ ['$','$'], ["\\(","\\)"]],
tags: 'ams'
},
options: {
renderActions: {
findScript: [10, doc => {
for (const node of document.querySelectorAll('script[type^="math/tex"]')) {
const display = !!node.type.match(/; *mode=display/)
const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display)
const text = document.createTextNode('')
node.parentNode.replaceChild(text, node)
math.start = {node: text, delim: '', n: 0}
math.end = {node: text, delim: '', n: 0}
doc.math.push(math)
}
}, '']
}
}
}
var script = document.createElement('script')
script.src = '!{theme.CDN.mathjax}'
script.id = 'MathJax-script'
script.async = true
document.head.appendChild(script)
} else {
MathJax.startup.document.state(0)
MathJax.texReset()
MathJax.typeset()
}

View File

@@ -0,0 +1,15 @@
script.
if (document.getElementsByClassName('mermaid').length) {
if (window.mermaidJsLoad) mermaid.init()
else {
$.getScript('!{theme.CDN.mermaid}', function () {
window.mermaidJsLoad = true
mermaid.initialize({
theme: '!{theme.mermaid.theme}',
})
!{theme.pjax} && mermaid.init()
})
}
}

View File

@@ -1,12 +1,19 @@
script(src=url_for(theme.CDN.pangu)) script.
if theme.pangu.field === 'post' && is_post() function panguFn () {
script. if (typeof pangu === 'object') pangu.spacingElementById('content-inner')
document.addEventListener('DOMContentLoaded', function() { else {
pangu.autoSpacingPage() $.getScript('!{url_for(theme.CDN.pangu)}', () => {
}) pangu.spacingElementById('content-inner')
else if theme.pangu.field === 'site' })
script. }
document.addEventListener('DOMContentLoaded', function() { }
pangu.autoSpacingPage()
})
function panguInit () {
if (!{theme.pangu.field === 'post'}){
GLOBAL_CONFIG_SITE.isPost && panguFn()
} else {
panguFn()
}
}
document.addEventListener('DOMContentLoaded', panguFn)

56
layout/includes/third-party/pjax.pug vendored Normal file
View File

@@ -0,0 +1,56 @@
script(src=url_for(theme.CDN.pjax))
script.
var pjax = new Pjax({
elements: 'a:not([target="_blank"])',
selectors: [
'title',
'meta[name=description]',
'#config_change',
'#body-wrap',
'#rightside-config-hide',
'#rightside-config-show',
'.js-pjax'
],
cacheBust: false,
})
document.addEventListener('pjax:complete', function () {
refreshFn()
$('script[data-pjax]').each(function () {
$(this).parent().append($(this).remove())
})
GLOBAL_CONFIG.islazyload && lazyLoadInstance.update()
typeof chatBtnFn === 'function' && chatBtnFn()
typeof panguInit === 'function' && panguInit()
if (typeof gtag === 'function') {
gtag('config', '!{theme.google_analytics}', {'page_path': window.location.pathname});
}
typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()
})
document.addEventListener('pjax:send', function () {
if (window.aplayers) {
for (let i = 0; i < window.aplayers.length; i++) {
if (!window.aplayers[i].options.fixed) {
window.aplayers[i].destroy()
}
}
}
typeof typed === 'object' && typed.destroy()
$(window).off('scroll')
//reset readmode
$('body').hasClass('read-mode') && $('body').removeClass('read-mode')
//reset font-size
$('body').css('font-size') !== originFontSize && $('body').css('font-size', parseFloat(originFontSize))
})

View File

@@ -9,4 +9,4 @@
#algolia-stats #algolia-stats
span.search-close-button span.search-close-button
i.fas.fa-times i.fas.fa-times
.search-mask #search-mask

View File

@@ -0,0 +1,4 @@
if theme.algolia_search.enable
include ./algolia.pug
else if theme.local_search.enable
include ./local-search.pug

View File

@@ -20,4 +20,4 @@
| #[a(href="https://github.com/wzpan/hexo-generator-search" style={'color': '#49B1F5'}) hexo-generator-search] | #[a(href="https://github.com/wzpan/hexo-generator-search" style={'color': '#49B1F5'}) hexo-generator-search]
span.search-close-button span.search-close-button
i.fas.fa-times i.fas.fa-times
.search-mask #search-mask

View File

@@ -0,0 +1,7 @@
.post_share
if theme.addThis.enable
!=partial('includes/third-party/share/add-this', {}, {cache:theme.fragment_cache})
else if theme.sharejs.enable
include ./share-js.pug
else if theme.addtoany.enable
!=partial('includes/third-party/share/addtoany', {}, {cache:theme.fragment_cache})

View File

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

137
layout/includes/third-party/subtitle.pug vendored Normal file
View File

@@ -0,0 +1,137 @@
- var source = theme.subtitle.source
if source == '1'
script.
function subtitleType () {
$.getJSON('https://api.btstu.cn/yan/api.php?charset=utf-8&encode=json',function (data) {
if (!{theme.subtitle.effect}) {
var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',')
var both = sub.unshift(data.text)
typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
backSpeed: 50,
})
} else {
document.getElementById('subtitle').innerHTML = data.text
}
})
}
if (!{theme.subtitle.effect}) {
if (typeof Typed === 'function') subtitleType()
else $.getScript('!{url_for(theme.CDN.typed)}', subtitleType)
} else {
subtitleType()
}
else if source == '2'
script.
function subtitleType () {
$.getJSON('https://v1.hitokoto.cn', function (data) {
if (!{theme.subtitle.effect}) {
var from = '出自 ' + data.from
var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',')
var both = sub.unshift(data.hitokoto, from)
var typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
backSpeed: 50,
})
} else {
document.getElementById('subtitle').innerHTML = data.hitokoto
}
})
}
if (!{theme.subtitle.effect}) {
if (typeof Typed === 'function') subtitleType()
else $.getScript('!{url_for(theme.CDN.typed)}', subtitleType)
} else {
subtitleType()
}
else if source == '3'
script.
function subtitleType () {
$.getScript('http://yijuzhan.com/api/word.php?m=js', function () {
var con = str[0]
if (!{theme.subtitle.effect}) {
var from = '出自 ' + str[1]
var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',')
var both = sub.unshift(con, from)
var typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
backSpeed: 50,
})
} else {
document.getElementById('subtitle').innerHTML = con
}
})
}
if (!{theme.subtitle.effect}) {
if (typeof Typed === 'function') subtitleType()
else $.getScript('!{url_for(theme.CDN.typed)}', subtitleType)
} else {
subtitleType()
}
else if source == '4'
script.
function subtitleType () {
$.getScript('https://sdk.jinrishici.com/v2/browser/jinrishici.js',function () {
jinrishici.load(function (result) {
if (!{theme.subtitle.effect}) {
var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',')
var content = result.data.content
var both = sub.unshift(content)
var typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
backSpeed: 50,
})
} else {
document.getElementById('subtitle').innerHTML = result.data.content
}
})
})
}
if (!{theme.subtitle.effect}) {
if (typeof Typed === 'function') subtitleType()
else $.getScript('!{url_for(theme.CDN.typed)}', subtitleType)
} else {
subtitleType()
}
else
script.
function subtitleType () {
if (!{theme.subtitle.effect}) {
var typed = new Typed("#subtitle", {
strings: "!{theme.subtitle.sub}".split(","),
startDelay: 300,
typeSpeed: 150,
loop: !{theme.subtitle.loop},
backSpeed: 50
})
} else {
document.getElementById("subtitle").innerHTML = '!{theme.subtitle.sub[0]}'
}
}
if (!{theme.subtitle.effect}) {
if (typeof Typed === 'function') subtitleType()
else $.getScript('!{url_for(theme.CDN.typed)}', subtitleType)
} else {
subtitleType()
}

View File

@@ -1,7 +1,10 @@
.card-widget.card-info .card-widget.card-info
.card-content .card-content
.card-info-avatar.is-center .card-info-avatar.is-center
img.avatar-img(src=url_for(theme.avatar.img) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt="avatar") if theme.lazyload.enable
img.avatar-img(data-lazy-src=url_for(theme.avatar.img) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt="avatar")
else
img.avatar-img(src=url_for(theme.avatar.img) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt="avatar")
.author-info__name= config.author .author-info__name= config.author
.author-info__description!= theme.aside.card_author.description || config.description .author-info__description!= theme.aside.card_author.description || config.description
@@ -19,15 +22,14 @@
.length_num= site.tags.length .length_num= site.tags.length
if site.categories.length if site.categories.length
.card-info-data-item.is-center .card-info-data-item.is-center
a(href=url_for(config.category_dir)) a(href=url_for(config.category_dir))
.headline= _p('aside.categories') .headline= _p('aside.categories')
.length_num= site.categories.length .length_num= site.categories.length
.card-info-bookmark.is-center a#card-info-btn.button--animated(href=theme.aside.card_author.button.link)
button#bookmark-it.button--animated(title= _p('aside.card_bookmark')) i(class=theme.aside.card_author.button.icon)
i.fas.fa-bookmark span=theme.aside.card_author.button.text
span= _p('aside.card_bookmark') || 'Follow Me'
if(theme.social) if(theme.social)
.card-info-social-icons.is-center .card-info-social-icons.is-center

View File

@@ -4,23 +4,24 @@
i.fas.fa-history i.fas.fa-history
span= _p('aside.card_recent_post') span= _p('aside.card_recent_post')
.aside-recent-item .aside-recent-item
- var postLimit = theme.aside.card_recent_post.limit === 0 ? site.posts.length : theme.aside.card_recent_post.limit || 5 - let postLimit = theme.aside.card_recent_post.limit === 0 ? site.posts.length : theme.aside.card_recent_post.limit || 5
- site.posts.sort('date', -1).limit(postLimit).each(function(article){ - let sort = theme.aside.card_recent_post.sort === 'updated' ? 'updated' : 'date'
- site.posts.sort(sort, -1).limit(postLimit).each(function(article){
.aside-recent-post .aside-recent-post
- var link = article.link || article.path - let link = article.link || article.path
- var title = article.title || _p('no_title') - let title = article.title || _p('no_title')
- var no_cover = article.cover === false || !theme.cover.aside_enable ? 'no-aside-cover' : '' - let no_cover = article.cover === false || !theme.cover.aside_enable ? 'no-aside-cover' : ''
- var post_cover = article.cover - let post_cover = article.cover
if post_cover && theme.cover.aside_enable
a(href=url_for(link)) a.aside-post-cover(href=url_for(link) title=title)
if post_cover && theme.cover.aside_enable if theme.lazyload.enable
.aside-post-cover img.aside-post-bg(data-lazy-src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title)
if theme.lazyload.enable else
img.aside-post-bg(data-src=url_for(post_cover) onerror=`this.onerror=null;this.src='`+ url_for(theme.error_img.post_page) + `'` title=title alt=title) img.aside-post-bg(src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title)
else .aside-post-info(class=no_cover)
img.aside-post-bg(src=url_for(post_cover) onerror=`this.onerror=null;this.src='`+ url_for(theme.error_img.post_page) + `'` title=title alt=title) a.aside-post-title(href=url_for(link) title=title)= title
.aside-post-title(class=no_cover) if theme.aside.card_recent_post.sort === 'updated'
.aside-post_title(href=url_for(link) title=article.title || _p('no_title'))= article.title || _p('no_title') time.aside-post_meta.post-meta-updated(datetime=date_xml(article.updated) title=_p('post.updated') + ' ' + full_date(article.updated)) #[=date(article.updated, config.date_format)]
time.aside-post_meta.post-meta__date(title=_p('post.created') + ' ' + full_date(article.date)) #[=date(article.date, config.date_format)] else
time.aside-post_meta.post-meta-date(datetime=date_xml(article.date) title=_p('post.created') + ' ' + full_date(article.date)) #[=date(article.date, config.date_format)]
- }) - })

View File

@@ -8,8 +8,9 @@ block content
span.tag-cloud__amount= site.tags.length span.tag-cloud__amount= site.tags.length
.tag-cloud-tags .tag-cloud-tags
!=cloudTags({source: site.tags, minfontsize: 15, maxfontsize: 30, limit: 0}) !=cloudTags({source: site.tags, minfontsize: 15, maxfontsize: 30, limit: 0})
if page.comments !== false if page.comments !== false && theme.comments && theme.comments.use
include includes/comments/index.pug - var commentsJsLoad = true
!=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache})
else if page.type === 'link' else if page.type === 'link'
include flink.pug include flink.pug
else if page.type === 'categories' else if page.type === 'categories'
@@ -19,10 +20,15 @@ block content
| - | -
span.category__amount= site.categories.length span.category__amount= site.categories.length
div!= list_categories() div!= list_categories()
if page.comments !== false if page.comments !== false && theme.comments && theme.comments.use
include includes/comments/index.pug - var commentsJsLoad = true
!=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache})
else else
#page #page
if theme.douban && theme.douban.meta
if (is_current('/movies/', [strict]) || is_current('/books/', [strict]) || is_current('/games/', [strict]))
meta(name="referrer" content="no-referrer")
#article-container!= page.content #article-container!= page.content
if page.comments !== false if page.comments !== false && theme.comments && theme.comments.use
include includes/comments/index.pug - var commentsJsLoad = true
!=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache})

View File

@@ -9,7 +9,7 @@ block content
.post-meta__tag-list .post-meta__tag-list
each item, index in page.tags.data each item, index in page.tags.data
a(href=url_for(item.path)).post-meta__tags #[=item.name] a(href=url_for(item.path)).post-meta__tags #[=item.name]
!=partial('includes/share/index', {}, {cache:theme.fragment_cache}) include includes/third-party/share/index.pug
if theme.reward.enable if theme.reward.enable
!=partial('includes/post/reward', {}, {cache:theme.fragment_cache}) !=partial('includes/post/reward', {}, {cache:theme.fragment_cache})
@@ -21,5 +21,8 @@ block content
include includes/pagination.pug include includes/pagination.pug
if theme.related_post && theme.related_post.enable if theme.related_post && theme.related_post.enable
!= related_posts(page,site.posts) != related_posts(page,site.posts)
if page.comments !== false
include includes/comments/index.pug if page.comments !== false && theme.comments && theme.comments.use
- var commentsJsLoad = true
!=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache})

View File

@@ -1,18 +1,32 @@
{ {
"name": "hexo-theme-butterfly", "name": "hexo-theme-butterfly",
"version": "3.0.0-rc-1", "version": "3.0.0-rc2",
"private": true,
"engines": {
"node": ">=8.10.0"
},
"description": "A Simple and Card UI Design theme for Hexo", "description": "A Simple and Card UI Design theme for Hexo",
"main": "package.json",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [ "keywords": [
"hexo", "hexo",
"theme", "theme",
"butterfly", "butterfly",
"Card UI Design" "Card UI Design",
"Jerry",
"hexo-theme-butterfly"
], ],
"repository": "https://github.com/jerryc127/hexo-theme-butterfly.git", "repository": {
"type" : "git",
"url" : "https://github.com/jerryc127/hexo-theme-butterfly.git"
},
"bugs": {
"url": "https://github.com/jerryc127/hexo-theme-butterfly/issues",
"email": "wong@jerryc.me"
},
"dependencies": {
"hexo-renderer-marked": "^3.0.0",
"hexo-renderer-pug": "^1.0.0"
},
"homepage": "https://demo.jerryc.me/",
"author": "Jerry <wong@jerryc.me>", "author": "Jerry <wong@jerryc.me>",
"license": "MIT" "license": "Apache-2.0"
} }

View File

@@ -1,23 +1,15 @@
/** /**
* Butterfly * Butterfly
* lazyload * lazyload
* replace src to data-src * replace src to data-lazy-src
*/ */
// <figure .+class="[^"]* highlight [^"]*".+>
'use strict' 'use strict'
const urlFor = require('hexo-util').url_for.bind(hexo) const urlFor = require('hexo-util').url_for.bind(hexo)
function lazyProcess (htmlContent) { hexo.extend.filter.register('after_post_render', data => {
var bg = hexo.theme.config.lazyload.post ? urlFor(hexo.theme.config.lazyload.post) : 'data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs='
return htmlContent.replace(/(<img .*?src=)/ig, `$1 "${bg}" data-src=`)
}
var processPost = function (data) {
if (!hexo.theme.config.lazyload.enable) return if (!hexo.theme.config.lazyload.enable) return
data.content = lazyProcess.call(this, data.content) const bg = hexo.theme.config.lazyload.post ? urlFor(hexo.theme.config.lazyload.post) : 'data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs='
return data return data.content.replace(/(<img.*? src=)/ig, `$1 "${bg}" data-lazy-src=`)
} })
hexo.extend.filter.register('after_post_render', processPost)

View File

@@ -6,18 +6,22 @@
'use strict' 'use strict'
hexo.extend.filter.register('before_post_render', function (data) { hexo.extend.filter.register('before_post_render', function (data) {
if (data.top_img && data.top_img.indexOf('/') === -1) data.top_img = data.path + data.top_img
if (data.cover && data.cover.indexOf('/') === -1) data.cover = data.path + data.cover
if (data.cover === false) { if (data.cover === false) {
data.randomcover = randomCover() data.randomcover = randomCover()
return data return data
} }
data.cover = data.cover || randomCover() data.cover = data.cover || randomCover()
return data return data
}) })
var randomCover = function () { function randomCover () {
var theme = hexo.theme.config const theme = hexo.theme.config
var cover let cover
var num let num
if (theme.cover.default_cover) { if (theme.cover.default_cover) {
if (!Array.isArray(theme.cover.default_cover)) { if (!Array.isArray(theme.cover.default_cover)) {

View File

@@ -98,7 +98,7 @@ hexo.extend.helper.register('aside_archives', function (options = {}) {
return result return result
}) })
var toMomentLocale = function (lang) { const toMomentLocale = function (lang) {
if (lang === undefined) { if (lang === undefined) {
return undefined return undefined
} }

View File

@@ -24,7 +24,7 @@ hexo.extend.helper.register('aside_categories', function (categories, options) {
const categoryDir = this.url_for(config.category_dir) const categoryDir = this.url_for(config.category_dir)
const limit = options.limit === 0 ? categories.length : options.limit const limit = options.limit === 0 ? categories.length : options.limit
const isExpand = options.expand !== 'none' const isExpand = options.expand !== 'none'
const expandClass = isExpand && options.expand === true ? 'card-category-list-icon expand' : 'card-category-list-icon' const expandClass = isExpand && options.expand === true ? 'expand' : ''
const buttonLabel = this._p('aside.more_button') const buttonLabel = this._p('aside.more_button')
const prepareQuery = (parent) => { const prepareQuery = (parent) => {
@@ -35,19 +35,19 @@ hexo.extend.helper.register('aside_categories', function (categories, options) {
const hierarchicalList = (t, level, parent, topparent = true) => { const hierarchicalList = (t, level, parent, topparent = true) => {
let result = '' let result = ''
var isTopParent = topparent const isTopParent = topparent
if (t > 0) { if (t > 0) {
prepareQuery(parent).forEach((cat, i) => { prepareQuery(parent).forEach((cat, i) => {
if (t > 0) { if (t > 0) {
t = t - 1 t = t - 1
let child let child
if (!depth || level + 1 < depth) { if (!depth || level + 1 < depth) {
var childList = hierarchicalList(t, level + 1, cat._id, false) const childList = hierarchicalList(t, level + 1, cat._id, false)
child = childList[0] child = childList[0]
t = childList[1] t = childList[1]
} }
var parentClass = isExpand && isTopParent && child ? 'parent' : '' const parentClass = isExpand && isTopParent && child ? 'parent' : ''
result += `<li class="card-category-list-item ${parentClass}">` result += `<li class="card-category-list-item ${parentClass}">`
@@ -79,8 +79,8 @@ hexo.extend.helper.register('aside_categories', function (categories, options) {
const list = hierarchicalList(limit, 0) const list = hierarchicalList(limit, 0)
var moreButton = function () { const moreButton = function () {
var moreHtml = '' let moreHtml = ''
if (categories.length <= limit) return '' if (categories.length <= limit) return ''
moreHtml += '<li class="card-category-list-item more is-center">' moreHtml += '<li class="card-category-list-item more is-center">'
moreHtml += `<a class="card-category-list-link-more" href="${categoryDir}"> moreHtml += `<a class="card-category-list-link-more" href="${categoryDir}">

View File

@@ -9,6 +9,7 @@
'use strict' 'use strict'
const { stripHTML, escapeHTML } = require('hexo-util') const { stripHTML, escapeHTML } = require('hexo-util')
const crypto = require('crypto')
hexo.extend.helper.register('page_description', function () { hexo.extend.helper.register('page_description', function () {
const { config, page } = this const { config, page } = this
@@ -25,7 +26,7 @@ hexo.extend.helper.register('page_description', function () {
hexo.extend.helper.register('injectHtml', function (data) { hexo.extend.helper.register('injectHtml', function (data) {
let result = '' let result = ''
if (!data) return '' if (!data) return ''
for (var i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
result += data[i] result += data[i]
} }
return result return result
@@ -41,8 +42,8 @@ hexo.extend.helper.register('cloudTags', function (options = {}) {
let result = '' let result = ''
const tagLimit = limit === 0 ? source.length : limit const tagLimit = limit === 0 ? source.length : limit
source.sort('name').limit(tagLimit).forEach(function (tags) { source.sort('name').limit(tagLimit).forEach(function (tags) {
var fontSize = Math.floor(Math.random() * (maxfontsize - minfontsize) + minfontsize) + 'px' const fontSize = Math.floor(Math.random() * (maxfontsize - minfontsize) + minfontsize) + 'px'
var color = 'rgb(' + Math.floor(Math.random() * 201) + ', ' + Math.floor(Math.random() * 201) + ', ' + Math.floor(Math.random() * 201) + ')' // 0,0,0 -> 200,200,200 const color = 'rgb(' + Math.floor(Math.random() * 201) + ', ' + Math.floor(Math.random() * 201) + ', ' + Math.floor(Math.random() * 201) + ')' // 0,0,0 -> 200,200,200
result += `<a href='${env.url_for(tags.path)}' style='font-size:${fontSize}; color:${color}'>${tags.name}</a>` result += `<a href='${env.url_for(tags.path)}' style='font-size:${fontSize}; color:${color}'>${tags.name}</a>`
}) })
return result return result
@@ -56,3 +57,7 @@ hexo.extend.helper.register('urlNoIndex', function () {
} }
return url return url
}) })
hexo.extend.helper.register('md5', function (path) {
return crypto.createHash('md5').update(decodeURI(this.url_for(path))).digest('hex')
})

View File

@@ -7,11 +7,11 @@
'use strict' 'use strict'
hexo.extend.helper.register('related_posts', function (currentPost, allPosts) { hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
var relatedPosts = [] let relatedPosts = []
currentPost.tags.forEach(function (tag) { currentPost.tags.forEach(function (tag) {
allPosts.forEach(function (post) { allPosts.forEach(function (post) {
if (isTagRelated(tag.name, post.tags)) { if (isTagRelated(tag.name, post.tags)) {
var relatedPost = { const relatedPost = {
title: post.title, title: post.title,
path: post.path, path: post.path,
cover: post.cover, cover: post.cover,
@@ -20,7 +20,7 @@ hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
updated: post.updated, updated: post.updated,
created: post.date created: post.date
} }
var index = findItem(relatedPosts, 'path', post.path) const index = findItem(relatedPosts, 'path', post.path)
if (index !== -1) { if (index !== -1) {
relatedPosts[index].weight += 1 relatedPosts[index].weight += 1
} else { } else {
@@ -34,14 +34,14 @@ hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
if (relatedPosts.length === 0) { if (relatedPosts.length === 0) {
return '' return ''
} }
var result = '' let result = ''
const hexoConfig = hexo.theme.config.rootConfig const hexoConfig = hexo.theme.config.rootConfig
const config = hexo.theme.config const config = hexo.theme.config
var limitNum = config.related_post.limit || 6 const limitNum = config.related_post.limit || 6
var dateType = config.related_post.date_type || 'created' const dateType = config.related_post.date_type || 'created'
var headlineLang = this._p('post.recommend') const headlineLang = this._p('post.recommend')
var lazySrc = config.lazyload.enable ? 'data-src' : 'src' const lazySrc = config.lazyload.enable ? 'data-lazy-src' : 'src'
relatedPosts = relatedPosts.sort(compare('weight')) relatedPosts = relatedPosts.sort(compare('weight'))
@@ -54,8 +54,8 @@ hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
'</span></div>' '</span></div>'
result += '<div class="relatedPosts_list">' result += '<div class="relatedPosts_list">'
for (var i = 0; i < Math.min(relatedPosts.length, limitNum); i++) { for (let i = 0; i < Math.min(relatedPosts.length, limitNum); i++) {
var cover = const cover =
relatedPosts[i].cover === false relatedPosts[i].cover === false
? relatedPosts[i].randomcover ? relatedPosts[i].randomcover
: relatedPosts[i].cover : relatedPosts[i].cover
@@ -96,7 +96,7 @@ hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
}) })
function isTagRelated (tagName, TBDtags) { function isTagRelated (tagName, TBDtags) {
var result = false let result = false
TBDtags.forEach(function (tag) { TBDtags.forEach(function (tag) {
if (tagName === tag.name) { if (tagName === tag.name) {
result = true result = true
@@ -106,7 +106,7 @@ function isTagRelated (tagName, TBDtags) {
} }
function findItem (arrayToSearch, attr, val) { function findItem (arrayToSearch, attr, val) {
for (var i = 0; i < arrayToSearch.length; i++) { for (let i = 0; i < arrayToSearch.length; i++) {
if (arrayToSearch[i][attr] === val) { if (arrayToSearch[i][attr] === val) {
return i return i
} }
@@ -116,8 +116,8 @@ function findItem (arrayToSearch, attr, val) {
function compare (attr) { function compare (attr) {
return function (a, b) { return function (a, b) {
var val1 = a[attr] const val1 = a[attr]
var val2 = b[attr] const val2 = b[attr]
return val2 - val1 return val2 - val1
} }
} }

View File

@@ -11,17 +11,18 @@ const urlFor = require('hexo-util').url_for.bind(hexo)
function btn (args) { function btn (args) {
args = args.join(' ').split(',') args = args.join(' ').split(',')
var url = args[0] || '' let url = args[0] || ''
var text = args[1] || '' let text = args[1] || ''
var icon = args[2] || '' let icon = args[2] || ''
var option = args[3] || '' let option = args[3] || ''
url = url.trim() url = url.trim()
text = text.trim() text = text.trim()
icon = icon.trim() icon = icon.trim()
option = option.trim() option = option.trim()
return `<a class="btn-beautify button--animated ${option}" href="${urlFor(url)}" title="${text}">${icon.length > 0 ? `<i class="${icon} fa-fw"></i>` : ''} ${text} </a>` return `<a class="btn-beautify button--animated ${option}" href="${urlFor(url)}"
title="${text}">${icon.length > 0 ? `<i class="${icon} fa-fw"></i>` : ''}<span>${text}</span></a>`
} }
hexo.extend.tag.register('btn', btn, { ends: false }) hexo.extend.tag.register('btn', btn, { ends: false })

View File

@@ -5,7 +5,7 @@
'use strict' 'use strict'
const url_for = require('hexo-util').url_for.bind(hexo) const urlFor = require('hexo-util').url_for.bind(hexo)
function gallery (args, content) { function gallery (args, content) {
return `<div class="justified-gallery">${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')} return `<div class="justified-gallery">${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}
@@ -15,8 +15,8 @@ function gallery (args, content) {
function galleryGroup (args) { function galleryGroup (args) {
const name = args[0] const name = args[0]
const desrc = args[1] const desrc = args[1]
const url = url_for(args[2]) const url = urlFor(args[2])
const img = url_for(args[3]) const img = urlFor(args[3])
return ` return `
<figure class="gallery-group"> <figure class="gallery-group">

View File

@@ -18,42 +18,42 @@
function hideInline (args) { function hideInline (args) {
args = args.join(' ').split(',') args = args.join(' ').split(',')
var content = args[0] const content = args[0]
var display = args[1] || 'Click' const display = args[1] || 'Click'
var bg = args[2] || false const bg = args[2] || false
var color = args[3] || false const color = args[3] || false
var group = 'style="' let group = 'style="'
if (bg) group += `background-color: ${bg};` if (bg) group += `background-color: ${bg};`
if (color) group += `color: ${color}` if (color) group += `color: ${color}`
group += '"' group += '"'
return `<span class="hide-inline"><button class="hide-button button--animated" ${group}>${display} return `<span class="hide-inline"><button type="button" class="hide-button button--animated" ${group}>${display}
</button><span class="hide-content">${content}</span></span>` </button><span class="hide-content">${content}</span></span>`
} }
function hideBlock (args, content) { function hideBlock (args, content) {
args = args.join(' ').split(',') args = args.join(' ').split(',')
var display = args[0] || 'Click' const display = args[0] || 'Click'
var bg = args[1] || false const bg = args[1] || false
var color = args[2] || false const color = args[2] || false
var group = 'style="' let group = 'style="'
if (bg) group += `background-color: ${bg};` if (bg) group += `background-color: ${bg};`
if (color) group += `color: ${color}` if (color) group += `color: ${color}`
group += '"' group += '"'
return `<div class="hide-block"><button class="hide-button button--animated" ${group}>${display} return `<div class="hide-block"><button type="button" class="hide-button button--animated" ${group}>${display}
</button><span class="hide-content">${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}</span></div>` </button><span class="hide-content">${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}</span></div>`
} }
function hideToggle (args, content) { function hideToggle (args, content) {
args = args.join(' ').split(',') args = args.join(' ').split(',')
var display = args[0] const display = args[0]
var bg = args[1] || false const bg = args[1] || false
var color = args[2] || false const color = args[2] || false
var group = 'style="' let group = 'style="'
var border = '' let border = ''
if (bg) { if (bg) {
border = `style="border: 1px solid ${bg}"` border = `style="border: 1px solid ${bg}"`

View File

@@ -44,10 +44,10 @@ function postTabs (args, content) {
const icon = tabIcon.trim() const icon = tabIcon.trim()
tabIcon.length > 0 && (tabIcon = `<i class="${icon}"${isOnlyicon}></i>`) tabIcon.length > 0 && (tabIcon = `<i class="${icon}"${isOnlyicon}></i>`)
const toTop = '<button class="tab-to-top" onclick="scrollToDest($(this).parents(\'.tabs\'),65)"><i class="fas fa-arrow-up"></i></button>' const toTop = '<button type="button" class="tab-to-top" onclick="scrollToDest($(this).parents(\'.tabs\'),65)"><i class="fas fa-arrow-up"></i></button>'
const isActive = (tabActive > 0 && tabActive === tabId) || (tabActive === 0 && tabId === 1) ? ' active' : '' const isActive = (tabActive > 0 && tabActive === tabId) || (tabActive === 0 && tabId === 1) ? ' active' : ''
tabNav += `<li class="tab${isActive}"><button data-href="#${tabHref}">${tabIcon + tabCaption.trim()}</button></li>` tabNav += `<li class="tab${isActive}"><button type="button" data-href="#${tabHref}">${tabIcon + tabCaption.trim()}</button></li>`
tabContent += `<div class="tab-item-content${isActive}" id="${tabHref}">${postContent + toTop}</div>` tabContent += `<div class="tab-item-content${isActive}" id="${tabHref}">${postContent + toTop}</div>`
} }

View File

@@ -16,3 +16,31 @@
font-family: 'Font Awesome 5 Free' font-family: 'Font Awesome 5 Free'
text-rendering: auto text-rendering: auto
-webkit-font-smoothing: antialiased -webkit-font-smoothing: antialiased
[data-theme='light']
--global-bg: $body-bg
--font-color: $font-black
--hr-border: lighten($theme-hr-color, 50%)
--hr-before-color: lighten($theme-hr-color, 30%)
--search-bg: $search-bg
--search-input-color: $search-input-color
--search-result-title: $search-result-title
--preloader-bg: $preloader-bg
--preloader-color: $preloader-word-color
--tab-border-color: $tab-border-color
--tab-botton-bg: $tab-botton-bg
--tab-botton-color: $tab-botton-color
--tab-button-hover-bg: $tab-button-hover-bg
--tab-button-active-bg: $tab-button-active-bg
--card-bg: $card-bg
--sidebar-bg: $sidebar-background
--btn-hover-color: $button-hover-color
--btn-color: $button-color
--btn-bg: $button-bg
--text-bg-hover: $text-bg-hover
--light-grey: $light-grey
--white: $white
--text-highlight-color: $text-highlight-color
--blockquote-color: $blockquote-color
--blockquote-bg: $blockquote-background-color
--reward-pop: $reward-pop-up-bg

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