🏷️ 2.3.0發佈

This commit is contained in:
Jerry
2020-04-26 23:29:38 +08:00
parent 796b8e6df4
commit 0d56db50e4
16 changed files with 127 additions and 87 deletions

View File

@@ -1,13 +1,11 @@
# hexo-theme-butterfly # hexo-theme-butterfly
<a href="https://github.com/jerryc127/hexo-theme-butterfly/releases"><img alt="Version" src="https://img.shields.io/badge/release-2.2.5-blue"/></a> <a href="https://github.com/jerryc127/hexo-theme-butterfly/releases"><img alt="Version" src="https://img.shields.io/badge/release-2.3.0-blue"/></a>
<a href="https://jerryc.me"><img alt="Author" src="https://img.shields.io/badge/author-JerryC-blur"/></a> <a href="https://jerryc.me"><img alt="Author" src="https://img.shields.io/badge/author-JerryC-blur"/></a>
<a href="https://hexo.io"><img alt="Hexo" src="https://img.shields.io/badge/hexo-4.0+-0e83c"/></a> <a href="https://hexo.io"><img alt="Hexo" src="https://img.shields.io/badge/hexo-4.0+-0e83c"/></a>
<a href="https://nodejs.org/"><img alt="node.js" src="https://img.shields.io/badge/node.js-8.0+-blur"/></a> <a href="https://nodejs.org/"><img alt="node.js" src="https://img.shields.io/badge/node.js-8.0+-blur"/></a>
Demo: https://demo.jerryc.me/ Demo: 👍 [Butterfly](https://demo.jerryc.me/) || 🤞 [JerryC](https://jerryc.me/)
JerryC: https://jerryc.me/
Based on [hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody) theme. Based on [hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody) theme.

View File

@@ -1,14 +1,11 @@
# hexo-theme-butterfly # hexo-theme-butterfly
<a href="https://github.com/jerryc127/hexo-theme-butterfly/releases"><img alt="Version" src="https://img.shields.io/badge/release-2.2.5-blue"/></a> <a href="https://github.com/jerryc127/hexo-theme-butterfly/releases"><img alt="Version" src="https://img.shields.io/badge/release-2.3.0-blue"/></a>
<a href="https://jerryc.me"><img alt="Author" src="https://img.shields.io/badge/author-JerryC-blur"/></a> <a href="https://jerryc.me"><img alt="Author" src="https://img.shields.io/badge/author-JerryC-blur"/></a>
<a href="https://hexo.io"><img alt="Hexo" src="https://img.shields.io/badge/hexo-4.0+-0e83c"/></a> <a href="https://hexo.io"><img alt="Hexo" src="https://img.shields.io/badge/hexo-4.0+-0e83c"/></a>
<a href="https://nodejs.org/"><img alt="node.js" src="https://img.shields.io/badge/node.js-8.0+-blur"/></a> <a href="https://nodejs.org/"><img alt="node.js" src="https://img.shields.io/badge/node.js-8.0+-blur"/></a>
Demo: https://demo.jerryc.me/ Demo: 👍 [Butterfly](https://demo.jerryc.me/) || 🤞 [JerryC](https://jerryc.me/)
JerryC: https://jerryc.me/
一款基於[hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody)修改的主題 一款基於[hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody)修改的主題

View File

