Compare commits

...

3 Commits
5.2.1 ... 5.2.2

Author SHA1 Message Date
Jerry Wong
c8609e8433 Update package.json 2024-11-05 19:12:36 +08:00
myw
997b76b967 fix conflicts 2024-11-05 18:03:47 +08:00
myw
91c8c5cd4b feat: 過期通知優化,可單獨文章關閉
fix: 修復説説評論 css 受主題影響的 bug
2024-11-05 18:01:36 +08:00
25 changed files with 83 additions and 81 deletions

View File

@@ -69,16 +69,6 @@
}) })
} }
let noticeOutdate = 'undefined'
if (theme.noticeOutdate && theme.noticeOutdate.enable) {
noticeOutdate = JSON.stringify({
limitDay: theme.noticeOutdate.limit_day,
position: theme.noticeOutdate.position,
messagePrev: theme.noticeOutdate.message_prev,
messageNext: theme.noticeOutdate.message_next,
})
}
let highlight = 'undefined' let highlight = 'undefined'
let syntaxHighlighter = config.syntax_highlighter let syntaxHighlighter = config.syntax_highlighter
let highlightEnable = syntaxHighlighter ? ['highlight.js', 'prismjs'].includes(syntaxHighlighter) : (config.highlight.enable || config.prismjs.enable) let highlightEnable = syntaxHighlighter ? ['highlight.js', 'prismjs'].includes(syntaxHighlighter) : (config.highlight.enable || config.prismjs.enable)
@@ -100,7 +90,6 @@ script.
algolia: !{algolia}, algolia: !{algolia},
localSearch: !{localSearch}, localSearch: !{localSearch},
translate: !{translate}, translate: !{translate},
noticeOutdate: !{noticeOutdate},
highlight: !{highlight}, highlight: !{highlight},
copy: { copy: {
success: '!{_p("copy.success")}', success: '!{_p("copy.success")}',

View File

@@ -23,6 +23,5 @@ script#config-diff.
isHome: !{is_home()}, isHome: !{is_home()},
isHighlightShrink: !{isHighlightShrink}, isHighlightShrink: !{isHighlightShrink},
isToc: !{showToc}, isToc: !{showToc},
postUpdate: '!{full_date(page.updated)}',
isShuoshuo: !{page.type == 'shuoshuo'} isShuoshuo: !{page.type == 'shuoshuo'}
} }

View File

@@ -1,2 +1,2 @@
#article-container #article-container.container
!= page.content != page.content

View File

@@ -1,4 +1,4 @@
#article-container #article-container.container
.flink .flink
- let { content, random, flink_url } = page - let { content, random, flink_url } = page
- let pageContent = content - let pageContent = content

View File

@@ -28,7 +28,7 @@
const btn = e.target.closest('.shuoshuo-comment-btn') const btn = e.target.closest('.shuoshuo-comment-btn')
if (!btn) return if (!btn) return
const ele = btn.parentNode.nextElementSibling const ele = btn.closest('.container').nextElementSibling
const { shuoshuoComment } = window const { shuoshuoComment } = window
const isInclude = ele.classList.contains('no-comment') const isInclude = ele.classList.contains('no-comment')
runDestroy(shuoshuoComment) runDestroy(shuoshuoComment)
@@ -103,6 +103,7 @@
return ` return `
<div class="shuoshuo-item"> <div class="shuoshuo-item">
<div class="container">
<div class="shuoshuo-item-header"> <div class="shuoshuo-item-header">
<div class="shuoshuo-avatar"> <div class="shuoshuo-avatar">
<img class="no-lightbox" src="${item.avatar || '!{url_for(theme.avatar.img)}'}"> <img class="no-lightbox" src="${item.avatar || '!{url_for(theme.avatar.img)}'}">
@@ -119,6 +120,7 @@
${tags ? `<div class="shuoshuo-tags">${tags}</div>` : ''} ${tags ? `<div class="shuoshuo-tags">${tags}</div>` : ''}
${commentButton} ${commentButton}
</div> </div>
</div>
${commentContainer} ${commentContainer}
</div>` </div>`
}).join('') }).join('')
@@ -165,6 +167,7 @@
if site.data.shuoshuo if site.data.shuoshuo
each i in shuoshuoFN(site.data.shuoshuo, page) each i in shuoshuoFN(site.data.shuoshuo, page)
.shuoshuo-item .shuoshuo-item
.container
.shuoshuo-item-header .shuoshuo-item-header
.shuoshuo-avatar .shuoshuo-avatar
img.no-lightbox(src=i.avatar || url_for(theme.avatar.img)) img.no-lightbox(src=i.avatar || url_for(theme.avatar.img))

