Compare commits

...

33 Commits
3.1.1 ... 3.3.0

110 changed files with 1867 additions and 2607 deletions

View File

@@ -16,6 +16,8 @@ Based on [hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody) t
### GIT ### GIT
> If you are in Mainland China, you can download in [Gitee](https://gitee.com/iamjerryw/hexo-theme-butterfly)
Stable branch [recommend]: Stable branch [recommend]:
``` ```
@@ -92,5 +94,3 @@ npm i hexo-theme-butterfly
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-1.png) ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-1.png)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-2.png) ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-2.png)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-post.png)

View File

@@ -17,6 +17,8 @@
### Git 安裝 ### Git 安裝
> 本倉庫同時上傳到 [Gitee](https://gitee.com/iamjerryw/hexo-theme-butterfly),如果你訪問 Github 緩慢,可從 Gitee 中下載。
在博客根目錄裡安裝穩定版【推薦】 在博客根目錄裡安裝穩定版【推薦】
```powershell ```powershell
@@ -92,5 +94,3 @@ theme: butterfly
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-1.png) ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-1.png)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-2.png) ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-2.png)
![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-post.png)

View File

@@ -53,17 +53,9 @@ algolia_search:
hits: hits:
per_page: 6 per_page: 6
labels:
input_placeholder: Search for Posts
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'
# Local search # Local search
local_search: local_search:
enable: false enable: false
labels:
input_placeholder: Search for Posts
hits_empty: "We didn't find any results for the search: ${query}" # if there are no result
# Math (數學) # Math (數學)
# -------------------------------------- # --------------------------------------
@@ -94,29 +86,32 @@ avatar:
img: img:
effect: false effect: false
# the banner image of home page # The banner image of home page
index_img: index_img:
# if the banner of page not setting, it will show the top_img # If the banner of page not setting, it will show the top_img
default_top_img: default_top_img:
# the banner image of archive page # The banner image of archive page
archive_img: archive_img:
# the banner image of tag page # If the banner of tag page not setting, it will show the top_img
# note: tag page, not tags page (子標籤頁面的 top_img) # note: tag page, not tags page (子標籤頁面的 top_img)
tag_img: tag_img:
# the banner image of category page # The banner image of tag page
# format:
# - tag name: xxxxx
tag_per_img:
# If the banner of category page not setting, it will show the top_img
# note: category page, not categories page (子分類頁面的 top_img) # note: category page, not categories page (子分類頁面的 top_img)
category_img: category_img:
# If you are using hexo-douban, you can configure it (如果你有使用 hexo-douban,可配置這個) # The banner image of category page
# douban: # format:
# meta: false # - category name: xxxxx
# movies_img: category_per_img:
# books_img:
# games_img:
cover: cover:
# display the cover or not (是否顯示文章封面) # display the cover or not (是否顯示文章封面)
@@ -144,11 +139,13 @@ error_404:
post_meta: post_meta:
page: # Home Page page: # Home Page
date_type: created # created or updated or both 主頁文章日期是創建日或者更新日或都顯示 date_type: created # created or updated or both 主頁文章日期是創建日或者更新日或都顯示
date_format: date # date/relative 顯示日期還是相對日期
categories: true # true or false 主頁是否顯示分類 categories: true # true or false 主頁是否顯示分類
tags: false # true or false 主頁是否顯示標籤 tags: false # true or false 主頁是否顯示標籤
label: true # true or false 顯示描述性文字 label: true # true or false 顯示描述性文字
post: post:
date_type: both # created or updated or both 文章頁日期是創建日或者更新日或都顯示 date_type: both # created or updated or both 文章頁日期是創建日或者更新日或都顯示
date_format: date # date/relative 顯示日期還是相對日期
categories: true # true or false 文章頁是否顯示分類 categories: true # true or false 文章頁是否顯示分類
tags: true # true or false 文章頁是否顯示標籤 tags: true # true or false 文章頁是否顯示標籤
label: true # true or false 顯示描述性文字 label: true # true or false 顯示描述性文字
@@ -164,6 +161,7 @@ wordcount:
# 1: description # 1: description
# 2: both (if the description exists, it will show description, or show the auto_excerpt) # 2: both (if the description exists, it will show description, or show the auto_excerpt)
# 3: auto_excerpt (default) # 3: auto_excerpt (default)
# false: do not show the article introduction
index_post_content: index_post_content:
method: 3 method: 3
length: 500 # if you set method to 2 or 3, the length need to config length: 500 # if you set method to 2 or 3, the length need to config
@@ -175,7 +173,6 @@ index_post_content:
toc: toc:
enable: true enable: true
number: true number: true
auto_open: true # auto open the sidebar
post_copyright: post_copyright:
enable: true enable: true
@@ -304,6 +301,7 @@ valine:
emojiCDN: # emoji CDN emojiCDN: # emoji CDN
enableQQ: false # enable the Nickname box to automatically get QQ Nickname and QQ Avatar enableQQ: false # enable the Nickname box to automatically get QQ Nickname and QQ Avatar
requiredFields: nick,mail # required fields (nick/mail) requiredFields: nick,mail # required fields (nick/mail)
option:
# utterances # utterances
# https://utteranc.es/ # https://utteranc.es/
@@ -324,6 +322,10 @@ facebook_comments:
order_by: social # social/time/reverse_time order_by: social # social/time/reverse_time
lang: en_US # Language en_US/zh_CN/zh_TW and so on lang: en_US # Language en_US/zh_CN/zh_TW and so on
# Twikoo
# https://github.com/imaegoo/twikoo
twikoo:
# Chat Services # Chat Services
# -------------------------------------- # --------------------------------------
@@ -473,17 +475,18 @@ tag_ui: # 留空或 index
# Website Background (設置網站背景) # Website Background (設置網站背景)
# can set it to color or image (可設置圖片 或者 顔色) # can set it to color or image (可設置圖片 或者 顔色)
# The formal of color: '#49B202'
# The formal of image: url(http://xxxxxx.com/xxx.jpg) # The formal of image: url(http://xxxxxx.com/xxx.jpg)
# White color will be shown as default
background: background:
# Show the footer background image (same as top_img) # Footer Background
footer_bg: false footer_bg: false
# the position of bottom right button/default unit: px (右下角按鈕距離底部的距離/默認單位為px) # the position of bottom right button/default unit: px (右下角按鈕距離底部的距離/默認單位為px)
rightside-bottom: rightside-bottom:
# Enter transitions (開啓網頁進入效果)
enter_transitions: true
# Background effects (背景特效) # Background effects (背景特效)
# -------------------------------------- # --------------------------------------
@@ -497,8 +500,8 @@ canvas_ribbon:
click_to_change: false click_to_change: false
mobile: false mobile: false
# Dynamic ribbon (動態彩帶) # Fluttering Ribbon (動態彩帶)
canvas_ribbon_piao: canvas_fluttering_ribbon:
enable: false enable: false
mobile: false mobile: false
@@ -518,14 +521,18 @@ activate_power_mode:
enable: false enable: false
colorful: true # open particle animation (冒光特效) colorful: true # open particle animation (冒光特效)
shake: true # open shake (抖動特效) shake: true # open shake (抖動特效)
mobile: false
# Mouse click effects: fireworks (鼠標點擊效果: 煙火特效) # Mouse click effects: fireworks (鼠標點擊效果: 煙火特效)
fireworks: fireworks:
enable: false enable: false
zIndex: 9999 # -1 or 9999 zIndex: 9999 # -1 or 9999
mobile: false
# Mouse click effects: Heart symbol (鼠標點擊效果: 愛心) # Mouse click effects: Heart symbol (鼠標點擊效果: 愛心)
click_heart: false click_heart:
enable: false
mobile: false
# Mouse click effects: words (鼠標點擊效果: 文字) # Mouse click effects: words (鼠標點擊效果: 文字)
ClickShowText: ClickShowText:
@@ -535,6 +542,7 @@ ClickShowText:
# - LOVE # - LOVE
# - YOU # - YOU
fontSize: 15px fontSize: 15px
mobile: false
# Default display mode (網站默認的顯示模式) # Default display mode (網站默認的顯示模式)
# light (default) / dark # light (default) / dark
@@ -557,9 +565,9 @@ font:
# Font settings for the site title and site subtitle # Font settings for the site title and site subtitle
# 左上角網站名字 主頁居中網站名字 # 左上角網站名字 主頁居中網站名字
# blog_title_font: blog_title_font:
# font_link: https://fonts.googleapis.com/css?family=Titillium+Web&display=swap font_link:
# font-family: Titillium Web, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif font-family:
# The setting of divider icon (水平分隔線圖標設置) # The setting of divider icon (水平分隔線圖標設置)
hr_icon: hr_icon:
@@ -596,6 +604,8 @@ preloader: false
aside: aside:
enable: true enable: true
hide: false
button: true
mobile: true # display on mobile mobile: true # display on mobile
position: right # left or right position: right # left or right
card_author: card_author:
@@ -733,6 +743,13 @@ note:
# other # other
# -------------------------------------- # --------------------------------------
# Artitalk
# see https://artitalk.js.org/
artitalk:
appId:
appKey:
option:
# Pjax [Beta] # Pjax [Beta]
# It may contain bugs and unstable, give feedback when you find the bugs. # It may contain bugs and unstable, give feedback when you find the bugs.
# https://github.com/MoOx/pjax # https://github.com/MoOx/pjax
@@ -826,6 +843,7 @@ CDN:
disqusjs: https://cdn.jsdelivr.net/npm/disqusjs@1/dist/disqus.js disqusjs: https://cdn.jsdelivr.net/npm/disqusjs@1/dist/disqus.js
disqusjs_css: https://cdn.jsdelivr.net/npm/disqusjs@1/dist/disqusjs.css disqusjs_css: https://cdn.jsdelivr.net/npm/disqusjs@1/dist/disqusjs.css
utterances: https://utteranc.es/client.js utterances: https://utteranc.es/client.js
twikoo: https://cdn.jsdelivr.net/npm/twikoo/dist/twikoo.all.min.js
# share # share
addtoany: https://static.addtoany.com/menu/page.js addtoany: https://static.addtoany.com/menu/page.js
@@ -849,9 +867,9 @@ CDN:
busuanzi: //busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js busuanzi: //busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js
# background effect # background effect
canvas_ribbon: /js/third-party/canvas-ribbon.js canvas_ribbon: https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-ribbon.min.js
canvas_ribbon_piao: /js/third-party/piao.js canvas_fluttering_ribbon: https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js
canvas_nest: /js/third-party/canvas-nest.js canvas_nest: https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-nest.min.js
lazyload: https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js lazyload: https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js
instantpage: https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js instantpage: https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js
@@ -868,11 +886,10 @@ CDN:
snackbar: https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js snackbar: https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js
# effect # effect
anime: https://cdn.jsdelivr.net/npm/animejs@latest/anime.min.js activate_power_mode: https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/activate-power-mode.min.js
activate_power_mode: /js/third-party/activate-power-mode.js fireworks: https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/fireworks.min.js
fireworks: /js/third-party/fireworks.js click_heart: https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-heart.min.js
click_heart: /js/third-party/click_heart.js ClickShowText: https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-show-text.min.js
ClickShowText: /js/third-party/ClickShowText.js
# fontawesome # fontawesome
fontawesome: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css fontawesome: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css
@@ -893,3 +910,5 @@ CDN:
prismjs_js: https://cdn.jsdelivr.net/npm/prismjs/prism.min.js prismjs_js: https://cdn.jsdelivr.net/npm/prismjs/prism.min.js
prismjs_lineNumber_js: https://cdn.jsdelivr.net/npm/prismjs/plugins/line-numbers/prism-line-numbers.min.js prismjs_lineNumber_js: https://cdn.jsdelivr.net/npm/prismjs/plugins/line-numbers/prism-line-numbers.min.js
prismjs_autoloader: https://cdn.jsdelivr.net/npm/prismjs/plugins/autoloader/prism-autoloader.min.js prismjs_autoloader: https://cdn.jsdelivr.net/npm/prismjs/plugins/autoloader/prism-autoloader.min.js
artitalk: https://cdn.jsdelivr.net/npm/artitalk

View File

@@ -1,7 +1,3 @@
sidebar:
catalog: Catalog
have_read: You've read
footer: footer:
framework: Framework framework: Framework
theme: Theme theme: Theme
@@ -75,25 +71,23 @@ aside:
site_pv_name: PV site_pv_name: PV
more_button: More more_button: More
card_newest_comments: card_newest_comments:
heading: Newest Comments headline: Newest Comments
loading_text: loading... loading_text: loading...
zero_day: Today error: Unable to get the data, please make sure the settings are correct.
day: days ago card_toc: Catalog
date_suffix: date_suffix:
one_hour: Just just: Just
hours: hours ago min: minutes ago
hour: hours ago
day: days ago day: days ago
month: months ago
donate: Donate donate: Donate
share: Share share: Share
bookmark:
title: Bookmark
rightside: rightside:
readmode_title: Read Mode readmode_title: Read Mode
font_plus_title: Increase Font Size
font_minus_title: Decrease Font Size
translate_title: Switch Between Traditional Chinese And Simplified Chinese translate_title: Switch Between Traditional Chinese And Simplified Chinese
night_mode_title: Switch Between Light And Dark Mode night_mode_title: Switch Between Light And Dark Mode
back_to_top: Back To Top back_to_top: Back To Top
@@ -108,9 +102,6 @@ copy_copyright:
info: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source. info: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
Snackbar: Snackbar:
bookmark:
message_prev: Press
message_next: to bookmark this page
chs_to_cht: Traditional Chinese Activated Manually chs_to_cht: Traditional Chinese Activated Manually
cht_to_chs: Simplified Chinese Activated Manually cht_to_chs: Simplified Chinese Activated Manually
day_to_night: Dark Mode Activated Manually day_to_night: Dark Mode Activated Manually

View File

@@ -1,7 +1,3 @@
sidebar:
catalog: Catalog
have_read: You've read
footer: footer:
framework: Framework framework: Framework
theme: Theme theme: Theme
@@ -75,25 +71,23 @@ aside:
site_pv_name: PV site_pv_name: PV
more_button: More more_button: More
card_newest_comments: card_newest_comments:
heading: Newest Comments headline: Newest Comments
loading_text: loading... loading_text: loading...
zero_day: Today error: Unable to get the data, please make sure the settings are correct.
day: days ago card_toc: Catalog
date_suffix: date_suffix:
one_hour: Just just: Just
hours: hours ago min: minutes ago
hour: hours ago
day: days ago day: days ago
month: months ago
donate: Donate donate: Donate
share: Share share: Share
bookmark:
title: Bookmark
rightside: rightside:
readmode_title: Read Mode readmode_title: Read Mode
font_plus_title: Increase Font Size
font_minus_title: Decrease Font Size
translate_title: Switch Between Traditional Chinese And Simplified Chinese translate_title: Switch Between Traditional Chinese And Simplified Chinese
night_mode_title: Switch Between Light And Dark Mode night_mode_title: Switch Between Light And Dark Mode
back_to_top: Back To Top back_to_top: Back To Top
@@ -108,9 +102,6 @@ copy_copyright:
info: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source. info: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
Snackbar: Snackbar:
bookmark:
message_prev: Press
message_next: to bookmark this page
chs_to_cht: Traditional Chinese Activated Manually chs_to_cht: Traditional Chinese Activated Manually
cht_to_chs: Simplified Chinese Activated Manually cht_to_chs: Simplified Chinese Activated Manually
day_to_night: Dark Mode Activated Manually day_to_night: Dark Mode Activated Manually

View File

@@ -1,7 +1,3 @@
sidebar:
catalog: 目录
have_read: 你已经读了
footer: footer:
framework: 框架 framework: 框架
theme: 主题 theme: 主题
@@ -77,25 +73,23 @@ aside:
site_pv_name: 本站总访问量 site_pv_name: 本站总访问量
more_button: 查看更多 more_button: 查看更多
card_newest_comments: card_newest_comments:
heading: 最新评论 headline: 最新评论
loading_text: 正在加载中... loading_text: 正在加载中...
zero_day: 今天 error: 无法获取资料,请确认相关配置是否正确
day: 天前 card_toc: 目录
date_suffix: date_suffix:
one_hour: 刚刚 just: 刚刚
hours: 小时 min: 分钟
hour: 小时前
day: 天前 day: 天前
month: 个月前
donate: 打赏 donate: 打赏
share: 分享 share: 分享
bookmark:
title: 添加书签
rightside: rightside:
readmode_title: 阅读模式 readmode_title: 阅读模式
font_plus_title: 放大字体
font_minus_title: 缩小字体
translate_title: 简繁转换 translate_title: 简繁转换
night_mode_title: 浅色和深色模式转换 night_mode_title: 浅色和深色模式转换
back_to_top: 回到顶部 back_to_top: 回到顶部
@@ -110,9 +104,6 @@ copy_copyright:
info: 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 info: 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
Snackbar: Snackbar:
bookmark:
message_prev:
message_next: 键将本页加入书签
chs_to_cht: 你已切换为繁体 chs_to_cht: 你已切换为繁体
cht_to_chs: 你已切换为简体 cht_to_chs: 你已切换为简体
day_to_night: 你已切换为深色模式 day_to_night: 你已切换为深色模式

View File

@@ -1,7 +1,3 @@
sidebar:
catalog: 目錄
have_read: 你已經讀了
footer: footer:
framework: 框架 framework: 框架
theme: 主題 theme: 主題
@@ -77,25 +73,23 @@ aside:
site_pv_name: 本站總訪問量 site_pv_name: 本站總訪問量
more_button: 檢視更多 more_button: 檢視更多
card_newest_comments: card_newest_comments:
heading: 最新評論 headline: 最新評論
loading_text: 正在加載中... loading_text: 正在加載中...
zero_day: 今天 error: 無法獲取資料,請確認相關配置是否正確
day: 天前 card_toc: 目錄
date_suffix: date_suffix:
one_hour: 剛剛 just: 剛剛
hours: 小時 min: 分鐘
hour: 小時前
day: 天前 day: 天前
month: 個月前
donate: 打賞 donate: 打賞
share: 分享 share: 分享
bookmark:
title: 新增書籤
rightside: rightside:
readmode_title: 閱讀模式 readmode_title: 閱讀模式
font_plus_title: 放大字型
font_minus_title: 縮小字型
translate_title: 簡繁轉換 translate_title: 簡繁轉換
night_mode_title: 淺色和深色模式轉換 night_mode_title: 淺色和深色模式轉換
back_to_top: 回到頂部 back_to_top: 回到頂部
@@ -110,9 +104,6 @@ copy_copyright:
info: 著作權歸作者所有。商業轉載請聯絡作者獲得授權,非商業轉載請註明出處。 info: 著作權歸作者所有。商業轉載請聯絡作者獲得授權,非商業轉載請註明出處。
Snackbar: Snackbar:
bookmark:
message_prev:
message_next: 鍵將本頁加入書籤
chs_to_cht: 你已切換為繁體 chs_to_cht: 你已切換為繁體
cht_to_chs: 你已切換為簡體 cht_to_chs: 你已切換為簡體
day_to_night: 你已切換為深色模式 day_to_night: 你已切換為深色模式

View File

