🔖 2.2.5發佈

更新内容請看 https://github.com/jerryc127/hexo-theme-butterfly/releases
This commit is contained in:
Jerry
2020-03-28 03:13:30 +08:00
Unverified
parent 0ba52293a2
commit 16a3ac510d
35 changed files with 322 additions and 350 deletions

View File

@@ -62,4 +62,4 @@ if theme.mermaid.enable
include ./math/mermaid.pug
if is_home()
include index-js.pug
include ./head/subtitle.pug

View File

@@ -1,16 +1,19 @@
- var pageTitle = page.title || config.title || ''
- var pageTitle
- if (is_archive()) pageTitle = _p('page.archives')
- if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag
- if (is_category()) pageTitle = _p('page.category') + ': ' + page.category
- if (is_month()) pageTitle += ': ' + page.month + '/' + page.year
- if (is_year()) pageTitle += ': ' + page.year
- else if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag
- else if (is_category()) pageTitle = _p('page.category') + ': ' + page.category
- else if (is_month()) pageTitle += ': ' + page.month + '/' + page.year
- else if (is_year()) pageTitle += ': ' + page.year
- else if (is_current('/404.html', [strict])) pageTitle = _p('error_title')
- else pageTitle = page.title || config.title || ''
- var isSubtitle = config.subtitle ? ' - ' + config.subtitle : ''
- var tabTitle = is_home() || !pageTitle ? config.title + isSubtitle : pageTitle + ' | ' + config.title
- pageTitle ? '' : pageTitle = config.title || ''
- var pageDescription = page.description || page.title || config.description
- var pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords
- var pageKeywords
- if (page.tags && page.tags.data) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',')
- else pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords
- var pageAuthor = config.email ? config.author + ',' + config.email : config.author
- var pageCopyright = config.copyright || config.author
- var without_html = url.replace('index.html', '')
@@ -97,4 +100,6 @@ if theme.blog_title_font.font_link
//- global config
!=partial('includes/head/config', {}, {cache:theme.fragment_cache})
include ./head/config_site.pug
include ./head/noscript.pug

View File

@@ -42,7 +42,7 @@
copyright = JSON.stringify({
languages: {
author: _p("copy_copyright.author") + ': ' + config.author,
link: _p("copy_copyright.link") + ': ' + without_html,
link: _p("copy_copyright.link") + ': ',
source: _p("copy_copyright.source") + ': ' + config.title,
info: _p("copy_copyright.info")
}
@@ -62,7 +62,6 @@
if (theme.snackbar && theme.snackbar.enable) {
Snackbar = JSON.stringify({
bookmark: {
title: _p("Snackbar.bookmark.title"),
message_prev: _p("Snackbar.bookmark.message_prev"),
message_next: _p("Snackbar.bookmark.message_next")
},
@@ -76,16 +75,6 @@
})
}
var highlightCopy = theme.highlight_copy
var highlightLang = theme.highlight_lang
var highlightShrink = theme.highlight_shrink
var runtime = theme.runtimeshow.enable
var fancybox = theme.fancybox.enable
var medium_zoom = theme.medium_zoom.enable
var baiduPush = theme.baidu_push && theme.baidu_push.enable
var isFontAwesomeV5 = theme.fontawesome_v5 && theme.fontawesome_v5.enable
script.
var GLOBAL_CONFIG = {
root: '!{config.root}',
@@ -98,22 +87,22 @@ script.
noSupport: '!{_p("copy.noSupport")}'
},
bookmark: {
title: '!{_p("Snackbar.bookmark.title")}',
message_prev: '!{_p("Snackbar.bookmark.message_prev")}',
message_next: '!{_p("Snackbar.bookmark.message_next")}'
},
runtime_unit: '!{_p("runtime_unit")}',
runtime: !{runtime},
runtime: !{theme.runtimeshow.enable},
copyright: !{copyright},
ClickShowText: !{ClickShowText},
medium_zoom: !{medium_zoom},
fancybox: !{fancybox},
medium_zoom: !{theme.medium_zoom.enable},
fancybox: !{theme.fancybox.enable},
Snackbar: !{Snackbar},
baiduPush: !{baiduPush},
highlightCopy: !{highlightCopy},
highlightLang: !{highlightLang},
highlightShrink: !{highlightShrink},
isFontAwesomeV5: !{isFontAwesomeV5}
baiduPush: !{theme.baidu_push && theme.baidu_push.enable},
highlightCopy: !{theme.highlight_copy},
highlightLang: !{theme.highlight_lang},
highlightShrink: '!{theme.highlight_shrink}',
isFontAwesomeV5: !{theme.fontawesome_v5 && theme.fontawesome_v5.enable},
isPhotoFigcaption: !{theme.photofigcaption}
}

View File

@@ -1,6 +1,7 @@
script.
var GLOBAL_CONFIG_SITE = {
isPost: !{is_post()},
isHome: !{is_home()}
}
isHome: !{is_home()},
isSidebar: !{is_post() && page.toc !== false && theme.toc.enable && (toc(page.content) !== '' || page.encrypt == true )}
}

