diff --git a/layout/includes/head/config.pug b/layout/includes/head/config.pug index f47a21ffd..b23742e16 100644 --- a/layout/includes/head/config.pug +++ b/layout/includes/head/config.pug @@ -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 syntaxHighlighter = config.syntax_highlighter let highlightEnable = syntaxHighlighter ? ['highlight.js', 'prismjs'].includes(syntaxHighlighter) : (config.highlight.enable || config.prismjs.enable) @@ -100,7 +90,6 @@ script. algolia: !{algolia}, localSearch: !{localSearch}, translate: !{translate}, - noticeOutdate: !{noticeOutdate}, highlight: !{highlight}, copy: { success: '!{_p("copy.success")}', diff --git a/layout/includes/head/config_site.pug b/layout/includes/head/config_site.pug index 7531f045a..ccd45dcf8 100644 --- a/layout/includes/head/config_site.pug +++ b/layout/includes/head/config_site.pug @@ -23,6 +23,5 @@ script#config-diff. isHome: !{is_home()}, isHighlightShrink: !{isHighlightShrink}, isToc: !{showToc}, - postUpdate: '!{full_date(page.updated)}', isShuoshuo: !{page.type == 'shuoshuo'} } diff --git a/layout/includes/page/default-page.pug b/layout/includes/page/default-page.pug index e7057f73a..4a7d51560 100644 --- a/layout/includes/page/default-page.pug +++ b/layout/includes/page/default-page.pug @@ -1,2 +1,2 @@ -#article-container +#article-container.container != page.content \ No newline at end of file diff --git a/layout/includes/page/flink.pug b/layout/includes/page/flink.pug index 10d3893ac..30cdad58d 100644 --- a/layout/includes/page/flink.pug +++ b/layout/includes/page/flink.pug @@ -1,4 +1,4 @@ -#article-container +#article-container.container .flink - let { content, random, flink_url } = page - let pageContent = content diff --git a/layout/includes/page/shuoshuo.pug b/layout/includes/page/shuoshuo.pug index 75ed49c43..3bcb01d6d 100644 --- a/layout/includes/page/shuoshuo.pug +++ b/layout/includes/page/shuoshuo.pug @@ -28,7 +28,7 @@ const btn = e.target.closest('.shuoshuo-comment-btn') if (!btn) return - const ele = btn.parentNode.nextElementSibling + const ele = btn.closest('.container').nextElementSibling const { shuoshuoComment } = window const isInclude = ele.classList.contains('no-comment') runDestroy(shuoshuoComment) @@ -103,22 +103,24 @@ return `
-
-
- +
+
+
+ +
+
+
${item.author || '!{config.author}'}
+ +
-
-
${item.author || '!{config.author}'}
- +
${item.content}
+
-
${item.content}
- ${commentContainer}
` }).join('') @@ -165,21 +167,22 @@ if site.data.shuoshuo each i in shuoshuoFN(site.data.shuoshuo, page) .shuoshuo-item - .shuoshuo-item-header - .shuoshuo-avatar - img.no-lightbox(src=i.avatar || url_for(theme.avatar.img)) - .shuoshuo-info - .shuoshuo-author=i.author || config.author - time.shuoshuo-date(title=i.date)=i.date - .shuoshuo-content - !=markdown(i.content) - .shuoshuo-footer(class=i.tags && i.tags.length ? 'flex-between' : 'flex-end') - if i.tags - .shuoshuo-tags - each tag in i.tags - span.shuoshuo-tag=tag - if i.key && commentsJsLoad - .shuoshuo-comment-btn(onclick='addCommentToShuoshuo(event)') - i.fa-solid.fa-comments + .container + .shuoshuo-item-header + .shuoshuo-avatar + img.no-lightbox(src=i.avatar || url_for(theme.avatar.img)) + .shuoshuo-info + .shuoshuo-author=i.author || config.author + time.shuoshuo-date(title=i.date)=i.date + .shuoshuo-content + !=markdown(i.content) + .shuoshuo-footer(class=i.tags && i.tags.length ? 'flex-between' : 'flex-end') + if i.tags + .shuoshuo-tags + each tag in i.tags + span.shuoshuo-tag=tag + if i.key && commentsJsLoad + .shuoshuo-comment-btn(onclick='addCommentToShuoshuo(event)') + i.fa-solid.fa-comments if i.key && commentsJsLoad .shuoshuo-comment.no-comment(data-key=i.key) \ No newline at end of file diff --git a/layout/includes/post/outdate-notice.pug b/layout/includes/post/outdate-notice.pug new file mode 100644 index 000000000..ef7277272 --- /dev/null +++ b/layout/includes/post/outdate-notice.pug @@ -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) \ No newline at end of file diff --git a/layout/post.pug b/layout/post.pug index 07c696e6d..08bdea3a7 100644 --- a/layout/post.pug +++ b/layout/post.pug @@ -5,7 +5,11 @@ block content if top_img === false 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 .tag_share if (page.tags.length > 0 && theme.post_meta.post.tags) diff --git a/package.json b/package.json index b30459497..0b4dd0d5a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,9 @@ { "name": "hexo-theme-butterfly", +<<<<<<< HEAD "version": "5.2.1", +======= + "version": "5.2.2", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { diff --git a/scripts/tag/gallery.js b/scripts/tag/gallery.js index 2753eed73..5d6949b02 100644 --- a/scripts/tag/gallery.js +++ b/scripts/tag/gallery.js @@ -3,8 +3,8 @@ * galleryGroup and gallery * {% galleryGroup [name] [descr] [url] [img] %} * - * {% gallery [button],%} - * {% gallery url,[url],[button]%} + * {% gallery [button] %} + * {% gallery url,[url],[button] %} */ 'use strict' diff --git a/source/css/_highlight/highlight.styl b/source/css/_highlight/highlight.styl index 16d3ea322..ab0e4ff12 100644 --- a/source/css/_highlight/highlight.styl +++ b/source/css/_highlight/highlight.styl @@ -42,7 +42,7 @@ $code-block counter-reset: line white-space: pre-wrap -#article-container +.container pre, code font-size: $code-font-size @@ -164,7 +164,7 @@ $code-block border: none if $highlight_macstyle - #article-container + .container figure.highlight margin: 0 0 24px border-radius: 7px @@ -202,7 +202,7 @@ if $highlight_macstyle transform: rotate(90deg) if hexo-config('code_blocks.height_limit') - #article-container + .container .code-expand-btn position: absolute bottom: 0 @@ -243,7 +243,7 @@ if hexo-config('code_blocks.height_limit') opacity: .6 if hexo-config('code_blocks.fullpage') - #article-container + .container figure.highlight.code-fullpage position: fixed top: 0 diff --git a/source/css/_highlight/highlight/index.styl b/source/css/_highlight/highlight/index.styl index bdb9d96ab..b241d9845 100644 --- a/source/css/_highlight/highlight/index.styl +++ b/source/css/_highlight/highlight/index.styl @@ -1,7 +1,7 @@ if $highlight_theme != false @require 'diff' -#article-container +.container figure.highlight .line if wordWrap diff --git a/source/css/_highlight/prismjs/index.styl b/source/css/_highlight/prismjs/index.styl index 142782651..b76b6ec31 100644 --- a/source/css/_highlight/prismjs/index.styl +++ b/source/css/_highlight/prismjs/index.styl @@ -4,7 +4,7 @@ if $prismjs_line_number if $highlight_theme != false @require 'diff' -#article-container +.container pre[class*='language-'] // scrollbar - firefox @-moz-document url-prefix() diff --git a/source/css/_highlight/prismjs/line-number.styl b/source/css/_highlight/prismjs/line-number.styl index 97b21334f..85d437689 100644 --- a/source/css/_highlight/prismjs/line-number.styl +++ b/source/css/_highlight/prismjs/line-number.styl @@ -1,4 +1,4 @@ -#article-container +.container pre[class*='language-'] &.line-numbers position: relative diff --git a/source/css/_layout/post.styl b/source/css/_layout/post.styl index 5c499fb62..bd52eec64 100644 --- a/source/css/_layout/post.styl +++ b/source/css/_layout/post.styl @@ -69,7 +69,7 @@ beautify() hr @extend .custom-hr -#article-container +.container word-wrap: break-word overflow-wrap: break-word @@ -236,7 +236,7 @@ beautify() &:hover text-decoration: none - .post-outdate-notice + #post-outdate-notice position: relative margin: 0 0 20px padding: .5em 1.2em @@ -244,6 +244,9 @@ beautify() color: $noticeOutdate-color addBorderRadius(3) + .num + padding: 0 4px + if hexo-config('noticeOutdate.style') == 'flat' padding: .5em 1em .5em 2.6em border-left: 5px solid $noticeOutdate-border diff --git a/source/css/_layout/third-party.styl b/source/css/_layout/third-party.styl index bfe6304f6..d1653f2f9 100644 --- a/source/css/_layout/third-party.styl +++ b/source/css/_layout/third-party.styl @@ -153,7 +153,7 @@ if hexo-config('math.use') .aplayer color: $font-black -#article-container +.container .aplayer margin: 0 0 20px diff --git a/source/css/_mode/darkmode.styl b/source/css/_mode/darkmode.styl index de4b749a0..d561ae5b4 100644 --- a/source/css/_mode/darkmode.styl +++ b/source/css/_mode/darkmode.styl @@ -41,7 +41,7 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark' background-color: alpha($dark-black, .7) content: '' - #article-container + .container code background: #2c2c2c @@ -87,9 +87,9 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark' .hide-button, .btn-beautify, .hl-label, - .post-outdate-notice, + #post-outdate-notice, .error-img, - #article-container iframe, + .container iframe, .gist, .ads-wrap filter: brightness(.8) diff --git a/source/css/_mode/readmode.styl b/source/css/_mode/readmode.styl index 8ead4781c..db4a6cf0d 100644 --- a/source/css/_mode/readmode.styl +++ b/source/css/_mode/readmode.styl @@ -77,13 +77,13 @@ if hexo-config('readmode') #footer, #post > *:not(#post-info):not(.post-content), #nav, - .post-outdate-notice, + #post-outdate-notice, #web_bg, #rightside, .not-top-img display: none !important - #article-container + .container a color: #99a9bf diff --git a/source/css/_page/flink.styl b/source/css/_page/flink.styl index db01b6c30..e28808525 100644 --- a/source/css/_page/flink.styl +++ b/source/css/_page/flink.styl @@ -1,4 +1,4 @@ -#article-container +.container .flink margin-bottom: 20px diff --git a/source/css/_tags/button.styl b/source/css/_tags/button.styl index 51ff9dab7..ffad827de 100644 --- a/source/css/_tags/button.styl +++ b/source/css/_tags/button.styl @@ -1,4 +1,4 @@ -#article-container +.container .btn-center margin: 0 0 20px text-align: center diff --git a/source/css/_tags/gallery.styl b/source/css/_tags/gallery.styl index 1ab8acbb4..70145478e 100644 --- a/source/css/_tags/gallery.styl +++ b/source/css/_tags/gallery.styl @@ -1,4 +1,4 @@ -#article-container +.container figure.gallery-group position: relative float: left diff --git a/source/css/_tags/inlineImg.styl b/source/css/_tags/inlineImg.styl index c8bb0c10d..6585f4a0d 100644 --- a/source/css/_tags/inlineImg.styl +++ b/source/css/_tags/inlineImg.styl @@ -1,4 +1,4 @@ -#article-container +.container .inline-img display: inline margin: 0 3px diff --git a/source/css/_tags/series.styl b/source/css/_tags/series.styl index 5c9139e00..22b3074a9 100644 --- a/source/css/_tags/series.styl +++ b/source/css/_tags/series.styl @@ -1,4 +1,4 @@ -#article-container +.container .series-items a &:hover diff --git a/source/css/_tags/tabs.styl b/source/css/_tags/tabs.styl index 0d176a6b1..689106bb6 100644 --- a/source/css/_tags/tabs.styl +++ b/source/css/_tags/tabs.styl @@ -1,5 +1,5 @@ -#article-container +.container .tabs position: relative margin: 0 0 20px diff --git a/source/css/_tags/timeline.styl b/source/css/_tags/timeline.styl index 5e1b89c1b..36ce543b1 100644 --- a/source/css/_tags/timeline.styl +++ b/source/css/_tags/timeline.styl @@ -1,4 +1,4 @@ -#article-container +.container .timeline margin: 0 10px 20px padding: 14px 0 5px 20px diff --git a/source/js/main.js b/source/js/main.js index ed77f7c21..42cfd9766 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -807,18 +807,14 @@ document.addEventListener('DOMContentLoaded', () => { } const addPostOutdateNotice = () => { - const { limitDay, messagePrev, messageNext, position } = GLOBAL_CONFIG.noticeOutdate - const diffDay = btf.diffDate(GLOBAL_CONFIG_SITE.postUpdate) + const ele = document.getElementById('post-outdate-notice') + if (!ele) return + + const { limitDay, messagePrev, messageNext, postUpdate } = JSON.parse(ele.getAttribute('data')) + const diffDay = btf.diffDate(postUpdate) if (diffDay >= limitDay) { - const ele = document.createElement('div') - ele.className = 'post-outdate-notice' ele.textContent = `${messagePrev} ${diffDay} ${messageNext}` - const $targetEle = document.getElementById('article-container') - if (position === 'top') { - $targetEle.insertBefore(ele, $targetEle.firstChild) - } else { - $targetEle.appendChild(ele) - } + ele.hidden = false } } @@ -895,7 +891,7 @@ document.addEventListener('DOMContentLoaded', () => { justifiedIndexPostUI() if (GLOBAL_CONFIG_SITE.isPost) { - GLOBAL_CONFIG.noticeOutdate !== undefined && addPostOutdateNotice() + addPostOutdateNotice() GLOBAL_CONFIG.relativeDate.post && relativeDate(document.querySelectorAll('#post-meta time')) } else { GLOBAL_CONFIG.relativeDate.homepage && relativeDate(document.querySelectorAll('#recent-posts time'))