feat: 美化 firefox 瀏覽器滾動條

fix: Utterances 評論區在多個頁面顯示的是同一個評論區
fix: 修復評論配置爲 Livere 和 Facebook Comments 時,最新評論模塊仍然顯示的 bug
improvement: blueimp_md5 CDN 可配置
improvement: timeline 優化
improvement: css優化
improvement: 友情鏈接優化
This commit is contained in:
Jerry
2022-01-15 00:30:01 +08:00
parent 850c825fcf
commit 18d9d652a0
22 changed files with 97 additions and 82 deletions

View File

@@ -254,6 +254,7 @@ addtoany:
comments: comments:
# Up to two comments system, the first will be shown as default # Up to two comments system, the first will be shown as default
# Choose: Disqus/Disqusjs/Livere/Gitalk/Valine/Waline/Utterances/Facebook Comments/Twikoo/Giscus
use: # Valine,Disqus use: # Valine,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.
@@ -466,6 +467,7 @@ site_verification:
# toc_color: "#00c4b6" # toc_color: "#00c4b6"
# blockquote_padding_color: "#49b1f5" # blockquote_padding_color: "#49b1f5"
# blockquote_background_color: "#49b1f5" # blockquote_background_color: "#49b1f5"
# scrollbar_color: "#49b1f5"
# The top_img settings of home page # The top_img settings of home page
# default: top img - full screen, site info - middle (默認top_img全屏site_info在中間) # default: top img - full screen, site info - middle (默認top_img全屏site_info在中間)
@@ -836,6 +838,7 @@ CDN:
# comments # comments
gitalk: gitalk:
gitalk_css: gitalk_css:
blueimp_md5:
valine: valine:
disqusjs: disqusjs:
disqusjs_css: disqusjs_css:

View File

@@ -40,18 +40,29 @@
else else
if site.data.link if site.data.link
- let result = ''
each i in site.data.link each i in site.data.link
if i.class_name - let className = i.class_name ? markdown(`## ${i.class_name}`) : ''
!=markdown(`## ${i.class_name}`) - let classDesc = i.class_desc ? `<div class='flink-desc'>${i.class_desc}</div>` : ''
if i.class_desc
.flink-desc!=i.class_desc - let listResult = ''
.flink-list
each item in i.link_list each j in i.link_list
.flink-list-item -
a(href=url_for(item.link) title=item.name target="_blank") listResult += `
.flink-item-icon <div class="flink-list-item">
img.no-lightbox(src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name ) <a href='${j.link}' title='${j.name}' target='_blank'>
.flink-item-name= item.name <div class='flink-item-icon'>
.flink-item-desc(title=item.descr)= item.descr <img class='no-lightbox' src='${j.avatar}' onerror='this.onerror=null;this.src="${url_for(theme.error_img.flink)}"' alt='${j.name}' />
</div>
<div class='flink-item-name'>${j.name}</div>
<div class='flink-item-desc' title='${j.descr}'>${j.descr}</div>
</a>
</div>`
-
- result += `${className}${classDesc} <div class='flink-list'>${listResult}</div>`
- page.content = result + page.content
!= page.content != page.content

View File

