Compare commits

...

39 Commits
3.0.1 ... 3.1.1

Author SHA1 Message Date
Jerry
8e4c20f6d4 label: 更新 3.1.1
chore: update hexo-renderer-stylus to 2.0.1
2020-09-06 22:13:37 +08:00
Jerry
e984efa35c fix: 修復開啟 prismjs 後, 在低版本的 safari 會出現 js 報錯的 Bugs 2020-09-06 22:11:59 +08:00
Jerry
863cf1e780 Merge branch 'dev' into master 2020-09-04 00:42:50 +08:00
Jerry
8603db0545 fix: 修復關閉last push date 後, 報 'hour' 找不到的bugs 2020-09-02 00:04:32 +08:00
Jerry
85b8a83371 Merge branch 'dev' into master 2020-08-31 13:41:47 +08:00
Jerry
d381d63c08 label: 3.1.0 發佈
fix: 簡體中文的 ‘小時’ 修改為簡體
2020-08-31 13:40:02 +08:00
Jerry
51c4726c54 improvements: 代碼名全大寫
improvements: 補全card-categories和card-archives的 '查看更多‘鏈接 close #337
fix: 修復comments沒設置時,報Unexpected token ')'的bugs close #344
improvements: 優化js和html
fix: 修復toc 滾動百分比不準的Bugs
2020-08-31 01:31:59 +08:00
Jerry
593eb4734e label: 版本號更改 2020-08-29 01:16:46 +08:00
Jerry
fe97d2e63f feat: 增加 aside 最新評論部件
style: 部分css調整和html優化
improvements: 刪除pwa中的theme-color配置,默認生成meta theme-color  close #340
improvements: 優化最後更新時間顯示(1小時內顯示 剛剛,1小時到24小時 顯示 xx小時前,1天到365天 顯示 xx天前,365天后直接顯示日期)
2020-08-29 01:11:11 +08:00
Jerry
ee6f62f4bc fix: 修復在modern樣式下,note 標簽外掛沒有使用tags名時,沒有背景色和夜間模式文字顯示不清楚的bugs
fix: 修復主頁文章cover在深色模式下,邊角有小白邊的bugs close #278
fix: 修復note標簽外掛下,代碼塊顯示背景色的bugs close #339
2020-08-27 21:47:40 +08:00
Jerry
40fd319cb2 fix: 修復當關閉代碼渲染后,標簽外挂裏的代碼塊會被壓縮到一行的bugs
improvements: 優化網站最後更新時間顯示,’0天前‘改爲’今天‘
2020-08-24 22:56:58 +08:00
Jerry
4aacafdae1 feat: 適配hexo 5.1.0 prismjs caption
feat: code-font-size 也會影響行內代碼塊字體大小 #325
fix: 修復aside recent post的 time 在safari沒有顯示的bug
fix: 修復 prismjs 在 tags-toggle 外掛標簽裏,代碼塊顯示一行的bugs
style: 刪除不必要的css
2020-08-22 23:17:28 +08:00
Jerry Wong
ea7eb904fd Merge pull request #331 from HackerYunen/patch-1
Update card_author.pug
2020-08-22 21:20:09 +08:00
HackerYunen
fb5d6f1fd7 Update card_author.pug
同mobile-menus.pug一般,补齐URL。
2020-08-22 20:29:31 +08:00
Jerry
543cd94c9f feat: 適配 hexo 5.0.0 的 prismjs, 代碼主題和各項功能
refactor: 移除 代碼default主題
fix: 修復夜間模式下代碼塊有背景的bugs(沒開啟渲染的情況下)
feat: 增加 code font-size配置 close #322
refactor: 更改配置中 code-font 為 code-font-family
feat: Pjax下,刷新頁面時,會滾動到上次瀏覽的位置
fix: 修復mathjax溢出屏幕的Bugs close #321
2020-08-19 00:21:18 +08:00
Jerry
973306898a 1. style: 版本號更新 2020-08-18 00:52:55 +08:00
Jerry
c512a5fda5 1. chore: 只支持hexo 4.2.0以上版本
2. feat: 可隱藏Mobile sidebar 子菜單
3. refactor: archives和card-post 改為flex佈局
4. feat: 當寬度小於1024時,點擊toc滾動,增加滾動效果
5. feat: 點擊滾動,如果滾動是向上時,將會偏移60px, 避免導航欄遮擋 close #317
6. feat: 可配置font-size
7. refactor: 去除字體放大、縮小按鈕
8. refactor: 部分css由'px'改為'em',適應font-size值改變而改變
9.  feat: pjax增加exclude配置
10. fix: 修復canvas_nest 配置沒有生效的Bugs
11. feat: 新增 cnzz_analytics
12. feat: 騰訊分析改為騰訊移動分析,並適配pjax
13. perf: 改cookies為localstore存儲
14. feat: 設置中的theme_color可單獨配置幾個,而不需要全部開啟 close #314
15. feat: butterfly.yml 採用deepMerge, 與_config文件進行合併而不是替換
16. fix: 修復rightsize-bottom配置無效的bug
17. refactor: aside增加position sticky
18. refactor: 調整webinfo 寬度小時的顯示
19. feat: 更改addtoany item的寫法
20. refactor: aside 內容邊距調整
21. feat: 增加最後更新時間顯示
2020-08-18 00:33:05 +08:00
Jerry
d73960f2a2 Merge branch 'dev' into master 2020-08-11 21:20:01 +08:00
Jerry
fcd430902d Merge branch 'dev' into master 2020-08-05 22:04:47 +08:00
Jerry
ee45f6517f Merge branch 'dev' into master 2020-08-02 23:31:32 +08:00
Jerry
67201ac58d 📝 更改注釋文字 2020-08-01 22:47:34 +08:00
Jerry
315d3b50df Merge branch 'dev' into master 2020-08-01 14:44:06 +08:00
Jerry
727a2d97d9 🐛 修復子目錄下,404頁面的‘回到首頁’鏈接錯誤的bugs 2020-07-18 23:30:37 +08:00
Jerry
54b67987c1 Merge branch 'dev' 2020-06-24 00:52:33 +08:00
Jerry
26df41c772 Merge branch 'dev' 2020-06-20 22:10:55 +08:00
Jerry
4e7051ad77 Merge branch 'dev' 2020-06-20 14:01:45 +08:00
Jerry
955b4bae6a Merge branch 'dev' 2020-06-18 20:13:59 +08:00
Jerry
95ddf28f3b Merge branch 'dev' 2020-06-16 21:19:47 +08:00
Jerry
e901f9ad35 Merge branch 'dev' 2020-06-16 18:43:13 +08:00
Jerry
462422e279 Merge branch 'dev' 2020-05-21 16:29:44 +08:00
Jerry
bad24849bd Merge branch 'dev' 2020-05-01 19:00:12 +08:00
Jerry
eb242f0809 Merge branch 'dev' 2020-04-30 00:36:07 +08:00
Jerry
b1795e3def Merge branch 'dev' 2020-04-28 15:35:58 +08:00
Jerry
54b212ead3 Merge branch 'dev' 2020-04-27 14:45:26 +08:00
Jerry
4bbc035f54 Merge branch 'dev' 2020-04-27 02:40:24 +08:00
Jerry
40ba3bb92f 🏷️ 更新2.3.0 2020-04-26 23:42:52 +08:00
Jerry
e2cb0242bb 🏷️ 2.3.0發佈 2020-04-26 23:37:37 +08:00
Jerry
559afab632 🔖 2.2.5發佈
更新内容請看 https://github.com/jerryc127/hexo-theme-butterfly/releases
2020-03-28 03:20:36 +08:00
Jerry
c134d4fc86 🐛 fix: 修復highlight_shrink設為false時,導致script報錯的bug
🐛 fix: 修復highlight_shrink設為true時,按鈕點擊無反應,沒有打開代碼框的bug
🐛 fix: 修復自動切換darkmode時,切換按鈕icon沒有變更的bug
2020-03-24 19:03:51 +08:00
101 changed files with 2796 additions and 1898 deletions

View File

@@ -7,14 +7,16 @@ assignees: ''
--- ---
<!-- Do not delete the template (不要刪除模板) -->
<!-- <!--
IMPORTANT: Please follow the template to create a new issue. IMPORTANT: Please follow the template to create a new issue.
重要:請依照該模板來提交。 重要:請依照該模板來提交。
If you upgrade from the old version, and an error occurs when running, please copy the new content in the config to the butterfly.yml If you upgrade from the old version, and an error occurs when running, please copy the new content in the config to the butterfly.yml
如果你是由舊版本升級到新版執行時出現報錯請首先把config裡新的內容複製到舊的butterfly設定去如有 如果你是由舊版本升級到新版執行時出現報錯請首先把config裡新的內容複製到舊的butterfly設定去(如有)
If you are a problem when visit the website, please open your browser 'developer tools (shortcut F12)' and check the console if there is an error, include your website address in the feedback If you are a problem when visiting the website, please open your browser 'developer tools (shortcut F12)' and check the console if there is an error, include your website address in the feedback
如果你是線上訪問出現問題請檢查瀏覽器開發人員工具快捷鍵F12的console是否有報錯反饋時附上你的網站 如果你是線上訪問出現問題請檢查瀏覽器開發人員工具快捷鍵F12的console是否有報錯反饋時附上你的網站
--> -->

View File

@@ -4,7 +4,6 @@ about: Describe this issue template's purpose here.
title: '' title: ''
labels: '' labels: ''
assignees: '' assignees: ''
--- ---

1
.github/stale.yml vendored
View File

@@ -8,7 +8,6 @@ exemptLabels:
- security - security
- bug - bug
- enhancement - enhancement
- Solved
- documentation - documentation
# Label to use when marking an issue as stale # Label to use when marking an issue as stale
staleLabel: wontfix staleLabel: wontfix

View File