@@ -13,8 +13,7 @@ html(lang=config.language data-theme=theme.display_mode)
canvas.fireworks canvas.fireworks
if theme.background if theme.background
- var is_photo = theme.background.startsWith('url') ? 'photo':'color' #web_bg
#web_bg(data-type=is_photo)
#error-wrap #error-wrap
.error-content .error-content
@@ -26,5 +25,4 @@ html(lang=config.language data-theme=theme.display_mode)
i.fas.fa-rocket i.fas.fa-rocket
= _p('error404.back_button') = _p('error404.back_button')
!=partial('includes/third-party/search/index', {}, {cache:theme.fragment_cache})
include includes/additional-js.pug include includes/additional-js.pug

View File

@@ -1,24 +0,0 @@
#page
.flink#article-container
if site.data.link
each i in site.data.link
if i.class_name
h2!= i.class_name
if i.class_desc
.flink-desc!=i.class_desc
.flink-list
each item in i.link_list
.flink-list-item
a(href=url_for(item.link) title=item.name target="_blank")
if theme.lazyload.enable
img(data-lazy-src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name )
else
img(src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name )
span.flink-item-name= item.name
span.flink-item-desc(title=item.descr)= item.descr
!= page.content
if page.comments !== false && theme.comments && theme.comments.use
- var commentsJsLoad = true
!=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache})

View File

@@ -33,9 +33,12 @@ div
!=partial('includes/loading/loading-js', {}, {cache:theme.fragment_cache}) !=partial('includes/loading/loading-js', {}, {cache:theme.fragment_cache})
.js-pjax .js-pjax
if is_home() && theme.subtitle.enable if theme.subtitle.enable && is_home() && theme.index_img !== false
include ./third-party/subtitle.pug include ./third-party/subtitle.pug
if page.type === 'artitalk'
include ./third-party/artitalk.pug
include ./third-party/math/index.pug include ./third-party/math/index.pug
if commentsJsLoad if commentsJsLoad
@@ -60,9 +63,12 @@ div
if theme.aplayerInject && theme.aplayerInject.enable if theme.aplayerInject && theme.aplayerInject.enable
if theme.pjax.enable || theme.aplayerInject.per_page if theme.pjax.enable || theme.aplayerInject.per_page
include ./head/aplayer.pug include ./third-party/aplayer.pug
else if page.aplayer else if page.aplayer
include ./head/aplayer.pug include ./third-party/aplayer.pug
if theme.pjax.enable if theme.pjax.enable
!=partial('includes/third-party/pjax', {}, {cache:theme.fragment_cache}) !=partial('includes/third-party/pjax', {}, {cache:theme.fragment_cache})
!=partial('includes/third-party/baidu_push', {}, {cache:theme.fragment_cache})

View File

@@ -19,5 +19,5 @@
.icp .icp
a(href=theme.footer.ICP.url) a(href=theme.footer.ICP.url)
if theme.footer.ICP.icon if theme.footer.ICP.icon
img.icp-icon(src=url_for(theme.footer.ICP.icon)) img.icp-icon(src=url_for(theme.footer.ICP.icon) alt='ICP')
span=theme.footer.ICP.text span=theme.footer.ICP.text

View File

@@ -10,7 +10,6 @@
- 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
- var pageDescription = page_description()
- var pageKeywords - var pageKeywords
- if (page.keywords) pageKeywords = Array.isArray(page.keywords) ? (page.keywords).join(',') : ([]).join(',') || page.keywords - 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 if (page.tags && page.tags.length) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',')
@@ -23,7 +22,6 @@ 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)
if pageKeywords if pageKeywords
meta(name="keywords" content=pageKeywords) meta(name="keywords" content=pageKeywords)
meta(name="author" content=pageAuthor) meta(name="author" content=pageAuthor)
@@ -35,6 +33,9 @@ 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")
//- Open_Graph
include ./head/Open_Graph.pug
!=favicon_tag(theme.favicon || config.favicon) !=favicon_tag(theme.favicon || config.favicon)
link(rel="canonical" href=urlNoIndex()) link(rel="canonical" href=urlNoIndex())
@@ -44,14 +45,6 @@ link(rel="canonical" href=urlNoIndex())
//- 網站驗證 //- 網站驗證
!=partial('includes/head/site_verification', {}, {cache:theme.fragment_cache}) !=partial('includes/head/site_verification', {}, {cache:theme.fragment_cache})
//- Open_Graph
include ./head/Open_Graph.pug
if theme.facebook_comments.app_id
meta(property="fb:app_id" content=theme.facebook_comments.app_id )
if theme.facebook_comments.user_id
meta(property="fb:admins" content=theme.facebook_comments.user_id)
//- PWA //- PWA
if (theme.pwa && theme.pwa.enable) if (theme.pwa && theme.pwa.enable)
!=partial('includes/head/pwa', {}, {cache:theme.fragment_cache}) !=partial('includes/head/pwa', {}, {cache:theme.fragment_cache})
@@ -86,7 +79,6 @@ if theme.blog_title_font && theme.blog_title_font.font_link
include ./head/config_site.pug include ./head/config_site.pug
include ./head/noscript.pug include ./head/noscript.pug
!=partial('includes/head/darkmode', {}, {cache:theme.fragment_cache}) !=partial('includes/head/js', {}, {cache:theme.fragment_cache})
!=fragment_cache('injectHead', function(){return injectHtml(theme.inject.head)}) !=fragment_cache('injectHead', function(){return injectHtml(theme.inject.head)})

View File

@@ -1,12 +1,11 @@
- var contentType = is_post() ? 'article' : 'website'
if theme.Open_Graph_meta if theme.Open_Graph_meta
meta(property="og:type" content=contentType) - let contentType = is_post() ? 'article' : 'website'
meta(property="og:title" content=pageTitle) - let metaImage = full_url_for(page.cover || theme.avatar.img)
meta(property="og:url" content=urlNoIndex()) - let fb_appId = theme.facebook_comments.app_id || ''
meta(property="og:site_name" content=config.title) - let fb_admins = theme.facebook_comments.user_id || ''
meta(property="og:description" content!=pageDescription)
meta(property="og:image" content=full_url_for(page.cover || theme.avatar.img)) != open_graph({type: contentType, image: metaImage, fb_admins: fb_admins, fb_app_id: fb_appId})
meta(property="article:published_time" content=date_xml(page.date))
meta(property="article:modified_time" content=date_xml(page.updated)) else
meta(name="twitter:card" content="summary") meta(name="description" content=page_description())

View File

@@ -61,10 +61,6 @@
let Snackbar = 'undefined'; let Snackbar = 'undefined';
if (theme.snackbar && theme.snackbar.enable) { if (theme.snackbar && theme.snackbar.enable) {
Snackbar = JSON.stringify({ Snackbar = JSON.stringify({
bookmark: {
message_prev: _p("Snackbar.bookmark.message_prev"),
message_next: _p("Snackbar.bookmark.message_next")
},
chs_to_cht: _p("Snackbar.chs_to_cht"), chs_to_cht: _p("Snackbar.chs_to_cht"),
cht_to_chs: _p("Snackbar.cht_to_chs"), cht_to_chs: _p("Snackbar.cht_to_chs"),
day_to_night: _p("Snackbar.day_to_night"), day_to_night: _p("Snackbar.day_to_night"),
@@ -94,16 +90,9 @@
}) })
} }
let date_suffix = JSON.stringify({
one_hour: _p("date_suffix.one_hour"),
hours: _p("date_suffix.hours"),
day: _p('date_suffix.day')
})
script. script.
var GLOBAL_CONFIG = { var GLOBAL_CONFIG = {
root: '!{config.root}', root: '!{config.root}',
hexoversion: '!{get_hexo_version()}',
algolia: !{algolia}, algolia: !{algolia},
localSearch: !{localSearch}, localSearch: !{localSearch},
translate: !{translate}, translate: !{translate},
@@ -114,22 +103,26 @@ script.
error: '!{_p("copy.error")}', error: '!{_p("copy.error")}',
noSupport: '!{_p("copy.noSupport")}' noSupport: '!{_p("copy.noSupport")}'
}, },
bookmark: { relativeDate: {
message_prev: '!{_p("Snackbar.bookmark.message_prev")}', homepage: !{theme.post_meta.page.date_format === 'relative'},
message_next: '!{_p("Snackbar.bookmark.message_next")}' post: !{theme.post_meta.post.date_format === 'relative'}
}, },
runtime: '!{theme.runtimeshow.enable ? _p("aside.card_webinfo.runtime.unit") : ""}', runtime: '!{theme.runtimeshow.enable ? _p("aside.card_webinfo.runtime.unit") : ""}',
date_suffix: !{date_suffix}, date_suffix: {
just: '!{_p("date_suffix.just")}',
min: '!{_p("date_suffix.min")}',
hour: '!{_p("date_suffix.hour")}',
day: '!{_p("date_suffix.day")}',
month: '!{_p("date_suffix.month")}'
},
copyright: !{copyright}, copyright: !{copyright},
ClickShowText: !{ClickShowText}, ClickShowText: !{ClickShowText},
medium_zoom: !{theme.medium_zoom}, lightbox: '!{ theme.medium_zoom ? "mediumZoom" : (theme.fancybox ? "fancybox" : "null" )}',
fancybox: !{theme.fancybox},
Snackbar: !{Snackbar}, Snackbar: !{Snackbar},
justifiedGallery: { justifiedGallery: {
js: '!{theme.CDN.justifiedGallery_js}', js: '!{theme.CDN.justifiedGallery_js}',
css: '!{theme.CDN.justifiedGallery_css}' css: '!{theme.CDN.justifiedGallery_css}'
}, },
baiduPush: !{theme.baidu_push},
isPhotoFigcaption: !{theme.photofigcaption}, isPhotoFigcaption: !{theme.photofigcaption},
islazyload: !{theme.lazyload.enable}, islazyload: !{theme.lazyload.enable},
isanchor: !{theme.anchor} isanchor: !{theme.anchor}

View File

@@ -5,7 +5,7 @@
else isHighlightShrink = theme.highlight_shrink else isHighlightShrink = theme.highlight_shrink
const pageToc = page.toc === true || page.toc === false ? page.toc : theme.toc.enable const pageToc = page.toc === true || page.toc === false ? page.toc : theme.toc.enable
const showToc = is_post() && pageToc && (toc(page.content) !== '' || page.encrypt == true ) const showToc = is_post() && theme.aside.enable && pageToc && (toc(page.content) !== '' || page.encrypt == true )
- -
script#config_change script#config_change
@@ -14,6 +14,6 @@ script#config_change
isPost: !{is_post()}, isPost: !{is_post()},
isHome: !{is_home()}, isHome: !{is_home()},
isHighlightShrink: !{isHighlightShrink}, isHighlightShrink: !{isHighlightShrink},
isSidebar: !{showToc}, isToc: !{showToc},
postUpdate: '!{full_date(page.updated)}' postUpdate: '!{full_date(page.updated)}'
} }

View File

@@ -1,50 +0,0 @@
if theme.darkmode.enable
script.
var activateDarkMode = function () {
document.documentElement.setAttribute('data-theme', 'dark')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
}
}
var activateLightMode = function () {
document.documentElement.setAttribute('data-theme', 'light')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
}
}
var autoChangeMode = '#{theme.darkmode.autoChangeMode}'
var t = saveToLocal.get('theme')
if (autoChangeMode === '1') {
var isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
var isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
var isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
var hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
if (t === undefined) {
if (isLightMode) activateLightMode()
else if (isDarkMode) activateDarkMode()
else if (isNotSpecified || hasNoSupport) {
var now = new Date()
var hour = now.getHours()
var isNight = hour <= 6 || hour >= 18
isNight ? activateDarkMode() : activateLightMode()
}
window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
if (saveToLocal.get('theme') === undefined) {
e.matches ? activateDarkMode() : activateLightMode()
}
})
} else if (t === 'light') activateLightMode()
else activateDarkMode()
} else if (autoChangeMode === '2') {
now = new Date()
hour = now.getHours()
isNight = hour <= 6 || hour >= 18
if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
else if (t === 'light') activateLightMode()
else activateDarkMode()
} else {
if (t === 'dark') activateDarkMode()
else if (t === 'light') activateLightMode()
}

View File

@@ -0,0 +1,65 @@
script
| (function () {
if theme.darkmode.enable
| window.activateDarkMode = function () {
| document.documentElement.setAttribute('data-theme', 'dark')
| if (document.querySelector('meta[name="theme-color"]') !== null) {
| document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
| }
| }
| window.activateLightMode = function () {
| document.documentElement.setAttribute('data-theme', 'light')
| if (document.querySelector('meta[name="theme-color"]') !== null) {
| document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
| }
| }
| const autoChangeMode = '#{theme.darkmode.autoChangeMode}'
| const t = saveToLocal.get('theme')
| if (autoChangeMode === '1') {
| const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
| const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
| const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
| const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
| if (t === undefined) {
| if (isLightMode) activateLightMode()
| else if (isDarkMode) activateDarkMode()
| else if (isNotSpecified || hasNoSupport) {
| const now = new Date()
| const hour = now.getHours()
| const isNight = hour <= 6 || hour >= 18
| isNight ? activateDarkMode() : activateLightMode()
| }
| window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
| if (saveToLocal.get('theme') === undefined) {
| e.matches ? activateDarkMode() : activateLightMode()
| }
| })
| } else if (t === 'light') activateLightMode()
| else activateDarkMode()
| } else if (autoChangeMode === '2') {
| const now = new Date()
| const hour = now.getHours()
| const isNight = hour <= 6 || hour >= 18
| if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
| else if (t === 'light') activateLightMode()
| else activateDarkMode()
| } else {
| if (t === 'dark') activateDarkMode()
| else if (t === 'light') activateLightMode()
| }
if theme.aside.enable && theme.aside.button
| const asideStatus = saveToLocal.get('aside-status')
| if (asideStatus !== undefined) {
| if (asideStatus === 'hide') {
| document.documentElement.classList.add('hide-aside')
| } else {
| document.documentElement.classList.remove('hide-aside')
| }
| }
| })()

View File

@@ -6,4 +6,9 @@ noscript.
.justified-gallery img { .justified-gallery img {
opacity: 1 opacity: 1
} }
#recent-posts time,
#post-meta time {
display: inline !important
}
</style> </style>

View File

@@ -1,43 +1,48 @@
if is_home() if page.top_img !== false
- var top_img = theme.index_img || theme.default_top_img if is_post()
else if is_post()
- var top_img = page.top_img || page.cover || page.randomcover || theme.default_top_img - var top_img = page.top_img || page.cover || page.randomcover || theme.default_top_img
else if is_archive() else if is_page()
- var top_img = theme.archive_img || theme.default_top_img - var top_img = page.top_img || theme.default_top_img
else if is_tag() else if is_tag()
- var top_img = theme.tag_img || theme.default_top_img - var top_img = theme.tag_per_img && theme.tag_per_img[page.tag]
else if is_category() - top_img = top_img ? top_img : (theme.tag_img !== false ? theme.tag_img || theme.default_top_img : false)
- var top_img = theme.category_img || theme.default_top_img else if is_category()
else - var top_img = theme.category_per_img && theme.category_per_img[page.category]
- top_img = top_img ? top_img : (theme.category_img !== false ? theme.category_img || theme.default_top_img : false)
else if is_home()
- var top_img = theme.index_img !== false ? theme.index_img || theme.default_top_img : false
else if is_archive()
- var top_img = theme.archive_img !== false ? theme.archive_img || theme.default_top_img : false
else
- var top_img = page.top_img || theme.default_top_img - var top_img = page.top_img || theme.default_top_img
if theme.douban if top_img !== false
if is_current('/movies/', [strict]) - var imgSource = top_img && top_img.indexOf('/') !== -1 ? `background-image: url(${url_for(top_img)})` : `background: ${top_img}`
- var top_img = theme.douban.movies_img || theme.default_top_img - var bg_img = top_img ? imgSource : ''
else if is_current('/books/', [strict]) - var site_title = is_archive() ? _p('page.archives') : page.title || page.tag || page.category || config.title
- var top_img = theme.douban.books_img || theme.default_top_img - var isHomeClass = is_home() ? 'full_page' : 'not-index-bg'
else if is_current('/games/', [strict]) - is_post() ? isHomeClass = 'post-bg' : isHomeClass
- var top_img = theme.douban.games_img || theme.default_top_img else
- var isHomeClass = 'no-top-img'
- var bg_img = top_img && top_img !== true ? `background-image: url(${url_for(top_img)})` : '' else
- var site_title = is_archive() ? _p('page.archives') : page.title || page.tag || page.category || config.title - var top_img = false
- var isHomeClass = is_home() ? 'full_page' : 'not-index-bg' - var isHomeClass = 'no-top-img'
- is_post() ? isHomeClass = 'post-bg' : isHomeClass
header#page-header(class=isHomeClass style=bg_img) header#page-header(class=isHomeClass style=bg_img)
!=partial('includes/header/nav', {}, {cache:theme.fragment_cache}) !=partial('includes/header/nav', {}, {cache:theme.fragment_cache})
if is_home() if top_img !== false
if is_post()
include ./post-info.pug
else if is_home()
#site-info #site-info
h1#site_title=site_title h1#site-title=site_title
#site_subtitle #site-subtitle
span#subtitle span#subtitle
if(theme.social) if(theme.social)
#site_social_icons #site_social_icons
!=fragment_cache('social', function(){return partial('includes/header/social')}) !=fragment_cache('social', function(){return partial('includes/header/social')})
#scroll_down #scroll-down
i.fas.fa-angle-down.scroll-down-effects i.fas.fa-angle-down.scroll-down-effects
else if is_post()
include ./post-info.pug
else else
#page_site-info #page-site-info
h1#site_title=site_title h1#site-title=site_title

View File

@@ -1,6 +1,5 @@
#post-info #post-info
#post-title h1.post-title= page.title || _p('no_title')
.posttitle= page.title || _p('no_title')
#post-meta #post-meta
.meta-firstline .meta-firstline

View File

@@ -1,41 +1,40 @@
- var htmlClassHideAside = theme.aside.enable && theme.aside.hide ? 'hide-aside' : ''
- var hideAside = !theme.aside.enable || page.aside === false ? 'hide-aside' : '' - var hideAside = !theme.aside.enable || page.aside === false ? 'hide-aside' : ''
doctype html doctype html
html(lang=config.language data-theme=theme.display_mode) html(lang=config.language data-theme=theme.display_mode class=htmlClassHideAside)
head head
include ./head.pug include ./head.pug
body body
if theme.preloader if theme.preloader
!=partial('includes/loading/loading', {}, {cache:theme.fragment_cache}) !=partial('includes/loading/loading', {}, {cache:theme.fragment_cache})
!=partial('includes/mobile-sidebar/index', {}, {cache:theme.fragment_cache}) if theme.background
#web_bg
!=partial('includes/sidebar', {}, {cache:theme.fragment_cache})
#body-wrap #body-wrap
if theme.background
- var is_photo = theme.background.startsWith('url') ? 'photo':'color'
#web_bg(data-type=is_photo)
include ./sidebar.pug
include ./header/index.pug include ./header/index.pug
if (!is_post()) main#content-inner.layout(class=hideAside)
main#content-inner.layout_page(class=hideAside)
if body if body
div!= body div!= body
else else
block content block content
if theme.aside.enable && page.aside !== false if theme.aside.enable && page.aside !== false
!=partial('includes/widget/index', {}, {cache:theme.fragment_cache}) include widget/index.pug
else
main#content-inner.layout_post
if body
div!= body
else
block content
- var footer_bg = theme.footer_bg == false ? '' : bg_img - var footerBg = theme.footer_bg
- var is_bg = theme.footer_bg == false ? 'color' : 'photo' if (footerBg)
footer#footer(style=footer_bg data-type=is_bg) if (footerBg === true)
- var footer_bg = bg_img
else
- var footer_bg = theme.footer_bg.indexOf('/') !== -1 ? `background-image: url(${url_for(footerBg)})` : `background: ${footerBg}`
else
- var footer_bg = ''
footer#footer(style=footer_bg)
!=partial('includes/footer', {}, {cache:theme.fragment_cache}) !=partial('includes/footer', {}, {cache:theme.fragment_cache})
include ./rightside.pug include ./rightside.pug