@@ -221,7 +221,7 @@ addtoany:
disqus: disqus:
enable: false enable: false
shortname: shortname:
count: false # top_img顯示評論數 count: false # dispaly comment count in top_img
# Disqus.js版評論系統應對大陸長城的折中方案兼容原版https://github.com/SukkaW/DisqusJS # Disqus.js版評論系統應對大陸長城的折中方案兼容原版https://github.com/SukkaW/DisqusJS
# API 申請地址https://disqus.com/api/applications/ # API 申請地址https://disqus.com/api/applications/
@@ -234,7 +234,7 @@ disqusjs:
api: https://disqus.skk.moe/disqus/ #一般情況下無需修改 API 地址 api: https://disqus.skk.moe/disqus/ #一般情況下無需修改 API 地址
admin: admin:
adminLabel: adminLabel:
count: true # top_img顯示評論數 count: false # dispaly comment count in top_img
laibili: laibili:
enable: false enable: false
@@ -252,7 +252,7 @@ gitalk:
distractionFreeMode: false # Facebook-like distraction free mode. distractionFreeMode: false # Facebook-like distraction free mode.
pagerDirection: last # Comment sorting direction, available values are last and first. pagerDirection: last # Comment sorting direction, available values are last and first.
createIssueManually: false # Gitalk will create a corresponding github issue for your every single page automatically createIssueManually: false # Gitalk will create a corresponding github issue for your every single page automatically
count: true # top_img顯示評論數 count: false # dispaly comment count in top_img
# valine comment system. https://valine.js.org # valine comment system. https://valine.js.org
valine: valine:
@@ -269,8 +269,10 @@ valine:
recordIP: false # Record reviewer IP recordIP: false # Record reviewer IP
serverURLs: # This configuration is suitable for domestic custom domain name users, overseas version will be automatically detected (no need to manually fill in) serverURLs: # This configuration is suitable for domestic custom domain name users, overseas version will be automatically detected (no need to manually fill in)
emojiCDN: # emoji CDN emojiCDN: # emoji CDN
enableQQ: false # enable the Nickname box to automatically get QQ Nickname and QQ Avatar
requiredFields: nick,mail # required fields nick/mail/link
bg: /img/comment_bg.png # valine background bg: /img/comment_bg.png # valine background
count: true # top_img顯示評論數 count: false # dispaly comment count in top_img
# utterances # utterances
# https://utteranc.es/ # https://utteranc.es/
@@ -292,7 +294,7 @@ facebook_comments:
pageSize: 10 # The number of comments to show pageSize: 10 # The number of comments to show
order_by: social # social/time/reverse_time order_by: social # social/time/reverse_time
lang: en_US # Language en_US/zh_CN/zh_TW and so on lang: en_US # Language en_US/zh_CN/zh_TW and so on
count: true count: false
##### Footer Settings #### ##### Footer Settings ####
# ------------------------------------ # ------------------------------------
@@ -463,8 +465,9 @@ click_heart:
ClickShowText: ClickShowText:
enable: false enable: false
text: text:
- 本人 - I
- 超帥 - LOVE
- YOU
fontSize: 15px fontSize: 15px
# 網站顯示模式 # 網站顯示模式

View File

@@ -5,11 +5,17 @@ if site.data.valine
#vcomment.vcomment #vcomment.vcomment
script(src=url_for(theme.CDN.valine)) script(src=url_for(theme.CDN.valine))
script. script.
var GUEST_INFO = ['nick','mail','link']; var requestSetting = function (from,set) {
var guest_info = '#{ theme.valine.guest_info }'.split(',').filter(function(item){ var from = from
return GUEST_INFO.indexOf(item) > -1 var setting = set.split(',').filter(function(item){
return from.indexOf(item) > -1
}); });
guest_info = guest_info.length == 0 ? GUEST_INFO :guest_info; setting = setting.length == 0 ? from :setting;
return setting
}
var guestInfo = requestSetting(['nick','mail','link'],'#{ theme.valine.guest_info }')
var requiredFields = requestSetting(['nick','mail','link'],'#{ theme.valine.requiredFields }')
window.valine = new Valine({ window.valine = new Valine({
el:'#vcomment', el:'#vcomment',
@@ -19,11 +25,13 @@ script.
verify: #{theme.valine.verify}, verify: #{theme.valine.verify},
placeholder: '#{theme.valine.placeholder}', placeholder: '#{theme.valine.placeholder}',
avatar: '#{theme.valine.avatar}', avatar: '#{theme.valine.avatar}',
meta: guest_info, meta: guestInfo,
pageSize: '#{theme.valine.pageSize}', pageSize: '#{theme.valine.pageSize}',
lang: '#{theme.valine.lang}', lang: '#{theme.valine.lang}',
recordIP: #{theme.valine.recordIP}, recordIP: #{theme.valine.recordIP},
serverURLs: '#{theme.valine.serverURLs}', serverURLs: '#{theme.valine.serverURLs}',
emojiCDN: '#{theme.valine.emojiCDN}', emojiCDN: '#{theme.valine.emojiCDN}',
emojiMaps: !{emojiMaps} emojiMaps: !{emojiMaps},
enableQQ: #{theme.valine.enableQQ},
requiredFields: requiredFields
}); });

View File