@@ -2,9 +2,8 @@
![version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly) ![version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly)
![https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff](https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff) ![https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff](https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff)
![hexo version](https://img.shields.io/badge/hexo-4.0+-0e83c) ![hexo version](https://img.shields.io/badge/hexo-4.2+-0e83c)
![npm download](https://img.shields.io/npm/dw/hexo-theme-butterfly?color=green) ![npm download](https://img.shields.io/npm/dw/hexo-theme-butterfly?color=green)
![nodejs version](https://img.shields.io/badge/node.js-8.0+-yellow)
![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly?color=FF5531) ![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly?color=FF5531)
Demo: 👍 [Butterfly](https://demo.jerryc.me/) || 🤞 [JerryC](https://jerryc.me/) Demo: 👍 [Butterfly](https://demo.jerryc.me/) || 🤞 [JerryC](https://jerryc.me/)
@@ -49,10 +48,49 @@ npm i hexo-theme-butterfly
> npm install hexo-renderer-pug hexo-renderer-stylus > npm install hexo-renderer-pug hexo-renderer-stylus
## Features
- [x] Card UI Design
- [X] Support sub-menu
- [x] Two Column designs
- [x] Responsive Web Design
- [x] Dark Mode
- [x] Pjax
- [x] Read Mode
- [x] Conversion between Traditional and Simplified Chinese
- [X] TOC catalog is available for both computers and mobile phones
- [X] Color themes (darker/pale night/light/ocean/mac/mac light), support custom colors
- [X] Code Blocks (Display code language/close or expand Code Blocks/Copy Button/word wrap)
- [X] Disable copy/Add a Copyright Notice to the Copied Text
- [X] Search (Algolia SearchZ/Local Search)
- [x] Mathjax and Katex
- [x] Built-in 404 page
- [x] WordCount
- [x] Related articles
- [x] Displays outdated notice for a post
- [x] Share (AddThis/Sharejs/Addtoany)
- [X] Comment (Disqus/Disqusjs/Livere/Gitalk/Valine/Utterances/Facebook Comments)
- [x] Multiple Comment System Support
- [x] Online Chats (Chatra/Tidio/Daovoice/Gitter/Crisp)
- [x] Web analytics (Baidu Analytics/Google Analytics/Tencent Analytics/CNZZ Analytics)
- [x] Google AdSense
- [x] Webmaster Verification (google/Bing/Baidu/360/Yandex)
- [x] Change website colour scheme
- [x] Typewriter Effect: activate_power_mode
- [x] Background effects (Canvas ribbon/canvas_ribbon_piao/canvas_nest)
- [x] Mouse click effects (Fireworks/Heart/Text)
- [x] Preloader/Loading Animation
- [x] Busuanzi visitor counter
- [x] Medium Zoom/Fancybox
- [x] Mermaid
- [x] Justified Gallery
- [x] Lazyload images
- [x] Instantpage/Pangu/Snackbar notification toast/PWA......
## Screenshots ## Screenshots
![image](https://user-images.githubusercontent.com/16351105/58887365-1272f780-8718-11e9-9329-3292c6ba20d4.png) ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-1.png)
![](https://user-images.githubusercontent.com/16351105/58887457-3cc4b500-8718-11e9-9417-2bdea603c92e.png) ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-2.png)
![](https://user-images.githubusercontent.com/16351105/69338594-7d03f980-0c9e-11ea-8b64-7f165e6508e2.png) ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-post.png)

View File

@@ -2,9 +2,8 @@
![version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly) ![version](https://img.shields.io/github/package-json/v/jerryc127/hexo-theme-butterfly)
![https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff](https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff) ![https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff](https://img.shields.io/npm/v/hexo-theme-butterfly?color=%09%23bf00ff)
![hexo version](https://img.shields.io/badge/hexo-4.0+-0e83c) ![hexo version](https://img.shields.io/badge/hexo-4.2+-0e83c)
![npm download](https://img.shields.io/npm/dw/hexo-theme-butterfly?color=green) ![npm download](https://img.shields.io/npm/dw/hexo-theme-butterfly?color=green)
![nodejs version](https://img.shields.io/badge/node.js-8.0+-yellow)
![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly?color=FF5531) ![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly?color=FF5531)
@@ -49,9 +48,49 @@ theme: butterfly
>如果你沒有pug以及stylus的渲染器請下載安裝 npm install hexo-renderer-pug hexo-renderer-stylus --save >如果你沒有pug以及stylus的渲染器請下載安裝 npm install hexo-renderer-pug hexo-renderer-stylus --save
## 特色
- [x] 卡片化設計
- [X] 支持二級目錄
- [x] 雙欄設計
- [x] 響應式主題
- [x] 夜間模式
- [x] Pjax
- [x] 文章閲讀模式
- [x] 簡體和繁體轉換
- [X] 電腦和手機都可查看TOC目錄
- [X] 內置多種代碼配色darker/pale night/light/ocean/mac/mac light可自定義代碼配色
- [X] 代碼塊顯示代碼語言/關閉或展開代碼塊/代碼複製/代碼自動換行
- [X] 可關閉文字複製/可開啟內容複製增加版權信息)
- [X] 兩種搜索Algolia搜索和本地搜索
- [x] Mathjax 和 Katex
- [x] 內置404頁面
- [x] 顯示字數統計
- [x] 顯示相關文章
- [x] 過期文章提醒
- [x] 多種分享系統AddThis/Sharejs/Addtoany
- [X] 多種評論系統Disqus/Disqusjs/Livere/Gitalk/Valine/Utterances/Facebook Comments
- [x] 支持雙評論部署
- [x] 多種在線聊天Chatra/Tidio/Daovoice/Gitter/Crisp
- [x] 多種分析系統(百度分析/谷歌分析/騰訊分析/CNZZ分析
- [x] 谷歌廣告/手動廣告位置
- [x] 各種站長驗證Google/Bing/Baidu/360/Yandex
- [x] 修改網站配色
- [x] 打字特效 activate_power_mode
- [x] 多種背景特效(靜止彩帶/動態彩帶/Canvas Nest
- [x] 多種鼠標點擊特效(煙花/文字/愛心)
- [x] 內置一種 Preloader 加載動畫
- [x] 不蒜子訪問統計
- [x] 兩種大圖模式Medium Zoom/Fancybox
- [x] Mermaid 圖表顯示
- [x] 照片牆
- [x] 圖片懶加載
- [x] Instantpage/Pangu/Snackbar彈窗/PWA......
## 截圖 ## 截圖
![image](https://user-images.githubusercontent.com/16351105/58887365-1272f780-8718-11e9-9329-3292c6ba20d4.png) ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-1.png)
![image](https://user-images.githubusercontent.com/16351105/58887457-3cc4b500-8718-11e9-9417-2bdea603c92e.png)
![](https://user-images.githubusercontent.com/16351105/69338594-7d03f980-0c9e-11ea-8b64-7f165e6508e2.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,10 +17,13 @@ menu:
# Link: /link/ || fas fa-link # Link: /link/ || fas fa-link
# About: /about/ || fas fa-heart # About: /about/ || fas fa-heart
# Hide the child menu items in mobile sidebar
hide_sidebar_menu_child: false
# Code Blocks (代碼相關) # Code Blocks (代碼相關)
# -------------------------------------- # --------------------------------------
highlight_theme: light # default / darker / pale night / light / ocean / mac / mac light / false highlight_theme: light # darker / pale night / light / ocean / mac / mac light / false
highlight_copy: true # copy button highlight_copy: true # copy button
highlight_lang: true # show the code language highlight_lang: true # show the code language
highlight_shrink: false # true: shrink the code blocks / false: expand the code blocks | none: expand code blocks and hide the button highlight_shrink: false # true: shrink the code blocks / false: expand the code blocks | none: expand code blocks and hide the button
@@ -88,14 +91,14 @@ favicon: /img/favicon.png
# Avatar (頭像) # Avatar (頭像)
avatar: avatar:
img: /img/avatar.png 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: https://i.loli.net/2020/05/01/IuWi8QbHvzjlOPw.jpg default_top_img:
# the banner image of archive page # the banner image of archive page
archive_img: archive_img:
@@ -125,7 +128,7 @@ cover:
position: both position: both
# When cover is not set, the default cover is displayed (當沒有設置cover時默認的封面顯示) # When cover is not set, the default cover is displayed (當沒有設置cover時默認的封面顯示)
default_cover: default_cover:
- https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg # - https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg
# Replace Broken Images (替換無法顯示的圖片) # Replace Broken Images (替換無法顯示的圖片)
error_img: error_img:
@@ -232,14 +235,7 @@ sharejs:
# https://www.addtoany.com/ # https://www.addtoany.com/
addtoany: addtoany:
enable: false enable: false
item: item: facebook,twitter,wechat,sina_weibo,facebook_messenger,email,copy_link
- facebook
- twitter
- wechat
- sina_weibo
- facebook_messenger
- email
- copy_link
# Comments System # Comments System
# -------------------------------------- # --------------------------------------
@@ -252,7 +248,7 @@ comments:
# - Disqus # - Disqus
text: true # Display the comment name next to the button text: true # Display the comment name next to the button
# lazyload: The comment system will be load when comment element enters the browser's viewport. # lazyload: The comment system will be load when comment element enters the browser's viewport.
# If you set it to false, the comment count will be invalid # If you set it to true, the comment count will be invalid
lazyload: false lazyload: false
count: false # Display comment count in top_img count: false # Display comment count in top_img
@@ -386,14 +382,21 @@ footer:
# -------------------------------------- # --------------------------------------
# Baidu Analytics # Baidu Analytics
# https://tongji.baidu.com/web/welcome/login
baidu_analytics: baidu_analytics:
# Google Analytics # Google Analytics
# https://analytics.google.com/analytics/web/
google_analytics: google_analytics:
# Tencent Analytics ID # Tencent Analytics ID
# https://mta.qq.com
tencent_analytics: tencent_analytics:
# CNZZ Analytics
# https://www.umeng.com/
cnzz_analytics:
# Advertisement # Advertisement
# -------------------------------------- # --------------------------------------
@@ -528,9 +531,9 @@ click_heart: false
ClickShowText: ClickShowText:
enable: false enable: false
text: text:
- I # - I
- LOVE # - LOVE
- YOU # - YOU
fontSize: 15px fontSize: 15px
# Default display mode (網站默認的顯示模式) # Default display mode (網站默認的顯示模式)
@@ -547,14 +550,16 @@ beautify:
# Global font settings # Global font settings
# Don't modify the following settings unless you know how they work (非必要不要修改) # Don't modify the following settings unless you know how they work (非必要不要修改)
font: font:
global-font-size:
code-font-size:
font-family: font-family:
code-font: code-font-family:
# 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: https://fonts.googleapis.com/css?family=Titillium+Web&display=swap
font-family: Titillium Web, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif # font-family: Titillium Web, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif
# The setting of divider icon (水平分隔線圖標設置) # The setting of divider icon (水平分隔線圖標設置)
hr_icon: hr_icon:
@@ -621,7 +626,10 @@ aside:
format: MMMM YYYY # eg: YYYY年MM月 format: MMMM YYYY # eg: YYYY年MM月
order: -1 # Sort of order. 1, asc for ascending; -1, desc for descending order: -1 # Sort of order. 1, asc for ascending; -1, desc for descending
limit: 8 # if set 0 will show all limit: 8 # if set 0 will show all
card_webinfo: true card_webinfo:
enable: true
post_count: true
last_push_date: true
# busuanzi count for PV / UV in site # busuanzi count for PV / UV in site
# 訪問人數 # 訪問人數
@@ -636,6 +644,25 @@ runtimeshow:
enable: false enable: false
publish_date: publish_date:
# Aside widget - Newest Comments
newest_comments:
enable: false
limit: 6
avatar: true
leancloud:
enable: false
appId: # leancloud application app id
appKey: # leancloud application app key
serverURL: # This configuration is suitable for domestic custom domain name users, overseas version will be automatically detected (no need to manually fill in)
default_avatar: # mp/identicon/monsterid/wavatar/retro/robohash/blank
github_issues:
enable: false
repo:
disqus:
enable: false
forum:
api_key:
# Bottom right button (右下角按鈕) # Bottom right button (右下角按鈕)
# -------------------------------------- # --------------------------------------
@@ -709,7 +736,11 @@ note:
# 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
pjax: false pjax:
enable: false
exclude:
# - xxxx
# - xxxx
# Inject the css and script (aplayer/meting) # Inject the css and script (aplayer/meting)
aplayerInject: aplayerInject:
@@ -731,7 +762,7 @@ baidu_push: false
# https://instant.page/ # https://instant.page/
# prefetch (預加載) # prefetch (預加載)
instantpage: true instantpage: false
# https://github.com/vinta/pangu.js # https://github.com/vinta/pangu.js
# Insert a space between Chinese character and English character (中英文之間添加空格) # Insert a space between Chinese character and English character (中英文之間添加空格)
@@ -742,7 +773,7 @@ pangu:
# Lazyload (圖片懶加載) # Lazyload (圖片懶加載)
# https://github.com/verlok/lazyload # https://github.com/verlok/lazyload
lazyload: lazyload:
enable: true enable: false
post: /img/loading.gif post: /img/loading.gif
# PWA # PWA
@@ -751,7 +782,6 @@ lazyload:
# pwa: # pwa:
# enable: false # enable: false
# manifest: /image/pwa/manifest.json # manifest: /image/pwa/manifest.json
# theme_color: "#fff"
# apple_touch_icon: /image/pwa/apple-touch-icon.png # apple_touch_icon: /image/pwa/apple-touch-icon.png
# favicon_32_32: /image/pwa/32.png # favicon_32_32: /image/pwa/32.png
# favicon_16_16: /image/pwa/16.png # favicon_16_16: /image/pwa/16.png
@@ -858,3 +888,8 @@ CDN:
aplayer_css: https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css aplayer_css: https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css
aplayer_js: https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js aplayer_js: https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js
meting_js: https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js meting_js: https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js
# Prism.js
prismjs_js: https://cdn.jsdelivr.net/npm/prismjs/prism.min.js
prismjs_lineNumber_js: https://cdn.jsdelivr.net/npm/prismjs/plugins/line-numbers/prism-line-numbers.min.js
prismjs_autoloader: https://cdn.jsdelivr.net/npm/prismjs/plugins/autoloader/prism-autoloader.min.js

View File

@@ -65,11 +65,25 @@ aside:
card_webinfo: card_webinfo:
headline: Info headline: Info
article_name: Article article_name: Article
runtime_name: Run time runtime:
name: Run time
unit: days
last_push_date:
name: Last Push
site_wordcount: Total Count site_wordcount: Total Count
site_uv_name: UV site_uv_name: UV
site_pv_name: PV site_pv_name: PV
more_button: More more_button: More
card_newest_comments:
heading: Newest Comments
loading_text: loading...
zero_day: Today
day: days ago
date_suffix:
one_hour: Just
hours: hours ago
day: days ago
donate: Donate donate: Donate
share: Share share: Share
@@ -87,8 +101,6 @@ rightside:
scroll_to_comment: Scroll To Comments scroll_to_comment: Scroll To Comments
setting: Setting setting: Setting
runtime_unit: days
copy_copyright: copy_copyright:
author: Author author: Author
link: Link link: Link

View File

@@ -65,11 +65,25 @@ aside:
card_webinfo: card_webinfo:
headline: Info headline: Info
article_name: Article article_name: Article
runtime_name: Run time runtime:
name: Run time
unit: days
last_push_date:
name: Last Push
site_wordcount: Total Count site_wordcount: Total Count
site_uv_name: UV site_uv_name: UV
site_pv_name: PV site_pv_name: PV
more_button: More more_button: More
card_newest_comments:
heading: Newest Comments
loading_text: loading...
zero_day: Today
day: days ago
date_suffix:
one_hour: Just
hours: hours ago
day: days ago
donate: Donate donate: Donate
share: Share share: Share
@@ -87,8 +101,6 @@ rightside:
scroll_to_comment: Scroll To Comments scroll_to_comment: Scroll To Comments
setting: Setting setting: Setting
runtime_unit: days
copy_copyright: copy_copyright:
author: Author author: Author
link: Link link: Link

View File

@@ -67,11 +67,25 @@ aside:
card_webinfo: card_webinfo:
headline: 网站资讯 headline: 网站资讯
article_name: 文章数目 article_name: 文章数目
runtime_name: 已运行时间 runtime:
name: 已运行时间
unit:
last_push_date:
name: 最后更新时间
site_wordcount: 本站总字数 site_wordcount: 本站总字数
site_uv_name: 本站访客数 site_uv_name: 本站访客数
site_pv_name: 本站总访问量 site_pv_name: 本站总访问量
more_button: 查看更多 more_button: 查看更多
card_newest_comments:
heading: 最新评论
loading_text: 正在加载中...
zero_day: 今天
day: 天前
date_suffix:
one_hour: 刚刚
hours: 小时前
day: 天前
donate: 打赏 donate: 打赏
share: 分享 share: 分享
@@ -89,8 +103,6 @@ rightside:
scroll_to_comment: 直达评论 scroll_to_comment: 直达评论
setting: 设置 setting: 设置
runtime_unit:
copy_copyright: copy_copyright:
author: 作者 author: 作者
link: 链接 link: 链接
@@ -106,7 +118,6 @@ Snackbar:
day_to_night: 你已切换为深色模式 day_to_night: 你已切换为深色模式
night_to_day: 你已切换为浅色模式 night_to_day: 你已切换为浅色模式
error_title: 页面没有找到
loading: 加载中... loading: 加载中...
error404: error404:

View File

@@ -67,11 +67,25 @@ aside:
card_webinfo: card_webinfo:
headline: 網站資訊 headline: 網站資訊
article_name: 文章數目 article_name: 文章數目
runtime_name: 已執行時間 runtime:
name: 已運行時間
unit:
last_push_date:
name: 最後更新時間
site_wordcount: 本站總字數 site_wordcount: 本站總字數
site_uv_name: 本站訪客數 site_uv_name: 本站訪客數
site_pv_name: 本站總訪問量 site_pv_name: 本站總訪問量
more_button: 檢視更多 more_button: 檢視更多
card_newest_comments:
heading: 最新評論
loading_text: 正在加載中...
zero_day: 今天
day: 天前
date_suffix:
one_hour: 剛剛
hours: 小時前
day: 天前
donate: 打賞 donate: 打賞
share: 分享 share: 分享
@@ -89,8 +103,6 @@ rightside:
scroll_to_comment: 直達評論 scroll_to_comment: 直達評論
setting: 設定 setting: 設定
runtime_unit:
copy_copyright: copy_copyright:
author: 作者 author: 作者
link: 連結 link: 連結

View File

@@ -15,7 +15,7 @@ div
script(src=url_for(theme.CDN.instantpage) type="module" defer) script(src=url_for(theme.CDN.instantpage) type="module" defer)
if theme.lazyload.enable if theme.lazyload.enable
script(src=url_for(theme.CDN.lazyload) async) script(src=url_for(theme.CDN.lazyload))
if (theme.snackbar && theme.snackbar.enable) if (theme.snackbar && theme.snackbar.enable)
script(src=url_for(theme.CDN.snackbar)) script(src=url_for(theme.CDN.snackbar))
@@ -44,6 +44,14 @@ div
if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv
script(async src=url_for(theme.CDN.busuanzi)) script(async src=url_for(theme.CDN.busuanzi))
!=partial('includes/third-party/prismjs', {}, {cache:theme.fragment_cache})
if theme.aside.enable && theme.newest_comments.enable
if theme.pjax.enable
!=partial('includes/third-party/newest-comments/index', {}, {cache:theme.fragment_cache})
else if (!is_post() && page.aside !== false)
!=partial('includes/third-party/newest-comments/index', {}, {cache:theme.fragment_cache})
!=fragment_cache('injectBottom', function(){return injectHtml(theme.inject.bottom)}) !=fragment_cache('injectBottom', function(){return injectHtml(theme.inject.bottom)})
!=partial('includes/third-party/effect', {}, {cache:theme.fragment_cache}) !=partial('includes/third-party/effect', {}, {cache:theme.fragment_cache})
@@ -51,11 +59,10 @@ div
!=partial('includes/third-party/chat/index', {}, {cache:theme.fragment_cache}) !=partial('includes/third-party/chat/index', {}, {cache:theme.fragment_cache})
if theme.aplayerInject && theme.aplayerInject.enable if theme.aplayerInject && theme.aplayerInject.enable
if theme.pjax || theme.aplayerInject.per_page if theme.pjax.enable || theme.aplayerInject.per_page
include ./head/aplayer.pug include ./head/aplayer.pug
else if page.aplayer else if page.aplayer
include ./head/aplayer.pug include ./head/aplayer.pug
if theme.pjax if theme.pjax.enable
!=partial('includes/third-party/pjax', {}, {cache:theme.fragment_cache}) !=partial('includes/third-party/pjax', {}, {cache:theme.fragment_cache})

View File

@@ -17,6 +17,7 @@
- else pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords - else pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords
- var pageAuthor = config.email ? config.author + ',' + config.email : config.author - var pageAuthor = config.email ? config.author + ',' + config.email : config.author
- var pageCopyright = config.copyright || config.author - var pageCopyright = config.copyright || config.author
- var themeColor = theme.display_mode === 'dark' ? '#0d0d0d' : '#ffffff'
meta(charset='UTF-8') meta(charset='UTF-8')
meta(http-equiv="X-UA-Compatible" content="IE=edge") meta(http-equiv="X-UA-Compatible" content="IE=edge")
@@ -28,13 +29,15 @@ if pageKeywords
meta(name="author" content=pageAuthor) meta(name="author" content=pageAuthor)
meta(name="copyright" content=pageCopyright) meta(name="copyright" content=pageCopyright)
meta(name ="format-detection" content="telephone=no") meta(name ="format-detection" content="telephone=no")
!=favicon_tag(theme.favicon || config.favicon) meta(name="theme-color" content=themeColor)
link(rel="canonical" href=urlNoIndex())
if theme.disable_baidu_transformation 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")
!=favicon_tag(theme.favicon || config.favicon)
link(rel="canonical" href=urlNoIndex())
//- 預解析 //- 預解析
!=partial('includes/head/preconnect', {}, {cache:theme.fragment_cache}) !=partial('includes/head/preconnect', {}, {cache:theme.fragment_cache})
@@ -53,9 +56,6 @@ if theme.facebook_comments.user_id
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})
if theme.darkmode.enable
!=partial('includes/head/darkmode', {}, {cache:theme.fragment_cache})
//- main css //- main css
link(rel='stylesheet', href=url_for(theme.CDN.main_css)) link(rel='stylesheet', href=url_for(theme.CDN.main_css))
link(rel='stylesheet', href=url_for(theme.CDN.fontawesome)) link(rel='stylesheet', href=url_for(theme.CDN.fontawesome))
@@ -77,7 +77,7 @@ if theme.algolia_search.enable
!=partial('includes/head/analytics', {}, {cache:theme.fragment_cache}) !=partial('includes/head/analytics', {}, {cache:theme.fragment_cache})
//- font //- font
if theme.blog_title_font.font_link if theme.blog_title_font && theme.blog_title_font.font_link
link(rel='stylesheet' href=url_for(theme.blog_title_font.font_link)) link(rel='stylesheet' href=url_for(theme.blog_title_font.font_link))
//- global config //- global config
@@ -86,5 +86,7 @@ if 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})
!=fragment_cache('injectHead', function(){return injectHtml(theme.inject.head)}) !=fragment_cache('injectHead', function(){return injectHtml(theme.inject.head)})

View File

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

View File

@@ -1,6 +1,6 @@
- -
var algolia = 'undefined'; let algolia = 'undefined';
var env = process.env; let env = process.env;
if (theme.algolia_search.enable) { if (theme.algolia_search.enable) {
algolia = JSON.stringify({ algolia = JSON.stringify({
appId: env.ALGOLIA_APP_ID || config.algolia.appId || config.algolia.applicationID, appId: env.ALGOLIA_APP_ID || config.algolia.appId || config.algolia.applicationID,
@@ -16,7 +16,7 @@
}) })
} }
var localSearch = 'undefined'; let localSearch = 'undefined';
if (theme.local_search && theme.local_search.enable) { if (theme.local_search && theme.local_search.enable) {
localSearch = JSON.stringify({ localSearch = JSON.stringify({
path: config.search.path, path: config.search.path,
@@ -26,7 +26,8 @@
} }
}) })
} }
var translate = 'undefined';
let translate = 'undefined';
if (theme.translate && theme.translate.enable){ if (theme.translate && theme.translate.enable){
translate = JSON.stringify({ translate = JSON.stringify({
defaultEncoding: theme.translate.defaultEncoding, defaultEncoding: theme.translate.defaultEncoding,
@@ -36,7 +37,7 @@
}) })
} }
var copyright = 'undefined'; let copyright = 'undefined';
if (theme.copy.enable && theme.copy.copyright.enable){ if (theme.copy.enable && theme.copy.copyright.enable){
copyright = JSON.stringify({ copyright = JSON.stringify({
limitCount: theme.copy.copyright.limit_count, limitCount: theme.copy.copyright.limit_count,
@@ -49,7 +50,7 @@
}) })
} }
var ClickShowText = 'undefined'; let ClickShowText = 'undefined';
if (theme.ClickShowText && theme.ClickShowText.enable) { if (theme.ClickShowText && theme.ClickShowText.enable) {
ClickShowText = JSON.stringify({ ClickShowText = JSON.stringify({
text: theme.ClickShowText.text.join(","), text: theme.ClickShowText.text.join(","),
@@ -57,8 +58,7 @@
}) })
} }
let Snackbar = 'undefined';
var Snackbar = 'undefined';
if (theme.snackbar && theme.snackbar.enable) { if (theme.snackbar && theme.snackbar.enable) {
Snackbar = JSON.stringify({ Snackbar = JSON.stringify({
bookmark: { bookmark: {
@@ -75,7 +75,7 @@
}) })
} }
var noticeOutdate = 'undefined'; let noticeOutdate = 'undefined';
if (theme.noticeOutdate && theme.noticeOutdate.enable) { if (theme.noticeOutdate && theme.noticeOutdate.enable) {
noticeOutdate = JSON.stringify({ noticeOutdate = JSON.stringify({
limitDay: theme.noticeOutdate.limit_day, limitDay: theme.noticeOutdate.limit_day,
@@ -85,6 +85,21 @@
}) })
} }
let highlight = 'undefined';
if ((config.highlight && config.highlight.enable) || (config.prismjs && config.prismjs.enable)) {
highlight = JSON.stringify({
plugin: config.highlight.enable ? 'highlighjs' : 'prismjs',
highlightCopy: theme.highlight_copy,
highlightLang: theme.highlight_lang
})
}
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}',
@@ -93,6 +108,7 @@ script.
localSearch: !{localSearch}, localSearch: !{localSearch},
translate: !{translate}, translate: !{translate},
noticeOutdate: !{noticeOutdate}, noticeOutdate: !{noticeOutdate},
highlight: !{highlight},
copy: { copy: {
success: '!{_p("copy.success")}', success: '!{_p("copy.success")}',
error: '!{_p("copy.error")}', error: '!{_p("copy.error")}',
@@ -102,8 +118,8 @@ script.
message_prev: '!{_p("Snackbar.bookmark.message_prev")}', message_prev: '!{_p("Snackbar.bookmark.message_prev")}',
message_next: '!{_p("Snackbar.bookmark.message_next")}' message_next: '!{_p("Snackbar.bookmark.message_next")}'
}, },
runtime_unit: '!{_p("runtime_unit")}', runtime: '!{theme.runtimeshow.enable ? _p("aside.card_webinfo.runtime.unit") : ""}',
runtime: !{theme.runtimeshow.enable}, date_suffix: !{date_suffix},
copyright: !{copyright}, copyright: !{copyright},
ClickShowText: !{ClickShowText}, ClickShowText: !{ClickShowText},
medium_zoom: !{theme.medium_zoom}, medium_zoom: !{theme.medium_zoom},
@@ -114,10 +130,38 @@ script.
css: '!{theme.CDN.justifiedGallery_css}' css: '!{theme.CDN.justifiedGallery_css}'
}, },
baiduPush: !{theme.baidu_push}, baiduPush: !{theme.baidu_push},
highlightCopy: !{theme.highlight_copy},
highlightLang: !{theme.highlight_lang},
isPhotoFigcaption: !{theme.photofigcaption}, isPhotoFigcaption: !{theme.photofigcaption},
islazyload: !{theme.lazyload.enable}, islazyload: !{theme.lazyload.enable},
isanchor: !{theme.anchor} isanchor: !{theme.anchor}
};
var saveToLocal = {
set: function setWithExpiry(key, value, ttl) {
const now = new Date()
const expiryDay = ttl * 86400000
const item = {
value: value,
expiry: now.getTime() + expiryDay,
}
localStorage.setItem(key, JSON.stringify(item))
},
get: function getWithExpiry(key) {
const itemStr = localStorage.getItem(key)
if (!itemStr) {
return undefined
}
const item = JSON.parse(itemStr)
const now = new Date()
if (now.getTime() > item.expiry) {
localStorage.removeItem(key)
return undefined
}
return item.value
}
} }

View File

@@ -1,25 +1,20 @@
script. if theme.darkmode.enable
script.
var activateDarkMode = function () { var activateDarkMode = function () {
document.documentElement.setAttribute('data-theme', 'dark') document.documentElement.setAttribute('data-theme', 'dark')
if (document.querySelector('meta[name="theme-color"]') !== null) { if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#000') document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
} }
} }
var activateLightMode = function () { var activateLightMode = function () {
document.documentElement.setAttribute('data-theme', 'light') document.documentElement.setAttribute('data-theme', 'light')
if (document.querySelector('meta[name="theme-color"]') !== null) { if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#fff') document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
} }
} }
var getCookies = function (name) {
const value = `; ${document.cookie}`
const parts = value.split(`; ${name}=`)
if (parts.length === 2) return parts.pop().split(';').shift()
}
var autoChangeMode = '#{theme.darkmode.autoChangeMode}' var autoChangeMode = '#{theme.darkmode.autoChangeMode}'
var t = getCookies('theme') var t = saveToLocal.get('theme')
if (autoChangeMode === '1') { if (autoChangeMode === '1') {
var isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches var isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
var isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches var isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
@@ -30,14 +25,13 @@ script.
if (isLightMode) activateLightMode() if (isLightMode) activateLightMode()
else if (isDarkMode) activateDarkMode() else if (isDarkMode) activateDarkMode()
else if (isNotSpecified || hasNoSupport) { else if (isNotSpecified || hasNoSupport) {
console.log('You specified no preference for a color scheme or your browser does not support it. I Schedule dark mode during night time.')
var now = new Date() var now = new Date()
var hour = now.getHours() var hour = now.getHours()
var isNight = hour <= 6 || hour >= 18 var isNight = hour <= 6 || hour >= 18
isNight ? activateDarkMode() : activateLightMode() isNight ? activateDarkMode() : activateLightMode()
} }
window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) { window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
if (Cookies.get('theme') === undefined) { if (saveToLocal.get('theme') === undefined) {
e.matches ? activateDarkMode() : activateLightMode() e.matches ? activateDarkMode() : activateLightMode()
} }
}) })

View File

@@ -1,5 +1,5 @@
noscript. noscript.
<style> <style type="text/css">
#nav { #nav {
opacity: 1 opacity: 1
} }

View File

@@ -7,9 +7,12 @@ if theme.baidu_analytics
link(rel="preconnect" href="//hm.baidu.com") link(rel="preconnect" href="//hm.baidu.com")
if theme.tencent_analytics if theme.tencent_analytics
link(rel="preconnect" href="//ta.qq.com") link(rel="preconnect" href="//pingjs.qq.com")
if theme.blog_title_font.font_link && theme.blog_title_font.font_link.indexOf('//fonts.googleapis.com') != -1 if theme.cnzz_analytics
link(rel="preconnect" href="//s4.cnzz.com")
if theme.blog_title_font && theme.blog_title_font.font_link && theme.blog_title_font.font_link.indexOf('//fonts.googleapis.com') != -1
link(rel="preconnect" href="//fonts.googleapis.com" crossorigin) link(rel="preconnect" href="//fonts.googleapis.com" crossorigin)
if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv

View File

@@ -1,6 +1,4 @@
link(rel="manifest" href=url_for(theme.pwa.manifest)) link(rel="manifest" href=url_for(theme.pwa.manifest))
if(theme.pwa.theme_color)
meta(name="theme-color" content=theme.pwa.theme_color)
if(theme.pwa.theme_color) if(theme.pwa.theme_color)
meta(name="msapplication-TileColor" content=theme.pwa.theme_color) meta(name="msapplication-TileColor" content=theme.pwa.theme_color)
if(theme.pwa.apple_touch_icon) if(theme.pwa.apple_touch_icon)

View File

@@ -1,4 +1,7 @@
if theme.menu if theme.menu
//- for mobile sidebar
- let sidebarChildHide = theme.hide_sidebar_menu_child ? 'hide' : ''
.menus_items .menus_items
each value, label in theme.menu each value, label in theme.menu
if !Array.isArray(value) if !Array.isArray(value)
@@ -13,7 +16,7 @@ if theme.menu
if label.split('||')[1] if label.split('||')[1]
i.fa-fw(class=trim(label.split('||')[1])) i.fa-fw(class=trim(label.split('||')[1]))
span=' '+ trim(label.split('||')[0]) span=' '+ trim(label.split('||')[0])
i.fas.fa-chevron-down.expand i.fas.fa-chevron-down.expand(class=sidebarChildHide)
ul.menus_item_child ul.menus_item_child
each i in value each i in value
li li

View File

@@ -1,8 +1,8 @@
nav#nav nav#nav
span#blog_name.pull-left span#blog_name
a#site-name.blog_title(href=url_for('/')) #[=config.title] a#site-name(href=url_for('/')) #[=config.title]
span.pull-right.menus span#menus
if (theme.algolia_search.enable || theme.local_search.enable) if (theme.algolia_search.enable || theme.local_search.enable)
#search_button #search_button
a.site-page.social-icon.search a.site-page.social-icon.search
@@ -10,7 +10,7 @@ nav#nav
span=' '+_p('search') span=' '+_p('search')
!=fragment_cache('menus', function(){return partial('includes/header/menu_item')}) !=fragment_cache('menus', function(){return partial('includes/header/menu_item')})
span.toggle-menu.close span#toggle-menu.close
a.site-page a.site-page
i.fas.fa-bars.fa-fw i.fas.fa-bars.fa-fw

View File

@@ -24,7 +24,8 @@ html(lang=config.language data-theme=theme.display_mode)
div!= body div!= body
else else
block content block content
include widget/index.pug if theme.aside.enable && page.aside !== false
!=partial('includes/widget/index', {}, {cache:theme.fragment_cache})
else else
main#content-inner.layout_post main#content-inner.layout_post
if body if body

View File

@@ -4,10 +4,6 @@ section#rightside
if 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
button#font_plus(type="button" title=_p('rightside.font_plus_title'))
i.fas.fa-plus
button#font_minus(type="button" title=_p('rightside.font_minus_title'))
i.fas.fa-minus
if theme.translate && theme.translate.enable if theme.translate && 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

View File

@@ -16,7 +16,7 @@ if theme.chat_btn
initGitter() initGitter()
if (!{theme.pjax}) { if (!{theme.pjax.enable}) {
document.addEventListener('pjax:complete', () => { document.addEventListener('pjax:complete', () => {
chat.destroy() chat.destroy()
initGitter() initGitter()

View File

@@ -25,7 +25,7 @@ script.
} }
if ('!{theme.comments.use[0]}' === 'Disqus' || !!{theme.comments.lazyload}) { if ('!{theme.comments.use[0]}' === 'Disqus' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.getElementById('disqus_thread'), loadDisqus) if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('disqus_thread'), loadDisqus)
else loadDisqus() else loadDisqus()
} else { } else {
function loadOtherComment () { function loadOtherComment () {

View File

@@ -34,7 +34,7 @@ script.
} }
if ('!{theme.comments.use[0]}' === 'Disqusjs' || !!{theme.comments.lazyload}) { if ('!{theme.comments.use[0]}' === 'Disqusjs' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.getElementById('disqus_thread'), loadDisqusjs) if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('disqus_thread'), loadDisqusjs)
else loadDisqusjs() else loadDisqusjs()
} }
else { else {

View File

@@ -16,7 +16,7 @@ script.
} }
if ('!{theme.comments.use[0]}' === 'Facebook Comments' || !!{theme.comments.lazyload}) { if ('!{theme.comments.use[0]}' === 'Facebook Comments' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.querySelector('#post-comment .fb-comments'), loadFBComment) if (!{theme.comments.lazyload}) btf.loadComment(document.querySelector('#post-comment .fb-comments'), loadFBComment)
else loadFBComment() else loadFBComment()
} else { } else {
function loadOtherComment () { function loadOtherComment () {

View File

@@ -40,7 +40,7 @@ script.
} }
if ('!{theme.comments.use[0]}' === 'Gitalk' || !!{theme.comments.lazyload}) { if ('!{theme.comments.use[0]}' === 'Gitalk' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.getElementById('gitalk-container'), loadGitalk) if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('gitalk-container'), loadGitalk)
else loadGitalk() else loadGitalk()
} else { } else {
function loadOtherComment () { function loadOtherComment () {

View File

@@ -16,7 +16,7 @@ script.
} }
if ('!{theme.comments.use[0]}' === 'Livere' || !!{theme.comments.lazyload}) { if ('!{theme.comments.use[0]}' === 'Livere' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.getElementById('lv-container'), loadLivere) if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('lv-container'), loadLivere)
else loadLivere() else loadLivere()
} }
else { else {

View File

@@ -25,7 +25,7 @@ script.
} }
if ('!{theme.comments.use[0]}' === 'Utterances' || !!{theme.comments.lazyload}) { if ('!{theme.comments.use[0]}' === 'Utterances' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.getElementById('utterances-wrap'), loadUtterances) if (!{theme.comments.lazyload}) btf.loadComment(document.getElementById('utterances-wrap'), loadUtterances)
else loadUtterances() else loadUtterances()
} else { } else {
function loadOtherComment () { function loadOtherComment () {

View File

@@ -29,7 +29,7 @@ script.
} }
if ('!{theme.comments.use[0]}' === 'Valine' || !!{theme.comments.lazyload}) { if ('!{theme.comments.use[0]}' === 'Valine' || !!{theme.comments.lazyload}) {
if (!{theme.comments.lazyload}) loadComment(document.querySelector('#vcomment'),loadValine) if (!{theme.comments.lazyload}) btf.loadComment(document.querySelector('#vcomment'),loadValine)
else setTimeout(() => loadValine(), 0) else setTimeout(() => loadValine(), 0)
} else { } else {
function loadOtherComment () { function loadOtherComment () {

View File

@@ -16,8 +16,8 @@ if (theme.canvas_nest && theme.canvas_nest.enable)
if theme.activate_power_mode.enable if theme.activate_power_mode.enable
script(src=url_for(theme.CDN.activate_power_mode)) script(src=url_for(theme.CDN.activate_power_mode))
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};
document.body.addEventListener('input', POWERMODE); document.body.addEventListener('input', POWERMODE);
//- 鼠標特效 //- 鼠標特效

View File

@@ -28,7 +28,15 @@ script.
math.end = {node: text, delim: '', n: 0} math.end = {node: text, delim: '', n: 0}
doc.math.push(math) doc.math.push(math)
} }
}, ''] }, ''],
addClass: [200,() => {
document.querySelectorAll('mjx-container:not([display=\'true\']').forEach( node => {
const target = node.parentNode
if (!target.classList.contains('has-jax')) {
target.classList.add('mathjax-overflow')
}
})
}, '', false]
} }
} }
} }