@@ -1,6 +1,6 @@
- let default_avatar = theme.valine.avatar - let default_avatar = theme.valine.avatar
script(src="https://cdn.jsdelivr.net/npm/blueimp-md5@2.17.0/js/md5.min.js") script(src=url_for(theme.CDN.blueimp_md5))
script. script.
window.addEventListener('load', () => { window.addEventListener('load', () => {
const changeContent = (content) => { const changeContent = (content) => {

View File

@@ -3,20 +3,18 @@ if theme.pjax.exclude
each val in theme.pjax.exclude each val in theme.pjax.exclude
- pjaxExclude = pjaxExclude + `:not([href="${val}"])` - pjaxExclude = pjaxExclude + `:not([href="${val}"])`
- let pjaxSelectors = ['title','#config-diff','#body-wrap','#rightside-config-hide','#rightside-config-show','.js-pjax']
- let choose = theme.comments.use
if choose
if theme.Open_Graph_meta && (choose.includes('Livere') || choose.includes('Utterances') || choose.includes('Giscus'))
- pjaxSelectors.unshift('meta[property="og:image"]', 'meta[property="og:title"]', 'meta[property="og:url"]')
if choose.includes('Utterances') || choose.includes('Giscus')
- pjaxSelectors.unshift('link[rel="canonical"]')
script(src=url_for(theme.CDN.pjax)) script(src=url_for(theme.CDN.pjax))
script. script.
let pjaxSelectors = [ let pjaxSelectors = !{JSON.stringify(pjaxSelectors)}
'title',
'#config-diff',
'#body-wrap',
'#rightside-config-hide',
'#rightside-config-show',
'.js-pjax'
]
if (!{Boolean(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"]')
}
var pjax = new Pjax({ var pjax = new Pjax({
elements: '!{pjaxExclude}', elements: '!{pjaxExclude}',

View File

@@ -1,4 +1,4 @@
if theme.newest_comments.enable if theme.newest_comments.enable && !['Livere','Facebook Comments','Giscus'].includes(theme.comments.use[0])
.card-widget#card-newest-comments .card-widget#card-newest-comments
.item-headline .item-headline
i.fas.fa-comment-dots i.fas.fa-comment-dots

View File

@@ -1,7 +1,7 @@
#aside-content.aside-content #aside-content.aside-content
//- post //- post
if is_post() if is_post()
- const tocStyle = page.style_simple - const tocStyle = page.toc_style_simple
- const tocStyleVal = tocStyle === true || tocStyle === false ? tocStyle : theme.toc.style_simple - const tocStyleVal = tocStyle === true || tocStyle === false ? tocStyle : theme.toc.style_simple
if showToc && tocStyleVal if showToc && tocStyleVal
.sticky_layout .sticky_layout

View File

@@ -1,6 +1,6 @@
{ {
"name": "hexo-theme-butterfly", "name": "hexo-theme-butterfly",
"version": "4.0.0-b11", "version": "4.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": {

View File

@@ -24,6 +24,7 @@ hexo.extend.filter.register('before_generate', () => {
// comments // comments
gitalk: 'https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.js', gitalk: 'https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.js',
gitalk_css: 'https://cdn.jsdelivr.net/npm/gitalk/dist/gitalk.min.css', gitalk_css: 'https://cdn.jsdelivr.net/npm/gitalk/dist/gitalk.min.css',
blueimp_md5: 'https://cdn.jsdelivr.net/npm/blueimp-md5/js/md5.min.js',
valine: 'https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js', valine: 'https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js',
disqusjs: 'https://cdn.jsdelivr.net/npm/disqusjs@1/dist/disqus.js', disqusjs: 'https://cdn.jsdelivr.net/npm/disqusjs@1/dist/disqus.js',
disqusjs_css: 'https://cdn.jsdelivr.net/npm/disqusjs@1/dist/disqusjs.css', disqusjs_css: 'https://cdn.jsdelivr.net/npm/disqusjs@1/dist/disqusjs.css',

View File

@@ -39,7 +39,7 @@ function randomCover () {
return cover return cover
} }
} else { } else {
cover = theme.default_top_img || 'https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg' cover = theme.default_top_img || 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
return cover return cover
} }
} }

View File

@@ -9,9 +9,12 @@ function timeLineFn (args, content) {
const tlBlock = /<!--\s*timeline (.*?)\s*-->\n([\w\W\s\S]*?)<!--\s*endtimeline\s*-->/g const tlBlock = /<!--\s*timeline (.*?)\s*-->\n([\w\W\s\S]*?)<!--\s*endtimeline\s*-->/g
let result = '' let result = ''
let color = ''
if (args.length) { if (args.length) {
args = hexo.render.renderSync({ text: args.join(' '), engine: 'markdown' }) args = args.join(' ').split(',')
result += `<div class='timeline-item headline'><div class='timeline-item-title'><div class='item-circle'>${args}</div></div></div>` color = args[1]
const mdContent = hexo.render.renderSync({ text: args[0], engine: 'markdown' })
result += `<div class='timeline-item headline'><div class='timeline-item-title'><div class='item-circle'>${mdContent}</div></div></div>`
} }
const matches = [] const matches = []
@@ -32,7 +35,7 @@ function timeLineFn (args, content) {
result += `<div class='timeline-item'>${tlTitleHtml + tlContentHtml}</div>` result += `<div class='timeline-item'>${tlTitleHtml + tlContentHtml}</div>`
} }
return `<div class="timeline">${result}</div>` return `<div class="timeline ${color}">${result}</div>`
} }
hexo.extend.tag.register('timeline', timeLineFn, { ends: true }) hexo.extend.tag.register('timeline', timeLineFn, { ends: true })

View File

@@ -30,8 +30,6 @@
--toc-link-color: $toc-link-color --toc-link-color: $toc-link-color
--card-box-shadow: 0 3px 8px 6px rgba(7, 17, 27, .05) --card-box-shadow: 0 3px 8px 6px rgba(7, 17, 27, .05)
--card-hover-box-shadow: 0 3px 8px 6px rgba(7, 17, 27, .09) --card-hover-box-shadow: 0 3px 8px 6px rgba(7, 17, 27, .09)
--timeline-bg: $timeline-content-bg
--timeline-border-color: $timeline-border-color
--pseudo-hover: $pseudo-hover --pseudo-hover: $pseudo-hover
--headline-presudo: #a0a0a0 --headline-presudo: #a0a0a0
--scrollbar-color: $scrollbar-color --scrollbar-color: $scrollbar-color
@@ -49,6 +47,7 @@ body
if !hexo-config('copy.enable') if !hexo-config('copy.enable')
user-select: none user-select: none
// scrollbar - chrome/safari
*::-webkit-scrollbar *::-webkit-scrollbar
width: 8px width: 8px
height: 8px height: 8px
@@ -59,6 +58,11 @@ body
*::-webkit-scrollbar-track *::-webkit-scrollbar-track
background-color: transparent background-color: transparent
// scrollbar - firefox
*
scrollbar-width: thin
scrollbar-color: var(--scrollbar-color) transparent
input::placeholder input::placeholder
color: var(--font-color) color: var(--font-color)

View File

@@ -1,5 +1,7 @@
figure.highlight figure.highlight
table table
scrollbar-color: var(--hlscrollbar-bg) transparent
&::-webkit-scrollbar-thumb &::-webkit-scrollbar-thumb
background: var(--hlscrollbar-bg) background: var(--hlscrollbar-bg)

View File

@@ -6,6 +6,8 @@ if $highlight_theme != false
#article-container #article-container
pre[class*='language-'] pre[class*='language-']
scrollbar-color: var(--hlscrollbar-bg) transparent
&::-webkit-scrollbar-thumb &::-webkit-scrollbar-thumb
background: var(--hlscrollbar-bg) background: var(--hlscrollbar-bg)

View File

@@ -173,9 +173,9 @@
.card-archives ul.card-archive-list > .card-archive-list-item, .card-archives ul.card-archive-list > .card-archive-list-item,
.card-categories ul.card-category-list > .card-category-list-item .card-categories ul.card-category-list > .card-category-list-item
a a
display: inline-block display: flex
flex-direction: row
padding: 3px 10px padding: 3px 10px
width: 100%
color: var(--font-color) color: var(--font-color)
transition: all .4s transition: all .4s
@@ -185,15 +185,9 @@
span span
@extend .limit-one-line @extend .limit-one-line
display: inline-block
vertical-align: bottom
&:first-child &:first-child
width: 80% flex: 1
&:last-child
width: 20%
text-align: right
.card-categories .card-categories
.card-category-list .card-category-list
@@ -269,8 +263,8 @@
+maxWidth900() +maxWidth900()
max-height: calc(100vh - 140px) max-height: calc(100vh - 140px)
& > .toc & > *
margin: 0 20px margin: 0 20px !important
& > .toc-item > .toc-child & > .toc-item > .toc-child
margin-left: 10px margin-left: 10px

View File

@@ -57,13 +57,15 @@
& > .recent-posts & > .recent-posts
.pagination .pagination
& > * & > *
@extend .cardHover
display: inline-block display: inline-block
margin: 0 6px margin: 0 6px
width: w = 2.5em width: w = 2.5em
height: w height: w
line-height: w line-height: w
& > *:not(.space)
@extend .cardHover
&:hover &:hover
background: var(--btn-hover-color) background: var(--btn-hover-color)
color: var(--btn-color) color: var(--btn-color)

View File

@@ -36,8 +36,8 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
--hlnumber-color: alpha(#FFFFFF, .4) --hlnumber-color: alpha(#FFFFFF, .4)
--hlscrollbar-bg: lighten(#121212, 5) --hlscrollbar-bg: lighten(#121212, 5)
--hlexpand-bg: linear-gradient(180deg, rgba(lighten(#121212, 2), .6), rgba(lighten(#121212, 2), .9)) --hlexpand-bg: linear-gradient(180deg, rgba(lighten(#121212, 2), .6), rgba(lighten(#121212, 2), .9))
--timeline-bg: lighten(#121212, 5)
--scrollbar-color: lighten(#121212, 5) --scrollbar-color: lighten(#121212, 5)
--timeline-bg: lighten(#121212, 5)
#web_bg:before, #web_bg:before,
#footer:before, #footer:before,

View File

@@ -11,8 +11,6 @@ if hexo-config('readmode')
--exit-btn-bg: #C0C0C0 --exit-btn-bg: #C0C0C0
--exit-btn-color: #fff --exit-btn-color: #fff
--exit-btn-hover: darken(#C0C0C0, 20) --exit-btn-hover: darken(#C0C0C0, 20)
--timeline-bg: none
--timeline-border-color: none
--pseudo-hover: none --pseudo-hover: none
[data-theme='dark'] [data-theme='dark']

View File

@@ -7,10 +7,14 @@
display: inline-block display: inline-block
margin: 0 4px 6px margin: 0 4px 6px
padding: 0 15px padding: 0 15px
background-color: $btn-default-color background-color: var(--btn-beautify-color, $btn-default-color)
color: $btn-color color: $btn-color
line-height: 2 line-height: 2
for $type in $color-types
&.{$type}
--btn-beautify-color: lookup('$tagsP-' + $type + '-color')
&:hover &:hover
background-color: var(--btn-hover-color) background-color: var(--btn-hover-color)
@@ -38,29 +42,14 @@
&:hover &:hover
text-decoration: none text-decoration: none
for $type in $tagsP-types
&.{$type}
background-color: lookup('$tagsP-' + $type + '-color')
&:hover
background-color: var(--btn-hover-color)
&.outline &.outline
border: 1px solid transparent border: 1px solid transparent
border-color: $btn-default-color border-color: var(--btn-beautify-color, $btn-default-color)
background-color: transparent background-color: transparent
color: $btn-default-color color: var(--btn-beautify-color, $btn-default-color)
&:hover &:hover
background-color: $btn-default-color background-color: var(--btn-beautify-color, $btn-default-color)
&:hover &:hover
color: white !important color: white !important
for $type in $tagsP-types
&.{$type}
border-color: lookup('$tagsP-' + $type + '-color')
color: lookup('$tagsP-' + $type + '-color')
&:hover
background-color: lookup('$tagsP-' + $type + '-color')

View File

@@ -6,6 +6,6 @@
&.default &.default
background-color: $btn-default-color background-color: $btn-default-color
for $type in $tagsP-types for $type in $color-types
&.{$type} &.{$type}
background-color: lookup('$tagsP-' + $type + '-color') background-color: lookup('$tagsP-' + $type + '-color')

View File

@@ -16,7 +16,7 @@
left: .8em left: .8em
font-size: larger font-size: larger
for $type in $tagsP-types for $type in $color-types
&.{$type} &.{$type}
&:not(.disabled) &:not(.disabled)
border-left-color: lookup('$tagsP-' + $type + '-color') !important border-left-color: lookup('$tagsP-' + $type + '-color') !important

View File

@@ -1,8 +1,13 @@
#article-container #article-container
.timeline .timeline
margin: 0 0 20px margin: 0 0 20px 10px
padding: 14px 20px 5px padding: 14px 20px 5px
border-left: 2px solid var(--timeline-border-color) border-left: 2px solid var(--timeline-color, $theme-color)
for $type in $color-types
&.{$type}
--timeline-color: lookup('$tagsP-' + $type + '-color')
--timeline-bg: s('rgba(%s,%s,%s, 0.2)', red(lookup('$tagsP-' + $type + '-color')), green(lookup('$tagsP-' + $type + '-color')), blue(lookup('$tagsP-' + $type + '-color')))
.timeline-item .timeline-item
margin: 0 0 15px margin: 0 0 15px
@@ -10,7 +15,7 @@
&:hover &:hover
.item-circle .item-circle
&:before &:before
border: 3px solid var(--pseudo-hover) border-color: var(--timeline-color, $theme-color)
&.headline &.headline
.timeline-item-title .timeline-item-title
@@ -21,7 +26,12 @@
&:before &:before
left: -28px left: -28px
border: 4px solid var(--pseudo-hover) border: 4px solid var(--timeline-color, $theme-color)
&:hover
.item-circle
&:before
border-color: var(--pseudo-hover)
.timeline-item-title .timeline-item-title
position: relative position: relative
@@ -33,7 +43,7 @@
left: -27px left: -27px
width: 6px width: 6px
height: 6px height: 6px
border: 3px solid var(--timeline-border-color) border: 3px solid var(--pseudo-hover)
border-radius: 50% border-radius: 50%
background: var(--card-bg) background: var(--card-bg)
content: '' content: ''
@@ -46,9 +56,9 @@
.timeline-item-content .timeline-item-content
position: relative position: relative
padding: 12px 10px padding: 12px 15px
border-radius: 8px border-radius: 8px
background: var(--timeline-bg) background: var(--timeline-bg, lighten($theme-color, 85%))
font-size: .93em font-size: .93em
& > :last-child & > :last-child

View File

@@ -162,7 +162,7 @@ $note-modern-danger-bg = lighten(spin($note-modern-danger-border, 10), 35% + ($l
$note-modern-danger-text = #a94442 $note-modern-danger-text = #a94442
$note-modern-danger-hover = darken(spin($note-modern-danger-text, -10), 22%) $note-modern-danger-hover = darken(spin($note-modern-danger-text, -10), 22%)
// Tag Plugins - Button/note // Tag Plugins - Button/note
$tagsP-types = 'blue' 'pink' 'red' 'purple' 'orange' 'green' $color-types = 'blue' 'pink' 'red' 'purple' 'orange' 'green'
$btn-color = #fff $btn-color = #fff
$btn-default-color = #777 $btn-default-color = #777
$tagsP-blue-color = #428bca $tagsP-blue-color = #428bca
@@ -179,7 +179,5 @@ $tab-button-hover-bg = darken($tab-border-color, 8)
$tab-active-border-color = $theme-color $tab-active-border-color = $theme-color
$tab-button-active-bg = $card-bg $tab-button-active-bg = $card-bg
$tab-to-top-color = #99a9bf $tab-to-top-color = #99a9bf
// Tag Plugins - timeline
// timeline $timeline-default-color = $theme-color
$timeline-content-bg = #f6f6f6
$timeline-border-color = $theme-color