Compare commits

...

6 Commits

Author SHA1 Message Date
Jerry
fcd430902d Merge branch 'dev' into master 2020-08-05 22:04:47 +08:00
Jerry
065093e217 🔖 3.0.0 發佈 2020-08-05 22:02:23 +08:00
Jerry
8f27859cea 🐛 修復livere在pjax下的bugs 2020-08-03 18:02:44 +08:00
Jerry
ee45f6517f Merge branch 'dev' into master 2020-08-02 23:31:32 +08:00
Jerry
75f5e991d0 🐛 修復文章頁沒有lazyload的bugs 2020-08-02 23:29:44 +08:00
Jerry
67201ac58d 📝 更改注釋文字 2020-08-01 22:47:34 +08:00
9 changed files with 62 additions and 17 deletions

View File

@@ -12,7 +12,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 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 visit the website, please open your browser 'developer tools (shortcut F12)' and check the console if there is an error, include your website address in the feedback
如果你是線上訪問出現問題請檢查瀏覽器開發人員工具快捷鍵F12的console是否有報錯反饋時附上你的網站 如果你是線上訪問出現問題請檢查瀏覽器開發人員工具快捷鍵F12的console是否有報錯反饋時附上你的網站

View File

@@ -15,6 +15,8 @@ Based on [hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody) t
## Installation ## Installation
### GIT
Stable branch [recommend]: Stable branch [recommend]:
``` ```
@@ -27,6 +29,16 @@ Dev branch:
git clone -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly git clone -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly
``` ```
### NPM
> It supports Hexo 5.0.0 or later
In Hexo site root directory
```powershell
npm i hexo-theme-butterfly
```
## Configuration ## Configuration
Set theme in the hexo work folder's root config file `_config.yml`: Set theme in the hexo work folder's root config file `_config.yml`:

View File

@@ -16,18 +16,30 @@
## 安裝 ## 安裝
在你的博客根目錄裡安裝穩定版【推薦】 ### Git 安裝
``` 在博客根目錄裡安裝穩定版【推薦】
```powershell
git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly git clone -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly
``` ```
如果想要安裝比較新的dev分支可以 如果想要安裝比較新的dev分支可以
``` ```powershell
git clone -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly git clone -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/butterfly
``` ```
### npm 安裝
> 此方法只支持Hexo 5.0.0以上版本
在博客根目錄裡
```powershell
npm i hexo-theme-butterfly
```
## 應用主題 ## 應用主題
修改hexo配置文件`_config.yml`,把主題改為`Butterfly` 修改hexo配置文件`_config.yml`,把主題改為`Butterfly`

View File

@@ -252,7 +252,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

View File

@@ -1,5 +1,9 @@
script. script.
function loadLivere () { function loadLivere () {
if (typeof LivereTower === 'object') {
window.LivereTower.init()
}
else {
(function(d, s) { (function(d, s) {
var j, e = d.getElementsByTagName(s)[0]; var j, e = d.getElementsByTagName(s)[0];
if (typeof LivereTower === 'function') { return; } if (typeof LivereTower === 'function') { return; }
@@ -9,6 +13,7 @@ script.
e.parentNode.insertBefore(j, e); e.parentNode.insertBefore(j, e);
})(document, 'script'); })(document, '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}) loadComment(document.getElementById('lv-container'), loadLivere)

View File

@@ -1,6 +1,6 @@
{ {
"name": "hexo-theme-butterfly", "name": "hexo-theme-butterfly",
"version": "3.0.0-rc2", "version": "3.0.0",
"description": "A Simple and Card UI Design theme for Hexo", "description": "A Simple and Card UI Design theme for Hexo",
"main": "package.json", "main": "package.json",
"scripts": { "scripts": {
@@ -23,7 +23,7 @@
"email": "wong@jerryc.me" "email": "wong@jerryc.me"
}, },
"dependencies": { "dependencies": {
"hexo-renderer-marked": "^3.0.0", "hexo-renderer-stylus": "^1.1.0",
"hexo-renderer-pug": "^1.0.0" "hexo-renderer-pug": "^1.0.0"
}, },
"homepage": "https://demo.jerryc.me/", "homepage": "https://demo.jerryc.me/",

15
scripts/events/log.js Normal file
View File

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

View File

@@ -11,5 +11,6 @@ const urlFor = require('hexo-util').url_for.bind(hexo)
hexo.extend.filter.register('after_post_render', data => { hexo.extend.filter.register('after_post_render', data => {
if (!hexo.theme.config.lazyload.enable) return if (!hexo.theme.config.lazyload.enable) return
const bg = hexo.theme.config.lazyload.post ? urlFor(hexo.theme.config.lazyload.post) : 'data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs=' const bg = hexo.theme.config.lazyload.post ? urlFor(hexo.theme.config.lazyload.post) : 'data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs='
return data.content.replace(/(<img.*? src=)/ig, `$1 "${bg}" data-lazy-src=`) data.content = data.content.replace(/(<img.*? src=)/ig, `$1 "${bg}" data-lazy-src=`)
return data
}) })

View File

@@ -23,7 +23,7 @@ function randomCover () {
let cover let cover
let num let num
if (theme.cover.default_cover) { if (theme.cover && theme.cover.default_cover) {
if (!Array.isArray(theme.cover.default_cover)) { if (!Array.isArray(theme.cover.default_cover)) {
cover = theme.cover.default_cover cover = theme.cover.default_cover
return cover return cover