fix: 修復當關閉代碼渲染后,標簽外挂裏的代碼塊會被壓縮到一行的bugs

improvements: 優化網站最後更新時間顯示,’0天前‘改爲’今天‘
This commit is contained in:
Jerry
2020-08-24 22:56:58 +08:00
parent 4aacafdae1
commit 40fd319cb2
14 changed files with 109 additions and 20 deletions

View File

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

View File

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

1
.github/stale.yml vendored
View File

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

View File

@@ -49,10 +49,49 @@ npm i hexo-theme-butterfly
> 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
![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

@@ -49,9 +49,49 @@ theme: butterfly
>如果你沒有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)
![image](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-1.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

@@ -70,6 +70,7 @@ aside:
unit: days
last_push_date:
name: Last Push
zero_day: Today
suffix: days ago
site_wordcount: Total Count
site_uv_name: UV

View File

@@ -70,6 +70,7 @@ aside:
unit: days
last_push_date:
name: Last Push
zero_day: Today
suffix: days ago
site_wordcount: Total Count
site_uv_name: UV

View File

@@ -72,6 +72,7 @@ aside:
unit:
last_push_date:
name: 最后更新时间
zero_day: 今天
suffix: 天前
site_wordcount: 本站总字数
site_uv_name: 本站访客数

View File

@@ -72,6 +72,7 @@ aside:
unit:
last_push_date:
name: 最後更新時間
zero_day: 今天
suffix: 天前
site_wordcount: 本站總字數
site_uv_name: 本站訪客數

View File

@@ -95,6 +95,14 @@
})
}
let last_push_date = 'undefined';
if (theme.aside.card_webinfo.last_push_date) {
last_push_date = JSON.stringify({
zeroDay: _p("aside.card_webinfo.last_push_date.zero_day"),
suffix: _p("aside.card_webinfo.last_push_date.suffix")
})
}
script.
var GLOBAL_CONFIG = {
root: '!{config.root}',
@@ -114,7 +122,7 @@ script.
message_next: '!{_p("Snackbar.bookmark.message_next")}'
},
runtime: '!{theme.runtimeshow.enable ? _p("aside.card_webinfo.runtime.unit") : ""}',
last_push_date: '!{theme.aside.card_webinfo.last_push_date ? _p("aside.card_webinfo.last_push_date.suffix") : ""}',
last_push_date: !{last_push_date},
copyright: !{copyright},
ClickShowText: !{ClickShowText},
medium_zoom: !{theme.medium_zoom},

View File

@@ -44,7 +44,7 @@ function hideBlock (args, content) {
group += '"'
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) {

View File

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

View File

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

View File

@@ -633,10 +633,12 @@ const addLastPushDate = () => {
if ($lastPushDateItem.length) {
const lastPushDate = $lastPushDateItem.attr('last-push-date')
const diffDay = diffDate(lastPushDate)
if (diffDay > 365) {
if (diffDay < 1) {
$lastPushDateItem.text(GLOBAL_CONFIG.last_push_date.zeroDay)
} else if (diffDay > 365) {
$lastPushDateItem.text(lastPushDate)
} else {
$lastPushDateItem.text(diffDay + ' ' + GLOBAL_CONFIG.last_push_date)
$lastPushDateItem.text(diffDay + ' ' + GLOBAL_CONFIG.last_push_date.suffix)
}
}
}
@@ -808,7 +810,7 @@ const refreshFn = function () {
addLightBox()
scrollFn()
GLOBAL_CONFIG.runtime && addRuntime()
GLOBAL_CONFIG.last_push_date && addLastPushDate()
GLOBAL_CONFIG.last_push_date !== undefined && addLastPushDate()
addTableWrap()
clickFnOfTagHide()
tabsFn.clickFnOfTabs()