View File

@@ -1,6 +1,13 @@
script. script.
var endLoading = function () { var preloader = {
endLoading: () => {
document.body.style.overflow = 'auto'; document.body.style.overflow = 'auto';
document.getElementById('loading-box').classList.add("loaded") document.getElementById('loading-box').classList.add("loaded")
},
initLoading: () => {
document.body.style.overflow = '';
document.getElementById('loading-box').classList.remove("loaded")
} }
window.addEventListener('load',endLoading) }
window.addEventListener('load',()=> {preloader.endLoading()})

View File

@@ -57,9 +57,12 @@ mixin postUI(posts)
span.article-meta__link #[='•'] span.article-meta__link #[='•']
//- Display the article introduction on homepage //- Display the article introduction on homepage
if theme.index_post_content.method == 1 case theme.index_post_content.method
when false
- break
when 1
.content!= article.description .content!= article.description
else if theme.index_post_content.method == 2 when 2
if article.description if article.description
.content!= article.description .content!= article.description
else else
@@ -67,7 +70,7 @@ mixin postUI(posts)
- let expert = content.substring(0, theme.index_post_content.length) - let expert = content.substring(0, theme.index_post_content.length)
- content.length > theme.index_post_content.length ? expert += ' ...' : '' - content.length > theme.index_post_content.length ? expert += ' ...' : ''
.content!= expert .content!= expert
else default
- const content = strip_html(article.content) - const content = strip_html(article.content)
- let expert = content.substring(0, theme.index_post_content.length) - let expert = content.substring(0, theme.index_post_content.length)
- content.length > theme.index_post_content.length ? expert += ' ...' : '' - content.length > theme.index_post_content.length ? expert += ' ...' : ''
@@ -75,4 +78,4 @@ mixin postUI(posts)
if theme.ad && theme.ad.index if theme.ad && theme.ad.index
if (index + 1) % 3 == 0 if (index + 1) % 3 == 0
.recent-post-item.ad_height!=theme.ad.index .recent-post-item.ad-height!=theme.ad.index

View File

@@ -1,3 +0,0 @@
#mobile-sidebar
#menu_mask
include ../mobile-sidebar/mobile-menus.pug

View File