View File

@@ -7,7 +7,7 @@ script.
mermaid.initialize({ mermaid.initialize({
theme: '!{theme.mermaid.theme}', theme: '!{theme.mermaid.theme}',
}) })
!{theme.pjax} && mermaid.init() !{theme.pjax.enable} && mermaid.init()
}) })
} }
} }

View File

@@ -0,0 +1,71 @@
script.
window.addEventListener('load', () => {
const changeContent = (content) => {
if (content === '') return content
content = content.replace(/<[^>]+>/g,"") // remove html tag
content = content.replace(/(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|jpeg|gif|png|webp)/g, '') // remove image link
content = content.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi, '') // remove url
if (content.length > 150) {
content = content.substring(0,150) + '...'
}
return content
}
const getDisqusComment = () => {
let disqusArray = []
$.getJSON('https://disqus.com/api/3.0/forums/listPosts.json?forum=!{theme.newest_comments.disqus.forum}&related=thread&limit=!{theme.newest_comments.limit}&api_key=!{theme.newest_comments.disqus.api_key}', function(data){
$.each(data.response, (i, item) => {
disqusArray.push({
'avatar': item.author.avatar.cache,
'content': changeContent(item.message),
'nick': item.author.name,
'url': item.url,
'date': item.createdAt
})
})
// set expiry to 10 min
saveToLocal.set('disqus-newest-comments', JSON.stringify(disqusArray), 10/(60*24))
generateHtml(disqusArray)
})
}
const generateHtml = array => {
let result = ''
for (let i = 0; i < array.length; i++) {
result += '<div class=\'aside-list-item\'>'
if (!{theme.newest_comments.avatar}) {
result += `<a href='${array[i].url}' class="thumbnail"><img src='${array[i].avatar}'></a>`
}
result += `<div class='content'>
<a class='comment' href='${array[i].url}'>${array[i].content}</a>
<div class='name'><span>${array[i].nick}</span><time> / ${btf.diffDate(array[i].date, true)}</time></div>
</div></div>`
}
let $dom = document.querySelector('.card-newest-comments .aside-list')
$dom.innerHTML= result
window.pjax && window.pjax.refresh($dom)
}
const newestCommentInit = () => {
if (document.querySelector('.card-newest-comments .aside-list')) {
const data = saveToLocal.get('disqus-newest-comments')
if (data) {
generateHtml(JSON.parse(data))
} else {
getDisqusComment()
}
}
}
newestCommentInit()
document.addEventListener('pjax:complete', newestCommentInit)
})

View File

@@ -0,0 +1,71 @@
script.
window.addEventListener('load', () => {
const changeContent = (content) => {
if (content === '') return content
content = content.replace(/<[^>]+>/g,"") // remove html tag
content = content.replace(/(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|jpeg|gif|png|webp)/g, '') // remove image link
content = content.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi, '') // remove url
if (content.length > 150) {
content = content.substring(0,150) + '...'
}
return content
}
const getGithubIssues = () => {
let githubArray = []
$.getJSON('https://api.github.com/repos/!{theme.newest_comments.github_issues.repo}/issues/comments?sort=updated&direction=desc&per_page=!{theme.newest_comments.limit}&page=1', (data) => {
$.each(data, (index, item) => {
githubArray.push({
'avatar': item.user.avatar_url,
'content': changeContent(item.body),
'nick': item.user.login,
'url': item.html_url,
'date': item.updated_at
})
})
saveToLocal.set('github-newest-comments', JSON.stringify(githubArray), 10/(60*24))
generateHtml(githubArray)
})
}
const generateHtml = array => {
let result = ''
for (let i = 0; i < array.length; i++) {
result += '<div class=\'aside-list-item\'>'
if (!{theme.newest_comments.avatar}) {
result += `<a href='${array[i].url}' class="thumbnail"><img src='${array[i].avatar}'></a>`
}
result += `<div class='content'>
<a class='comment' href='${array[i].url}'>${array[i].content}</a>
<div class='name'><span>${array[i].nick}</span><time> / ${btf.diffDate(array[i].date, true)}</time></div>
</div></div>`
}
let $dom = document.querySelector('.card-newest-comments .aside-list')
$dom.innerHTML= result
window.pjax && window.pjax.refresh($dom)
}
const newestCommentInit = () => {
if (document.querySelector('.card-newest-comments .aside-list')) {
const data = saveToLocal.get('github-newest-comments')
if (data) {
generateHtml(JSON.parse(data))
} else {
getGithubIssues()
}
}
}
newestCommentInit()
document.addEventListener('pjax:complete', newestCommentInit)
})

View File

@@ -0,0 +1,6 @@
if theme.newest_comments.leancloud.enable
include ./leancloud.pug
else if theme.newest_comments.github_issues.enable
include ./github-issues.pug
else if theme.newest_comments.disqus.enable
include ./disqus-comment.pug

View File

@@ -0,0 +1,98 @@
script(src="https://cdn.jsdelivr.net/npm/blueimp-md5@2.17.0/js/md5.min.js")
script.
window.addEventListener('load', () => {
const changeContent = (content) => {
if (content === '') return content
content = content.replace(/<[^>]+>/g,"") // remove html tag
content = content.replace(/(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|jpeg|gif|png|webp)/g, '') // remove image link
content = content.replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi, '') // remove url
if (content.length > 150) {
content = content.substring(0,150) + '...'
}
return content
}
const getIcon = (icon, mail) => {
if (icon) return icon
let defaultIcon = '!{ theme.newest_comments.leancloud.default_avatar ? `?d=${theme.newest_comments.leancloud.default_avatar}` : ''}'
let iconUrl = `https://gravatar.loli.net/avatar/${md5(mail.toLowerCase()) + defaultIcon}`
return iconUrl
}
const generateHtml = array => {
let result = ''
for (let i = 0; i < array.length; i++) {
result += '<div class=\'aside-list-item\'>'
if (!{theme.newest_comments.avatar}) {
result += `<a href='${array[i].url}' class="thumbnail"><img src='${getIcon(array[i].avatar, array[i].mail)}'></a>`
}
result += `<div class='content'>
<a class='comment' href='${array[i].url}'>${array[i].content}</a>
<div class='name'><span>${array[i].nick}</span><time> / ${btf.diffDate(array[i].date, true)}</time></div>
</div></div>`
}
let $dom = document.querySelector('.card-newest-comments .aside-list')
$dom.innerHTML= result
window.pjax && window.pjax.refresh($dom)
}
const getValineData = () => {
if (!(AV.applicationId && (AV.applicationKey || AV.masterKey))) {
const dataInit = {
appId: '!{theme.newest_comments.leancloud.appId}',
appKey: '!{theme.newest_comments.leancloud.appKey}'
}
if (!{theme.newest_comments.leancloud.serverURL ? true : false}) {
dataInit.serverURL= '!{theme.newest_comments.leancloud.serverURL}'
}
AV.init(dataInit)
}
const query = new AV.Query('Comment');
query.descending('createdAt').limit(!{theme.newest_comments.limit})
var valineArray = []
query.find().then(comments => {
comments.forEach(comment => {
valineArray.push({
'avatar': comment.get('QQAvatar'),
'content': changeContent(comment.get('comment')),
'mail': comment.get('mail'),
'nick': comment.get('nick'),
'url': comment.get('url'),
'date': comment.createdAt,
})
})
}).then(function() {
saveToLocal.set('leancloud-newest-comments', JSON.stringify(valineArray), 10/(60*24))
generateHtml(valineArray)
})
}
const newestCommentInit = () => {
if (document.querySelector('.card-newest-comments .aside-list')) {
const data = saveToLocal.get('leancloud-newest-comments')
if (data) {
generateHtml(JSON.parse(data))
} else {
if (typeof window.AV === 'object') {
getValineData()
} else {
$.getScript('https://cdn.jsdelivr.net/npm/leancloud-storage@4.6.1/dist/av-min.js', getValineData)
}
}
}
}
newestCommentInit()
document.addEventListener('pjax:complete', newestCommentInit)
})

View File

@@ -1,3 +1,8 @@
- var pjaxExclude = 'a:not([target="_blank"])'
if theme.pjax.exclude
each val in theme.pjax.exclude
- pjaxExclude = pjaxExclude + `:not([href="${val}"])`
script(src=url_for(theme.CDN.pjax)) script(src=url_for(theme.CDN.pjax))
script. script.
let pjaxSelectors = [ let pjaxSelectors = [
@@ -10,24 +15,26 @@ script.
'.js-pjax' '.js-pjax'
] ]
if (!{theme.Open_Graph_meta && theme.comments.use && theme.comments.use.includes('Livere')}) { if (!{Boolean(theme.Open_Graph_meta && theme.comments.use && theme.comments.use.includes('Livere'))}) {
pjaxSelectors.unshift('meta[property="og:image"]', 'meta[property="og:title"]', 'meta[property="og:url"]') pjaxSelectors.unshift('meta[property="og:image"]', 'meta[property="og:title"]', 'meta[property="og:url"]')
} }
const pjax = new Pjax({ var pjax = new Pjax({
elements: 'a:not([target="_blank"])', elements: '!{pjaxExclude}',
selectors: pjaxSelectors, selectors: pjaxSelectors,
cacheBust: false, cacheBust: false,
analytics: !{theme.google_analytics ? true : false},
scrollRestoration: false
}) })
document.addEventListener('pjax:complete', function () { document.addEventListener('pjax:complete', function () {
refreshFn() window.refreshFn()
$('script[data-pjax]').each(function () { $('script[data-pjax]').each(function () {
$(this).parent().append($(this).remove()) $(this).parent().append($(this).remove())
}) })
GLOBAL_CONFIG.islazyload && lazyLoadInstance.update() GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()
typeof chatBtnFn === 'function' && chatBtnFn() typeof chatBtnFn === 'function' && chatBtnFn()
typeof panguInit === 'function' && panguInit() typeof panguInit === 'function' && panguInit()
@@ -38,8 +45,16 @@ script.
typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting() typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()
// Analytics
if (!{theme.tencent_analytics ? true : false}) {
MtaH5.pgv()
}
// prismjs
typeof Prism === 'object' && Prism.highlightAll()
}) })
document.addEventListener('pjax:send', function () { document.addEventListener('pjax:send', function () {
if (window.aplayers) { if (window.aplayers) {
for (let i = 0; i < window.aplayers.length; i++) { for (let i = 0; i < window.aplayers.length; i++) {
@@ -56,7 +71,5 @@ script.
//reset readmode //reset readmode
$('body').hasClass('read-mode') && $('body').removeClass('read-mode') $('body').hasClass('read-mode') && $('body').removeClass('read-mode')
//reset font-size
$('body').css('font-size') !== originFontSize && $('body').css('font-size', parseFloat(originFontSize))
}) })

View File

@@ -0,0 +1,5 @@
if config.prismjs && config.prismjs.enable && !config.prismjs.preprocess
script(src=url_for(theme.CDN.prismjs_js))
script(src=url_for(theme.CDN.prismjs_autoloader))
if config.prismjs.line_number
script(src=url_for(theme.CDN.prismjs_lineNumber_js))

View File

@@ -1,6 +1,7 @@
.addtoany .addtoany
.a2a_kit.a2a_kit_size_32.a2a_default_style .a2a_kit.a2a_kit_size_32.a2a_default_style
each name in theme.addtoany.item - let addtoanyItem = theme.addtoany.item.split(',')
each name in addtoanyItem
a(class="a2a_button_" + name) a(class="a2a_button_" + name)
a.a2a_dd(href="https://www.addtoany.com/share") a.a2a_dd(href="https://www.addtoany.com/share")

View File

@@ -11,19 +11,19 @@
.card-info-data .card-info-data
if site.posts.length if site.posts.length
.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

View File

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

View File

@@ -3,25 +3,25 @@
.item-headline .item-headline
i.fas.fa-history i.fas.fa-history
span= _p('aside.card_recent_post') span= _p('aside.card_recent_post')
.aside-recent-item .aside-list
- 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-recent-post .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-aside-cover' : ''
- let post_cover = article.cover - let post_cover = article.cover
if post_cover && theme.cover.aside_enable if post_cover && theme.cover.aside_enable
a.aside-post-cover(href=url_for(link) title=title) a.thumbnail(href=url_for(link) title=title)
if theme.lazyload.enable if theme.lazyload.enable
img.aside-post-bg(data-lazy-src=url_for(post_cover) onerror=`this.onerror=null;this.src='${url_for(theme.error_img.post_page)}'` alt=title) 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.aside-post-bg(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)
.aside-post-info(class=no_cover) .content(class=no_cover)
a.aside-post-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.aside-post_meta.post-meta-updated(datetime=date_xml(article.updated) title=_p('post.updated') + ' ' + full_date(article.updated)) #[=date(article.updated, config.date_format)] time(datetime=date_xml(article.updated) title=_p('post.updated') + ' ' + full_date(article.updated)) #[=date(article.updated, config.date_format)]
else else
time.aside-post_meta.post-meta-date(datetime=date_xml(article.date) title=_p('post.created') + ' ' + full_date(article.date)) #[=date(article.date, config.date_format)] time(datetime=date_xml(article.date) title=_p('post.created') + ' ' + full_date(article.date)) #[=date(article.date, config.date_format)]
- }) - })

View File

@@ -7,6 +7,6 @@ if site.tags.length
- let tagLimit = theme.aside.card_tags.limit === 0 ? 0 : theme.aside.card_tags.limit || 40 - let tagLimit = theme.aside.card_tags.limit === 0 ? 0 : theme.aside.card_tags.limit || 40
if theme.aside.card_tags.color if theme.aside.card_tags.color
.card-tag-cloud!=cloudTags({source: site.tags, minfontsize: 16, maxfontsize: 22, limit: tagLimit}) .card-tag-cloud!= cloudTags({source: site.tags, minfontsize: 1.1, maxfontsize: 1.5, limit: tagLimit, unit: 'em'})
else else
.card-tag-cloud!= tagcloud({min_font: 16, max_font: 22, amount: tagLimit , color: true, start_color: '#999', end_color: '#99a9bf'}) .card-tag-cloud!= tagcloud({min_font: 1.1, max_font: 1.5, amount: tagLimit , color: true, start_color: '#999', end_color: '#99a9bf', unit: 'em'})

View File

@@ -4,23 +4,28 @@
i.fas.fa-chart-line i.fas.fa-chart-line
span= _p('aside.card_webinfo.headline') span= _p('aside.card_webinfo.headline')
.webinfo .webinfo
if theme.aside.card_webinfo.post_count
.webinfo-item .webinfo-item
.webinfo-article-name= _p('aside.card_webinfo.article_name') + " :" .item-name= _p('aside.card_webinfo.article_name') + " :"
.webinfo-article-count= site.posts.length .item-count= site.posts.length
if theme.runtimeshow.enable if theme.runtimeshow.enable
.webinfo-item .webinfo-item
.webinfo-runtime-name= _p('aside.card_webinfo.runtime_name') + " :" .item-name= _p('aside.card_webinfo.runtime.name') + " :"
#webinfo-runtime-count.webinfo-runtime-count(publish_date=theme.runtimeshow.publish_date) .item-count#runtimeshow(data-publishDate=date_xml(theme.runtimeshow.publish_date))
if theme.wordcount.enable && theme.wordcount.total_wordcount if theme.wordcount.enable && theme.wordcount.total_wordcount
.webinfo-item .webinfo-item
.webinfo-site-wordcount-name=_p('aside.card_webinfo.site_wordcount') + " :" .item-name=_p('aside.card_webinfo.site_wordcount') + " :"
.webinfo-site-wordcount=totalcount(site) .item-count=totalcount(site)
if theme.busuanzi.site_uv if theme.busuanzi.site_uv
.webinfo-item .webinfo-item
.webinfo-site-uv-name= _p('aside.card_webinfo.site_uv_name') + " :" .item-name= _p('aside.card_webinfo.site_uv_name') + " :"
.webinfo-site-uv-count#busuanzi_value_site_uv .item-count#busuanzi_value_site_uv
if theme.busuanzi.site_pv if theme.busuanzi.site_pv
.webinfo-item .webinfo-item
.webinfo-site-name= _p('aside.card_webinfo.site_pv_name') + " :" .item-name= _p('aside.card_webinfo.site_pv_name') + " :"
.webinfo-site-pv-count#busuanzi_value_site_pv .item-count#busuanzi_value_site_pv
if theme.aside.card_webinfo.last_push_date
.webinfo-item
.item-name= _p('aside.card_webinfo.last_push_date.name') + " :"
.item-count#last-push-date(data-lastPushDate=date_xml(Date.now()))

View File

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

View File