View File

@@ -0,0 +1,8 @@
- const { limit_day, message_prev, message_next, position} = theme.noticeOutdate
- const notice_data = { limitDay: limit_day, messagePrev: message_prev, messageNext: message_next, postUpdate: full_date(page.updated)}
if position === 'top'
#post-outdate-notice(data=notice_data hidden)
!=page.content
else
!=page.content
#post-outdate-notice(data=notice_data hidden)

View File

@@ -5,7 +5,11 @@ block content
if top_img === false if top_img === false
include includes/header/post-info.pug include includes/header/post-info.pug
article#article-container.post-content!=page.content article#article-container.container.post-content
if theme.noticeOutdate.enable && page.noticeOutdate !== false
include includes/post/outdate-notice.pug
else
!=page.content
include includes/post/post-copyright.pug include includes/post/post-copyright.pug
.tag_share .tag_share
if (page.tags.length > 0 && theme.post_meta.post.tags) if (page.tags.length > 0 && theme.post_meta.post.tags)

View File

@@ -1,6 +1,6 @@
{ {
"name": "hexo-theme-butterfly", "name": "hexo-theme-butterfly",
"version": "5.2.1", "version": "5.2.2",
"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

@@ -3,7 +3,7 @@
* galleryGroup and gallery * galleryGroup and gallery
* {% galleryGroup [name] [descr] [url] [img] %} * {% galleryGroup [name] [descr] [url] [img] %}
* *
* {% gallery [button],%} * {% gallery [button] %}
* {% gallery url,[url],[button] %} * {% gallery url,[url],[button] %}
*/ */

View File

@@ -42,7 +42,7 @@ $code-block
counter-reset: line counter-reset: line
white-space: pre-wrap white-space: pre-wrap
#article-container .container
pre, pre,
code code
font-size: $code-font-size font-size: $code-font-size
@@ -164,7 +164,7 @@ $code-block
border: none border: none
if $highlight_macstyle if $highlight_macstyle
#article-container .container
figure.highlight figure.highlight
margin: 0 0 24px margin: 0 0 24px
border-radius: 7px border-radius: 7px
@@ -202,7 +202,7 @@ if $highlight_macstyle
transform: rotate(90deg) transform: rotate(90deg)
if hexo-config('code_blocks.height_limit') if hexo-config('code_blocks.height_limit')
#article-container .container
.code-expand-btn .code-expand-btn
position: absolute position: absolute
bottom: 0 bottom: 0
@@ -243,7 +243,7 @@ if hexo-config('code_blocks.height_limit')
opacity: .6 opacity: .6
if hexo-config('code_blocks.fullpage') if hexo-config('code_blocks.fullpage')
#article-container .container
figure.highlight.code-fullpage figure.highlight.code-fullpage
position: fixed position: fixed
top: 0 top: 0

View File

@@ -1,7 +1,7 @@
if $highlight_theme != false if $highlight_theme != false
@require 'diff' @require 'diff'
#article-container .container
figure.highlight figure.highlight
.line .line
if wordWrap if wordWrap

View File

@@ -4,7 +4,7 @@ if $prismjs_line_number
if $highlight_theme != false if $highlight_theme != false
@require 'diff' @require 'diff'
#article-container .container
pre[class*='language-'] pre[class*='language-']
// scrollbar - firefox // scrollbar - firefox
@-moz-document url-prefix() @-moz-document url-prefix()

View File

@@ -1,4 +1,4 @@
#article-container .container
pre[class*='language-'] pre[class*='language-']
&.line-numbers &.line-numbers
position: relative position: relative

View File

@@ -69,7 +69,7 @@ beautify()
hr hr
@extend .custom-hr @extend .custom-hr
#article-container .container
word-wrap: break-word word-wrap: break-word
overflow-wrap: break-word overflow-wrap: break-word
@@ -236,7 +236,7 @@ beautify()
&:hover &:hover
text-decoration: none text-decoration: none
.post-outdate-notice #post-outdate-notice
position: relative position: relative
margin: 0 0 20px margin: 0 0 20px
padding: .5em 1.2em padding: .5em 1.2em
@@ -244,6 +244,9 @@ beautify()
color: $noticeOutdate-color color: $noticeOutdate-color
addBorderRadius(3) addBorderRadius(3)
.num
padding: 0 4px
if hexo-config('noticeOutdate.style') == 'flat' if hexo-config('noticeOutdate.style') == 'flat'
padding: .5em 1em .5em 2.6em padding: .5em 1em .5em 2.6em
border-left: 5px solid $noticeOutdate-border border-left: 5px solid $noticeOutdate-border

View File

@@ -153,7 +153,7 @@ if hexo-config('math.use')
.aplayer .aplayer
color: $font-black color: $font-black
#article-container .container
.aplayer .aplayer
margin: 0 0 20px margin: 0 0 20px

View File

@@ -41,7 +41,7 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
background-color: alpha($dark-black, .7) background-color: alpha($dark-black, .7)
content: '' content: ''
#article-container .container
code code
background: #2c2c2c background: #2c2c2c
@@ -87,9 +87,9 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark'
.hide-button, .hide-button,
.btn-beautify, .btn-beautify,
.hl-label, .hl-label,
.post-outdate-notice, #post-outdate-notice,
.error-img, .error-img,
#article-container iframe, .container iframe,
.gist, .gist,
.ads-wrap .ads-wrap
filter: brightness(.8) filter: brightness(.8)

View File

@@ -77,13 +77,13 @@ if hexo-config('readmode')
#footer, #footer,
#post > *:not(#post-info):not(.post-content), #post > *:not(#post-info):not(.post-content),
#nav, #nav,
.post-outdate-notice, #post-outdate-notice,
#web_bg, #web_bg,
#rightside, #rightside,
.not-top-img .not-top-img
display: none !important display: none !important
#article-container .container
a a
color: #99a9bf color: #99a9bf

View File

@@ -1,4 +1,4 @@
#article-container .container
.flink .flink
margin-bottom: 20px margin-bottom: 20px

View File

@@ -1,4 +1,4 @@
#article-container .container
.btn-center .btn-center
margin: 0 0 20px margin: 0 0 20px
text-align: center text-align: center

View File

@@ -1,4 +1,4 @@
#article-container .container
figure.gallery-group figure.gallery-group
position: relative position: relative
float: left float: left

View File

@@ -1,4 +1,4 @@
#article-container .container
.inline-img .inline-img
display: inline display: inline
margin: 0 3px margin: 0 3px

View File

@@ -1,4 +1,4 @@
#article-container .container
.series-items .series-items
a a
&:hover &:hover

View File

@@ -1,5 +1,5 @@
#article-container .container
.tabs .tabs
position: relative position: relative
margin: 0 0 20px margin: 0 0 20px

View File

@@ -1,4 +1,4 @@
#article-container .container
.timeline .timeline
margin: 0 10px 20px margin: 0 10px 20px
padding: 14px 0 5px 20px padding: 14px 0 5px 20px

View File

@@ -807,18 +807,14 @@ document.addEventListener('DOMContentLoaded', () => {
} }
const addPostOutdateNotice = () => { const addPostOutdateNotice = () => {
const { limitDay, messagePrev, messageNext, position } = GLOBAL_CONFIG.noticeOutdate const ele = document.getElementById('post-outdate-notice')
const diffDay = btf.diffDate(GLOBAL_CONFIG_SITE.postUpdate) if (!ele) return
const { limitDay, messagePrev, messageNext, postUpdate } = JSON.parse(ele.getAttribute('data'))
const diffDay = btf.diffDate(postUpdate)
if (diffDay >= limitDay) { if (diffDay >= limitDay) {
const ele = document.createElement('div')
ele.className = 'post-outdate-notice'
ele.textContent = `${messagePrev} ${diffDay} ${messageNext}` ele.textContent = `${messagePrev} ${diffDay} ${messageNext}`
const $targetEle = document.getElementById('article-container') ele.hidden = false
if (position === 'top') {
$targetEle.insertBefore(ele, $targetEle.firstChild)
} else {
$targetEle.appendChild(ele)
}
} }
} }
@@ -895,7 +891,7 @@ document.addEventListener('DOMContentLoaded', () => {
justifiedIndexPostUI() justifiedIndexPostUI()
if (GLOBAL_CONFIG_SITE.isPost) { if (GLOBAL_CONFIG_SITE.isPost) {
GLOBAL_CONFIG.noticeOutdate !== undefined && addPostOutdateNotice() addPostOutdateNotice()
GLOBAL_CONFIG.relativeDate.post && relativeDate(document.querySelectorAll('#post-meta time')) GLOBAL_CONFIG.relativeDate.post && relativeDate(document.querySelectorAll('#post-meta time'))
} else { } else {
GLOBAL_CONFIG.relativeDate.homepage && relativeDate(document.querySelectorAll('#recent-posts time')) GLOBAL_CONFIG.relativeDate.homepage && relativeDate(document.querySelectorAll('#recent-posts time'))