@@ -1,29 +0,0 @@
#mobile-sidebar-menus
.mobile_author_icon
if theme.lazyload.enable
img.avatar-img(data-lazy-src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar")
else
img.avatar-img(src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar")
.mobile_post_data
if site.posts.length
.mobile_data_item.is-center
.mobile_data_link
a(href=url_for(config.archive_dir) + '/')
.headline= _p('aside.articles')
.length_num= site.posts.length
if site.tags.length
.mobile_data_item.is-center
.mobile_data_link
a(href=url_for(config.tag_dir) + '/' )
.headline= _p('aside.tags')
.length_num= site.tags.length
if site.categories.length
.mobile_data_item.is-center
.mobile_data_link
a(href=url_for(config.category_dir) + '/')
.headline= _p('aside.categories')
.length_num= site.categories.length
hr
!=fragment_cache('menus', function(){return partial('includes/header/menu_item')})

View File

@@ -0,0 +1,4 @@
if top_img === false
h1.page-title= page.title
#artitalk_main

View File

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

View File

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

View File

@@ -0,0 +1,19 @@
.flink#article-container
if site.data.link
each i in site.data.link
if i.class_name
h2!= i.class_name
if i.class_desc
.flink-desc!=i.class_desc
.flink-list
each item in i.link_list
.flink-list-item
a(href=url_for(item.link) title=item.name target="_blank")
if theme.lazyload.enable
img(data-lazy-src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name )
else
img(src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name )
span.flink-item-name= item.name
span.flink-item-desc(title=item.descr)= item.descr
!= page.content

View File

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

View File

@@ -1,28 +1,33 @@
section#rightside #rightside
#rightside-config-hide #rightside-config-hide
if is_post() if is_post() && theme.readmode
if theme.readmode
button#readmode(type="button" title=_p('rightside.readmode_title')) button#readmode(type="button" title=_p('rightside.readmode_title'))
i.fas.fa-book-open i.fas.fa-book-open
if theme.translate && theme.translate.enable if theme.translate.enable
button#translateLink(type="button" title=_p('rightside.translate_title'))= theme.translate.default button#translateLink(type="button" title=_p('rightside.translate_title'))= theme.translate.default
if theme.darkmode.enable && theme.darkmode.button if theme.darkmode.enable && theme.darkmode.button
button#darkmode(type="button" title=_p('rightside.night_mode_title')) button#darkmode(type="button" title=_p('rightside.night_mode_title'))
i.fas.fa-adjust i.fas.fa-adjust
if theme.aside.enable && theme.aside.button && page.aside !== false
button#hide-aside-btn(type="button")
i.fas.fa-arrows-alt-h
#rightside-config-show #rightside-config-show
if is_post()
if (theme.readmode || theme.translate.enable || (theme.darkmode.enable && theme.darkmode.button))
button#rightside_config(type="button" title=_p("rightside.setting")) button#rightside_config(type="button" title=_p("rightside.setting"))
i.fas.fa-cog i.fas.fa-cog
if is_post() && page.comments !== false && theme.comments.use if showToc && theme.aside.mobile
a#to_comment(href="#post-comment" title=_p("rightside.scroll_to_comment"))
i.fas.fa-comments
if showToc
button#mobile-toc-button.close(type="button" title=_p("rightside.toc")) button#mobile-toc-button.close(type="button" title=_p("rightside.toc"))
i.fas.fa-list-ul i.fas.fa-list-ul
else if theme.translate.enable || (theme.darkmode.enable && theme.darkmode.button)
button#rightside_config(type="button" title=_p("rightside.setting"))
i.fas.fa-cog
if theme.chat_btn if theme.chat_btn
button#chat_btn(type="button" title=_p("rightside.chat_btn")) button#chat_btn(type="button" title=_p("rightside.chat_btn"))
i.fas.fa-sms i.fas.fa-sms
if commentsJsLoad
a#to_comment(href="#post-comment" title=_p("rightside.scroll_to_comment"))
i.fas.fa-comments
button#go-up(type="button" title=_p("rightside.back_to_top")) button#go-up(type="button" title=_p("rightside.back_to_top"))
i.fas.fa-arrow-up i.fas.fa-arrow-up

View File

@@ -1,21 +1,31 @@
- #sidebar
let tocNumber = page.toc_number !== undefined ? page.toc_number : theme.toc.number #menu-mask
let autoOpenPostSet = page.auto_open == undefined ? theme.toc.auto_open : page.auto_open #sidebar-menus
let autoOpenSidebar = autoOpenPostSet ? 'on' : '' .author-avatar
- if theme.lazyload.enable
img.avatar-img(data-lazy-src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar")
if(showToc)
#sidebar
i.fas.fa-arrow-right#toggle-sidebar(class=autoOpenSidebar)
.sidebar-toc
div.sidebar-toc__title= _p('sidebar.catalog')
div.sidebar-toc__progress
span.progress-notice= _p('sidebar.have_read')
span.progress-num 0
span.progress-percentage %
div.sidebar-toc__progress-bar
if (page.encrypt == true)
div.sidebar-toc__content.toc-div-class(style="display:none")!=toc(page.origin, {list_number: tocNumber})
else else
div.sidebar-toc__content!=toc(page.content, {list_number: tocNumber}) img.avatar-img(src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar")
.site-data
if site.posts.length
.data-item.is-center
.data-item-link
a(href=url_for(config.archive_dir) + '/')
.headline= _p('aside.articles')
.length-num= site.posts.length
if site.tags.length
.data-item.is-center
.data-item-link
a(href=url_for(config.tag_dir) + '/' )
.headline= _p('aside.tags')
.length-num= site.tags.length
if site.categories.length
.data-item.is-center
.data-item-link
a(href=url_for(config.category_dir) + '/')
.headline= _p('aside.categories')
.length-num= site.categories.length
hr
!=fragment_cache('menus', function(){return partial('includes/header/menu_item')})

View File

@@ -0,0 +1,24 @@
- let option = theme.artitalk.option ? JSON.stringify(theme.artitalk.option) : false
script.
(()=>{
let setting = {
appId: '!{theme.artitalk.appId}',
appKey: '!{theme.artitalk.appKey}',
}
if (!{Boolean(option)}) {
const otherSetting = !{option}
setting = Object.assign({}, setting, otherSetting)
}
const init = () => {
new Artitalk(setting)
}
if (typeof Artitalk === 'function') {
init()
} else {
$.getScript('!{theme.CDN.artitalk}',init)
}
})()

View File

@@ -0,0 +1,15 @@
if theme.baidu_push
script.
(function(){
const bp = document.createElement('script');
const curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https'){
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
}
else{
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
bp.dataset.pjax = ''
const s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})()

View File

@@ -1,3 +1,4 @@
- let disqusjsApi = theme.disqusjs.api || 'https://disqus.skk.moe/disqus/'
script. script.
function loadDisqusjs () { function loadDisqusjs () {
function addDisqusjsCSS () { function addDisqusjsCSS () {
@@ -15,7 +16,7 @@ script.
identifier: '!{ page.path }', identifier: '!{ page.path }',
url: '!{ page.permalink }', url: '!{ page.permalink }',
title: '!{ page.title }', title: '!{ page.title }',
api: '!{theme.disqusjs.api}', api: '!{disqusjsApi}',
apikey: '!{theme.disqusjs.apikey}', apikey: '!{theme.disqusjs.apikey}',
nocomment: '!{theme.disqusjs.nocomment}', nocomment: '!{theme.disqusjs.nocomment}',
admin: '!{theme.disqusjs.admin}', admin: '!{theme.disqusjs.admin}',

View File

@@ -7,11 +7,9 @@ hr
span= ' ' + _p('comment') span= ' ' + _p('comment')
if theme.comments.use.length > 1 if theme.comments.use.length > 1
.comment-switch #comment-switch
span.first-comment=defaultComment span.first-comment=defaultComment
label span.switch-btn
input#switch-comments-btn(type="checkbox")
span.slider
span.second-comment=theme.comments.use[1] span.second-comment=theme.comments.use[1]
@@ -31,6 +29,8 @@ hr
#gitalk-container #gitalk-container
when 'Utterances' when 'Utterances'
#utterances-wrap #utterances-wrap
when 'Twikoo'
#twikoo
when 'Facebook Comments' when 'Facebook Comments'
.fb-comments(data-colorscheme = theme.display_mode === 'dark' ? 'dark' : 'light' .fb-comments(data-colorscheme = theme.display_mode === 'dark' ? 'dark' : 'light'
data-numposts= theme.facebook_comments.pageSize || 10 data-numposts= theme.facebook_comments.pageSize || 10

View File

@@ -12,5 +12,7 @@ each name in theme.comments.use
include ./gitalk.pug include ./gitalk.pug
when 'Utterances' when 'Utterances'
!=partial('includes/third-party/comments/utterances', {}, {cache:theme.fragment_cache}) !=partial('includes/third-party/comments/utterances', {}, {cache:theme.fragment_cache})
when 'Twikoo'
!=partial('includes/third-party/comments/twikoo', {}, {cache:theme.fragment_cache})
when 'Facebook Comments' when 'Facebook Comments'
!=partial('includes/third-party/comments/facebook_comments', {}, {cache:theme.fragment_cache}) !=partial('includes/third-party/comments/facebook_comments', {}, {cache:theme.fragment_cache})

View File

@@ -0,0 +1,24 @@
script.
function loadTwikoo () {
function init () {
twikoo.init({
envId: '!{theme.twikoo}'
})
}
if (typeof twikoo.init === 'function') {
init()
} else {
$.getScript('!{theme.CDN.twikoo}', init)
}
}
if ('!{theme.comments.use[0]}' === 'Twikoo' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('twikoo'), loadTwikoo)
else loadTwikoo()
} else {
function loadOtherComment () {
loadTwikoo()
}
}

View File

@@ -1,3 +1,4 @@
- let option = theme.valine.option ? JSON.stringify(theme.valine.option) : false
- let emojiMaps = '""' - let emojiMaps = '""'
if site.data.valine if site.data.valine
- emojiMaps = JSON.stringify(site.data.valine) - emojiMaps = JSON.stringify(site.data.valine)
@@ -5,7 +6,7 @@ if site.data.valine
script. script.
function loadValine () { function loadValine () {
function initValine () { function initValine () {
window.valine = new Valine({ let initData = {
el: '#vcomment', el: '#vcomment',
appId: '#{theme.valine.appId}', appId: '#{theme.valine.appId}',
appKey: '#{theme.valine.appKey}', appKey: '#{theme.valine.appKey}',
@@ -20,8 +21,18 @@ script.
emojiMaps: !{emojiMaps}, emojiMaps: !{emojiMaps},
enableQQ: #{theme.valine.enableQQ}, enableQQ: #{theme.valine.enableQQ},
path: window.location.pathname, path: window.location.pathname,
}); }
if ('#{theme.valine.requiredFields}') { valine.config.requiredFields= '#{theme.valine.requiredFields}'.split(',') }
if (!{Boolean(theme.valine.requiredFields)}) {
initData.requiredFields= ('!{theme.valine.requiredFields}'.split(','))
}
if (!{Boolean(option)}) {
const otherData = !{option}
initData = Object.assign({}, initData, otherData)
}
const valine = new Valine(initData)
} }
if (typeof Valine === 'function') initValine() if (typeof Valine === 'function') initValine()

View File

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

View File

@@ -41,7 +41,7 @@ script.
} }
} }
var script = document.createElement('script') const script = document.createElement('script')
script.src = '!{theme.CDN.mathjax}' script.src = '!{theme.CDN.mathjax}'
script.id = 'MathJax-script' script.id = 'MathJax-script'
script.async = true script.async = true

View File

@@ -28,6 +28,9 @@ script.
// set expiry to 10 min // set expiry to 10 min
saveToLocal.set('disqus-newest-comments', JSON.stringify(disqusArray), 10/(60*24)) saveToLocal.set('disqus-newest-comments', JSON.stringify(disqusArray), 10/(60*24))
generateHtml(disqusArray) generateHtml(disqusArray)
}).fail(()=>{
const $dom = document.querySelector('#card-newest-comments .aside-list')
$dom.innerHTML= "!{_p('aside.card_newest_comments.error')}"
}) })
} }
@@ -38,7 +41,7 @@ script.
result += '<div class=\'aside-list-item\'>' result += '<div class=\'aside-list-item\'>'
if (!{theme.newest_comments.avatar}) { if (!{theme.newest_comments.avatar}) {
result += `<a href='${array[i].url}' class="thumbnail"><img src='${array[i].avatar}'></a>` result += `<a href='${array[i].url}' class='thumbnail'><img src='${array[i].avatar}' alt='${array[i].nick}'></a>`
} }
result += `<div class='content'> result += `<div class='content'>
@@ -47,13 +50,13 @@ script.
</div></div>` </div></div>`
} }
let $dom = document.querySelector('.card-newest-comments .aside-list') let $dom = document.querySelector('#card-newest-comments .aside-list')
$dom.innerHTML= result $dom.innerHTML= result
window.pjax && window.pjax.refresh($dom) window.pjax && window.pjax.refresh($dom)
} }
const newestCommentInit = () => { const newestCommentInit = () => {
if (document.querySelector('.card-newest-comments .aside-list')) { if (document.querySelector('#card-newest-comments .aside-list')) {
const data = saveToLocal.get('disqus-newest-comments') const data = saveToLocal.get('disqus-newest-comments')
if (data) { if (data) {
generateHtml(JSON.parse(data)) generateHtml(JSON.parse(data))

View File

@@ -27,6 +27,9 @@ script.
}) })
saveToLocal.set('github-newest-comments', JSON.stringify(githubArray), 10/(60*24)) saveToLocal.set('github-newest-comments', JSON.stringify(githubArray), 10/(60*24))
generateHtml(githubArray) generateHtml(githubArray)
}).fail(()=>{
const $dom = document.querySelector('#card-newest-comments .aside-list')
$dom.innerHTML= "!{_p('aside.card_newest_comments.error')}"
}) })
} }
@@ -37,7 +40,7 @@ script.
result += '<div class=\'aside-list-item\'>' result += '<div class=\'aside-list-item\'>'
if (!{theme.newest_comments.avatar}) { if (!{theme.newest_comments.avatar}) {
result += `<a href='${array[i].url}' class="thumbnail"><img src='${array[i].avatar}'></a>` result += `<a href='${array[i].url}' class="thumbnail"><img src='${array[i].avatar}' alt='${array[i].nick}'></a>`
} }
result += `<div class='content'> result += `<div class='content'>
@@ -46,13 +49,13 @@ script.
</div></div>` </div></div>`
} }
let $dom = document.querySelector('.card-newest-comments .aside-list') let $dom = document.querySelector('#card-newest-comments .aside-list')
$dom.innerHTML= result $dom.innerHTML= result
window.pjax && window.pjax.refresh($dom) window.pjax && window.pjax.refresh($dom)
} }
const newestCommentInit = () => { const newestCommentInit = () => {
if (document.querySelector('.card-newest-comments .aside-list')) { if (document.querySelector('#card-newest-comments .aside-list')) {
const data = saveToLocal.get('github-newest-comments') const data = saveToLocal.get('github-newest-comments')
if (data) { if (data) {
generateHtml(JSON.parse(data)) generateHtml(JSON.parse(data))

View File

@@ -28,7 +28,7 @@ script.
result += '<div class=\'aside-list-item\'>' result += '<div class=\'aside-list-item\'>'
if (!{theme.newest_comments.avatar}) { if (!{theme.newest_comments.avatar}) {
result += `<a href='${array[i].url}' class="thumbnail"><img src='${getIcon(array[i].avatar, array[i].mail)}'></a>` result += `<a href='${array[i].url}' class="thumbnail"><img src='${getIcon(array[i].avatar, array[i].mail)}' alt='${array[i].nick}'></a>`
} }
result += `<div class='content'> result += `<div class='content'>
@@ -37,58 +37,59 @@ script.
</div></div>` </div></div>`
} }
let $dom = document.querySelector('.card-newest-comments .aside-list') let $dom = document.querySelector('#card-newest-comments .aside-list')
$dom.innerHTML= result $dom.innerHTML= result
window.pjax && window.pjax.refresh($dom) window.pjax && window.pjax.refresh($dom)
} }
const getValineData = () => { const getValineData = () => {
let serverURL = ''
if (!(AV.applicationId && (AV.applicationKey || AV.masterKey))) { if (!{Boolean(theme.newest_comments.leancloud.serverURL)}) {
const dataInit = { serverURL = '!{theme.newest_comments.leancloud.serverURL}'
appId: '!{theme.newest_comments.leancloud.appId}', } else {
appKey: '!{theme.newest_comments.leancloud.appKey}' serverURL = 'https://!{theme.newest_comments.leancloud.appId.substring(0,8)}.api.lncldglobal.com'
} }
if (!{theme.newest_comments.leancloud.serverURL ? true : false}) { var settings = {
dataInit.serverURL= '!{theme.newest_comments.leancloud.serverURL}' "url": `${serverURL}/1.1/classes/Comment?limit=!{theme.newest_comments.limit}&order=-createdAt`,
"method": "GET",
"timeout": 0,
"headers": {
"X-LC-Id": '!{theme.newest_comments.leancloud.appId}',
"X-LC-Key": '!{theme.newest_comments.leancloud.appKey}',
"Content-Type": "application/json"
},
} }
AV.init(dataInit) $.ajax(settings).done((response) => {
}
const query = new AV.Query('Comment');
query.descending('createdAt').limit(!{theme.newest_comments.limit})
var valineArray = [] var valineArray = []
query.find().then(comments => { response.results.forEach((e)=>{
comments.forEach(comment => {
valineArray.push({ valineArray.push({
'avatar': comment.get('QQAvatar'), 'avatar': e.QQAvatar,
'content': changeContent(comment.get('comment')), 'content': changeContent(e.comment),
'mail': comment.get('mail'), 'mail': e.mail,
'nick': comment.get('nick'), 'nick': e.nick,
'url': comment.get('url'), 'url': e.url,
'date': comment.createdAt, 'date': e.createdAt,
}) })
}) })
}).then(function() {
saveToLocal.set('leancloud-newest-comments', JSON.stringify(valineArray), 10/(60*24)) saveToLocal.set('leancloud-newest-comments', JSON.stringify(valineArray), 10/(60*24))
generateHtml(valineArray) generateHtml(valineArray)
}).fail(()=>{
const $dom = document.querySelector('#card-newest-comments .aside-list')
$dom.innerHTML= "!{_p('aside.card_newest_comments.error')}"
}) })
} }
const newestCommentInit = () => { const newestCommentInit = () => {
if (document.querySelector('.card-newest-comments .aside-list')) { if (document.querySelector('#card-newest-comments .aside-list')) {
const data = saveToLocal.get('leancloud-newest-comments') const data = saveToLocal.get('leancloud-newest-comments')
if (data) { if (data) {
generateHtml(JSON.parse(data)) generateHtml(JSON.parse(data))
} else { } else {
if (typeof window.AV === 'object') {
getValineData() getValineData()
} else {
$.getScript('https://cdn.jsdelivr.net/npm/leancloud-storage@4.6.1/dist/av-min.js', getValineData)
}
} }
} }
} }

View File

@@ -7,7 +7,6 @@ script(src=url_for(theme.CDN.pjax))
script. script.
let pjaxSelectors = [ let pjaxSelectors = [
'title', 'title',
'meta[name=description]',
'#config_change', '#config_change',
'#body-wrap', '#body-wrap',
'#rightside-config-hide', '#rightside-config-hide',
@@ -52,10 +51,14 @@ script.
// prismjs // prismjs
typeof Prism === 'object' && Prism.highlightAll() typeof Prism === 'object' && Prism.highlightAll()
typeof preloader === 'object' && preloader.endLoading()
}) })
document.addEventListener('pjax:send', function () { document.addEventListener('pjax:send', function () {
typeof preloader === 'object' && preloader.initLoading()
if (window.aplayers) { if (window.aplayers) {
for (let i = 0; i < window.aplayers.length; i++) { for (let i = 0; i < window.aplayers.length; i++) {
if (!window.aplayers[i].options.fixed) { if (!window.aplayers[i].options.fixed) {

View File

@@ -1,4 +1,5 @@
#algolia-search.search-dialog #algolia-search
.search-dialog
#algolia-search-title.search-dialog__title Algolia #algolia-search-title.search-dialog__title Algolia
#algolia-input-panel #algolia-input-panel
#algolia-search-input #algolia-search-input
@@ -9,4 +10,4 @@
#algolia-stats #algolia-stats
span.search-close-button span.search-close-button
i.fas.fa-times i.fas.fa-times
#search-mask #search-mask

View File

@@ -1,4 +1,5 @@
#local-search.search-dialog #local-search
.search-dialog
#local-search-title.search-dialog__title=_p("local_search.label") #local-search-title.search-dialog__title=_p("local_search.label")
#local-input-panel #local-input-panel
#local-search-input #local-search-input
@@ -20,4 +21,4 @@
| #[a(href="https://github.com/wzpan/hexo-generator-search" style={'color': '#49B1F5'}) hexo-generator-search] | #[a(href="https://github.com/wzpan/hexo-generator-search" style={'color': '#49B1F5'}) hexo-generator-search]
span.search-close-button span.search-close-button
i.fas.fa-times i.fas.fa-times
#search-mask #search-mask

View File

@@ -1,5 +1,6 @@
- var source = theme.subtitle.source - var source = theme.subtitle.source
if source == '1' case source
when 1
script. script.
function subtitleType () { function subtitleType () {
$.getJSON('https://api.btstu.cn/yan/api.php?charset=utf-8&encode=json',function (data) { $.getJSON('https://api.btstu.cn/yan/api.php?charset=utf-8&encode=json',function (data) {
@@ -26,7 +27,7 @@ if source == '1'
subtitleType() subtitleType()
} }
else if source == '2' when 2
script. script.
function subtitleType () { function subtitleType () {
$.getJSON('https://v1.hitokoto.cn', function (data) { $.getJSON('https://v1.hitokoto.cn', function (data) {
@@ -54,7 +55,7 @@ else if source == '2'
subtitleType() subtitleType()
} }
else if source == '3' when 3
script. script.
function subtitleType () { function subtitleType () {
$.getScript('http://yijuzhan.com/api/word.php?m=js', function () { $.getScript('http://yijuzhan.com/api/word.php?m=js', function () {
@@ -83,7 +84,7 @@ else if source == '3'
subtitleType() subtitleType()
} }
else if source == '4' when 4
script. script.
function subtitleType () { function subtitleType () {
$.getScript('https://sdk.jinrishici.com/v2/browser/jinrishici.js',function () { $.getScript('https://sdk.jinrishici.com/v2/browser/jinrishici.js',function () {
@@ -113,7 +114,7 @@ else if source == '4'
subtitleType() subtitleType()
} }
else default
script. script.
function subtitleType () { function subtitleType () {
if (!{theme.subtitle.effect}) { if (!{theme.subtitle.effect}) {

View File

@@ -13,19 +13,19 @@
.card-info-data-item.is-center .card-info-data-item.is-center
a(href=url_for(config.archive_dir) + '/') a(href=url_for(config.archive_dir) + '/')
.headline= _p('aside.articles') .headline= _p('aside.articles')
.length_num= site.posts.length .length-num= site.posts.length
if site.tags.length if site.tags.length
.card-info-data-item.is-center .card-info-data-item.is-center
a(href=url_for(config.tag_dir) + '/') a(href=url_for(config.tag_dir) + '/')
.headline= _p('aside.tags') .headline= _p('aside.tags')
.length_num= site.tags.length .length-num= site.tags.length
if site.categories.length if site.categories.length
.card-info-data-item.is-center .card-info-data-item.is-center
a(href=url_for(config.category_dir) + '/') a(href=url_for(config.category_dir) + '/')
.headline= _p('aside.categories') .headline= _p('aside.categories')
.length_num= site.categories.length .length-num= site.categories.length
a#card-info-btn.button--animated(href=theme.aside.card_author.button.link) a#card-info-btn.button--animated(href=theme.aside.card_author.button.link)
i(class=theme.aside.card_author.button.icon) i(class=theme.aside.card_author.button.icon)

View File

@@ -1,7 +1,7 @@
.card-widget.card-newest-comments .card-widget#card-newest-comments
.card-content .card-content
.item-headline .item-headline
i.fas.fa-bolt i.fas.fa-bolt
span= _p('aside.card_newest_comments.heading') span= _p('aside.card_newest_comments.headline')
.aside-list .aside-list
span= _p('aside.card_newest_comments.loading_text') span= _p('aside.card_newest_comments.loading_text')

View File

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

View File

@@ -7,18 +7,18 @@
- let postLimit = theme.aside.card_recent_post.limit === 0 ? site.posts.length : theme.aside.card_recent_post.limit || 5 - let postLimit = theme.aside.card_recent_post.limit === 0 ? site.posts.length : theme.aside.card_recent_post.limit || 5
- let sort = theme.aside.card_recent_post.sort === 'updated' ? 'updated' : 'date' - let sort = theme.aside.card_recent_post.sort === 'updated' ? 'updated' : 'date'
- site.posts.sort(sort, -1).limit(postLimit).each(function(article){ - site.posts.sort(sort, -1).limit(postLimit).each(function(article){
.aside-list-item
- let link = article.link || article.path - let link = article.link || article.path
- let title = article.title || _p('no_title') - let title = article.title || _p('no_title')
- let no_cover = article.cover === false || !theme.cover.aside_enable ? 'no-aside-cover' : '' - let no_cover = article.cover === false || !theme.cover.aside_enable ? 'no-cover' : ''
- let post_cover = article.cover - let post_cover = article.cover
.aside-list-item(class=no_cover)
if post_cover && theme.cover.aside_enable if post_cover && theme.cover.aside_enable
a.thumbnail(href=url_for(link) title=title) a.thumbnail(href=url_for(link) title=title)
if theme.lazyload.enable if theme.lazyload.enable
img(data-lazy-src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title) img(data-lazy-src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title)
else else
img(src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title) img(src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title)
.content(class=no_cover) .content
a.title(href=url_for(link) title=title)= title a.title(href=url_for(link) title=title)= title
if theme.aside.card_recent_post.sort === 'updated' if theme.aside.card_recent_post.sort === 'updated'
time(datetime=date_xml(article.updated) title=_p('post.updated') + ' ' + full_date(article.updated)) #[=date(article.updated, config.date_format)] time(datetime=date_xml(article.updated) title=_p('post.updated') + ' ' + full_date(article.updated)) #[=date(article.updated, config.date_format)]

View File

@@ -1,20 +1,28 @@
#aside_content.aside_content #aside_content.aside_content
if theme.aside.card_author.enable if theme.aside.card_author.enable
include ./card_author.pug !=partial('includes/widget/card_author', {}, {cache:theme.fragment_cache})
.sticky_layout
if theme.aside.card_announcement.enable if theme.aside.card_announcement.enable
include ./card_announcement.pug !=partial('includes/widget/card_announcement', {}, {cache:theme.fragment_cache})
.sticky_layout
if is_post()
if showToc
include ./card_post_toc.pug
if theme.aside.card_recent_post.enable if theme.aside.card_recent_post.enable
include ./card_recent_post.pug !=partial('includes/widget/card_recent_post', {}, {cache:theme.fragment_cache})
if theme.newest_comments.enable
include ./card_newest_comment.pug
if theme.ad && theme.ad.aside if theme.ad && theme.ad.aside
include ./card_ad.pug !=partial('includes/widget/card_ad', {}, {cache:theme.fragment_cache})
else
if theme.aside.card_recent_post.enable
!=partial('includes/widget/card_recent_post', {}, {cache:theme.fragment_cache})
if theme.ad && theme.ad.aside
!=partial('includes/widget/card_ad', {}, {cache:theme.fragment_cache})
if theme.newest_comments.enable
!=partial('includes/widget/card_newest_comment', {}, {cache:theme.fragment_cache})
if theme.aside.card_categories.enable if theme.aside.card_categories.enable
include ./card_categories.pug !=partial('includes/widget/card_categories', {}, {cache:theme.fragment_cache})
if theme.aside.card_tags.enable if theme.aside.card_tags.enable
include ./card_tags.pug !=partial('includes/widget/card_tags', {}, {cache:theme.fragment_cache})
if theme.aside.card_archives.enable if theme.aside.card_archives.enable
include ./card_archives.pug !=partial('includes/widget/card_archives', {}, {cache:theme.fragment_cache})
if theme.aside.card_webinfo.enable if theme.aside.card_webinfo.enable
include ./card_webinfo.pug !=partial('includes/widget/card_webinfo', {}, {cache:theme.fragment_cache})

View File

@@ -1,34 +1,19 @@
extends includes/layout.pug extends includes/layout.pug
block content block content
if page.type === 'tags'
.tag-cloud
.tag-cloud__title= _p('page.tag')
| -
span.tag-cloud__amount= site.tags.length
.tag-cloud-tags
!=cloudTags({source: site.tags, minfontsize: 1, maxfontsize: 2.1, limit: 0, unit: 'em'})
if page.comments !== false && theme.comments && theme.comments.use
- var commentsJsLoad = true
!=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache})
else if page.type === 'link'
include flink.pug
else if page.type === 'categories'
.category-content
.category-lists
.category__title= _p('page.category')
| -
span.category__amount= site.categories.length
div!= list_categories()
if page.comments !== false && theme.comments && theme.comments.use
- var commentsJsLoad = true
!=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache})
else
#page #page
if theme.douban && theme.douban.meta case page.type
if (is_current('/movies/', [strict]) || is_current('/books/', [strict]) || is_current('/games/', [strict])) when 'tags'
meta(name="referrer" content="no-referrer") include includes/page/tags.pug
#article-container!= page.content when 'link'
include includes/page/flink.pug
when 'categories'
include includes/page/categories.pug
when 'artitalk'
include includes/page/artitalk.pug
default
include includes/page/default-page.pug
if page.comments !== false && theme.comments && theme.comments.use if page.comments !== false && theme.comments && theme.comments.use
- var commentsJsLoad = true - var commentsJsLoad = true
!=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache}) !=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache})

View File

@@ -1,8 +1,11 @@
extends includes/layout.pug extends includes/layout.pug
block content block content
article#post(class="") #post
#article-container.post-content!=page.content if top_img === false
include includes/header/post-info.pug
article#article-container.post-content!=page.content
include includes/post/post-copyright.pug include includes/post/post-copyright.pug
.tag_share .tag_share
if (theme.post_meta.post.tags) if (theme.post_meta.post.tags)

View File

@@ -1,6 +1,6 @@
{ {
"name": "hexo-theme-butterfly", "name": "hexo-theme-butterfly",
"version": "3.1.1", "version": "3.3.0",
"description": "A Simple and Card UI Design theme for Hexo", "description": "A Simple and Card UI Design theme for Hexo",
"main": "package.json", "main": "package.json",
"scripts": { "scripts": {

View File

@@ -1,12 +0,0 @@
const logger = require('hexo-log')()
hexo.extend.filter.register('before_generate', () => {
// Get first two digits of the Hexo version number
var hexoVer = hexo.version.replace(/(^.*\..*)\..*/, '$1')
if (hexoVer < 4.2) {
logger.error('Please update Hexo to V4.2.0 or higher!')
logger.error('請把 Hexo 升級到 V4.2.0 或更高的版本!')
process.exit(-1)
}
})

27
scripts/events/init.js Normal file
View File

@@ -0,0 +1,27 @@
const logger = require('hexo-log')()
hexo.extend.filter.register('before_generate', () => {
// Get first two digits of the Hexo version number
var hexoVer = hexo.version.replace(/(^.*\..*)\..*/, '$1')
if (hexoVer < 5) {
logger.error('Please update Hexo to V5.0.0 or higher!')
logger.error('請把 Hexo 升級到 V5.0.0 或更高的版本!')
process.exit(-1)
}
if (hexo.locals.get) {
const data = hexo.locals.get('data')
if (data && data.butterfly) {
logger.error(" 'butterfly.yml' is deprecated. Please use '_config.butterfly.yml' ")
logger.error(" 'butterfly.yml' 已經棄用,請使用 '_config.butterfly.yml' ")
process.exit(-1)
}
}
// let stylus to get the hexo highlight config
const themeConfig = hexo.theme.config
const hexoConfig = hexo.config
themeConfig.highlight_settings = hexoConfig.highlight
themeConfig.prismjs_settings = hexoConfig.prismjs
})

View File

@@ -1,18 +0,0 @@
/**
* Note: configs in _data/butterfly.yml will merge configs with hexo.theme.config.
*/
'use strict'
const { deepMerge } = require('hexo-util')
hexo.on('generateBefore', function () {
const rootConfig = hexo.config
if (hexo.locals.get) {
const data = hexo.locals.get('data')
if (data && data.butterfly) {
hexo.theme.config = deepMerge(hexo.theme.config, data.butterfly)
}
}
hexo.theme.config.rootConfig = rootConfig
})

View File

@@ -6,8 +6,14 @@
'use strict' 'use strict'
hexo.extend.filter.register('before_post_render', function (data) { hexo.extend.filter.register('before_post_render', function (data) {
if (data.top_img && data.top_img.indexOf('/') === -1) data.top_img = data.path + data.top_img const { config } = this
if (data.cover && data.cover.indexOf('/') === -1) data.cover = data.path + data.cover if (config.post_asset_folder) {
const imgTestReg = /\.(png|jpe?g|gif|svg|webp)(\?.*)?$/
const topImg = data.top_img
const cover = data.cover
if (topImg && topImg.indexOf('/') === -1 && imgTestReg.test(topImg)) data.top_img = data.path + topImg
if (cover && cover.indexOf('/') === -1) data.cover = data.path + cover
}
if (data.cover === false) { if (data.cover === false) {
data.randomcover = randomCover() data.randomcover = randomCover()
@@ -33,6 +39,7 @@ function randomCover () {
return cover return cover
} }
} else { } else {
return theme.default_top_img cover = 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg'
return cover
} }
} }

View File

@@ -2,13 +2,12 @@
* Butterfly * Butterfly
* @example * @example
* page_description() * page_description()
* injectHtml(data)
* cloudTags(source, minfontsize, maxfontsize, limit) * cloudTags(source, minfontsize, maxfontsize, limit)
*/ */
'use strict' 'use strict'
const { stripHTML, escapeHTML } = require('hexo-util') const { stripHTML, escapeHTML, prettyUrls } = require('hexo-util')
const crypto = require('crypto') const crypto = require('crypto')
hexo.extend.helper.register('page_description', function () { hexo.extend.helper.register('page_description', function () {
@@ -23,6 +22,46 @@ hexo.extend.helper.register('page_description', function () {
} }
}) })
hexo.extend.helper.register('cloudTags', function (options = {}) {
const env = this
let source = options.source
const minfontsize = options.minfontsize
const maxfontsize = options.maxfontsize
const limit = options.limit
const unit = options.unit || 'px'
let result = ''
if (limit > 0) {
source = source.limit(limit)
}
const sizes = []
source.sort('length').forEach(tag => {
const { length } = tag
if (sizes.includes(length)) return
sizes.push(length)
})
const length = sizes.length - 1
source.forEach(tag => {
const ratio = length ? sizes.indexOf(tag.length) / length : 0
const size = minfontsize + ((maxfontsize - minfontsize) * ratio)
let style = `font-size: ${parseFloat(size.toFixed(2))}${unit};`
const color = 'rgb(' + Math.floor(Math.random() * 201) + ', ' + Math.floor(Math.random() * 201) + ', ' + Math.floor(Math.random() * 201) + ')' // 0,0,0 -> 200,200,200
style += ` color: ${color}`
result += `<a href="${env.url_for(tag.path)}" style="${style}">${tag.name}</a>`
})
return result
})
hexo.extend.helper.register('urlNoIndex', function () {
return prettyUrls(this.url, { trailing_index: false, trailing_html: false })
})
hexo.extend.helper.register('md5', function (path) {
return crypto.createHash('md5').update(decodeURI(this.url_for(path))).digest('hex')
})
hexo.extend.helper.register('injectHtml', function (data) { hexo.extend.helper.register('injectHtml', function (data) {
let result = '' let result = ''
if (!data) return '' if (!data) return ''
@@ -31,39 +70,3 @@ hexo.extend.helper.register('injectHtml', function (data) {
} }
return result 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
const unit = options.unit || 'px'
let result = ''
const tagLimit = limit === 0 ? source.length : limit
source.sort('name').limit(tagLimit).forEach(function (tags) {
const fontSizeRD = Math.random() * (maxfontsize - minfontsize) + minfontsize
const fontSize = fontSizeRD.toFixed(2) + unit
const color = 'rgb(' + Math.floor(Math.random() * 201) + ', ' + Math.floor(Math.random() * 201) + ', ' + Math.floor(Math.random() * 201) + ')' // 0,0,0 -> 200,200,200
result += `<a href='${env.url_for(tags.path)}' style='font-size:${fontSize}; color:${color}'>${tags.name}</a>`
})
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
})
hexo.extend.helper.register('md5', function (path) {
return crypto.createHash('md5').update(decodeURI(this.url_for(path))).digest('hex')
})
hexo.extend.helper.register('get_hexo_version', function () {
return hexo.version
})

View File

@@ -35,7 +35,7 @@ hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
return '' return ''
} }
let result = '' let result = ''
const hexoConfig = hexo.theme.config.rootConfig const hexoConfig = hexo.config
const config = hexo.theme.config const config = hexo.theme.config
const limitNum = config.related_post.limit || 6 const limitNum = config.related_post.limit || 6
@@ -71,7 +71,7 @@ hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
lazySrc + lazySrc +
'="' + '="' +
this.url_for(cover) + this.url_for(cover) +
'">' '" alt="cover">'
if (dateType === 'created') { if (dateType === 'created') {
result += result +=
'<div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i>' + '<div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i>' +

View File

@@ -6,8 +6,10 @@
'use strict' 'use strict'
const { escapeHTML } = require('hexo-util')
function mermaid (args, content) { function mermaid (args, content) {
return `<div class="mermaid">${content}</div>` return `<div class="mermaid">${escapeHTML(content)}</div>`
} }
hexo.extend.tag.register('mermaid', mermaid, { ends: true }) hexo.extend.tag.register('mermaid', mermaid, { ends: true })

27
scripts/tag/note.js Normal file
View File

@@ -0,0 +1,27 @@
/**
* note.js
* transplant from hexo-theme-next
* Modify by Jerry
*/
'use strict'
function postNote (args, content) {
const styleConfig = hexo.theme.config.note.style
const lastArgs = args[args.length - 1]
if (!(lastArgs === 'flat' || lastArgs === 'modern' || lastArgs === 'simple' || lastArgs === 'disabled')) {
args.push(styleConfig)
}
let icon = ''
const iconArray = args[args.length - 2]
if (iconArray && iconArray.startsWith('fa')) {
icon = `<i class="note-icon ${iconArray}"></i>`
args[args.length - 2] = 'icon'
}
return `<div class="note ${args.join(' ')}">${icon + hexo.render.renderSync({ text: content, engine: 'markdown' })}</div>`
}
hexo.extend.tag.register('note', postNote, { ends: true })
hexo.extend.tag.register('subnote', postNote, { ends: true })

View File

@@ -1,13 +0,0 @@
/**
* note.js
* transplant from hexo-theme-next
*/
'use strict'
function postNote (args, content) {
return `<div class="note ${args.join(' ')}">${hexo.render.renderSync({ text: content, engine: 'markdown' })}</div>`
}
hexo.extend.tag.register('note', postNote, { ends: true })
hexo.extend.tag.register('subnote', postNote, { ends: true })

View File

@@ -45,31 +45,155 @@ minWidth2000()
@media screen and (min-width: 2000px) @media screen and (min-width: 2000px)
{block} {block}
[data-theme='light'] // animation
--global-bg: $body-bg if hexo-config('enter_transitions')
--font-color: $font-black #content-inner,
--hr-border: lighten($theme-hr-color, 50%) #footer
--hr-before-color: lighten($theme-hr-color, 30%) animation: main 1s
--search-bg: $search-bg
--search-input-color: $search-input-color #page-header
--search-result-title: $search-result-title animation: header-effect 1s
--preloader-bg: $preloader-bg
--preloader-color: $preloader-word-color #site-title,
--tab-border-color: $tab-border-color #site-subtitle
--tab-botton-bg: $tab-botton-bg animation: titlescale 1s
--tab-botton-color: $tab-botton-color
--tab-button-hover-bg: $tab-button-hover-bg #nav.show
--tab-button-active-bg: $tab-button-active-bg animation: headerNoOpacity 1s
--card-bg: $card-bg
--sidebar-bg: $sidebar-background canvas:not(#ribbon-canvas),
--btn-hover-color: $button-hover-color #web_bg
--btn-color: $button-color animation: to_show 4s
--btn-bg: $button-bg
--text-bg-hover: $text-bg-hover #ribbon-canvas
--light-grey: $light-grey animation: ribbon_to_show 4s
--white: $white
--text-highlight-color: $text-highlight-color #sidebar-menus
--blockquote-color: $blockquote-color &.open
--blockquote-bg: $blockquote-background-color for i in 1 2 3 4
--reward-pop: $reward-pop-up-bg > :nth-child({i})
--sidebar-icon-color: $sidebar-icon-color animation: sidebarItem (i / 5)s
.card-announcement-animation
color: #FF0000
animation: announ_animation .8s linear infinite
.scroll-down-effects
animation: scroll-down-effect 1.5s infinite
if hexo-config('avatar.effect') == true
.avatar-img
animation: avatar_turn_around 2s linear infinite
.reward-main
animation: donate_effcet .3s .1s ease both
@keyframes scroll-down-effect
0%
top: 0
opacity: .4
50%
top: -16px
opacity: 1
100%
top: 0
opacity: .4
@keyframes header-effect
0%
opacity: 0
transform: translateY(-50px)
100%
opacity: 1
transform: translateY(0)
@keyframes headerNoOpacity
0%
transform: translateY(-50px)
100%
transform: translateY(0)
@keyframes main
0%
opacity: 0
transform: translateY(50px)
100%
opacity: 1
transform: translateY(0)
@keyframes titlescale
0%
opacity: 0
transform: scale(.7)
100%
opacity: 1
transform: scale(1)
@keyframes search_close
0%
opacity: 1
transform: scale(1)
100%
opacity: 0
transform: scale(.7)
@keyframes to_show
0%
opacity: 0
100%
opacity: 1
@keyframes ribbon_to_show
0%
opacity: 0
100%
opacity: hexo-config('canvas_ribbon.alpha')
@keyframes avatar_turn_around
from
transform: rotate(0)
to
transform: rotate(360deg)
@keyframes sub_menus
0%
opacity: 0
transform: translateY(10px)
100%
opacity: 1
transform: translateY(0)
@keyframes donate_effcet
0%
opacity: 0
transform: translateY(-20px)
100%
opacity: 1
transform: translateY(0)
@keyframes announ_animation
0%,
to
transform: scale(1)
50%
transform: scale(1.2)
@keyframes sidebarItem
0%
transform: translateX(200px)
100%
transform: translateX(0)

View File

@@ -1,3 +1,32 @@
[data-theme='light']
--global-bg: $body-bg
--font-color: $font-black
--hr-border: lighten($theme-hr-color, 50%)
--hr-before-color: lighten($theme-hr-color, 30%)
--search-bg: $search-bg
--search-input-color: $search-input-color
--search-result-title: $search-result-title
--preloader-bg: $preloader-bg
--preloader-color: $preloader-word-color
--tab-border-color: $tab-border-color
--tab-botton-bg: $tab-botton-bg
--tab-botton-color: $tab-botton-color
--tab-button-hover-bg: $tab-button-hover-bg
--tab-button-active-bg: $tab-button-active-bg
--card-bg: $card-bg
--sidebar-bg: $sidebar-background
--btn-hover-color: $button-hover-color
--btn-color: $button-color
--btn-bg: $button-bg
--text-bg-hover: $text-bg-hover
--light-grey: $light-grey
--white: $white
--text-highlight-color: $text-highlight-color
--blockquote-color: $blockquote-color
--blockquote-bg: $blockquote-background-color
--reward-pop: $reward-pop-up-bg
--toc-link-color: $toc-link-color
html html
height: 100% height: 100%
font-size: 20px font-size: 20px
@@ -111,12 +140,23 @@ button
background: none background: none
cursor: pointer cursor: pointer
a
color: $a-link-color
text-decoration: none
word-wrap: break-word
transition: all .2s
overflow-wrap: break-word
&:hover
color: $light-blue
// font // font
#page-header #site_title, if $site-name-font
#page-header #site_subtitle, #site-title,
#site-name, #site-subtitle,
#aside_content .author-info__name, #site-name,
#aside_content .author-info__description #aside_content .author-info__name,
#aside_content .author-info__description
font-family: $site-name-font font-family: $site-name-font
.is-center .is-center
@@ -154,6 +194,10 @@ button
transition-timing-function: cubic-bezier(.45, 1.64, .47, .66) transition-timing-function: cubic-bezier(.45, 1.64, .47, .66)
transform: scaleX(1) transform: scaleX(1)
img
max-width: 100%
transition: all .2s
img[src=''], img[src=''],
img:not([src]) img:not([src])
opacity: 0 opacity: 0
@@ -168,191 +212,6 @@ img:not([src])
.post-ad .post-ad
margin: 2rem 0 margin: 2rem 0
.ad_height .ad-height
display: block !important display: block !important
height: auto !important height: auto !important
// animation
#content-inner,
#footer
animation: main 1s
#page-header
animation: header-effect 1s
#site_title,
#site_subtitle
animation: titlescale 1s
canvas:not(#ribbon-canvas),
#web_bg
animation: to_show 4s
#ribbon-canvas
animation: ribbon_to_show 4s
.card-announcement-animation
color: #FF0000
animation: announ_animation .8s linear infinite
.scroll-down-effects
animation: scroll-down-effect 1.5s infinite
if hexo-config('avatar.effect') == true
.avatar-img
animation: avatar_turn_around 2s linear infinite
.reward-main
animation: donate_effcet .3s .1s ease both
.tocOpenPc
.sidebar-toc__title
animation: tocsidebarLtoR .5s
.sidebar-toc__progress
animation: tocsidebarLtoR .7s
.sidebar-toc__content
animation: tocsidebarLtoR .9s
.tocOpenMobile
.sidebar-toc__title
animation: tocsidebarRtoL .4s
.sidebar-toc__progress
animation: tocsidebarRtoL .6s
.sidebar-toc__content
animation: tocsidebarRtoL .7s
#mobile-sidebar-menus
&.open
transform: translate3d(-100%, 0, 0)
for i in 1 2 3 4
> :nth-child({i})
animation: sidebarItem (i / 5)s
@keyframes scroll-down-effect
0%
top: 0
opacity: .4
50%
top: -16px
opacity: 1
100%
top: 0
opacity: .4
@keyframes header-effect
0%
opacity: 0
transform: translateY(-50px)
100%
opacity: 1
transform: translateY(0)
@keyframes headerNoOpacity
0%
transform: translateY(-50px)
100%
transform: translateY(0)
@keyframes main
0%
opacity: 0
transform: translateY(50px)
100%
opacity: 1
transform: translateY(0)
@keyframes titlescale
0%
opacity: 0
transform: scale(.7)
100%
opacity: 1
transform: scale(1)
@keyframes search_close
0%
opacity: 1
transform: scale(1)
100%
opacity: 0
transform: scale(.7)
@keyframes to_show
0%
opacity: 0
100%
opacity: 1
@keyframes ribbon_to_show
0%
opacity: 0
100%
opacity: hexo-config('canvas_ribbon.alpha')
@keyframes avatar_turn_around
from
transform: rotate(0)
to
transform: rotate(360deg)
@keyframes sub_menus
0%
opacity: 0
transform: translateY(10px)
100%
opacity: 1
transform: translateY(0)
@keyframes donate_effcet
0%
opacity: 0
transform: translateY(-20px)
100%
opacity: 1
transform: translateY(0)
@keyframes announ_animation
0%,
to
transform: scale(1)
50%
transform: scale(1.2)
@keyframes sidebarItem
0%
transform: translateX(200px)
100%
transform: translateX(0)
@keyframes tocsidebarRtoL
0%
transform: translateX(200px)
100%
transform: translateX(0)
@keyframes tocsidebarLtoR
0%
transform: translateX(-200px)
100%
transform: translateX(0)

View File

@@ -1,8 +1,8 @@
// https://github.com/equinusocio/vsc-material-theme // https://github.com/equinusocio/vsc-material-theme
$highlight_theme = hexo-config('highlight_theme') $highlight_theme = hexo-config('highlight_theme')
$highlighEnable = hexo-config('rootConfig.highlight') && hexo-config('rootConfig.highlight.enable') $highlighEnable = hexo-config('highlight_settings') && hexo-config('highlight_settings.enable')
$prismjsEnable = hexo-config('rootConfig.prismjs') && hexo-config('rootConfig.prismjs.enable') $prismjsEnable = hexo-config('prismjs_settings') && hexo-config('prismjs_settings.enable')
wordWrap = !hexo-config('rootConfig.highlight.line_number') && hexo-config('code_word_wrap') wordWrap = !hexo-config('highlight_settings.line_number') && hexo-config('code_word_wrap')
@require 'theme' @require 'theme'
@@ -126,6 +126,7 @@ blockquote
text-transform: uppercase text-transform: uppercase
font-weight: bold font-weight: bold
font-size: 1.15em font-size: 1.15em
user-select: none
.copy-notice .copy-notice
position: absolute position: absolute

View File

@@ -1,4 +1,4 @@
if hexo-fonfig('rootConfig.prismjs.line_number') if hexo-fonfig('prismjs_settings.line_number')
@require 'line-number' @require 'line-number'
if $highlight_theme != false if $highlight_theme != false

View File

@@ -45,6 +45,7 @@ if hexo-config('error_404.enable')
padding: .5rem padding: .5rem
text-align: center text-align: center
font-size: 14px font-size: 14px
if $site-name-font
font-family: $site-name-font font-family: $site-name-font
+maxWidth768() +maxWidth768()

View File

@@ -1,10 +1,27 @@
#aside_content #aside_content
width: 25% width: 25%
+minWidth900()
if hexo-config('aside.position') == 'right'
padding-left: 15px
else
padding-right: 15px
+maxWidth900()
width: 100%
if hexo-config('aside.mobile') == false
+maxWidth768()
display: none
> .card-widget:first-child > .card-widget:first-child
margin-top: 0 margin-top: 0
+maxWidth900()
margin-top: 1rem
.card-widget .card-widget
position: relative
overflow: hidden overflow: hidden
margin-top: 1rem margin-top: 1rem
border-radius: 8px border-radius: 8px
@@ -48,7 +65,7 @@
color: var(--font-color) color: var(--font-color)
font-size: 1em font-size: 1em
.length_num .length-num
margin-top: -.3rem margin-top: -.3rem
color: var(--text-highlight-color) color: var(--text-highlight-color)
font-size: 1.4em font-size: 1.4em
@@ -82,15 +99,12 @@
padding: 1rem 1.2rem padding: 1rem 1.2rem
.item-headline .item-headline
padding-bottom: .3rem
font-size: 1.2em font-size: 1.2em
span span
margin-left: .5rem margin-left: .5rem
& + div,
& + ul
padding: .3rem 0 0
.sticky_layout .sticky_layout
+minWidth900() +minWidth900()
position: sticky position: sticky
@@ -150,6 +164,7 @@
& > time, & > time,
& > .name & > .name
display: block
color: $theme-meta-color color: $theme-meta-color
font-size: 85% font-size: 85%
@@ -164,17 +179,13 @@
&:hover &:hover
color: $text-hover color: $text-hover
.card-recent-post &.no-cover
.thumbnail min-height: 4.4em
border-radius: 0 !important
.no-aside-cover
title
height: auto
.card-archives ul.card-archive-list, .card-archives ul.card-archive-list,
.card-categories ul.card-category-list .card-categories ul.card-category-list
margin: 0 margin: 0
padding: 0
list-style: none list-style: none
.card-archives ul.card-archive-list > .card-archive-list-item, .card-archives ul.card-archive-list > .card-archive-list-item,
@@ -252,23 +263,78 @@
flex: 1 flex: 1
padding-right: 1rem padding-right: 1rem
+maxWidth900() // toc
#aside_content #card-toc
width: 100% !important +maxWidth900()
position: fixed
right: 45px
bottom: 30px
z-index: 100
display: none
width: $toc-mobile-width
transform-origin: right bottom
animation: toc-open .3s
#aside_content .toc-child
.card-widget:first-child display: block !important
margin-top: 1rem
.toc-content
overflow-y: auto
max-height: calc(100vh - 120px)
ol,
li
list-style: none
> ol
padding: 0 !important
ol
margin: 0
padding-left: .4rem
.toc-link
display: block
padding-left: .3rem
border-left: 3px solid transparent
color: var(--toc-link-color)
transition: all .2s ease-in-out
&.active
border-left-color: darken($theme-toc-color, 20%)
background: $theme-toc-color
color: $toc-active-color
&:before
position: absolute
top: .6rem
right: 1.2rem
color: #a9a9a9
content: attr(progress-percentage)
font-style: italic
font-size: 1.2rem
@keyframes toc-open
0%
transform: scale(.7)
100%
transform: scale(1)
@keyframes toc-close
0%
transform: scale(1)
100%
transform: scale(.7)
+minWidth900() +minWidth900()
#aside_content html.hide-aside
.card-widget .layout
if hexo-config('aside.position') == 'right' justify-content: center
margin-left: 15px
else
margin-right: 15px
if hexo-config('aside.mobile') == false > .aside_content
+maxWidth768()
#aside_content
display: none display: none
> div:first-child
width: 80%

View File

@@ -8,7 +8,7 @@
font-weight: 700 font-weight: 700
font-size: 1.43em font-size: 1.43em
.comment-switch #comment-switch
display: inline-block display: inline-block
if hexo-config('comments.text') if hexo-config('comments.text')
@@ -30,33 +30,15 @@
.second-comment .second-comment
color: $comments-switch-second-text color: $comments-switch-second-text
label .switch-btn
position: relative position: relative
display: inline-block display: inline-block
margin: -4px .4rem 0 margin: -4px .4rem 0
width: 42px width: 42px
height: 22px height: 22px
vertical-align: middle
input#switch-comments-btn
width: 0
height: 0
opacity: 0
&:checked + .slider
background-color: $comments-switch-second-text
&:checked + .slider:before
transform: translateX(20px)
.slider
position: absolute
top: 0
right: 0
bottom: 0
left: 0
border-radius: 34px border-radius: 34px
background-color: $comments-switch-first-text background-color: $comments-switch-first-text
vertical-align: middle
cursor: pointer cursor: pointer
transition: .4s transition: .4s
@@ -71,6 +53,12 @@
content: '' content: ''
transition: .4s transition: .4s
&.move
background-color: $comments-switch-second-text
&:before
transform: translateX(20px)
.comment-wrap .comment-wrap
> div:nth-child(2) > div:nth-child(2)
display: none display: none

View File

@@ -2,7 +2,6 @@
position: relative position: relative
width: 100% width: 100%
background-color: $light-blue background-color: $light-blue
background-attachment: scroll
background-position: center center background-position: center center
background-size: cover background-size: cover
background-repeat: no-repeat background-repeat: no-repeat
@@ -19,14 +18,14 @@
padding: 0 .5rem padding: 0 .5rem
width: 100% width: 100%
#site_title, #site-title,
#site_subtitle, #site-subtitle,
#scroll_down .scroll-down-effects #scroll-down .scroll-down-effects
text-align: center text-align: center
text-shadow: .1rem .1rem .2rem rgba(0, 0, 0, .15) text-shadow: .1rem .1rem .2rem rgba(0, 0, 0, .15)
line-height: 1.5 line-height: 1.5
#site_title #site-title
margin: 0 margin: 0
color: var(--white) color: var(--white)
font-size: 1.85em font-size: 1.85em
@@ -34,7 +33,7 @@
+minWidth768() +minWidth768()
font-size: 2.85em font-size: 2.85em
#site_subtitle #site-subtitle
color: var(--light-grey) color: var(--light-grey)
font-size: 1.15em font-size: 1.15em
@@ -57,7 +56,7 @@
font-size: 1.43em font-size: 1.43em
cursor: pointer cursor: pointer
#scroll_down #scroll-down
position: absolute position: absolute
bottom: 0 bottom: 0
width: 100% width: 100%
@@ -76,7 +75,7 @@
+maxWidth768() +maxWidth768()
height: 14rem height: 14rem
#page_site-info #page-site-info
position: absolute position: absolute
top: 10rem top: 10rem
padding: 0 .5rem padding: 0 .5rem
@@ -102,30 +101,47 @@
background-color: alpha($dark-black, .5) background-color: alpha($dark-black, .5)
content: '' content: ''
&.no-top-img
margin-bottom: .5rem
height: 60px
background: 0
#nav
background: rgba(255, 255, 255, .8)
box-shadow: 0 5px 6px -5px rgba(133, 133, 133, .6)
a
color: var(--font-color)
text-shadow: none
#post-info #post-info
position: absolute position: absolute
bottom: 1.5rem bottom: 5rem
padding: 0 8% padding: 0 8%
width: 100% width: 100%
text-align: center
+maxWidth900()
bottom: 1.5rem
text-align: left text-align: left
+maxWidth768() +maxWidth768()
bottom: 1.1rem bottom: 1.1rem
padding: 0 1.1rem padding: 0 1.1rem
#post-title #post-info
margin-bottom: .4rem .post-title
font-size: 2.15em
+maxWidth768()
font-size: 1.72em
.posttitle
@extend .limit-more-line @extend .limit-more-line
margin-bottom: .4rem
font-size: 2.5em
font-weight: normal
color: var(--white) color: var(--white)
line-height: 1.5 line-height: 1.5
-webkit-line-clamp: 3 -webkit-line-clamp: 3
+maxWidth768()
font-size: 1.72em
#post-meta #post-meta
color: var(--light-grey) color: var(--light-grey)
font-size: 95% font-size: 95%
@@ -163,6 +179,27 @@
color: $text-hover color: $text-hover
text-decoration: underline text-decoration: underline
if hexo-config('post_meta.post.date_format') == 'relative'
time
display: none
// for not top_img
#post
& > #post-info
margin-bottom: 1.5rem
.post-title
padding-bottom: .2rem
border-bottom: 1px solid var(--light-grey)
color: var(--text-highlight-color)
[data-theme='light']
#post
#post-info
#post-meta,
#post-meta a
color: #78818a
// css hack // css hack
// all browser in ios and safari in all apple device // all browser in ios and safari in all apple device
_::-webkit-full-page-media, _::-webkit-full-page-media,
@@ -191,6 +228,9 @@ _:future,
#menus #menus
padding-right: 0 !important padding-right: 0 !important
&.show
opacity: 1
#blog_name #blog_name
flex: 1 flex: 1
@@ -210,7 +250,7 @@ _:future,
&.fixed &.fixed
position: fixed position: fixed
top: -62px top: -60px
z-index: 91 z-index: 91
background: rgba(255, 255, 255, .8) background: rgba(255, 255, 255, .8)
box-shadow: 0 5px 6px -5px alpha($grey, .6) box-shadow: 0 5px 6px -5px alpha($grey, .6)

View File

@@ -5,7 +5,6 @@ if hexo-config('preloader')
width: 50% width: 50%
height: 100% height: 100%
background-color: var(--preloader-bg) background-color: var(--preloader-bg)
transition: all .5s
#loading-box #loading-box
.loading-left-bg .loading-left-bg
@@ -53,9 +52,11 @@ if hexo-config('preloader')
&.loaded &.loaded
.loading-left-bg .loading-left-bg
transition: all .5s
transform: translate(-100%, 0) transform: translate(-100%, 0)
.loading-right-bg .loading-right-bg
transition: all .5s
transform: translate(100%, 0) transform: translate(100%, 0)
.spinner-box .spinner-box

View File

@@ -1,94 +0,0 @@
#mobile-sidebar
#menu_mask
position: fixed
z-index: 102
display: none
width: 100%
height: 100%
background: alpha($dark-black, .8)
#mobile-sidebar-menus
position: fixed
top: 0
right: -250px
z-index: 103
overflow-x: hidden
overflow-y: auto
width: 250px
height: 100%
background: var(--sidebar-bg)
transition: all .5s
& > .mobile_author_icon
padding: 1.3rem 1.5rem 0
text-align: center
img
width: 110px
height: 110px
border-radius: 70px
transition: all .5s
&:hover
transform: rotate(360deg)
.mobile_post_data
display: table
padding: .6rem .5rem 0
width: 100%
table-layout: fixed
.mobile_data_item
display: table-cell
.mobile_data_link
& > a > div
@extend .limit-one-line
.length_num
color: var(--text-highlight-color)
font-size: 1.28em
.headline
color: var(--font-color)
hr
margin: 1rem auto
.menus_items
padding: 0 .5rem 2rem
.site-page
@extend .limit-one-line
position: relative
display: block
padding: .3rem 1.5rem
color: var(--font-color)
font-size: 1.15em
cursor: pointer
i:first-child
width: 30%
text-align: left
span
width: 70%
&:hover
color: $light-blue
.expand
position: absolute
top: .78em
right: .4rem
transition: transform .3s
&.hide
transform: rotate(90deg) !important
.menus_item_child
margin: 0
list-style: none
if hexo-config('hide_sidebar_menu_child')
display: none

View File

@@ -59,6 +59,9 @@
.next-post .next-post
width: 50% width: 50%
+maxWidth768()
width: 100%
a a
position: relative position: relative
display: block display: block
@@ -74,8 +77,3 @@
&.pagination-post &.pagination-post
margin: 2rem 0 !important margin: 2rem 0 !important
background: $dark-black background: $dark-black
+maxWidth768()
.prev-post,
.next-post
width: 100% !important

View File

@@ -142,6 +142,24 @@ no-beautify()
padding-left: .3rem padding-left: .3rem
#article-container #article-container
word-wrap: break-word
overflow-wrap: break-word
a
color: $theme-link-color
&:hover
text-decoration: underline
img
margin: 0 auto .8rem
p
margin: 0 0 .8rem
iframe
margin: 0 0 1rem
if hexo-config('beautify.enable') && hexo-config('beautify.field') == 'site' if hexo-config('beautify.enable') && hexo-config('beautify.field') == 'site'
beautify() beautify()
else if hexo-config('beautify.enable') && hexo-config('beautify.field') == 'post' else if hexo-config('beautify.enable') && hexo-config('beautify.field') == 'post'
@@ -152,42 +170,7 @@ no-beautify()
else else
no-beautify() no-beautify()
a #post
color: $a-link-color
text-decoration: none
word-wrap: break-word
transition: all .2s
overflow-wrap: break-word
&:hover
color: $light-blue
a.fancybox
outline: none
&:focus
outline: none
display: inline-block
width: 100%
text-align: center
img
max-width: 100%
transition: all .2s
.katex-wrap
overflow: auto
if hexo-config('katex') && hexo-config('katex.hide_scrollbar')
&::-webkit-scrollbar
display: none
.layout_post
margin: 0 auto
padding: 2rem 15px
max-width: 1000px
img img
display: block display: block
@@ -272,25 +255,6 @@ img
&:hover &:hover
text-decoration: none text-decoration: none
#article-container
word-wrap: break-word
overflow-wrap: break-word
a
color: $theme-link-color
&:hover
text-decoration: underline
img
margin: 0 auto .8rem
p
margin: 0 0 .8rem
iframe
margin: 0 0 1rem
.post-outdate-notice .post-outdate-notice
position: relative position: relative
margin: 0 0 1rem margin: 0 0 1rem
@@ -311,25 +275,3 @@ img
color: $noticeOutdate-border color: $noticeOutdate-border
content: '\f071' content: '\f071'
transform: translateY(-50%) transform: translateY(-50%)
+maxWidth1024()
.layout_post
width: auto
+maxWidth768()
.layout_post
padding: 1rem 5px
& > #post
padding: 1.8rem .7rem
// adjust the layout width in big screen
+minWidth2000()
.layout_post
max-width: 1300px
.layout_page
max-width: 1500px
&.hide-aside
max-width: 1300px

View File

@@ -36,5 +36,9 @@
#mobile-toc-button #mobile-toc-button
display: none display: none
+maxWidth1024() +maxWidth900()
display: block display: block
+maxWidth900()
#hide-aside-btn
display: none

View File

@@ -1,88 +1,97 @@
#toggle-sidebar
position: fixed
bottom: $sidebar-icon-top
left: $sidebar-icon-left
z-index: 100
color: var(--sidebar-icon-color)
font-size: $sidebar-icon-size
cursor: pointer
transition: all .2s
+maxWidth1024()
display: none
#sidebar #sidebar
#menu-mask
position: fixed
z-index: 102
display: none
width: 100%
height: 100%
background: alpha($dark-black, .8)
#sidebar-menus
position: fixed position: fixed
top: 0 top: 0
left: -($sidebar-width) right: -($sidebar-width)
z-index: 10 z-index: 103
padding: 1rem 0 2rem .5rem overflow-x: hidden
overflow-y: auto
width: $sidebar-width width: $sidebar-width
height: 100% height: 100%
background: var(--sidebar-bg) background: var(--sidebar-bg)
opacity: .9 transition: all .5s
&.tocOpenPc &.open
& > #toggle-sidebar transform: translate3d(-100%, 0, 0)
color: #99a9bf
transform: rotateZ(180deg)
+maxWidth1024() & > .author-avatar
right: -($mobile-sidebar-width) padding: 1.3rem 1.5rem 0
left: auto text-align: center
z-index: 103
width: $mobile-sidebar-width
box-shadow: none
opacity: 1
transition: all .4s
.toc-child img
display: block !important width: 110px
height: 110px
border-radius: 70px
transition: all .5s
.sidebar-toc &:hover
ol, transform: rotate(360deg)
li
.site-data
display: table
padding: .6rem .5rem 0
width: 100%
table-layout: fixed
.data-item
display: table-cell
.data-item-link
& > a > div
@extend .limit-one-line
.length-num
color: var(--text-highlight-color)
font-size: 1.28em
.headline
color: var(--font-color)
hr
margin: 1rem auto
.menus_items
padding: 0 .5rem 2rem
.site-page
@extend .limit-one-line
position: relative
display: block
padding: .3rem 1.5rem
color: var(--font-color)
font-size: 1.15em
cursor: pointer
i:first-child
width: 25%
text-align: left
span
width: 75%
&:hover
color: $light-blue
.expand
position: absolute
top: .78em
right: .4rem
transition: transform .3s
&.hide
transform: rotate(90deg) !important
.menus_item_child
margin: 0
list-style: none list-style: none
ol if hexo-config('hide_sidebar_menu_child')
margin-top: .2rem display: none
padding-left: .4rem
&__title
padding-right: .5rem
text-align: center
font-size: 1.3em
&__content
overflow-y: scroll
padding-bottom: 5rem
height: 90vh
.toc-link
display: block
padding-left: .2rem
border-right: 3px solid transparent
transition: all .2s ease-in-out
&.active
border-right-color: darken($theme-toc-color, 20%)
background: $theme-toc-color
color: $sidebar-active-color
&__progress
position: relative
margin-bottom: .3rem
padding-left: .6rem
color: $theme-toc-color
.progress-notice
margin-right: .4rem
.progress-num
display: inline-block
min-width: .9rem
&-bar
width: 0
height: 1px
background: $theme-toc-color

View File

@@ -1,5 +1,5 @@
#vcomment #vcomment
font-size: 1.15em font-size: 1.1em
.vbtn .vbtn
border: none border: none
@@ -13,6 +13,9 @@
textarea textarea
background: url(hexo-config('valine.bg')) 100% 100% no-repeat background: url(hexo-config('valine.bg')) 100% 100% no-repeat
&:focus
background-image: none
.vimg .vimg
transition: all .3s transition: all .3s
@@ -58,6 +61,13 @@
margin: 0 0 .8em margin: 0 0 .8em
padding: .3rem 0 .8em padding: .3rem 0 .8em
.katex-wrap
overflow: auto
if hexo-config('katex') && hexo-config('katex.hide_scrollbar')
&::-webkit-scrollbar
display: none
// mathjax // mathjax
.mathjax-overflow .mathjax-overflow
overflow-x: auto overflow-x: auto

View File

@@ -1,49 +1,42 @@
if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark' if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
[data-theme='dark'] [data-theme='dark']
--global-bg: darken(#121212, 2) --global-bg: darken(#121212, 2)
--font-color: alpha(#FFFFFF, .6) --font-color: alpha(#FFFFFF, .7)
--hr-border: alpha(#FFFFFF, .3) --hr-border: alpha(#FFFFFF, .4)
--hr-before-color: alpha(#FFFFFF, .6) --hr-before-color: alpha(#FFFFFF, .7)
--search-bg: #121212 --search-bg: #121212
--search-input-color: alpha(#FFFFFF, .6) --search-input-color: alpha(#FFFFFF, .7)
--search-result-title: alpha(#FFFFFF, .8) --search-result-title: alpha(#FFFFFF, .9)
--preloader-bg: darken(#121212, 2) --preloader-bg: darken(#121212, 2)
--preloader-color: alpha(#FFFFFF, .6) --preloader-color: alpha(#FFFFFF, .7)
--tab-border-color: #2c2c2c --tab-border-color: #2c2c2c
--tab-botton-bg: #2c2c2c --tab-botton-bg: #2c2c2c
--tab-botton-color: alpha(#FFFFFF, .6) --tab-botton-color: alpha(#FFFFFF, .7)
--tab-button-hover-bg: lighten(#121212, 15) --tab-button-hover-bg: lighten(#121212, 15)
--tab-button-active-bg: #121212 --tab-button-active-bg: #121212
--card-bg: #121212 --card-bg: #121212
--sidebar-bg: #121212 --sidebar-bg: #121212
--btn-hover-color: lighten(#121212, 40) --btn-hover-color: lighten(#121212, 40)
--btn-color: alpha(#FFFFFF, .6) --btn-color: alpha(#FFFFFF, .7)
--btn-bg: lighten(#121212, 5) --btn-bg: lighten(#121212, 5)
--text-bg-hover: lighten(#121212, 15) --text-bg-hover: lighten(#121212, 15)
--light-grey: alpha(#FFFFFF, .6) --light-grey: alpha(#FFFFFF, .7)
--white: alpha(#FFFFFF, .8) --white: alpha(#FFFFFF, .9)
--text-highlight-color: alpha(#FFFFFF, .8) --text-highlight-color: alpha(#FFFFFF, .9)
--blockquote-color: alpha(#FFFFFF, .6) --blockquote-color: alpha(#FFFFFF, .7)
--blockquote-bg: lighten(#121212, 10) --blockquote-bg: lighten(#121212, 10)
--reward-pop: lighten(#121212, 10) --reward-pop: lighten(#121212, 10)
--sidebar-icon-color: alpha(#FFFFFF, .6) --toc-link-color: alpha(#FFFFFF, .6)
// footer #web_bg:before,
#web_bg[data-type=color], #footer:before,
#footer[data-type=color] #page-header:before
background: darken(#121212, 2)
#web_bg[data-type=photo]:before,
#footer[data-type=photo]:before
position: absolute position: absolute
width: 100% width: 100%
height: 100% height: 100%
background-color: alpha($dark-black, .7) background-color: alpha($dark-black, .7)
content: '' content: ''
#page-header
background-color: #121212
#article-container #article-container
code code
background: #2c2c2c background: #2c2c2c
@@ -55,20 +48,13 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
code code
background: $code-background background: $code-background
.aplayer
filter: brightness(.8)
// //
#page-header #page-header
&:before & > #nav.fixed,
position: absolute &.no-top-img #nav
top: 0
left: 0
display: block
width: 100%
height: 100%
background-color: alpha($dark-black, .7)
content: ''
& > #nav
&.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)
@@ -77,17 +63,17 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
pre, pre,
.highlight:not(.js-file-line-container) .highlight:not(.js-file-line-container)
background-color: lighten(#121212, 2) !important background-color: lighten(#121212, 2) !important
color: alpha(#FFFFFF, .6) !important color: alpha(#FFFFFF, .7) !important
figure.highlight figure.highlight
box-shadow: none box-shadow: none
if hexo-config('rootConfig.highlight') && hexo-config('rootConfig.highlight.enable') if hexo-config('highlight_settings') && hexo-config('highlight_settings.enable')
table::-webkit-scrollbar-thumb table::-webkit-scrollbar-thumb
background: lighten(#121212, 5) background: lighten(#121212, 5)
.line:before .line:before
color: alpha(#FFFFFF, .6) !important color: alpha(#FFFFFF, .7) !important
.hljs .hljs
background-color: lighten(#121212, 2) !important background-color: lighten(#121212, 2) !important
@@ -100,17 +86,17 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
color: #90a4ae !important color: #90a4ae !important
#post-comment #post-comment
.comment-switch #comment-switch
if hexo-config('comments.text') if hexo-config('comments.text')
background: #2c2c2c !important background: #2c2c2c !important
label .switch-btn
filter: brightness(.7) filter: brightness(.8)
// note // note
if hexo-config('note.style') == 'modern' || hexo-config('note.style') == 'flat' if hexo-config('note.style') == 'modern' || hexo-config('note.style') == 'flat'
.note .note
filter: brightness(.7) filter: brightness(.8)
// hide-tags // hide-tags
.hide-button, .hide-button,
@@ -120,9 +106,8 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
.error-img, .error-img,
#article-container iframe, #article-container iframe,
img, img,
.gist, .gist
.aplayer filter: brightness(.8)
filter: brightness(.7)
#aside_content .aside-list > .aside-list-item:not(:last-child) #aside_content .aside-list > .aside-list-item:not(:last-child)
border-bottom: 1px dashed alpha(#FFFFFF, .1) border-bottom: 1px dashed alpha(#FFFFFF, .1)
@@ -132,7 +117,7 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
#hexo-blog-encrypt #hexo-blog-encrypt
label, label,
input input
color: alpha(#FFFFFF, .6) !important color: alpha(#FFFFFF, .7) !important
input input
background-color: #121212 background-color: #121212
@@ -142,24 +127,30 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
filter: brightness(.8) filter: brightness(.8)
svg svg
fill: alpha(#FFFFFF, .8) !important fill: alpha(#FFFFFF, .9) !important
// Disqus and Disqusjs // Disqus and Disqusjs
#disqus_thread #disqus_thread
#dsqjs #dsqjs
.dsqjs-tab-active, .dsqjs-tab-active,
.dsqjs-no-comment .dsqjs-no-comment
color: alpha(#FFFFFF, .6) color: alpha(#FFFFFF, .7)
.dsqjs-order-label .dsqjs-order-label
background-color: lighten(#121212, 5) background-color: lighten(#121212, 5)
.dsqjs-post-body .dsqjs-post-body
color: alpha(#FFFFFF, .6) color: alpha(#FFFFFF, .7)
code, code,
pre pre
background: #2c2c2c background: #2c2c2c
blockquote blockquote
color: alpha(#FFFFFF, .6) color: alpha(#FFFFFF, .7)
#artitalk_main #lazy
background: #121212
#operare_artitalk .c2
background: #121212

View File

@@ -12,18 +12,21 @@ if hexo-config('readmode')
[data-theme='dark'] [data-theme='dark']
.read-mode .read-mode
--font-color: rgba(255, 255, 255, .6) --font-color: rgba(255, 255, 255, .7)
--readmode-light-color: #0d0d0d --readmode-light-color: #0d0d0d
--white: rgba(255, 255, 255, .8) --white: rgba(255, 255, 255, .9)
--light-grey: rgba(255, 255, 255, .6) --light-grey: rgba(255, 255, 255, .7)
--gray: rgba(255, 255, 255, .6) --gray: rgba(255, 255, 255, .7)
--hr-border: rgba(255, 255, 255, .3) --hr-border: rgba(255, 255, 255, .5)
--hr-before-color: rgba(255, 255, 255, .6) --hr-before-color: rgba(255, 255, 255, .7)
-highlight-bg: #171717 -highlight-bg: #171717
.read-mode .read-mode
background: var(--readmode-light-color) background: var(--readmode-light-color)
#aside_content
display: none
#body-wrap #body-wrap
padding-left: 0 !important padding-left: 0 !important
@@ -38,8 +41,8 @@ if hexo-config('readmode')
padding: 0 padding: 0
text-align: center text-align: center
.layout_post #post
> #post margin: 0 auto
background: transparent background: transparent
box-shadow: none box-shadow: none
@@ -51,10 +54,8 @@ if hexo-config('readmode')
.highlight-tools, .highlight-tools,
#footer, #footer,
#post > *:not(:first-child), #post > *:not(#post-info):not(.post-content),
#to_comment, #to_comment,
#sidebar,
#toggle-sidebar,
#mobile-toc-button, #mobile-toc-button,
#nav, #nav,
.post-outdate-notice, .post-outdate-notice,
@@ -179,6 +180,7 @@ if hexo-config('readmode')
.note .note
border: 2px solid var(--gray) border: 2px solid var(--gray)
border-left-color: var(--gray) !important
filter: none filter: none
background-color: var(--readmode-light-color) background-color: var(--readmode-light-color) !important
color: var(--font-color) color: var(--font-color)

View File

@@ -1,14 +1,16 @@
.category-content #page
.category-lists .category-lists
padding: 1rem 0 1.5rem padding: 1rem 0 1.5rem
+maxWidth768() +maxWidth768()
padding: 0 padding: 0
.category__title .category-title
text-align: center
font-size: 2.57em font-size: 2.57em
+maxWidth768()
font-size: 2em
.category-list .category-list
a a
color: var(--font-color) color: var(--font-color)

View File

@@ -1,4 +1,4 @@
.layout_page .layout
display: flex display: flex
margin: 0 auto margin: 0 auto
padding: 2rem 15px padding: 2rem 15px
@@ -10,42 +10,43 @@
+maxWidth768() +maxWidth768()
padding: 1rem 5px !important padding: 1rem 5px !important
+minWidth2000()
max-width: 1500px
& > div:first-child:not(.recent-posts) & > div:first-child:not(.recent-posts)
+maxWidth768()
padding: 1.8rem .7rem !important
& > div:first-child
width: 75%
+maxWidth900()
width: 100% !important
// aside
&.hide-aside
max-width: 1000px
& > div
width: 100% !important
.layout_post > #post,
.layout_page > div:first-child:not(.recent-posts)
align-self: flex-start align-self: flex-start
padding: 50px 40px padding: 50px 40px
border-radius: 8px border-radius: 8px
background: var(--card-bg) background: var(--card-bg)
box-shadow: 0 4px 8px 6px rgba(7, 17, 27, .06) box-shadow: 0 4px 8px 6px rgba(7, 17, 27, .06)
transition: all .3s
&:hover &:hover
box-shadow: 0 4px 12px 12px rgba(7, 17, 27, .15) box-shadow: 0 4px 12px 12px rgba(7, 17, 27, .15)
+minWidth900() +maxWidth768()
padding: 1.8rem .7rem !important
& > div:first-child
width: 75%
transition: all .3s
+maxWidth900()
width: 100% !important
if hexo-config('aside.position') == 'left' if hexo-config('aside.position') == 'left'
#recent-posts, +minWidth900()
#page,
.category-content,
#archive,
.tag-cloud,
#tag,
#category
order: 2 order: 2
// aside
&.hide-aside
max-width: 1000px
+minWidth2000()
max-width: 1300px
& > div
width: 100% !important
#page
h1.page-title
margin-top: .4rem

View File

@@ -107,6 +107,10 @@
.fa-angle-right .fa-angle-right
margin: 0 .2rem margin: 0 .2rem
if hexo-config('post_meta.page.date_format') == 'relative'
time
display: none
a a
color: $theme-meta-color color: $theme-meta-color

View File

@@ -1,6 +1,5 @@
.tag-cloud .tag-cloud
text-align: center &-list
a a
display: inline-block display: inline-block
padding: 0 .4rem padding: 0 .4rem
@@ -10,5 +9,11 @@
color: $text-hover !important color: $text-hover !important
transform: scale(1.1) transform: scale(1.1)
&__title +maxWidth768()
zoom: .85
&-title
font-size: 2.57em font-size: 2.57em
+maxWidth768()
font-size: 2em

View File

@@ -1,4 +1,5 @@
#algolia-search #algolia-search
.search-dialog
animation: titlescale .5s animation: titlescale .5s
.ais-search-box .ais-search-box

View File

@@ -1,4 +1,5 @@
#local-search #local-search
.search-dialog
animation: titlescale .5s animation: titlescale .5s
.local-search-box .local-search-box

View File

@@ -32,9 +32,9 @@
&:hover &:hover
text-decoration: none text-decoration: none
for $type in $btn-types for $type in $tagsP-types
&.{$type} &.{$type}
background-color: lookup('$btn-' + $type + '-color') background-color: lookup('$tagsP-' + $type + '-color')
&.outline &.outline
border: 1px solid transparent border: 1px solid transparent
@@ -49,10 +49,10 @@
&:hover &:hover
color: white !important color: white !important
for $type in $btn-types for $type in $tagsP-types
&.{$type} &.{$type}
border-color: lookup('$btn-' + $type + '-color') border-color: lookup('$tagsP-' + $type + '-color')
color: lookup('$btn-' + $type + '-color') color: lookup('$tagsP-' + $type + '-color')
&.button--animated:before &.button--animated:before
background: lookup('$btn-' + $type + '-color') background: lookup('$tagsP-' + $type + '-color')

View File

@@ -1,28 +1,51 @@
.note .note
$note-icons = hexo-config('note.icons') $note-icons = hexo-config('note.icons')
$note-style = hexo-config('note.style')
position: relative position: relative
margin: 0 0 1rem margin: 0 0 1rem
padding: 15px padding: 15px
if ($note-style == 'simple') if hexo-config('note.border_radius') is a 'unit'
border-radius: unit(hexo-config('note.border_radius'), px)
&.icon
padding-left: 2.25rem
& > .note-icon
position: absolute
top: calc(50% - .4rem)
left: .7rem
font-size: larger
for $type in $tagsP-types
&.{$type}
&:not(.disabled)
border-left-color: lookup('$tagsP-' + $type + '-color') !important
&.modern
border-left-color: transparent !important
color: lookup('$tagsP-' + $type + '-color')
&:not(.simple)
background: lighten(lookup('$tagsP-' + $type + '-color'), 85%) !important
& > .note-icon
color: lookup('$tagsP-' + $type + '-color')
&.simple
border: 1px solid #EEEEEE border: 1px solid #EEEEEE
border-left-width: 5px border-left-width: 5px
if ($note-style == 'modern') &.modern
border: 1px solid transparent border: 1px solid transparent !important
background-color: #f5f5f5 background-color: #f5f5f5
color: $font-black color: $font-black
if ($note-style == 'flat') &.flat
border: initial border: initial
border-left: 5px solid #EEEEEE border-left: 5px solid #EEEEEE
background-color: lighten(#EEEEEE, 65%) background-color: lighten(#EEEEEE, 65%)
color: $font-black color: $font-black
if hexo-config('note.border_radius') is a 'unit'
border-radius: unit(hexo-config('note.border_radius'), px)
h2, h2,
h3, h3,
h4, h4,
@@ -52,21 +75,21 @@
if $note-icons if $note-icons
&:not(.no-icon) &:not(.no-icon)
padding-left: 45px padding-left: 2.25rem
&::before &::before
position: absolute position: absolute
top: 13px top: calc(50% - .8rem)
left: 15px left: .7rem
font-size: larger font-size: larger
@extend .fontawesomeIcon @extend .fontawesomeIcon
for $type in $note-types for $type in $note-types
&.{$type} &.{$type}
if ($note-style == 'flat') &.flat
background: lookup('$note-' + $type + '-bg') background: lookup('$note-' + $type + '-bg')
if ($note-style == 'modern') &.modern
border-color: lookup('$note-modern-' + $type + '-border') border-color: lookup('$note-modern-' + $type + '-border')
background: lookup('$note-modern-' + $type + '-bg') background: lookup('$note-modern-' + $type + '-bg')
color: lookup('$note-modern-' + $type + '-text') color: lookup('$note-modern-' + $type + '-text')
@@ -78,7 +101,7 @@
&:hover &:hover
color: lookup('$note-modern-' + $type + '-hover') color: lookup('$note-modern-' + $type + '-hover')
if ($note-style != 'modern') &:not(.modern)
border-left-color: lookup('$note-' + $type + '-border') border-left-color: lookup('$note-' + $type + '-border')
h2, h2,
@@ -89,8 +112,10 @@
color: lookup('$note-' + $type + '-text') color: lookup('$note-' + $type + '-text')
if $note-icons if $note-icons
&:not(.no-icon)::before &:not(.no-icon)
&::before
content: lookup('$note-' + $type + '-icon') content: lookup('$note-' + $type + '-icon')
if ($note-style != 'modern') &:not(.modern)
&::before
color: lookup('$note-' + $type + '-text') color: lookup('$note-' + $type + '-text')

View File

@@ -17,7 +17,7 @@ $dafault-font-family = -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica
$dafault-code-font = consolas, Menlo, 'PingFang SC', 'Microsoft YaHei', sans-serif $dafault-code-font = consolas, Menlo, 'PingFang SC', 'Microsoft YaHei', sans-serif
$font-family = hexo-config('font.font-family') ? unquote(hexo-config('font.font-family')) : $dafault-font-family $font-family = hexo-config('font.font-family') ? unquote(hexo-config('font.font-family')) : $dafault-font-family
$code-font-family = hexo-config('font.code-font-family') ? unquote(hexo-config('font.code-font-family')) : $dafault-code-font $code-font-family = hexo-config('font.code-font-family') ? unquote(hexo-config('font.code-font-family')) : $dafault-code-font
$site-name-font = hexo-config('blog_title_font.font-family') ? unquote(hexo-config('blog_title_font.font-family')) : $font-family $site-name-font = hexo-config('blog_title_font.font-family') && unquote(hexo-config('blog_title_font.font-family'))
// hr // hr
$hrEnable = hexo-config('hr_icon') && hexo-config('hr_icon.enable') $hrEnable = hexo-config('hr_icon') && hexo-config('hr_icon.enable')
$hr-icon = $hrEnable && hexo-config('hr_icon.icon') ? hexo-config('hr_icon.icon') : '\f0c4' $hr-icon = $hrEnable && hexo-config('hr_icon.icon') ? hexo-config('hr_icon.icon') : '\f0c4'
@@ -32,7 +32,7 @@ $code-font-size = hexo-config('font.code-font-size') ? convert(hexo-config('font
$font-color = #1F2D3D $font-color = #1F2D3D
$rem = 20px $rem = 20px
$text-line-height = 2 $text-line-height = 2
$web-bg = hexo-config('background') && convert(hexo-config('background')) $web-bg = hexo-config('background') && unquote(hexo-config('background'))
$index_top_img_height = hexo-config('index_top_img_height') ? convert(hexo-config('index_top_img_height')) : 100vh $index_top_img_height = hexo-config('index_top_img_height') ? convert(hexo-config('index_top_img_height')) : 100vh
$index_site_info_top = hexo-config('index_site_info_top') ? convert(hexo-config('index_site_info_top')) : 43% $index_site_info_top = hexo-config('index_site_info_top') ? convert(hexo-config('index_site_info_top')) : 43%
// Global color & SVG // Global color & SVG
@@ -58,14 +58,12 @@ $a-link-color = #99a9bf
$sticky-color = $light-orange $sticky-color = $light-orange
$theme-meta-color = $themeColorEnable && hexo-config('theme_color.meta_color') ? convert(hexo-config('theme_color.meta_color')) : #858585 $theme-meta-color = $themeColorEnable && hexo-config('theme_color.meta_color') ? convert(hexo-config('theme_color.meta_color')) : #858585
// sidebar // sidebar
$sidebar-icon-top = 20px
$sidebar-icon-left = $sidebar-icon-top - 4px
$sidebar-icon-size = 16px
$sidebar-icon-color = #1F2D3D
$sidebar-width = 300px
$sidebar-background = #f6f8fa $sidebar-background = #f6f8fa
$sidebar-active-color = #fff $sidebar-width = 300px
$mobile-sidebar-width = 250px // aside
$toc-link-color = #666261
$toc-mobile-width = 300px
$toc-active-color = #fff
// Button // Button
$button-color = #fff $button-color = #fff
$button-hover-color = $themeColorEnable && hexo-config('theme_color.button_hover') ? convert(hexo-config('theme_color.button_hover')) : $light-orange $button-hover-color = $themeColorEnable && hexo-config('theme_color.button_hover') ? convert(hexo-config('theme_color.button_hover')) : $light-orange
@@ -160,16 +158,16 @@ $note-modern-danger-border = #ebcdd2
$note-modern-danger-bg = lighten(spin($note-modern-danger-border, 10), 35% + ($lbg * 4)) $note-modern-danger-bg = lighten(spin($note-modern-danger-border, 10), 35% + ($lbg * 4))
$note-modern-danger-text = #a94442 $note-modern-danger-text = #a94442
$note-modern-danger-hover = darken(spin($note-modern-danger-text, -10), 22%) $note-modern-danger-hover = darken(spin($note-modern-danger-text, -10), 22%)
// Tag Plugins - Button // Tag Plugins - Button/note
$btn-types = 'blue' 'pink' 'red' 'purple' 'orange' 'green' $tagsP-types = 'blue' 'pink' 'red' 'purple' 'orange' 'green'
$btn-color = #fff $btn-color = #fff
$btn-default-color = #777 $btn-default-color = #777
$btn-blue-color = #428bca $tagsP-blue-color = #428bca
$btn-pink-color = #FF69B4 $tagsP-pink-color = #FF69B4
$btn-red-color = #FF0000 $tagsP-red-color = #FF0000
$btn-orange-color = #FF8C00 $tagsP-orange-color = #FF8C00
$btn-purple-color = #6f42c1 $tagsP-purple-color = #6f42c1
$btn-green-color = #5cb85c $tagsP-green-color = #5cb85c
// Tag Plugins - Tab // Tag Plugins - Tab
$tab-border-color = #f0f0f0 $tab-border-color = #f0f0f0
$tab-botton-bg = #f0f0f0 $tab-botton-bg = #f0f0f0

View File

@@ -1,21 +1,11 @@
/**
* 當menu過多時自動適配避免UI錯亂
* @param {*} n
* 傳入 1 sidebar打開時
* 傳入 2 正常狀態下
*/
$(function () { $(function () {
const blogNameWidth = $('#site-name').width() const blogNameWidth = $('#site-name').width()
const menusWidth = $('#menus').width() const menusWidth = $('#menus').width()
const sidebarWidth = $('#sidebar').width() || 300
const adjustMenu = function (n) { const adjustMenu = () => {
const $nav = $('#nav') const $nav = $('#nav')
let t let t
if (n === 0) t = true if (window.innerWidth < 768) t = true
else if (n === 1) t = blogNameWidth + menusWidth > $nav.width() - sidebarWidth - 30
else t = blogNameWidth + menusWidth > $nav.width() - 30 else t = blogNameWidth + menusWidth > $nav.width() - 30
if (t) { if (t) {
@@ -27,153 +17,45 @@ $(function () {
// 初始化header // 初始化header
const initAdjust = () => { const initAdjust = () => {
if (window.innerWidth < 768) adjustMenu(0) adjustMenu()
else adjustMenu(2) $('#nav').addClass('show')
$('#nav').css({ opacity: '1', animation: 'headerNoOpacity 1s' })
} }
/** // sidebar menus
* 進入post頁sidebar處理
*/
const OpenSidebarAuto = () => {
if (window.innerWidth > 1024 && $('#toggle-sidebar').hasClass('on')) {
setTimeout(function () {
openSidebar()
}, 400)
}
}
/**
* 點擊左下角箭頭,顯示sidebar
*/
const closeSidebar = () => {
$('#sidebar').removeClass('tocOpenPc').animate({
left: '-300px'
}, 400)
$('#menus').animate({
paddingRight: 0
}, 400)
$('#body-wrap').animate({
paddingLeft: 0
}, 400)
if ($('#nav').hasClass('hide-menu')) {
setTimeout(function () {
adjustMenu(2)
}, 400)
}
}
const openSidebar = () => {
if (!$('#nav').hasClass('hide-menu')) {
adjustMenu(1)
}
$('#sidebar').addClass('tocOpenPc').animate({
left: 0
}, 400)
$('#menus').animate({
paddingRight: 300
}, 400)
$('#body-wrap').animate({
paddingLeft: 300
}, 400)
}
const toggleSidebar = function () {
$('#toggle-sidebar').on('click', function () {
const isOpen = $(this).hasClass('on')
isOpen ? $(this).removeClass('on') : $(this).addClass('on')
if (isOpen) {
closeSidebar()
} else {
openSidebar()
}
})
}
/**
* 手機menu和toc按鈕點擊
* 顯示menu和toc的sidebar
*/
const sidebarFn = () => { const sidebarFn = () => {
const $toggleMenu = $('#toggle-menu') const $toggleMenu = $('#toggle-menu')
const $mobileSidebarMenus = $('#mobile-sidebar-menus') const $mobileSidebarMenus = $('#sidebar-menus')
const $mobileTocButton = $('#mobile-toc-button') const $menuMask = $('#menu-mask')
const $menuMask = $('#menu_mask')
const $body = $('body') const $body = $('body')
const $sidebar = $('#sidebar')
function openMobileSidebar (name) { function openMobileSidebar () {
btf.sidebarPaddingR() btf.sidebarPaddingR()
$body.css('overflow', 'hidden') $body.css('overflow', 'hidden')
$menuMask.fadeIn() $menuMask.fadeIn()
if (name === 'menu') {
$toggleMenu.removeClass('close').addClass('open') $toggleMenu.removeClass('close').addClass('open')
$mobileSidebarMenus.addClass('open') $mobileSidebarMenus.addClass('open')
} }
if (name === 'toc') { function closeMobileSidebar () {
$mobileTocButton.removeClass('close').addClass('open')
$sidebar.addClass('tocOpenMobile').css({ transform: 'translate3d(-100%,0,0)', left: '' })
}
}
function closeMobileSidebar (name) {
$body.css({ overflow: '', 'padding-right': '' }) $body.css({ overflow: '', 'padding-right': '' })
$menuMask.fadeOut() $menuMask.fadeOut()
if (name === 'menu') {
$toggleMenu.removeClass('open').addClass('close') $toggleMenu.removeClass('open').addClass('close')
$mobileSidebarMenus.removeClass('open') $mobileSidebarMenus.removeClass('open')
} }
if (name === 'toc') {
$mobileTocButton.removeClass('open').addClass('close')
$sidebar.removeClass('tocOpenMobile').css({ transform: '' })
}
}
$toggleMenu.on('click', function () { $toggleMenu.on('click', function () {
openMobileSidebar('menu') openMobileSidebar()
})
$mobileTocButton.on('click', function () {
openMobileSidebar('toc')
}) })
$menuMask.on('click touchstart', function (e) { $menuMask.on('click touchstart', function (e) {
if ($toggleMenu.hasClass('open')) { if ($toggleMenu.hasClass('open')) {
closeMobileSidebar('menu') closeMobileSidebar()
}
if ($mobileTocButton.hasClass('open')) {
closeMobileSidebar('toc')
} }
}) })
$(window).on('resize', function (e) { $(window).on('resize', function (e) {
if (!$toggleMenu.is(':visible')) { if (!$toggleMenu.is(':visible')) {
if ($toggleMenu.hasClass('open')) closeMobileSidebar('menu') if ($toggleMenu.hasClass('open')) closeMobileSidebar()
}
})
const mql = window.matchMedia('(max-width: 1024px)')
mql.addListener((ev) => {
if (ev.matches) {
if ($sidebar.hasClass('tocOpenPc')) closeSidebar()
} else {
if ($('#toggle-sidebar').hasClass('on')) openSidebar()
if ($mobileTocButton.hasClass('open')) closeMobileSidebar('toc')
}
})
// toc元素點擊
$sidebar.find('.toc-link').on('click', function (e) {
e.preventDefault()
btf.scrollToDest(decodeURI($(this).attr('href')))
if (window.innerWidth < 1024) {
closeMobileSidebar('toc')
} }
}) })
} }
@@ -182,7 +64,7 @@ $(function () {
* 首頁top_img底下的箭頭 * 首頁top_img底下的箭頭
*/ */
const scrollDownInIndex = () => { const scrollDownInIndex = () => {
$('#scroll_down').on('click', function () { $('#scroll-down').on('click', function () {
btf.scrollToDest('#content-inner') btf.scrollToDest('#content-inner')
}) })
} }
@@ -345,9 +227,7 @@ $(function () {
* fancybox和 mediumZoom * fancybox和 mediumZoom
*/ */
const addLightBox = function () { const addLightBox = function () {
const isMediumZoom = GLOBAL_CONFIG.medium_zoom if (GLOBAL_CONFIG.lightbox === 'fancybox') {
const isFancybox = GLOBAL_CONFIG.fancybox
if (isFancybox) {
const images = $('#article-container img:not(.gallery-group-img)').not($('a>img')) const images = $('#article-container img:not(.gallery-group-img)').not($('a>img'))
images.each(function (i, o) { images.each(function (i, o) {
const lazyloadSrc = $(o).attr('data-lazy-src') ? $(o).attr('data-lazy-src') : $(o).attr('src') const lazyloadSrc = $(o).attr('data-lazy-src') ? $(o).attr('data-lazy-src') : $(o).attr('src')
@@ -363,7 +243,7 @@ $(function () {
buttons: ['slideShow', 'fullScreen', 'thumbs', 'close'], buttons: ['slideShow', 'fullScreen', 'thumbs', 'close'],
hash: false hash: false
}) })
} else if (isMediumZoom) { } else {
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' const photoBg = $(document.documentElement).attr('data-theme') === 'dark' ? '#121212' : '#fff'
@@ -425,14 +305,19 @@ $(function () {
* toc * toc
*/ */
const tocFn = function () { const tocFn = function () {
$('.toc-child').hide() const $cardTocLayout = $('#card-toc')
const $cardToc = $cardTocLayout.find('.toc-content')
const $tocChild = $cardToc.find('.toc-child')
const $tocLink = $cardToc.find('.toc-link')
const $article = $('#article-container')
$tocChild.hide()
// main of scroll // main of scroll
$(window).scroll(btf.throttle(function (event) { $(window).scroll(btf.throttle(function (event) {
const currentTop = $(this).scrollTop() const currentTop = $(this).scrollTop()
scrollPercent(currentTop) scrollPercent(currentTop)
findHeadPosition(currentTop) findHeadPosition(currentTop)
autoScrollToc(currentTop)
}, 100)) }, 100))
// expand toc-item // expand toc-item
@@ -444,20 +329,16 @@ $(function () {
} }
const scrollPercent = function (currentTop) { const scrollPercent = function (currentTop) {
const $dom = $('#article-container') const docHeight = $article.height()
const docHeight = $dom.height()
const winHeight = $(window).height() const winHeight = $(window).height()
const headerHeight = $dom.offset().top const headerHeight = $article.offset().top
const contentMath = (docHeight > winHeight) ? (docHeight - winHeight) : ($(document).height() - winHeight) const contentMath = (docHeight > winHeight) ? (docHeight - winHeight) : ($(document).height() - winHeight)
const scrollPercent = (currentTop - headerHeight) / (contentMath) const scrollPercent = (currentTop - headerHeight) / (contentMath)
const scrollPercentRounded = Math.round(scrollPercent * 100) const scrollPercentRounded = Math.round(scrollPercent * 100)
const percentage = (scrollPercentRounded > 100) ? 100 const percentage = (scrollPercentRounded > 100) ? 100
: (scrollPercentRounded <= 0) ? 0 : (scrollPercentRounded <= 0) ? 0
: scrollPercentRounded : scrollPercentRounded
$('#sidebar .progress-num').text(percentage) $cardToc.attr('progress-percentage', percentage)
$('#sidebar .sidebar-toc__progress-bar').animate({
width: percentage + '%'
}, 100)
} }
// anchor // anchor
@@ -468,41 +349,83 @@ $(function () {
} }
} }
const mobileToc = {
open: () => {
$cardTocLayout.css('display', 'block')
},
close: () => {
$cardTocLayout.css('animation', 'toc-close .2s')
setTimeout(() => {
$cardTocLayout.css({ display: '', animation: '' })
}, 100)
}
}
$('#mobile-toc-button').on('click', () => {
if ($cardTocLayout.is(':visible')) {
mobileToc.close()
} else {
mobileToc.open()
}
})
// toc元素點擊
$tocLink.on('click', function (e) {
e.preventDefault()
btf.scrollToDest(decodeURI($(this).attr('href')))
if (window.innerWidth < 900) {
mobileToc.close()
}
})
const autoScrollToc = function (currentTop, item) {
const activePosition = item.offset().top
const $tocContent = $cardToc
const sidebarScrollTop = $tocContent.scrollTop()
if (activePosition > (currentTop + $(window).height() - 100)) {
$tocContent.scrollTop(sidebarScrollTop + 100)
}
if (activePosition < currentTop + 100) {
$tocContent.scrollTop(sidebarScrollTop - 100)
}
}
// find head position & add active class // find head position & add active class
// DOM Hierarchy: // DOM Hierarchy:
// ol.toc > (li.toc-item, ...) // ol.toc > (li.toc-item, ...)
// li.toc-item > (a.toc-link, ol.toc-2child > (li.toc-item, ...)) // li.toc-item > (a.toc-link, ol.toc-2child > (li.toc-item, ...))
const versionBiggerFive = GLOBAL_CONFIG.hexoversion.split('.')[0] >= 5 const list = $article.find('h1,h2,h3,h4,h5,h6')
const findHeadPosition = function (top) { const findHeadPosition = function (top) {
// assume that we are not in the post page if no TOC link be found, // assume that we are not in the post page if no TOC link be found,
// thus no need to update the status // thus no need to update the status
if ($('.toc-link').length === 0) { if ($tocLink.length === 0) {
return false return false
} }
const list = $('#article-container').find('h1,h2,h3,h4,h5,h6')
let currentId = '' let currentId = ''
list.each(function () { list.each(function () {
const head = $(this) const head = $(this)
if (top > head.offset().top - 70) { if (top > head.offset().top - 70) {
if (versionBiggerFive) currentId = '#' + encodeURI($(this).attr('id')) currentId = '#' + encodeURI($(this).attr('id'))
else currentId = '#' + $(this).attr('id')
} }
}) })
if (currentId === '') { if (currentId === '') {
$('.toc-link').removeClass('active') $tocLink.removeClass('active')
$('.toc-child').hide() $tocChild.hide()
} }
const currentActive = $('.toc-link.active') const currentActive = $tocLink.filter('.active')
if (currentId && currentActive.attr('href') !== currentId) { if (currentId && currentActive.attr('href') !== currentId) {
if (isAnchor) updateAnchor(currentId) if (isAnchor) updateAnchor(currentId)
$('.toc-link').removeClass('active') $tocLink.removeClass('active')
const _this = $('.toc-link[href="' + currentId + '"]') const _this = $tocLink.filter('[href="' + currentId + '"]')
_this.addClass('active') _this.addClass('active')
autoScrollToc(top, _this)
const parents = _this.parents('.toc-child') const parents = _this.parents('.toc-child')
// Returned list is in reverse order of the DOM elements // Returned list is in reverse order of the DOM elements
@@ -518,19 +441,6 @@ $(function () {
.find('.toc-child').hide() .find('.toc-child').hide()
} }
} }
const autoScrollToc = function (currentTop) {
if ($('.toc-link').hasClass('active')) {
const activePosition = $('.active').offset().top
const sidebarScrollTop = $('#sidebar .sidebar-toc__content').scrollTop()
if (activePosition > (currentTop + $(window).height() - 100)) {
$('#sidebar .sidebar-toc__content').scrollTop(sidebarScrollTop + 100)
}
if (activePosition < currentTop + 100) {
$('#sidebar .sidebar-toc__content').scrollTop(sidebarScrollTop - 100)
}
}
}
} }
/** /**
@@ -573,13 +483,24 @@ $(function () {
// Back to top // Back to top
$rightsideEle.on('click', '#go-up', () => btf.scrollToDest('body')) $rightsideEle.on('click', '#go-up', () => btf.scrollToDest('body'))
$rightsideEle.on('click', '#hide-aside-btn', () => {
const $htmlDom = $(document.documentElement)
if ($htmlDom.hasClass('hide-aside')) {
$htmlDom.removeClass('hide-aside')
saveToLocal.set('aside-status', 'show', 2)
} else {
$htmlDom.addClass('hide-aside')
saveToLocal.set('aside-status', 'hide', 2)
}
})
/** /**
* menu * menu
* 側邊欄sub-menu 展開/收縮 * 側邊欄sub-menu 展開/收縮
* 解決menus在觸摸屏下滑動屏幕menus_item_child不消失的問題手機hover的bug) * 解決menus在觸摸屏下滑動屏幕menus_item_child不消失的問題手機hover的bug)
*/ */
const clickFnOfSubMenu = function () { const clickFnOfSubMenu = function () {
$('#mobile-sidebar-menus .expand').on('click', function () { $('#sidebar-menus .expand').on('click', function () {
$(this).parents('.menus_item').find('> .menus_item_child').slideToggle() $(this).parents('.menus_item').find('> .menus_item_child').slideToggle()
$(this).toggleClass('hide') $(this).toggleClass('hide')
}) })
@@ -650,22 +571,6 @@ $(function () {
}) })
} }
/**
* 百度推送
*/
const pushToBaidu = () => {
const bp = document.createElement('script')
const curProtocol = window.location.protocol.split(':')[0]
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'
} else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js'
}
bp.dataset.pjax = ''
const s = document.getElementsByTagName('script')[0]
s.parentNode.insertBefore(bp, s)
}
/** /**
* tag-hide * tag-hide
*/ */
@@ -719,20 +624,21 @@ $(function () {
const $cardCategory = $('#aside-cat-list .card-category-list-item.parent i') const $cardCategory = $('#aside-cat-list .card-category-list-item.parent i')
$cardCategory.on('click', function (e) { $cardCategory.on('click', function (e) {
e.preventDefault() e.preventDefault()
const $this = $(this) $(this).toggleClass('expand').parents('.parent').next().slideToggle(300)
$this.toggleClass('expand')
$this.parents('.parent').next().toggle()
}) })
} }
const switchComments = function () { const switchComments = function () {
let switchDone = false let switchDone = false
$('#switch-comments-btn').on('click', function () { $('#comment-switch > .switch-btn').on('click', function () {
$('#post-comment > .comment-wrap > div').each(function () { const $btn = $(this)
if ($(this).is(':visible')) { $btn.hasClass('move') ? $btn.removeClass('move') : $btn.addClass('move')
$(this).hide() $('#post-comment > .comment-wrap > div').each(function (i, o) {
const $this = $(o)
if ($this.is(':visible')) {
$this.hide()
} else { } else {
$(this).css({ $this.css({
display: 'block', display: 'block',
animation: 'tabshow .5s' animation: 'tabshow .5s'
}) })
@@ -766,27 +672,36 @@ $(function () {
}) })
} }
const relativeDate = function (selector) {
selector.each((i, o) => {
const $this = $(o)
const timeVal = $this.attr('datetime')
$this.text(btf.diffDate(timeVal, true)).css('display', 'inline')
})
}
const unRefreshFn = function () { const unRefreshFn = function () {
$(window).on('resize', function () { $(window).on('resize', function () {
if (window.innerWidth < 768) adjustMenu(0) adjustMenu()
else if ($('#sidebar').hasClass('tocOpenPc') && $('#nav').hasClass('fixed')) adjustMenu(1)
else adjustMenu(2)
}) })
clickFnOfSubMenu() clickFnOfSubMenu()
GLOBAL_CONFIG.islazyload && lazyloadImg() GLOBAL_CONFIG.islazyload && lazyloadImg()
GLOBAL_CONFIG.copyright !== undefined && addCopyright() GLOBAL_CONFIG.copyright !== undefined && addCopyright()
GLOBAL_CONFIG.baiduPush && pushToBaidu()
} }
window.refreshFn = function () { window.refreshFn = function () {
initAdjust() initAdjust()
if (GLOBAL_CONFIG_SITE.isPost) { if (GLOBAL_CONFIG_SITE.isPost) {
OpenSidebarAuto() GLOBAL_CONFIG_SITE.isToc && tocFn()
toggleSidebar()
GLOBAL_CONFIG_SITE.isSidebar && tocFn()
GLOBAL_CONFIG.noticeOutdate !== undefined && addPostOutdateNotice() GLOBAL_CONFIG.noticeOutdate !== undefined && addPostOutdateNotice()
GLOBAL_CONFIG.relativeDate.post && relativeDate($('#post-meta time'))
} else {
GLOBAL_CONFIG.relativeDate.homepage && relativeDate($('#recent-posts time'))
GLOBAL_CONFIG.runtime && addRuntime()
addLastPushDate()
toggleCardCategory()
} }
sidebarFn() sidebarFn()
@@ -794,15 +709,12 @@ $(function () {
GLOBAL_CONFIG.highlight && addHighlightTool() GLOBAL_CONFIG.highlight && addHighlightTool()
GLOBAL_CONFIG.isPhotoFigcaption && addPhotoFigcaption() GLOBAL_CONFIG.isPhotoFigcaption && addPhotoFigcaption()
runJustifiedGallery() runJustifiedGallery()
addLightBox() GLOBAL_CONFIG.lightbox !== 'null' && addLightBox()
scrollFn() scrollFn()
GLOBAL_CONFIG.runtime && addRuntime()
addLastPushDate()
addTableWrap() addTableWrap()
clickFnOfTagHide() clickFnOfTagHide()
tabsFn.clickFnOfTabs() tabsFn.clickFnOfTabs()
tabsFn.backToTop() tabsFn.backToTop()
toggleCardCategory()
switchComments() switchComments()
} }

View File

@@ -1,7 +1,7 @@
$(function () { $(function () {
const openSearch = () => { const openSearch = () => {
$('body').css({ width: '100%', overflow: 'hidden' }) $('body').css({ width: '100%', overflow: 'hidden' })
$('#algolia-search').css('display', 'block') $('#algolia-search .search-dialog').css('display', 'block')
$('.ais-search-box--input').focus() $('.ais-search-box--input').focus()
$('#search-mask').fadeIn() $('#search-mask').fadeIn()
// shortcut: ESC // shortcut: ESC
@@ -15,12 +15,12 @@ $(function () {
const closeSearch = () => { const closeSearch = () => {
$('body').css({ width: '', overflow: '' }) $('body').css({ width: '', overflow: '' })
$('#algolia-search').css({ $('#algolia-search .search-dialog').css({
animation: 'search_close .5s' animation: 'search_close .5s'
}) })
setTimeout(function () { setTimeout(function () {
$('#algolia-search').css({ $('#algolia-search .search-dialog').css({
animation: '', animation: '',
display: 'none' display: 'none'
}) })
@@ -36,7 +36,7 @@ $(function () {
searchClickFn() searchClickFn()
window.addEventListener('pjax:success', function () { window.addEventListener('pjax:complete', function () {
closeSearch() closeSearch()
searchClickFn() searchClickFn()
}) })

View File

@@ -5,7 +5,7 @@ $(function () {
width: '100%', width: '100%',
overflow: 'hidden' overflow: 'hidden'
}) })
$('#local-search').css('display', 'block') $('#local-search .search-dialog').css('display', 'block')
$('#local-search-input input').focus() $('#local-search-input input').focus()
$('#search-mask').fadeIn() $('#search-mask').fadeIn()
if (!loadFlag) { if (!loadFlag) {
@@ -27,12 +27,12 @@ $(function () {
width: '', width: '',
overflow: '' overflow: ''
}) })
$('#local-search').css({ $('#local-search .search-dialog').css({
animation: 'search_close .5s' animation: 'search_close .5s'
}) })
setTimeout(function () { setTimeout(function () {
$('#local-search').css({ $('#local-search .search-dialog').css({
animation: '', animation: '',
display: 'none' display: 'none'
}) })
@@ -47,8 +47,9 @@ $(function () {
} }
searchClickFn() searchClickFn()
window.addEventListener('pjax:success', function () {
$('#local-search').is(':visible') && closeSearch() window.addEventListener('pjax:complete', function () {
$('#local-search .search-dialog').is(':visible') && closeSearch()
searchClickFn() searchClickFn()
}) })
@@ -85,7 +86,7 @@ $(function () {
} }
let dataTitle = data.title.trim().toLowerCase() let dataTitle = data.title.trim().toLowerCase()
const dataContent = data.content.trim().replace(/<[^>]+>/g, '').toLowerCase() const dataContent = data.content.trim().replace(/<[^>]+>/g, '').toLowerCase()
const dataUrl = data.url const dataUrl = data.url.startsWith('/') ? data.url : GLOBAL_CONFIG.root + data.url
let indexTitle = -1 let indexTitle = -1
let indexContent = -1 let indexContent = -1
let firstOccur = -1 let firstOccur = -1

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