@@ -1,16 +1,22 @@
link(rel="preconnect" href="//cdn.jsdelivr.net") link(rel="preconnect" href="//cdn.jsdelivr.net")
link(rel="dns-prefetch" href="//cdn.jsdelivr.net")
if theme.google_analytics if theme.google_analytics
link(rel="preconnect" href="https://www.google-analytics.com" crossorigin) link(rel="preconnect" href="https://www.google-analytics.com" crossorigin)
link(rel="dns-prefetch" href="https://www.google-analytics.com")
if theme.baidu_analytics if theme.baidu_analytics
link(rel="preconnect" href="https://hm.baidu.com") link(rel="preconnect" href="https://hm.baidu.com")
link(rel="dns-prefetch" href="https://hm.baidu.com")
if theme.tencent_analytics if theme.tencent_analytics
link(rel="preconnect" href="http://ta.qq.com") link(rel="preconnect" href="http://ta.qq.com")
link(rel="dns-prefetch" href="http://ta.qq.com")
if theme.blog_title_font.font_link if theme.blog_title_font.font_link
link(rel="preconnect" href="https://fonts.googleapis.com" crossorigin) link(rel="preconnect" href="https://fonts.googleapis.com" crossorigin)
link(rel="dns-prefetch" href="https://fonts.googleapis.com")
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
link(rel="preconnect" href="//busuanzi.ibruce.info") link(rel="preconnect" href="//busuanzi.ibruce.info")
link(rel="dns-prefetch" href="//busuanzi.ibruce.info")

View File

