Skip to content

Commit

Permalink
🏷️ 2.3.0發佈
Browse files Browse the repository at this point in the history
  • Loading branch information
jerryc127 committed Apr 26, 2020
1 parent 796b8e6 commit 0d56db5
Show file tree
Hide file tree
Showing 16 changed files with 127 additions and 87 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# 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://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>

Demo: https://demo.jerryc.me/

JerryC: https://jerryc.me/
Demo: 👍 [Butterfly](https://demo.jerryc.me/) || 🤞 [JerryC](https://jerryc.me/)

Based on [hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody) theme.

Expand Down
7 changes: 2 additions & 5 deletions README_CN.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# 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://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>

Demo: https://demo.jerryc.me/

JerryC: https://jerryc.me/

Demo: 👍 [Butterfly](https://demo.jerryc.me/) || 🤞 [JerryC](https://jerryc.me/)

一款基於[hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody)修改的主題

Expand Down
19 changes: 11 additions & 8 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ addtoany:
disqus:
enable: false
shortname:
count: false # top_img顯示評論數
count: false # dispaly comment count in top_img

# Disqus.js版評論系統,應對大陸長城的折中方案,兼容原版:https://github.com/SukkaW/DisqusJS
# API 申請地址:https://disqus.com/api/applications/
Expand All @@ -234,7 +234,7 @@ disqusjs:
api: https://disqus.skk.moe/disqus/ #一般情況下無需修改 API 地址
admin:
adminLabel:
count: true # top_img顯示評論數
count: false # dispaly comment count in top_img

laibili:
enable: false
Expand All @@ -252,7 +252,7 @@ gitalk:
distractionFreeMode: false # Facebook-like distraction free mode.
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
count: true # top_img顯示評論數
count: false # dispaly comment count in top_img

# valine comment system. https://valine.js.org
valine:
Expand All @@ -268,9 +268,11 @@ valine:
guest_info: nick,mail,link #valine comment header info
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)
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
count: true # top_img顯示評論數
count: false # dispaly comment count in top_img

# utterances
# https://utteranc.es/
Expand All @@ -292,7 +294,7 @@ facebook_comments:
pageSize: 10 # The number of comments to show
order_by: social # social/time/reverse_time
lang: en_US # Language en_US/zh_CN/zh_TW and so on
count: true
count: false

##### Footer Settings ####
# ------------------------------------
Expand Down Expand Up @@ -463,8 +465,9 @@ click_heart:
ClickShowText:
enable: false
text:
- 本人
- 超帥
- I
- LOVE
- YOU
fontSize: 15px

# 網站顯示模式
Expand Down
22 changes: 15 additions & 7 deletions layout/includes/comments/valine.pug
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ if site.data.valine
#vcomment.vcomment
script(src=url_for(theme.CDN.valine))
script.
var GUEST_INFO = ['nick','mail','link'];
var guest_info = '#{ theme.valine.guest_info }'.split(',').filter(function(item){
return GUEST_INFO.indexOf(item) > -1
});
guest_info = guest_info.length == 0 ? GUEST_INFO :guest_info;
var requestSetting = function (from,set) {
var from = from
var setting = set.split(',').filter(function(item){
return from.indexOf(item) > -1
});
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({
el:'#vcomment',
Expand All @@ -19,11 +25,13 @@ script.
verify: #{theme.valine.verify},
placeholder: '#{theme.valine.placeholder}',
avatar: '#{theme.valine.avatar}',
meta: guest_info,
meta: guestInfo,
pageSize: '#{theme.valine.pageSize}',
lang: '#{theme.valine.lang}',
recordIP: #{theme.valine.recordIP},
serverURLs: '#{theme.valine.serverURLs}',
emojiCDN: '#{theme.valine.emojiCDN}',
emojiMaps: !{emojiMaps}
emojiMaps: !{emojiMaps},
enableQQ: #{theme.valine.enableQQ},
requiredFields: requiredFields
});
6 changes: 6 additions & 0 deletions layout/includes/head/dns_prefetch.pug
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
link(rel="preconnect" href="//cdn.jsdelivr.net")
link(rel="dns-prefetch" href="//cdn.jsdelivr.net")

if theme.google_analytics
link(rel="preconnect" href="https://www.google-analytics.com" crossorigin)
link(rel="dns-prefetch" href="https://www.google-analytics.com")

if theme.baidu_analytics
link(rel="preconnect" href="https://hm.baidu.com")
link(rel="dns-prefetch" href="https://hm.baidu.com")

if theme.tencent_analytics
link(rel="preconnect" href="http://ta.qq.com")
link(rel="dns-prefetch" href="http://ta.qq.com")

if theme.blog_title_font.font_link
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
link(rel="preconnect" href="//busuanzi.ibruce.info")
link(rel="dns-prefetch" href="//busuanzi.ibruce.info")
2 changes: 1 addition & 1 deletion layout/includes/mixins/article-sort.pug
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mixin articleSort(posts)
if article.cover && theme.cover.archives_enable
.article-sort-img
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
a.article-sort-item__post(href=url_for(article.path))
i.fa.fa-clock-o(aria-hidden="true")
Expand Down
4 changes: 2 additions & 2 deletions layout/includes/widget/card_tags.pug
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ if site.tags.length

- let tagLimit = theme.aside.card_tags.limit === 0 ? 0 : theme.aside.card_tags.limit || 40
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
.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'})
2 changes: 1 addition & 1 deletion layout/page.pug
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ block content
| -
span.tag-cloud__amount= site.tags.length
.tag-cloud-tags
!=cloudTags(site.tags,15,30,0)
!=cloudTags({source: site.tags, minfontsize: 15, maxfontsize: 30, limit: 0})
if page.comments !== false
include includes/comments/index.pug
else if page.type === 'link'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hexo-theme-butterfly",
"version": "2.2.5",
"version": "2.3.0",
"private": true,
"engines": {
"node": ">=8.10.0"
Expand Down
15 changes: 8 additions & 7 deletions scripts/helpers/aside_archives.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,31 +67,32 @@ hexo.extend.helper.register('aside_archives', function (options = {}) {
return this.url_for(url)
}

result += '<ul class="archive-list">'
result += '<ul class="card-archive-list">'

const len = data.length
const Judge = limit === 0 ? len : Math.min(len, limit)

for (let i = 0; i < Judge; 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 += '<span class="archive-list-date">'
result += `<a class="card-archive-list-link" href="${link(item)}">`
result += '<span class="card-archive-list-date">'
result += transform ? transform(item.name) : item.name
result += '</span>'

if (showCount) {
result += `<span class="archive-list-count">${item.count}</span>`
result += `<span class="card-archive-list-count">${item.count}</span>`
}
result += '</a>'
result += '</li>'
}

if (len > Judge) {
result += '<li class="archive-list-item is-center">'
result += `<a class="archive-list-link-more" href="${this.url_for(archiveDir)}">${moreButton}</a></li>`
result += '<li class="card-archive-list-item more is-center">'
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>'
return result
Expand Down
40 changes: 25 additions & 15 deletions scripts/helpers/aside_categories.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,39 @@
'use strict'

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
categories = this.site.categories
}

if (!categories || !categories.length) return ''
options = options || {}
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 orderby = options.orderby || 'name'
const order = options.order || 1
const categoryDir = this.url_for(config.category_dir)
const limit = options.limit === 0 ? categories.length : options.limit
const buttonLabel = this._p('aside.more_button')
const prepareQuery = parent => {
const prepareQuery = (parent) => {
const query = {}
if (parent) {
query.parent = parent
} else {
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) => {
Expand All @@ -46,20 +54,22 @@ hexo.extend.helper.register('aside_categories', function (categories, options) {
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 += `<span class="aside-category-list-name">${cat.name}</span>`
result += `<a class="card-category-list-link" href="${this.url_for(
cat.path
)}">`
result += `<span class="card-category-list-name">${cat.name}</span>`

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 += '</li>'

if (child) {
result += `<ul class="aside-category-list child">${child}</ul>`
result += `<ul class="card-category-list child">${child}</ul>`
}
}
})
Expand All @@ -73,14 +83,14 @@ hexo.extend.helper.register('aside_categories', function (categories, options) {
var moreButton = function () {
var moreHtml = ''
if (categories.length <= limit) return ''
moreHtml += '<li class="aside-category-list-item is-center">'
moreHtml += `<a class="aside-category-list-item-more" href="${categoryDir}" >`
moreHtml += buttonLabel
moreHtml += '</a></li>'
moreHtml += '<li class="card-category-list-item more is-center">'
moreHtml += `<a class="card-category-list-link-more" href="${categoryDir}">
<span>${buttonLabel}</span><i class="fa fa-angle-right" aria-hidden="true"></i></a></li>`

return moreHtml
}

return `<ul class="aside-category-list">
return `<ul class="card-category-list">
${list[0]}
${moreButton()}
</ul>`
Expand Down
7 changes: 6 additions & 1 deletion scripts/helpers/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ hexo.extend.helper.register('injectHtml', function (data) {
return result
})

hexo.extend.helper.register('cloudTags', function (source, minfontsize, maxfontsize, limit) {
hexo.extend.helper.register('cloudTags', function (options = {}) {
const env = this
const source = options.source
const minfontsize = options.minfontsize
const maxfontsize = options.maxfontsize
const limit = options.limit || 8

let result = ''
const tagLimit = limit === 0 ? source.length : limit
source.sort('name').limit(tagLimit).forEach(function (tags) {
Expand Down
4 changes: 4 additions & 0 deletions source/css/_global/index.styl
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ img:not([src])

.img-alt
margin: -.5rem 0 .5rem
color: $font-black

&:hover
text-decoration: none !important

// hexo tag video
.video-container
Expand Down
26 changes: 18 additions & 8 deletions source/css/_layout/aside.styl
Original file line number Diff line number Diff line change
Expand Up @@ -147,20 +147,20 @@
.aside-post_title
height: auto

.card-archives ul.archive-list,
.card-categories ul.aside-category-list
.card-archives ul.card-archive-list,
.card-categories ul.card-category-list
margin: 0
padding: .2rem 0 0
list-style: none

.card-archives ul.archive-list > .archive-list-item,
.card-categories ul.aside-category-list > .aside-category-list-item
padding: .2rem 1rem
.card-archives ul.card-archive-list > .card-archive-list-item,
.card-categories ul.card-category-list > .card-category-list-item
padding: .15rem 1rem
cursor: pointer
transition: all .3s
transition: all .5s

&:hover
padding: .2rem .85rem
padding: .15rem .85rem
background-color: $light-blue

a
Expand All @@ -180,8 +180,18 @@
width: 20%
text-align: right

&.more
span
padding-right: .3rem
width: auto !important
transition: .5s

&:hover
span
padding-right: .6rem

.card-categories
.aside-category-list
.card-category-list
&.child
padding: 0 0 0 1.2rem

Expand Down
Loading

0 comments on commit 0d56db5

Please sign in to comment.