mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-16 20:30:53 +08:00
Compare commits
18 Commits
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -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是否有報錯,反饋時附上你的網站
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -15,8 +15,6 @@ Based on [hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody) t
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
### GIT
|
|
||||||
|
|
||||||
Stable branch [recommend]:
|
Stable branch [recommend]:
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -29,16 +27,6 @@ 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`:
|
||||||
|
|||||||
18
README_CN.md
18
README_CN.md
@@ -16,28 +16,16 @@
|
|||||||
|
|
||||||
## 安裝
|
## 安裝
|
||||||
|
|
||||||
### 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
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## 應用主題
|
## 應用主題
|
||||||
|
|||||||
@@ -88,7 +88,6 @@
|
|||||||
script.
|
script.
|
||||||
var GLOBAL_CONFIG = {
|
var GLOBAL_CONFIG = {
|
||||||
root: '!{config.root}',
|
root: '!{config.root}',
|
||||||
hexoversion: '!{get_hexo_version()}',
|
|
||||||
algolia: !{algolia},
|
algolia: !{algolia},
|
||||||
localSearch: !{localSearch},
|
localSearch: !{localSearch},
|
||||||
translate: !{translate},
|
translate: !{translate},
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
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; }
|
||||||
@@ -13,7 +9,6 @@ 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)
|
||||||
|
|||||||
14
layout/includes/third-party/pjax.pug
vendored
14
layout/includes/third-party/pjax.pug
vendored
@@ -1,6 +1,8 @@
|
|||||||
script(src=url_for(theme.CDN.pjax))
|
script(src=url_for(theme.CDN.pjax))
|
||||||
script.
|
script.
|
||||||
let pjaxSelectors = [
|
var pjax = new Pjax({
|
||||||
|
elements: 'a:not([target="_blank"])',
|
||||||
|
selectors: [
|
||||||
'title',
|
'title',
|
||||||
'meta[name=description]',
|
'meta[name=description]',
|
||||||
'#config_change',
|
'#config_change',
|
||||||
@@ -8,15 +10,7 @@ script.
|
|||||||
'#rightside-config-hide',
|
'#rightside-config-hide',
|
||||||
'#rightside-config-show',
|
'#rightside-config-show',
|
||||||
'.js-pjax'
|
'.js-pjax'
|
||||||
]
|
],
|
||||||
|
|
||||||
if (!{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"]')
|
|
||||||
}
|
|
||||||
|
|
||||||
const pjax = new Pjax({
|
|
||||||
elements: 'a:not([target="_blank"])',
|
|
||||||
selectors: pjaxSelectors,
|
|
||||||
cacheBust: false,
|
cacheBust: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hexo-theme-butterfly",
|
"name": "hexo-theme-butterfly",
|
||||||
"version": "3.0.1",
|
"version": "3.0.0-rc2",
|
||||||
"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-marked": "^3.0.0",
|
||||||
"hexo-renderer-pug": "^1.0.0"
|
"hexo-renderer-pug": "^1.0.0"
|
||||||
},
|
},
|
||||||
"homepage": "https://demo.jerryc.me/",
|
"homepage": "https://demo.jerryc.me/",
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
hexo.on('ready', () => {
|
|
||||||
const { version } = require('../../package.json')
|
|
||||||
hexo.log.info(`
|
|
||||||
===================================================================
|
|
||||||
|
|
||||||
##### # # ##### ##### ###### ##### ###### # # #
|
|
||||||
# # # # # # # # # # # # #
|
|
||||||
##### # # # # ##### # # ##### # #
|
|
||||||
# # # # # # # ##### # # #
|
|
||||||
# # # # # # # # # # # #
|
|
||||||
##### #### # # ###### # # # ###### #
|
|
||||||
|
|
||||||
${version}
|
|
||||||
===================================================================`)
|
|
||||||
})
|
|
||||||
@@ -11,6 +11,5 @@ 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='
|
||||||
data.content = data.content.replace(/(<img.*? src=)/ig, `$1 "${bg}" data-lazy-src=`)
|
return data.content.replace(/(<img.*? src=)/ig, `$1 "${bg}" data-lazy-src=`)
|
||||||
return data
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ function randomCover () {
|
|||||||
let cover
|
let cover
|
||||||
let num
|
let num
|
||||||
|
|
||||||
if (theme.cover && theme.cover.default_cover) {
|
if (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
|
||||||
|
|||||||
@@ -61,7 +61,3 @@ hexo.extend.helper.register('urlNoIndex', function () {
|
|||||||
hexo.extend.helper.register('md5', function (path) {
|
hexo.extend.helper.register('md5', function (path) {
|
||||||
return crypto.createHash('md5').update(decodeURI(this.url_for(path))).digest('hex')
|
return crypto.createHash('md5').update(decodeURI(this.url_for(path))).digest('hex')
|
||||||
})
|
})
|
||||||
|
|
||||||
hexo.extend.helper.register('get_hexo_version', function () {
|
|
||||||
return hexo.version
|
|
||||||
})
|
|
||||||
@@ -465,7 +465,6 @@ const tocFn = function () {
|
|||||||
// DOM Hierarchy:
|
// DOM Hierarchy:
|
||||||
// ol.toc > (li.toc-item, ...)
|
// ol.toc > (li.toc-item, ...)
|
||||||
// li.toc-item > (a.toc-link, ol.toc-2child > (li.toc-item, ...))
|
// li.toc-item > (a.toc-link, ol.toc-2child > (li.toc-item, ...))
|
||||||
const versionBiggerFive = GLOBAL_CONFIG.hexoversion.split('.')[0] >= 5
|
|
||||||
const findHeadPosition = function (top) {
|
const findHeadPosition = function (top) {
|
||||||
// assume that we are not in the post page if no TOC link be found,
|
// assume that we are not in the post page if no TOC link be found,
|
||||||
// thus no need to update the status
|
// thus no need to update the status
|
||||||
@@ -478,8 +477,7 @@ const tocFn = function () {
|
|||||||
list.each(function () {
|
list.each(function () {
|
||||||
const head = $(this)
|
const head = $(this)
|
||||||
if (top > head.offset().top - 25) {
|
if (top > head.offset().top - 25) {
|
||||||
if (versionBiggerFive) currentId = '#' + encodeURI($(this).attr('id'))
|
currentId = '#' + encodeURI($(this).attr('id'))
|
||||||
else currentId = '#' + $(this).attr('id')
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user