View File

@@ -1,20 +1,20 @@
script.
const autoChangeMode = '#{theme.darkmode.autoChangeMode}'
var autoChangeMode = '#{theme.darkmode.autoChangeMode}'
var t = Cookies.get("theme")
if (autoChangeMode == '1'){
const isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches
const isLightMode = window.matchMedia("(prefers-color-scheme: light)").matches
const isNotSpecified = window.matchMedia("(prefers-color-scheme: no-preference)").matches
const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
var isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches
var isLightMode = window.matchMedia("(prefers-color-scheme: light)").matches
var isNotSpecified = window.matchMedia("(prefers-color-scheme: no-preference)").matches
var hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
if (t === undefined){
if (isLightMode) activateLightMode()
else if (isDarkMode) activateDarkMode()
else if (isNotSpecified || hasNoSupport){
console.log('You specified no preference for a color scheme or your browser does not support it. I Schedule dark mode during night time.')
now = new Date();
hour = now.getHours();
isNight = hour < 6 || hour >= 18
var now = new Date()
var hour = now.getHours()
var isNight = hour < 6 || hour >= 18
isNight ? activateDarkMode() : activateLightMode()
}
} else if (t == 'light') activateLightMode()

View File

@@ -0,0 +1,9 @@
noscript.
<style>
#page-header {
opacity: 1
}
.justified-gallery img{
opacity: 1
}
</style>

View File

