From 04e36c8d8ae0d38b0d7b5820360b9f5ba74d1c99 Mon Sep 17 00:00:00 2001 From: Jerry Date: Mon, 10 Apr 2023 16:45:45 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=99=BC=E4=BD=88=204.8.0=20feat:=20?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A=E7=BE=A9=20giscus=20?= =?UTF-8?q?=E8=A9=95=E8=AB=96=E7=B3=BB=E7=B5=B1=E7=9A=84=20JS=20=E5=9C=B0?= =?UTF-8?q?=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 417 +++++++++--------- .../includes/third-party/comments/giscus.pug | 26 +- package.json | 2 +- plugins.yml | 16 +- source/css/_layout/third-party.styl | 2 +- 5 files changed, 233 insertions(+), 230 deletions(-) diff --git a/_config.yml b/_config.yml index 57d523a46..3ab28660b 100644 --- a/_config.yml +++ b/_config.yml @@ -1,7 +1,13 @@ -# Main menu navigation (導航目錄) -# see https://butterfly.js.org/posts/4aa8abbe/#導航菜單 +# Navigation bar settings (導航欄設置) +# see https://butterfly.js.org/posts/4aa8abbe/##導航欄設置-Navigation-bar-settings # -------------------------------------- +nav: + logo: # image + display_title: true + fixed: false # fixed navigation bar + +# Menu 目錄 menu: # Home: / || fas fa-home # Archives: /archives/ || fas fa-archive @@ -13,11 +19,6 @@ menu: # Link: /link/ || fas fa-link # About: /about/ || fas fa-heart -nav: - logo: # image - display_title: true - fixed: false # fixed navigation bar - # Code Blocks (代碼相關) # -------------------------------------- @@ -28,68 +29,13 @@ highlight_shrink: false # true: shrink the code blocks / false: expand the code highlight_height_limit: false # unit: px code_word_wrap: false -# copy settings -# copyright: Add the copyright information after copied content (複製的內容後面加上版權信息) -copy: - enable: true - copyright: - enable: false - limit_count: 50 - -# social settings (社交圖標設置) +# Social Settings (社交圖標設置) # formal: # icon: link || the description || color social: # fab fa-github: https://github.com/xxxxx || Github || '#24292e' # fas fa-envelope: mailto:xxxxxx@gmail.com || Email || '#4a7dbe' -# search (搜索) -# see https://butterfly.js.org/posts/ceeb73f/#搜索系統 -# -------------------------------------- - -# Algolia search -algolia_search: - enable: false - hits: - per_page: 6 - -# Local search -local_search: - enable: false - # Preload the search data when the page loads. - preload: false - # Show top n results per article, show all results by setting to -1 - top_n_per_article: 1 - # Unescape html strings to the readable one. - unescape: false - CDN: - -# Docsearch -docsearch: - enable: false - appId: - apiKey: - indexName: - option: - -# Math (數學) -# -------------------------------------- -# About the per_page -# if you set it to true, it will load mathjax/katex script in each page (true 表示每一頁都加載js) -# if you set it to false, it will load mathjax/katex script according to your setting (add the 'mathjax: true' in page's front-matter) -# (false 需要時加載,須在使用的 Markdown Front-matter 加上 mathjax: true) - -# MathJax -mathjax: - enable: false - per_page: false - -# KaTeX -katex: - enable: false - per_page: false - hide_scrollbar: true - # Image (圖片設置) # -------------------------------------- @@ -168,14 +114,6 @@ post_meta: tags: true # true or false 文章頁是否顯示標籤 label: true # true or false 顯示描述性文字 -# wordcount (字數統計) -# see https://butterfly.js.org/posts/ceeb73f/#字數統計 -wordcount: - enable: false - post_wordcount: true - min2read: true - total_wordcount: true - # Display the article introduction on homepage # 1: description # 2: both (if the description exists, it will show description, or show the auto_excerpt) @@ -193,6 +131,17 @@ anchor: icon: # the unicode value of Font Awesome icon, such as '\3423' auto_update: false # when you scroll in post, the URL will update according to header id. +# figcaption (圖片描述文字) +photofigcaption: false + +# copy settings +# copyright: Add the copyright information after copied content (複製的內容後面加上版權信息) +copy: + enable: true + copyright: + enable: false + limit_count: 50 + # Post # -------------------------------------- @@ -237,9 +186,6 @@ related_post: limit: 6 # Number of posts displayed date_type: created # or created or updated 文章日期顯示創建日或者更新日 -# figcaption (圖片描述文字) -photofigcaption: false - # post_pagination (分頁) # value: 1 || 2 || false # 1: The 'next post' will link to old post @@ -256,7 +202,180 @@ noticeOutdate: message_prev: It has been message_next: days since the last update, the content of the article may be outdated. -# Share System (分享功能) +# Footer Settings +# -------------------------------------- +footer: + owner: + enable: true + since: 2020 + custom_text: + copyright: true # Copyright of theme and framework + +# aside (側邊欄) +# -------------------------------------- + +aside: + enable: true + hide: false + button: true + mobile: true # display on mobile + position: right # left or right + display: + archive: true + tag: true + category: true + card_author: + enable: true + description: + button: + enable: true + icon: fab fa-github + text: Follow Me + link: https://github.com/xxxxxx + card_announcement: + enable: true + content: This is my Blog + card_recent_post: + enable: true + limit: 5 # if set 0 will show all + sort: date # date or updated + sort_order: # Don't modify the setting unless you know how it works + card_categories: + enable: true + limit: 8 # if set 0 will show all + expand: none # none/true/false + sort_order: # Don't modify the setting unless you know how it works + card_tags: + enable: true + limit: 40 # if set 0 will show all + color: false + orderby: random # Order of tags, random/name/length + order: 1 # Sort of order. 1, asc for ascending; -1, desc for descending + sort_order: # Don't modify the setting unless you know how it works + card_archives: + enable: true + type: monthly # yearly or monthly + format: MMMM YYYY # eg: YYYY年MM月 + order: -1 # Sort of order. 1, asc for ascending; -1, desc for descending + limit: 8 # if set 0 will show all + sort_order: # Don't modify the setting unless you know how it works + card_webinfo: + enable: true + post_count: true + last_push_date: true + sort_order: # Don't modify the setting unless you know how it works + +# busuanzi count for PV / UV in site +# 訪問人數 +busuanzi: + site_uv: true + site_pv: true + page_pv: true + +# Time difference between publish date and now (網頁運行時間) +# Formal: Month/Day/Year Time or Year/Month/Day Time +runtimeshow: + enable: false + publish_date: + +# Aside widget - Newest Comments +newest_comments: + enable: false + sort_order: # Don't modify the setting unless you know how it works + limit: 6 + storage: 10 # unit: mins, save data to localStorage + avatar: true + +# Bottom right button (右下角按鈕) +# -------------------------------------- + +# Conversion between Traditional and Simplified Chinese (簡繁轉換) +translate: + enable: false + # The text of a button + default: 繁 + # the language of website (1 - Traditional Chinese/ 2 - Simplified Chinese) + defaultEncoding: 2 + # Time delay + translateDelay: 0 + # The text of the button when the language is Simplified Chinese + msgToTraditionalChinese: '繁' + # The text of the button when the language is Traditional Chinese + msgToSimplifiedChinese: '簡' + +# Read Mode (閲讀模式) +readmode: true + +# dark mode +darkmode: + enable: true + # Toggle Button to switch dark/light mode + button: true + # Switch dark/light mode automatically (自動切換 dark mode和 light mode) + # autoChangeMode: 1 Following System Settings, if the system doesn't support dark mode, it will switch dark mode between 6 pm to 6 am + # autoChangeMode: 2 Switch dark mode between 6 pm to 6 am + # autoChangeMode: false + autoChangeMode: false + +# show scroll percent in scroll-to-top button +rightside_scroll_percent: false + +# Don't modify the following settings unless you know how they work (非必要請不要修改 ) +# Choose: readmode,translate,darkmode,hideAside,toc,chat,comment +# Don't repeat 不要重複 +rightside_item_order: + enable: false + hide: # readmode,translate,darkmode,hideAside + show: # toc,chat,comment + +# Math (數學) +# -------------------------------------- +# About the per_page +# if you set it to true, it will load mathjax/katex script in each page (true 表示每一頁都加載js) +# if you set it to false, it will load mathjax/katex script according to your setting (add the 'mathjax: true' in page's front-matter) +# (false 需要時加載,須在使用的 Markdown Front-matter 加上 mathjax: true) + +# MathJax +mathjax: + enable: false + per_page: false + +# KaTeX +katex: + enable: false + per_page: false + hide_scrollbar: true + +# search (搜索) +# see https://butterfly.js.org/posts/ceeb73f/#搜索系統 +# -------------------------------------- + +# Algolia search +algolia_search: + enable: false + hits: + per_page: 6 + +# Local search +local_search: + enable: false + # Preload the search data when the page loads. + preload: false + # Show top n results per article, show all results by setting to -1 + top_n_per_article: 1 + # Unescape html strings to the readable one. + unescape: false + CDN: + +# Docsearch +docsearch: + enable: false + appId: + apiKey: + indexName: + option: + +# Share System (分享) # -------------------------------------- # AddThis @@ -433,15 +552,6 @@ messenger: pageID: lang: zh_TW # Language en_US/zh_CN/zh_TW and so on -# Footer Settings -# -------------------------------------- -footer: - owner: - enable: true - since: 2020 - custom_text: - copyright: true # Copyright of theme and framework - # Analysis # -------------------------------------- @@ -538,6 +648,14 @@ rightside-bottom: # Enter transitions (開啓網頁進入效果) enter_transitions: true +# Typewriter Effect (打字效果) +# https://github.com/disjukr/activate-power-mode +activate_power_mode: + enable: false + colorful: true # open particle animation (冒光特效) + shake: true # open shake (抖動特效) + mobile: false + # Background effects (背景特效) # -------------------------------------- @@ -566,14 +684,6 @@ canvas_nest: count: 99 # the number of lines, default: 99. mobile: false -# Typewriter Effect (打字效果) -# https://github.com/disjukr/activate-power-mode -activate_power_mode: - enable: false - colorful: true # open particle animation (冒光特效) - shake: true # open shake (抖動特效) - mobile: false - # Mouse click effects: fireworks (鼠標點擊效果: 煙火特效) fireworks: enable: false @@ -655,122 +765,13 @@ preloader: # pace theme (see https://codebyzach.github.io/pace/) pace_css_url: -# aside (側邊欄) -# -------------------------------------- - -aside: - enable: true - hide: false - button: true - mobile: true # display on mobile - position: right # left or right - display: - archive: true - tag: true - category: true - card_author: - enable: true - description: - button: - enable: true - icon: fab fa-github - text: Follow Me - link: https://github.com/xxxxxx - card_announcement: - enable: true - content: This is my Blog - card_recent_post: - enable: true - limit: 5 # if set 0 will show all - sort: date # date or updated - sort_order: # Don't modify the setting unless you know how it works - card_categories: - enable: true - limit: 8 # if set 0 will show all - expand: none # none/true/false - sort_order: # Don't modify the setting unless you know how it works - card_tags: - enable: true - limit: 40 # if set 0 will show all - color: false - orderby: random # Order of tags, random/name/length - order: 1 # Sort of order. 1, asc for ascending; -1, desc for descending - sort_order: # Don't modify the setting unless you know how it works - card_archives: - enable: true - type: monthly # yearly or monthly - format: MMMM YYYY # eg: YYYY年MM月 - order: -1 # Sort of order. 1, asc for ascending; -1, desc for descending - limit: 8 # if set 0 will show all - sort_order: # Don't modify the setting unless you know how it works - card_webinfo: - enable: true - post_count: true - last_push_date: true - sort_order: # Don't modify the setting unless you know how it works - -# busuanzi count for PV / UV in site -# 訪問人數 -busuanzi: - site_uv: true - site_pv: true - page_pv: true - -# Time difference between publish date and now (網頁運行時間) -# Formal: Month/Day/Year Time or Year/Month/Day Time -runtimeshow: - enable: false - publish_date: - -# Aside widget - Newest Comments -newest_comments: - enable: false - sort_order: # Don't modify the setting unless you know how it works - limit: 6 - storage: 10 # unit: mins, save data to localStorage - avatar: true - -# Bottom right button (右下角按鈕) -# -------------------------------------- - -# Conversion between Traditional and Simplified Chinese (簡繁轉換) -translate: - enable: false - # The text of a button - default: 繁 - # the language of website (1 - Traditional Chinese/ 2 - Simplified Chinese) - defaultEncoding: 2 - # Time delay - translateDelay: 0 - # The text of the button when the language is Simplified Chinese - msgToTraditionalChinese: '繁' - # The text of the button when the language is Traditional Chinese - msgToSimplifiedChinese: '簡' - -# Read Mode (閲讀模式) -readmode: true - -# dark mode -darkmode: - enable: true - # Toggle Button to switch dark/light mode - button: true - # Switch dark/light mode automatically (自動切換 dark mode和 light mode) - # autoChangeMode: 1 Following System Settings, if the system doesn't support dark mode, it will switch dark mode between 6 pm to 6 am - # autoChangeMode: 2 Switch dark mode between 6 pm to 6 am - # autoChangeMode: false - autoChangeMode: false - -# show scroll percent in scroll-to-top button -rightside_scroll_percent: false - -# Don't modify the following settings unless you know how they work (非必要請不要修改 ) -# Choose: readmode,translate,darkmode,hideAside,toc,chat,comment -# Don't repeat 不要重複 -rightside_item_order: +# wordcount (字數統計) +# see https://butterfly.js.org/posts/ceeb73f/#字數統計 +wordcount: enable: false - hide: # readmode,translate,darkmode,hideAside - show: # toc,chat,comment + post_wordcount: true + min2read: true + total_wordcount: true # Lightbox (圖片大圖查看模式) # -------------------------------------- @@ -789,7 +790,6 @@ fancybox: true # abcjs (樂譜渲染) # See https://github.com/paulrosen/abcjs -# --------------- abcjs: enable: false per_page: true @@ -940,6 +940,7 @@ CDN: # twikoo: # waline_js: # waline_css: + # giscus: # sharejs: # sharejs_css: # mathjax: diff --git a/layout/includes/third-party/comments/giscus.pug b/layout/includes/third-party/comments/giscus.pug index df195680d..cad50aed4 100644 --- a/layout/includes/third-party/comments/giscus.pug +++ b/layout/includes/third-party/comments/giscus.pug @@ -1,16 +1,20 @@ -- const { repo, repo_id, category_id, option } = theme.giscus -- const themes = theme.giscus.theme +- const { repo, repo_id, category_id, theme:themes, option } = theme.giscus +- const giscusUrl = theme.asset.giscus || 'https://giscus.app/client.js' +- const giscusOriginUrl = new URL(giscusUrl).origin + script. - function loadGiscus () { - let nowTheme = document.documentElement.getAttribute('data-theme') === 'dark' ? '!{themes.dark}' : '!{themes.light}' + function getGiscusTheme () { + return document.documentElement.getAttribute('data-theme') === 'dark' ? '!{themes.dark}' : '!{themes.light}' + } + function loadGiscus () { const config = Object.assign({ - src: 'https://giscus.app/client.js', + src: '!{giscusUrl}', 'data-repo': '!{repo}', 'data-repo-id': '!{repo_id}', 'data-category-id': '!{category_id}', 'data-mapping': 'pathname', - 'data-theme': nowTheme, + 'data-theme': getGiscusTheme(), 'data-reactions-enabled': '1', crossorigin: 'anonymous', async: true @@ -24,17 +28,15 @@ script. } function changeGiscusTheme () { - const theme = document.documentElement.getAttribute('data-theme') === 'dark' ? '!{themes.dark}' : '!{themes.light}' - function sendMessage(message) { - const iframe = document.querySelector('iframe.giscus-frame'); - if (!iframe) return; - iframe.contentWindow.postMessage({ giscus: message }, 'https://giscus.app'); + const iframe = document.querySelector('iframe.giscus-frame') + if (!iframe) return + iframe.contentWindow.postMessage({ giscus: message }, '!{giscusOriginUrl}') } sendMessage({ setConfig: { - theme: theme + theme: getGiscusTheme() } }); } diff --git a/package.json b/package.json index 424a615bc..f1f176396 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "4.8.0-b2", + "version": "4.8.0", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { diff --git a/plugins.yml b/plugins.yml index bac25dac6..e1ce2f8ec 100644 --- a/plugins.yml +++ b/plugins.yml @@ -1,11 +1,11 @@ algolia_search: name: algoliasearch file: dist/algoliasearch-lite.umd.js - version: 4.16.0 + version: 4.17.0 instantsearch: name: instantsearch.js file: dist/instantsearch.production.min.js - version: 4.53.0 + version: 4.54.0 pjax: name: pjax file: pjax.min.js @@ -37,7 +37,7 @@ disqusjs_css: twikoo: name: twikoo file: dist/twikoo.all.min.js - version: 1.6.11 + version: 1.6.14 waline_js: name: '@waline/client' file: dist/waline.js @@ -121,12 +121,12 @@ pangu: fancybox_css: name: '@fancyapps/ui' file: dist/fancybox/fancybox.css - version: 5.0.14 + version: 5.0.15 other_name: fancyapps-ui fancybox: name: '@fancyapps/ui' file: dist/fancybox/fancybox.umd.js - version: 5.0.14 + version: 5.0.15 other_name: fancyapps-ui medium_zoom: name: medium-zoom @@ -183,11 +183,11 @@ prismjs_autoloader: artalk_js: name: artalk file: dist/Artalk.js - version: 2.5.2 + version: 2.5.4 artalk_css: name: artalk file: dist/Artalk.css - version: 2.5.2 + version: 2.5.4 pace_js: name: pace-js other_name: pace @@ -211,4 +211,4 @@ docsearch_css: abcjs_basic_js: name: abcjs file: dist/abcjs-basic-min.js - version: 6.2.0 \ No newline at end of file + version: 6.2.0 diff --git a/source/css/_layout/third-party.styl b/source/css/_layout/third-party.styl index 97efacee2..1ea63e9d9 100644 --- a/source/css/_layout/third-party.styl +++ b/source/css/_layout/third-party.styl @@ -122,7 +122,7 @@ span.mathjax-overflow &.abcjs-container opacity: 1 - + +maxWidth768() .fancybox__toolbar__column.is-middle display: none