@@ -7,7 +7,7 @@ block content
| - | -
span.tag-cloud__amount= site.tags.length span.tag-cloud__amount= site.tags.length
.tag-cloud-tags .tag-cloud-tags
!=cloudTags({source: site.tags, minfontsize: 15, maxfontsize: 30, limit: 0}) !=cloudTags({source: site.tags, minfontsize: 1, maxfontsize: 2.1, limit: 0, unit: 'em'})
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,6 +1,6 @@
{ {
"name": "hexo-theme-butterfly", "name": "hexo-theme-butterfly",
"version": "3.0.1", "version": "3.1.1",
"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": {
@@ -23,7 +23,7 @@
"email": "wong@jerryc.me" "email": "wong@jerryc.me"
}, },
"dependencies": { "dependencies": {
"hexo-renderer-stylus": "^1.1.0", "hexo-renderer-stylus": "^2.0.1",
"hexo-renderer-pug": "^1.0.0" "hexo-renderer-pug": "^1.0.0"
}, },
"homepage": "https://demo.jerryc.me/", "homepage": "https://demo.jerryc.me/",

View File

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

View File

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

View File

@@ -1,6 +1,8 @@
const logger = require('hexo-log')()
hexo.on('ready', () => { hexo.on('ready', () => {
const { version } = require('../../package.json') const { version } = require('../../package.json')
hexo.log.info(` logger.info(`
=================================================================== ===================================================================
##### # # ##### ##### ###### ##### ###### # # # ##### # # ##### ##### ###### ##### ###### # # #

View File

@@ -91,7 +91,7 @@ hexo.extend.helper.register('aside_archives', function (options = {}) {
if (len > Judge) { if (len > Judge) {
result += '<li class="card-archive-list-item more is-center">' result += '<li class="card-archive-list-item more is-center">'
result += `<a class="card-archive-list-link-more" href="${this.url_for(archiveDir)}"> result += `<a class="card-archive-list-link-more" href="${this.url_for(archiveDir)}/">
<span>${moreButton}</span><i class="fas fa-angle-right" ></i></a></li>` <span>${moreButton}</span><i class="fas fa-angle-right" ></i></a></li>`
} }
result += '</ul>' result += '</ul>'

View File

@@ -83,13 +83,13 @@ hexo.extend.helper.register('aside_categories', function (categories, options) {
let moreHtml = '' let moreHtml = ''
if (categories.length <= limit) return '' if (categories.length <= limit) return ''
moreHtml += '<li class="card-category-list-item more is-center">' moreHtml += '<li class="card-category-list-item more is-center">'
moreHtml += `<a class="card-category-list-link-more" href="${categoryDir}"> moreHtml += `<a class="card-category-list-link-more" href="${categoryDir}/">
<span>${buttonLabel}</span><i class="fas fa-angle-right"></i></a></li>` <span>${buttonLabel}</span><i class="fas fa-angle-right"></i></a></li>`
return moreHtml return moreHtml
} }
return `<ul class="card-category-list"> return `<ul class="card-category-list" id="aside-cat-list">
${list[0]} ${list[0]}
${moreButton()} ${moreButton()}
</ul>` </ul>`

View File

@@ -38,11 +38,13 @@ hexo.extend.helper.register('cloudTags', function (options = {}) {
const minfontsize = options.minfontsize const minfontsize = options.minfontsize
const maxfontsize = options.maxfontsize const maxfontsize = options.maxfontsize
const limit = options.limit const limit = options.limit
const unit = options.unit || 'px'
let result = '' let result = ''
const tagLimit = limit === 0 ? source.length : limit const tagLimit = limit === 0 ? source.length : limit
source.sort('name').limit(tagLimit).forEach(function (tags) { source.sort('name').limit(tagLimit).forEach(function (tags) {
const fontSize = Math.floor(Math.random() * (maxfontsize - minfontsize) + minfontsize) + 'px' 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 const color = 'rgb(' + Math.floor(Math.random() * 201) + ', ' + Math.floor(Math.random() * 201) + ', ' + Math.floor(Math.random() * 201) + ')' // 0,0,0 -> 200,200,200
result += `<a href='${env.url_for(tags.path)}' style='font-size:${fontSize}; color:${color}'>${tags.name}</a>` result += `<a href='${env.url_for(tags.path)}' style='font-size:${fontSize}; color:${color}'>${tags.name}</a>`
}) })

View File

@@ -48,11 +48,11 @@ hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
if (relatedPosts.length > 0) { if (relatedPosts.length > 0) {
result += '<div class="relatedPosts">' result += '<div class="relatedPosts">'
result += result +=
'<div class="relatedPosts_headline"><i class="fas fa-thumbs-up fa-fw"></i><span>' + '<div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>' +
' ' + ' ' +
headlineLang + headlineLang +
'</span></div>' '</span></div>'
result += '<div class="relatedPosts_list">' result += '<div class="relatedPosts-list">'
for (let i = 0; i < Math.min(relatedPosts.length, limitNum); i++) { for (let i = 0; i < Math.min(relatedPosts.length, limitNum); i++) {
const cover = const cover =
@@ -60,33 +60,33 @@ hexo.extend.helper.register('related_posts', function (currentPost, allPosts) {
? relatedPosts[i].randomcover ? relatedPosts[i].randomcover
: relatedPosts[i].cover : relatedPosts[i].cover
result += result +=
'<div class="relatedPosts_item"><a href="' + '<div><a href="' +
hexoConfig.root + hexoConfig.root +
relatedPosts[i].path + relatedPosts[i].path +
'" title="' + '" title="' +
relatedPosts[i].title + relatedPosts[i].title +
'">' '">'
result += result +=
'<img class="relatedPosts_cover" ' + '<img class="cover" ' +
lazySrc + lazySrc +
'="' + '="' +
cover + this.url_for(cover) +
'">' '">'
if (dateType === 'created') { if (dateType === 'created') {
result += result +=
'<div class="relatedPosts_main is-center"><div class="relatedPosts_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>' +
' ' + ' ' +
this.date(relatedPosts[i].created, hexoConfig.date_format) + this.date(relatedPosts[i].created, hexoConfig.date_format) +
'</div>' '</div>'
} else { } else {
result += result +=
'<div class="relatedPosts_main is-center"><div class="relatedPosts_date"><i class="fas fa-history fa-fw"></i>' + '<div class="content is-center"><div class="date"><i class="fas fa-history fa-fw"></i>' +
' ' + ' ' +
this.date(relatedPosts[i].updated, hexoConfig.date_format) + this.date(relatedPosts[i].updated, hexoConfig.date_format) +
'</div>' '</div>'
} }
result += result +=
'<div class="relatedPosts_title">' + relatedPosts[i].title + '</div>' '<div class="title">' + relatedPosts[i].title + '</div>'
result += '</div></a></div>' result += '</div></a></div>'
} }

View File

@@ -44,7 +44,7 @@ function hideBlock (args, content) {
group += '"' group += '"'
return `<div class="hide-block"><button type="button" class="hide-button button--animated" ${group}>${display} return `<div class="hide-block"><button type="button" class="hide-button button--animated" ${group}>${display}
</button><span class="hide-content">${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}</span></div>` </button><span class="hide-content">${hexo.render.renderSync({ text: content, engine: 'markdown' })}</span></div>`
} }
function hideToggle (args, content) { function hideToggle (args, content) {
@@ -63,7 +63,7 @@ function hideToggle (args, content) {
group += '"' group += '"'
return `<div class="hide-toggle" ${border}><div class="hide-button toggle-title" ${group}><i class="fas fa-caret-right fa-fw"></i><span>${display}</span></div> return `<div class="hide-toggle" ${border}><div class="hide-button toggle-title" ${group}><i class="fas fa-caret-right fa-fw"></i><span>${display}</span></div>
<div class="hide-content">${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}</div></div>` <div class="hide-content">${hexo.render.renderSync({ text: content, engine: 'markdown' })}</div></div>`
} }
hexo.extend.tag.register('hideInline', hideInline) hexo.extend.tag.register('hideInline', hideInline)

View File

@@ -7,9 +7,7 @@
'use strict' 'use strict'
function mermaid (args, content) { function mermaid (args, content) {
return `<div class="mermaid"> return `<div class="mermaid">${content}</div>`
${content}
</div>`
} }
hexo.extend.tag.register('mermaid', mermaid, { ends: true }) hexo.extend.tag.register('mermaid', mermaid, { ends: true })

View File

@@ -6,9 +6,7 @@
'use strict' 'use strict'
function postNote (args, content) { function postNote (args, content) {
return `<div class="note ${args.join(' ')}"> return `<div class="note ${args.join(' ')}">${hexo.render.renderSync({ text: content, engine: 'markdown' })}</div>`
${hexo.render.renderSync({ text: content, engine: 'markdown' }).split('\n').join('')}
</div>`
} }
hexo.extend.tag.register('note', postNote, { ends: true }) hexo.extend.tag.register('note', postNote, { ends: true })

View File

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

View File

@@ -17,6 +17,34 @@
text-rendering: auto text-rendering: auto
-webkit-font-smoothing: antialiased -webkit-font-smoothing: antialiased
maxWidth600()
@media screen and (max-width: 600px)
{block}
maxWidth768()
@media screen and (max-width: 768px)
{block}
minWidth768()
@media screen and (min-width: 768px)
{block}
maxWidth1024()
@media screen and (max-width: 1024px)
{block}
maxWidth900()
@media screen and (max-width: 900px)
{block}
minWidth900()
@media screen and (min-width: 900px)
{block}
minWidth2000()
@media screen and (min-width: 2000px)
{block}
[data-theme='light'] [data-theme='light']
--global-bg: $body-bg --global-bg: $body-bg
--font-color: $font-black --font-color: $font-black
@@ -44,3 +72,4 @@
--blockquote-color: $blockquote-color --blockquote-color: $blockquote-color
--blockquote-bg: $blockquote-background-color --blockquote-bg: $blockquote-background-color
--reward-pop: $reward-pop-up-bg --reward-pop: $reward-pop-up-bg
--sidebar-icon-color: $sidebar-icon-color

View File

@@ -1,6 +1,6 @@
html html
height: 100% height: 100%
font-size: $rem font-size: 20px
body body
position: relative position: relative
@@ -119,27 +119,9 @@ button
#aside_content .author-info__description #aside_content .author-info__description
font-family: $site-name-font font-family: $site-name-font
.is-right
text-align: right
.is-left
text-align: left
.is-center .is-center
text-align: center text-align: center
.is_visible
display: block !important
.is-visible-inline
display: inline-block !important
.is-invisible
display: none !important
.is-hidden
overflow: hidden
.copy-true .copy-true
user-select: all user-select: all

View File

@@ -1,12 +1,16 @@
// 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')
$prismjsEnable = hexo-config('rootConfig.prismjs') && hexo-config('rootConfig.prismjs.enable')
wordWrap = !hexo-config('rootConfig.highlight.line_number') && hexo-config('code_word_wrap')
@require 'theme' @require 'theme'
if $highlight_theme != false if $highlighEnable
@require 'diff' @require 'highlight/index'
wordWrap = !hexo-config('rootConfig.highlight.line_number') && hexo-config('code_word_wrap') if $prismjsEnable
@require 'prismjs/index'
$code-block $code-block
overflow: auto overflow: auto
@@ -45,7 +49,8 @@ blockquote
#article-container #article-container
pre, pre,
code code
font-family: $code-font !important font-size: $code-font-size
font-family: $code-font-family !important
code code
padding: .1rem .2rem padding: .1rem .2rem
@@ -74,33 +79,10 @@ blockquote
padding: 8px 0 padding: 8px 0
border: none border: none
.line figcaption,
if wordWrap .caption
&:before
display: inline-block
padding: 0 .3rem 0 0
min-width: 1.6rem
color: $highlight-gutter.color
content: counter(line)
counter-increment: line
text-align: left
&.marked
background-color: $highlight-selection
table
display: block
overflow: auto
border: none
td
padding: 0
border: none
figcaption
clearfix()
padding: .3rem 0 .1rem .7rem padding: .3rem 0 .1rem .7rem
font-size: 1em font-size: $code-font-size
line-height: 1em line-height: 1em
a a
@@ -111,26 +93,16 @@ blockquote
&:hover &:hover
border-bottom-color: $highlight-foreground border-bottom-color: $highlight-foreground
.gutter pre
padding-right: .5rem
padding-left: .5rem
background-color: $highlight-gutter.bg-color
color: $highlight-gutter.color
text-align: right
.code pre
padding-right: .5rem
padding-left: .5rem
width: 100%
.highlight-tools .highlight-tools
position: relative position: relative
display: flex
align-items: center
overflow: hidden overflow: hidden
width: 100% min-height: 1.2rem
height: 1.5rem height: 2.15em
background: $highlight-tools.bg-color background: $highlight-tools.bg-color
color: $highlight-tools.color color: $highlight-tools.color
font-size: 14px font-size: $code-font-size
&.closed + table &.closed + table
display: none display: none
@@ -151,20 +123,17 @@ blockquote
.code-lang .code-lang
position: absolute position: absolute
left: .7rem left: .7rem
text-transform: capitalize text-transform: uppercase
font-weight: bold font-weight: bold
font-size: .8rem font-size: 1.15em
line-height: 1.5rem
.copy-notice .copy-notice
position: absolute position: absolute
top: .25rem
right: 1.7rem right: 1.7rem
opacity: 0 opacity: 0
.copy-button .copy-button
position: absolute position: absolute
top: .4rem
right: .7rem right: .7rem
cursor: pointer cursor: pointer
transition: color .2s transition: color .2s
@@ -191,7 +160,6 @@ blockquote
.highlight-tools .highlight-tools
&:after &:after
position: absolute position: absolute
top: .45rem
left: .7rem left: .7rem
width: 12px width: 12px
height: 12px height: 12px

View File

@@ -1,4 +1,3 @@
// For diff highlight
figure.highlight figure.highlight
table table
&::-webkit-scrollbar-thumb &::-webkit-scrollbar-thumb

View File

@@ -0,0 +1,39 @@
if $highlight_theme != false
@require 'diff'
#article-container
figure.highlight
.line
if wordWrap
&:before
display: inline-block
padding: 0 .3rem 0 0
min-width: 1.6rem
color: $highlight-gutter.color
content: counter(line)
counter-increment: line
text-align: left
&.marked
background-color: $highlight-selection
table
display: block
overflow: auto
border: none
td
padding: 0
border: none
.gutter pre
padding-right: .5rem
padding-left: .5rem
background-color: $highlight-gutter.bg-color
color: $highlight-gutter.color
text-align: right
.code pre
padding-right: .5rem
padding-left: .5rem
width: 100%

View File

@@ -0,0 +1,302 @@
if $highlight_theme == 'light' || ($highlight_theme == 'mac light')
// prism-base16-ateliersulphurpool.light
pre[class*='language-']
.token.function
color: #ffb62c
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata
color: rgba(149, 165, 166, .8)
.token.punctuation
color: #5e6687
.token.namespace
opacity: .7
.token.operator,
.token.boolean,
.token.number
color: #c76b29
.token.property
color: #c08b30
.token.tag
color: #3d8fd1
.token.string
color: #22a2c9
.token.selector
color: #6679cc
.token.attr-name
color: #c76b29
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string
color: #22a2c9
.token.attr-value,
.token.keyword,
.token.control,
.token.directive,
.token.unit
color: #ac9739
.token.statement,
.token.regex,
.token.atrule
color: #22a2c9
.token.placeholder,
.token.variable
color: #3d8fd1
.token.deleted
text-decoration: line-through
.token.inserted
border-bottom: 1px dotted #202746
text-decoration: none
.token.italic
font-style: italic
.token.important,
.token.bold
font-weight: bold
.token.important
color: #c94922
.token.entity
cursor: help
pre > code.highlight
outline: .4em solid #c94922
outline-offset: .4em
if $highlight_theme == 'darker' || ($highlight_theme == 'mac')
// prism-atom-dark
pre[class*='language-']
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata
color: #7C7C7C
.token.punctuation
color: #c5c8c6
.namespace
opacity: .7
.token.property,
.token.keyword,
.token.tag
color: #96CBFE
.token.class-name
color: #FFFFB6
.token.boolean,
.token.constant
color: #99CC99
.token.symbol,
.token.deleted
color: #f92672
.token.number
color: #FF73FD
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted
color: #A8FF60
.token.variable
color: #C6C5FE
.token.operator
color: #EDEDED
.token.entity
color: #FFFFB6
cursor: help
.token.url
color: #96CBFE
.language-css .token.string,
.style .token.string
color: #87C38A
.token.atrule,
.token.attr-value
color: #F9EE98
.token.function
color: #DAD085
.token.regex
color: #E9C062
.token.important
color: #fd971f
.token.important,
.token.bold
font-weight: bold
.token.italic
font-style: italic
if $highlight_theme == 'pale night'
// prism-dracula
pre[class*='language-']
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata
color: #6272a4
.token.punctuation
color: #f8f8f2
.namespace
opacity: .7
.token.property,
.token.tag,
.token.constant,
.token.symbol,
.token.deleted
color: #ff79c6
.token.boolean,
.token.number
color: #bd93f9
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted
color: #50fa7b
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string,
.token.variable
color: #f8f8f2
.token.atrule,
.token.attr-value,
.token.function,
.token.class-name
color: #f1fa8c
.token.keyword
color: #8be9fd
.token.regex,
.token.important
color: #ffb86c
.token.important,
.token.bold
font-weight: bold
.token.italic
font-style: italic
.token.entity
cursor: help
if $highlight_theme == 'ocean'
// prism-material-oceanic
pre[class*='language-']
&.language-css > code,
&.language-sass > code,
&.language-scss > code
color: #fd9170 !important
.namespace
opacity: .7
.token.atrule,
.token.symbol,
.token.constant,
.token.boolean,
.token.function
color: #c792ea
.token.attr-name,
.token.builtin,
.token.class
color: #ffcb6b
.token.attr-value,
.token.attribute,
.token.pseudo-class,
.token.pseudo-element,
.token.string
color: #c3e88d
.token.cdata,
.token.property,
.token.char,
.token.inserted
color: #80cbc4
.token.class-name,
.token.color,
.token.hexcode,
.token.regex
color: #f2ff00
.token.comment,
.token.prolog,
.token.doctype
color: #546e7a
.token.deleted,
.token.variable,
.token.entity,
.token.selector,
.token.tag,
.token.unit
color: #f07178
.token.id
color: #c792ea
font-weight: bold
.token.important
color: #c792ea
font-weight: bold
.token.keyword
color: #c792ea
font-style: italic
.token.number,
.token.url
color: #fd9170
.token.operator,
.token.punctuation
color: #89ddff

View File

@@ -0,0 +1,20 @@
if hexo-fonfig('rootConfig.prismjs.line_number')
@require 'line-number'
if $highlight_theme != false
@require 'diff'
#article-container
pre[class*='language-']
&::-webkit-scrollbar-thumb
background: $highlight-scrollbar
&:not(.line-numbers)
padding: 10px 20px
.caption
margin-left: -3.8em
padding: .2rem .8rem !important
a
padding: 0 !important

View File

@@ -0,0 +1,34 @@
#article-container
pre[class*='language-']
&.line-numbers
position: relative
padding-left: 3.8em
counter-reset: linenumber
line-height: $line-height-code-block
> code
position: relative
white-space: inherit
line-height: $line-height-code-block
.line-numbers-rows
position: absolute
top: 0
left: -3.8em
width: 3em
letter-spacing: -1px
font-size: 100%
pointer-events: none
user-select: none
& > span
display: block
counter-increment: linenumber
pointer-events: none
&:before
display: block
padding-right: .8em
color: $highlight-gutter.color
content: counter(linenumber)
text-align: right

View File

@@ -1,45 +1,7 @@
$highlight_theme = hexo-config('highlight_theme')
if $highlight_theme == 'default'
$highlight-background = #263238
$highlight-current-line = #efefef
$highlight-selection = #80CBC420
$highlight-foreground = #EEFFFF
$highlight-comment = #546E7A
$highlight-red = #FF5370
$highlight-orange = #F78C6C
$highlight-yellow = #FFCB6B
$highlight-green = #C3E88D
$highlight-aqua = #89DDFF
$highlight-blue = #82AAFF
$highlight-purple = #C792EA
$highlight-deletion = #BF42BF
$highlight-addition = #105EDE
$highlight-gutter = {
color: alpha($highlight-foreground, .5),
bg-color: $highlight-background
}
$highlight-tools = {
color: alpha($highlight-foreground, .8),
bg-color: darken($highlight-background, 2)
}
$highlight-scrollbar = darken($highlight-background, 6)
if $highlight_theme == 'darker' || ($highlight_theme == 'mac') if $highlight_theme == 'darker' || ($highlight_theme == 'mac')
$highlight-background = #212121 $highlight-background = #212121
$highlight-current-line = #282a2e
$highlight-selection = #61616150 $highlight-selection = #61616150
$highlight-foreground = #EEFFFF $highlight-foreground = #EEFFFF
$highlight-comment = #969896
$highlight-red = #FF5370
$highlight-orange = #F78C6C
$highlight-yellow = #FFCB6B
$highlight-green = #C3E88D
$highlight-aqua = #89DDFF
$highlight-blue = #82AAFF
$highlight-purple = #C792EA
$highlight-deletion = #BF42BF
$highlight-addition = #105EDE
$highlight-mac-border = rgba(0, 0, 0, .4) $highlight-mac-border = rgba(0, 0, 0, .4)
$highlight-gutter = { $highlight-gutter = {
color: alpha($highlight-foreground, .5), color: alpha($highlight-foreground, .5),
@@ -51,12 +13,8 @@ if $highlight_theme == 'darker' || ($highlight_theme == 'mac')
} }
$highlight-scrollbar = darken($highlight-background, 6) $highlight-scrollbar = darken($highlight-background, 6)
if $highlight_theme == 'pale night' if $highlighEnable
$highlight-background = #292D3E $highlight-comment = #969896
$highlight-current-line = #393939
$highlight-selection = #717CB450
$highlight-foreground = #A6ACCD
$highlight-comment = #676E95
$highlight-red = #FF5370 $highlight-red = #FF5370
$highlight-orange = #F78C6C $highlight-orange = #F78C6C
$highlight-yellow = #FFCB6B $highlight-yellow = #FFCB6B
@@ -66,6 +24,11 @@ if $highlight_theme == 'pale night'
$highlight-purple = #C792EA $highlight-purple = #C792EA
$highlight-deletion = #BF42BF $highlight-deletion = #BF42BF
$highlight-addition = #105EDE $highlight-addition = #105EDE
if $highlight_theme == 'pale night'
$highlight-background = #292D3E
$highlight-selection = #717CB450
$highlight-foreground = #A6ACCD
$highlight-gutter = { $highlight-gutter = {
color: alpha($highlight-foreground, .5), color: alpha($highlight-foreground, .5),
bg-color: $highlight-background bg-color: $highlight-background
@@ -76,12 +39,8 @@ if $highlight_theme == 'pale night'
} }
$highlight-scrollbar = darken($highlight-background, 6) $highlight-scrollbar = darken($highlight-background, 6)
if $highlight_theme == 'ocean' if $highlighEnable
$highlight-background = #0F111A $highlight-comment = #676E95
$highlight-current-line = #000000
$highlight-selection = #717CB450
$highlight-foreground = #8F93A2
$highlight-comment = rgba(101, 115, 126, .8)
$highlight-red = #FF5370 $highlight-red = #FF5370
$highlight-orange = #F78C6C $highlight-orange = #F78C6C
$highlight-yellow = #FFCB6B $highlight-yellow = #FFCB6B
@@ -91,6 +50,11 @@ if $highlight_theme == 'ocean'
$highlight-purple = #C792EA $highlight-purple = #C792EA
$highlight-deletion = #BF42BF $highlight-deletion = #BF42BF
$highlight-addition = #105EDE $highlight-addition = #105EDE
if $highlight_theme == 'ocean'
$highlight-background = #0F111A
$highlight-selection = #717CB450
$highlight-foreground = #8F93A2
$highlight-gutter = { $highlight-gutter = {
color: alpha($highlight-foreground, .5), color: alpha($highlight-foreground, .5),
bg-color: $highlight-background bg-color: $highlight-background
@@ -101,11 +65,34 @@ if $highlight_theme == 'ocean'
} }
$highlight-scrollbar = darken($highlight-background, 5) $highlight-scrollbar = darken($highlight-background, 5)
if $highlighEnable
$highlight-comment = rgba(101, 115, 126, .8)
$highlight-red = #FF5370
$highlight-orange = #F78C6C
$highlight-yellow = #FFCB6B
$highlight-green = #C3E88D
$highlight-aqua = #89DDFF
$highlight-blue = #82AAFF
$highlight-purple = #C792EA
$highlight-deletion = #BF42BF
$highlight-addition = #105EDE
if $highlight_theme == 'light' || ($highlight_theme == 'mac light') if $highlight_theme == 'light' || ($highlight_theme == 'mac light')
$highlight-background = #F6F8FA $highlight-background = #F6F8FA
$highlight-current-line = #00346e
$highlight-selection = #80CBC440 $highlight-selection = #80CBC440
$highlight-foreground = #90A4AE $highlight-foreground = #90A4AE
$highlight-mac-border = rgba(144, 164, 174, .4)
$highlight-tools = {
color: $highlight-foreground,
bg-color: darken($highlight-background, 5)
}
$highlight-gutter = {
color: alpha($highlight-foreground, .5),
bg-color: $highlight-background
}
$highlight-scrollbar = darken($highlight-background, 8)
if $highlighEnable
$highlight-comment = rgba(149, 165, 166, .8) $highlight-comment = rgba(149, 165, 166, .8)
$highlight-red = #E53935 $highlight-red = #E53935
$highlight-orange = #F76D47 $highlight-orange = #F76D47
@@ -116,16 +103,6 @@ if $highlight_theme == 'light' || ($highlight_theme == 'mac light')
$highlight-purple = #7C4DFF $highlight-purple = #7C4DFF
$highlight-deletion = #BF42BF $highlight-deletion = #BF42BF
$highlight-addition = #105EDE $highlight-addition = #105EDE
$highlight-mac-border = rgba(144, 164, 174, .4)
$highlight-gutter = {
color: alpha($highlight-foreground, .5),
bg-color: $highlight-background
}
$highlight-tools = {
color: $highlight-foreground,
bg-color: darken($highlight-background, 5)
}
$highlight-scrollbar = darken($highlight-background, 8)
if $highlight_theme == false if $highlight_theme == false
$highlight-background = #F6F8FA $highlight-background = #F6F8FA
@@ -139,3 +116,4 @@ if $highlight_theme == false
color: $highlight-foreground, color: $highlight-foreground,
bg-color: darken($highlight-background, 5) bg-color: darken($highlight-background, 5)
} }
$highlight-scrollbar = darken($highlight-background, 8)

View File

@@ -20,7 +20,7 @@ if hexo-config('error_404.enable')
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)
@media screen and (max-width: 768px) +maxWidth768()
flex-direction: column flex-direction: column
margin: 0 margin: 0
height: 25rem height: 25rem
@@ -34,7 +34,7 @@ if hexo-config('error_404.enable')
background-position: center background-position: center
background-size: cover background-size: cover
@media screen and (max-width: 768px) +maxWidth768()
flex: 1 flex: 1
width: 100% width: 100%
border-top-right-radius: 8px border-top-right-radius: 8px
@@ -47,7 +47,7 @@ if hexo-config('error_404.enable')
font-size: 14px font-size: 14px
font-family: $site-name-font font-family: $site-name-font
@media screen and (max-width: 768px) +maxWidth768()
flex: 1.1 flex: 1.1
width: 100% width: 100%
@@ -55,7 +55,7 @@ if hexo-config('error_404.enable')
margin-top: -4rem margin-top: -4rem
font-size: 9em font-size: 9em
@media screen and (max-width: 768px) +maxWidth768()
margin-top: -3rem margin-top: -3rem
.error_subtitle .error_subtitle

View File

@@ -1,11 +1,12 @@
#aside_content #aside_content
width: 25% width: 25%
.card-widget:not(:first-child) > .card-widget:first-child
margin-top: 1rem margin-top: 0
.card-widget .card-widget
overflow: hidden overflow: hidden
margin-top: 1rem
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)
@@ -27,7 +28,7 @@
.author-info .author-info
&__name &__name
font-weight: 500 font-weight: 500
font-size: 1.1rem font-size: 1.57em
&__description &__description
margin-top: -.3rem margin-top: -.3rem
@@ -45,12 +46,12 @@
.headline .headline
@extend .limit-one-line @extend .limit-one-line
color: var(--font-color) color: var(--font-color)
font-size: .7rem 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: 1rem font-size: 1.4em
.card-info-social-icons .card-info-social-icons
margin: .3rem 0 -.3rem margin: .3rem 0 -.3rem
@@ -58,7 +59,7 @@
.social-icon .social-icon
margin: 0 .5rem margin: 0 .5rem
color: var(--font-color) color: var(--font-color)
font-size: 1rem font-size: 1.4em
cursor: pointer cursor: pointer
i i
@@ -72,7 +73,7 @@
background-color: var(--btn-bg) background-color: var(--btn-bg)
color: var(--btn-color) color: var(--btn-color)
text-align: center text-align: center
line-height: 1.6rem line-height: 2.4
span span
padding-left: .5rem padding-left: .5rem
@@ -81,11 +82,21 @@
padding: 1rem 1.2rem padding: 1rem 1.2rem
.item-headline .item-headline
font-size: .8rem font-size: 1.2em
span span
margin-left: .5rem margin-left: .5rem
& + div,
& + ul
padding: .3rem 0 0
.sticky_layout
+minWidth900()
position: sticky
position: -webkit-sticky
top: 20px
.card-tag-cloud .card-tag-cloud
a a
display: inline-block display: inline-block
@@ -94,63 +105,83 @@
&:hover &:hover
color: $text-hover !important color: $text-hover !important
.card-recent-post .aside-list
.aside-recent-item & > span
margin: 10px 0 -15px display: block
margin-bottom: .5rem
text-align: center
& > .aside-recent-post & > .aside-list-item
margin-bottom: 10px display: flex
align-items: center
padding: .3rem 0
.aside-post-cover &:first-child
float: left padding-top: 0
&:not(:last-child)
border-bottom: 1px dashed #f5f5f5
&:last-child
padding-bottom: 0
.thumbnail
overflow: hidden overflow: hidden
width: 66px width: w = 4.2em
height: 66px height: w
.aside-post-bg & > img
padding: 0
max-width: 100%
width: 100% width: 100%
height: 100% height: 100%
transition: all .6s transition: all .6s
object-fit: cover object-fit: cover
&:hover &:hover
box-shadow: none
transform: scale(1.1) transform: scale(1.1)
.aside-post-info .content
.aside-post_meta flex: 1
padding-left: 10px padding-left: 10px
color: $theme-meta-color word-break: break-all
font-size: .6rem
.aside-post-title & > .name
@extend .limit-more-line
-webkit-line-clamp: 1
& > time,
& > .name
color: $theme-meta-color
font-size: 85%
& > .title,
& > .comment
@extend .limit-more-line @extend .limit-more-line
padding-left: 10px
height: 40px
color: var(--font-color) color: var(--font-color)
line-height: 1rem font-size: 95%
line-height: 1.5
-webkit-line-clamp: 2 -webkit-line-clamp: 2
&:hover &:hover
color: $text-hover color: $text-hover
&.no-aside-cover .card-recent-post
.aside-post-title .thumbnail
border-radius: 0 !important
.no-aside-cover
title
height: auto 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: .2rem 0 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,
.card-categories ul.card-category-list > .card-category-list-item .card-categories ul.card-category-list > .card-category-list-item
a a
display: inline-block display: inline-block
padding: .15rem 1rem padding: .15rem .5rem
width: 100% width: 100%
color: var(--font-color) color: var(--font-color)
transition: all .4s transition: all .4s
@@ -211,25 +242,17 @@
.card-webinfo .card-webinfo
.webinfo .webinfo
padding: .2rem 1rem
.webinfo-item .webinfo-item
display: block display: flex
padding: 4px 0 0 align-items: center
padding: .1rem .5rem 0
div div
&:first-child &:first-child
display: inline-block flex: 1
padding-right: 1rem
&:last-child +maxWidth900()
display: inline-block
float: right
@media screen and (max-width: 900px)
.layout_page
flex-direction: column
#recent-posts,
#aside_content #aside_content
width: 100% !important width: 100% !important
@@ -237,7 +260,7 @@
.card-widget:first-child .card-widget:first-child
margin-top: 1rem margin-top: 1rem
@media screen and (min-width: 900px) +minWidth900()
#aside_content #aside_content
.card-widget .card-widget
if hexo-config('aside.position') == 'right' if hexo-config('aside.position') == 'right'
@@ -246,6 +269,6 @@
margin-right: 15px margin-right: 15px
if hexo-config('aside.mobile') == false if hexo-config('aside.mobile') == false
@media screen and (max-width: $sm) +maxWidth768()
#aside_content #aside_content
display: none display: none

View File

@@ -1,33 +0,0 @@
.category-content
ul
margin-top: .4rem
padding: 0 0 0 1rem
list-style: none
counter-reset: li
ul
padding-left: .2rem
li
position: relative
margin: .3rem 0
padding: .1rem .2rem .1rem 1rem
&:before
position: absolute
left: 0
cursor: pointer
transition: all .3s ease-out
$w = .3rem
top: 10px
width: w = $w
height: h = w
border: .5 * w solid $light-blue
border-radius: w
background: transparent
content: ''
line-height: h
&:hover
&:before
border-color: $pseudo-hover

View File

@@ -6,7 +6,7 @@
display: inline-block display: inline-block
vertical-align: middle vertical-align: middle
font-weight: 700 font-weight: 700
font-size: 20px font-size: 1.43em
.comment-switch .comment-switch
display: inline-block display: inline-block
@@ -33,10 +33,10 @@
label label
position: relative position: relative
display: inline-block display: inline-block
margin: 0 .4rem margin: -4px .4rem 0
width: 42px width: 42px
height: 22px height: 22px
vertical-align: sub vertical-align: middle
input#switch-comments-btn input#switch-comments-btn
width: 0 width: 0

View File

@@ -18,10 +18,10 @@
line-height: 17px line-height: 17px
-webkit-transform: translateZ(0) -webkit-transform: translateZ(0)
@media screen and (max-width: 1100px) +maxWidth1024()
width: calc(50% - 15px) !important width: calc(50% - 15px) !important
@media screen and (max-width: 600px) +maxWidth600()
width: calc(100% - 15px) !important width: calc(100% - 15px) !important
&:hover &:hover
@@ -66,11 +66,11 @@
padding: 16px 10px 0 0 padding: 16px 10px 0 0
height: 40px height: 40px
font-weight: bold font-weight: bold
font-size: 20px font-size: 1.43em
.flink-item-desc .flink-item-desc
@extend .limit-one-line @extend .limit-one-line
display: block display: block
padding: 16px 10px 16px 0 padding: 16px 10px 16px 0
height: 50px height: 50px
font-size: 13px font-size: .93em

View File

@@ -29,17 +29,17 @@
#site_title #site_title
margin: 0 margin: 0
color: var(--white) color: var(--white)
font-size: 1.3rem font-size: 1.85em
@media screen and (min-width: $sm) +minWidth768()
font-size: 2rem font-size: 2.85em
#site_subtitle #site_subtitle
color: var(--light-grey) color: var(--light-grey)
font-size: .8rem font-size: 1.15em
@media screen and (min-width: $sm) +minWidth768()
font-size: 1.2rem font-size: 1.72em
#site_social_icons #site_social_icons
display: none display: none
@@ -47,14 +47,14 @@
width: 15rem width: 15rem
text-align: center text-align: center
@media screen and (max-width: $sm) +maxWidth768()
display: block display: block
.social-icon .social-icon
margin: 0 .5rem margin: 0 .5rem
color: var(--light-grey) color: var(--light-grey)
text-shadow: .1rem .1rem .2rem rgba(0, 0, 0, .15) text-shadow: .1rem .1rem .2rem rgba(0, 0, 0, .15)
font-size: 1rem font-size: 1.43em
cursor: pointer cursor: pointer
#scroll_down #scroll_down
@@ -73,7 +73,7 @@
&.not-index-bg &.not-index-bg
height: 20rem height: 20rem
@media screen and (max-width: $sm) +maxWidth768()
height: 14rem height: 14rem
#page_site-info #page_site-info
@@ -82,14 +82,14 @@
padding: 0 .5rem padding: 0 .5rem
width: 100% width: 100%
@media screen and (max-width: $sm) +maxWidth768()
top: 7rem top: 7rem
// post // post
&.post-bg &.post-bg
height: 20rem height: 20rem
@media screen and (max-width: $sm) +maxWidth768()
height: 18rem height: 18rem
&:before &:before
@@ -109,16 +109,16 @@
width: 100% width: 100%
text-align: left text-align: left
@media screen and (max-width: $sm) +maxWidth768()
bottom: 1.1rem bottom: 1.1rem
padding: 0 1.1rem padding: 0 1.1rem
#post-title #post-title
margin-bottom: .4rem margin-bottom: .4rem
font-size: 1.5rem font-size: 2.15em
@media screen and (max-width: $sm) +maxWidth768()
font-size: 1.2rem font-size: 1.72em
.posttitle .posttitle
@extend .limit-more-line @extend .limit-more-line
@@ -130,12 +130,12 @@
color: var(--light-grey) color: var(--light-grey)
font-size: 95% font-size: 95%
@media screen and (min-width: $sm) +minWidth768()
> .meta-secondline > .meta-secondline
> span:first-child > span:first-child
display: none display: none
@media screen and (max-width: $sm) +maxWidth768()
font-size: 90% font-size: 90%
> .meta-firstline, > .meta-firstline,
@@ -174,22 +174,27 @@ _:future,
position: absolute position: absolute
top: 0 top: 0
z-index: 90 z-index: 90
padding: 10px 36px display: flex
flex-wrap: wrap
align-items: center
padding: 0 36px
width: 100% width: 100%
height: 58px height: 60px
border: none font-size: 1.3em
font-size: 18px
opacity: 0 opacity: 0
transition: all .5s transition: all .5s
@media screen and (max-width: $sm) +maxWidth768()
padding: 10px .8rem padding: 0 16px
&:not(.fixed) &:not(.fixed)
.menus #menus
padding-right: 0 !important padding-right: 0 !important
.toggle-menu #blog_name
flex: 1
#toggle-menu
display: none display: none
padding: .1rem 0 0 .3rem padding: .1rem 0 0 .3rem
vertical-align: top vertical-align: top
@@ -197,10 +202,6 @@ _:future,
&:hover &:hover
color: var(--white) color: var(--white)
&.is-visible-inline
.site-page
font-size: inherit
a a
color: var(--light-grey) color: var(--light-grey)
@@ -209,7 +210,7 @@ _:future,
&.fixed &.fixed
position: fixed position: fixed
top: -60px top: -62px
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)
@@ -217,7 +218,7 @@ _:future,
a, a,
#site-name, #site-name,
.toggle-menu #toggle-menu
color: var(--font-color) color: var(--font-color)
text-shadow: none text-shadow: none
@@ -300,6 +301,19 @@ _:future,
color: var(--font-color) color: var(--font-color)
text-shadow: none text-shadow: none
&.hide-menu
#toggle-menu
display: inline-block !important
.site-page
font-size: inherit
.menus_items
display: none !important
#search_button span
display: none !important
#search_button #search_button
display: inline display: inline
padding: 0 0 0 .7rem padding: 0 0 0 .7rem
@@ -308,5 +322,5 @@ _:future,
position: relative position: relative
padding-bottom: .3rem padding-bottom: .3rem
text-shadow: .05rem .05rem .1rem rgba($dark-black, .3) text-shadow: .05rem .05rem .1rem rgba($dark-black, .3)
font-size: .7rem font-size: .78em
cursor: pointer cursor: pointer

View File

@@ -47,12 +47,10 @@
.length_num .length_num
color: var(--text-highlight-color) color: var(--text-highlight-color)
font-size: .9rem font-size: 1.28em
.headline .headline
display: block
color: var(--font-color) color: var(--font-color)
font-size: .7rem
hr hr
margin: 1rem auto margin: 1rem auto
@@ -66,7 +64,7 @@
display: block display: block
padding: .3rem 1.5rem padding: .3rem 1.5rem
color: var(--font-color) color: var(--font-color)
font-size: .8rem font-size: 1.15em
cursor: pointer cursor: pointer
i:first-child i:first-child
@@ -81,13 +79,16 @@
.expand .expand
position: absolute position: absolute
right: 0 top: .78em
padding: .4rem right: .4rem
transition: transform .3s transition: transform .3s
&.closed &.hide
transform: rotate(90deg) !important transform: rotate(90deg) !important
.menus_item_child .menus_item_child
margin: 0 margin: 0
list-style: none list-style: none
if hexo-config('hide_sidebar_menu_child')
display: none

View File

@@ -1,382 +0,0 @@
.layout_page
display: flex
align-items: flex-start
margin: 0 auto
padding: 2rem 15px
max-width: 1200px
// index
#recent-posts
width: 75%
& > .recent-post-item:not(:first-child)
margin-top: 1rem
& > .recent-post-item
display: flex
flex-direction: row
align-items: center
padding: 0
height: 280px
border-radius: 8px
background: var(--card-bg)
box-shadow: 0 4px 8px 6px rgba(7, 17, 27, .06)
transition: all .3s
&:hover
box-shadow: 0 4px 12px 12px rgba(7, 17, 27, .15)
img.post_bg
transform: scale(1.1)
if hexo-config('cover.position') == 'both'
.left_radius
border-radius: 8px 0 0 8px
.right_radius
order: 2
border-radius: 0 8px 8px 0
else if hexo-config('cover.position') == 'left'
.left_radius
border-radius: 8px 0 0 8px
.right_radius
border-radius: 8px 0 0 8px
else if hexo-config('cover.position') == 'right'
.left_radius
order: 2
border-radius: 0 8px 8px 0
.right_radius
order: 2
border-radius: 0 8px 8px 0
.post_cover
overflow: hidden
width: 45%
height: 280px
-webkit-mask-image: -webkit-radial-gradient(white, black)
img.post_bg
display: block
margin: 0
padding: 0
width: 100%
height: 100%
border: 0
transition: all .6s
object-fit: cover
&:hover
transform: scale(1.1)
& >.recent-post-info
display: inline-block
overflow: hidden
padding: 0 40px
width: 55%
&.no-cover
width: 100%
& > .article-title
@extend .limit-more-line
margin-bottom: .3rem
color: var(--text-highlight-color)
font-size: 1.2rem
line-height: 1.4
transition: all .2s ease-in-out
-webkit-line-clamp: 2
&:hover
color: $text-hover
& > .article-meta-wrap
color: $theme-meta-color
font-size: 90%
& > .post-meta-date
cursor: default
.sticky
color: $sticky-color
i
margin: 0 .2rem 0 0
.article-meta-label
if hexo-config('post_meta.page.label')
padding-right: .2rem
else
display: none
.article-meta__separator
margin: 0 .3rem
.article-meta__link
margin: 0 .2rem
.fa-angle-right
margin: 0 .2rem
a
color: $theme-meta-color
&:hover
color: $text-hover
text-decoration: underline
& > .content
@extend .limit-more-line
margin-top: .3rem
-webkit-line-clamp: 3
// tags page
.tag-cloud
a
display: inline-block
padding: 0 .4rem
cursor: pointer
transition: all .3s
&:hover
color: $text-hover !important
transform: scale(1.1)
&__title
text-align: center
font-size: 1.8rem
&-tags
text-align: center
.layout_post > #post,
.layout_page > div:first-child:not(.recent-posts)
padding: 50px 40px
border-radius: 8px
background: var(--card-bg)
box-shadow: 0 4px 8px 6px rgba(7, 17, 27, .06)
transition: all .3s
&:hover
box-shadow: 0 4px 12px 12px rgba(7, 17, 27, .15)
.layout_page
& > div:first-child:not(.recent-posts)
width: 75%
.article-sort
margin-left: .5rem
padding-left: 1rem
border-left: 2px solid lighten($light-blue, 20)
&-title
position: relative
margin-left: .5rem
padding-bottom: 1.2rem
padding-left: 1rem
font-size: 1.2rem
line-height: 1
&:hover
&:before
border-color: $pseudo-hover
&:before
position: absolute
top: .25rem
left: calc(-.5rem + 1px)
z-index: 1
width: w = .5rem
height: h = w
border: .5 * w solid $light-blue
border-radius: w
background: var(--card-bg)
content: ''
line-height: h
transition: all .2s ease-in-out
&:after
position: absolute
bottom: 0
left: 0
z-index: 0
width: .1rem
height: 1.3rem
background: lighten($light-blue, 20)
content: ''
&-item
position: relative
margin: 0 0 1rem .5rem
width: 100%
height: 80px
transition: all .2s ease-in-out
&:hover
&:before
border-color: $pseudo-hover
&:before
$w = .3rem
position: absolute
top: 1.8rem
left: calc(-1rem - 17px)
width: w = $w
height: h = w
border: .5 * w solid $light-blue
border-radius: w
background: var(--card-bg)
content: ''
line-height: h
transition: all .2s ease-in-out
&.no-article-cover
display: flex
flex-direction: column
justify-content: center
.article-sort-item-info
padding: 0
width: 100%
&.year
height: auto
font-size: 1rem
&:hover
&:before
border-color: $light-blue
&:before
top: .7rem
border-color: $pseudo-hover
&-time
color: $theme-meta-color
font-size: .9em
time
padding-left: .4rem
cursor: default
&-title
@extend .limit-more-line
color: var(--font-color)
font-size: 1.1em
transition: all .3s
-webkit-line-clamp: 2
&:hover
color: $text-hover
transform: translateX(20px)
&-img
float: left
overflow: hidden
width: 80px
height: 80px
img
width: 100%
height: 100%
transition: all .6s
object-fit: cover
&:hover
transform: scale(1.1)
&-info
display: inline-block
overflow: hidden
padding: 0 1rem
width: calc(100% - 80px)
.category-lists
padding: 1rem 0 1.5rem
.category__title
text-align: center
font-size: 1.8rem
.category-list
a
color: var(--font-color)
cursor: pointer
&:hover
color: $text-hover
.category-list-count
margin-left: .4rem
color: $theme-meta-color
&:before
content: '('
&:after
content: ')'
// aside
.hide-aside
max-width: 1000px
& > div
width: 100% !important
@media screen and (max-width: $sm)
.layout_page
padding: 1rem 5px !important
& > div:first-child:not(.recent-posts)
padding: 1.8rem .7rem
.category-lists
padding: 0
#recent-posts
.recent-post-item
flex-direction: column
height: auto !important
.post_cover
order: 1 !important
width: 100%
height: 230px
border-radius: 8px 8px 0 0
.recent-post-info
order: 2 !important
padding: 1rem 1rem 1.5rem
width: 100%
&.no-cover
padding: 1.5rem 1rem
.article-title
font-size: 1rem
.content
height: auto
@media screen and (min-width: 900px)
if hexo-config('aside.position') == 'left'
#recent-posts,
#page,
.category-content,
#archive,
.tag-cloud,
#tag,
#category
order: 2
@media screen and (max-width: 900px)
.layout_page
& > div:first-child:not(.recent-posts)
width: 100% !important
// ie10-ios11使
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active)
.recent-post-info
.content
height: 90px

View File

@@ -75,7 +75,7 @@
margin: 2rem 0 !important margin: 2rem 0 !important
background: $dark-black background: $dark-black
@media screen and (max-width: 768px) +maxWidth768()
.prev-post, .prev-post,
.next-post .next-post
width: 100% !important width: 100% !important

View File

@@ -58,7 +58,7 @@ beautify()
list-style: none list-style: none
counter-reset: li counter-reset: li
@media screen and (max-width: $sm) +maxWidth768()
padding: 0 0 0 .4rem padding: 0 0 0 .4rem
p p
@@ -68,7 +68,7 @@ beautify()
ul ul
padding-left: .6rem padding-left: .6rem
@media screen and (max-width: $sm) +maxWidth768()
padding-left: .2rem padding-left: .2rem
li li
@@ -92,30 +92,30 @@ beautify()
ol ol
> li > li
&:not(.tab) &:not(.tab)
padding: .1rem .2rem .1rem 1.4rem padding: .2em .2em .2em 1.8em
&:before &:before
margin-top: .3rem margin-top: .65em
width: w = 1rem width: w = 1.45em
height: h = w height: h = w
border-radius: .5 * w border-radius: .5 * w
content: counter(li) content: counter(li)
counter-increment: li counter-increment: li
text-align: center text-align: center
font-size: .6rem font-size: .85em
line-height: h line-height: h
ul ul
> li:not(.tab) > li:not(.tab)
padding: .1rem .2rem .1rem 1rem padding: .2em .2em .2em 1.4em
&:hover &:hover
&:before &:before
border-color: $pseudo-hover border-color: $pseudo-hover
&:before &:before
$w = .3rem $w = .42em
top: 10px top: .78em
width: w = $w width: w = $w
height: h = w height: h = w
border: .5 * w solid $light-blue border: .5 * w solid $light-blue
@@ -204,8 +204,7 @@ img
border: 1px solid $light-blue border: 1px solid $light-blue
border-radius: .6rem border-radius: .6rem
color: $light-blue color: $light-blue
font-size: 12px font-size: .85em
cursor: pointer
transition: all .2s ease-in-out transition: all .2s ease-in-out
&:hover &:hover
@@ -219,14 +218,14 @@ img
width: fit-content width: fit-content
.social-share .social-share
font-size: 12px font-size: .85em
.social-share-icon .social-share-icon
margin: 0 4px margin: 0 4px
width: 26px width: w = 1.85em
height: 26px height: w
font-size: 15px font-size: 1.2em
line-height: 25px line-height: w
.post-copyright .post-copyright
position: relative position: relative
@@ -295,29 +294,29 @@ img
.post-outdate-notice .post-outdate-notice
position: relative position: relative
margin: 0 0 1rem margin: 0 0 1rem
padding: .5rem 1.2rem padding: .5em 1.2em
border-radius: 3px border-radius: 3px
background-color: $noticeOutdate-bg background-color: $noticeOutdate-bg
color: $noticeOutdate-color color: $noticeOutdate-color
if hexo-config('noticeOutdate.style') == 'flat' if hexo-config('noticeOutdate.style') == 'flat'
padding: .5rem 1.2rem .5rem 1.8rem padding: .5em 1em .5em 2.6em
border-left: 5px solid $noticeOutdate-border border-left: 5px solid $noticeOutdate-border
&:before &:before
@extend .fontawesomeIcon @extend .fontawesomeIcon
position: absolute position: absolute
top: 50% top: 50%
left: 1em left: .9em
color: $noticeOutdate-border color: $noticeOutdate-border
content: '\f071' content: '\f071'
transform: translateY(-50%) transform: translateY(-50%)
@media screen and (max-width: 1024px) +maxWidth1024()
.layout_post .layout_post
width: auto width: auto
@media screen and (max-width: $sm) +maxWidth768()
.layout_post .layout_post
padding: 1rem 5px padding: 1rem 5px
@@ -325,7 +324,7 @@ img
padding: 1.8rem .7rem padding: 1.8rem .7rem
// adjust the layout width in big screen // adjust the layout width in big screen
@media screen and (min-width: $lr) +minWidth2000()
.layout_post .layout_post
max-width: 1300px max-width: 1300px

View File

@@ -1,12 +1,13 @@
.relatedPosts .relatedPosts
margin-top: 1rem margin-top: 1rem
.relatedPosts_headline & > .headline
margin-bottom: 5px margin-bottom: 5px
font-weight: 700 font-weight: 700
font-size: 20px font-size: 1.43em
.relatedPosts_item & > .relatedPosts-list
& > div
position: relative position: relative
display: inline-block display: inline-block
overflow: hidden overflow: hidden
@@ -17,37 +18,37 @@
vertical-align: bottom vertical-align: bottom
&:hover &:hover
.relatedPosts_cover .cover
opacity: .8 opacity: .8
transform: scale(1.1) transform: scale(1.1)
@media screen and (max-width: 768px) +maxWidth768()
margin: 2px margin: 2px
width: calc(50% - 4px) width: calc(50% - 4px)
height: 150px height: 150px
@media screen and (max-width: 480px) +maxWidth600()
width: calc(100% - 4px) width: calc(100% - 4px)
.relatedPosts_cover .cover
width: 100% width: 100%
height: 100% height: 100%
opacity: .4 opacity: .4
transition: all .6s transition: all .6s
object-fit: cover object-fit: cover
.relatedPosts_main .content
position: absolute position: absolute
top: 50% top: 50%
padding: 0 1rem padding: 0 1rem
width: 100% width: 100%
transform: translate(0, -50%) transform: translate(0, -50%)
.relatedPosts_date .date
color: var(--light-grey) color: var(--light-grey)
font-size: 90% font-size: 90%
.relatedPosts_title .title
@extend .limit-more-line @extend .limit-more-line
color: var(--white) color: var(--white)
-webkit-line-clamp: 2 -webkit-line-clamp: 2

View File

@@ -36,5 +36,5 @@
#mobile-toc-button #mobile-toc-button
display: none display: none
@media screen and (max-width: $bg) +maxWidth1024()
display: block display: block

View File

@@ -3,11 +3,12 @@
bottom: $sidebar-icon-top bottom: $sidebar-icon-top
left: $sidebar-icon-left left: $sidebar-icon-left
z-index: 100 z-index: 100
color: var(--sidebar-icon-color)
font-size: $sidebar-icon-size font-size: $sidebar-icon-size
cursor: pointer cursor: pointer
transition: all .2s transition: all .2s
@media screen and (max-width: $bg) +maxWidth1024()
display: none display: none
#sidebar #sidebar
@@ -21,7 +22,12 @@
background: var(--sidebar-bg) background: var(--sidebar-bg)
opacity: .9 opacity: .9
@media screen and (max-width: $bg) &.tocOpenPc
& > #toggle-sidebar
color: #99a9bf
transform: rotateZ(180deg)
+maxWidth1024()
right: -($mobile-sidebar-width) right: -($mobile-sidebar-width)
left: auto left: auto
z-index: 103 z-index: 103

View File

@@ -1,4 +1,6 @@
#vcomment #vcomment
font-size: 1.15em
.vbtn .vbtn
border: none border: none
background: var(--btn-bg) background: var(--btn-bg)
@@ -57,12 +59,14 @@
padding: .3rem 0 .8em padding: .3rem 0 .8em
// mathjax // mathjax
.mathjax-overflow
overflow-x: auto
overflow-y: hidden
mjx-container[jax='CHTML'][display='true'] mjx-container[jax='CHTML'][display='true']
overflow-x: auto overflow-x: auto
overflow-y: hidden overflow-y: hidden
padding-bottom: .5rem padding-bottom: .3rem
outline: 0
line-height: 2
.aplayer .aplayer
color: $font-black color: $font-black

View File

@@ -26,6 +26,7 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
--blockquote-color: alpha(#FFFFFF, .6) --blockquote-color: alpha(#FFFFFF, .6)
--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)
// footer // footer
#web_bg[data-type=color], #web_bg[data-type=color],
@@ -43,9 +44,17 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
#page-header #page-header
background-color: #121212 background-color: #121212
#article-container code #article-container
code
background: #2c2c2c background: #2c2c2c
pre > code
background: 0
.note
code
background: $code-background
// //
#page-header #page-header
&:before &:before
@@ -73,6 +82,7 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
figure.highlight figure.highlight
box-shadow: none box-shadow: none
if hexo-config('rootConfig.highlight') && hexo-config('rootConfig.highlight.enable')
table::-webkit-scrollbar-thumb table::-webkit-scrollbar-thumb
background: lighten(#121212, 5) background: lighten(#121212, 5)
@@ -82,6 +92,9 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
.hljs .hljs
background-color: lighten(#121212, 2) !important background-color: lighten(#121212, 2) !important
pre[class*='language-']::-webkit-scrollbar-thumb
background: lighten(#121212, 5)
.highlight-tools .highlight-tools
background: lighten(#121212, 3) !important background: lighten(#121212, 3) !important
color: #90a4ae !important color: #90a4ae !important
@@ -111,6 +124,9 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
.aplayer .aplayer
filter: brightness(.7) filter: brightness(.7)
#aside_content .aside-list > .aside-list-item:not(:last-child)
border-bottom: 1px dashed alpha(#FFFFFF, .1)
// //
// hexo-blog-encrypt // hexo-blog-encrypt
#hexo-blog-encrypt #hexo-blog-encrypt

View File

@@ -0,0 +1,115 @@
.article-sort
margin-left: .5rem
padding-left: 1rem
border-left: 2px solid lighten($light-blue, 20)
&-title
position: relative
margin-left: .5rem
padding-bottom: 1rem
padding-left: 1rem
font-size: 1.72em
&:hover
&:before
border-color: $pseudo-hover
&:before
position: absolute
top: calc(((100% - 1.8rem) / 2))
left: -.45rem
z-index: 1
width: w = .5rem
height: h = w
border: .5 * w solid $light-blue
border-radius: w
background: var(--card-bg)
content: ''
line-height: h
transition: all .2s ease-in-out
&:after
position: absolute
bottom: 0
left: 0
z-index: 0
width: .1rem
height: 1.5em
background: lighten($light-blue, 20)
content: ''
&-item
position: relative
display: flex
align-items: center
margin: 0 0 1rem .5rem
transition: all .2s ease-in-out
&:hover
&:before
border-color: $pseudo-hover
&:before
$w = .3rem
position: absolute
left: calc(-1rem - 17px)
width: w = $w
height: h = w
border: .5 * w solid $light-blue
border-radius: w
background: var(--card-bg)
content: ''
transition: all .2s ease-in-out
&.no-article-cover
height: 80px
.article-sort-item-info
padding: 0
&.year
font-size: 1.43em
&:hover
&:before
border-color: $light-blue
&:before
border-color: $pseudo-hover
&-time
color: $theme-meta-color
font-size: 95%
time
padding-left: .3rem
cursor: default
&-title
@extend .limit-more-line
color: var(--font-color)
font-size: 1.1em
transition: all .3s
-webkit-line-clamp: 2
&:hover
color: $text-hover
transform: translateX(10px)
&-img
overflow: hidden
width: 80px
height: 80px
img
width: 100%
height: 100%
transition: all .6s
object-fit: cover
&:hover
transform: scale(1.1)
&-info
flex: 1
padding: 0 .8rem

View File

@@ -0,0 +1,60 @@
.category-content
.category-lists
padding: 1rem 0 1.5rem
+maxWidth768()
padding: 0
.category__title
text-align: center
font-size: 2.57em
.category-list
a
color: var(--font-color)
&:hover
color: $text-hover
.category-list-count
margin-left: .4rem
color: $theme-meta-color
&:before
content: '('
&:after
content: ')'
ul
margin-top: .4rem
padding: 0 0 0 1rem
list-style: none
counter-reset: li
ul
padding-left: .2rem
li
position: relative
margin: .3rem 0
padding: .12em .4em .12em 1.4em
&:before
position: absolute
left: 0
cursor: pointer
transition: all .3s ease-out
$w = .43em
top: .7em
width: w = $w
height: h = w
border: .5 * w solid $light-blue
border-radius: w
background: transparent
content: ''
// line-height: h
&:hover
&:before
border-color: $pseudo-hover

View File

@@ -0,0 +1,51 @@
.layout_page
display: flex
margin: 0 auto
padding: 2rem 15px
max-width: 1200px
+maxWidth900()
flex-direction: column
+maxWidth768()
padding: 1rem 5px !important
& > 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
padding: 50px 40px
border-radius: 8px
background: var(--card-bg)
box-shadow: 0 4px 8px 6px rgba(7, 17, 27, .06)
transition: all .3s
&:hover
box-shadow: 0 4px 12px 12px rgba(7, 17, 27, .15)
+minWidth900()
if hexo-config('aside.position') == 'left'
#recent-posts,
#page,
.category-content,
#archive,
.tag-cloud,
#tag,
#category
order: 2

View File

@@ -0,0 +1,146 @@
#recent-posts
& > .recent-post-item:not(:first-child)
margin-top: 1rem
& > .recent-post-item
display: flex
flex-direction: row
align-items: center
height: 20em
border-radius: 12px 8px 8px 12px
background: var(--card-bg)
box-shadow: 0 4px 8px 6px rgba(7, 17, 27, .06)
transition: all .3s
+maxWidth768()
border-radius: 12px 12px 8px 8px
&:hover
box-shadow: 0 4px 12px 12px rgba(7, 17, 27, .15)
img.post_bg
transform: scale(1.1)
if hexo-config('cover.position') == 'both'
.left_radius
border-radius: 8px 0 0 8px
.right_radius
order: 2
border-radius: 0 8px 8px 0
else if hexo-config('cover.position') == 'left'
.left_radius
border-radius: 8px 0 0 8px
.right_radius
border-radius: 8px 0 0 8px
else if hexo-config('cover.position') == 'right'
.left_radius
order: 2
border-radius: 0 8px 8px 0
.right_radius
order: 2
border-radius: 0 8px 8px 0
.post_cover
overflow: hidden
width: 45%
height: 100%
-webkit-mask-image: -webkit-radial-gradient(white, black)
img.post_bg
width: 100%
height: 100%
transition: all .6s
object-fit: cover
&:hover
transform: scale(1.1)
& >.recent-post-info
display: inline-block
overflow: hidden
padding: 0 40px
width: 55%
&.no-cover
width: 100%
& > .article-title
@extend .limit-more-line
margin-bottom: .3rem
color: var(--text-highlight-color)
font-size: 1.72em
line-height: 1.4
transition: all .2s ease-in-out
-webkit-line-clamp: 2
&:hover
color: $text-hover
& > .article-meta-wrap
color: $theme-meta-color
font-size: 90%
& > .post-meta-date
cursor: default
.sticky
color: $sticky-color
i
margin: 0 .2rem 0 0
.article-meta-label
if hexo-config('post_meta.page.label')
padding-right: .2rem
else
display: none
.article-meta__separator
margin: 0 .3rem
.article-meta__link
margin: 0 .2rem
.fa-angle-right
margin: 0 .2rem
a
color: $theme-meta-color
&:hover
color: $text-hover
text-decoration: underline
& > .content
@extend .limit-more-line
margin-top: .3rem
-webkit-line-clamp: 3
+maxWidth768()
#recent-posts
.recent-post-item
flex-direction: column
height: auto !important
.post_cover
order: 1 !important
width: 100%
height: 230px
border-radius: 8px 8px 0 0
.recent-post-info
order: 2 !important
padding: 1rem 1rem 1.5rem
width: 100%
&.no-cover
padding: 1.5rem 1rem
.article-title
font-size: 1.43em
.content
height: auto

View File

@@ -0,0 +1,14 @@
.tag-cloud
text-align: center
a
display: inline-block
padding: 0 .4rem
transition: all .3s
&:hover
color: $text-hover !important
transform: scale(1.1)
&__title
font-size: 2.57em

View File

@@ -13,24 +13,23 @@
border-radius: 2rem border-radius: 2rem
background: var(--search-bg) background: var(--search-bg)
color: var(--search-input-color) color: var(--search-input-color)
font-size: 14px
.ais-hits--item.algolia-hit-item .ais-hits--item.algolia-hit-item
position: relative position: relative
padding-left: 1.5rem padding-left: 1.2rem
&:hover &:hover
&:before &:before
border-color: $pseudo-hover border-color: $pseudo-hover
&:before &:before
$w = .3rem $w = .5em
position: absolute position: absolute
top: .4rem top: .53em
left: 0 left: 0
width: w = $w width: w = $w
height: h = w height: h = w
border: .5 * w solid $search-color border: .15rem solid $search-color
border-radius: w border-radius: w
background: transparent background: transparent
content: '' content: ''
@@ -40,7 +39,6 @@
a a
display: block display: block
color: var(--search-result-title) color: var(--search-result-title)
font-size: 14px
cursor: pointer cursor: pointer
&:hover &:hover

View File

@@ -9,7 +9,7 @@
width: 30rem width: 30rem
background: var(--search-bg) background: var(--search-bg)
@media screen and (max-width: $sm) +maxWidth768()
top: 0 top: 0
left: 0 left: 0
margin: 0 margin: 0
@@ -24,7 +24,7 @@
top: .8rem top: .8rem
right: 1rem right: 1rem
color: $grey color: $grey
font-size: 1rem font-size: 1.4em
line-height: 1 line-height: 1
cursor: pointer cursor: pointer
transition: color .2s ease-in-out transition: color .2s ease-in-out
@@ -35,7 +35,7 @@
&__title &__title
padding: 0 0 .7rem padding: 0 0 .7rem
color: $search-color color: $search-color
font-size: 1rem font-size: 1.4em
line-height: 1 line-height: 1
#search-mask #search-mask

View File

@@ -14,12 +14,11 @@
border-radius: 2rem border-radius: 2rem
background: var(--search-bg) background: var(--search-bg)
color: var(--search-input-color) color: var(--search-input-color)
font-size: 14px
-webkit-appearance: none -webkit-appearance: none
.local-search__hit-item .local-search__hit-item
position: relative position: relative
padding-left: 1.3rem padding-left: 1.2rem
line-height: 1.7 line-height: 1.7
&:hover &:hover
@@ -27,13 +26,13 @@
border-color: $pseudo-hover border-color: $pseudo-hover
&:before &:before
$w = .3rem $w = .5em
position: absolute position: absolute
top: .3rem top: .45em
left: 0 left: 0
width: w = $w width: w = $w
height: h = w height: h = w
border: .5 * w solid $search-color border: .15rem solid $search-color
border-radius: w border-radius: w
background: transparent background: transparent
content: '' content: ''
@@ -44,7 +43,6 @@
display: block display: block
color: var(--search-result-title) color: var(--search-result-title)
font-weight: 600 font-weight: 600
font-size: 14px
cursor: pointer cursor: pointer
&:hover &:hover
@@ -65,6 +63,6 @@
overflow-y: auto overflow-y: auto
max-height: 10.5rem max-height: 10.5rem
@media screen and (max-width: $sm) +maxWidth768()
padding-bottom: 2rem padding-bottom: 2rem
max-height: 75vh !important max-height: 75vh !important

View File

@@ -9,7 +9,7 @@ figure.gallery-group
background: $dark-black background: $dark-black
-webkit-transform: translate3d(0, 0, 0) -webkit-transform: translate3d(0, 0, 0)
@media screen and (max-width: 600px) +maxWidth600()
width: calc(100% - .4rem) width: calc(100% - .4rem)
&:hover &:hover
@@ -61,7 +61,7 @@ figure.gallery-group
margin: 0 margin: 0
padding: .4rem 0 0 padding: .4rem 0 0
letter-spacing: 1px letter-spacing: 1px
font-size: .8rem font-size: 1.1em
line-height: 1.5 line-height: 1.5
opacity: 0 opacity: 0
transition: opacity .35s, transform .35s transition: opacity .35s, transform .35s
@@ -74,7 +74,7 @@ figure.gallery-group
margin: 0 margin: 0
padding: .4rem 0 padding: .4rem 0
font-weight: bold font-weight: bold
font-size: 1.2rem font-size: 1.65em
line-height: 1.5 line-height: 1.5
-webkit-line-clamp: 2 -webkit-line-clamp: 2
@@ -99,9 +99,6 @@ figure.gallery-group
img img
opacity: 0 opacity: 0
.img-alt
display: none
.fancybox .fancybox
width: auto width: auto
text-align: inherit text-align: inherit

View File

@@ -5,21 +5,20 @@
margin: 0 0 1rem margin: 0 0 1rem
padding: 15px padding: 15px
if ($note-style == 'simple') if ($note-style == 'simple')
border: 1px solid #EEEEEE border: 1px solid #EEEEEE
border-left-width: 5px border-left-width: 5px
if ($note-style == 'modern') if ($note-style == 'modern')
border: 1px solid transparent border: 1px solid transparent
background-color: var(--white)smoke background-color: #f5f5f5
color: $font-black
if ($note-style == 'flat') if ($note-style == 'flat')
border: initial border: initial
color: $font-black
border-left: 5px solid #EEEEEE border-left: 5px solid #EEEEEE
background-color: lighten(#EEEEEE, 65%) background-color: lighten(#EEEEEE, 65%)
color: $font-black
if hexo-config('note.border_radius') is a 'unit' if hexo-config('note.border_radius') is a 'unit'
border-radius: unit(hexo-config('note.border_radius'), px) border-radius: unit(hexo-config('note.border_radius'), px)
@@ -51,9 +50,6 @@
&:last-child &:last-child
margin-bottom: 0 !important margin-bottom: 0 !important
code
background: $code-background !important
if $note-icons if $note-icons
&:not(.no-icon) &:not(.no-icon)
padding-left: 45px padding-left: 45px

View File

@@ -19,7 +19,7 @@
padding: 0 padding: 0
list-style: none list-style: none
@media screen and (max-width: 768px) +maxWidth768()
flex-grow: 1 flex-grow: 1
button button
@@ -53,7 +53,7 @@
display: none display: none
padding: 1.8rem 1.2rem padding: 1.8rem 1.2rem
@media screen and (max-width: 768px) +maxWidth768()
padding: 1.2rem .7rem padding: 1.2rem .7rem
&.active &.active

View File

@@ -4,6 +4,7 @@
@import 'var' @import 'var'
@import '_global/*' @import '_global/*'
@import '_highlight/highlight' @import '_highlight/highlight'
@import '_page/*'
@import '_layout/*' @import '_layout/*'
@import '_tags/*' @import '_tags/*'
@import '_mode/*' @import '_mode/*'

View File

@@ -4,19 +4,19 @@ $strong-cyan = #00c4b6
$light-orange = #FF7242 $light-orange = #FF7242
$light-red = #F47466 $light-red = #F47466
$themeColorEnable = hexo-config('theme_color') && hexo-config('theme_color.enable') $themeColorEnable = hexo-config('theme_color') && hexo-config('theme_color.enable')
$theme-color = $themeColorEnable ? convert(hexo-config('theme_color.main')) : $bright-blue $theme-color = $themeColorEnable && hexo-config('theme_color.main') ? convert(hexo-config('theme_color.main')) : $bright-blue
$theme-paginator-color = $themeColorEnable ? convert(hexo-config('theme_color.paginator')) : $strong-cyan $theme-paginator-color = $themeColorEnable && hexo-config('theme_color.paginator') ? convert(hexo-config('theme_color.paginator')) : $strong-cyan
$theme-text-selection-color = $themeColorEnable ? convert(hexo-config('theme_color.text_selection')) : $strong-cyan $theme-text-selection-color = $themeColorEnable && hexo-config('theme_color.text_selection') ? convert(hexo-config('theme_color.text_selection')) : $strong-cyan
$theme-link-color = $themeColorEnable ? convert(hexo-config('theme_color.link_color')) : $bright-blue $theme-link-color = $themeColorEnable && hexo-config('theme_color.link_color') ? convert(hexo-config('theme_color.link_color')) : $bright-blue
$theme-hr-color = $themeColorEnable ? convert(hexo-config('theme_color.hr_color')) : $bright-blue $theme-hr-color = $themeColorEnable && hexo-config('theme_color.hr_color') ? convert(hexo-config('theme_color.hr_color')) : $bright-blue
$code-foreground = $themeColorEnable ? convert(hexo-config('theme_color.code_foreground')) : $light-red $code-foreground = $themeColorEnable && hexo-config('theme_color.code_foreground') ? convert(hexo-config('theme_color.code_foreground')) : $light-red
$code-background = $themeColorEnable ? convert(hexo-config('theme_color.code_background')) : rgba(27, 31, 35, .05) $code-background = $themeColorEnable && hexo-config('theme_color.code_background') ? convert(hexo-config('theme_color.code_background')) : rgba(27, 31, 35, .05)
$theme-toc-color = $themeColorEnable ? convert(hexo-config('theme_color.toc_color')) : $strong-cyan $theme-toc-color = $themeColorEnable && hexo-config('theme_color.toc_color') ? convert(hexo-config('theme_color.toc_color')) : $strong-cyan
// font // font
$dafault-font-family = -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Lato, Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif $dafault-font-family = -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Lato, Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif
$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 = hexo-config('font.code-font') ? unquote(hexo-config('font.code-font')) : $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')) : $font-family
// hr // hr
$hrEnable = hexo-config('hr_icon') && hexo-config('hr_icon.enable') $hrEnable = hexo-config('hr_icon') && hexo-config('hr_icon.enable')
@@ -27,16 +27,14 @@ $beautifyEnable = hexo-config('beautify.enable')
$title-prefix-icon = $beautifyEnable ? hexo-config('beautify.title-prefix-icon') : '\f0c1' $title-prefix-icon = $beautifyEnable ? hexo-config('beautify.title-prefix-icon') : '\f0c1'
$title-prefix-icon-color = $beautifyEnable ? convert(hexo-config('beautify.title-prefix-icon-color')) : $light-red $title-prefix-icon-color = $beautifyEnable ? convert(hexo-config('beautify.title-prefix-icon-color')) : $light-red
// Global Variables // Global Variables
$font-size = 14px $font-size = hexo-config('font.global-font-size') ? convert(hexo-config('font.global-font-size')) : 14px
$code-font-size = hexo-config('font.code-font-size') ? convert(hexo-config('font.code-font-size')) : $font-size
$font-color = #1F2D3D $font-color = #1F2D3D
$rem = 20px $rem = 20px
$text-line-height = 2 $text-line-height = 2
$sm = 768px $web-bg = hexo-config('background') && convert(hexo-config('background'))
$bg = 1024px $index_top_img_height = hexo-config('index_top_img_height') ? convert(hexo-config('index_top_img_height')) : 100vh
$lr = 2000px $index_site_info_top = hexo-config('index_site_info_top') ? convert(hexo-config('index_site_info_top')) : 43%
$web-bg = convert(hexo-config('background'))
$index_top_img_height = convert(hexo-config('index_top_img_height')) || 100vh
$index_site_info_top = convert(hexo-config('index_site_info_top')) || 43%
// Global color & SVG // Global color & SVG
$light-blue = $theme-color $light-blue = $theme-color
$dark-black = #000000 $dark-black = #000000
@@ -52,27 +50,27 @@ $text-bg-hover = $theme-color
// code // code
$line-height-code-block = 1.6 $line-height-code-block = 1.6
$blockquote-color = #6a737d $blockquote-color = #6a737d
$blockquote-padding-color = $themeColorEnable ? convert(hexo-config('theme_color.blockquote_padding_color')) : #49B1F5 $blockquote-padding-color = $themeColorEnable && hexo-config('theme_color.blockquote_padding_color') ? convert(hexo-config('theme_color.blockquote_padding_color')) : #49B1F5
$blockquote-background-color = $themeColorEnable ? alpha(convert(hexo-config('theme_color.blockquote_background_color')), .1) : alpha($blockquote-padding-color, .1) $blockquote-background-color = $themeColorEnable && hexo-config('theme_color.blockquote_background_color') ? alpha(convert(hexo-config('theme_color.blockquote_background_color')), .1) : alpha($blockquote-padding-color, .1)
// page // page
$body-bg = #fff $body-bg = #fff
$a-link-color = #99a9bf $a-link-color = #99a9bf
$sticky-color = $light-orange $sticky-color = $light-orange
$theme-meta-color = $themeColorEnable ? 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-top = 20px
$sidebar-icon-left = $sidebar-icon-top - 4px $sidebar-icon-left = $sidebar-icon-top - 4px
$sidebar-icon-size = 16px $sidebar-icon-size = 16px
$sidebar-icon-color = #1F2D3D
$sidebar-width = 300px $sidebar-width = 300px
$sidebar-background = #f6f8fa $sidebar-background = #f6f8fa
$sidebar-active-color = #fff $sidebar-active-color = #fff
$mobile-sidebar-width = 250px $mobile-sidebar-width = 250px
// Button // Button
$button-color = #fff $button-color = #fff
$button-hover-color = $themeColorEnable ? 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
$button-bg= $theme-color $button-bg = $theme-color
$pseudo-hover = $button-hover-color $pseudo-hover = $button-hover-color
// table // table
$table-thead-bg = #99a9bf $table-thead-bg = #99a9bf
// reward // reward
@@ -80,10 +78,10 @@ $reward-pop-up-bg = #f5f5f5
$reward-pop-up-color = #858585 $reward-pop-up-color = #858585
// search // search
$search-bg = #f6f8fa $search-bg = #f6f8fa
$search-input-color= $font-black $search-input-color = $font-black
$search-color = $theme-color $search-color = $theme-color
$search-keyword-highlight = #F47466 $search-keyword-highlight = #F47466
$search-result-title= $font-black $search-result-title = $font-black
// comments // comments
$comments-switch-first-text = $bright-blue $comments-switch-first-text = $bright-blue
$comments-switch-second-text = $light-orange $comments-switch-second-text = $light-orange
@@ -102,7 +100,7 @@ $tag-hide-toggle-bg = #f0f0f0
$preloader-bg = #37474f $preloader-bg = #37474f
$preloader-word-color = #fff $preloader-word-color = #fff
// rightside // rightside
$rightside-bottom = hexo-config('rightside-bottom') is a 'unit' ? unit(hexo-config('rightside-bottom'), px) : 40px $rightside-bottom = hexo-config('rightside-bottom') ? convert(hexo-config('rightside-bottom')) : 40px
// fireworks // fireworks
$fireworks-zIndex = hexo-config('fireworks.zIndex') ? hexo-config('fireworks.zIndex') : 99999 $fireworks-zIndex = hexo-config('fireworks.zIndex') ? hexo-config('fireworks.zIndex') : 99999
// Tag Plugins - Note // Tag Plugins - Note
@@ -178,5 +176,5 @@ $tab-botton-bg = #f0f0f0
$tab-botton-color = $font-color $tab-botton-color = $font-color
$tab-button-hover-bg = darken($tab-border-color, 8) $tab-button-hover-bg = darken($tab-border-color, 8)
$tab-active-border-color = $theme-color $tab-active-border-color = $theme-color
$tab-button-active-bg= $card-bg $tab-button-active-bg = $card-bg
$tab-to-top-color = #99a9bf $tab-to-top-color = #99a9bf

View File

@@ -1,3 +1,4 @@
/** /**
* 當menu過多時自動適配避免UI錯亂 * 當menu過多時自動適配避免UI錯亂
* @param {*} n * @param {*} n
@@ -5,11 +6,12 @@
* 傳入 2 正常狀態下 * 傳入 2 正常狀態下
*/ */
const blogNameWidth = $('#blog_name').width() $(function () {
const menusWidth = $('.menus').width() const blogNameWidth = $('#site-name').width()
const sidebarWidth = $('#sidebar').width() const menusWidth = $('#menus').width()
const sidebarWidth = $('#sidebar').width() || 300
const adjustMenu = function (n) { const adjustMenu = function (n) {
const $nav = $('#nav') const $nav = $('#nav')
let t let t
if (n === 0) t = true if (n === 0) t = true
@@ -17,77 +19,67 @@ const adjustMenu = function (n) {
else t = blogNameWidth + menusWidth > $nav.width() - 30 else t = blogNameWidth + menusWidth > $nav.width() - 30
if (t) { if (t) {
$nav.find('.toggle-menu').addClass('is-visible-inline') $nav.addClass('hide-menu')
$nav.find('.menus_items').addClass('is-invisible')
$nav.find('#search_button span').addClass('is-invisible')
} else { } else {
$nav.find('.toggle-menu').removeClass('is-visible-inline') $nav.removeClass('hide-menu')
$nav.find('.menus_items').removeClass('is-invisible') }
$nav.find('#search_button span').removeClass('is-invisible')
} }
}
// 初始化header // 初始化header
const initAdjust = () => { const initAdjust = () => {
if (window.innerWidth < 768) adjustMenu(0) if (window.innerWidth < 768) adjustMenu(0)
else adjustMenu(2) else adjustMenu(2)
$('#nav').css({ opacity: '1', animation: 'headerNoOpacity 1s' }) $('#nav').css({ opacity: '1', animation: 'headerNoOpacity 1s' })
} }
/** /**
* 進入post頁sidebar處理 * 進入post頁sidebar處理
*/ */
const OpenSidebarAuto = () => { const OpenSidebarAuto = () => {
if (window.innerWidth > 1024 && $('#toggle-sidebar').hasClass('on')) { if (window.innerWidth > 1024 && $('#toggle-sidebar').hasClass('on')) {
setTimeout(function () { setTimeout(function () {
openSidebar() openSidebar()
}, 400) }, 400)
} }
} }
/** /**
* 點擊左下角箭頭,顯示sidebar * 點擊左下角箭頭,顯示sidebar
*/ */
const closeSidebar = () => { const closeSidebar = () => {
$('#sidebar').removeClass('tocOpenPc').animate({ $('#sidebar').removeClass('tocOpenPc').animate({
left: '-300px' left: '-300px'
}, 400) }, 400)
$('.menus').animate({ $('#menus').animate({
paddingRight: 0 paddingRight: 0
}, 400) }, 400)
$('#body-wrap').animate({ $('#body-wrap').animate({
paddingLeft: 0 paddingLeft: 0
}, 400) }, 400)
$('#toggle-sidebar').css({ if ($('#nav').hasClass('hide-menu')) {
transform: 'rotateZ(0deg)',
color: '#1F2D3D',
opacity: '1'
})
setTimeout(function () { setTimeout(function () {
adjustMenu(2) adjustMenu(2)
}, 400) }, 400)
} }
}
const openSidebar = () => { const openSidebar = () => {
if (!$('#nav').hasClass('hide-menu')) {
adjustMenu(1) adjustMenu(1)
}
$('#sidebar').addClass('tocOpenPc').animate({ $('#sidebar').addClass('tocOpenPc').animate({
left: 0 left: 0
}, 400) }, 400)
$('.menus').animate({ $('#menus').animate({
paddingRight: 300 paddingRight: 300
}, 400) }, 400)
$('#body-wrap').animate({ $('#body-wrap').animate({
paddingLeft: 300 paddingLeft: 300
}, 400) }, 400)
$('#toggle-sidebar').css({ }
transform: 'rotateZ(180deg)',
color: '#99a9bf',
opacity: '1'
})
}
const toggleSidebar = function () { const toggleSidebar = function () {
$('#toggle-sidebar').on('click', function () { $('#toggle-sidebar').on('click', function () {
const isOpen = $(this).hasClass('on') const isOpen = $(this).hasClass('on')
isOpen ? $(this).removeClass('on') : $(this).addClass('on') isOpen ? $(this).removeClass('on') : $(this).addClass('on')
@@ -97,15 +89,15 @@ const toggleSidebar = function () {
openSidebar() openSidebar()
} }
}) })
} }
/** /**
* 手機menu和toc按鈕點擊 * 手機menu和toc按鈕點擊
* 顯示menu和toc的sidebar * 顯示menu和toc的sidebar
*/ */
const sidebarFn = () => { const sidebarFn = () => {
const $toggleMenu = $('.toggle-menu') const $toggleMenu = $('#toggle-menu')
const $mobileSidebarMenus = $('#mobile-sidebar-menus') const $mobileSidebarMenus = $('#mobile-sidebar-menus')
const $mobileTocButton = $('#mobile-toc-button') const $mobileTocButton = $('#mobile-toc-button')
const $menuMask = $('#menu_mask') const $menuMask = $('#menu_mask')
@@ -113,7 +105,7 @@ const sidebarFn = () => {
const $sidebar = $('#sidebar') const $sidebar = $('#sidebar')
function openMobileSidebar (name) { function openMobileSidebar (name) {
sidebarPaddingR() btf.sidebarPaddingR()
$body.css('overflow', 'hidden') $body.css('overflow', 'hidden')
$menuMask.fadeIn() $menuMask.fadeIn()
@@ -167,7 +159,7 @@ const sidebarFn = () => {
}) })
const mql = window.matchMedia('(max-width: 1024px)') const mql = window.matchMedia('(max-width: 1024px)')
mql.addListener(function (ev) { mql.addListener((ev) => {
if (ev.matches) { if (ev.matches) {
if ($sidebar.hasClass('tocOpenPc')) closeSidebar() if ($sidebar.hasClass('tocOpenPc')) closeSidebar()
} else { } else {
@@ -178,35 +170,37 @@ const sidebarFn = () => {
// toc元素點擊 // toc元素點擊
$sidebar.find('.toc-link').on('click', function (e) { $sidebar.find('.toc-link').on('click', function (e) {
if (window.innerWidth <= 1024) {
closeMobileSidebar('toc')
} else {
e.preventDefault() e.preventDefault()
scrollToDest(decodeURI($(this).attr('href'))) btf.scrollToDest(decodeURI($(this).attr('href')))
if (window.innerWidth < 1024) {
closeMobileSidebar('toc')
} }
}) })
} }
/** /**
* 首頁top_img底下的箭頭 * 首頁top_img底下的箭頭
*/ */
const scrollDownInIndex = () => { const scrollDownInIndex = () => {
$('#scroll_down').on('click', function () { $('#scroll_down').on('click', function () {
scrollToDest('#content-inner') btf.scrollToDest('#content-inner')
}) })
} }
/** /**
* 代碼 * 代碼
* 只適用於Hexo默認的代碼渲染 * 只適用於Hexo默認的代碼渲染
*/ */
const addHighlightTool = function () { const addHighlightTool = function () {
const $figureHighlight = $('figure.highlight') const isHighlightCopy = GLOBAL_CONFIG.highlight.highlightCopy
const isHighlightCopy = GLOBAL_CONFIG.highlightCopy const isHighlightLang = GLOBAL_CONFIG.highlight.highlightLang
const isHighlightLang = GLOBAL_CONFIG.highlightLang
const isHighlightShrink = GLOBAL_CONFIG_SITE.isHighlightShrink const isHighlightShrink = GLOBAL_CONFIG_SITE.isHighlightShrink
const isShowTool = isHighlightCopy || isHighlightLang || isHighlightShrink !== undefined
const $figureHighlight = GLOBAL_CONFIG.highlight.plugin === 'highlighjs' ? $('figure.highlight') : $('pre[class*="language-"]')
if (isShowTool && $figureHighlight.length) {
const isPrismjs = GLOBAL_CONFIG.highlight.plugin === 'prismjs'
if ($figureHighlight.length && (isHighlightCopy || isHighlightLang || isHighlightShrink !== undefined)) {
let highlightShrinkEle = '' let highlightShrinkEle = ''
let highlightCopyEle = '' let highlightCopyEle = ''
const highlightShrinkClass = isHighlightShrink === true ? 'closed' : '' const highlightShrinkClass = isHighlightShrink === true ? 'closed' : ''
@@ -220,16 +214,26 @@ const addHighlightTool = function () {
} }
if (isHighlightLang) { if (isHighlightLang) {
let langName if (isPrismjs) {
$figureHighlight.each(function () { $figureHighlight.each(function () {
const $this = $(this) const $this = $(this)
langName = $this.attr('class').split(' ')[1] const langName = $this.attr('data-language') !== undefined ? $this.attr('data-language') : 'Code'
const highlightLangEle = `<div class="code-lang">${langName}</div>`
$this.wrap('<figure class="highlight"></figure>').before(`<div class="highlight-tools ${highlightShrinkClass}">${highlightShrinkEle + highlightLangEle + highlightCopyEle}</div>`)
})
} else {
$figureHighlight.each(function (i, o) {
const $this = $(this)
let langName = $this.attr('class').split(' ')[1]
if (langName === 'plain' || langName === undefined) langName = 'Code' if (langName === 'plain' || langName === undefined) langName = 'Code'
const highlightLangEle = `<div class="code-lang">${langName}</div>` const highlightLangEle = `<div class="code-lang">${langName}</div>`
$this.prepend(`<div class="highlight-tools ${highlightShrinkClass}">${highlightShrinkEle + highlightLangEle + highlightCopyEle}</div>`) $this.prepend(`<div class="highlight-tools ${highlightShrinkClass}">${highlightShrinkEle + highlightLangEle + highlightCopyEle}</div>`)
}) })
}
} else { } else {
$figureHighlight.prepend(`<div class="highlight-tools ${highlightShrinkClass}">${highlightShrinkEle + highlightCopyEle}</div>`) const ele = `<div class="highlight-tools ${highlightShrinkClass}">${highlightShrinkEle + highlightCopyEle}</div>`
if (isPrismjs) $figureHighlight.wrap('<figure class="highlight"></figure>').before(ele)
else $figureHighlight.prepend(ele)
} }
/** /**
@@ -237,7 +241,7 @@ const addHighlightTool = function () {
*/ */
if (isHighlightShrink !== undefined) { if (isHighlightShrink !== undefined) {
$figureHighlight.find('.highlight-tools >.expand').on('click', function () { $('.highlight-tools >.expand').on('click', function () {
const $this = $(this) const $this = $(this)
const $table = $this.parent().nextAll() const $table = $this.parent().nextAll()
$this.toggleClass('closed') $this.toggleClass('closed')
@@ -253,7 +257,7 @@ const addHighlightTool = function () {
if (document.queryCommandSupported && document.queryCommandSupported('copy')) { if (document.queryCommandSupported && document.queryCommandSupported('copy')) {
document.execCommand('copy') document.execCommand('copy')
if (GLOBAL_CONFIG.Snackbar !== undefined) { if (GLOBAL_CONFIG.Snackbar !== undefined) {
snackbarShow(GLOBAL_CONFIG.copy.success) btf.snackbarShow(GLOBAL_CONFIG.copy.success)
} else { } else {
$(ctx).prev('.copy-notice') $(ctx).prev('.copy-notice')
.text(GLOBAL_CONFIG.copy.success) .text(GLOBAL_CONFIG.copy.success)
@@ -269,7 +273,7 @@ const addHighlightTool = function () {
} }
} else { } else {
if (GLOBAL_CONFIG.Snackbar !== undefined) { if (GLOBAL_CONFIG.Snackbar !== undefined) {
snackbarShow(GLOBAL_CONFIG.copy.noSupport) btf.snackbarShow(GLOBAL_CONFIG.copy.noSupport)
} else { } else {
$(ctx).prev('.copy-notice').text(GLOBAL_CONFIG.copy.noSupport) $(ctx).prev('.copy-notice').text(GLOBAL_CONFIG.copy.noSupport)
} }
@@ -277,12 +281,13 @@ const addHighlightTool = function () {
} }
// click events // click events
$figureHighlight.find('.highlight-tools >.copy-button').on('click', function () { $('.highlight-tools >.copy-button').on('click', function () {
const $buttonParent = $(this).parents('figure.highlight') const $buttonParent = $(this).parents('figure.highlight')
$buttonParent.addClass('copy-true') $buttonParent.addClass('copy-true')
const selection = window.getSelection() const selection = window.getSelection()
const range = document.createRange() const range = document.createRange()
range.selectNodeContents($buttonParent.find('table .code pre')[0]) if (isPrismjs) range.selectNodeContents($buttonParent.find('> pre code')[0])
else range.selectNodeContents($buttonParent.find('table .code pre')[0])
selection.removeAllRanges() selection.removeAllRanges()
selection.addRange(range) selection.addRange(range)
const text = selection.toString() const text = selection.toString()
@@ -292,12 +297,12 @@ const addHighlightTool = function () {
}) })
} }
} }
} }
/** /**
* PhotoFigcaption * PhotoFigcaption
*/ */
function addPhotoFigcaption () { function addPhotoFigcaption () {
const images = $('#article-container img').not('.justified-gallery img') const images = $('#article-container img').not('.justified-gallery img')
images.each(function (i, o) { images.each(function (i, o) {
const $this = $(o) const $this = $(o)
@@ -306,14 +311,14 @@ function addPhotoFigcaption () {
$this.after(t) $this.after(t)
} }
}) })
} }
/** /**
* justified-gallery 圖庫排版 * justified-gallery 圖庫排版
*/ */
let detectJgJsLoad = false let detectJgJsLoad = false
const runJustifiedGallery = function () { const runJustifiedGallery = function () {
const $justifiedGallery = $('.justified-gallery') const $justifiedGallery = $('.justified-gallery')
if ($justifiedGallery.length) { if ($justifiedGallery.length) {
const $imgList = $justifiedGallery.find('img') const $imgList = $justifiedGallery.find('img')
@@ -325,21 +330,21 @@ const runJustifiedGallery = function () {
}) })
} }
if (detectJgJsLoad) initJustifiedGallery($justifiedGallery) if (detectJgJsLoad) btf.initJustifiedGallery($justifiedGallery)
else { else {
$('head').append(`<link rel="stylesheet" type="text/css" href="${GLOBAL_CONFIG.justifiedGallery.css}">`) $('head').append(`<link rel="stylesheet" type="text/css" href="${GLOBAL_CONFIG.justifiedGallery.css}">`)
$.getScript(`${GLOBAL_CONFIG.justifiedGallery.js}`, function () { $.getScript(`${GLOBAL_CONFIG.justifiedGallery.js}`, function () {
initJustifiedGallery($justifiedGallery) btf.initJustifiedGallery($justifiedGallery)
}) })
detectJgJsLoad = true detectJgJsLoad = true
} }
} }
} }
/** /**
* fancybox和 mediumZoom * fancybox和 mediumZoom
*/ */
const addLightBox = function () { const addLightBox = function () {
const isMediumZoom = GLOBAL_CONFIG.medium_zoom const isMediumZoom = GLOBAL_CONFIG.medium_zoom
const isFancybox = GLOBAL_CONFIG.fancybox const isFancybox = GLOBAL_CONFIG.fancybox
if (isFancybox) { if (isFancybox) {
@@ -367,19 +372,19 @@ const addLightBox = function () {
}) })
}) })
} }
} }
/** /**
* 滾動處理 * 滾動處理
*/ */
const scrollFn = function () { const scrollFn = function () {
let initTop = 0 let initTop = 0
let isChatShow = true let isChatShow = true
const $rightside = $('#rightside') const $rightside = $('#rightside')
const $nav = $('#nav') const $nav = $('#nav')
const isChatBtnHide = typeof chatBtnHide === 'function' const isChatBtnHide = typeof chatBtnHide === 'function'
const isChatBtnShow = typeof chatBtnShow === 'function' const isChatBtnShow = typeof chatBtnShow === 'function'
$(window).scroll(throttle(function (event) { $(window).scroll(btf.throttle(function (event) {
const currentTop = $(this).scrollTop() const currentTop = $(this).scrollTop()
const isDown = scrollDirection(currentTop) const isDown = scrollDirection(currentTop)
if (currentTop > 56) { if (currentTop > 56) {
@@ -414,16 +419,16 @@ const scrollFn = function () {
initTop = currentTop initTop = currentTop
return result return result
} }
} }
/** /**
* toc * toc
*/ */
const tocFn = function () { const tocFn = function () {
$('.toc-child').hide() $('.toc-child').hide()
// main of scroll // main of scroll
$(window).scroll(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)
@@ -439,16 +444,18 @@ const tocFn = function () {
} }
const scrollPercent = function (currentTop) { const scrollPercent = function (currentTop) {
const docHeight = $('#article-container').height() const $dom = $('#article-container')
const docHeight = $dom.height()
const winHeight = $(window).height() const winHeight = $(window).height()
const headerHeight = $dom.offset().top
const contentMath = (docHeight > winHeight) ? (docHeight - winHeight) : ($(document).height() - winHeight) const contentMath = (docHeight > winHeight) ? (docHeight - winHeight) : ($(document).height() - winHeight)
const scrollPercent = (currentTop) / (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
$('.progress-num').text(percentage) $('#sidebar .progress-num').text(percentage)
$('.sidebar-toc__progress-bar').animate({ $('#sidebar .sidebar-toc__progress-bar').animate({
width: percentage + '%' width: percentage + '%'
}, 100) }, 100)
} }
@@ -477,7 +484,7 @@ const tocFn = function () {
let currentId = '' let currentId = ''
list.each(function () { list.each(function () {
const head = $(this) const head = $(this)
if (top > head.offset().top - 25) { if (top > head.offset().top - 70) {
if (versionBiggerFive) currentId = '#' + encodeURI($(this).attr('id')) if (versionBiggerFive) currentId = '#' + encodeURI($(this).attr('id'))
else currentId = '#' + $(this).attr('id') else currentId = '#' + $(this).attr('id')
} }
@@ -524,47 +531,31 @@ const tocFn = function () {
} }
} }
} }
} }
/** /**
* Rightside * Rightside
*/ */
const $rightsideEle = $('#rightside') const $rightsideEle = $('#rightside')
// read-mode // read-mode
$rightsideEle.on('click', '#readmode', function () { $rightsideEle.on('click', '#readmode', function () {
$('body').toggleClass('read-mode') $('body').toggleClass('read-mode')
}) })
// font change // Switch Between Light And Dark Mode
const originFontSize = $('body').css('font-size') if ($('#darkmode').length) {
$rightsideEle.on('click', '#font_plus', () => {
const nowFontSize = parseFloat($('body').css('font-size'))
if (nowFontSize < 20) {
$('body').css('font-size', nowFontSize + 1)
}
})
$rightsideEle.on('click', '#font_minus', () => {
const nowFontSize = parseFloat($('body').css('font-size'))
if (nowFontSize > 10) {
$('body').css('font-size', nowFontSize - 1)
}
})
// Switch Between Light And Dark Mode
if ($('#darkmode').length) {
const switchReadMode = function () { const switchReadMode = function () {
const nowMode = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light' const nowMode = document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'
if (nowMode === 'light') { if (nowMode === 'light') {
activateDarkMode() activateDarkMode()
Cookies.set('theme', 'dark', 2) saveToLocal.set('theme', 'dark', 2)
GLOBAL_CONFIG.Snackbar !== undefined && snackbarShow(GLOBAL_CONFIG.Snackbar.day_to_night) GLOBAL_CONFIG.Snackbar !== undefined && btf.snackbarShow(GLOBAL_CONFIG.Snackbar.day_to_night)
} else { } else {
activateLightMode() activateLightMode()
Cookies.set('theme', 'light', 2) saveToLocal.set('theme', 'light', 2)
GLOBAL_CONFIG.Snackbar !== undefined && snackbarShow(GLOBAL_CONFIG.Snackbar.night_to_day) GLOBAL_CONFIG.Snackbar !== undefined && btf.snackbarShow(GLOBAL_CONFIG.Snackbar.night_to_day)
} }
} }
@@ -574,23 +565,23 @@ if ($('#darkmode').length) {
typeof FB === 'object' && window.loadFBComment() typeof FB === 'object' && window.loadFBComment()
window.DISQUS && $('#disqus_thread').children().length && setTimeout(() => window.disqusReset(), 200) window.DISQUS && $('#disqus_thread').children().length && setTimeout(() => window.disqusReset(), 200)
}) })
} }
// rightside 點擊設置 按鈕 展開 // rightside 點擊設置 按鈕 展開
$rightsideEle.on('click', '#rightside_config', () => $('#rightside-config-hide').toggleClass('show')) $rightsideEle.on('click', '#rightside_config', () => $('#rightside-config-hide').toggleClass('show'))
// Back to top // Back to top
$rightsideEle.on('click', '#go-up', () => scrollToDest('body')) $rightsideEle.on('click', '#go-up', () => btf.scrollToDest('body'))
/** /**
* 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 () { $('#mobile-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('closed') $(this).toggleClass('hide')
}) })
$(window).on('touchmove', function (e) { $(window).on('touchmove', function (e) {
@@ -599,12 +590,12 @@ const clickFnOfSubMenu = function () {
$menusChild.css('display', 'none') $menusChild.css('display', 'none')
} }
}) })
} }
/** /**
* 複製時加上版權信息 * 複製時加上版權信息
*/ */
const addCopyright = () => { const addCopyright = () => {
const copyright = GLOBAL_CONFIG.copyright const copyright = GLOBAL_CONFIG.copyright
document.body.oncopy = (e) => { document.body.oncopy = (e) => {
e.preventDefault() e.preventDefault()
@@ -624,33 +615,45 @@ const addCopyright = () => {
return window.clipboardData.setData('text', textFont) return window.clipboardData.setData('text', textFont)
} }
} }
} }
/** /**
* 網頁運行時間 * 網頁運行時間
*/ */
const addRuntime = () => { const addRuntime = () => {
const $runtimeCount = $('#webinfo-runtime-count') const $runtimeCount = $('#runtimeshow')
if ($runtimeCount.length) { if ($runtimeCount.length) {
const publishDate = $runtimeCount.attr('publish_date') const publishDate = $runtimeCount.attr('data-publishDate')
$runtimeCount.text(diffDate(publishDate) + ' ' + GLOBAL_CONFIG.runtime_unit) $runtimeCount.text(btf.diffDate(publishDate) + ' ' + GLOBAL_CONFIG.runtime)
}
} }
}
/** /**
* 最後一次更新時間
*/
const addLastPushDate = () => {
const $lastPushDateItem = $('#last-push-date')
if ($lastPushDateItem.length) {
const lastPushDate = $lastPushDateItem.attr('data-lastPushDate')
const diffDay = btf.diffDate(lastPushDate, true)
$lastPushDateItem.text(diffDay)
}
}
/**
* table overflow * table overflow
*/ */
const addTableWrap = function () { const addTableWrap = function () {
const $table = $('#article-container table').not($('figure.highlight > table')) const $table = $('#article-container table').not($('figure.highlight > table'))
$table.each(function () { $table.each(function () {
$(this).wrap('<div class="table-wrap"></div>') $(this).wrap('<div class="table-wrap"></div>')
}) })
} }
/** /**
* 百度推送 * 百度推送
*/ */
const pushToBaidu = () => { const pushToBaidu = () => {
const bp = document.createElement('script') const bp = document.createElement('script')
const curProtocol = window.location.protocol.split(':')[0] const curProtocol = window.location.protocol.split(':')[0]
if (curProtocol === 'https') { if (curProtocol === 'https') {
@@ -661,12 +664,12 @@ const pushToBaidu = () => {
bp.dataset.pjax = '' bp.dataset.pjax = ''
const s = document.getElementsByTagName('script')[0] const s = document.getElementsByTagName('script')[0]
s.parentNode.insertBefore(bp, s) s.parentNode.insertBefore(bp, s)
} }
/** /**
* tag-hide * tag-hide
*/ */
const clickFnOfTagHide = function () { const clickFnOfTagHide = function () {
const $hideInline = $('.hide-button') const $hideInline = $('.hide-button')
if ($hideInline.length) { if ($hideInline.length) {
$hideInline.on('click', function (e) { $hideInline.on('click', function (e) {
@@ -676,16 +679,17 @@ const clickFnOfTagHide = function () {
$hideContent.toggle() $hideContent.toggle()
if ($this.hasClass('open')) { if ($this.hasClass('open')) {
if ($hideContent.find('.justified-gallery').length > 0) { if ($hideContent.find('.justified-gallery').length > 0) {
initJustifiedGallery($hideContent.find('.justified-gallery')) btf.initJustifiedGallery($hideContent.find('.justified-gallery'))
} }
} }
}) })
} }
} }
const clickFnOfTabs = function () { const tabsFn = {
clickFnOfTabs: function () {
const $tab = $('#article-container .tabs') const $tab = $('#article-container .tabs')
$tab.find('.tab > button').on('click', function (e) { $tab.find('.tab > button:not(.tab-to-top)').on('click', function (e) {
const $this = $(this) const $this = $(this)
const $tabItem = $this.parent() const $tabItem = $this.parent()
@@ -698,23 +702,30 @@ const clickFnOfTabs = function () {
$tabContent.find(`> ${tabId}`).addClass('active') $tabContent.find(`> ${tabId}`).addClass('active')
const $isTabJustifiedGallery = $tabContent.find(tabId).find('.justified-gallery') const $isTabJustifiedGallery = $tabContent.find(tabId).find('.justified-gallery')
if ($isTabJustifiedGallery.length > 0) { if ($isTabJustifiedGallery.length > 0) {
initJustifiedGallery($isTabJustifiedGallery) btf.initJustifiedGallery($isTabJustifiedGallery)
} }
} }
}) })
} },
backToTop: () => {
const backToTopBtn = $('#article-container .tabs .tab-to-top')
backToTopBtn.on('click', function () {
btf.scrollToDest($(this).parents('.tabs'))
})
}
}
const toggleCardCategory = function () { const toggleCardCategory = function () {
const $cardCategory = $('.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) const $this = $(this)
$this.toggleClass('expand') $this.toggleClass('expand')
$this.parents('.parent').next().toggle() $this.parents('.parent').next().toggle()
}) })
} }
const switchComments = function () { const switchComments = function () {
let switchDone = false let switchDone = false
$('#switch-comments-btn').on('click', function () { $('#switch-comments-btn').on('click', function () {
$('#post-comment > .comment-wrap > div').each(function () { $('#post-comment > .comment-wrap > div').each(function () {
@@ -732,11 +743,11 @@ const switchComments = function () {
loadOtherComment() loadOtherComment()
} }
}) })
} }
const addPostOutdateNotice = function () { const addPostOutdateNotice = function () {
const data = GLOBAL_CONFIG.noticeOutdate const data = GLOBAL_CONFIG.noticeOutdate
var diffDay = diffDate(GLOBAL_CONFIG_SITE.postUpdate) var diffDay = btf.diffDate(GLOBAL_CONFIG_SITE.postUpdate)
if (diffDay >= data.limitDay) { if (diffDay >= data.limitDay) {
const code = `<div class="post-outdate-notice">${data.messagePrev + ' ' + diffDay + ' ' + data.messageNext}</div>` const code = `<div class="post-outdate-notice">${data.messagePrev + ' ' + diffDay + ' ' + data.messageNext}</div>`
if (data.position === 'top') { if (data.position === 'top') {
@@ -745,28 +756,17 @@ const addPostOutdateNotice = function () {
$('#article-container').append(code) $('#article-container').append(code)
} }
} }
} }
/** const lazyloadImg = () => {
* lazyload window.lazyLoadInstance = new LazyLoad({
*/
if (GLOBAL_CONFIG.islazyload) {
window.lazyLoadOptions = {
elements_selector: 'img', elements_selector: 'img',
threshold: 0, threshold: 0,
data_src: 'lazy-src' data_src: 'lazy-src'
})
} }
window.addEventListener(
'LazyLoad::Initialized',
function (event) {
window.lazyLoadInstance = event.detail.instance
},
false
)
}
const unRefreshFn = function () { const unRefreshFn = function () {
$(window).on('resize', function () { $(window).on('resize', function () {
if (window.innerWidth < 768) adjustMenu(0) if (window.innerWidth < 768) adjustMenu(0)
else if ($('#sidebar').hasClass('tocOpenPc') && $('#nav').hasClass('fixed')) adjustMenu(1) else if ($('#sidebar').hasClass('tocOpenPc') && $('#nav').hasClass('fixed')) adjustMenu(1)
@@ -774,11 +774,12 @@ const unRefreshFn = function () {
}) })
clickFnOfSubMenu() clickFnOfSubMenu()
GLOBAL_CONFIG.islazyload && lazyloadImg()
GLOBAL_CONFIG.copyright !== undefined && addCopyright() GLOBAL_CONFIG.copyright !== undefined && addCopyright()
GLOBAL_CONFIG.baiduPush && pushToBaidu() GLOBAL_CONFIG.baiduPush && pushToBaidu()
} }
const refreshFn = function () { window.refreshFn = function () {
initAdjust() initAdjust()
if (GLOBAL_CONFIG_SITE.isPost) { if (GLOBAL_CONFIG_SITE.isPost) {
@@ -790,20 +791,21 @@ const refreshFn = function () {
sidebarFn() sidebarFn()
GLOBAL_CONFIG_SITE.isHome && scrollDownInIndex() GLOBAL_CONFIG_SITE.isHome && scrollDownInIndex()
addHighlightTool() GLOBAL_CONFIG.highlight && addHighlightTool()
GLOBAL_CONFIG.isPhotoFigcaption && addPhotoFigcaption() GLOBAL_CONFIG.isPhotoFigcaption && addPhotoFigcaption()
runJustifiedGallery() runJustifiedGallery()
addLightBox() addLightBox()
scrollFn() scrollFn()
GLOBAL_CONFIG.runtime && addRuntime() GLOBAL_CONFIG.runtime && addRuntime()
addLastPushDate()
addTableWrap() addTableWrap()
clickFnOfTagHide() clickFnOfTagHide()
clickFnOfTabs() tabsFn.clickFnOfTabs()
tabsFn.backToTop()
toggleCardCategory() toggleCardCategory()
switchComments() switchComments()
} }
$(function () {
refreshFn() refreshFn()
unRefreshFn() unRefreshFn()
}) })

View File

@@ -15,11 +15,8 @@
} }
function l() { function l() {
var i = j("script"), var v = cn;
w = i.length,
v = i[w - 1];
return { return {
l: w,
z: o(v, "zIndex", -1), z: o(v, "zIndex", -1),
o: o(v, "opacity", 0.5), o: o(v, "opacity", 0.5),
c: o(v, "color", "0,0,0"), c: o(v, "color", "0,0,0"),
@@ -49,7 +46,6 @@
} }
var u = document.createElement("canvas"), var u = document.createElement("canvas"),
s = l(), s = l(),
c = "c_n" + s.l,
e = u.getContext("2d"), e = u.getContext("2d"),
r, n, m = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (i) { r, n, m = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (i) {
window.setTimeout(i, 1000 / 45) window.setTimeout(i, 1000 / 45)
@@ -60,7 +56,6 @@
y: null, y: null,
max: 20000 max: 20000
}; };
u.id = c;
u.style.cssText = "position:fixed;top:0;left:0;z-index:" + s.z + ";opacity:" + s.o; u.style.cssText = "position:fixed;top:0;left:0;z-index:" + s.z + ";opacity:" + s.o;
j("body")[0].appendChild(u); j("body")[0].appendChild(u);
k(), window.onresize = k; k(), window.onresize = k;

View File

@@ -9,7 +9,7 @@ if (canvasEl) {
var tap = 'mousedown' var tap = 'mousedown'
var colors = ['#FF1461', '#18FF92', '#5A87FF', '#FBF38C'] var colors = ['#FF1461', '#18FF92', '#5A87FF', '#FBF38C']
var setCanvasSize = debounce(function () { var setCanvasSize = btf.debounce(function () {
canvasEl.width = window.innerWidth canvasEl.width = window.innerWidth
canvasEl.height = window.innerHeight canvasEl.height = window.innerHeight
canvasEl.style.width = window.innerWidth + 'px' canvasEl.style.width = window.innerWidth + 'px'

View File

@@ -1,3 +1,4 @@
/* eslint-disable no-undef */
(function () { (function () {
const translate = GLOBAL_CONFIG.translate const translate = GLOBAL_CONFIG.translate
const snackbarData = GLOBAL_CONFIG.Snackbar const snackbarData = GLOBAL_CONFIG.Snackbar
@@ -8,9 +9,9 @@
let currentEncoding = defaultEncoding let currentEncoding = defaultEncoding
const targetEncodingCookie = 'translate-chn-cht' const targetEncodingCookie = 'translate-chn-cht'
let targetEncoding = let targetEncoding =
Cookies.get(targetEncodingCookie) === undefined saveToLocal.get(targetEncodingCookie) === undefined
? defaultEncoding ? defaultEncoding
: Number(Cookies.get(targetEncodingCookie)) : Number(saveToLocal.get('translate-chn-cht'))
let translateButtonObject let translateButtonObject
const isSnackbar = GLOBAL_CONFIG.Snackbar !== undefined const isSnackbar = GLOBAL_CONFIG.Snackbar !== undefined
@@ -47,16 +48,16 @@
currentEncoding = 1 currentEncoding = 1
targetEncoding = 2 targetEncoding = 2
translateButtonObject.innerHTML = msgToTraditionalChinese translateButtonObject.innerHTML = msgToTraditionalChinese
Cookies.set(targetEncodingCookie, targetEncoding, 2) saveToLocal.set(targetEncodingCookie, targetEncoding, 2)
translateBody() translateBody()
if (isSnackbar) snackbarShow(snackbarData.cht_to_chs) if (isSnackbar) btf.snackbarShow(snackbarData.cht_to_chs)
} else if (targetEncoding === 2) { } else if (targetEncoding === 2) {
currentEncoding = 2 currentEncoding = 2
targetEncoding = 1 targetEncoding = 1
translateButtonObject.innerHTML = msgToSimplifiedChinese translateButtonObject.innerHTML = msgToSimplifiedChinese
Cookies.set(targetEncodingCookie, targetEncoding, 2) saveToLocal.set(targetEncodingCookie, targetEncoding, 2)
translateBody() translateBody()
if (isSnackbar) snackbarShow(snackbarData.chs_to_cht) if (isSnackbar) btf.snackbarShow(snackbarData.chs_to_cht)
} }
} }
function JTPYStr () { function JTPYStr () {

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