@@ -1,22 +1,22 @@
if theme.subtitle.enable
- let source = theme.subtitle.source
- let subtitleEffect = theme.subtitle.effect
- var source = theme.subtitle.source
- var subtitleEffect = theme.subtitle.effect
if subtitleEffect
script(src=url_for(theme.CDN.typed))
if source == '1'
script.
let subtitleEffect = !{subtitleEffect}
var subtitleEffect = !{subtitleEffect}
fetch('https://api.ooopn.com/ciba/api.php',)
.then(function (res){
return res.json();
})
.then(function (data) {
if (subtitleEffect){
let sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
let both = sub.unshift(data['ciba-en'],data.ciba)
let typed = new Typed("#subtitle", {
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
var both = sub.unshift(data['ciba-en'],data.ciba)
var typed = new Typed("#subtitle", {
strings: sub,
startDelay: 300,
typeSpeed: 150,
@@ -33,17 +33,17 @@ if theme.subtitle.enable
else if source == '2'
script.
let subtitleEffect = !{subtitleEffect}
var subtitleEffect = !{subtitleEffect}
fetch('https://v1.hitokoto.cn')
.then(function (res){
return res.json();
})
.then(function (data) {
if (subtitleEffect){
let from = '出自 ' + data.from
let sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
let both = sub.unshift(data.hitokoto,from)
let typed = new Typed("#subtitle", {
var from = '出自 ' + data.from
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
var both = sub.unshift(data.hitokoto,from)
var typed = new Typed("#subtitle", {
strings: sub,
startDelay: 300,
typeSpeed: 150,
@@ -61,13 +61,13 @@ if theme.subtitle.enable
else if source == "3"
script(type="text/javascript" src="http://yijuzhan.com/api/word.php?m=js")
script.
let subtitleEffect = !{subtitleEffect}
let con = str[0];
var subtitleEffect = !{subtitleEffect}
var con = str[0];
if (subtitleEffect){
let from = "出自 " + str[1];
let sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
let both = sub.unshift(con,from)
let typed = new Typed("#subtitle", {
var from = "出自 " + str[1];
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
var both = sub.unshift(con,from)
var typed = new Typed("#subtitle", {
strings: sub,
startDelay: 300,
typeSpeed: 150,
@@ -81,13 +81,13 @@ if theme.subtitle.enable
else if source == '4'
script(type="text/javascript" src="https://sdk.jinrishici.com/v2/browser/jinrishici.js" charset="utf-8")
script.
let subtitleEffect = !{subtitleEffect}
var subtitleEffect = !{subtitleEffect}
jinrishici.load(function(result) {
if (subtitleEffect){
let sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
let content = result.data.content;
let both = sub.unshift(content)
let typed = new Typed("#subtitle", {
var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(",");
var content = result.data.content;
var both = sub.unshift(content)
var typed = new Typed("#subtitle", {
strings: sub,
startDelay: 300,
typeSpeed: 150,
@@ -102,9 +102,9 @@ if theme.subtitle.enable
else
- var subtitle = theme.subtitle.sub[0]
script.
let subtitleEffect = !{subtitleEffect}
var subtitleEffect = !{subtitleEffect}
if (subtitleEffect){
let typed = new Typed("#subtitle", {
var typed = new Typed("#subtitle", {
strings: '!{theme.subtitle.sub}'.split(","),
startDelay: 300,
typeSpeed: 150,

View File

@@ -1,15 +1,18 @@
#page-header
span#blog_name.pull_left
a#site-name.blog_title(href=url_for('/')) #[=config.title]
span.toggle-menu.pull_right.close
a.site-page
i.fa.fa-bars.fa-fw(aria-hidden="true")
span.pull_right.menus
if (theme.algolia_search.enable || theme.local_search && theme.local_search.enable)
#search_button
a.site-page.social-icon.search
i.fa.fa-search.fa-fw
span=' '+_p('search')
.menus_items
include ./menu_item.pug
if (theme.algolia_search.enable || theme.local_search && theme.local_search.enable)
span#search_button.pull_right
a.site-page.social-icon.search
i.fa.fa-search.fa-fw
span=' '+_p('search')
span.toggle-menu.close
a.site-page
i.fa.fa-bars.fa-fw(aria-hidden="true")

View File

@@ -33,9 +33,7 @@ if theme.douban
span#subtitle
if(theme.social)
#site_social_icons
each url, icon in theme.social
a.social-icon(href=url target="_blank")
i(class=icon aria-hidden="true")
!=partial('includes/header/social', {}, {cache:theme.fragment_cache})
#scroll_down
i.fa.fa-angle-down.scroll-down-effects
else if is_post()

View File

@@ -7,17 +7,19 @@
if (theme.post_meta.post.date_type)
if (theme.post_meta.post.date_type === 'both')
time.post-meta__date
i.fa.fa-calendar(aria-hidden="true")
=' '+_p('post.created')+' '+date(page.date, config.date_format)
span.post-meta__date-created(title= _p('post.created')+' '+full_date(page.date))
i.fa.fa-calendar(aria-hidden="true")
=' '+_p('post.created')+' '+date(page.date, config.date_format)
span.post-meta__separator |
i.fa.fa-history(aria-hidden="true")
=' '+_p('post.updated')+' '+date(page.updated, config.date_format)
span.post-meta__date-updated(title= _p('post.updated')+' '+full_date(page.updated))
i.fa.fa-history(aria-hidden="true")
=' '+_p('post.updated')+' '+date(page.updated, config.date_format)
else
- var data_type_update = theme.post_meta.post.date_type === 'updated'
- var date_type = data_type_update ? 'updated' : 'date'
- var date_icon = data_type_update ? 'fa-history' :'fa-calendar'
- var data_info = data_type_update ? _p('post.updated') : _p('post.created')
time.post-meta__date
time.post-meta__date(title=data_info + ' ' + full_date(page[date_type]))
i.fa(class=date_icon aria-hidden="true")
=' ' + data_info + ' ' + date(page[date_type], config.date_format)
@@ -33,7 +35,7 @@
i.fa.fa-angle-right.post-meta__separator(aria-hidden="true")
.meta-secondline
- let postWordcount = theme.wordcount.post_wordcount || theme.wordcount.min2read
- let postWordcount = theme.wordcount.enable && (theme.wordcount.post_wordcount || theme.wordcount.min2read)
if (postWordcount)
span.post-meta-wordcount
if theme.wordcount.post_wordcount

View File

@@ -0,0 +1,4 @@
each url, icon in theme.social
a.social-icon(href=trim(url.split('||')[0]) target="_blank"
title=url.split('||')[1] === undefined ? '' : trim(url.split('||')[1]))
i(class=icon aria-hidden="true")

View File

@@ -1,5 +1,4 @@
- var hideAside = !theme.aside.enable || page.aside === false ? 'hide-aside' : ''
- var autoOpenSidebar = theme.auto_open_sidebar.enable === true ? 'on' : ''
doctype html
html(lang=config.language data-theme=theme.display_mode)
@@ -8,10 +7,11 @@ html(lang=config.language data-theme=theme.display_mode)
body
if theme.fireworks && theme.fireworks.enable
canvas.fireworks
!=partial('includes/mobile-sidebar/index', {}, {cache:theme.fragment_cache})
if (is_post() && page.toc != false && theme.toc.enable)
i.fa.fa-arrow-right#toggle-sidebar(aria-hidden="true" class=autoOpenSidebar)
include ./sidebar.pug
include ./sidebar.pug
#body-wrap
if theme.background
- var is_photo = theme.background.substring(3,0) === 'url' ? 'photo':'color'
@@ -36,10 +36,14 @@ html(lang=config.language data-theme=theme.display_mode)
- var is_bg = theme.footer_bg == false ? 'color' : 'photo'
footer#footer(style=footer_bg data-type=is_bg)
!=partial('includes/footer', {}, {cache:theme.fragment_cache})
include ./rightside.pug
!=partial('includes/search/index', {}, {cache:theme.fragment_cache})
each item in theme.CDN_USE.js
script(src=url_for(item))
include ./additional-js.pug

View File

@@ -19,15 +19,19 @@ mixin UI_NEW(posts)
if (theme.post_meta.page.date_type)
if (theme.post_meta.page.date_type === 'both')
time.post-meta__date
i.fa.fa-calendar(aria-hidden="true")
=date(article.date, config.date_format)
span.post-meta__date-created(title=_p('post.created') + ' ' + full_date(article.date))
i.fa.fa-calendar(aria-hidden="true")
=date(article.date, config.date_format)
span.article-meta__separator |
i.fa.fa-history(aria-hidden="true")
=date(article.updated, config.date_format)
span.post-meta__date-updated(title=_p('post.updated') + ' ' + full_date(article.updated))
i.fa.fa-history(aria-hidden="true")
=date(article.updated, config.date_format)
else
- var date_type = theme.post_meta.page.date_type === 'updated' ? 'updated' : 'date'
- var date_icon = theme.post_meta.page.date_type === 'updated' ? 'fa-history' :'fa-calendar'
time.post-meta__date
- var data_type_updated = theme.post_meta.page.date_type === 'updated'
- var date_type = data_type_updated ? 'updated' : 'date'
- var date_icon = data_type_updated ? 'fa-history' :'fa-calendar'
- var date_title = data_type_updated ? _p('post.updated') : _p('post.created')
time.post-meta__date(title=date_title + ' ' + full_date(article[date_type]))
i.fa(class=date_icon aria-hidden="true")
=date(article[date_type], config.date_format)
if (theme.post_meta.page.categories && article.categories.data.length > 0)

View File

@@ -15,6 +15,6 @@ mixin articleSort(posts)
.article-sort-post
a.article-sort-item__post(href=url_for(article.path))
i.fa.fa-clock-o(aria-hidden="true")
time.article-sort-item__time= date(article.date)
time.article-sort-item__time(title=_p('post.created') + ' ' + full_date(article.date))= date(article.date, config.date_format)
.article-sort-item__title= article.title || 'No Title'
- })

View File

@@ -23,15 +23,19 @@ each article , index in page.posts.data
if (theme.post_meta.page.date_type)
if (theme.post_meta.page.date_type === 'both')
time.post-meta__date
i.fa.fa-calendar(aria-hidden="true")
=date(article.date, config.date_format)
span.post-meta__date-created(title=_p('post.created') + ' ' + full_date(article.date))
i.fa.fa-calendar(aria-hidden="true")
=date(article.date, config.date_format)
span.article-meta__separator |
i.fa.fa-history(aria-hidden="true")
=date(article.updated, config.date_format)
span.post-meta__date-updated(title=_p('post.updated') + ' ' + full_date(article.updated))
i.fa.fa-history(aria-hidden="true")
=date(article.updated, config.date_format)
else
- var date_type = theme.post_meta.page.date_type === 'updated' ? 'updated' : 'date'
- var date_icon = theme.post_meta.page.date_type === 'updated' ? 'fa-history' :'fa-calendar'
time.post-meta__date
- var data_type_updated = theme.post_meta.page.date_type === 'updated'
- var date_type = data_type_updated ? 'updated' : 'date'
- var date_icon = data_type_updated ? 'fa-history' :'fa-calendar'
- var date_title = data_type_updated ? _p('post.updated') : _p('post.created')
time.post-meta__date(title=date_title + ' ' + full_date(article[date_type]))
i.fa(class=date_icon aria-hidden="true")
=date(article[date_type], config.date_format)
if (theme.post_meta.page.categories && article.categories.data.length > 0)

View File

@@ -18,6 +18,6 @@ section#rightside.rightside
if is_post() && page.comments !== false && isComment
a#to_comment(href="#post-comment" title=_p("rightside.scroll_to_comment"))
i.scroll_to_comment.fa.fa-comments
if is_post() && page.toc != false && theme.toc.enable
if is_post() && page.toc !== false && theme.toc.enable && (toc(page.content) !== '' || page.encrypt == true )
i#mobile-toc-button.fa.fa-list-ul.close(title=_p("rightside.toc") aria-hidden="true")
i.fa.fa-arrow-up#go-up(title=_p("rightside.back_to_top") aria-hidden="true")

View File

@@ -1,12 +1,16 @@
#sidebar
- const showToc = is_post() && page.toc != false && theme.toc.enable
-
let tocNumber
if (page.toc_number !== undefined) tocNumber = page.toc_number
else if (theme.toc.number !== undefined) tocNumber = theme.toc.number
else tocNumber = true
-
if(showToc)
- let showToc = is_post() && page.toc !== false && theme.toc.enable && (toc(page.content) !== '' || page.encrypt == true )
- let autoOpenSidebar = theme.auto_open_sidebar.enable === true ? 'on' : ''
-
let tocNumber
if (page.toc_number !== undefined) tocNumber = page.toc_number
else if (theme.toc.number !== undefined) tocNumber = theme.toc.number
else tocNumber = true
-
if(showToc)
i.fa.fa-arrow-right#toggle-sidebar(aria-hidden="true" class=autoOpenSidebar)
#sidebar
.sidebar-toc
div.sidebar-toc__title= _p('sidebar.catalog')
div.sidebar-toc__progress
@@ -18,4 +22,4 @@
div.sidebar-toc__content.toc-div-class(style="display:none")!=toc(page.origin, {list_number: tocNumber})
else
div.sidebar-toc__content!=toc(page.content, {list_number: tocNumber})

View File

@@ -31,6 +31,4 @@
if(theme.social)
.card-info-social-icons.is-center
each url, icon in theme.social
a.social-icon(href=url target="_blank")
i(class=icon aria-hidden="true")
include ../header/social.pug

View File

@@ -20,8 +20,6 @@
img.aside-post-bg(src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` title=title alt=title)
.aside-post-title(class=no_cover)
.aside-post_title(href=url_for(link) title=article.title || _p('no_title'))= article.title || _p('no_title')
if (theme.post_meta.page.date_type)
- var date_type = theme.post_meta.page.date_type == 'updated' ? 'updated' : 'date'
time.aside-post_meta.post-meta__date #[=date(article[date_type], config.date_format)]
time.aside-post_meta.post-meta__date(title=_p('post.created') + ' ' + full_date(article.date)) #[=date(article.date, config.date_format)]
- })

View File

@@ -12,7 +12,7 @@
.webinfo-item
.webinfo-runtime-name= _p('aside.card_webinfo.runtime_name') + " :"
#webinfo-runtime-count.webinfo-runtime-count(start_date=theme.runtimeshow.start_date)
if theme.wordcount.total_wordcount
if theme.wordcount.enable && theme.wordcount.total_wordcount
.webinfo-item
.webinfo-site-wordcount-name=_p('aside.card_webinfo.site_wordcount') + " :"
.webinfo-site-wordcount=totalcount(site)