mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-16 20:30:53 +08:00
Compare commits
18 Commits
7
.github/ISSUE_TEMPLATE.md
vendored
7
.github/ISSUE_TEMPLATE.md
vendored
@@ -1,8 +1,15 @@
|
|||||||
<!--
|
<!--
|
||||||
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
|
||||||
|
如果你是由舊版本升級到新版,運行時出現報錯,請首先把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
|
||||||
|
如果你是線上訪問出現問題,請檢查瀏覽器‘開發人員工具(快捷鍵F12)’的console是否有報錯,反饋時附上你的網站
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
## I want to create a new issue <!-- 我想要建立一個新的issue -->
|
## I want to create a new issue <!-- 我想要建立一個新的issue -->
|
||||||
|
|
||||||
<!-- Check all with "x" especially FAQ & Documentation!! (使用 "x" 選擇) -->
|
<!-- Check all with "x" especially FAQ & Documentation!! (使用 "x" 選擇) -->
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
# 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-2.2.0-blue"/></a>
|
<a href="https://github.com/jerryc127/hexo-theme-butterfly/releases"><img alt="Version" src="https://img.shields.io/badge/release-2.3.0-blue"/></a>
|
||||||
<a href="https://jerryc.me"><img alt="Author" src="https://img.shields.io/badge/author-JerryC-blur"/></a>
|
<a href="https://jerryc.me"><img alt="Author" src="https://img.shields.io/badge/author-JerryC-blur"/></a>
|
||||||
<a href="https://hexo.io"><img alt="Hexo" src="https://img.shields.io/badge/hexo-4.0+-0e83c"/></a>
|
<a href="https://hexo.io"><img alt="Hexo" src="https://img.shields.io/badge/hexo-4.0+-0e83c"/></a>
|
||||||
<a href="https://nodejs.org/"><img alt="node.js" src="https://img.shields.io/badge/node.js-8.0+-blur"/></a>
|
<a href="https://nodejs.org/"><img alt="node.js" src="https://img.shields.io/badge/node.js-8.0+-blur"/></a>
|
||||||
|
|
||||||
Demo: https://demo.jerryc.me/
|
Demo: 👍 [Butterfly](https://demo.jerryc.me/) || 🤞 [JerryC](https://jerryc.me/)
|
||||||
|
|
||||||
JerryC: https://jerryc.me/
|
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Stable branch:
|
Stable branch [recommend]:
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/Butterfly
|
git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/Butterfly
|
||||||
|
|||||||
@@ -1,20 +1,17 @@
|
|||||||
# 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-2.2.0-blue"/></a>
|
<a href="https://github.com/jerryc127/hexo-theme-butterfly/releases"><img alt="Version" src="https://img.shields.io/badge/release-2.3.0-blue"/></a>
|
||||||
<a href="https://jerryc.me"><img alt="Author" src="https://img.shields.io/badge/author-JerryC-blur"/></a>
|
<a href="https://jerryc.me"><img alt="Author" src="https://img.shields.io/badge/author-JerryC-blur"/></a>
|
||||||
<a href="https://hexo.io"><img alt="Hexo" src="https://img.shields.io/badge/hexo-4.0+-0e83c"/></a>
|
<a href="https://hexo.io"><img alt="Hexo" src="https://img.shields.io/badge/hexo-4.0+-0e83c"/></a>
|
||||||
<a href="https://nodejs.org/"><img alt="node.js" src="https://img.shields.io/badge/node.js-8.0+-blur"/></a>
|
<a href="https://nodejs.org/"><img alt="node.js" src="https://img.shields.io/badge/node.js-8.0+-blur"/></a>
|
||||||
|
|
||||||
Demo: https://demo.jerryc.me/
|
Demo: 👍 [Butterfly](https://demo.jerryc.me/) || 🤞 [JerryC](https://jerryc.me/)
|
||||||
|
|
||||||
JerryC: https://jerryc.me/
|
|
||||||
|
|
||||||
|
|
||||||
一款基於[hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody)修改的主題
|
一款基於[hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody)修改的主題
|
||||||
|
|
||||||
## 安裝
|
## 安裝
|
||||||
|
|
||||||
在你的博客根目錄裡
|
在你的博客根目錄裡安裝穩定版【推薦】
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/Butterfly
|
git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/Butterfly
|
||||||
|
|||||||
143
_config.yml
143
_config.yml
@@ -49,12 +49,12 @@ copy:
|
|||||||
|
|
||||||
# social settings
|
# social settings
|
||||||
# formal:
|
# formal:
|
||||||
# icon: link
|
# icon: link || the description
|
||||||
# ---------------
|
# ---------------
|
||||||
social:
|
social:
|
||||||
fa fa-github: https://github.com/jerryc127
|
fa fa-github: https://github.com/jerryc127 || Github
|
||||||
fa fa-envelope: mailto:xxxxxxxx@gmail.com
|
fa fa-envelope: mailto:xxxxxxx@gmail.com || Email
|
||||||
fa fa-rss: /atom.xml
|
fa fa-rss: /atom.xml || RSS
|
||||||
|
|
||||||
#### search ####
|
#### search ####
|
||||||
# Algolia search
|
# Algolia search
|
||||||
@@ -67,10 +67,10 @@ algolia_search:
|
|||||||
labels:
|
labels:
|
||||||
input_placeholder: Search for Posts
|
input_placeholder: Search for Posts
|
||||||
hits_empty: "We didn't find any results for the search: ${query}" # if there are no result
|
hits_empty: "We didn't find any results for the search: ${query}" # if there are no result
|
||||||
hits_stats: "${hits} results found in ${time} ms"
|
hits_stats: '${hits} results found in ${time} ms'
|
||||||
|
|
||||||
# Local search
|
# Local search
|
||||||
# Please see doc for more details: https://jerryc.me/posts/21cfbf15/#本地搜索
|
# Please see doc for more details: https://docs.jerryc.me/config.html#本地搜索
|
||||||
# ---------------
|
# ---------------
|
||||||
local_search:
|
local_search:
|
||||||
enable: false
|
enable: false
|
||||||
@@ -79,7 +79,7 @@ local_search:
|
|||||||
hits_empty: "We didn't find any results for the search: ${query}" # if there are no result
|
hits_empty: "We didn't find any results for the search: ${query}" # if there are no result
|
||||||
|
|
||||||
# MathJax
|
# MathJax
|
||||||
# Please see doc for more details: https://jerryc.me/posts/21cfbf15/#MathJax
|
# Please see doc for more details: https://docs.jerryc.me/config.html#mathjax
|
||||||
# ---------------
|
# ---------------
|
||||||
mathjax:
|
mathjax:
|
||||||
enable: false
|
enable: false
|
||||||
@@ -155,7 +155,7 @@ lodding_bg:
|
|||||||
# A simple 404 page
|
# A simple 404 page
|
||||||
error_404:
|
error_404:
|
||||||
enable: false
|
enable: false
|
||||||
subtitle: "Page Not Found"
|
subtitle: 'Page Not Found'
|
||||||
background:
|
background:
|
||||||
|
|
||||||
post_meta:
|
post_meta:
|
||||||
@@ -168,9 +168,12 @@ post_meta:
|
|||||||
categories: true # true or false 文章頁是否顯示分類
|
categories: true # true or false 文章頁是否顯示分類
|
||||||
tags: true # true or false 文章頁是否顯示標籤
|
tags: true # true or false 文章頁是否顯示標籤
|
||||||
|
|
||||||
# Please see doc for more details: https://jerryc.me/posts/21cfbf15/#字數統計
|
# Please see doc for more details: https://docs.jerryc.me/config.html#字數統計
|
||||||
wordcount:
|
wordcount:
|
||||||
enable: false
|
enable: false
|
||||||
|
post_wordcount: true
|
||||||
|
min2read: true
|
||||||
|
total_wordcount: true
|
||||||
|
|
||||||
toc:
|
toc:
|
||||||
enable: true
|
enable: true
|
||||||
@@ -218,7 +221,7 @@ addtoany:
|
|||||||
disqus:
|
disqus:
|
||||||
enable: false
|
enable: false
|
||||||
shortname:
|
shortname:
|
||||||
count: false # top_img顯示評論數
|
count: false # dispaly comment count in top_img
|
||||||
|
|
||||||
# Disqus.js版評論系統,應對大陸長城的折中方案,兼容原版:https://github.com/SukkaW/DisqusJS
|
# Disqus.js版評論系統,應對大陸長城的折中方案,兼容原版:https://github.com/SukkaW/DisqusJS
|
||||||
# API 申請地址:https://disqus.com/api/applications/
|
# API 申請地址:https://disqus.com/api/applications/
|
||||||
@@ -231,7 +234,7 @@ disqusjs:
|
|||||||
api: https://disqus.skk.moe/disqus/ #一般情況下無需修改 API 地址
|
api: https://disqus.skk.moe/disqus/ #一般情況下無需修改 API 地址
|
||||||
admin:
|
admin:
|
||||||
adminLabel:
|
adminLabel:
|
||||||
count: true # top_img顯示評論數
|
count: false # dispaly comment count in top_img
|
||||||
|
|
||||||
laibili:
|
laibili:
|
||||||
enable: false
|
enable: false
|
||||||
@@ -249,24 +252,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: true # top_img顯示評論數
|
count: false # dispaly comment count in top_img
|
||||||
|
|
||||||
# valine comment system. https://valine.js.org
|
# valine comment system. https://valine.js.org
|
||||||
valine:
|
valine:
|
||||||
enable: false # if you want use valine,please set this value is true
|
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
|
||||||
notify: false # valine mail notify (true/false) https://github.com/xCss/Valine/wiki
|
notify: false # valine mail notify (true/false) Deprecated in v1.4.0+
|
||||||
verify: false # valine verify code (true/false)
|
verify: false # valine verify code (true/false) Deprecated in v1.4.0+
|
||||||
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/en
|
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
|
guest_info: nick,mail,link #valine comment header info
|
||||||
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)
|
||||||
|
emojiCDN: # emoji CDN
|
||||||
|
enableQQ: false # enable the Nickname box to automatically get QQ Nickname and QQ Avatar
|
||||||
|
requiredFields: nick,mail # required fields nick/mail/link
|
||||||
bg: /img/comment_bg.png # valine background
|
bg: /img/comment_bg.png # valine background
|
||||||
count: true # top_img顯示評論數
|
count: false # dispaly comment count in top_img
|
||||||
|
|
||||||
# utterances
|
# utterances
|
||||||
# https://utteranc.es/
|
# https://utteranc.es/
|
||||||
@@ -279,6 +285,17 @@ utterances:
|
|||||||
light_theme: github-light
|
light_theme: github-light
|
||||||
dark_theme: photon-dark
|
dark_theme: photon-dark
|
||||||
|
|
||||||
|
# Facebook Comments Plugin
|
||||||
|
# https://developers.facebook.com/docs/plugins/comments/
|
||||||
|
facebook_comments:
|
||||||
|
enable: false
|
||||||
|
app_id:
|
||||||
|
user_id: # optional
|
||||||
|
pageSize: 10 # The number of comments to show
|
||||||
|
order_by: social # social/time/reverse_time
|
||||||
|
lang: en_US # Language en_US/zh_CN/zh_TW and so on
|
||||||
|
count: false
|
||||||
|
|
||||||
##### Footer Settings ####
|
##### Footer Settings ####
|
||||||
# ------------------------------------
|
# ------------------------------------
|
||||||
since: 2020
|
since: 2020
|
||||||
@@ -313,6 +330,13 @@ google_adsense:
|
|||||||
client:
|
client:
|
||||||
enable_page_level_ads: true
|
enable_page_level_ads: true
|
||||||
|
|
||||||
|
# 廣告插入位置
|
||||||
|
# 適用於開啓手動廣告的配置
|
||||||
|
# ad:
|
||||||
|
# index:
|
||||||
|
# aside:
|
||||||
|
# post:
|
||||||
|
|
||||||
#### 站長驗證 ####
|
#### 站長驗證 ####
|
||||||
# Google Webmaster tools verification setting
|
# Google Webmaster tools verification setting
|
||||||
# See: https://www.google.com/webmasters/
|
# See: https://www.google.com/webmasters/
|
||||||
@@ -347,6 +371,10 @@ related_post:
|
|||||||
limit: 6 # 顯示推薦文章數目
|
limit: 6 # 顯示推薦文章數目
|
||||||
date_type: created # or created or updated 文章日期顯示創建日或者更新日
|
date_type: created # or created or updated 文章日期顯示創建日或者更新日
|
||||||
|
|
||||||
|
# figcaption
|
||||||
|
# 圖片描述文字
|
||||||
|
photofigcaption: false
|
||||||
|
|
||||||
#### 美化/效果 ####
|
#### 美化/效果 ####
|
||||||
#--------------------------------
|
#--------------------------------
|
||||||
|
|
||||||
@@ -411,7 +439,7 @@ canvas_ribbon_piao:
|
|||||||
# https://github.com/hustcc/canvas-nest.js
|
# https://github.com/hustcc/canvas-nest.js
|
||||||
canvas_nest:
|
canvas_nest:
|
||||||
enable: false
|
enable: false
|
||||||
color: "0,0,255" #color of lines, default: '0,0,0'; RGB values: (R,G,B).(note: use ',' to separate.)
|
color: '0,0,255' #color of lines, default: '0,0,0'; RGB values: (R,G,B).(note: use ',' to separate.)
|
||||||
opacity: 0.7 # the opacity of line (0~1), default: 0.5.
|
opacity: 0.7 # the opacity of line (0~1), default: 0.5.
|
||||||
zIndex: -1 # z-index property of the background, default: -1.
|
zIndex: -1 # z-index property of the background, default: -1.
|
||||||
count: 99 # the number of lines, default: 99.
|
count: 99 # the number of lines, default: 99.
|
||||||
@@ -437,8 +465,9 @@ click_heart:
|
|||||||
ClickShowText:
|
ClickShowText:
|
||||||
enable: false
|
enable: false
|
||||||
text:
|
text:
|
||||||
- 本人
|
- I
|
||||||
- 超帥
|
- LOVE
|
||||||
|
- YOU
|
||||||
fontSize: 15px
|
fontSize: 15px
|
||||||
|
|
||||||
# 網站顯示模式
|
# 網站顯示模式
|
||||||
@@ -450,7 +479,7 @@ display_mode: light
|
|||||||
beautify:
|
beautify:
|
||||||
enable: false
|
enable: false
|
||||||
title-prefix-icon: '\f0c1'
|
title-prefix-icon: '\f0c1'
|
||||||
title-prefix-icon-color: "#F47466"
|
title-prefix-icon-color: '#F47466'
|
||||||
|
|
||||||
# 全局字體
|
# 全局字體
|
||||||
font:
|
font:
|
||||||
@@ -479,8 +508,8 @@ subtitle:
|
|||||||
loop: false
|
loop: false
|
||||||
# source調用第三方服務
|
# source調用第三方服務
|
||||||
# source: false 關閉調用
|
# source: false 關閉調用
|
||||||
# source: 1 調用金山詞霸的每日一句(簡體)
|
# source: 1 調用搏天api的隨機語錄(簡體) https://api.btstu.cn/
|
||||||
# source: 2 調用一言網的一句話(簡體) #https://hitokoto.cn/
|
# source: 2 調用一言網的一句話(簡體) https://hitokoto.cn/
|
||||||
# source: 3 調用一句網(簡體) http://yijuzhan.com/
|
# source: 3 調用一句網(簡體) http://yijuzhan.com/
|
||||||
# source: 4 調用今日詩詞(簡體) https://www.jinrishici.com/
|
# source: 4 調用今日詩詞(簡體) https://www.jinrishici.com/
|
||||||
# subtitle 會先顯示 source , 再顯示 sub 的內容
|
# subtitle 會先顯示 source , 再顯示 sub 的內容
|
||||||
@@ -496,6 +525,9 @@ subtitle:
|
|||||||
fontawesome_v5:
|
fontawesome_v5:
|
||||||
enable: false
|
enable: false
|
||||||
|
|
||||||
|
# 加載動畫 Loading Animation
|
||||||
|
preloader: false
|
||||||
|
|
||||||
#### 側邊欄 ####
|
#### 側邊欄 ####
|
||||||
#-------------------------------------
|
#-------------------------------------
|
||||||
# 側邊欄顯示設置
|
# 側邊欄顯示設置
|
||||||
@@ -503,18 +535,30 @@ aside:
|
|||||||
enable: true
|
enable: true
|
||||||
mobile: true # 手機頁面( 顯示寬度 < 768px )是否顯示aside內容
|
mobile: true # 手機頁面( 顯示寬度 < 768px )是否顯示aside內容
|
||||||
position: right # left or right
|
position: right # left or right
|
||||||
card_author: true
|
card_author:
|
||||||
card_announcement: true
|
enable: true
|
||||||
card_recent_post: true
|
description:
|
||||||
card_categories: true
|
card_announcement:
|
||||||
card_tags: true
|
enable: true
|
||||||
card_archives: true
|
content: This is my Blog
|
||||||
|
card_recent_post:
|
||||||
|
enable: true
|
||||||
|
limit: 5 # if set 0 will show all
|
||||||
|
card_categories:
|
||||||
|
enable: true
|
||||||
|
limit: 8 # if set 0 will show all
|
||||||
|
card_tags:
|
||||||
|
enable: true
|
||||||
|
limit: 40 # if set 0 will show all
|
||||||
|
color: false
|
||||||
|
card_archives:
|
||||||
|
enable: true
|
||||||
|
type: monthly # yearly or monthly
|
||||||
|
format: MMMM YYYY # eg: YYYY年MM月
|
||||||
|
order: -1 # Sort of order. 1, asc for ascending; -1, desc for descending
|
||||||
|
limit: 8 # if set 0 will show all
|
||||||
card_webinfo: true
|
card_webinfo: true
|
||||||
|
|
||||||
# 網站公告
|
|
||||||
announcement:
|
|
||||||
content: 感謝訪問本站,若喜歡請收藏 ^_^
|
|
||||||
|
|
||||||
# busuanzi count for PV / UV in site
|
# busuanzi count for PV / UV in site
|
||||||
# 訪問人數
|
# 訪問人數
|
||||||
busuanzi:
|
busuanzi:
|
||||||
@@ -541,11 +585,11 @@ translate:
|
|||||||
#延遲時間,若不在前, 要設定延遲翻譯時間, 如100表示100ms,默認為0
|
#延遲時間,若不在前, 要設定延遲翻譯時間, 如100表示100ms,默認為0
|
||||||
translateDelay: 0
|
translateDelay: 0
|
||||||
#博客網址
|
#博客網址
|
||||||
cookieDomain: "https://xxx/"
|
cookieDomain: 'https://xxx/'
|
||||||
#當文字是簡體時,按鈕顯示的文字
|
#當文字是簡體時,按鈕顯示的文字
|
||||||
msgToTraditionalChinese: "繁"
|
msgToTraditionalChinese: '繁'
|
||||||
#當文字是繁體時,按鈕顯示的文字
|
#當文字是繁體時,按鈕顯示的文字
|
||||||
msgToSimplifiedChinese: "簡"
|
msgToSimplifiedChinese: '簡'
|
||||||
|
|
||||||
#閲讀模式
|
#閲讀模式
|
||||||
readmode:
|
readmode:
|
||||||
@@ -584,8 +628,8 @@ fancybox:
|
|||||||
snackbar:
|
snackbar:
|
||||||
enable: false
|
enable: false
|
||||||
position: bottom-left
|
position: bottom-left
|
||||||
bg_light: "#49b1f5" #light mode時彈窗背景
|
bg_light: '#49b1f5' #light mode時彈窗背景
|
||||||
bg_dark: "#2d3035" #dark mode時彈窗背景
|
bg_dark: '#2d3035' #dark mode時彈窗背景
|
||||||
|
|
||||||
#百度推送
|
#百度推送
|
||||||
baidu_push:
|
baidu_push:
|
||||||
@@ -639,21 +683,23 @@ Open_Graph_meta: true
|
|||||||
# 開啟hexo自帶的緩存,加快生成速度
|
# 開啟hexo自帶的緩存,加快生成速度
|
||||||
fragment_cache: true
|
fragment_cache: true
|
||||||
|
|
||||||
# CDN
|
# inject
|
||||||
# 網站必須
|
# 插入代码到头部</head>之前 和 尾部</body>之前
|
||||||
# 可根據需要自行添加js/css
|
inject:
|
||||||
CDN_USE:
|
head:
|
||||||
css:
|
# - <link rel="stylesheet" href="xxxxx">
|
||||||
- /css/index.css
|
bottom:
|
||||||
|
# - <script src="xxxx"></script>
|
||||||
js:
|
|
||||||
- https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js #/js/third-party/jquery.min.js
|
|
||||||
- /js/utils.js
|
|
||||||
- /js/main.js
|
|
||||||
|
|
||||||
# CDN
|
# CDN
|
||||||
# 非必要不要修改
|
# 非必要不要修改
|
||||||
CDN:
|
CDN:
|
||||||
|
# main
|
||||||
|
main_css: /css/index.css
|
||||||
|
jquery: https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js
|
||||||
|
main: /js/main.js
|
||||||
|
utils: /js/utils.js
|
||||||
|
|
||||||
# comments
|
# comments
|
||||||
blueimp_md5: https://cdn.jsdelivr.net/npm/blueimp-md5/js/md5.min.js
|
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
|
||||||
@@ -715,4 +761,5 @@ CDN:
|
|||||||
fontawesome_v4: https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css
|
fontawesome_v4: https://cdn.jsdelivr.net/npm/font-awesome@latest/css/font-awesome.min.css
|
||||||
fontawesome_v5: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css
|
fontawesome_v5: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css
|
||||||
|
|
||||||
|
# 簡繁轉換
|
||||||
translate: /js/tw_cn.js
|
translate: /js/tw_cn.js
|
||||||
|
|||||||
@@ -61,13 +61,15 @@ 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: Add to bookmark
|
card_bookmark: Bookmark
|
||||||
card_webinfo:
|
card_webinfo:
|
||||||
headline: Info
|
headline: Info
|
||||||
article_name: Article
|
article_name: Article
|
||||||
runtime_name: Run time
|
runtime_name: Run time
|
||||||
|
site_wordcount: Total Count
|
||||||
site_uv_name: UV
|
site_uv_name: UV
|
||||||
site_pv_name: PV
|
site_pv_name: PV
|
||||||
|
more_button: More
|
||||||
|
|
||||||
donate: Donate
|
donate: Donate
|
||||||
share: Share
|
share: Share
|
||||||
@@ -103,3 +105,4 @@ Snackbar:
|
|||||||
night_to_day: Light Mode Activated Manually
|
night_to_day: Light Mode Activated Manually
|
||||||
|
|
||||||
error_title: Page not found
|
error_title: Page not found
|
||||||
|
loading: Loading...
|
||||||
|
|||||||
@@ -61,13 +61,15 @@ 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: Add to bookmark
|
card_bookmark: Bookmark
|
||||||
card_webinfo:
|
card_webinfo:
|
||||||
headline: Info
|
headline: Info
|
||||||
article_name: Article
|
article_name: Article
|
||||||
runtime_name: Run time
|
runtime_name: Run time
|
||||||
|
site_wordcount: Total Count
|
||||||
site_uv_name: UV
|
site_uv_name: UV
|
||||||
site_pv_name: PV
|
site_pv_name: PV
|
||||||
|
more_button: More
|
||||||
|
|
||||||
donate: Donate
|
donate: Donate
|
||||||
share: Share
|
share: Share
|
||||||
@@ -103,3 +105,4 @@ Snackbar:
|
|||||||
night_to_day: Light Mode Activated Manually
|
night_to_day: Light Mode Activated Manually
|
||||||
|
|
||||||
error_title: Page not found
|
error_title: Page not found
|
||||||
|
loading: Loading...
|
||||||
|
|||||||
@@ -68,8 +68,10 @@ aside:
|
|||||||
headline: 网站资讯
|
headline: 网站资讯
|
||||||
article_name: 文章数目
|
article_name: 文章数目
|
||||||
runtime_name: 已运行时间
|
runtime_name: 已运行时间
|
||||||
|
site_wordcount: 本站总字数
|
||||||
site_uv_name: 本站访客数
|
site_uv_name: 本站访客数
|
||||||
site_pv_name: 本站总访问量
|
site_pv_name: 本站总访问量
|
||||||
|
more_button: 查看更多
|
||||||
|
|
||||||
donate: 打赏
|
donate: 打赏
|
||||||
share: 分享
|
share: 分享
|
||||||
@@ -105,3 +107,4 @@ Snackbar:
|
|||||||
night_to_day: 你已切换为浅色模式
|
night_to_day: 你已切换为浅色模式
|
||||||
|
|
||||||
error_title: 页面没有找到
|
error_title: 页面没有找到
|
||||||
|
loading: 加载中...
|
||||||
@@ -9,7 +9,7 @@ footer:
|
|||||||
copy:
|
copy:
|
||||||
success: 複製成功
|
success: 複製成功
|
||||||
error: 複製錯誤
|
error: 複製錯誤
|
||||||
noSupport: 瀏覽器不支持
|
noSupport: 瀏覽器不支援
|
||||||
|
|
||||||
page:
|
page:
|
||||||
articles: 文章總覽
|
articles: 文章總覽
|
||||||
@@ -24,28 +24,28 @@ post:
|
|||||||
created: 發表於
|
created: 發表於
|
||||||
updated: 更新於
|
updated: 更新於
|
||||||
wordcount: 字數總計
|
wordcount: 字數總計
|
||||||
min2read: "閲讀時長: %s 分鐘"
|
min2read: "閱讀時長: %s 分鐘"
|
||||||
page_pv: 閲讀量
|
page_pv: 閱讀量
|
||||||
comments: 評論數
|
comments: 評論數
|
||||||
copyright:
|
copyright:
|
||||||
author: 文章作者
|
author: 文章作者
|
||||||
link: 文章鏈接
|
link: 文章連結
|
||||||
copyright_notice: 版權聲明
|
copyright_notice: 版權聲明
|
||||||
copyright_content: '本博客所有文章除特別聲明外,均採用
|
copyright_content: '本部落格所有文章除特別聲明外,均採用
|
||||||
<a href="%s" target="_blank">%s</a> 許可協議。轉載請註明來自 <a href="%s" target="_blank">%s</a>!'
|
<a href="%s" target="_blank">%s</a> 許可協議。轉載請註明來自 <a href="%s" target="_blank">%s</a>!'
|
||||||
recommend: 相關推薦
|
recommend: 相關推薦
|
||||||
|
|
||||||
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: 由
|
||||||
|
|
||||||
pagination:
|
pagination:
|
||||||
@@ -67,33 +67,35 @@ aside:
|
|||||||
card_webinfo:
|
card_webinfo:
|
||||||
headline: 網站資訊
|
headline: 網站資訊
|
||||||
article_name: 文章數目
|
article_name: 文章數目
|
||||||
runtime_name: 已運行時間
|
runtime_name: 已執行時間
|
||||||
|
site_wordcount: 本站總字數
|
||||||
site_uv_name: 本站訪客數
|
site_uv_name: 本站訪客數
|
||||||
site_pv_name: 本站總訪問量
|
site_pv_name: 本站總訪問量
|
||||||
|
more_button: 檢視更多
|
||||||
|
|
||||||
donate: 打賞
|
donate: 打賞
|
||||||
share: 分享
|
share: 分享
|
||||||
bookmark:
|
bookmark:
|
||||||
title: 添加書籤
|
title: 新增書籤
|
||||||
|
|
||||||
rightside:
|
rightside:
|
||||||
readmode_title: 閲讀模式
|
readmode_title: 閱讀模式
|
||||||
font_plus_title: 放大字體
|
font_plus_title: 放大字型
|
||||||
font_minus_title: 縮小字體
|
font_minus_title: 縮小字型
|
||||||
translate_title: 簡繁轉換
|
translate_title: 簡繁轉換
|
||||||
night_mode_title: 夜間模式
|
night_mode_title: 夜間模式
|
||||||
back_to_top: 回到頂部
|
back_to_top: 回到頂部
|
||||||
toc: 目錄
|
toc: 目錄
|
||||||
scroll_to_comment: 直達評論
|
scroll_to_comment: 直達評論
|
||||||
setting: 設置
|
setting: 設定
|
||||||
|
|
||||||
runtime_unit: 天
|
runtime_unit: 天
|
||||||
|
|
||||||
copy_copyright:
|
copy_copyright:
|
||||||
author: 作者
|
author: 作者
|
||||||
link: 鏈接
|
link: 連結
|
||||||
source: 來源
|
source: 來源
|
||||||
info: 著作權歸作者所有。商業轉載請聯繫作者獲得授權,非商業轉載請註明出處。
|
info: 著作權歸作者所有。商業轉載請聯絡作者獲得授權,非商業轉載請註明出處。
|
||||||
|
|
||||||
Snackbar:
|
Snackbar:
|
||||||
bookmark:
|
bookmark:
|
||||||
@@ -105,5 +107,5 @@ Snackbar:
|
|||||||
night_to_day: 你已切換為淺色模式
|
night_to_day: 你已切換為淺色模式
|
||||||
|
|
||||||
error_title: 頁面沒有找到
|
error_title: 頁面沒有找到
|
||||||
|
loading: 載入中...
|
||||||
|
|
||||||
|
|||||||
@@ -1,87 +1,24 @@
|
|||||||
doctype html
|
|
||||||
html(lang=config.language data-theme=theme.display_mode)
|
|
||||||
head
|
|
||||||
- var pageTitle = _p('error_title')
|
|
||||||
- var tabTitle = pageTitle + ' | ' + config.title
|
|
||||||
- var pageDescription = page.description || page.title || config.description
|
|
||||||
- var pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords
|
|
||||||
- var pageAuthor = config.email ? config.author + ',' + config.email : config.author
|
|
||||||
- var pageCopyright = config.copyright || config.author
|
|
||||||
- var without_html = url.replace('index.html', '')
|
|
||||||
- var top_img = theme.error_404.background || theme.default_top_img
|
- var top_img = theme.error_404.background || theme.default_top_img
|
||||||
- var bg_img = `background-image: url(${top_img})`
|
- var bg_img = `background-image: url(${top_img})`
|
||||||
|
|
||||||
|
doctype html
|
||||||
meta(charset='UTF-8')
|
html(lang=config.language data-theme=theme.display_mode)
|
||||||
meta(http-equiv="X-UA-Compatible" content="IE=edge")
|
head
|
||||||
meta(name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5")
|
include includes/head.pug
|
||||||
title= tabTitle
|
|
||||||
meta(name="description" content=pageDescription)
|
|
||||||
if pageKeywords
|
|
||||||
meta(name="keywords" content=pageKeywords)
|
|
||||||
meta(name="author" content=pageAuthor)
|
|
||||||
meta(name="copyright" content=pageCopyright)
|
|
||||||
meta(name ="format-detection" content="telephone=no")
|
|
||||||
!=favicon_tag(theme.favicon || config.favicon)
|
|
||||||
//- 預解析
|
|
||||||
include includes/head/dns_prefetch.pug
|
|
||||||
//- 網站驗證
|
|
||||||
include includes/head/site_verification.pug
|
|
||||||
//- Open_Graph
|
|
||||||
include includes/head/Open_Graph.pug
|
|
||||||
//- PWA
|
|
||||||
if (theme.pwa && theme.pwa.enable)
|
|
||||||
include includes/head/pwa
|
|
||||||
|
|
||||||
script(src=url_for(theme.CDN.js_cookies))
|
|
||||||
|
|
||||||
if theme.darkmode.enable
|
|
||||||
include includes/head/darkmode.pug
|
|
||||||
|
|
||||||
each item in theme.CDN_USE.css
|
|
||||||
link(rel='stylesheet', href=url_for(item))
|
|
||||||
|
|
||||||
if theme.fontawesome_v5 && theme.fontawesome_v5.enable
|
|
||||||
link(rel='stylesheet', href=url_for(theme.CDN.fontawesome_v5))
|
|
||||||
else
|
|
||||||
link(rel='stylesheet', href=url_for(theme.CDN.fontawesome_v4))
|
|
||||||
|
|
||||||
if (theme.snackbar && theme.snackbar.enable)
|
|
||||||
link(rel='stylesheet', href=url_for(theme.CDN.snackbar_css))
|
|
||||||
|
|
||||||
if theme.canonical
|
|
||||||
link(rel="canonical" href=without_html)
|
|
||||||
|
|
||||||
if theme.algolia_search.enable
|
|
||||||
link(rel="stylesheet" type="text/css" href=url_for(theme.CDN.algolia_search_css))
|
|
||||||
script(src=url_for(theme.CDN.algolia_search) defer)
|
|
||||||
|
|
||||||
//- google_adsense
|
|
||||||
include includes/head/google_adsense.pug
|
|
||||||
|
|
||||||
//- analytics
|
|
||||||
include includes/head/analytics.pug
|
|
||||||
|
|
||||||
if theme.blog_title_font.font_link
|
|
||||||
link(rel='stylesheet', href=url_for(theme.blog_title_font.font_link))
|
|
||||||
|
|
||||||
include includes/head/config.pug
|
|
||||||
include includes/head/config_site.pug
|
|
||||||
|
|
||||||
body
|
body
|
||||||
|
if theme.preloader
|
||||||
|
!=partial('includes/loading/loading', {}, {cache:theme.fragment_cache})
|
||||||
|
|
||||||
if theme.fireworks && theme.fireworks.enable
|
if theme.fireworks && theme.fireworks.enable
|
||||||
canvas.fireworks
|
canvas.fireworks
|
||||||
|
|
||||||
|
include includes/mobile-sidebar/index.pug
|
||||||
|
|
||||||
nav#nav.error-no-found(style=bg_img)
|
nav#nav.error-no-found(style=bg_img)
|
||||||
include includes/header/header.pug
|
include includes/header/header.pug
|
||||||
#error_info.is-center
|
#error_info.is-center
|
||||||
h1#error_title= '404'
|
h1#error_title= '404'
|
||||||
#error_subtitle= theme.error_404.subtitle
|
#error_subtitle= theme.error_404.subtitle
|
||||||
include includes/mobile-sidebar/index.pug
|
|
||||||
include includes/rightside.pug
|
include includes/rightside.pug
|
||||||
each item in theme.CDN_USE.js
|
!=partial('includes/search/index', {}, {cache:theme.fragment_cache})
|
||||||
script(src=url_for(item))
|
|
||||||
include includes/additional-js.pug
|
include includes/additional-js.pug
|
||||||
include includes/search/index.pug
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ extends includes/layout.pug
|
|||||||
|
|
||||||
block content
|
block content
|
||||||
if theme.category_ui == 'index'
|
if theme.category_ui == 'index'
|
||||||
include ./includes/mixins/UI.pug
|
include ./includes/mixins/post-ui.pug
|
||||||
#recent-posts.recent-posts.category_ui
|
#recent-posts.recent-posts.category_ui
|
||||||
+UI_NEW(page.posts)
|
+postUI
|
||||||
include includes/pagination.pug
|
include includes/pagination.pug
|
||||||
else
|
else
|
||||||
include ./includes/mixins/article-sort.pug
|
include ./includes/mixins/article-sort.pug
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#page
|
#page
|
||||||
.flink#article-container
|
.flink#article-container
|
||||||
|
if site.data.link
|
||||||
each i in site.data.link
|
each i in site.data.link
|
||||||
h2= i.class_name
|
h2= i.class_name
|
||||||
.post-cards
|
.post-cards
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
script(src=url_for(theme.CDN.jquery))
|
||||||
|
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))
|
||||||
|
|
||||||
@@ -62,4 +66,9 @@ if theme.mermaid.enable
|
|||||||
include ./math/mermaid.pug
|
include ./math/mermaid.pug
|
||||||
|
|
||||||
if is_home()
|
if is_home()
|
||||||
include index-js.pug
|
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})
|
||||||
@@ -12,6 +12,7 @@ script.
|
|||||||
(d.head || d.body).appendChild(s);
|
(d.head || d.body).appendChild(s);
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
if is_post() && theme.disqus.count
|
||||||
script.
|
script.
|
||||||
function getDisqusCount() {
|
function getDisqusCount() {
|
||||||
var d = document, s = d.createElement('script');
|
var d = document, s = d.createElement('script');
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ script.
|
|||||||
adminLabel: '!{theme.disqusjs.adminLabel}'
|
adminLabel: '!{theme.disqusjs.adminLabel}'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if is_post() && theme.disqusjs.count
|
||||||
script.
|
script.
|
||||||
function getDisqusCount() {
|
function getDisqusCount() {
|
||||||
var d = document, s = d.createElement('script');
|
var d = document, s = d.createElement('script');
|
||||||
|
|||||||
12
layout/includes/comments/facebook_comments.pug
Normal file
12
layout/includes/comments/facebook_comments.pug
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#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)
|
||||||
@@ -8,7 +8,7 @@ script.
|
|||||||
admin: ['!{theme.gitalk.admin}'],
|
admin: ['!{theme.gitalk.admin}'],
|
||||||
id: md5(decodeURI(location.pathname)),
|
id: md5(decodeURI(location.pathname)),
|
||||||
language: '!{theme.gitalk.language}',
|
language: '!{theme.gitalk.language}',
|
||||||
perPage: '!{theme.gitalk.perPage}',
|
perPage: !{theme.gitalk.perPage},
|
||||||
distractionFreeMode: !{theme.gitalk.distractionFreeMode},
|
distractionFreeMode: !{theme.gitalk.distractionFreeMode},
|
||||||
pagerDirection: '!{theme.gitalk.pagerDirection}',
|
pagerDirection: '!{theme.gitalk.pagerDirection}',
|
||||||
createIssueManually: !{theme.gitalk.createIssueManually},
|
createIssueManually: !{theme.gitalk.createIssueManually},
|
||||||
@@ -17,7 +17,11 @@ script.
|
|||||||
gitalk.render('gitalk-container')
|
gitalk.render('gitalk-container')
|
||||||
|
|
||||||
function commentCount(n){
|
function commentCount(n){
|
||||||
|
try {
|
||||||
document.getElementsByClassName('gitalk-comment-count')[0].innerHTML= n
|
document.getElementsByClassName('gitalk-comment-count')[0].innerHTML= n
|
||||||
|
} catch (e) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
- var gt = theme.gitalk && theme.gitalk.enable
|
- var gt = theme.gitalk && theme.gitalk.enable
|
||||||
- var v = theme.valine && theme.valine.enable
|
- var v = theme.valine && theme.valine.enable
|
||||||
- var u = theme.utterances && theme.utterances.enable
|
- var u = theme.utterances && theme.utterances.enable
|
||||||
- var isComment = d || dj || l || gt || v || u
|
- var fb = theme.facebook_comments && theme.facebook_comments.enable
|
||||||
|
- var isComment = d || dj || l || gt || v || u || fb
|
||||||
|
|
||||||
if isComment
|
if isComment
|
||||||
hr
|
hr
|
||||||
@@ -24,3 +25,5 @@ if isComment
|
|||||||
include ./valine.pug
|
include ./valine.pug
|
||||||
else if u
|
else if u
|
||||||
include ./utterances.pug
|
include ./utterances.pug
|
||||||
|
else if fb
|
||||||
|
include ./facebook_comments.pug
|
||||||
@@ -1,9 +1,11 @@
|
|||||||
script#utterances_comment(src=theme.CDN.utterances
|
script#utterances_comment(src=theme.CDN.utterances
|
||||||
repo=theme.utterances.repo
|
repo=theme.utterances.repo
|
||||||
issue-term=theme.utterances.issue_term
|
issue-term=theme.utterances.issue_term
|
||||||
theme=theme.utterances.light_theme
|
theme= theme.display_mode === 'dark' ? theme.utterances.dark_theme : theme.utterances.light_theme
|
||||||
crossorigin="anonymous"
|
crossorigin="anonymous"
|
||||||
async)
|
async)
|
||||||
|
|
||||||
|
if theme.darkmode.enable
|
||||||
script.
|
script.
|
||||||
var themeNow = document.documentElement.getAttribute('data-theme') === 'dark' ? '#{theme.utterances.dark_theme}' : '#{theme.utterances.light_theme}'
|
var themeNow = document.documentElement.getAttribute('data-theme') === 'dark' ? '#{theme.utterances.dark_theme}' : '#{theme.utterances.light_theme}'
|
||||||
document.getElementById('utterances_comment').setAttribute('theme',themeNow)
|
document.getElementById('utterances_comment').setAttribute('theme',themeNow)
|
||||||
|
|||||||
@@ -1,23 +1,37 @@
|
|||||||
|
- let emojiMaps = '""'
|
||||||
|
if site.data.valine
|
||||||
|
- emojiMaps = JSON.stringify(site.data.valine)
|
||||||
|
|
||||||
#vcomment.vcomment
|
#vcomment.vcomment
|
||||||
script(src=url_for(theme.CDN.valine))
|
script(src=url_for(theme.CDN.valine))
|
||||||
script.
|
script.
|
||||||
var GUEST_INFO = ['nick','mail','link'];
|
var requestSetting = function (from,set) {
|
||||||
var guest_info = '#{ theme.valine.guest_info }'.split(',').filter(function(item){
|
var from = from
|
||||||
return GUEST_INFO.indexOf(item) > -1
|
var setting = set.split(',').filter(function(item){
|
||||||
|
return from.indexOf(item) > -1
|
||||||
});
|
});
|
||||||
guest_info = guest_info.length == 0 ? GUEST_INFO :guest_info;
|
setting = setting.length == 0 ? from :setting;
|
||||||
|
return setting
|
||||||
|
}
|
||||||
|
|
||||||
|
var guestInfo = requestSetting(['nick','mail','link'],'#{ theme.valine.guest_info }')
|
||||||
|
var requiredFields = requestSetting(['nick','mail','link'],'#{ theme.valine.requiredFields }')
|
||||||
|
|
||||||
window.valine = new Valine({
|
window.valine = new Valine({
|
||||||
el:'#vcomment',
|
el:'#vcomment',
|
||||||
notify: #{theme.valine.notify},
|
|
||||||
verify: #{theme.valine.verify},
|
|
||||||
appId: '#{theme.valine.appId}',
|
appId: '#{theme.valine.appId}',
|
||||||
appKey: '#{theme.valine.appKey}',
|
appKey: '#{theme.valine.appKey}',
|
||||||
|
notify: #{theme.valine.notify},
|
||||||
|
verify: #{theme.valine.verify},
|
||||||
placeholder: '#{theme.valine.placeholder}',
|
placeholder: '#{theme.valine.placeholder}',
|
||||||
avatar: '#{theme.valine.avatar}',
|
avatar: '#{theme.valine.avatar}',
|
||||||
meta: guest_info,
|
meta: guestInfo,
|
||||||
pageSize: '#{theme.valine.pageSize}',
|
pageSize: '#{theme.valine.pageSize}',
|
||||||
lang: '#{theme.valine.lang}',
|
lang: '#{theme.valine.lang}',
|
||||||
recordIP: #{theme.valine.recordIP},
|
recordIP: #{theme.valine.recordIP},
|
||||||
serverURLs: '#{theme.valine.serverURLs}'
|
serverURLs: '#{theme.valine.serverURLs}',
|
||||||
|
emojiCDN: '#{theme.valine.emojiCDN}',
|
||||||
|
emojiMaps: !{emojiMaps},
|
||||||
|
enableQQ: #{theme.valine.enableQQ},
|
||||||
|
requiredFields: requiredFields
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,25 +1,28 @@
|
|||||||
- var pageTitle = page.title || config.title || ''
|
- var pageTitle
|
||||||
- if (is_archive()) pageTitle = _p('page.archives')
|
- if (is_archive()) pageTitle = _p('page.archives')
|
||||||
- if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag
|
- else if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag
|
||||||
- if (is_category()) pageTitle = _p('page.category') + ': ' + page.category
|
- else if (is_category()) pageTitle = _p('page.category') + ': ' + page.category
|
||||||
- if (is_month()) pageTitle += ': ' + page.month + '/' + page.year
|
- else if (is_month()) pageTitle += ': ' + page.month + '/' + page.year
|
||||||
- if (is_year()) pageTitle += ': ' + page.year
|
- else if (is_year()) pageTitle += ': ' + page.year
|
||||||
|
- else if (is_current('/404.html', [strict])) pageTitle = _p('error_title')
|
||||||
|
- else pageTitle = page.title || config.title || ''
|
||||||
|
|
||||||
- var isSubtitle = config.subtitle ? ' - ' + config.subtitle : ''
|
- var isSubtitle = config.subtitle ? ' - ' + config.subtitle : ''
|
||||||
- var tabTitle = is_home() || !pageTitle ? config.title + isSubtitle : pageTitle + ' | ' + config.title
|
- var tabTitle = is_home() || !pageTitle ? config.title + isSubtitle : pageTitle + ' | ' + config.title
|
||||||
- pageTitle ? '' : pageTitle = config.title || ''
|
|
||||||
|
|
||||||
- var pageDescription = page.description || page.title || config.description
|
- var pageDescription = page_description()
|
||||||
- var pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords
|
- var pageKeywords
|
||||||
- if (page.tags && page.tags.data) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',')
|
- if (page.keywords) pageKeywords = Array.isArray(page.keywords) ? (page.keywords).join(',') : ([]).join(',') || page.keywords
|
||||||
|
- else if (page.tags && page.tags.length) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',')
|
||||||
|
- else pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords
|
||||||
- var pageAuthor = config.email ? config.author + ',' + config.email : config.author
|
- var pageAuthor = config.email ? config.author + ',' + config.email : config.author
|
||||||
- var pageCopyright = config.copyright || config.author
|
- var pageCopyright = config.copyright || config.author
|
||||||
- var without_html = url.replace('index.html', '')
|
|
||||||
|
|
||||||
meta(charset='UTF-8')
|
meta(charset='UTF-8')
|
||||||
meta(http-equiv="X-UA-Compatible" content="IE=edge")
|
meta(http-equiv="X-UA-Compatible" content="IE=edge")
|
||||||
meta(name="viewport" content="width=device-width,initial-scale=1")
|
meta(name="viewport" content="width=device-width,initial-scale=1")
|
||||||
title= tabTitle
|
title= tabTitle
|
||||||
meta(name="description" content=pageDescription)
|
meta(name="description" content!=pageDescription)
|
||||||
if pageKeywords
|
if pageKeywords
|
||||||
meta(name="keywords" content=pageKeywords)
|
meta(name="keywords" content=pageKeywords)
|
||||||
meta(name="author" content=pageAuthor)
|
meta(name="author" content=pageAuthor)
|
||||||
@@ -31,9 +34,7 @@ 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 page.hide == true
|
if theme.douban
|
||||||
meta(name="robots" content="noindex")
|
|
||||||
|
|
||||||
if theme.douban.meta && (is_current('/movies/', [strict]) || is_current('/books/', [strict]) || is_current('/games/', [strict]))
|
if theme.douban.meta && (is_current('/movies/', [strict]) || is_current('/books/', [strict]) || is_current('/games/', [strict]))
|
||||||
meta(name="referrer" content="no-referrer")
|
meta(name="referrer" content="no-referrer")
|
||||||
|
|
||||||
@@ -55,8 +56,8 @@ script(src=url_for(theme.CDN.js_cookies))
|
|||||||
if theme.darkmode.enable
|
if theme.darkmode.enable
|
||||||
!=partial('includes/head/darkmode', {}, {cache:theme.fragment_cache})
|
!=partial('includes/head/darkmode', {}, {cache:theme.fragment_cache})
|
||||||
|
|
||||||
each item in theme.CDN_USE.css
|
//- main css
|
||||||
link(rel='stylesheet', href=url_for(item))
|
link(rel='stylesheet', href=url_for(theme.CDN.main_css))
|
||||||
|
|
||||||
if theme.fontawesome_v5 && theme.fontawesome_v5.enable
|
if theme.fontawesome_v5 && theme.fontawesome_v5.enable
|
||||||
link(rel='stylesheet', href=url_for(theme.CDN.fontawesome_v5))
|
link(rel='stylesheet', href=url_for(theme.CDN.fontawesome_v5))
|
||||||
@@ -70,7 +71,7 @@ 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 theme.canonical
|
if theme.canonical
|
||||||
link(rel="canonical" href=without_html)
|
link(rel="canonical" href=urlNoIndex())
|
||||||
|
|
||||||
if is_post()
|
if is_post()
|
||||||
if(page.prev)
|
if(page.prev)
|
||||||
@@ -96,4 +97,8 @@ if theme.blog_title_font.font_link
|
|||||||
|
|
||||||
//- global config
|
//- global config
|
||||||
!=partial('includes/head/config', {}, {cache:theme.fragment_cache})
|
!=partial('includes/head/config', {}, {cache:theme.fragment_cache})
|
||||||
|
|
||||||
include ./head/config_site.pug
|
include ./head/config_site.pug
|
||||||
|
include ./head/noscript.pug
|
||||||
|
|
||||||
|
!=fragment_cache('injectHead', function(){return injectHtml(theme.inject.head)})
|
||||||
@@ -4,14 +4,16 @@
|
|||||||
if theme.twitter_meta
|
if theme.twitter_meta
|
||||||
meta(name="twitter:card" content="summary")
|
meta(name="twitter:card" content="summary")
|
||||||
meta(name="twitter:title" content=pageTitle)
|
meta(name="twitter:title" content=pageTitle)
|
||||||
meta(name="twitter:description" content=pageDescription)
|
meta(name="twitter:description" content!=pageDescription)
|
||||||
meta(name="twitter:image" content=full_url_for(page.cover || theme.avatar.img))
|
meta(name="twitter:image" content=full_url_for(page.cover || theme.avatar.img))
|
||||||
|
|
||||||
//- Open_Graph
|
//- Open_Graph
|
||||||
if theme.Open_Graph_meta
|
if theme.Open_Graph_meta
|
||||||
meta(property="og:type" content=contentType)
|
meta(property="og:type" content=contentType)
|
||||||
meta(property="og:title" content=pageTitle)
|
meta(property="og:title" content=pageTitle)
|
||||||
meta(property="og:url" content=without_html)
|
meta(property="og:url" content=urlNoIndex())
|
||||||
meta(property="og:site_name" content=config.title)
|
meta(property="og:site_name" content=config.title)
|
||||||
meta(property="og:description" content=pageDescription)
|
meta(property="og:description" content!=pageDescription)
|
||||||
meta(property="og:image" content=full_url_for(page.cover || theme.avatar.img))
|
meta(property="og:image" content=full_url_for(page.cover || theme.avatar.img))
|
||||||
|
meta(property="article:published_time" content=date_xml(page.date))
|
||||||
|
meta(property="article:modified_time" content=date_xml(page.updated))
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
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())
|
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))
|
link(rel="stylesheet" type="text/css" href=url_for(theme.CDN.disqusjs_css))
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
copyright = JSON.stringify({
|
copyright = JSON.stringify({
|
||||||
languages: {
|
languages: {
|
||||||
author: _p("copy_copyright.author") + ': ' + config.author,
|
author: _p("copy_copyright.author") + ': ' + config.author,
|
||||||
link: _p("copy_copyright.link") + ': ' + without_html,
|
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")
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,6 @@
|
|||||||
if (theme.snackbar && theme.snackbar.enable) {
|
if (theme.snackbar && theme.snackbar.enable) {
|
||||||
Snackbar = JSON.stringify({
|
Snackbar = JSON.stringify({
|
||||||
bookmark: {
|
bookmark: {
|
||||||
title: _p("Snackbar.bookmark.title"),
|
|
||||||
message_prev: _p("Snackbar.bookmark.message_prev"),
|
message_prev: _p("Snackbar.bookmark.message_prev"),
|
||||||
message_next: _p("Snackbar.bookmark.message_next")
|
message_next: _p("Snackbar.bookmark.message_next")
|
||||||
},
|
},
|
||||||
@@ -76,16 +75,6 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var highlightCopy = theme.highlight_copy
|
|
||||||
var highlightLang = theme.highlight_lang
|
|
||||||
var highlightShrink = theme.highlight_shrink
|
|
||||||
var runtime = theme.runtimeshow.enable
|
|
||||||
var fancybox = theme.fancybox.enable
|
|
||||||
var medium_zoom = theme.medium_zoom.enable
|
|
||||||
var baiduPush = theme.baidu_push && theme.baidu_push.enable
|
|
||||||
var isFontAwesomeV5 = theme.fontawesome_v5 && theme.fontawesome_v5.enable
|
|
||||||
|
|
||||||
|
|
||||||
script.
|
script.
|
||||||
var GLOBAL_CONFIG = {
|
var GLOBAL_CONFIG = {
|
||||||
root: '!{config.root}',
|
root: '!{config.root}',
|
||||||
@@ -98,22 +87,22 @@ script.
|
|||||||
noSupport: '!{_p("copy.noSupport")}'
|
noSupport: '!{_p("copy.noSupport")}'
|
||||||
},
|
},
|
||||||
bookmark: {
|
bookmark: {
|
||||||
title: '!{_p("Snackbar.bookmark.title")}',
|
|
||||||
message_prev: '!{_p("Snackbar.bookmark.message_prev")}',
|
message_prev: '!{_p("Snackbar.bookmark.message_prev")}',
|
||||||
message_next: '!{_p("Snackbar.bookmark.message_next")}'
|
message_next: '!{_p("Snackbar.bookmark.message_next")}'
|
||||||
},
|
},
|
||||||
runtime_unit: '!{_p("runtime_unit")}',
|
runtime_unit: '!{_p("runtime_unit")}',
|
||||||
runtime: !{runtime},
|
runtime: !{theme.runtimeshow.enable},
|
||||||
copyright: !{copyright},
|
copyright: !{copyright},
|
||||||
ClickShowText: !{ClickShowText},
|
ClickShowText: !{ClickShowText},
|
||||||
medium_zoom: !{medium_zoom},
|
medium_zoom: !{theme.medium_zoom.enable},
|
||||||
fancybox: !{fancybox},
|
fancybox: !{theme.fancybox.enable},
|
||||||
Snackbar: !{Snackbar},
|
Snackbar: !{Snackbar},
|
||||||
baiduPush: !{baiduPush},
|
baiduPush: !{theme.baidu_push && theme.baidu_push.enable},
|
||||||
highlightCopy: !{highlightCopy},
|
highlightCopy: !{theme.highlight_copy},
|
||||||
highlightLang: !{highlightLang},
|
highlightLang: !{theme.highlight_lang},
|
||||||
highlightShrink: !{highlightShrink},
|
highlightShrink: '!{theme.highlight_shrink}',
|
||||||
isFontAwesomeV5: !{isFontAwesomeV5}
|
isFontAwesomeV5: !{theme.fontawesome_v5 && theme.fontawesome_v5.enable},
|
||||||
|
isPhotoFigcaption: !{theme.photofigcaption}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
script.
|
script.
|
||||||
var GLOBAL_CONFIG_SITE = {
|
var GLOBAL_CONFIG_SITE = {
|
||||||
isPost: !{is_post()},
|
isPost: !{is_post()},
|
||||||
isHome: !{is_home()}
|
isHome: !{is_home()},
|
||||||
|
isSidebar: !{is_post() && page.toc !== false && theme.toc.enable && (toc(page.content) !== '' || page.encrypt == true )}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
script.
|
script.
|
||||||
const autoChangeMode = '#{theme.darkmode.autoChangeMode}'
|
var autoChangeMode = '#{theme.darkmode.autoChangeMode}'
|
||||||
var t = Cookies.get("theme")
|
var t = Cookies.get("theme")
|
||||||
if (autoChangeMode == '1'){
|
if (autoChangeMode == '1'){
|
||||||
const isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches
|
var isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches
|
||||||
const isLightMode = window.matchMedia("(prefers-color-scheme: light)").matches
|
var isLightMode = window.matchMedia("(prefers-color-scheme: light)").matches
|
||||||
const isNotSpecified = window.matchMedia("(prefers-color-scheme: no-preference)").matches
|
var isNotSpecified = window.matchMedia("(prefers-color-scheme: no-preference)").matches
|
||||||
const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
|
var hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
|
||||||
|
|
||||||
if (t === undefined){
|
if (t === undefined){
|
||||||
if (isLightMode) activateLightMode()
|
if (isLightMode) activateLightMode()
|
||||||
else if (isDarkMode) activateDarkMode()
|
else if (isDarkMode) activateDarkMode()
|
||||||
else if (isNotSpecified || hasNoSupport){
|
else if (isNotSpecified || hasNoSupport){
|
||||||
console.log('You specified no preference for a color scheme or your browser does not support it. I Schedule dark mode during night time.')
|
console.log('You specified no preference for a color scheme or your browser does not support it. I Schedule dark mode during night time.')
|
||||||
now = new Date();
|
var now = new Date()
|
||||||
hour = now.getHours();
|
var hour = now.getHours()
|
||||||
isNight = hour < 6 || hour >= 18
|
var isNight = hour < 6 || hour >= 18
|
||||||
isNight ? activateDarkMode() : activateLightMode()
|
isNight ? activateDarkMode() : activateLightMode()
|
||||||
}
|
}
|
||||||
} else if (t == 'light') activateLightMode()
|
} else if (t == 'light') activateLightMode()
|
||||||
|
|||||||
@@ -1,16 +1,22 @@
|
|||||||
link(rel="preconnect" href="//cdn.jsdelivr.net")
|
link(rel="preconnect" href="//cdn.jsdelivr.net")
|
||||||
|
link(rel="dns-prefetch" href="//cdn.jsdelivr.net")
|
||||||
|
|
||||||
if theme.google_analytics
|
if theme.google_analytics
|
||||||
link(rel="preconnect" href="https://www.google-analytics.com" crossorigin)
|
link(rel="preconnect" href="https://www.google-analytics.com" crossorigin)
|
||||||
|
link(rel="dns-prefetch" href="https://www.google-analytics.com")
|
||||||
|
|
||||||
if theme.baidu_analytics
|
if theme.baidu_analytics
|
||||||
link(rel="preconnect" href="https://hm.baidu.com")
|
link(rel="preconnect" href="https://hm.baidu.com")
|
||||||
|
link(rel="dns-prefetch" href="https://hm.baidu.com")
|
||||||
|
|
||||||
if theme.tencent_analytics
|
if theme.tencent_analytics
|
||||||
link(rel="preconnect" href="http://ta.qq.com")
|
link(rel="preconnect" href="http://ta.qq.com")
|
||||||
|
link(rel="dns-prefetch" href="http://ta.qq.com")
|
||||||
|
|
||||||
if theme.blog_title_font.font_link
|
if theme.blog_title_font.font_link
|
||||||
link(rel="preconnect" href="https://fonts.googleapis.com" crossorigin)
|
link(rel="preconnect" href="https://fonts.googleapis.com" crossorigin)
|
||||||
|
link(rel="dns-prefetch" href="https://fonts.googleapis.com")
|
||||||
|
|
||||||
if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv
|
if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv
|
||||||
link(rel="preconnect" href="//busuanzi.ibruce.info")
|
link(rel="preconnect" href="//busuanzi.ibruce.info")
|
||||||
|
link(rel="dns-prefetch" href="//busuanzi.ibruce.info")
|
||||||
|
|||||||
9
layout/includes/head/noscript.pug
Normal file
9
layout/includes/head/noscript.pug
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
noscript.
|
||||||
|
<style>
|
||||||
|
#page-header {
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
.justified-gallery img{
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
</style>
|
||||||
130
layout/includes/head/subtitle.pug
Normal file
130
layout/includes/head/subtitle.pug
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
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]}'
|
||||||
|
}
|
||||||
@@ -1,15 +1,17 @@
|
|||||||
#page-header
|
#page-header
|
||||||
span#blog_name.pull_left
|
span#blog_name.pull_left
|
||||||
a#site-name.blog_title(href=url_for('/')) #[=config.title]
|
a#site-name.blog_title(href=url_for('/')) #[=config.title]
|
||||||
span.toggle-menu.pull_right.close
|
|
||||||
a.site-page
|
|
||||||
i.fa.fa-bars.fa-fw(aria-hidden="true")
|
|
||||||
span.pull_right.menus
|
|
||||||
.menus_items
|
|
||||||
include ./menu_item.pug
|
|
||||||
|
|
||||||
|
span.pull_right.menus
|
||||||
if (theme.algolia_search.enable || theme.local_search && theme.local_search.enable)
|
if (theme.algolia_search.enable || theme.local_search && theme.local_search.enable)
|
||||||
span#search_button.pull_right
|
#search_button
|
||||||
a.site-page.social-icon.search
|
a.site-page.social-icon.search
|
||||||
i.fa.fa-search.fa-fw
|
i.fa.fa-search.fa-fw
|
||||||
span=' '+_p('search')
|
span=' '+_p('search')
|
||||||
|
!=fragment_cache('menus', function(){return partial('includes/header/menu_item')})
|
||||||
|
|
||||||
|
span.toggle-menu.close
|
||||||
|
a.site-page
|
||||||
|
i.fa.fa-bars.fa-fw(aria-hidden="true")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,9 +33,7 @@ if theme.douban
|
|||||||
span#subtitle
|
span#subtitle
|
||||||
if(theme.social)
|
if(theme.social)
|
||||||
#site_social_icons
|
#site_social_icons
|
||||||
each url, icon in theme.social
|
!=fragment_cache('social', function(){return partial('includes/header/social')})
|
||||||
a.social-icon(href=url target="_blank")
|
|
||||||
i(class=icon aria-hidden="true")
|
|
||||||
#scroll_down
|
#scroll_down
|
||||||
i.fa.fa-angle-down.scroll-down-effects
|
i.fa.fa-angle-down.scroll-down-effects
|
||||||
else if is_post()
|
else if is_post()
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
.menus_items
|
||||||
each value, label in theme.menu
|
each value, label in theme.menu
|
||||||
if !Array.isArray(value)
|
if !Array.isArray(value)
|
||||||
.menus_item
|
.menus_item
|
||||||
|
|||||||
@@ -1,65 +1,91 @@
|
|||||||
#post-info
|
#post-info
|
||||||
#post-title
|
#post-title
|
||||||
.posttitle= page.title || _p('no_title')
|
.posttitle= page.title || _p('no_title')
|
||||||
|
|
||||||
#post-meta
|
#post-meta
|
||||||
|
.meta-firstline
|
||||||
if (theme.post_meta.post.date_type)
|
if (theme.post_meta.post.date_type)
|
||||||
if (theme.post_meta.post.date_type === 'both')
|
if (theme.post_meta.post.date_type === 'both')
|
||||||
time.post-meta__date
|
time.post-meta__date
|
||||||
i.fa.fa-calendar.fa-fw(aria-hidden="true")
|
span.post-meta__date-created(title= _p('post.created')+' '+full_date(page.date))
|
||||||
|
i.fa.fa-calendar(aria-hidden="true")
|
||||||
=' '+_p('post.created')+' '+date(page.date, config.date_format)
|
=' '+_p('post.created')+' '+date(page.date, config.date_format)
|
||||||
span.post-meta__separator |
|
span.post-meta__separator |
|
||||||
i.fa.fa-history.fa-fw(aria-hidden="true")
|
span.post-meta__date-updated(title= _p('post.updated')+' '+full_date(page.updated))
|
||||||
|
i.fa.fa-history(aria-hidden="true")
|
||||||
=' '+_p('post.updated')+' '+date(page.updated, config.date_format)
|
=' '+_p('post.updated')+' '+date(page.updated, config.date_format)
|
||||||
else
|
else
|
||||||
- var date_type = theme.post_meta.post.date_type === 'updated' ? 'updated' : 'date'
|
- var data_type_update = theme.post_meta.post.date_type === 'updated'
|
||||||
time.post-meta__date #[i.fa.fa-calendar.fa-fw(aria-hidden="true")] #[=date(page[date_type], config.date_format)]
|
- var date_type = data_type_update ? 'updated' : 'date'
|
||||||
|
- var date_icon = data_type_update ? 'fa-history' :'fa-calendar'
|
||||||
|
- var 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(class=date_icon aria-hidden="true")
|
||||||
|
=' ' + data_info + ' ' + 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
|
||||||
if (theme.post_meta.post.date_type)
|
if (theme.post_meta.post.date_type)
|
||||||
span.post-meta__separator |
|
span.post-meta__separator |
|
||||||
span
|
|
||||||
each item, index in page.categories.data
|
each item, index in page.categories.data
|
||||||
i.fa.fa-inbox.post-meta__icon.fa-fw(aria-hidden="true")
|
i.fa.fa-inbox.post-meta__icon(aria-hidden="true")
|
||||||
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.fa.fa-angle-right.fa-fw(aria-hidden="true")
|
i.fa.fa-angle-right.post-meta__separator(aria-hidden="true")
|
||||||
.post-meta-wordcount
|
|
||||||
if (theme.wordcount && theme.wordcount.enable)
|
.meta-secondline
|
||||||
|
- let postWordcount = theme.wordcount.enable && (theme.wordcount.post_wordcount || theme.wordcount.min2read)
|
||||||
|
if (postWordcount)
|
||||||
|
span.post-meta-wordcount
|
||||||
|
if theme.wordcount.post_wordcount
|
||||||
- var wordCountIcon = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-file-word' : 'fa fa-file-word-o'
|
- var wordCountIcon = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-file-word' : 'fa fa-file-word-o'
|
||||||
i.post-meta__icon.fa-fw(class=wordCountIcon aria-hidden="true")
|
i.post-meta__icon(class=wordCountIcon aria-hidden="true")
|
||||||
span= _p('post.wordcount') + ':'
|
span= _p('post.wordcount') + ':'
|
||||||
span.word-count= wordcount(page.content)
|
span.word-count= wordcount(page.content)
|
||||||
|
if theme.wordcount.min2read
|
||||||
span.post-meta__separator |
|
span.post-meta__separator |
|
||||||
|
if theme.wordcount.min2read
|
||||||
- var readCountIcon = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-clock' : 'fa fa-clock-o'
|
- var readCountIcon = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-clock' : 'fa fa-clock-o'
|
||||||
i.post-meta__icon.fa-fw(class=readCountIcon aria-hidden="true")
|
i.post-meta__icon(class=readCountIcon aria-hidden="true")
|
||||||
span= _p('post.min2read', min2read(page.content, {cn: 350, en: 160}))
|
span= _p('post.min2read', min2read(page.content, {cn: 350, en: 160}))
|
||||||
.post-meta-pv-cv
|
|
||||||
if (theme.wordcount && theme.wordcount.enable && theme.busuanzi.page_pv)
|
.meta-thirdline
|
||||||
|
span.post-meta-pv-cv
|
||||||
|
if (postWordcount && theme.busuanzi.page_pv)
|
||||||
span.post-meta__separator |
|
span.post-meta__separator |
|
||||||
if theme.busuanzi.page_pv
|
if theme.busuanzi.page_pv
|
||||||
i.fa.fa-eye.post-meta__icon.fa-fw(aria-hidden="true")
|
i.fa.fa-eye.post-meta__icon(aria-hidden="true")
|
||||||
span=_p('post.page_pv') + ':'
|
span=_p('post.page_pv') + ':'
|
||||||
span#busuanzi_value_page_pv
|
span#busuanzi_value_page_pv
|
||||||
|
|
||||||
|
span.post-meta-commentcount
|
||||||
- var commentCount = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-comments' : 'fa fa-comment-o'
|
- var commentCount = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-comments' : 'fa fa-comment-o'
|
||||||
if ((theme.disqus && theme.disqus.enable && theme.disqus.count && page.comments !== false) || (theme.disqusjs && theme.disqusjs.enable && theme.disqusjs.count && page.comments !== false))
|
if ((theme.disqus && theme.disqus.enable && theme.disqus.count && page.comments !== false) || (theme.disqusjs && theme.disqusjs.enable && theme.disqusjs.count && page.comments !== false))
|
||||||
if (theme.busuanzi && theme.busuanzi.page_pv)
|
if (postWordcount || theme.busuanzi.page_pv)
|
||||||
span.post-meta__separator |
|
span.post-meta__separator |
|
||||||
i.post-meta__icon.fa-fw(class=commentCount aria-hidden="true")
|
i.post-meta__icon(class=commentCount aria-hidden="true")
|
||||||
span= _p('post.comments') + ':'
|
span= _p('post.comments') + ':'
|
||||||
span.disqus-comment-count.comment-count
|
span.disqus-comment-count.comment-count
|
||||||
a(href=full_url_for(page.path) + '#disqus_thread')
|
a(href=full_url_for(page.path) + '#disqus_thread')
|
||||||
if (theme.valine && theme.valine.enable && theme.valine.count && page.comments !== false)
|
else if (theme.valine && theme.valine.enable && theme.valine.count && page.comments !== false)
|
||||||
if (theme.busuanzi && theme.busuanzi.page_pv)
|
if (postWordcount || theme.busuanzi.page_pv)
|
||||||
span.post-meta__separator |
|
span.post-meta__separator |
|
||||||
i.post-meta__icon.fa-fw(class=commentCount aria-hidden="true")
|
i.post-meta__icon(class=commentCount aria-hidden="true")
|
||||||
span= _p('post.comments') + ':'
|
span= _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")
|
||||||
if (theme.gitalk && theme.gitalk.enable && theme.gitalk.count && page.comments !== false)
|
else if (theme.gitalk && theme.gitalk.enable && theme.gitalk.count && page.comments !== false)
|
||||||
if (theme.busuanzi && theme.busuanzi.page_pv)
|
if (postWordcount || theme.busuanzi.page_pv)
|
||||||
span.post-meta__separator |
|
span.post-meta__separator |
|
||||||
i.post-meta__icon.fa-fw(class=commentCount aria-hidden="true")
|
i.post-meta__icon(class=commentCount aria-hidden="true")
|
||||||
span= _p('post.comments') + ':'
|
span= _p('post.comments') + ':'
|
||||||
a(href=url_for(page.path) + '#post-comment')
|
a(href=url_for(page.path) + '#post-comment')
|
||||||
span.gitalk-comment-count.comment-count
|
span.gitalk-comment-count.comment-count
|
||||||
|
else if theme.facebook_comments.enable && theme.facebook_comments.count && page.comments !== false
|
||||||
|
if (postWordcount || theme.busuanzi.page_pv)
|
||||||
|
span.post-meta__separator |
|
||||||
|
i.post-meta__icon(class=commentCount aria-hidden="true")
|
||||||
|
span= _p('post.comments') + ':'
|
||||||
|
a.comment-count(href=url_for(page.path) + '#post-comment')
|
||||||
|
span.fb-comments-count(data-href=urlNoIndex())
|
||||||
4
layout/includes/header/social.pug
Normal file
4
layout/includes/header/social.pug
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
each url, icon in theme.social
|
||||||
|
a.social-icon(href=trim(url.split('||')[0]) target="_blank"
|
||||||
|
title=url.split('||')[1] === undefined ? '' : trim(url.split('||')[1]))
|
||||||
|
i(class=icon aria-hidden="true")
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
if theme.subtitle.enable
|
|
||||||
- let source = theme.subtitle.source
|
|
||||||
- let subtitleEffect = theme.subtitle.effect
|
|
||||||
|
|
||||||
if subtitleEffect
|
|
||||||
script(src=url_for(theme.CDN.typed))
|
|
||||||
|
|
||||||
if source == '1'
|
|
||||||
script.
|
|
||||||
let subtitleEffect = !{subtitleEffect}
|
|
||||||
fetch('https://api.ooopn.com/ciba/api.php',)
|
|
||||||
.then(function (res){
|
|
||||||
return res.json();
|
|
||||||
})
|
|
||||||
.then(function (data) {
|
|
||||||
if (subtitleEffect){
|
|
||||||
let sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
|
|
||||||
let both = sub.unshift(data['ciba-en'],data.ciba)
|
|
||||||
let typed = new Typed("#subtitle", {
|
|
||||||
strings: sub,
|
|
||||||
startDelay: 300,
|
|
||||||
typeSpeed: 150,
|
|
||||||
loop: !{theme.subtitle.loop},
|
|
||||||
backSpeed: 50
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
document.getElementById("subtitle").innerHTML = data['ciba-en']
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(function (err) {
|
|
||||||
console.error(err);
|
|
||||||
})
|
|
||||||
|
|
||||||
else if source == '2'
|
|
||||||
script.
|
|
||||||
let subtitleEffect = !{subtitleEffect}
|
|
||||||
fetch('https://v1.hitokoto.cn')
|
|
||||||
.then(function (res){
|
|
||||||
return res.json();
|
|
||||||
})
|
|
||||||
.then(function (data) {
|
|
||||||
if (subtitleEffect){
|
|
||||||
let from = '出自 ' + data.from
|
|
||||||
let sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
|
|
||||||
let both = sub.unshift(data.hitokoto,from)
|
|
||||||
let 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);
|
|
||||||
})
|
|
||||||
|
|
||||||
else if source == "3"
|
|
||||||
script(type="text/javascript" src="http://yijuzhan.com/api/word.php?m=js")
|
|
||||||
script.
|
|
||||||
let subtitleEffect = !{subtitleEffect}
|
|
||||||
let con = str[0];
|
|
||||||
if (subtitleEffect){
|
|
||||||
let from = "出自 " + str[1];
|
|
||||||
let sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
|
|
||||||
let both = sub.unshift(con,from)
|
|
||||||
let typed = new Typed("#subtitle", {
|
|
||||||
strings: sub,
|
|
||||||
startDelay: 300,
|
|
||||||
typeSpeed: 150,
|
|
||||||
loop: !{theme.subtitle.loop},
|
|
||||||
backSpeed: 50
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
document.getElementById("subtitle").innerHTML = con
|
|
||||||
}
|
|
||||||
|
|
||||||
else if source == '4'
|
|
||||||
script(type="text/javascript" src="https://sdk.jinrishici.com/v2/browser/jinrishici.js" charset="utf-8")
|
|
||||||
script.
|
|
||||||
let subtitleEffect = !{subtitleEffect}
|
|
||||||
jinrishici.load(function(result) {
|
|
||||||
if (subtitleEffect){
|
|
||||||
let sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
|
|
||||||
let content = result.data.content;
|
|
||||||
let both = sub.unshift(content)
|
|
||||||
let typed = new Typed("#subtitle", {
|
|
||||||
strings: sub,
|
|
||||||
startDelay: 300,
|
|
||||||
typeSpeed: 150,
|
|
||||||
loop: !{theme.subtitle.loop},
|
|
||||||
backSpeed: 50
|
|
||||||
});
|
|
||||||
}else{
|
|
||||||
document.getElementById("subtitle").innerHTML = result.data.content
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
else
|
|
||||||
- var subtitle = theme.subtitle.sub[0]
|
|
||||||
script.
|
|
||||||
let subtitleEffect = !{subtitleEffect}
|
|
||||||
if (subtitleEffect){
|
|
||||||
let typed = new Typed("#subtitle", {
|
|
||||||
strings: '!{theme.subtitle.sub}'.split(","),
|
|
||||||
startDelay: 300,
|
|
||||||
typeSpeed: 150,
|
|
||||||
loop: !{theme.subtitle.loop},
|
|
||||||
backSpeed: 50
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
document.getElementById("subtitle").innerHTML = '!{subtitle}'
|
|
||||||
}
|
|
||||||
@@ -1,17 +1,20 @@
|
|||||||
- var hideAside = !theme.aside.enable || page.aside === false ? 'hide-aside' : ''
|
- var hideAside = !theme.aside.enable || page.aside === false ? 'hide-aside' : ''
|
||||||
- var autoOpenSidebar = theme.auto_open_sidebar.enable === true ? 'on' : ''
|
|
||||||
|
|
||||||
doctype html
|
doctype html
|
||||||
html(lang=config.language data-theme=theme.display_mode)
|
html(lang=config.language data-theme=theme.display_mode)
|
||||||
head
|
head
|
||||||
include ./head.pug
|
include ./head.pug
|
||||||
body
|
body
|
||||||
|
if theme.preloader
|
||||||
|
!=partial('includes/loading/loading', {}, {cache:theme.fragment_cache})
|
||||||
|
|
||||||
if theme.fireworks && theme.fireworks.enable
|
if theme.fireworks && theme.fireworks.enable
|
||||||
canvas.fireworks
|
canvas.fireworks
|
||||||
|
|
||||||
!=partial('includes/mobile-sidebar/index', {}, {cache:theme.fragment_cache})
|
!=partial('includes/mobile-sidebar/index', {}, {cache:theme.fragment_cache})
|
||||||
if (is_post() && page.toc != false && theme.toc.enable)
|
|
||||||
i.fa.fa-arrow-right#toggle-sidebar(aria-hidden="true" class=autoOpenSidebar)
|
|
||||||
include ./sidebar.pug
|
include ./sidebar.pug
|
||||||
|
|
||||||
#body-wrap
|
#body-wrap
|
||||||
if theme.background
|
if theme.background
|
||||||
- var is_photo = theme.background.substring(3,0) === 'url' ? 'photo':'color'
|
- var is_photo = theme.background.substring(3,0) === 'url' ? 'photo':'color'
|
||||||
@@ -36,11 +39,7 @@ html(lang=config.language data-theme=theme.display_mode)
|
|||||||
- var is_bg = theme.footer_bg == false ? 'color' : 'photo'
|
- var is_bg = theme.footer_bg == false ? 'color' : 'photo'
|
||||||
footer#footer(style=footer_bg data-type=is_bg)
|
footer#footer(style=footer_bg data-type=is_bg)
|
||||||
!=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/search/index', {}, {cache:theme.fragment_cache})
|
||||||
each item in theme.CDN_USE.js
|
|
||||||
script(src=url_for(item))
|
|
||||||
include ./additional-js.pug
|
include ./additional-js.pug
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
6
layout/includes/loading/loading-js.pug
Normal file
6
layout/includes/loading/loading-js.pug
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
script.
|
||||||
|
var endLoading = function () {
|
||||||
|
document.body.style.overflow = 'auto';
|
||||||
|
document.getElementById('loading-box').classList.add("loaded")
|
||||||
|
}
|
||||||
|
window.addEventListener('load',endLoading)
|
||||||
9
layout/includes/loading/loading.pug
Normal file
9
layout/includes/loading/loading.pug
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#loading-box
|
||||||
|
.loading-left-bg
|
||||||
|
.loading-right-bg
|
||||||
|
.spinner-box
|
||||||
|
.configure-border-1
|
||||||
|
.configure-core
|
||||||
|
.configure-border-2
|
||||||
|
.configure-core
|
||||||
|
.loading-word= _p('loading')
|
||||||
@@ -11,10 +11,10 @@ mixin articleSort(posts)
|
|||||||
if article.cover && theme.cover.archives_enable
|
if article.cover && theme.cover.archives_enable
|
||||||
.article-sort-img
|
.article-sort-img
|
||||||
a.article-sort-item__img(href=url_for(article.path))
|
a.article-sort-item__img(href=url_for(article.path))
|
||||||
img(src=article.cover alt=article.title || 'No Title' onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'`)
|
img(src=`${article.cover}` alt=article.title || 'No Title' onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'`)
|
||||||
.article-sort-post
|
.article-sort-post
|
||||||
a.article-sort-item__post(href=url_for(article.path))
|
a.article-sort-item__post(href=url_for(article.path))
|
||||||
i.fa.fa-clock-o(aria-hidden="true")
|
i.fa.fa-clock-o(aria-hidden="true")
|
||||||
time.article-sort-item__time= date(article.date)
|
time.article-sort-item__time(title=_p('post.created') + ' ' + full_date(article.date))= date(article.date, config.date_format)
|
||||||
.article-sort-item__title= article.title || 'No Title'
|
.article-sort-item__title= article.title || 'No Title'
|
||||||
- })
|
- })
|
||||||
@@ -1,32 +1,44 @@
|
|||||||
mixin UI_NEW(posts)
|
mixin postUI(posts)
|
||||||
- posts.each(function(article,index){
|
each article , index in page.posts.data
|
||||||
.recent-post-item
|
.recent-post-item
|
||||||
- var link = article.link || article.path
|
- var link = article.link || article.path
|
||||||
- var post_cover = article.cover
|
|
||||||
- var title = article.title || _p('no_title')
|
- var title = article.title || _p('no_title')
|
||||||
- var leftOrRight = index%2 == 0 ? 'left_radius' : 'right_radius'
|
- var leftOrRight = index%2 == 0 ? 'left_radius' : 'right_radius'
|
||||||
|
- var post_cover = article.cover
|
||||||
- var no_cover = article.cover === false || !theme.cover.index_enable ? 'no-cover' : ''
|
- var 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.lazyload(data-src=`${post_cover}` alt=title onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'`)
|
img.post_bg.lazyload(data-src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` alt=title)
|
||||||
else
|
else
|
||||||
img.post_bg(src=`${post_cover}` alt=title onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'`)
|
img.post_bg(src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` alt=title)
|
||||||
.recent-post-info(class=no_cover)
|
.recent-post-info(class=no_cover)
|
||||||
a.article-title(href=url_for(link) title=title)= title
|
a.article-title(href=url_for(link) title=title)= title
|
||||||
.article-meta-wrap
|
.article-meta-wrap
|
||||||
|
if (is_home() && (article.top || article.sticky > 0))
|
||||||
|
span.article-meta
|
||||||
|
i.fa.fa-thumb-tack.article-meta__icon.sticky
|
||||||
|
span.sticky= _p('sticky')
|
||||||
|
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')
|
if (theme.post_meta.page.date_type === 'both')
|
||||||
time.post-meta__date
|
time.post-meta__date
|
||||||
i.fa.fa-calendar.fa-fw(aria-hidden="true")
|
span.post-meta__date-created(title=_p('post.created') + ' ' + full_date(article.date))
|
||||||
=date(page.date, config.date_format)
|
i.fa.fa-calendar(aria-hidden="true")
|
||||||
|
=date(article.date, config.date_format)
|
||||||
span.article-meta__separator |
|
span.article-meta__separator |
|
||||||
i.fa.fa-history.fa-fw(aria-hidden="true")
|
span.post-meta__date-updated(title=_p('post.updated') + ' ' + full_date(article.updated))
|
||||||
=date(page.updated, config.date_format)
|
i.fa.fa-history(aria-hidden="true")
|
||||||
|
=date(article.updated, config.date_format)
|
||||||
else
|
else
|
||||||
- var date_type = theme.post_meta.post.date_type === 'updated' ? 'updated' : 'date'
|
- var data_type_updated = theme.post_meta.page.date_type === 'updated'
|
||||||
time.post-meta__date #[i.fa.fa-calendar.fa-fw(aria-hidden="true")]#[=date(page[date_type], config.date_format)]
|
- var date_type = data_type_updated ? 'updated' : 'date'
|
||||||
|
- var date_icon = data_type_updated ? 'fa-history' :'fa-calendar'
|
||||||
|
- var date_title = data_type_updated ? _p('post.updated') : _p('post.created')
|
||||||
|
time.post-meta__date(title=date_title + ' ' + full_date(article[date_type]))
|
||||||
|
i.fa(class=date_icon aria-hidden="true")
|
||||||
|
=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 |
|
||||||
@@ -50,4 +62,7 @@ mixin UI_NEW(posts)
|
|||||||
.content!= expert
|
.content!= expert
|
||||||
else
|
else
|
||||||
.content!= article.description
|
.content!= article.description
|
||||||
- })
|
|
||||||
|
if theme.ad && theme.ad.index
|
||||||
|
if (index + 1) % 3 == 0
|
||||||
|
.recent-post-item.ad_height!=theme.ad.index
|
||||||
@@ -23,5 +23,4 @@
|
|||||||
.headline= _p('aside.categories')
|
.headline= _p('aside.categories')
|
||||||
.length_num= site.categories.length
|
.length_num= site.categories.length
|
||||||
hr
|
hr
|
||||||
.menus_items
|
!=fragment_cache('menus', function(){return partial('includes/header/menu_item')})
|
||||||
include ../header/menu_item.pug
|
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
each article , index in page.posts.data
|
|
||||||
.recent-post-item
|
|
||||||
- var link = article.link || article.path
|
|
||||||
- var title = article.title || _p('no_title')
|
|
||||||
- var leftOrRight = index%2 == 0 ? 'left_radius' : 'right_radius'
|
|
||||||
- var post_cover = article.cover
|
|
||||||
- var no_cover = article.cover === false || !theme.cover.index_enable ? 'no-cover' : ''
|
|
||||||
if post_cover && theme.cover.index_enable
|
|
||||||
.post_cover(class=leftOrRight)
|
|
||||||
a(href=url_for(link) title=title)
|
|
||||||
if theme.lazyload.enable
|
|
||||||
img.post_bg.lazyload(data-src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` alt=title)
|
|
||||||
else
|
|
||||||
img.post_bg(src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` alt=title)
|
|
||||||
.recent-post-info(class=no_cover)
|
|
||||||
a.article-title(href=url_for(link) title=title)= title
|
|
||||||
.article-meta-wrap
|
|
||||||
if (article.top)
|
|
||||||
span.article-meta
|
|
||||||
i.fa.fa-thumb-tack.article-meta__icon.sticky
|
|
||||||
span.sticky= _p('sticky')
|
|
||||||
span.article-meta__separator |
|
|
||||||
if (theme.post_meta.page.date_type)
|
|
||||||
if (theme.post_meta.page.date_type === 'both')
|
|
||||||
time.post-meta__date
|
|
||||||
i.fa.fa-calendar.fa-fw(aria-hidden="true")
|
|
||||||
=date(page.date, config.date_format)
|
|
||||||
span.article-meta__separator |
|
|
||||||
i.fa.fa-history.fa-fw(aria-hidden="true")
|
|
||||||
=date(page.updated, config.date_format)
|
|
||||||
else
|
|
||||||
- var date_type = theme.post_meta.post.date_type === 'updated' ? 'updated' : 'date'
|
|
||||||
time.post-meta__date #[i.fa.fa-calendar.fa-fw(aria-hidden="true")]#[=date(page[date_type], config.date_format)]
|
|
||||||
if (theme.post_meta.page.categories && article.categories.data.length > 0)
|
|
||||||
span.article-meta
|
|
||||||
span.article-meta__separator |
|
|
||||||
each item, index in article.categories.data
|
|
||||||
i.fa.fa-inbox.article-meta__icon(aria-hidden="true")
|
|
||||||
a(href=url_for(item.path)).article-meta__categories #[=item.name]
|
|
||||||
if (index < article.categories.data.length - 1)
|
|
||||||
i.fa.fa-angle-right(aria-hidden="true")
|
|
||||||
if (theme.post_meta.page.tags && article.tags.data.length > 0)
|
|
||||||
span.article-meta.tags
|
|
||||||
span.article-meta__separator |
|
|
||||||
each item, index in article.tags.data
|
|
||||||
i.fa.fa-tag.article-meta__icon(aria-hidden="true")
|
|
||||||
a(href=url_for(item.path)).article-meta__tags #[=item.name]
|
|
||||||
if (index < article.tags.data.length - 1)
|
|
||||||
span.article-meta__link -
|
|
||||||
if theme.auto_excerpt && theme.auto_excerpt.enable
|
|
||||||
- const content = strip_html(article.content)
|
|
||||||
- let expert = content.substring(0, theme.auto_excerpt.length)
|
|
||||||
- content.length > theme.auto_excerpt.length ? expert += ' ...' : ''
|
|
||||||
.content!= expert
|
|
||||||
else
|
|
||||||
.content!= article.description
|
|
||||||
|
|
||||||
|
|
||||||
@@ -18,6 +18,6 @@ section#rightside.rightside
|
|||||||
if is_post() && page.comments !== false && isComment
|
if is_post() && page.comments !== false && isComment
|
||||||
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.fa.fa-comments
|
i.scroll_to_comment.fa.fa-comments
|
||||||
if is_post() && page.toc != false && theme.toc.enable
|
if is_post() && page.toc !== false && theme.toc.enable && (toc(page.content) !== '' || page.encrypt == true )
|
||||||
i#mobile-toc-button.fa.fa-list-ul.close(title=_p("rightside.toc") aria-hidden="true")
|
i#mobile-toc-button.fa.fa-list-ul.close(title=_p("rightside.toc") aria-hidden="true")
|
||||||
i.fa.fa-arrow-up#go-up(title=_p("rightside.back_to_top") aria-hidden="true")
|
i.fa.fa-arrow-up#go-up(title=_p("rightside.back_to_top") aria-hidden="true")
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
#sidebar
|
- let showToc = is_post() && page.toc !== false && theme.toc.enable && (toc(page.content) !== '' || page.encrypt == true )
|
||||||
- const showToc = is_post() && page.toc != false && theme.toc.enable
|
- let autoOpenSidebar = theme.auto_open_sidebar.enable === true ? 'on' : ''
|
||||||
|
|
||||||
-
|
-
|
||||||
let tocNumber
|
let tocNumber
|
||||||
if (page.toc_number !== undefined) tocNumber = page.toc_number
|
if (page.toc_number !== undefined) tocNumber = page.toc_number
|
||||||
else if (theme.toc.number !== undefined) tocNumber = theme.toc.number
|
else if (theme.toc.number !== undefined) tocNumber = theme.toc.number
|
||||||
else tocNumber = true
|
else tocNumber = true
|
||||||
-
|
-
|
||||||
|
|
||||||
if(showToc)
|
if(showToc)
|
||||||
|
i.fa.fa-arrow-right#toggle-sidebar(aria-hidden="true" class=autoOpenSidebar)
|
||||||
|
#sidebar
|
||||||
.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
|
||||||
|
|||||||
2
layout/includes/widget/card_ad.pug
Normal file
2
layout/includes/widget/card_ad.pug
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
.card-widget.card-ad
|
||||||
|
!= theme.ad.aside
|
||||||
@@ -3,4 +3,4 @@
|
|||||||
.item-headline
|
.item-headline
|
||||||
i.fa.fa-bullhorn.card-announcement-animation(aria-hidden="true")
|
i.fa.fa-bullhorn.card-announcement-animation(aria-hidden="true")
|
||||||
span= _p('aside.card_announcement')
|
span= _p('aside.card_announcement')
|
||||||
.announcement_content!= theme.announcement.content
|
.announcement_content!= theme.aside.card_announcement.content
|
||||||
@@ -3,4 +3,9 @@
|
|||||||
.item-headline
|
.item-headline
|
||||||
i.fa.fa-archive(aria-hidden="true")
|
i.fa.fa-archive(aria-hidden="true")
|
||||||
span= _p('aside.card_archives')
|
span= _p('aside.card_archives')
|
||||||
!= list_archives({type:'monthly',format: 'YYYY年MM月'})
|
|
||||||
|
- let type = theme.aside.card_archives.type || 'monthly'
|
||||||
|
- let format = theme.aside.card_archives.format || 'MMMM YYYY'
|
||||||
|
- let order = theme.aside.card_archives.order || -1
|
||||||
|
- let limit = theme.aside.card_archives.limit === 0 ? 0 : theme.aside.card_archives.limit || 8
|
||||||
|
!= aside_archives({ type:type, format: format, order: order, limit: limit })
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
.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.lodding_bg.flink) + `'` alt="avatar")
|
img.avatar-img(src=url_for(theme.avatar.img) onerror=`this.onerror=null;this.src='` + url_for(theme.lodding_bg.flink) + `'` alt="avatar")
|
||||||
.author-info__name= config.author
|
.author-info__name= config.author
|
||||||
.author-info__description= config.description
|
.author-info__description= theme.aside.card_author.description || config.description
|
||||||
|
|
||||||
.card-info-data
|
.card-info-data
|
||||||
if site.posts.length
|
if site.posts.length
|
||||||
@@ -31,6 +31,4 @@
|
|||||||
|
|
||||||
if(theme.social)
|
if(theme.social)
|
||||||
.card-info-social-icons.is-center
|
.card-info-social-icons.is-center
|
||||||
each url, icon in theme.social
|
!=fragment_cache('social', function(){return partial('includes/header/social')})
|
||||||
a.social-icon(href=url target="_blank")
|
|
||||||
i(class=icon aria-hidden="true")
|
|
||||||
|
|||||||
@@ -4,20 +4,6 @@ if site.categories.length
|
|||||||
.item-headline
|
.item-headline
|
||||||
i.fa.fa-folder-open(aria-hidden="true")
|
i.fa.fa-folder-open(aria-hidden="true")
|
||||||
span= _p('aside.card_categories')
|
span= _p('aside.card_categories')
|
||||||
ul.aside-category-item
|
!=aside_categories({ limit: theme.aside.card_categories.limit === 0 ? 0 : theme.aside.card_categories.limit || 8 })
|
||||||
mixin displayCategories(parent = undefined)
|
|
||||||
- site.categories.find({ parent }).sort("name").each(function(category) {
|
|
||||||
- var childCount = site.categories.find({ parent: category._id }).count();
|
|
||||||
li.aside-category-list
|
|
||||||
a.aside-category-list_link(href=url_for(category.path))
|
|
||||||
span.aside-category-list_name= category.name
|
|
||||||
span.aside-category-list_length= category.length
|
|
||||||
|
|
||||||
if childCount > 0
|
|
||||||
ul.aside-category-item.child
|
|
||||||
+displayCategories(category._id)
|
|
||||||
- })
|
|
||||||
|
|
||||||
+displayCategories()
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
i.fa.fa-history(aria-hidden="true")
|
i.fa.fa-history(aria-hidden="true")
|
||||||
span= _p('aside.card_recent_post')
|
span= _p('aside.card_recent_post')
|
||||||
.aside-recent-item
|
.aside-recent-item
|
||||||
- site.posts.sort('date', -1).limit(5).each(function(article){
|
- var 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){
|
||||||
.aside-recent-post
|
.aside-recent-post
|
||||||
- var link = article.link || article.path
|
- var link = article.link || article.path
|
||||||
- var title = article.title || _p('no_title')
|
- var title = article.title || _p('no_title')
|
||||||
@@ -20,8 +21,6 @@
|
|||||||
img.aside-post-bg(src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` title=title alt=title)
|
img.aside-post-bg(src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` title=title alt=title)
|
||||||
.aside-post-title(class=no_cover)
|
.aside-post-title(class=no_cover)
|
||||||
.aside-post_title(href=url_for(link) title=article.title || _p('no_title'))= article.title || _p('no_title')
|
.aside-post_title(href=url_for(link) title=article.title || _p('no_title'))= article.title || _p('no_title')
|
||||||
if (theme.post_meta.page.date_type)
|
time.aside-post_meta.post-meta__date(title=_p('post.created') + ' ' + full_date(article.date)) #[=date(article.date, config.date_format)]
|
||||||
- var date_type = theme.post_meta.page.date_type == 'updated' ? 'updated' : 'date'
|
|
||||||
time.aside-post_meta.post-meta__date #[=date(article[date_type], config.date_format)]
|
|
||||||
|
|
||||||
- })
|
- })
|
||||||
|
|||||||
@@ -4,4 +4,9 @@ if site.tags.length
|
|||||||
.item-headline
|
.item-headline
|
||||||
i.fa.fa-tags(aria-hidden="true")
|
i.fa.fa-tags(aria-hidden="true")
|
||||||
span= _p('aside.card_tags')
|
span= _p('aside.card_tags')
|
||||||
.card-tag-cloud!= tagcloud({min_font: 16, max_font: 24, amount: 200, color: true, start_color: '#999', end_color: '#99a9bf'})
|
|
||||||
|
- let tagLimit = theme.aside.card_tags.limit === 0 ? 0 : theme.aside.card_tags.limit || 40
|
||||||
|
if theme.aside.card_tags.color
|
||||||
|
.card-tag-cloud!=cloudTags({source: site.tags, minfontsize: 16, maxfontsize: 22, limit: tagLimit})
|
||||||
|
else
|
||||||
|
.card-tag-cloud!= tagcloud({min_font: 16, max_font: 22, amount: tagLimit , color: true, start_color: '#999', end_color: '#99a9bf'})
|
||||||
|
|||||||
@@ -12,6 +12,10 @@
|
|||||||
.webinfo-item
|
.webinfo-item
|
||||||
.webinfo-runtime-name= _p('aside.card_webinfo.runtime_name') + " :"
|
.webinfo-runtime-name= _p('aside.card_webinfo.runtime_name') + " :"
|
||||||
#webinfo-runtime-count.webinfo-runtime-count(start_date=theme.runtimeshow.start_date)
|
#webinfo-runtime-count.webinfo-runtime-count(start_date=theme.runtimeshow.start_date)
|
||||||
|
if theme.wordcount.enable && theme.wordcount.total_wordcount
|
||||||
|
.webinfo-item
|
||||||
|
.webinfo-site-wordcount-name=_p('aside.card_webinfo.site_wordcount') + " :"
|
||||||
|
.webinfo-site-wordcount=totalcount(site)
|
||||||
if theme.busuanzi.site_uv
|
if theme.busuanzi.site_uv
|
||||||
.webinfo-item
|
.webinfo-item
|
||||||
.webinfo-site-uv-name= _p('aside.card_webinfo.site_uv_name') + " :"
|
.webinfo-site-uv-name= _p('aside.card_webinfo.site_uv_name') + " :"
|
||||||
|
|||||||
@@ -1,17 +1,19 @@
|
|||||||
if theme.aside.enable
|
if theme.aside.enable
|
||||||
if page.aside !== false
|
if page.aside !== false
|
||||||
#aside_content.aside_content
|
#aside_content.aside_content
|
||||||
if theme.aside.card_author
|
if theme.aside.card_author.enable
|
||||||
!=partial('includes/widget/card_author', {}, {cache:theme.fragment_cache})
|
!=partial('includes/widget/card_author', {}, {cache:theme.fragment_cache})
|
||||||
if theme.aside.card_announcement
|
if theme.aside.card_announcement.enable
|
||||||
!=partial('includes/widget/card_announcement', {}, {cache:theme.fragment_cache})
|
!=partial('includes/widget/card_announcement', {}, {cache:theme.fragment_cache})
|
||||||
if theme.aside.card_recent_post
|
if theme.aside.card_recent_post.enable
|
||||||
!=partial('includes/widget/card_recent_post', {}, {cache:theme.fragment_cache})
|
!=partial('includes/widget/card_recent_post', {}, {cache:theme.fragment_cache})
|
||||||
if theme.aside.card_categories
|
if theme.ad && theme.ad.aside
|
||||||
|
!=partial('includes/widget/card_ad', {}, {cache:theme.fragment_cache})
|
||||||
|
if theme.aside.card_categories.enable
|
||||||
!=partial('includes/widget/card_categories', {}, {cache:theme.fragment_cache})
|
!=partial('includes/widget/card_categories', {}, {cache:theme.fragment_cache})
|
||||||
if theme.aside.card_tags
|
if theme.aside.card_tags.enable
|
||||||
!=partial('includes/widget/card_tags', {}, {cache:theme.fragment_cache})
|
!=partial('includes/widget/card_tags', {}, {cache:theme.fragment_cache})
|
||||||
if theme.aside.card_archives
|
if theme.aside.card_archives.enable
|
||||||
!=partial('includes/widget/card_archives', {}, {cache:theme.fragment_cache})
|
!=partial('includes/widget/card_archives', {}, {cache:theme.fragment_cache})
|
||||||
if theme.aside.card_webinfo
|
if theme.aside.card_webinfo
|
||||||
!=partial('includes/widget/card_webinfo', {}, {cache:theme.fragment_cache})
|
!=partial('includes/widget/card_webinfo', {}, {cache:theme.fragment_cache})
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
extends includes/layout.pug
|
extends includes/layout.pug
|
||||||
|
|
||||||
block content
|
block content
|
||||||
|
include ./includes/mixins/post-ui.pug
|
||||||
#recent-posts.recent-posts
|
#recent-posts.recent-posts
|
||||||
include includes/recent-posts.pug
|
+postUI
|
||||||
include includes/pagination.pug
|
include includes/pagination.pug
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
.tag-cloud
|
|
||||||
.tag-cloud__title= _p('page.tag')
|
|
||||||
| -
|
|
||||||
span.tag-cloud__amount= site.tags.length
|
|
||||||
.tag-cloud-tags
|
|
||||||
- site.tags.sort('path').each(function (tags){
|
|
||||||
- var fontSize = Math.floor(Math.random() * 15 + 15) + "px"; //15 ~ 30
|
|
||||||
- var color = "rgb(" + Math.floor(Math.random() * 201) + ", " + Math.floor(Math.random() * 201) +", " + Math.floor(Math.random() * 201) +")"; // 0,0,0 -> 200,200,200
|
|
||||||
a(href=url_for(tags.path) style='font-size:' + fontSize + ';color:' + color)=tags.name
|
|
||||||
-})
|
|
||||||
if page.comments !== false
|
|
||||||
include includes/comments/index.pug
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2,7 +2,14 @@ extends includes/layout.pug
|
|||||||
|
|
||||||
block content
|
block content
|
||||||
if page.type === 'tags'
|
if page.type === 'tags'
|
||||||
include page-tags.pug
|
.tag-cloud
|
||||||
|
.tag-cloud__title= _p('page.tag')
|
||||||
|
| -
|
||||||
|
span.tag-cloud__amount= site.tags.length
|
||||||
|
.tag-cloud-tags
|
||||||
|
!=cloudTags({source: site.tags, minfontsize: 15, maxfontsize: 30, limit: 0})
|
||||||
|
if page.comments !== false
|
||||||
|
include includes/comments/index.pug
|
||||||
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'
|
||||||
|
|||||||
@@ -13,8 +13,12 @@ block content
|
|||||||
|
|
||||||
if theme.reward.enable
|
if theme.reward.enable
|
||||||
!=partial('includes/post/reward', {}, {cache:theme.fragment_cache})
|
!=partial('includes/post/reward', {}, {cache:theme.fragment_cache})
|
||||||
include includes/pagination.pug
|
|
||||||
|
|
||||||
|
//- ad
|
||||||
|
if theme.ad && theme.ad.post
|
||||||
|
.post-ad!=theme.ad.post
|
||||||
|
|
||||||
|
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
|
if page.comments !== false
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ extends includes/layout.pug
|
|||||||
|
|
||||||
block content
|
block content
|
||||||
if theme.tag_ui == 'index'
|
if theme.tag_ui == 'index'
|
||||||
include ./includes/mixins/UI.pug
|
include ./includes/mixins/post-ui.pug
|
||||||
#recent-posts.recent-posts
|
#recent-posts.recent-posts
|
||||||
+UI_NEW(page.posts)
|
+postUI
|
||||||
include includes/pagination.pug
|
include includes/pagination.pug
|
||||||
else
|
else
|
||||||
include ./includes/mixins/article-sort.pug
|
include ./includes/mixins/article-sort.pug
|
||||||
|
|||||||
17
package.json
17
package.json
@@ -1,5 +1,18 @@
|
|||||||
{
|
{
|
||||||
"name": "hexo-theme-butterfly",
|
"name": "hexo-theme-butterfly",
|
||||||
"version": "2.2.0",
|
"version": "2.3.0",
|
||||||
"description": "A Hexo Theme: Butterfly"
|
"private": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.10.0"
|
||||||
|
},
|
||||||
|
"description": "A Simple and Card UI Design theme for Hexo",
|
||||||
|
"keywords": [
|
||||||
|
"hexo",
|
||||||
|
"theme",
|
||||||
|
"butterfly",
|
||||||
|
"Card UI Design"
|
||||||
|
],
|
||||||
|
"repository": "https://github.com/jerryc127/hexo-theme-butterfly.git",
|
||||||
|
"author": "Jerry <wong@jerryc.me>",
|
||||||
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* Butterfly
|
||||||
|
* 404 error page
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
hexo.extend.generator.register('404', function (locals) {
|
hexo.extend.generator.register('404', function (locals) {
|
||||||
if (!hexo.theme.config.error_404.enable) return
|
if (!hexo.theme.config.error_404.enable) return
|
||||||
return {
|
return {
|
||||||
@@ -5,4 +12,4 @@ hexo.extend.generator.register('404', function(locals){
|
|||||||
data: locals.posts,
|
data: locals.posts,
|
||||||
layout: ['404']
|
layout: ['404']
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
* Note: configs in _data/butterfly.yml will replace configs in hexo.theme.config.
|
* Note: configs in _data/butterfly.yml will replace configs in hexo.theme.config.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
hexo.on('generateBefore', function () {
|
hexo.on('generateBefore', function () {
|
||||||
const rootConfig = hexo.config
|
const rootConfig = hexo.config
|
||||||
if (hexo.locals.get) {
|
if (hexo.locals.get) {
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
/**
|
|
||||||
* global hexo
|
|
||||||
* from printempw/hexo-hide-posts
|
|
||||||
* modify by Jerry
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var public_generators = [];
|
|
||||||
|
|
||||||
hexo.extend.filter.register('before_generate', function () {
|
|
||||||
this._bindLocals();
|
|
||||||
|
|
||||||
const all_posts = this.locals.get('posts');
|
|
||||||
const hidden_posts = all_posts.find({
|
|
||||||
'hide': true
|
|
||||||
});
|
|
||||||
const normal_posts = all_posts.filter(post => !post['hide']);
|
|
||||||
|
|
||||||
this.locals.set('all_posts', all_posts);
|
|
||||||
this.locals.set('hidden_posts', hidden_posts);
|
|
||||||
this.locals.set('posts', normal_posts);
|
|
||||||
});
|
|
||||||
|
|
||||||
hexo.extend.filter.register('after_init', function () {
|
|
||||||
|
|
||||||
const original = {};
|
|
||||||
for (const name in hexo.extend.generator.list()) {
|
|
||||||
original[name] = hexo.extend.generator.get(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
hexo.extend.generator.register('post', async function (locals) {
|
|
||||||
const fg = original.post.bind(this);
|
|
||||||
|
|
||||||
const generated_public = await fg(locals);
|
|
||||||
const generated_hidden = await fg(Object.assign({}, locals, {
|
|
||||||
posts: locals.hidden_posts
|
|
||||||
}));
|
|
||||||
|
|
||||||
// Remove post.prev and post.next for hidden posts
|
|
||||||
generated_hidden.forEach(ele => {
|
|
||||||
ele.data.prev = ele.data.next = null;
|
|
||||||
});
|
|
||||||
|
|
||||||
return generated_public.concat(generated_hidden);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Then we hack into other generators if necessary
|
|
||||||
public_generators.filter(
|
|
||||||
name => Object.keys(original).includes(name)
|
|
||||||
).forEach(name => {
|
|
||||||
// Overwrite original generator
|
|
||||||
hexo.extend.generator.register(name, function (locals) {
|
|
||||||
const fg = original[name].bind(this);
|
|
||||||
|
|
||||||
return fg(Object.assign({}, locals, {
|
|
||||||
posts: new locals.posts.constructor(
|
|
||||||
locals.posts.data.concat(locals.hidden_posts.data)
|
|
||||||
)
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const fs = require('hexo-fs');
|
|
||||||
const url_for = require('hexo-util').url_for.bind(hexo);
|
|
||||||
|
|
||||||
function lazyProcess(htmlContent) {
|
|
||||||
var bg = url_for(hexo.theme.config.lodding_bg.post);
|
|
||||||
return htmlContent.replace(/<img(\s*?)src="(.*?)"(.*?)>/gi, (str, p1, p2, p3) => {
|
|
||||||
if (/data-src/gi.test(str)) {
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
if (/class="(.*?)"/gi.test(str)){
|
|
||||||
str = str.replace(/class="(.*?)"/gi, (classStr, p1) => {
|
|
||||||
return classStr.replace(p1, `${p1} lazyload`);
|
|
||||||
})
|
|
||||||
str = str.replace(p2, `${bg}`)
|
|
||||||
return str.replace(p3, `${p3} data-src="${p2}"`);
|
|
||||||
}
|
|
||||||
str = str.replace(p2, `${bg}`)
|
|
||||||
return str.replace(p3, `${p3} class="lazyload" data-src="${p2}"`);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var processPost = function(data) {
|
|
||||||
if (!hexo.theme.config.lazyload.enable) return;
|
|
||||||
data.content = lazyProcess.call(this, data.content);
|
|
||||||
return data;
|
|
||||||
};
|
|
||||||
|
|
||||||
hexo.extend.filter.register('after_post_render', processPost);
|
|
||||||
39
scripts/filters/post_lazyload.js
Normal file
39
scripts/filters/post_lazyload.js
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
/**
|
||||||
|
* Butterfly
|
||||||
|
* lazyload
|
||||||
|
* replace src to data-src
|
||||||
|
* add class 'lazyload'
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
const url_for = require('hexo-util').url_for.bind(hexo)
|
||||||
|
|
||||||
|
function lazyProcess (htmlContent) {
|
||||||
|
var bg = url_for(hexo.theme.config.lodding_bg.post)
|
||||||
|
return htmlContent.replace(
|
||||||
|
/<img(.*?)src="(.*?)"(.*?)>/gi,
|
||||||
|
(str, p1, p2, p3) => {
|
||||||
|
if (/data-src/gi.test(str)) {
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
if (/class="(.*?)"/gi.test(str)) {
|
||||||
|
str = str.replace(/class="(.*?)"/gi, (classStr, p1) => {
|
||||||
|
return classStr.replace(p1, `${p1} lazyload`)
|
||||||
|
})
|
||||||
|
str = str.replace(p2, `${bg}`)
|
||||||
|
return str.replace('>', ` data-src="${p2}">`)
|
||||||
|
}
|
||||||
|
str = str.replace(p2, `${bg}`)
|
||||||
|
return str.replace(p3, ` class="lazyload" data-src="${p2}" ${p3}`)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
var processPost = function (data) {
|
||||||
|
if (!hexo.theme.config.lazyload.enable) return
|
||||||
|
data.content = lazyProcess.call(this, data.content)
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
hexo.extend.filter.register('after_post_render', processPost)
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
hexo.extend.filter.register("before_post_render", function(data) {
|
|
||||||
if (data.cover == false) {
|
|
||||||
data.randomcover = random_cover();
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
data.cover = data.cover || random_cover();
|
|
||||||
return data;
|
|
||||||
});
|
|
||||||
|
|
||||||
var random_cover = function() {
|
|
||||||
var cover;
|
|
||||||
var num;
|
|
||||||
if (!Array.isArray(hexo.theme.config.cover.default_cover)) {
|
|
||||||
cover = hexo.theme.config.cover.default_cover;
|
|
||||||
return cover;
|
|
||||||
} else {
|
|
||||||
num = Math.floor(
|
|
||||||
Math.random() * hexo.theme.config.cover.default_cover.length
|
|
||||||
);
|
|
||||||
cover = hexo.theme.config.cover.default_cover[num];
|
|
||||||
return cover;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
34
scripts/filters/random_cover.js
Normal file
34
scripts/filters/random_cover.js
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/**
|
||||||
|
* Butterfly
|
||||||
|
* ramdom cover
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
hexo.extend.filter.register('before_post_render', function (data) {
|
||||||
|
if (data.cover === false) {
|
||||||
|
data.randomcover = randomCover()
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
data.cover = data.cover || randomCover()
|
||||||
|
return data
|
||||||
|
})
|
||||||
|
|
||||||
|
var randomCover = function () {
|
||||||
|
var theme = hexo.theme.config
|
||||||
|
var cover
|
||||||
|
var num
|
||||||
|
|
||||||
|
if (theme.cover.default_cover) {
|
||||||
|
if (!Array.isArray(theme.cover.default_cover)) {
|
||||||
|
cover = theme.cover.default_cover
|
||||||
|
return cover
|
||||||
|
} else {
|
||||||
|
num = Math.floor(Math.random() * theme.cover.default_cover.length)
|
||||||
|
cover = theme.cover.default_cover[num]
|
||||||
|
return cover
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return theme.default_top_img
|
||||||
|
}
|
||||||
|
}
|
||||||
112
scripts/helpers/aside_archives.js
Normal file
112
scripts/helpers/aside_archives.js
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
/**
|
||||||
|
* Butterfly
|
||||||
|
* for aside archives
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
hexo.extend.helper.register('aside_archives', function (options = {}) {
|
||||||
|
const { config } = this
|
||||||
|
const archiveDir = config.archive_dir
|
||||||
|
const { timezone } = config
|
||||||
|
const lang = toMomentLocale(this.page.lang || this.page.language || config.language)
|
||||||
|
let { format } = options
|
||||||
|
const type = options.type || 'monthly'
|
||||||
|
const { transform } = options
|
||||||
|
const showCount = Object.prototype.hasOwnProperty.call(options, 'show_count') ? options.show_count : true
|
||||||
|
const order = options.order || -1
|
||||||
|
const compareFunc = type === 'monthly'
|
||||||
|
? (yearA, monthA, yearB, monthB) => yearA === yearB && monthA === monthB
|
||||||
|
: (yearA, monthA, yearB, monthB) => yearA === yearB
|
||||||
|
const limit = options.limit
|
||||||
|
const moreButton = this._p('aside.more_button')
|
||||||
|
let result = ''
|
||||||
|
|
||||||
|
if (!format) {
|
||||||
|
format = type === 'monthly' ? 'MMMM YYYY' : 'YYYY'
|
||||||
|
}
|
||||||
|
|
||||||
|
const posts = this.site.posts.sort('date', order)
|
||||||
|
if (!posts.length) return result
|
||||||
|
|
||||||
|
const data = []
|
||||||
|
let length = 0
|
||||||
|
|
||||||
|
posts.forEach(post => {
|
||||||
|
// Clone the date object to avoid pollution
|
||||||
|
let date = post.date.clone()
|
||||||
|
|
||||||
|
if (timezone) date = date.tz(timezone)
|
||||||
|
|
||||||
|
const year = date.year()
|
||||||
|
const month = date.month() + 1
|
||||||
|
const lastData = data[length - 1]
|
||||||
|
|
||||||
|
if (!lastData || !compareFunc(lastData.year, lastData.month, year, month)) {
|
||||||
|
if (lang) date = date.locale(lang)
|
||||||
|
const name = date.format(format)
|
||||||
|
length = data.push({
|
||||||
|
name,
|
||||||
|
year,
|
||||||
|
month,
|
||||||
|
count: 1
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
lastData.count++
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const link = item => {
|
||||||
|
let url = `${archiveDir}/${item.year}/`
|
||||||
|
|
||||||
|
if (type === 'monthly') {
|
||||||
|
if (item.month < 10) url += '0'
|
||||||
|
url += `${item.month}/`
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.url_for(url)
|
||||||
|
}
|
||||||
|
|
||||||
|
result += '<ul class="card-archive-list">'
|
||||||
|
|
||||||
|
const len = data.length
|
||||||
|
const Judge = limit === 0 ? len : Math.min(len, limit)
|
||||||
|
|
||||||
|
for (let i = 0; i < Judge; i++) {
|
||||||
|
const item = data[i]
|
||||||
|
|
||||||
|
result += '<li class="card-archive-list-item">'
|
||||||
|
|
||||||
|
result += `<a class="card-archive-list-link" href="${link(item)}">`
|
||||||
|
result += '<span class="card-archive-list-date">'
|
||||||
|
result += transform ? transform(item.name) : item.name
|
||||||
|
result += '</span>'
|
||||||
|
|
||||||
|
if (showCount) {
|
||||||
|
result += `<span class="card-archive-list-count">${item.count}</span>`
|
||||||
|
}
|
||||||
|
result += '</a>'
|
||||||
|
result += '</li>'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (len > Judge) {
|
||||||
|
result += '<li class="card-archive-list-item more is-center">'
|
||||||
|
result += `<a class="card-archive-list-link-more" href="${this.url_for(archiveDir)}">
|
||||||
|
<span>${moreButton}</span><i class="fa fa-angle-right" aria-hidden="true"></i></a></li>`
|
||||||
|
}
|
||||||
|
result += '</ul>'
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
|
||||||
|
var toMomentLocale = function (lang) {
|
||||||
|
if (lang === undefined) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
// moment.locale('') equals moment.locale('en')
|
||||||
|
// moment.locale(null) equals moment.locale('en')
|
||||||
|
if (!lang || lang === 'en' || lang === 'default') {
|
||||||
|
return 'en'
|
||||||
|
}
|
||||||
|
return lang.toLowerCase().replace('_', '-')
|
||||||
|
}
|
||||||
97
scripts/helpers/aside_categories.js
Normal file
97
scripts/helpers/aside_categories.js
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
/**
|
||||||
|
* Butterfly
|
||||||
|
* for aside categories
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
hexo.extend.helper.register('aside_categories', function (categories, options) {
|
||||||
|
if (
|
||||||
|
!options &&
|
||||||
|
(!categories || !Object.prototype.hasOwnProperty.call(categories, 'length'))
|
||||||
|
) {
|
||||||
|
options = categories
|
||||||
|
categories = this.site.categories
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!categories || !categories.length) return ''
|
||||||
|
options = options || {}
|
||||||
|
const { config } = this
|
||||||
|
const showCount = Object.prototype.hasOwnProperty.call(options, 'show_count')
|
||||||
|
? options.show_count
|
||||||
|
: true
|
||||||
|
const depth = options.depth ? parseInt(options.depth, 10) : 0
|
||||||
|
const orderby = options.orderby || 'name'
|
||||||
|
const order = options.order || 1
|
||||||
|
const categoryDir = this.url_for(config.category_dir)
|
||||||
|
const limit = options.limit === 0 ? categories.length : options.limit
|
||||||
|
const buttonLabel = this._p('aside.more_button')
|
||||||
|
const prepareQuery = (parent) => {
|
||||||
|
const query = {}
|
||||||
|
if (parent) {
|
||||||
|
query.parent = parent
|
||||||
|
} else {
|
||||||
|
query.parent = {
|
||||||
|
$exists: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return categories
|
||||||
|
.find(query)
|
||||||
|
.sort(orderby, order)
|
||||||
|
.filter((cat) => cat.length)
|
||||||
|
}
|
||||||
|
|
||||||
|
const hierarchicalList = (t, level, parent) => {
|
||||||
|
let result = ''
|
||||||
|
if (t > 0) {
|
||||||
|
prepareQuery(parent).forEach((cat, i) => {
|
||||||
|
if (t > 0) {
|
||||||
|
t = t - 1
|
||||||
|
let child
|
||||||
|
if (!depth || level + 1 < depth) {
|
||||||
|
var childList = hierarchicalList(t, level + 1, cat._id)
|
||||||
|
child = childList[0]
|
||||||
|
t = childList[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
result += '<li class="card-category-list-item">'
|
||||||
|
|
||||||
|
result += `<a class="card-category-list-link" href="${this.url_for(
|
||||||
|
cat.path
|
||||||
|
)}">`
|
||||||
|
result += `<span class="card-category-list-name">${cat.name}</span>`
|
||||||
|
|
||||||
|
if (showCount) {
|
||||||
|
result += `<span class="card-category-list-count">${cat.length}</span>`
|
||||||
|
}
|
||||||
|
|
||||||
|
result += '</a>'
|
||||||
|
result += '</li>'
|
||||||
|
|
||||||
|
if (child) {
|
||||||
|
result += `<ul class="card-category-list child">${child}</ul>`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return [result, t]
|
||||||
|
}
|
||||||
|
|
||||||
|
const list = hierarchicalList(limit, 0)
|
||||||
|
|
||||||
|
var moreButton = function () {
|
||||||
|
var moreHtml = ''
|
||||||
|
if (categories.length <= limit) return ''
|
||||||
|
moreHtml += '<li class="card-category-list-item more is-center">'
|
||||||
|
moreHtml += `<a class="card-category-list-link-more" href="${categoryDir}">
|
||||||
|
<span>${buttonLabel}</span><i class="fa fa-angle-right" aria-hidden="true"></i></a></li>`
|
||||||
|
|
||||||
|
return moreHtml
|
||||||
|
}
|
||||||
|
|
||||||
|
return `<ul class="card-category-list">
|
||||||
|
${list[0]}
|
||||||
|
${moreButton()}
|
||||||
|
</ul>`
|
||||||
|
})
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
|
|
||||||
hexo.extend.helper.register("list_archives", function(options = {}) {
|
|
||||||
const { config } = this;
|
|
||||||
const archiveDir = config.archive_dir;
|
|
||||||
const { timezone } = config;
|
|
||||||
const lang = this.page.lang || this.page.language || config.language;
|
|
||||||
let { format } = options;
|
|
||||||
const type = options.type || "monthly";
|
|
||||||
const { style = "list", transform, separator = ", " } = options;
|
|
||||||
const showCount = Object.prototype.hasOwnProperty.call(options, "show_count")
|
|
||||||
? options.show_count
|
|
||||||
: true;
|
|
||||||
const order = options.order || -1;
|
|
||||||
const limit = 8;
|
|
||||||
let result = "";
|
|
||||||
|
|
||||||
var more_button;
|
|
||||||
if (lang === "zh-CN") {
|
|
||||||
more_button = "查看更多";
|
|
||||||
} else if (lang === "zh-TW") {
|
|
||||||
more_button = "查看更多";
|
|
||||||
} else {
|
|
||||||
more_button = "More";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!format) {
|
|
||||||
format = type === "monthly" ? "MMMM YYYY" : "YYYY";
|
|
||||||
}
|
|
||||||
|
|
||||||
const posts = this.site.posts.sort("date", order);
|
|
||||||
if (!posts.length) return result;
|
|
||||||
|
|
||||||
const data = [];
|
|
||||||
let length = 0;
|
|
||||||
|
|
||||||
posts.forEach(post => {
|
|
||||||
// Clone the date object to avoid pollution
|
|
||||||
let date = post.date.clone();
|
|
||||||
|
|
||||||
if (timezone) date = date.tz(timezone);
|
|
||||||
if (lang) date = date.locale(lang);
|
|
||||||
|
|
||||||
const year = date.year();
|
|
||||||
const month = date.month() + 1;
|
|
||||||
const name = date.format(format);
|
|
||||||
const lastData = data[length - 1];
|
|
||||||
|
|
||||||
if (!lastData || lastData.name !== name) {
|
|
||||||
length = data.push({
|
|
||||||
name,
|
|
||||||
year,
|
|
||||||
month,
|
|
||||||
count: 1
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
lastData.count++;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const link = item => {
|
|
||||||
let url = `${archiveDir}/${item.year}/`;
|
|
||||||
|
|
||||||
if (type === "monthly") {
|
|
||||||
if (item.month < 10) url += "0";
|
|
||||||
url += `${item.month}/`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.url_for(url);
|
|
||||||
};
|
|
||||||
|
|
||||||
result += `<ul class="archive-list">`;
|
|
||||||
|
|
||||||
for (let i = 0, len = data.length; i < Math.min(len, limit); i++) {
|
|
||||||
const item = data[i];
|
|
||||||
|
|
||||||
result += `<li class="archive-list-item">`;
|
|
||||||
|
|
||||||
result += `<a class="archive-list-link" href="${link(item)}">`;
|
|
||||||
result += `<span class="archive-list-date">`;
|
|
||||||
result += transform ? transform(item.name) : item.name;
|
|
||||||
result += `</span>`;
|
|
||||||
|
|
||||||
if (showCount) {
|
|
||||||
result += `<span class="archive-list-count">${item.count}</span>`;
|
|
||||||
}
|
|
||||||
result += "</a>";
|
|
||||||
result += "</li>";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.length > limit) {
|
|
||||||
result += `<li class="archive-list-item">`;
|
|
||||||
result +=
|
|
||||||
`<a class="archive-list-link-more" href="` +
|
|
||||||
"/" +
|
|
||||||
`${archiveDir}" >`;
|
|
||||||
result += more_button;
|
|
||||||
result += "</a>";
|
|
||||||
result += "</li>";
|
|
||||||
}
|
|
||||||
result += "</ul>";
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
58
scripts/helpers/page.js
Normal file
58
scripts/helpers/page.js
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
/**
|
||||||
|
* Butterfly
|
||||||
|
* @example
|
||||||
|
* page_description()
|
||||||
|
* injectHtml(data)
|
||||||
|
* cloudTags(source, minfontsize, maxfontsize, limit)
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
const { stripHTML } = require('hexo-util')
|
||||||
|
|
||||||
|
hexo.extend.helper.register('page_description', function () {
|
||||||
|
const { config, page } = this
|
||||||
|
let description = page.description || page.content || page.title || config.description
|
||||||
|
|
||||||
|
if (description) {
|
||||||
|
description = stripHTML(description).substring(0, 200)
|
||||||
|
.trim()
|
||||||
|
.replace(/\n/g, ' ')
|
||||||
|
return description
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
hexo.extend.helper.register('injectHtml', function (data) {
|
||||||
|
let result = ''
|
||||||
|
if (!data) return ''
|
||||||
|
for (var i = 0; i < data.length; i++) {
|
||||||
|
result += data[i]
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
|
||||||
|
hexo.extend.helper.register('cloudTags', function (options = {}) {
|
||||||
|
const env = this
|
||||||
|
const source = options.source
|
||||||
|
const minfontsize = options.minfontsize
|
||||||
|
const maxfontsize = options.maxfontsize
|
||||||
|
const limit = options.limit || 8
|
||||||
|
|
||||||
|
let result = ''
|
||||||
|
const tagLimit = limit === 0 ? source.length : limit
|
||||||
|
source.sort('name').limit(tagLimit).forEach(function (tags) {
|
||||||
|
var 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
|
||||||
|
result += `<a href='${env.url_for(tags.path)}' style='font-size:${fontSize}; color:${color}'>${tags.name}</a>`
|
||||||
|
})
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
|
||||||
|
hexo.extend.helper.register('urlNoIndex', function () {
|
||||||
|
const { permalink } = hexo.config
|
||||||
|
let url = this.url.replace(/index\.html$/, '')
|
||||||
|
if (!permalink.endsWith('.html')) {
|
||||||
|
url = url.replace(/\.html$/, '')
|
||||||
|
}
|
||||||
|
return url
|
||||||
|
})
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
|
|
||||||
var relatedPosts = [];
|
|
||||||
currentPost.tags.forEach(function (tag) {
|
|
||||||
allPosts.forEach(function (post) {
|
|
||||||
if (isTagRelated(tag.name, post.tags)) {
|
|
||||||
var relatedPost = {
|
|
||||||
title: post.title,
|
|
||||||
path: post.path,
|
|
||||||
cover: post.cover,
|
|
||||||
randomcover: post.randomcover,
|
|
||||||
weight: 1,
|
|
||||||
updated: post.updated,
|
|
||||||
created: post.date
|
|
||||||
};
|
|
||||||
var index = findItem(relatedPosts, 'path', post.path);
|
|
||||||
if (index != -1) {
|
|
||||||
relatedPosts[index].weight += 1;
|
|
||||||
} else {
|
|
||||||
if (currentPost.path != post.path) {
|
|
||||||
relatedPosts.push(relatedPost);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
});
|
|
||||||
});
|
|
||||||
if (relatedPosts.length == 0) {
|
|
||||||
return ''
|
|
||||||
};
|
|
||||||
var result = "";
|
|
||||||
const hexoConfig = hexo.theme.config.rootConfig;
|
|
||||||
const config = hexo.theme.config;
|
|
||||||
|
|
||||||
var limit_num = config.related_post.limit || 6
|
|
||||||
var date_type = config.related_post.date_type || 'created'
|
|
||||||
var headline_lang = this._p('post.recommend')
|
|
||||||
|
|
||||||
relatedPosts = relatedPosts.sort(compare('weight'));
|
|
||||||
var lazy_src = config.lazyload.enable ? lazy_src = 'data-src' : lazy_src = 'src'
|
|
||||||
var lazy_class = config.lazyload.enable ? lazy_class = 'lazyload' : lazy_class = ''
|
|
||||||
|
|
||||||
if (relatedPosts.length > 0) {
|
|
||||||
result += '<div class="relatedPosts">'
|
|
||||||
result += '<div class="relatedPosts_headline"><i class="fa fa-fw fa-thumbs-up" aria-hidden="true"></i><span>' + ' ' + headline_lang + '</span></div>'
|
|
||||||
result += '<div class="relatedPosts_list">'
|
|
||||||
|
|
||||||
for (var i = 0; i < Math.min(relatedPosts.length, limit_num); i++) {
|
|
||||||
var cover = relatedPosts[i].cover === false ? relatedPosts[i].randomcover : relatedPosts[i].cover
|
|
||||||
result += '<div class="relatedPosts_item"><a href="' + hexoConfig.root + relatedPosts[i].path + '" title="' + relatedPosts[i].title + '">';
|
|
||||||
result += '<img class="relatedPosts_cover ' + lazy_class + '"' + lazy_src + '="' + cover + '">';
|
|
||||||
if (date_type == 'created') {
|
|
||||||
result += '<div class="relatedPosts_main is-center"><div class="relatedPosts_date"><i class="fa fa-calendar fa-fw" aria-hidden="true"></i>' + ' ' + this.date(relatedPosts[i].created,hexoConfig.date_format) + '</div>'
|
|
||||||
} else {
|
|
||||||
result += '<div class="relatedPosts_main is-center"><div class="relatedPosts_date"><i class="fa fa-history fa-fw" aria-hidden="true"></i>' + ' ' + this.date(relatedPosts[i].updated,hexoConfig.date_format) + '</div>'
|
|
||||||
}
|
|
||||||
result += '<div class="relatedPosts_title">' + relatedPosts[i].title + '</div>';
|
|
||||||
result += '</div></a></div>'
|
|
||||||
};
|
|
||||||
|
|
||||||
result += '</div><div class="clear_both"></div></div>'
|
|
||||||
return result;
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function isTagRelated(tagName, TBDtags) {
|
|
||||||
var result = false;
|
|
||||||
TBDtags.forEach(function (tag) {
|
|
||||||
if (tagName == tag.name) {
|
|
||||||
result = true;
|
|
||||||
};
|
|
||||||
})
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function findItem(arrayToSearch, attr, val) {
|
|
||||||
for (var i = 0; i < arrayToSearch.length; i++) {
|
|
||||||
if (arrayToSearch[i][attr] == val) {
|
|
||||||
return i
|
|
||||||
};
|
|
||||||
};
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function compare(attr) {
|
|
||||||
return function (a, b) {
|
|
||||||
var val1 = a[attr];
|
|
||||||
var val2 = b[attr];
|
|
||||||
return val2 - val1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
126
scripts/helpers/related_post.js
Normal file
126
scripts/helpers/related_post.js
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
/**
|
||||||
|
* Butterfly
|
||||||
|
* Related Posts
|
||||||
|
* According the tag
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
|
||||||
|
var relatedPosts = []
|
||||||
|
currentPost.tags.forEach(function (tag) {
|
||||||
|
allPosts.forEach(function (post) {
|
||||||
|
if (isTagRelated(tag.name, post.tags)) {
|
||||||
|
var relatedPost = {
|
||||||
|
title: post.title,
|
||||||
|
path: post.path,
|
||||||
|
cover: post.cover,
|
||||||
|
randomcover: post.randomcover,
|
||||||
|
weight: 1,
|
||||||
|
updated: post.updated,
|
||||||
|
created: post.date
|
||||||
|
}
|
||||||
|
var index = findItem(relatedPosts, 'path', post.path)
|
||||||
|
if (index !== -1) {
|
||||||
|
relatedPosts[index].weight += 1
|
||||||
|
} else {
|
||||||
|
if (currentPost.path !== post.path) {
|
||||||
|
relatedPosts.push(relatedPost)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
if (relatedPosts.length === 0) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
var result = ''
|
||||||
|
const hexoConfig = hexo.theme.config.rootConfig
|
||||||
|
const config = hexo.theme.config
|
||||||
|
|
||||||
|
var limitNum = config.related_post.limit || 6
|
||||||
|
var dateType = config.related_post.date_type || 'created'
|
||||||
|
var headlineLang = this._p('post.recommend')
|
||||||
|
var lazySrc = config.lazyload.enable ? 'data-src' : 'src'
|
||||||
|
var lazyClass = config.lazyload.enable ? 'lazyload' : ''
|
||||||
|
|
||||||
|
relatedPosts = relatedPosts.sort(compare('weight'))
|
||||||
|
|
||||||
|
if (relatedPosts.length > 0) {
|
||||||
|
result += '<div class="relatedPosts">'
|
||||||
|
result +=
|
||||||
|
'<div class="relatedPosts_headline"><i class="fa fa-fw fa-thumbs-up" aria-hidden="true"></i><span>' +
|
||||||
|
' ' +
|
||||||
|
headlineLang +
|
||||||
|
'</span></div>'
|
||||||
|
result += '<div class="relatedPosts_list">'
|
||||||
|
|
||||||
|
for (var i = 0; i < Math.min(relatedPosts.length, limitNum); i++) {
|
||||||
|
var cover =
|
||||||
|
relatedPosts[i].cover === false
|
||||||
|
? relatedPosts[i].randomcover
|
||||||
|
: relatedPosts[i].cover
|
||||||
|
result +=
|
||||||
|
'<div class="relatedPosts_item"><a href="' +
|
||||||
|
hexoConfig.root +
|
||||||
|
relatedPosts[i].path +
|
||||||
|
'" title="' +
|
||||||
|
relatedPosts[i].title +
|
||||||
|
'">'
|
||||||
|
result +=
|
||||||
|
'<img class="relatedPosts_cover ' +
|
||||||
|
lazyClass +
|
||||||
|
'"' +
|
||||||
|
lazySrc +
|
||||||
|
'="' +
|
||||||
|
cover +
|
||||||
|
'">'
|
||||||
|
if (dateType === 'created') {
|
||||||
|
result +=
|
||||||
|
'<div class="relatedPosts_main is-center"><div class="relatedPosts_date"><i class="fa fa-calendar fa-fw" aria-hidden="true"></i>' +
|
||||||
|
' ' +
|
||||||
|
this.date(relatedPosts[i].created, hexoConfig.date_format) +
|
||||||
|
'</div>'
|
||||||
|
} else {
|
||||||
|
result +=
|
||||||
|
'<div class="relatedPosts_main is-center"><div class="relatedPosts_date"><i class="fa fa-history fa-fw" aria-hidden="true"></i>' +
|
||||||
|
' ' +
|
||||||
|
this.date(relatedPosts[i].updated, hexoConfig.date_format) +
|
||||||
|
'</div>'
|
||||||
|
}
|
||||||
|
result +=
|
||||||
|
'<div class="relatedPosts_title">' + relatedPosts[i].title + '</div>'
|
||||||
|
result += '</div></a></div>'
|
||||||
|
}
|
||||||
|
|
||||||
|
result += '</div><div class="clear_both"></div></div>'
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function isTagRelated (tagName, TBDtags) {
|
||||||
|
var result = false
|
||||||
|
TBDtags.forEach(function (tag) {
|
||||||
|
if (tagName === tag.name) {
|
||||||
|
result = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
function findItem (arrayToSearch, attr, val) {
|
||||||
|
for (var i = 0; i < arrayToSearch.length; i++) {
|
||||||
|
if (arrayToSearch[i][attr] === val) {
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
function compare (attr) {
|
||||||
|
return function (a, b) {
|
||||||
|
var val1 = a[attr]
|
||||||
|
var val2 = b[attr]
|
||||||
|
return val2 - val1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,15 @@
|
|||||||
const url_for = require('hexo-util').url_for.bind(hexo);
|
/**
|
||||||
|
* Butterfly
|
||||||
|
* galleryGroup and allery
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
const url_for = 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('')}
|
||||||
</div>`;
|
</div>`
|
||||||
}
|
}
|
||||||
|
|
||||||
function galleryGroup (args) {
|
function galleryGroup (args) {
|
||||||
@@ -23,5 +30,5 @@ function galleryGroup(args){
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
hexo.extend.tag.register('gallery', gallery, {ends: true});
|
hexo.extend.tag.register('gallery', gallery, { ends: true })
|
||||||
hexo.extend.tag.register('galleryGroup', galleryGroup);
|
hexo.extend.tag.register('galleryGroup', galleryGroup)
|
||||||
|
|||||||
@@ -1,33 +1,71 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Butterfly
|
||||||
|
* @example
|
||||||
|
* hideInline
|
||||||
* {% hideInline content,display,bg,color %}
|
* {% hideInline content,display,bg,color %}
|
||||||
* content不能包含當引號,可用 '
|
* content不能包含當引號,可用 '
|
||||||
*/
|
* hideBlock
|
||||||
function hideInline(args) {
|
|
||||||
args = args.join(' ').split(',')
|
|
||||||
let content = args[0].trim()
|
|
||||||
let display = args[1] || 'Click'
|
|
||||||
let bg = args[2] ==='' || typeof args[2] ==='undefined' ? '' : `background-color:${args[2]}`
|
|
||||||
let color = args[3] || '#fff'
|
|
||||||
return `<span class="hide-inline"><a class="hide-button button--primary button--animated" style="color:${color};${bg}">${display}
|
|
||||||
</a><span class="hide-content">${content}</span></span>`
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {% hideBlock display,bg,color %}
|
* {% hideBlock display,bg,color %}
|
||||||
* content
|
* content
|
||||||
* {% endhideBlock %}
|
* {% endhideBlock %}
|
||||||
|
* hideToggle
|
||||||
|
* {% hideToggle display,bg,color %}
|
||||||
|
* content
|
||||||
|
* {% endhideToggle %}
|
||||||
*/
|
*/
|
||||||
function hideBlock(args,content) {
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
function hideInline (args) {
|
||||||
args = args.join(' ').split(',')
|
args = args.join(' ').split(',')
|
||||||
let display = args[0] || 'Click'
|
var content = args[0]
|
||||||
let bg = args[1] ==='' || typeof args[2] ==='undefined' ? '' : `background-color:${args[2]}`
|
var display = args[1] || 'Click'
|
||||||
let color = args[2] || '#fff'
|
var bg = args[2] || false
|
||||||
|
var color = args[3] || false
|
||||||
|
var group = 'style="'
|
||||||
|
|
||||||
return `<div class="hide-block"><a class="hide-button button--primary button--animated" style="color:${color};${bg}">${display}
|
if (bg) group += `background-color: ${bg};`
|
||||||
</a><span class="hide-content">${hexo.render.renderSync({text: content, engine: 'markdown'}).split('\n').join('')}</span></div>`
|
if (color) group += `color: ${color}`
|
||||||
|
group += '"'
|
||||||
|
|
||||||
|
return `<span class="hide-inline"><a class="hide-button button--primary button--animated" ${group}>${display}
|
||||||
|
</a><span class="hide-content">${content}</span></span>`
|
||||||
}
|
}
|
||||||
|
|
||||||
hexo.extend.tag.register('hideInline', hideInline);
|
function hideBlock (args, content) {
|
||||||
hexo.extend.tag.register('hideBlock', hideBlock, {ends: true});
|
args = args.join(' ').split(',')
|
||||||
|
var display = args[0] || 'Click'
|
||||||
|
var bg = args[1] || false
|
||||||
|
var color = args[2] || false
|
||||||
|
var group = 'style="'
|
||||||
|
|
||||||
|
if (bg) group += `background-color: ${bg};`
|
||||||
|
if (color) group += `color: ${color}`
|
||||||
|
group += '"'
|
||||||
|
|
||||||
|
return `<div class="hide-block"><a class="hide-button button--primary button--animated" ${group}>${display}
|
||||||
|
</a><span class="hide-content">${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}</span></div>`
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideToggle (args, content) {
|
||||||
|
args = args.join(' ').split(',')
|
||||||
|
var display = args[0]
|
||||||
|
var bg = args[1] || false
|
||||||
|
var color = args[2] || false
|
||||||
|
var group = 'style="'
|
||||||
|
var border = ''
|
||||||
|
|
||||||
|
if (bg) {
|
||||||
|
border = `style="border: 1px solid ${bg}"`
|
||||||
|
group += `background-color: ${bg};`
|
||||||
|
}
|
||||||
|
if (color) group += `color: ${color}`
|
||||||
|
group += '"'
|
||||||
|
|
||||||
|
return `<div class="hide-toggle" ${border}><div class="hide-button toggle-title" ${group}><i class="fa fa-caret-right fa-fw"></i><span>${display}</span></div>
|
||||||
|
<div class="hide-content">${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}</div></div>`
|
||||||
|
}
|
||||||
|
|
||||||
|
hexo.extend.tag.register('hideInline', hideInline)
|
||||||
|
hexo.extend.tag.register('hideBlock', hideBlock, { ends: true })
|
||||||
|
hexo.extend.tag.register('hideToggle', hideToggle, { ends: true })
|
||||||
|
|||||||
@@ -1,7 +1,15 @@
|
|||||||
|
/**
|
||||||
|
* Butterfly
|
||||||
|
* mermaid
|
||||||
|
* https://github.com/mermaid-js/mermaid
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict'
|
||||||
|
|
||||||
function mermaid (args, content) {
|
function mermaid (args, content) {
|
||||||
return `<div class="mermaid">
|
return `<div class="mermaid">
|
||||||
${content}
|
${content}
|
||||||
</div>`;
|
</div>`
|
||||||
}
|
}
|
||||||
|
|
||||||
hexo.extend.tag.register('mermaid', mermaid, {ends: true});
|
hexo.extend.tag.register('mermaid', mermaid, { ends: true })
|
||||||
|
|||||||
@@ -3,13 +3,13 @@
|
|||||||
* transplant from hexo-theme-next
|
* transplant from hexo-theme-next
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict'
|
||||||
|
|
||||||
function postNote (args, content) {
|
function postNote (args, content) {
|
||||||
return `<div class="note ${args.join(' ')}">
|
return `<div class="note ${args.join(' ')}">
|
||||||
${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}
|
${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}
|
||||||
</div>`;
|
</div>`
|
||||||
}
|
}
|
||||||
|
|
||||||
hexo.extend.tag.register('note', postNote, {ends: true});
|
hexo.extend.tag.register('note', postNote, { ends: true })
|
||||||
hexo.extend.tag.register('subnote', postNote, {ends: true});
|
hexo.extend.tag.register('subnote', postNote, { ends: true })
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ h6
|
|||||||
left: $sidebar-icon-left
|
left: $sidebar-icon-left
|
||||||
z-index: 100
|
z-index: 100
|
||||||
font-size: $sidebar-icon-size
|
font-size: $sidebar-icon-size
|
||||||
opacity: 0
|
// opacity: 0
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
transition: all .2s
|
transition: all .2s
|
||||||
|
|
||||||
@@ -143,6 +143,9 @@ table
|
|||||||
.is_visible
|
.is_visible
|
||||||
display: block !important
|
display: block !important
|
||||||
|
|
||||||
|
.is-visible-inline
|
||||||
|
display: inline-block !important
|
||||||
|
|
||||||
.is_invisible
|
.is_invisible
|
||||||
display: none !important
|
display: none !important
|
||||||
|
|
||||||
@@ -187,6 +190,13 @@ img[src=''],
|
|||||||
img:not([src])
|
img:not([src])
|
||||||
opacity: 0
|
opacity: 0
|
||||||
|
|
||||||
|
.img-alt
|
||||||
|
margin: -.5rem 0 .5rem
|
||||||
|
color: $font-black
|
||||||
|
|
||||||
|
&:hover
|
||||||
|
text-decoration: none !important
|
||||||
|
|
||||||
// hexo tag video
|
// hexo tag video
|
||||||
.video-container
|
.video-container
|
||||||
position: relative
|
position: relative
|
||||||
@@ -203,39 +213,18 @@ img:not([src])
|
|||||||
width: 100%
|
width: 100%
|
||||||
height: 100%
|
height: 100%
|
||||||
|
|
||||||
// tag-hide
|
|
||||||
.hide-inline,
|
|
||||||
.hide-block
|
|
||||||
& > .hide-button
|
|
||||||
position: relative
|
|
||||||
z-index: 1
|
|
||||||
display: inline-block
|
|
||||||
padding: 0 1rem
|
|
||||||
background: $tag-hide-bg
|
|
||||||
text-align: center
|
|
||||||
cursor: pointer
|
|
||||||
|
|
||||||
&:hover
|
|
||||||
text-decoration: none !important
|
|
||||||
|
|
||||||
& > .hide-content
|
|
||||||
display: none
|
|
||||||
|
|
||||||
.hide-inline
|
|
||||||
& > .hide-button
|
|
||||||
margin: 0 .3rem
|
|
||||||
|
|
||||||
& > .hide-content
|
|
||||||
margin: 0 .3rem
|
|
||||||
|
|
||||||
.hide-block
|
|
||||||
margin: 0 0 .8rem
|
|
||||||
|
|
||||||
.comment_headling
|
.comment_headling
|
||||||
margin-bottom: 10px
|
margin-bottom: 10px
|
||||||
font-weight: 700
|
font-weight: 700
|
||||||
font-size: 20px
|
font-size: 20px
|
||||||
|
|
||||||
|
.post-ad
|
||||||
|
margin: 2rem 0
|
||||||
|
|
||||||
|
.ad_height
|
||||||
|
display: block !important
|
||||||
|
height: auto !important
|
||||||
|
|
||||||
#content-inner,
|
#content-inner,
|
||||||
#footer
|
#footer
|
||||||
animation: main 1s
|
animation: main 1s
|
||||||
@@ -243,17 +232,17 @@ img:not([src])
|
|||||||
#nav
|
#nav
|
||||||
animation: nav-effect 1s
|
animation: nav-effect 1s
|
||||||
|
|
||||||
#page-header
|
|
||||||
animation: header-effect 1s
|
|
||||||
|
|
||||||
#site_title,
|
#site_title,
|
||||||
#site_subtitle
|
#site_subtitle
|
||||||
animation: titlescale 1s
|
animation: titlescale 1s
|
||||||
|
|
||||||
canvas,
|
canvas:not(#ribbon-canvas),
|
||||||
#web_bg
|
#web_bg
|
||||||
animation: to_show 4s
|
animation: to_show 4s
|
||||||
|
|
||||||
|
#ribbon-canvas
|
||||||
|
animation: ribbon_to_show 4s
|
||||||
|
|
||||||
.card-announcement-animation
|
.card-announcement-animation
|
||||||
color: #FF0000
|
color: #FF0000
|
||||||
animation: announ_animation .8s linear infinite
|
animation: announ_animation .8s linear infinite
|
||||||
@@ -280,10 +269,10 @@ if hexo-config('avatar.effect') == true
|
|||||||
|
|
||||||
.tocOpenMobile
|
.tocOpenMobile
|
||||||
.sidebar-toc__title
|
.sidebar-toc__title
|
||||||
animation: tocsidebarRtoL .5s
|
animation: tocsidebarRtoL .4s
|
||||||
|
|
||||||
.sidebar-toc__progress
|
.sidebar-toc__progress
|
||||||
animation: tocsidebarRtoL .5s
|
animation: tocsidebarRtoL .6s
|
||||||
|
|
||||||
.sidebar-toc__content
|
.sidebar-toc__content
|
||||||
animation: tocsidebarRtoL .7s
|
animation: tocsidebarRtoL .7s
|
||||||
@@ -310,18 +299,6 @@ if hexo-config('avatar.effect') == true
|
|||||||
opacity: 1
|
opacity: 1
|
||||||
transform: translateY(0)
|
transform: translateY(0)
|
||||||
|
|
||||||
@keyframes header-effect
|
|
||||||
0%
|
|
||||||
opacity: 0
|
|
||||||
|
|
||||||
50%
|
|
||||||
opacity: 0
|
|
||||||
transform: translateY(-50px)
|
|
||||||
|
|
||||||
100%
|
|
||||||
opacity: 1
|
|
||||||
transform: translateY(0)
|
|
||||||
|
|
||||||
@keyframes headerNoOpacity
|
@keyframes headerNoOpacity
|
||||||
0%
|
0%
|
||||||
transform: translateY(-50px)
|
transform: translateY(-50px)
|
||||||
@@ -363,6 +340,13 @@ if hexo-config('avatar.effect') == true
|
|||||||
100%
|
100%
|
||||||
opacity: 1
|
opacity: 1
|
||||||
|
|
||||||
|
@keyframes ribbon_to_show
|
||||||
|
0%
|
||||||
|
opacity: 0
|
||||||
|
|
||||||
|
100%
|
||||||
|
opacity: hexo-config('canvas_ribbon.alpha')
|
||||||
|
|
||||||
@keyframes avatar_turn_around
|
@keyframes avatar_turn_around
|
||||||
from
|
from
|
||||||
transform: rotate(0)
|
transform: rotate(0)
|
||||||
|
|||||||
@@ -271,6 +271,3 @@ blockquote
|
|||||||
background: darken($highlight-background, 5)
|
background: darken($highlight-background, 5)
|
||||||
color: $highlight-foreground
|
color: $highlight-foreground
|
||||||
font-size: 14px
|
font-size: 14px
|
||||||
|
|
||||||
.highlight-close
|
|
||||||
height: 0 !important
|
|
||||||
@@ -16,14 +16,13 @@
|
|||||||
|
|
||||||
.card-info
|
.card-info
|
||||||
img
|
img
|
||||||
display: inline-block
|
|
||||||
width: 110px
|
width: 110px
|
||||||
height: 110px
|
height: 110px
|
||||||
border-radius: 70px
|
border-radius: 70px
|
||||||
transition: all .3s
|
transition: all .5s
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
transform: rotate(540deg)
|
transform: rotate(360deg)
|
||||||
|
|
||||||
.author-info
|
.author-info
|
||||||
&__name
|
&__name
|
||||||
@@ -34,23 +33,24 @@
|
|||||||
margin-top: -.3rem
|
margin-top: -.3rem
|
||||||
|
|
||||||
.card-info-data
|
.card-info-data
|
||||||
|
display: table
|
||||||
padding: .7rem 0
|
padding: .7rem 0
|
||||||
|
width: 100%
|
||||||
|
table-layout: fixed
|
||||||
|
|
||||||
& > .card-info-data-item
|
& > .card-info-data-item
|
||||||
display: inline-block
|
display: table-cell
|
||||||
width: 33.3%
|
|
||||||
|
|
||||||
a
|
a
|
||||||
.headline
|
.headline
|
||||||
display: block
|
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
color: $font-black
|
color: $font-black
|
||||||
// text-transform: uppercase
|
|
||||||
text-overflow: ellipsis
|
text-overflow: ellipsis
|
||||||
white-space: nowrap
|
white-space: nowrap
|
||||||
font-size: .7rem
|
font-size: .7rem
|
||||||
|
|
||||||
.length_num
|
.length_num
|
||||||
|
margin-top: -.3rem
|
||||||
color: $dark-black
|
color: $dark-black
|
||||||
font-size: 1rem
|
font-size: 1rem
|
||||||
|
|
||||||
@@ -75,7 +75,6 @@
|
|||||||
display: block
|
display: block
|
||||||
background-color: $light-blue
|
background-color: $light-blue
|
||||||
color: $button-color
|
color: $button-color
|
||||||
text-transform: uppercase
|
|
||||||
line-height: 1.6rem
|
line-height: 1.6rem
|
||||||
|
|
||||||
span
|
span
|
||||||
@@ -92,7 +91,8 @@
|
|||||||
|
|
||||||
.card-tag-cloud
|
.card-tag-cloud
|
||||||
a
|
a
|
||||||
word-break: keep-all
|
display: inline-block
|
||||||
|
padding: 0 .1rem
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
color: $light-blue !important
|
color: $light-blue !important
|
||||||
@@ -147,20 +147,20 @@
|
|||||||
.aside-post_title
|
.aside-post_title
|
||||||
height: auto
|
height: auto
|
||||||
|
|
||||||
.card-archives ul.archive-list,
|
.card-archives ul.card-archive-list,
|
||||||
.card-categories ul.aside-category-item
|
.card-categories ul.card-category-list
|
||||||
margin: 0
|
margin: 0
|
||||||
padding: .2rem 0 0
|
padding: .2rem 0 0
|
||||||
list-style: none
|
list-style: none
|
||||||
|
|
||||||
.card-archives ul.archive-list > .archive-list-item,
|
.card-archives ul.card-archive-list > .card-archive-list-item,
|
||||||
.card-categories ul.aside-category-item > .aside-category-list
|
.card-categories ul.card-category-list > .card-category-list-item
|
||||||
padding: .2rem 1rem
|
padding: .15rem 1rem
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
transition: all .3s
|
transition: all .5s
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
padding: .2rem .85rem
|
padding: .15rem .85rem
|
||||||
background-color: $light-blue
|
background-color: $light-blue
|
||||||
|
|
||||||
a
|
a
|
||||||
@@ -180,15 +180,21 @@
|
|||||||
width: 20%
|
width: 20%
|
||||||
text-align: right
|
text-align: right
|
||||||
|
|
||||||
|
&.more
|
||||||
|
span
|
||||||
|
padding-right: .3rem
|
||||||
|
width: auto !important
|
||||||
|
transition: .5s
|
||||||
|
|
||||||
|
&:hover
|
||||||
|
span
|
||||||
|
padding-right: .6rem
|
||||||
|
|
||||||
.card-categories
|
.card-categories
|
||||||
.aside-category-item
|
.card-category-list
|
||||||
&.child
|
&.child
|
||||||
padding: 0 0 0 1.2rem
|
padding: 0 0 0 1.2rem
|
||||||
|
|
||||||
.card-archives
|
|
||||||
.archive-list-link-more
|
|
||||||
justify-content: center
|
|
||||||
|
|
||||||
.card-webinfo
|
.card-webinfo
|
||||||
.webinfo
|
.webinfo
|
||||||
padding: .2rem 1rem
|
padding: .2rem 1rem
|
||||||
|
|||||||
@@ -52,6 +52,9 @@
|
|||||||
border-radius: 35px
|
border-radius: 35px
|
||||||
transition: all .3s
|
transition: all .3s
|
||||||
|
|
||||||
|
.img-alt
|
||||||
|
display: none
|
||||||
|
|
||||||
.md-links-title
|
.md-links-title
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
padding: 16px 10px 0 0
|
padding: 16px 10px 0 0
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
margin: 0 .5rem
|
margin: 0 .5rem
|
||||||
color: $light-grey
|
color: $light-grey
|
||||||
text-shadow: .1rem .1rem .2rem rgba(0, 0, 0, .15)
|
text-shadow: .1rem .1rem .2rem rgba(0, 0, 0, .15)
|
||||||
font-size: .9rem
|
font-size: 1rem
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
|
|
||||||
#scroll_down
|
#scroll_down
|
||||||
@@ -101,6 +101,12 @@
|
|||||||
-webkit-box-orient: vertical
|
-webkit-box-orient: vertical
|
||||||
|
|
||||||
#post-meta
|
#post-meta
|
||||||
|
font-size: 95%
|
||||||
|
|
||||||
|
> .meta-secondline,
|
||||||
|
> .meta-thirdline
|
||||||
|
display: inline
|
||||||
|
|
||||||
.word-count,
|
.word-count,
|
||||||
#busuanzi_value_page_pv,
|
#busuanzi_value_page_pv,
|
||||||
.comment-count
|
.comment-count
|
||||||
@@ -113,9 +119,6 @@
|
|||||||
&__icon
|
&__icon
|
||||||
margin-right: .2rem
|
margin-right: .2rem
|
||||||
|
|
||||||
&-pv-cv
|
|
||||||
display: inline-block
|
|
||||||
|
|
||||||
a
|
a
|
||||||
color: $light-grey
|
color: $light-grey
|
||||||
transition: all .3s ease-out
|
transition: all .3s ease-out
|
||||||
@@ -133,16 +136,22 @@
|
|||||||
height: 58px
|
height: 58px
|
||||||
border: none
|
border: none
|
||||||
font-size: 18px
|
font-size: 18px
|
||||||
|
opacity: 0
|
||||||
transition: all .5s
|
transition: all .5s
|
||||||
|
|
||||||
|
&:not(.fixed)
|
||||||
|
.menus
|
||||||
|
padding-right: 0 !important
|
||||||
|
|
||||||
.toggle-menu
|
.toggle-menu
|
||||||
display: none
|
display: none
|
||||||
padding: .1rem 0 0 .3rem
|
padding: .1rem 0 0 .3rem
|
||||||
|
vertical-align: top
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
color: $white
|
color: $white
|
||||||
|
|
||||||
&.is_visible
|
&.is-visible-inline
|
||||||
.site-page
|
.site-page
|
||||||
font-size: inherit
|
font-size: inherit
|
||||||
|
|
||||||
@@ -160,11 +169,6 @@
|
|||||||
box-shadow: 0 5px 6px -5px alpha($grey, .6)
|
box-shadow: 0 5px 6px -5px alpha($grey, .6)
|
||||||
transition: transform .2s ease-in-out, opacity .2s ease-in-out
|
transition: transform .2s ease-in-out, opacity .2s ease-in-out
|
||||||
|
|
||||||
&.open-sidebar
|
|
||||||
.menus,
|
|
||||||
#search_button
|
|
||||||
display: none
|
|
||||||
|
|
||||||
a,
|
a,
|
||||||
#site-name,
|
#site-name,
|
||||||
.toggle-menu
|
.toggle-menu
|
||||||
@@ -186,6 +190,9 @@
|
|||||||
font-weight: bold
|
font-weight: bold
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
|
|
||||||
|
.menus_items
|
||||||
|
display: inline
|
||||||
|
|
||||||
.menus_item
|
.menus_item
|
||||||
position: relative
|
position: relative
|
||||||
display: inline-block
|
display: inline-block
|
||||||
@@ -239,18 +246,20 @@
|
|||||||
content: ''
|
content: ''
|
||||||
|
|
||||||
li
|
li
|
||||||
padding: 1px 10px
|
|
||||||
list-style: none
|
list-style: none
|
||||||
text-align: center
|
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
background: $theme-color
|
background: $theme-color
|
||||||
|
|
||||||
a
|
a
|
||||||
|
display: inline-block
|
||||||
|
padding: .3rem .7rem
|
||||||
|
width: 100%
|
||||||
color: $font-black
|
color: $font-black
|
||||||
text-shadow: none
|
text-shadow: none
|
||||||
|
|
||||||
#search_button
|
#search_button
|
||||||
|
display: inline
|
||||||
padding: 0 0 0 .7rem
|
padding: 0 0 0 .7rem
|
||||||
|
|
||||||
.site-page
|
.site-page
|
||||||
@@ -295,11 +304,17 @@
|
|||||||
& > #post-meta
|
& > #post-meta
|
||||||
font-size: 90%
|
font-size: 90%
|
||||||
|
|
||||||
& > span
|
.post-meta__categories
|
||||||
display: none
|
display: none
|
||||||
|
|
||||||
.post-meta-pv-cv
|
.meta-thirdline
|
||||||
display: block
|
display: block
|
||||||
|
|
||||||
|
.post-meta-pv-cv
|
||||||
.post-meta__separator:first-child
|
.post-meta__separator:first-child
|
||||||
display: none
|
display: none
|
||||||
|
|
||||||
|
if !hexo-config('busuanzi.page_pv')
|
||||||
|
.post-meta-commentcount
|
||||||
|
.post-meta__separator
|
||||||
|
display: none
|
||||||
94
source/css/_layout/loadding.styl
Normal file
94
source/css/_layout/loadding.styl
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
if hexo-config('preloader')
|
||||||
|
loading-bg()
|
||||||
|
position: fixed
|
||||||
|
z-index: 1000
|
||||||
|
width: 50%
|
||||||
|
height: 100%
|
||||||
|
background-color: $preloader-bg
|
||||||
|
transition: all .5s
|
||||||
|
|
||||||
|
#loading-box
|
||||||
|
.loading-left-bg
|
||||||
|
loading-bg()
|
||||||
|
|
||||||
|
.loading-right-bg
|
||||||
|
loading-bg()
|
||||||
|
right: 0
|
||||||
|
|
||||||
|
.spinner-box
|
||||||
|
position: fixed
|
||||||
|
z-index: 1001
|
||||||
|
display: flex
|
||||||
|
justify-content: center
|
||||||
|
align-items: center
|
||||||
|
width: 100%
|
||||||
|
height: 100vh
|
||||||
|
|
||||||
|
.configure-border-1
|
||||||
|
position: absolute
|
||||||
|
padding: 3px
|
||||||
|
width: 115px
|
||||||
|
height: 115px
|
||||||
|
background: #ffab91
|
||||||
|
animation: configure-clockwise 3s ease-in-out 0s infinite alternate
|
||||||
|
|
||||||
|
.configure-border-2
|
||||||
|
left: -115px
|
||||||
|
padding: 3px
|
||||||
|
width: 115px
|
||||||
|
height: 115px
|
||||||
|
background: rgb(63, 249, 220)
|
||||||
|
transform: rotate(45deg)
|
||||||
|
animation: configure-xclockwise 3s ease-in-out 0s infinite alternate
|
||||||
|
|
||||||
|
.loading-word
|
||||||
|
position: absolute
|
||||||
|
color: $white
|
||||||
|
font-size: .8rem
|
||||||
|
|
||||||
|
.configure-core
|
||||||
|
width: 100%
|
||||||
|
height: 100%
|
||||||
|
background-color: $preloader-bg
|
||||||
|
|
||||||
|
&.loaded
|
||||||
|
.loading-left-bg
|
||||||
|
transform: translate(-100%, 0)
|
||||||
|
|
||||||
|
.loading-right-bg
|
||||||
|
transform: translate(100%, 0)
|
||||||
|
|
||||||
|
.spinner-box
|
||||||
|
display: none
|
||||||
|
|
||||||
|
@keyframes configure-clockwise
|
||||||
|
0%
|
||||||
|
transform: rotate(0)
|
||||||
|
|
||||||
|
25%
|
||||||
|
transform: rotate(90deg)
|
||||||
|
|
||||||
|
50%
|
||||||
|
transform: rotate(180deg)
|
||||||
|
|
||||||
|
75%
|
||||||
|
transform: rotate(270deg)
|
||||||
|
|
||||||
|
100%
|
||||||
|
transform: rotate(360deg)
|
||||||
|
|
||||||
|
@keyframes configure-xclockwise
|
||||||
|
0%
|
||||||
|
transform: rotate(45deg)
|
||||||
|
|
||||||
|
25%
|
||||||
|
transform: rotate(-45deg)
|
||||||
|
|
||||||
|
50%
|
||||||
|
transform: rotate(-135deg)
|
||||||
|
|
||||||
|
75%
|
||||||
|
transform: rotate(-225deg)
|
||||||
|
|
||||||
|
100%
|
||||||
|
transform: rotate(-315deg)
|
||||||
@@ -27,19 +27,22 @@
|
|||||||
text-align: center
|
text-align: center
|
||||||
|
|
||||||
img
|
img
|
||||||
display: inline-block
|
|
||||||
padding: 0
|
|
||||||
width: 110px
|
width: 110px
|
||||||
height: 110px
|
height: 110px
|
||||||
border-radius: 70px
|
border-radius: 70px
|
||||||
transition: all .3s
|
transition: all .5s
|
||||||
|
|
||||||
|
&:hover
|
||||||
|
transform: rotate(360deg)
|
||||||
|
|
||||||
.mobile_post_data
|
.mobile_post_data
|
||||||
|
display: table
|
||||||
padding: .6rem .5rem 0
|
padding: .6rem .5rem 0
|
||||||
|
width: 100%
|
||||||
|
table-layout: fixed
|
||||||
|
|
||||||
.mobile_data_item
|
.mobile_data_item
|
||||||
display: inline-block
|
display: table-cell
|
||||||
width: 33.3%
|
|
||||||
|
|
||||||
.mobile_data_link
|
.mobile_data_link
|
||||||
& > a > div
|
& > a > div
|
||||||
@@ -54,15 +57,13 @@
|
|||||||
.headline
|
.headline
|
||||||
display: block
|
display: block
|
||||||
color: $font-black
|
color: $font-black
|
||||||
// text-transform: uppercase
|
|
||||||
font-size: .7rem
|
font-size: .7rem
|
||||||
|
|
||||||
hr
|
hr
|
||||||
margin: 1rem auto
|
margin: 1rem auto
|
||||||
|
|
||||||
.menus_items
|
.menus_items
|
||||||
margin-bottom: 5rem
|
padding: 0 .5rem 2rem
|
||||||
padding: 0 .5rem
|
|
||||||
|
|
||||||
.site-page
|
.site-page
|
||||||
position: relative
|
position: relative
|
||||||
|
|||||||
@@ -100,6 +100,7 @@
|
|||||||
|
|
||||||
& > time
|
& > time
|
||||||
color: $theme-meta-color
|
color: $theme-meta-color
|
||||||
|
cursor: pointer
|
||||||
|
|
||||||
& > .article-meta
|
& > .article-meta
|
||||||
color: $theme-meta-color
|
color: $theme-meta-color
|
||||||
@@ -129,7 +130,7 @@
|
|||||||
display: -webkit-box
|
display: -webkit-box
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
margin-top: .3rem
|
margin-top: .3rem
|
||||||
height: 85px
|
// height: 85px
|
||||||
word-break: break-word
|
word-break: break-word
|
||||||
-webkit-line-clamp: 3
|
-webkit-line-clamp: 3
|
||||||
-webkit-box-orient: vertical
|
-webkit-box-orient: vertical
|
||||||
@@ -269,7 +270,7 @@
|
|||||||
-webkit-box-orient: vertical
|
-webkit-box-orient: vertical
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
color: $light-blue
|
color: $light-blue !important
|
||||||
transform: translateX(20px)
|
transform: translateX(20px)
|
||||||
|
|
||||||
&__img
|
&__img
|
||||||
@@ -379,3 +380,9 @@
|
|||||||
.layout_page
|
.layout_page
|
||||||
& > div:first-child:not(.recent-posts)
|
& > div:first-child:not(.recent-posts)
|
||||||
width: 100% !important
|
width: 100% !important
|
||||||
|
|
||||||
|
// ie10-ios11使用
|
||||||
|
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active)
|
||||||
|
.recent-post-info
|
||||||
|
.content
|
||||||
|
height: 90px
|
||||||
|
|||||||
@@ -163,9 +163,6 @@ a.fancybox
|
|||||||
width: 100%
|
width: 100%
|
||||||
text-align: center
|
text-align: center
|
||||||
|
|
||||||
p
|
|
||||||
margin: 0 0 .8rem
|
|
||||||
|
|
||||||
img
|
img
|
||||||
max-width: 100%
|
max-width: 100%
|
||||||
transition: all .2s
|
transition: all .2s
|
||||||
@@ -328,6 +325,9 @@ img
|
|||||||
img
|
img
|
||||||
margin: 0 auto .8rem
|
margin: 0 auto .8rem
|
||||||
|
|
||||||
|
p
|
||||||
|
margin: 0 0 .8rem
|
||||||
|
|
||||||
@media screen and (max-width: 1024px)
|
@media screen and (max-width: 1024px)
|
||||||
.layout_post
|
.layout_post
|
||||||
width: auto
|
width: auto
|
||||||
@@ -338,3 +338,14 @@ img
|
|||||||
|
|
||||||
& > #post
|
& > #post
|
||||||
padding: 1.8rem .7rem
|
padding: 1.8rem .7rem
|
||||||
|
|
||||||
|
// adjust the layout width in big screen
|
||||||
|
@media screen and (min-width: $lr)
|
||||||
|
.layout_post
|
||||||
|
max-width: 1300px
|
||||||
|
|
||||||
|
.layout_page
|
||||||
|
max-width: 1500px
|
||||||
|
|
||||||
|
&.hide-aside
|
||||||
|
max-width: 1300px
|
||||||
@@ -1,28 +1,25 @@
|
|||||||
if hexo-config('valine.enable')
|
if hexo-config('valine.enable')
|
||||||
// valine
|
|
||||||
#vcomment
|
#vcomment
|
||||||
button
|
button
|
||||||
padding: .3rem 1rem
|
padding: .3rem .8rem
|
||||||
border-color: $button-color
|
border-color: $button-color
|
||||||
background-color: $light-blue
|
background-color: $light-blue
|
||||||
color: $button-color
|
color: $button-color
|
||||||
font-size: .7rem
|
font-size: .7rem
|
||||||
|
transition: all .3s
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
background-color: $theme-button-hover-color
|
background-color: $theme-button-hover-color
|
||||||
|
|
||||||
textarea
|
|
||||||
if hexo-config('valine.bg')
|
if hexo-config('valine.bg')
|
||||||
|
textarea
|
||||||
background: url(hexo-config('valine.bg')) 100% 100% no-repeat
|
background: url(hexo-config('valine.bg')) 100% 100% no-repeat
|
||||||
|
|
||||||
.info
|
|
||||||
display: none
|
|
||||||
|
|
||||||
.vimg
|
.vimg
|
||||||
border: 0
|
transition: all .3s
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
transform: rotate(540deg)
|
transform: rotate(360deg)
|
||||||
|
|
||||||
.vat
|
.vat
|
||||||
padding: 0 .8rem
|
padding: 0 .8rem
|
||||||
@@ -30,6 +27,7 @@ if hexo-config('valine.enable')
|
|||||||
border-radius: 5px
|
border-radius: 5px
|
||||||
color: $light-blue
|
color: $light-blue
|
||||||
font-size: .7125rem
|
font-size: .7125rem
|
||||||
|
transition: all .3s
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
background-color: $light-blue
|
background-color: $light-blue
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
if hexo-config('darkmode.enable')
|
if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
|
||||||
[data-theme='dark']
|
[data-theme='dark']
|
||||||
body
|
body
|
||||||
background-color: darken(#121212, 2)
|
background-color: darken(#121212, 2)
|
||||||
@@ -39,7 +39,21 @@ if hexo-config('darkmode.enable')
|
|||||||
.article-title
|
.article-title
|
||||||
color: alpha(#FFFFFF, .8) !important
|
color: alpha(#FFFFFF, .8) !important
|
||||||
|
|
||||||
#page-header
|
// 頭部
|
||||||
|
#nav
|
||||||
|
&:before
|
||||||
|
position: absolute
|
||||||
|
top: 0
|
||||||
|
right: 0
|
||||||
|
bottom: 0
|
||||||
|
left: 0
|
||||||
|
background-color: alpha($dark-black, .7)
|
||||||
|
content: ''
|
||||||
|
|
||||||
|
& > #page-header
|
||||||
|
a
|
||||||
|
color: alpha(#FFFFFF, .8) !important
|
||||||
|
|
||||||
&.fixed
|
&.fixed
|
||||||
background: alpha(#121212, .8)
|
background: alpha(#121212, .8)
|
||||||
box-shadow: 0 5px 6px -5px rgba(133, 133, 133, 0)
|
box-shadow: 0 5px 6px -5px rgba(133, 133, 133, 0)
|
||||||
@@ -54,9 +68,13 @@ if hexo-config('darkmode.enable')
|
|||||||
|
|
||||||
li
|
li
|
||||||
&:hover
|
&:hover
|
||||||
background: lighten(#121212, 20)
|
background: lighten(#121212, 20) !important
|
||||||
|
|
||||||
a
|
a
|
||||||
|
color: alpha(#FFFFFF, .8)
|
||||||
|
|
||||||
|
#site_subtitle
|
||||||
|
& > span
|
||||||
color: alpha(#FFFFFF, .6)
|
color: alpha(#FFFFFF, .6)
|
||||||
|
|
||||||
// 代碼框
|
// 代碼框
|
||||||
@@ -109,6 +127,9 @@ if hexo-config('darkmode.enable')
|
|||||||
.post-copyright-info
|
.post-copyright-info
|
||||||
color: alpha(#FFFFFF, .6)
|
color: alpha(#FFFFFF, .6)
|
||||||
|
|
||||||
|
&:after
|
||||||
|
background: #121212
|
||||||
|
|
||||||
// 音樂播放器
|
// 音樂播放器
|
||||||
.aplayer
|
.aplayer
|
||||||
filter: brightness(.7)
|
filter: brightness(.7)
|
||||||
@@ -120,11 +141,11 @@ if hexo-config('darkmode.enable')
|
|||||||
& > i,
|
& > i,
|
||||||
& > a,
|
& > a,
|
||||||
& > div
|
& > div
|
||||||
background-color: lighten(#121212, 5) !important
|
background-color: lighten(#121212, 5)
|
||||||
color: alpha(#FFFFFF, .6) !important
|
color: alpha(#FFFFFF, .6)
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
background: lighten(#121212, 20) !important
|
background: lighten(#121212, 20)
|
||||||
|
|
||||||
// 打賞按鈕
|
// 打賞按鈕
|
||||||
.post-reward
|
.post-reward
|
||||||
@@ -138,8 +159,8 @@ if hexo-config('darkmode.enable')
|
|||||||
border-top: 13px solid lighten(#121212, 10) !important
|
border-top: 13px solid lighten(#121212, 10) !important
|
||||||
|
|
||||||
.md-links-item:before,
|
.md-links-item:before,
|
||||||
.aside-category-list:hover,
|
.card-category-list-item:hover,
|
||||||
.archive-list-item:hover,
|
.card-archive-list-item:hover,
|
||||||
#bookmark-it
|
#bookmark-it
|
||||||
background-color: lighten(#121212, 10) !important
|
background-color: lighten(#121212, 10) !important
|
||||||
|
|
||||||
@@ -156,33 +177,21 @@ if hexo-config('darkmode.enable')
|
|||||||
.headline,
|
.headline,
|
||||||
.length_num,
|
.length_num,
|
||||||
.aside-post_title,
|
.aside-post_title,
|
||||||
.aside-category-list_link,
|
.card-category-list-link,
|
||||||
.archive-list-link,
|
.card-archive-list-link,
|
||||||
.social-icon
|
.social-icon,
|
||||||
|
.card-category-list-link-more,
|
||||||
|
.card-archive-list-link-more
|
||||||
color: alpha(#FFFFFF, .6) !important
|
color: alpha(#FFFFFF, .6) !important
|
||||||
|
|
||||||
.button--animated:before
|
.button--animated:before
|
||||||
background: lighten(#121212, 20) !important
|
background: lighten(#121212, 20)
|
||||||
|
|
||||||
// 頭部
|
|
||||||
#nav
|
|
||||||
&:before
|
|
||||||
position: absolute
|
|
||||||
top: 0
|
|
||||||
right: 0
|
|
||||||
bottom: 0
|
|
||||||
left: 0
|
|
||||||
background-color: alpha($dark-black, .7)
|
|
||||||
content: ''
|
|
||||||
|
|
||||||
#nav span,
|
|
||||||
#nav i,
|
|
||||||
#page-header a,
|
|
||||||
#page-header .toggle-menu,
|
|
||||||
#post-meta,
|
#post-meta,
|
||||||
#post-meta a,
|
#post-meta a,
|
||||||
#footer-wrap,
|
#footer-wrap,
|
||||||
#footer-wrap a
|
#footer-wrap a,
|
||||||
|
.img-alt
|
||||||
color: alpha(#FFFFFF, .6) !important
|
color: alpha(#FFFFFF, .6) !important
|
||||||
|
|
||||||
.posttitle,
|
.posttitle,
|
||||||
@@ -215,11 +224,13 @@ if hexo-config('darkmode.enable')
|
|||||||
color: alpha(#FFFFFF, .8) !important
|
color: alpha(#FFFFFF, .8) !important
|
||||||
|
|
||||||
// 時間軸界面
|
// 時間軸界面
|
||||||
.article-sort-item__title
|
.article-sort
|
||||||
|
&-item__title
|
||||||
color: alpha(#FFFFFF, .6)
|
color: alpha(#FFFFFF, .6)
|
||||||
|
|
||||||
&:hover
|
&-item:before,
|
||||||
color: #49b1f5
|
&-title:before
|
||||||
|
background: #121212
|
||||||
|
|
||||||
// 手機 MENU,TOC
|
// 手機 MENU,TOC
|
||||||
#mobile-sidebar
|
#mobile-sidebar
|
||||||
@@ -245,6 +256,10 @@ if hexo-config('darkmode.enable')
|
|||||||
filter: brightness(.7)
|
filter: brightness(.7)
|
||||||
color: #4c4948
|
color: #4c4948
|
||||||
|
|
||||||
|
// hide-tags
|
||||||
|
.hide-button
|
||||||
|
filter: brightness(.7)
|
||||||
|
|
||||||
// 第三方
|
// 第三方
|
||||||
// 插件 hexo-blog-encrypt
|
// 插件 hexo-blog-encrypt
|
||||||
#hexo-blog-encrypt
|
#hexo-blog-encrypt
|
||||||
@@ -255,6 +270,9 @@ if hexo-config('darkmode.enable')
|
|||||||
input
|
input
|
||||||
background-color: #121212
|
background-color: #121212
|
||||||
|
|
||||||
|
.mermaid
|
||||||
|
filter: brightness(.7)
|
||||||
|
|
||||||
if hexo-config('gitalk') && hexo-config('gitalk.enable')
|
if hexo-config('gitalk') && hexo-config('gitalk.enable')
|
||||||
#gitalk-container
|
#gitalk-container
|
||||||
.gt-header-textarea,
|
.gt-header-textarea,
|
||||||
@@ -268,61 +286,16 @@ if hexo-config('darkmode.enable')
|
|||||||
fill: alpha(#FFFFFF, .6) !important
|
fill: alpha(#FFFFFF, .6) !important
|
||||||
|
|
||||||
if hexo-config('valine') && hexo-config('valine.enable')
|
if hexo-config('valine') && hexo-config('valine.enable')
|
||||||
// 評論
|
|
||||||
#vcomment
|
#vcomment
|
||||||
p,
|
|
||||||
a,
|
|
||||||
textarea,
|
|
||||||
.vemoji-btn,
|
|
||||||
.vpreview-btn,
|
|
||||||
input,
|
|
||||||
path,
|
|
||||||
.vcount,
|
|
||||||
.vnum,
|
|
||||||
.vtime,
|
|
||||||
.vsys,
|
|
||||||
.vsys,
|
|
||||||
.vnick
|
|
||||||
color: alpha(#FFFFFF, .6) !important
|
|
||||||
|
|
||||||
.vsys
|
|
||||||
background: rgb(97, 106, 107) !important
|
|
||||||
|
|
||||||
.vbtn,
|
.vbtn,
|
||||||
.vat
|
.vat
|
||||||
border: 1px solid alpha(#FFFFFF, .6)
|
border: 1px solid alpha(#FFFFFF, .6)
|
||||||
background: lighten(#121212, 5) !important
|
background: #121212 !important
|
||||||
color: alpha(#FFFFFF, .6) !important
|
color: alpha(#FFFFFF, .6) !important
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
background: lighten(#121212, 20) !important
|
background: lighten(#121212, 20) !important
|
||||||
|
|
||||||
.vwrap
|
|
||||||
border: 1px solid alpha(#FFFFFF, .6)
|
|
||||||
|
|
||||||
input
|
|
||||||
border-bottom: 1px dashed #616a6b
|
|
||||||
|
|
||||||
.vh
|
|
||||||
border-bottom: 1px dashed #616a6b
|
|
||||||
|
|
||||||
pre
|
|
||||||
border: 1px solid alpha(#FFFFFF, .6)
|
|
||||||
background-color: #121212
|
|
||||||
|
|
||||||
code
|
|
||||||
background: transparent
|
|
||||||
|
|
||||||
code
|
|
||||||
background-color: #2c2c2c
|
|
||||||
color: alpha(#FFFFFF, .6)
|
|
||||||
|
|
||||||
.vcontent.expand:before
|
|
||||||
background: linear-gradient(180deg, hsla(0, 0, 0, 0), hsl(218, 8%, 19%))
|
|
||||||
|
|
||||||
.vcontent.expand:after
|
|
||||||
background: hsla(204, 5%, 22%, 1)
|
|
||||||
|
|
||||||
if hexo-config('local_search') && hexo-config('local_search.enable')
|
if hexo-config('local_search') && hexo-config('local_search.enable')
|
||||||
#local-search
|
#local-search
|
||||||
background: #121212
|
background: #121212
|
||||||
@@ -366,5 +339,12 @@ if hexo-config('darkmode.enable')
|
|||||||
blockquote
|
blockquote
|
||||||
color: alpha(#FFFFFF, .6)
|
color: alpha(#FFFFFF, .6)
|
||||||
|
|
||||||
.mermaid
|
if hexo-config('preloader')
|
||||||
filter: brightness(.7)
|
#loading-box
|
||||||
|
.loading-left-bg,
|
||||||
|
.loading-right-bg,
|
||||||
|
.configure-core
|
||||||
|
background-color: darken(#121212, 2)
|
||||||
|
|
||||||
|
.loading-word
|
||||||
|
color: alpha(#FFFFFF, .6)
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
if hexo-config('readmode') && hexo-config('readmode.enable')
|
if hexo-config('readmode') && hexo-config('readmode.enable')
|
||||||
[data-theme='light']
|
[data-theme='light']
|
||||||
|
$light-redmode-bg = #fff
|
||||||
|
|
||||||
.read-mode
|
.read-mode
|
||||||
background: #fff
|
background: $light-redmode-bg
|
||||||
|
|
||||||
#nav.post-bg
|
#nav.post-bg
|
||||||
a
|
a
|
||||||
@@ -17,12 +19,12 @@ if hexo-config('readmode') && hexo-config('readmode.enable')
|
|||||||
|
|
||||||
blockquote
|
blockquote
|
||||||
border-left: .2rem solid #ddd
|
border-left: .2rem solid #ddd
|
||||||
background-color: transparent
|
background-color: $light-redmode-bg
|
||||||
|
|
||||||
ol,
|
ol,
|
||||||
li
|
li
|
||||||
&:before
|
&:before
|
||||||
background: transparent
|
background: $light-redmode-bg
|
||||||
color: #4c4948
|
color: #4c4948
|
||||||
|
|
||||||
ul
|
ul
|
||||||
@@ -32,28 +34,40 @@ if hexo-config('readmode') && hexo-config('readmode.enable')
|
|||||||
|
|
||||||
hr
|
hr
|
||||||
border: 2px dashed #d6dbdf
|
border: 2px dashed #d6dbdf
|
||||||
background: transparent
|
background: $light-redmode-bg
|
||||||
|
|
||||||
&:before
|
&:before
|
||||||
color: darken(#d6dbdf, 10)
|
color: darken(#d6dbdf, 10)
|
||||||
|
|
||||||
|
.hide-toggle
|
||||||
|
border: 1px solid darken(#d6dbdf, 10) !important
|
||||||
|
|
||||||
.hide-button
|
.hide-button
|
||||||
background: darken(#d6dbdf, 10) !important
|
background: $light-redmode-bg !important
|
||||||
|
color: #4c4948 !important
|
||||||
|
|
||||||
|
.hide-inline,
|
||||||
|
.hide-block
|
||||||
|
& >.hide-button
|
||||||
|
border: 1px solid darken(#d6dbdf, 10)
|
||||||
|
|
||||||
|
& > .button--animated:before
|
||||||
|
background: $light-redmode-bg
|
||||||
|
|
||||||
.note
|
.note
|
||||||
border: 2px solid #eee
|
border: 2px solid #eee
|
||||||
border-left-color: transparent
|
background-color: $light-redmode-bg
|
||||||
background-color: transparent
|
|
||||||
|
|
||||||
#mobile-sidebar-menus,
|
#rightside i:not(.fa-cog),
|
||||||
#rightside i,
|
|
||||||
#rightside a,
|
#rightside a,
|
||||||
#rightside #rightside_config
|
#rightside #rightside_config
|
||||||
background: darken(#d6dbdf, 10) !important
|
background: darken(#d6dbdf, 20) !important
|
||||||
|
|
||||||
[data-theme='dark']
|
[data-theme='dark']
|
||||||
|
$dark-readmode-bg = #0d0d0d
|
||||||
|
|
||||||
.read-mode
|
.read-mode
|
||||||
background: #0d0d0d
|
background: $dark-readmode-bg
|
||||||
|
|
||||||
#article-container
|
#article-container
|
||||||
code
|
code
|
||||||
@@ -61,12 +75,12 @@ if hexo-config('readmode') && hexo-config('readmode.enable')
|
|||||||
|
|
||||||
blockquote
|
blockquote
|
||||||
border-left: .2rem solid rgba(255, 255, 255, .6)
|
border-left: .2rem solid rgba(255, 255, 255, .6)
|
||||||
background-color: transparent
|
background-color: $dark-readmode-bg
|
||||||
|
|
||||||
ol,
|
ol,
|
||||||
li
|
li
|
||||||
&:before
|
&:before
|
||||||
background: transparent
|
background: $dark-readmode-bg
|
||||||
color: rgba(255, 255, 255, .6)
|
color: rgba(255, 255, 255, .6)
|
||||||
|
|
||||||
ul
|
ul
|
||||||
@@ -74,15 +88,27 @@ if hexo-config('readmode') && hexo-config('readmode.enable')
|
|||||||
&:before
|
&:before
|
||||||
border: .15rem solid rgba(255, 255, 255, .6)
|
border: .15rem solid rgba(255, 255, 255, .6)
|
||||||
|
|
||||||
.note
|
.hide-toggle
|
||||||
border: 2px solid rgba(255, 255, 255, .6)
|
border: 1px solid rgba(255, 255, 255, .6) !important
|
||||||
border-left-color: transparent
|
|
||||||
filter: none
|
|
||||||
background-color: transparent
|
|
||||||
color: rgba(255, 255, 255, .6)
|
|
||||||
|
|
||||||
.hide-button
|
.hide-button
|
||||||
background: #1f1f1f !important
|
background: $dark-readmode-bg !important
|
||||||
|
filter: none
|
||||||
|
color: rgba(255, 255, 255, .6) !important
|
||||||
|
|
||||||
|
.hide-inline,
|
||||||
|
.hide-block
|
||||||
|
& >.hide-button
|
||||||
|
border: 1px solid rgba(255, 255, 255, .6)
|
||||||
|
|
||||||
|
& > .button--animated:before
|
||||||
|
background: $dark-readmode-bg !important
|
||||||
|
|
||||||
|
.note
|
||||||
|
border: 2px solid rgba(255, 255, 255, .6)
|
||||||
|
filter: none
|
||||||
|
background-color: $dark-readmode-bg
|
||||||
|
color: rgba(255, 255, 255, .6)
|
||||||
|
|
||||||
.read-mode
|
.read-mode
|
||||||
#body-wrap
|
#body-wrap
|
||||||
@@ -114,10 +140,6 @@ if hexo-config('readmode') && hexo-config('readmode.enable')
|
|||||||
.highlight
|
.highlight
|
||||||
display: block !important
|
display: block !important
|
||||||
|
|
||||||
#rightside
|
|
||||||
#darkmode
|
|
||||||
display: none
|
|
||||||
|
|
||||||
& > canvas
|
& > canvas
|
||||||
display: none !important
|
display: none !important
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,10 @@
|
|||||||
&:hover
|
&:hover
|
||||||
color: $search-color
|
color: $search-color
|
||||||
|
|
||||||
|
em
|
||||||
|
color: $search-keyword-highlight
|
||||||
|
font-weight: bold
|
||||||
|
|
||||||
.ais-pagination.pagination
|
.ais-pagination.pagination
|
||||||
margin: .8rem 0 0
|
margin: .8rem 0 0
|
||||||
padding: 0
|
padding: 0
|
||||||
|
|||||||
@@ -50,4 +50,5 @@
|
|||||||
height: 100%
|
height: 100%
|
||||||
|
|
||||||
.search-result-list
|
.search-result-list
|
||||||
max-height: 100% !important
|
max-height: 75vh !important
|
||||||
|
padding-bottom: 2rem
|
||||||
|
|||||||
@@ -18,7 +18,8 @@
|
|||||||
|
|
||||||
.local-search__hit-item
|
.local-search__hit-item
|
||||||
position: relative
|
position: relative
|
||||||
padding-left: 1.5rem
|
padding-left: 1.3rem
|
||||||
|
line-height: 1.7
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
&:before
|
&:before
|
||||||
@@ -27,7 +28,7 @@
|
|||||||
&:before
|
&:before
|
||||||
$w = .3rem
|
$w = .3rem
|
||||||
position: absolute
|
position: absolute
|
||||||
top: .4rem
|
top: .3rem
|
||||||
left: 0
|
left: 0
|
||||||
width: w = $w
|
width: w = $w
|
||||||
height: h = w
|
height: h = w
|
||||||
@@ -41,12 +42,21 @@
|
|||||||
a
|
a
|
||||||
display: block
|
display: block
|
||||||
color: $font-black
|
color: $font-black
|
||||||
|
font-weight: 600
|
||||||
font-size: 14px
|
font-size: 14px
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
color: $search-color
|
color: $search-color
|
||||||
|
|
||||||
|
.search-result
|
||||||
|
margin: 0 0 .4rem
|
||||||
|
word-break: break-all
|
||||||
|
|
||||||
|
.search-keyword
|
||||||
|
color: $search-keyword-highlight
|
||||||
|
font-weight: bold
|
||||||
|
|
||||||
.local-search-stats__hr
|
.local-search-stats__hr
|
||||||
display: none !important
|
display: none !important
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ figure.gallery-group
|
|||||||
background: $dark-black
|
background: $dark-black
|
||||||
-webkit-transform: translate3d(0, 0, 0)
|
-webkit-transform: translate3d(0, 0, 0)
|
||||||
|
|
||||||
|
@media screen and (max-width: 600px)
|
||||||
|
width: calc(100% - .4rem)
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
img
|
img
|
||||||
opacity: .4
|
opacity: .4
|
||||||
@@ -100,10 +103,9 @@ figure.gallery-group
|
|||||||
img
|
img
|
||||||
opacity: 0
|
opacity: 0
|
||||||
|
|
||||||
|
.img-alt
|
||||||
|
display: none
|
||||||
|
|
||||||
.fancybox
|
.fancybox
|
||||||
width: auto
|
width: auto
|
||||||
text-align: inherit
|
text-align: inherit
|
||||||
|
|
||||||
@media screen and (max-width: 600px)
|
|
||||||
figure.gallery-group
|
|
||||||
width: calc(100% - .4rem)
|
|
||||||
53
source/css/_tags/hide.styl
Normal file
53
source/css/_tags/hide.styl
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
// tag-hide
|
||||||
|
.hide-inline,
|
||||||
|
.hide-block
|
||||||
|
& > a.hide-button
|
||||||
|
position: relative
|
||||||
|
z-index: 1
|
||||||
|
display: inline-block
|
||||||
|
padding: 0 1rem
|
||||||
|
background: $tag-hide-bg
|
||||||
|
color: $white !important
|
||||||
|
text-align: center
|
||||||
|
cursor: pointer
|
||||||
|
|
||||||
|
&:hover
|
||||||
|
text-decoration: none !important
|
||||||
|
|
||||||
|
&.open
|
||||||
|
display: none
|
||||||
|
|
||||||
|
& > .hide-content
|
||||||
|
display: none
|
||||||
|
|
||||||
|
.hide-inline
|
||||||
|
& > .hide-button
|
||||||
|
margin: 0 .3rem
|
||||||
|
|
||||||
|
& > .hide-content
|
||||||
|
margin: 0 .3rem
|
||||||
|
|
||||||
|
.hide-block
|
||||||
|
margin: 0 0 .8rem
|
||||||
|
|
||||||
|
.hide-toggle
|
||||||
|
margin-bottom: 1rem
|
||||||
|
border: 1px solid $tag-hide-toggle-bg
|
||||||
|
|
||||||
|
& > .hide-button
|
||||||
|
padding: .3rem .5rem
|
||||||
|
background: $tag-hide-toggle-bg
|
||||||
|
color: $font-color
|
||||||
|
cursor: pointer
|
||||||
|
|
||||||
|
& > i
|
||||||
|
font-size: 1.2em
|
||||||
|
transition: all .3s
|
||||||
|
|
||||||
|
&.open
|
||||||
|
i
|
||||||
|
transform: rotate(90deg)
|
||||||
|
|
||||||
|
& > .hide-content
|
||||||
|
display: none
|
||||||
|
margin: 1.5rem 1.2rem
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
@import '_global'
|
@import '_global'
|
||||||
@import '_highlight/highlight'
|
@import '_highlight/highlight'
|
||||||
@import '_layout/*'
|
@import '_layout/*'
|
||||||
|
@import '_tags/*'
|
||||||
@import '_mode/*'
|
@import '_mode/*'
|
||||||
|
|
||||||
// search
|
// search
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ $rem = 20px
|
|||||||
$text-line-height = 2
|
$text-line-height = 2
|
||||||
$sm = 768px
|
$sm = 768px
|
||||||
$bg = 1024px
|
$bg = 1024px
|
||||||
|
$lr = 2000px
|
||||||
$web-bg = convert(hexo-config('background'))
|
$web-bg = convert(hexo-config('background'))
|
||||||
$index_top_img_height = convert(hexo-config('index_top_img_height')) || 100vh
|
$index_top_img_height = convert(hexo-config('index_top_img_height')) || 100vh
|
||||||
$index_site_info_top = convert(hexo-config('index_site_info_top')) || 43%
|
$index_site_info_top = convert(hexo-config('index_site_info_top')) || 43%
|
||||||
@@ -78,12 +79,14 @@ $reward-pop-up-color = #858585
|
|||||||
// search
|
// search
|
||||||
$search-bg = #f6f8fa
|
$search-bg = #f6f8fa
|
||||||
$search-color = $theme-color
|
$search-color = $theme-color
|
||||||
|
$search-keyword-highlight = #F47466
|
||||||
//gallery
|
//gallery
|
||||||
$gallery-color = #fff
|
$gallery-color = #fff
|
||||||
// tag-hide
|
// tag-hide
|
||||||
$tag-hide-bg = $theme-color
|
$tag-hide-bg = $theme-color
|
||||||
|
$tag-hide-toggle-bg = #f0f0f0
|
||||||
|
//preloader
|
||||||
|
$preloader-bg = #37474f
|
||||||
|
|
||||||
// Note colors
|
// Note colors
|
||||||
// --------------------------------------------------
|
// --------------------------------------------------
|
||||||
|
|||||||
@@ -1,60 +1,55 @@
|
|||||||
$(function () {
|
$(function () {
|
||||||
const isSnackbar = GLOBAL_CONFIG.Snackbar !== undefined
|
const isSnackbar = GLOBAL_CONFIG.Snackbar !== undefined
|
||||||
const isTocContent = $('#sidebar .sidebar-toc__content').children().length > 0
|
|
||||||
const $pageHead = $('#page-header')
|
const $pageHead = $('#page-header')
|
||||||
const $rightside = $('#rightside')
|
const $rightside = $('#rightside')
|
||||||
const $body = $('body')
|
const $body = $('body')
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 當menu過多時,自動適配,避免UI錯亂
|
* 當menu過多時,自動適配,避免UI錯亂
|
||||||
*/
|
|
||||||
const searchWidth = $('#search_button').outerWidth() !== undefined ? $('#search_button').outerWidth() : 0
|
|
||||||
const blogNameWidth = $('#blog_name').width()
|
|
||||||
|
|
||||||
var mw = 0
|
|
||||||
var $menusItem = $pageHead.find('.menus_item')
|
|
||||||
for (var i = 0; i < $menusItem.length; i++) {
|
|
||||||
mw = mw + $menusItem.eq(i).outerWidth()
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 傳入 1 sidebar打開時
|
* 傳入 1 sidebar打開時
|
||||||
* 傳入 2 正常狀態下
|
* 傳入 2 正常狀態下
|
||||||
* 傳入 3 resize時使用
|
|
||||||
*/
|
*/
|
||||||
|
var blogNameWidth = $('#blog_name').width()
|
||||||
|
var menusWidth = $('.menus').width()
|
||||||
|
var sidebarWidth = $('#sidebar').width()
|
||||||
|
|
||||||
function isAdjust (n) {
|
function isAdjust (n) {
|
||||||
var t
|
var t
|
||||||
if (n === 1) {
|
if (n === 1) {
|
||||||
t = blogNameWidth + searchWidth + mw > $pageHead.width() - 300
|
t = blogNameWidth + menusWidth > $pageHead.width() - sidebarWidth - 20
|
||||||
} else if (n === 2) {
|
} else if (n === 2) {
|
||||||
t = blogNameWidth + searchWidth + mw > $pageHead.width()
|
t = blogNameWidth + menusWidth > $pageHead.width() - 20
|
||||||
}
|
}
|
||||||
|
|
||||||
if (t) headerAdjust()
|
if (t) headerAdjust()
|
||||||
else headerAdjustBack()
|
else headerAdjustBack()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function headerAdjust () {
|
||||||
|
$pageHead.find('.toggle-menu').addClass('is-visible-inline')
|
||||||
|
$pageHead.find('.menus_items').addClass('is_invisible')
|
||||||
|
$pageHead.find('#search_button span').addClass('is_invisible')
|
||||||
|
}
|
||||||
|
|
||||||
|
function headerAdjustBack () {
|
||||||
|
$pageHead.find('.toggle-menu').removeClass('is-visible-inline')
|
||||||
|
$pageHead.find('.menus_items').removeClass('is_invisible')
|
||||||
|
$pageHead.find('#search_button span').removeClass('is_invisible')
|
||||||
|
}
|
||||||
|
|
||||||
// 初始化header
|
// 初始化header
|
||||||
function initAjust () {
|
function initAjust () {
|
||||||
if (window.innerWidth < 768) headerAdjust()
|
if (window.innerWidth < 768) headerAdjust()
|
||||||
else isAdjust(2)
|
else isAdjust(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
initAjust()
|
initAjust()
|
||||||
|
$('#page-header').css({ opacity: '1', animation: 'headerNoOpacity 1s' })
|
||||||
function headerAdjust () {
|
|
||||||
$pageHead.find('.toggle-menu').addClass('is_visible')
|
|
||||||
$pageHead.find('.menus').addClass('is_invisible')
|
|
||||||
$pageHead.find('#search_button span').addClass('is_invisible')
|
|
||||||
}
|
|
||||||
|
|
||||||
function headerAdjustBack () {
|
|
||||||
$pageHead.find('.toggle-menu').removeClass('is_visible')
|
|
||||||
$pageHead.find('.menus').removeClass('is_invisible')
|
|
||||||
$pageHead.find('#search_button span').removeClass('is_invisible')
|
|
||||||
}
|
|
||||||
|
|
||||||
$(window).on('resize', function () {
|
$(window).on('resize', function () {
|
||||||
if (!$pageHead.hasClass('open-sidebar')) {
|
if ($('#sidebar').hasClass('tocOpenPc') && $pageHead.hasClass('fixed')) {
|
||||||
|
isAdjust(1)
|
||||||
|
} else {
|
||||||
initAjust()
|
initAjust()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -72,21 +67,12 @@ $(function () {
|
|||||||
/**
|
/**
|
||||||
* 進入post頁sidebar處理
|
* 進入post頁sidebar處理
|
||||||
*/
|
*/
|
||||||
|
if (GLOBAL_CONFIG_SITE.isPost) {
|
||||||
var isSidebarOpen = $('#toggle-sidebar').hasClass('on') && isTocContent
|
if (window.innerWidth > 1024 && $('#toggle-sidebar').hasClass('on')) {
|
||||||
var isPcSidebarOpen = false
|
|
||||||
if (window.innerWidth > 1024 && isSidebarOpen) {
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
openSidebar()
|
openSidebar()
|
||||||
}, 400)
|
}, 400)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 當toc爲空時,隱藏toc按鈕
|
|
||||||
if (isTocContent) {
|
|
||||||
$('#toggle-sidebar').css('opacity', '1')
|
|
||||||
} else {
|
|
||||||
$('#toggle-sidebar').css('display', 'none')
|
|
||||||
$('#mobile-toc-button').css('display', 'none')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,9 +80,10 @@ $(function () {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function closeSidebar () {
|
function closeSidebar () {
|
||||||
isPcSidebarOpen = false
|
|
||||||
$pageHead.removeClass('open-sidebar')
|
|
||||||
$('#sidebar').removeClass('tocOpenPc')
|
$('#sidebar').removeClass('tocOpenPc')
|
||||||
|
$('.menus').animate({
|
||||||
|
paddingRight: 0
|
||||||
|
}, 400)
|
||||||
$('#body-wrap').animate({
|
$('#body-wrap').animate({
|
||||||
paddingLeft: 0
|
paddingLeft: 0
|
||||||
}, 400)
|
}, 400)
|
||||||
@@ -114,9 +101,10 @@ $(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function openSidebar () {
|
function openSidebar () {
|
||||||
isPcSidebarOpen = true
|
|
||||||
$pageHead.addClass('open-sidebar')
|
|
||||||
$('#sidebar').addClass('tocOpenPc')
|
$('#sidebar').addClass('tocOpenPc')
|
||||||
|
$('.menus').animate({
|
||||||
|
paddingRight: 300
|
||||||
|
}, 400)
|
||||||
$('#body-wrap').animate({
|
$('#body-wrap').animate({
|
||||||
paddingLeft: 300
|
paddingLeft: 300
|
||||||
}, 400)
|
}, 400)
|
||||||
@@ -129,7 +117,8 @@ $(function () {
|
|||||||
opacity: '1'
|
opacity: '1'
|
||||||
})
|
})
|
||||||
var isAdjustTimeCount = window.setInterval(function () {
|
var isAdjustTimeCount = window.setInterval(function () {
|
||||||
isAdjust(1)
|
if ($pageHead.hasClass('fixed')) isAdjust(1)
|
||||||
|
else isAdjust(2)
|
||||||
}, 100)
|
}, 100)
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
clearInterval(isAdjustTimeCount)
|
clearInterval(isAdjustTimeCount)
|
||||||
@@ -165,7 +154,7 @@ $(function () {
|
|||||||
$toggleMenu.removeClass('close').addClass('open')
|
$toggleMenu.removeClass('close').addClass('open')
|
||||||
$mobileSidevarMenus.css('transform', 'translate3d(-100%,0,0)')
|
$mobileSidevarMenus.css('transform', 'translate3d(-100%,0,0)')
|
||||||
var $mobileSidevarMenusChild = $mobileSidevarMenus.children()
|
var $mobileSidevarMenusChild = $mobileSidevarMenus.children()
|
||||||
for (i = 0; i <= $mobileSidevarMenusChild.length; i++) {
|
for (let i = 0; i <= $mobileSidevarMenusChild.length; i++) {
|
||||||
const duration = i / 5 + 0.2
|
const duration = i / 5 + 0.2
|
||||||
$mobileSidevarMenusChild.eq(i).css('animation', 'sidebarItem ' + duration + 's')
|
$mobileSidevarMenusChild.eq(i).css('animation', 'sidebarItem ' + duration + 's')
|
||||||
}
|
}
|
||||||
@@ -221,9 +210,9 @@ $(function () {
|
|||||||
const mql = window.matchMedia('(max-width: 1024px)')
|
const mql = window.matchMedia('(max-width: 1024px)')
|
||||||
mql.addListener(function (ev) {
|
mql.addListener(function (ev) {
|
||||||
if (ev.matches) {
|
if (ev.matches) {
|
||||||
if (isPcSidebarOpen === true) closeSidebar()
|
if ($('#sidebar').hasClass('tocOpenPc')) closeSidebar()
|
||||||
} else {
|
} else {
|
||||||
if ($('#toggle-sidebar').hasClass('on') && isTocContent) openSidebar()
|
if ($('#toggle-sidebar').hasClass('on')) openSidebar()
|
||||||
if ($mobileTocButton.hasClass('open')) closeMobileSidebar('toc')
|
if ($mobileTocButton.hasClass('open')) closeMobileSidebar('toc')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -258,11 +247,15 @@ $(function () {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 代碼
|
* 代碼
|
||||||
|
* 只適用於Hexo默認的代碼渲染
|
||||||
*/
|
*/
|
||||||
|
const $figureHighlight = $('figure.highlight')
|
||||||
|
|
||||||
|
if ($figureHighlight.length) {
|
||||||
const isHighlightCopy = GLOBAL_CONFIG.highlightCopy
|
const isHighlightCopy = GLOBAL_CONFIG.highlightCopy
|
||||||
const isHighlightLang = GLOBAL_CONFIG.highlightLang
|
const isHighlightLang = GLOBAL_CONFIG.highlightLang
|
||||||
const isHighlightShrink = GLOBAL_CONFIG.highlightShrink
|
const isHighlightShrink = GLOBAL_CONFIG.highlightShrink
|
||||||
const $figureHighlight = $('figure.highlight')
|
|
||||||
if (isHighlightCopy || isHighlightLang || isHighlightShrink !== 'none') {
|
if (isHighlightCopy || isHighlightLang || isHighlightShrink !== 'none') {
|
||||||
$figureHighlight.wrap('<div class="code-area-wrap"></div>').before('<div class="highlight-tools"></div>')
|
$figureHighlight.wrap('<div class="code-area-wrap"></div>').before('<div class="highlight-tools"></div>')
|
||||||
}
|
}
|
||||||
@@ -271,16 +264,16 @@ $(function () {
|
|||||||
* 代碼收縮
|
* 代碼收縮
|
||||||
*/
|
*/
|
||||||
const $highlightTools = $('.highlight-tools')
|
const $highlightTools = $('.highlight-tools')
|
||||||
if (isHighlightShrink === true) {
|
if (isHighlightShrink === 'true') {
|
||||||
$highlightTools.append('<i class="fa fa-angle-down code-expand code-closed" aria-hidden="true"></i>')
|
$highlightTools.append('<i class="fa fa-angle-down code-expand code-closed" aria-hidden="true"></i>')
|
||||||
} else if (isHighlightShrink === false) {
|
} else if (isHighlightShrink === 'false') {
|
||||||
$highlightTools.append('<i class="fa fa-angle-down code-expand" aria-hidden="true"></i>')
|
$highlightTools.append('<i class="fa fa-angle-down code-expand" aria-hidden="true"></i>')
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('click', '.highlight-tools >.code-expand', function () {
|
$(document).on('click', '.highlight-tools >.code-expand', function () {
|
||||||
var $table = $(this).parent().next()
|
var $table = $(this).parent().next()
|
||||||
if ($(this).hasClass('code-closed')) {
|
if ($(this).hasClass('code-closed')) {
|
||||||
$table.css('display', '')
|
$table.css('display', 'block')
|
||||||
$(this).removeClass('code-closed')
|
$(this).removeClass('code-closed')
|
||||||
} else {
|
} else {
|
||||||
$table.css('display', 'none')
|
$table.css('display', 'none')
|
||||||
@@ -367,12 +360,30 @@ $(function () {
|
|||||||
selection.removeAllRanges()
|
selection.removeAllRanges()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PhotoFigcaption
|
||||||
|
*/
|
||||||
|
function addPhotoFigcaption () {
|
||||||
|
var images = $('#article-container img')
|
||||||
|
images.each(function (i, o) {
|
||||||
|
var $this = $(o)
|
||||||
|
if ($this.attr('alt')) {
|
||||||
|
var t = $('<div class="img-alt is-center">' + $this.attr('alt') + '</div>')
|
||||||
|
$this.after(t)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
if (GLOBAL_CONFIG.isPhotoFigcaption) addPhotoFigcaption()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* justified-gallery 圖庫排版
|
* justified-gallery 圖庫排版
|
||||||
*/
|
*/
|
||||||
var $justifiedGallery = $('.justified-gallery')
|
var $justifiedGallery = $('.justified-gallery')
|
||||||
|
var isJustifiedGallery = false
|
||||||
if ($justifiedGallery.length) {
|
if ($justifiedGallery.length) {
|
||||||
|
isJustifiedGallery = true
|
||||||
var $imgList = $justifiedGallery.find('img')
|
var $imgList = $justifiedGallery.find('img')
|
||||||
$imgList.unwrap()
|
$imgList.unwrap()
|
||||||
if ($imgList.length) {
|
if ($imgList.length) {
|
||||||
@@ -383,12 +394,20 @@ $(function () {
|
|||||||
}
|
}
|
||||||
$('head').append('<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css">')
|
$('head').append('<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css">')
|
||||||
loadScript('https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js', function () {
|
loadScript('https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js', function () {
|
||||||
$justifiedGallery.not($('.hide-content .justified-gallery')).justifiedGallery({
|
initJustifiedGallery($justifiedGallery)
|
||||||
|
})
|
||||||
|
|
||||||
|
var initJustifiedGallery = function (selector) {
|
||||||
|
selector.each(function (i, o) {
|
||||||
|
if ($(this).is(':visible')) {
|
||||||
|
$(this).justifiedGallery({
|
||||||
rowHeight: 220,
|
rowHeight: 220,
|
||||||
margins: 4
|
margins: 4
|
||||||
})
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fancybox和 mediumZoom
|
* fancybox和 mediumZoom
|
||||||
@@ -419,18 +438,16 @@ $(function () {
|
|||||||
} else if (isMediumZoom) {
|
} else if (isMediumZoom) {
|
||||||
const zoom = mediumZoom(document.querySelectorAll('#article-container :not(a)>img'))
|
const zoom = mediumZoom(document.querySelectorAll('#article-container :not(a)>img'))
|
||||||
zoom.on('open', function (event) {
|
zoom.on('open', function (event) {
|
||||||
const photoBg = $(document.documentElement).attr('data-theme') === 'dark' ? '#121212' : '#fff'
|
var photoBg = $(document.documentElement).attr('data-theme') === 'dark' ? '#121212' : '#fff'
|
||||||
zoom.update({
|
zoom.update({
|
||||||
background: photoBg
|
background: photoBg
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 點擊toc,收起sidebar
|
/**
|
||||||
// $('.toc-link').on('click', function () {
|
* 滾動處理
|
||||||
// closeMobileSidebar('toc')
|
*/
|
||||||
// })
|
|
||||||
|
|
||||||
var initTop = 0
|
var initTop = 0
|
||||||
$(window).scroll(function (event) {
|
$(window).scroll(function (event) {
|
||||||
var currentTop = $(this).scrollTop()
|
var currentTop = $(this).scrollTop()
|
||||||
@@ -442,7 +459,6 @@ $(function () {
|
|||||||
if (!$pageHead.hasClass('visible')) $pageHead.addClass('visible')
|
if (!$pageHead.hasClass('visible')) $pageHead.addClass('visible')
|
||||||
}
|
}
|
||||||
$pageHead.addClass('fixed')
|
$pageHead.addClass('fixed')
|
||||||
|
|
||||||
if ($rightside.css('opacity') === '0') {
|
if ($rightside.css('opacity') === '0') {
|
||||||
$rightside.css({ opacity: '1', transform: 'translateX(-38px)' })
|
$rightside.css({ opacity: '1', transform: 'translateX(-38px)' })
|
||||||
}
|
}
|
||||||
@@ -450,7 +466,6 @@ $(function () {
|
|||||||
if (currentTop === 0) {
|
if (currentTop === 0) {
|
||||||
$pageHead.removeClass('fixed').removeClass('visible')
|
$pageHead.removeClass('fixed').removeClass('visible')
|
||||||
}
|
}
|
||||||
|
|
||||||
$rightside.css({ opacity: '', transform: '' })
|
$rightside.css({ opacity: '', transform: '' })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -473,7 +488,7 @@ $(function () {
|
|||||||
* toc
|
* toc
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (GLOBAL_CONFIG_SITE.isPost && isTocContent) {
|
if (GLOBAL_CONFIG_SITE.isPost && GLOBAL_CONFIG_SITE.isSidebar) {
|
||||||
$('.toc-child').hide()
|
$('.toc-child').hide()
|
||||||
|
|
||||||
// main of scroll
|
// main of scroll
|
||||||
@@ -518,8 +533,8 @@ $(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var updateAnchor = function (anchor) {
|
var updateAnchor = function (anchor) {
|
||||||
if (window.history.replaceState && anchor !== window.location.hash) {
|
if (anchor !== window.location.hash) {
|
||||||
window.history.replaceState(undefined, undefined, anchor)
|
location.replace(window.location.href.split('#')[0] + anchor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -647,7 +662,7 @@ $(function () {
|
|||||||
if (copyFont.length > 45) {
|
if (copyFont.length > 45) {
|
||||||
textFont = copyFont + '\n' + '\n' + '\n' +
|
textFont = copyFont + '\n' + '\n' + '\n' +
|
||||||
copyright.languages.author + '\n' +
|
copyright.languages.author + '\n' +
|
||||||
copyright.languages.link + '\n' +
|
copyright.languages.link + window.location.href + '\n' +
|
||||||
copyright.languages.source + '\n' +
|
copyright.languages.source + '\n' +
|
||||||
copyright.languages.info
|
copyright.languages.info
|
||||||
} else {
|
} else {
|
||||||
@@ -668,8 +683,7 @@ $(function () {
|
|||||||
var isFontAwesomeV5 = GLOBAL_CONFIG.isFontAwesomeV5
|
var isFontAwesomeV5 = GLOBAL_CONFIG.isFontAwesomeV5
|
||||||
var $darkModeButtom = $('#darkmode')
|
var $darkModeButtom = $('#darkmode')
|
||||||
if (typeof autoChangeMode !== 'undefined') {
|
if (typeof autoChangeMode !== 'undefined') {
|
||||||
if (Cookies.get('theme') === 'dark') changeLightIcon()
|
document.documentElement.getAttribute('data-theme') === 'dark' ? changeLightIcon() : changeDarkIcon()
|
||||||
else changeDarkIcon()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeLightIcon () {
|
function changeLightIcon () {
|
||||||
@@ -724,6 +738,9 @@ $(function () {
|
|||||||
interval = setInterval(showDateTime, 10000)
|
interval = setInterval(showDateTime, 10000)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 百度推送
|
||||||
|
*/
|
||||||
if (GLOBAL_CONFIG.baiduPush) {
|
if (GLOBAL_CONFIG.baiduPush) {
|
||||||
(function () {
|
(function () {
|
||||||
var bp = document.createElement('script')
|
var bp = document.createElement('script')
|
||||||
@@ -742,14 +759,18 @@ $(function () {
|
|||||||
* tag-hide
|
* tag-hide
|
||||||
*/
|
*/
|
||||||
var $hideInline = $('.hide-button')
|
var $hideInline = $('.hide-button')
|
||||||
|
if ($hideInline.length) {
|
||||||
$hideInline.on('click', function (e) {
|
$hideInline.on('click', function (e) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
$(this).hide()
|
var $this = $(this)
|
||||||
var $hideContent = $(this).next('.hide-content')
|
var $hideContent = $(this).next('.hide-content')
|
||||||
$hideContent.show()
|
$this.toggleClass('open')
|
||||||
$hideContent.find('.justified-gallery').justifiedGallery({
|
$hideContent.toggle()
|
||||||
rowHeight: 220,
|
if ($this.hasClass('open')) {
|
||||||
margins: 4
|
if (isJustifiedGallery && $hideContent.find('.justified-gallery').length > 0) {
|
||||||
})
|
initJustifiedGallery($hideContent.find('.justified-gallery'))
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
$(function () {
|
$(function () {
|
||||||
var loadFlag = false
|
var loadFlag = false
|
||||||
$('a.social-icon.search').on('click', function () {
|
$('a.social-icon.search').on('click', function () {
|
||||||
$('body').css({ width: '100%', overflow: 'hidden' })
|
$('body').css({
|
||||||
|
width: '100%',
|
||||||
|
overflow: 'hidden'
|
||||||
|
})
|
||||||
$('.search-dialog').css('display', 'block')
|
$('.search-dialog').css('display', 'block')
|
||||||
$('#local-search-input input').focus()
|
$('#local-search-input input').focus()
|
||||||
$('.search-mask').fadeIn()
|
$('.search-mask').fadeIn()
|
||||||
@@ -52,6 +55,7 @@ $(function () {
|
|||||||
url: $('url', this).text()
|
url: $('url', this).text()
|
||||||
}
|
}
|
||||||
}).get()
|
}).get()
|
||||||
|
|
||||||
var $input = $('#local-search-input input')[0]
|
var $input = $('#local-search-input input')[0]
|
||||||
var $resultContent = $('#local-hits')[0]
|
var $resultContent = $('#local-hits')[0]
|
||||||
$input.addEventListener('input', function () {
|
$input.addEventListener('input', function () {
|
||||||
@@ -66,13 +70,17 @@ $(function () {
|
|||||||
// perform local searching
|
// perform local searching
|
||||||
datas.forEach(function (data) {
|
datas.forEach(function (data) {
|
||||||
var isMatch = true
|
var isMatch = true
|
||||||
|
if (!data.title || data.title.trim() === '') {
|
||||||
|
data.title = 'Untitled'
|
||||||
|
}
|
||||||
var dataTitle = data.title.trim().toLowerCase()
|
var dataTitle = data.title.trim().toLowerCase()
|
||||||
var dataContent = data.content.trim().replace(/<[^>]+>/g, '').toLowerCase()
|
var dataContent = data.content.trim().replace(/<[^>]+>/g, '').toLowerCase()
|
||||||
var dataUrl = data.url
|
var dataUrl = data.url
|
||||||
var indexTitle = -1
|
var indexTitle = -1
|
||||||
var indexContent = -1
|
var indexContent = -1
|
||||||
|
var firstOccur = -1
|
||||||
// only match artiles with not empty titles and contents
|
// only match artiles with not empty titles and contents
|
||||||
if (dataTitle !== '' && dataContent !== '') {
|
if (dataTitle !== '' || dataContent !== '') {
|
||||||
keywords.forEach(function (keyword, i) {
|
keywords.forEach(function (keyword, i) {
|
||||||
indexTitle = dataTitle.indexOf(keyword)
|
indexTitle = dataTitle.indexOf(keyword)
|
||||||
indexContent = dataContent.indexOf(keyword)
|
indexContent = dataContent.indexOf(keyword)
|
||||||
@@ -82,20 +90,60 @@ $(function () {
|
|||||||
if (indexContent < 0) {
|
if (indexContent < 0) {
|
||||||
indexContent = 0
|
indexContent = 0
|
||||||
}
|
}
|
||||||
|
if (i === 0) {
|
||||||
|
firstOccur = indexContent
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
isMatch = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// show search results
|
// show search results
|
||||||
if (isMatch) {
|
if (isMatch) {
|
||||||
str += '<div class="local-search__hit-item"><a href="' + dataUrl + '" class="search-result-title">' + dataTitle + '</a>' + '</div>'
|
var content = data.content.trim().replace(/<[^>]+>/g, '')
|
||||||
|
if (firstOccur >= 0) {
|
||||||
|
// cut out 130 characters
|
||||||
|
var start = firstOccur - 30
|
||||||
|
var end = firstOccur + 100
|
||||||
|
|
||||||
|
if (start < 0) {
|
||||||
|
start = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if (start === 0) {
|
||||||
|
end = 100
|
||||||
|
}
|
||||||
|
|
||||||
|
if (end > content.length) {
|
||||||
|
end = content.length
|
||||||
|
}
|
||||||
|
|
||||||
|
var matchContent = content.substring(start, end)
|
||||||
|
|
||||||
|
// highlight all keywords
|
||||||
|
keywords.forEach(function (keyword) {
|
||||||
|
var regS = new RegExp(keyword, 'gi')
|
||||||
|
matchContent = matchContent.replace(regS, '<span class="search-keyword">' + keyword + '</span>')
|
||||||
|
dataTitle = dataTitle.replace(regS, '<span class="search-keyword">' + keyword + '</span>')
|
||||||
|
})
|
||||||
|
|
||||||
|
str += '<div class="local-search__hit-item"><a href="' + dataUrl + '" class="search-result-title">' + dataTitle + '</a>'
|
||||||
count += 1
|
count += 1
|
||||||
$('.local-search-stats__hr').show()
|
$('.local-search-stats__hr').show()
|
||||||
|
|
||||||
|
if (dataContent !== '') {
|
||||||
|
str += '<p class="search-result">' + matchContent + '...</p>'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
str += '</div>'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if (count === 0) {
|
if (count === 0) {
|
||||||
str += '<div id="local-search__hits-empty">' + GLOBAL_CONFIG.localSearch.languages.hits_empty.replace(/\$\{query}/, this.value.trim()) +
|
str += '<div id="local-search__hits-empty">' + GLOBAL_CONFIG.localSearch.languages.hits_empty.replace(/\$\{query}/, this.value.trim()) +
|
||||||
'</div>'
|
'</div>'
|
||||||
}
|
}
|
||||||
|
str += '</div>'
|
||||||
$resultContent.innerHTML = str
|
$resultContent.innerHTML = str
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
104
source/js/third-party/canvas-ribbon.js
vendored
104
source/js/third-party/canvas-ribbon.js
vendored
@@ -6,30 +6,31 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
!(function() {
|
!(function() {
|
||||||
|
var script = document.getElementById("ribbon");
|
||||||
var script = document.getElementById('ribbon');
|
|
||||||
var mb = script.getAttribute("mobile");
|
var mb = script.getAttribute("mobile");
|
||||||
if (mb == 'false' && (/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent))) {
|
if (
|
||||||
|
mb == "false" &&
|
||||||
|
/Android|webOS|iPhone|iPod|iPad|BlackBerry/i.test(navigator.userAgent)
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
z: attr(script, 'zIndex', -1), // z-index
|
z: attr(script, "zIndex", -1), // z-index
|
||||||
a: attr(script, 'alpha', 0.6), // alpha
|
a: attr(script, "alpha", 0.6), // alpha
|
||||||
s: attr(script, 'size', 90), // size
|
s: attr(script, "size", 90), // size
|
||||||
c: attr(script, 'data-click', true) // click-to-change
|
c: attr(script, "data-click", true) // click-to-change
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
function attr(node, attr, default_value) {
|
function attr(node, attr, default_value) {
|
||||||
if (default_value === true) {
|
if (default_value === true) {
|
||||||
return node.getAttribute(attr) || default_value
|
return node.getAttribute(attr) || default_value;
|
||||||
}
|
}
|
||||||
return Number(node.getAttribute(attr)) || default_value
|
return Number(node.getAttribute(attr)) || default_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
var canvas = document.createElement('canvas'),
|
var canvas = document.createElement("canvas"),
|
||||||
g2d = canvas.getContext('2d'),
|
g2d = canvas.getContext("2d"),
|
||||||
pr = window.devicePixelRatio || 1,
|
pr = window.devicePixelRatio || 1,
|
||||||
width = window.innerWidth,
|
width = window.innerWidth,
|
||||||
height = window.innerHeight,
|
height = window.innerHeight,
|
||||||
@@ -40,52 +41,67 @@
|
|||||||
r = 0,
|
r = 0,
|
||||||
pi = m.PI * 2,
|
pi = m.PI * 2,
|
||||||
cos = m.cos,
|
cos = m.cos,
|
||||||
random = m.random
|
random = m.random;
|
||||||
canvas.width = width * pr
|
canvas.id = "ribbon-canvas";
|
||||||
canvas.height = height * pr
|
canvas.width = width * pr;
|
||||||
g2d.scale(pr, pr)
|
canvas.height = height * pr;
|
||||||
g2d.globalAlpha = config.a
|
g2d.scale(pr, pr);
|
||||||
|
g2d.globalAlpha = config.a;
|
||||||
canvas.style.cssText =
|
canvas.style.cssText =
|
||||||
'opacity: ' +
|
"opacity: " +
|
||||||
config.a +
|
config.a +
|
||||||
';position:fixed;top:0;left:0;z-index: ' +
|
";position:fixed;top:0;left:0;z-index: " +
|
||||||
config.z +
|
config.z +
|
||||||
';width:100%;height:100%;pointer-events:none;'
|
";width:100%;height:100%;pointer-events:none;";
|
||||||
// create canvas
|
// create canvas
|
||||||
document.getElementsByTagName('body')[0].appendChild(canvas)
|
document.getElementsByTagName("body")[0].appendChild(canvas);
|
||||||
|
|
||||||
function redraw() {
|
function redraw() {
|
||||||
g2d.clearRect(0, 0, width, height)
|
g2d.clearRect(0, 0, width, height);
|
||||||
q = [{ x: 0, y: height * 0.7 + f }, { x: 0, y: height * 0.7 - f }]
|
q = [
|
||||||
while (q[1].x < width + f) draw(q[0], q[1])
|
{
|
||||||
|
x: 0,
|
||||||
|
y: height * 0.7 + f
|
||||||
|
},
|
||||||
|
{
|
||||||
|
x: 0,
|
||||||
|
y: height * 0.7 - f
|
||||||
}
|
}
|
||||||
|
];
|
||||||
|
while (q[1].x < width + f) draw(q[0], q[1]);
|
||||||
|
}
|
||||||
|
|
||||||
function draw(i, j) {
|
function draw(i, j) {
|
||||||
g2d.beginPath()
|
g2d.beginPath();
|
||||||
g2d.moveTo(i.x, i.y)
|
g2d.moveTo(i.x, i.y);
|
||||||
g2d.lineTo(j.x, j.y)
|
g2d.lineTo(j.x, j.y);
|
||||||
var k = j.x + (random() * 2 - 0.25) * f,
|
var k = j.x + (random() * 2 - 0.25) * f,
|
||||||
n = line(j.y)
|
n = line(j.y);
|
||||||
g2d.lineTo(k, n)
|
g2d.lineTo(k, n);
|
||||||
g2d.closePath()
|
g2d.closePath();
|
||||||
r -= pi / -50
|
r -= pi / -50;
|
||||||
g2d.fillStyle =
|
g2d.fillStyle =
|
||||||
'#' +
|
"#" +
|
||||||
(
|
(
|
||||||
((cos(r) * 127 + 128) << 16) |
|
((cos(r) * 127 + 128) << 16) |
|
||||||
((cos(r + pi / 3) * 127 + 128) << 8) |
|
((cos(r + pi / 3) * 127 + 128) << 8) |
|
||||||
(cos(r + (pi / 3) * 2) * 127 + 128)
|
(cos(r + (pi / 3) * 2) * 127 + 128)
|
||||||
).toString(16)
|
).toString(16);
|
||||||
g2d.fill()
|
g2d.fill();
|
||||||
q[0] = q[1]
|
q[0] = q[1];
|
||||||
q[1] = { x: k, y: n }
|
q[1] = {
|
||||||
|
x: k,
|
||||||
|
y: n
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function line(p) {
|
function line(p) {
|
||||||
t = p + (random() * 2 - 1.1) * f
|
t = p + (random() * 2 - 1.1) * f;
|
||||||
return t > height || t < 0 ? line(p) : t
|
return t > height || t < 0 ? line(p) : t;
|
||||||
}
|
}
|
||||||
if (config.c !== 'false') {
|
if (config.c !== "false") {
|
||||||
document.onclick = redraw
|
document.onclick = redraw;
|
||||||
document.ontouchstart = redraw
|
document.ontouchstart = redraw;
|
||||||
}
|
}
|
||||||
redraw()
|
redraw();
|
||||||
})()
|
})();
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -49,9 +49,9 @@ function throttle (func, wait, options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sidebarPaddingR () {
|
function sidebarPaddingR () {
|
||||||
let innerWidth = window.innerWidth
|
var innerWidth = window.innerWidth
|
||||||
let clientWidth = document.body.clientWidth
|
var clientWidth = document.body.clientWidth
|
||||||
let paddingRight = innerWidth - clientWidth
|
var paddingRight = innerWidth - clientWidth
|
||||||
if (innerWidth !== clientWidth) {
|
if (innerWidth !== clientWidth) {
|
||||||
$('body').css('padding-right', paddingRight)
|
$('body').css('padding-right', paddingRight)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user