@@ -11,7 +11,7 @@ mixin articleSort(posts)
if article.cover && theme.cover.archives_enable if article.cover && theme.cover.archives_enable
.article-sort-img .article-sort-img
a.article-sort-item__img(href=url_for(article.path)) a.article-sort-item__img(href=url_for(article.path))
img(src=article.cover alt=article.title || 'No Title' onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'`) img(src=`${article.cover}` alt=article.title || 'No Title' onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'`)
.article-sort-post .article-sort-post
a.article-sort-item__post(href=url_for(article.path)) a.article-sort-item__post(href=url_for(article.path))
i.fa.fa-clock-o(aria-hidden="true") i.fa.fa-clock-o(aria-hidden="true")

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(site.tags,16,22,tagLimit) .card-tag-cloud!=cloudTags({source: site.tags, minfontsize: 16, maxfontsize: 22, limit: tagLimit})
else else
.card-tag-cloud!= tagcloud({min_font: 16, max_font: 24, amount: tagLimit , color: true, start_color: '#999', end_color: '#99a9bf'}) .card-tag-cloud!= tagcloud({min_font: 16, max_font: 22, amount: tagLimit , color: true, start_color: '#999', end_color: '#99a9bf'})

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(site.tags,15,30,0) !=cloudTags({source: site.tags, minfontsize: 15, maxfontsize: 30, limit: 0})
if page.comments !== false if page.comments !== false
include includes/comments/index.pug include includes/comments/index.pug
else if page.type === 'link' else if page.type === 'link'

View File

@@ -1,6 +1,6 @@
{ {
"name": "hexo-theme-butterfly", "name": "hexo-theme-butterfly",
"version": "2.2.5", "version": "2.3.0",
"private": true, "private": true,
"engines": { "engines": {
"node": ">=8.10.0" "node": ">=8.10.0"

View File

@@ -67,7 +67,7 @@ hexo.extend.helper.register('aside_archives', function (options = {}) {
return this.url_for(url) return this.url_for(url)
} }
result += '<ul class="archive-list">' result += '<ul class="card-archive-list">'
const len = data.length const len = data.length
const Judge = limit === 0 ? len : Math.min(len, limit) const Judge = limit === 0 ? len : Math.min(len, limit)
@@ -75,23 +75,24 @@ hexo.extend.helper.register('aside_archives', function (options = {}) {
for (let i = 0; i < Judge; i++) { for (let i = 0; i < Judge; i++) {
const item = data[i] const item = data[i]
result += '<li class="archive-list-item">' result += '<li class="card-archive-list-item">'
result += `<a class="archive-list-link" href="${link(item)}">` result += `<a class="card-archive-list-link" href="${link(item)}">`
result += '<span class="archive-list-date">' result += '<span class="card-archive-list-date">'
result += transform ? transform(item.name) : item.name result += transform ? transform(item.name) : item.name
result += '</span>' result += '</span>'
if (showCount) { if (showCount) {
result += `<span class="archive-list-count">${item.count}</span>` result += `<span class="card-archive-list-count">${item.count}</span>`
} }
result += '</a>' result += '</a>'
result += '</li>' result += '</li>'
} }
if (len > Judge) { if (len > Judge) {
result += '<li class="archive-list-item is-center">' result += '<li class="card-archive-list-item more is-center">'
result += `<a class="archive-list-link-more" href="${this.url_for(archiveDir)}">${moreButton}</a></li>` result += `<a class="card-archive-list-link-more" href="${this.url_for(archiveDir)}">
<span>${moreButton}</span><i class="fa fa-angle-right" aria-hidden="true"></i></a></li>`
} }
result += '</ul>' result += '</ul>'
return result return result

View File

@@ -6,7 +6,10 @@
'use strict' 'use strict'
hexo.extend.helper.register('aside_categories', function (categories, options) { hexo.extend.helper.register('aside_categories', function (categories, options) {
if (!options && (!categories || !Object.prototype.hasOwnProperty.call(categories, 'length'))) { if (
!options &&
(!categories || !Object.prototype.hasOwnProperty.call(categories, 'length'))
) {
options = categories options = categories
categories = this.site.categories categories = this.site.categories
} }
@@ -14,23 +17,28 @@ hexo.extend.helper.register('aside_categories', function (categories, options) {
if (!categories || !categories.length) return '' if (!categories || !categories.length) return ''
options = options || {} options = options || {}
const { config } = this const { config } = this
const showCount = Object.prototype.hasOwnProperty.call(options, 'show_count') ? options.show_count : true const showCount = Object.prototype.hasOwnProperty.call(options, 'show_count')
? options.show_count
: true
const depth = options.depth ? parseInt(options.depth, 10) : 0 const depth = options.depth ? parseInt(options.depth, 10) : 0
const orderby = options.orderby || 'name' const orderby = options.orderby || 'name'
const order = options.order || 1 const order = options.order || 1
const categoryDir = this.url_for(config.category_dir) const categoryDir = this.url_for(config.category_dir)
const limit = options.limit === 0 ? categories.length : options.limit const limit = options.limit === 0 ? categories.length : options.limit
const buttonLabel = this._p('aside.more_button') const buttonLabel = this._p('aside.more_button')
const prepareQuery = parent => { const prepareQuery = (parent) => {
const query = {} const query = {}
if (parent) { if (parent) {
query.parent = parent query.parent = parent
} else { } else {
query.parent = { query.parent = {
$exists: false $exists: false,
} }
} }
return categories.find(query).sort(orderby, order).filter(cat => cat.length) return categories
.find(query)
.sort(orderby, order)
.filter((cat) => cat.length)
} }
const hierarchicalList = (t, level, parent) => { const hierarchicalList = (t, level, parent) => {
@@ -46,20 +54,22 @@ hexo.extend.helper.register('aside_categories', function (categories, options) {
t = childList[1] t = childList[1]
} }
result += '<li class="aside-category-list-item">' result += '<li class="card-category-list-item">'
result += `<a class="aside-category-list-link" href="${this.url_for(cat.path)}">` result += `<a class="card-category-list-link" href="${this.url_for(
result += `<span class="aside-category-list-name">${cat.name}</span>` cat.path
)}">`
result += `<span class="card-category-list-name">${cat.name}</span>`
if (showCount) { if (showCount) {
result += `<span class="aside-category-list-count">${cat.length}</span>` result += `<span class="card-category-list-count">${cat.length}</span>`
} }
result += '</a>' result += '</a>'
result += '</li>' result += '</li>'
if (child) { if (child) {
result += `<ul class="aside-category-list child">${child}</ul>` result += `<ul class="card-category-list child">${child}</ul>`
} }
} }
}) })
@@ -73,14 +83,14 @@ hexo.extend.helper.register('aside_categories', function (categories, options) {
var moreButton = function () { var moreButton = function () {
var moreHtml = '' var moreHtml = ''
if (categories.length <= limit) return '' if (categories.length <= limit) return ''
moreHtml += '<li class="aside-category-list-item is-center">' moreHtml += '<li class="card-category-list-item more is-center">'
moreHtml += `<a class="aside-category-list-item-more" href="${categoryDir}" >` moreHtml += `<a class="card-category-list-link-more" href="${categoryDir}">
moreHtml += buttonLabel <span>${buttonLabel}</span><i class="fa fa-angle-right" aria-hidden="true"></i></a></li>`
moreHtml += '</a></li>'
return moreHtml return moreHtml
} }
return `<ul class="aside-category-list"> return `<ul class="card-category-list">
${list[0]} ${list[0]}
${moreButton()} ${moreButton()}
</ul>` </ul>`

View File

@@ -31,8 +31,13 @@ hexo.extend.helper.register('injectHtml', function (data) {
return result return result
}) })
hexo.extend.helper.register('cloudTags', function (source, minfontsize, maxfontsize, limit) { hexo.extend.helper.register('cloudTags', function (options = {}) {
const env = this const env = this
const source = options.source
const minfontsize = options.minfontsize
const maxfontsize = options.maxfontsize
const limit = options.limit || 8
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) {

View File

@@ -192,6 +192,10 @@ img:not([src])
.img-alt .img-alt
margin: -.5rem 0 .5rem margin: -.5rem 0 .5rem
color: $font-black
&:hover
text-decoration: none !important
// hexo tag video // hexo tag video
.video-container .video-container

View File

@@ -147,20 +147,20 @@
.aside-post_title .aside-post_title
height: auto height: auto
.card-archives ul.archive-list, .card-archives ul.card-archive-list,
.card-categories ul.aside-category-list .card-categories ul.card-category-list
margin: 0 margin: 0
padding: .2rem 0 0 padding: .2rem 0 0
list-style: none list-style: none
.card-archives ul.archive-list > .archive-list-item, .card-archives ul.card-archive-list > .card-archive-list-item,
.card-categories ul.aside-category-list > .aside-category-list-item .card-categories ul.card-category-list > .card-category-list-item
padding: .2rem 1rem padding: .15rem 1rem
cursor: pointer cursor: pointer
transition: all .3s transition: all .5s
&:hover &:hover
padding: .2rem .85rem padding: .15rem .85rem
background-color: $light-blue background-color: $light-blue
a a
@@ -180,8 +180,18 @@
width: 20% width: 20%
text-align: right text-align: right
&.more
span
padding-right: .3rem
width: auto !important
transition: .5s
&:hover
span
padding-right: .6rem
.card-categories .card-categories
.aside-category-list .card-category-list
&.child &.child
padding: 0 0 0 1.2rem padding: 0 0 0 1.2rem

View File

@@ -159,8 +159,8 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
border-top: 13px solid lighten(#121212, 10) !important border-top: 13px solid lighten(#121212, 10) !important
.md-links-item:before, .md-links-item:before,
.aside-category-list-item:hover, .card-category-list-item:hover,
.archive-list-item:hover, .card-archive-list-item:hover,
#bookmark-it #bookmark-it
background-color: lighten(#121212, 10) !important background-color: lighten(#121212, 10) !important
@@ -177,11 +177,11 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
.headline, .headline,
.length_num, .length_num,
.aside-post_title, .aside-post_title,
.aside-category-list-link, .card-category-list-link,
.archive-list-link, .card-archive-list-link,
.social-icon, .social-icon,
.aside-category-list-item-more, .card-category-list-link-more,
.archive-list-link-more .card-archive-list-link-more
color: alpha(#FFFFFF, .6) !important color: alpha(#FFFFFF, .6) !important
.button--animated:before .button--animated:before
@@ -190,7 +190,8 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
#post-meta, #post-meta,
#post-meta a, #post-meta a,
#footer-wrap, #footer-wrap,
#footer-wrap a #footer-wrap a,
.img-alt
color: alpha(#FFFFFF, .6) !important color: alpha(#FFFFFF, .6) !important
.posttitle, .posttitle,
@@ -286,9 +287,6 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
if hexo-config('valine') && hexo-config('valine.enable') if hexo-config('valine') && hexo-config('valine.enable')
#vcomment #vcomment
.vsys
background: #2c2c2c !important
.vbtn, .vbtn,
.vat .vat
border: 1px solid alpha(#FFFFFF, .6) border: 1px solid alpha(#FFFFFF, .6)

View File

@@ -362,6 +362,21 @@ $(function () {
} }
} }
/**
* PhotoFigcaption
*/
function addPhotoFigcaption () {
var images = $('#article-container img')
images.each(function (i, o) {
var $this = $(o)
if ($this.attr('alt')) {
var t = $('<div class="img-alt is-center">' + $this.attr('alt') + '</div>')
$this.after(t)
}
})
}
if (GLOBAL_CONFIG.isPhotoFigcaption) addPhotoFigcaption()
/** /**
* justified-gallery 圖庫排版 * justified-gallery 圖庫排版
*/ */
@@ -518,8 +533,8 @@ $(function () {
} }
var updateAnchor = function (anchor) { var updateAnchor = function (anchor) {
if (window.history.replaceState && anchor !== window.location.hash) { if (anchor !== window.location.hash) {
window.history.replaceState(undefined, undefined, anchor) location.replace(window.location.href.split('#')[0] + anchor)
} }
} }
@@ -758,19 +773,4 @@ $(function () {
} }
}) })
} }
/**
* PhotoFigcaption
*/
function addPhotoFigcaption () {
var images = $('#article-container img')
images.each(function (i, o) {
var $this = $(o)
if ($this.attr('alt')) {
var t = $('<div class="img-alt is-center">' + $this.attr('alt') + '</div>')
$this.after(t)
}
})
}
if (GLOBAL_CONFIG.isPhotoFigcaption) addPhotoFigcaption()
}) })