diff --git a/.github/logo.svg b/.github/logo.svg deleted file mode 100644 index 4e9ab5d2..00000000 --- a/.github/logo.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/.github/persona.avif b/.github/persona.avif new file mode 100644 index 00000000..a5eb7774 Binary files /dev/null and b/.github/persona.avif differ diff --git a/.github/screenshot.avif b/.github/screenshot.avif new file mode 100644 index 00000000..23825a7d Binary files /dev/null and b/.github/screenshot.avif differ diff --git a/.github/screenshot.webp b/.github/screenshot.webp deleted file mode 100644 index c6c943da..00000000 Binary files a/.github/screenshot.webp and /dev/null differ diff --git a/README.md b/README.md index 860b2d29..c7413809 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@
- Solitude logo + Solitude logo

Hexo Theme Solitude

@@ -31,11 +31,11 @@ [![gitee](https://img.shields.io/badge/Gitee-red?logo=gitee)](https://gitee.com/nsjjd_w/hexo-theme-solitude) [![gitlab](https://img.shields.io/badge/GitLab-blue?logo=gitlab)](https://gitlab.com/efu/hexo-theme-solitude) -[文档](https://solitude.js.org/)丨[预览](https://www.efu.me/) +[文档](https://solitude.js.org/)丨[预览](https://everfu.github.io/Solitude/)
-![Screenshot](.github/screenshot.webp) +![Screenshot](.github/screenshot.avif) ## 特性 diff --git a/README_en-US.md b/README_en-US.md index 2b32525e..c9528c80 100644 --- a/README_en-US.md +++ b/README_en-US.md @@ -2,7 +2,7 @@
- Solitude logo + Solitude logo

Hexo Theme Solitude

@@ -31,11 +31,11 @@ [![gitee](https://img.shields.io/badge/Gitee-red?logo=gitee)](https://gitee.com/nsjjd_w/hexo-theme-solitude) [![gitlab](https://img.shields.io/badge/GitLab-blue?logo=gitlab)](https://gitlab.com/efu/hexo-theme-solitude) -[Documentation](https://solitude.js.org/)丨[Preview](https://www.efu.me/) +[Documentation](https://solitude.js.org/)丨[Preview](https://everfu.github.io/Solitude/)
-![Screenshot](.github/screenshot.webp) +![Screenshot](.github/screenshot.avif) ## Features diff --git a/README_zh-Hant.md b/README_zh-Hant.md index f53b47c7..79ad0cf1 100644 --- a/README_zh-Hant.md +++ b/README_zh-Hant.md @@ -2,7 +2,7 @@
- Solitude logo + Solitude logo

Hexo Theme Solitude

@@ -31,11 +31,11 @@ [![gitee](https://img.shields.io/badge/Gitee-red?logo=gitee)](https://gitee.com/nsjjd_w/hexo-theme-solitude) [![gitlab](https://img.shields.io/badge/GitLab-blue?logo=gitlab)](https://gitlab.com/efu/hexo-theme-solitude) -[文档](https://solitude.js.org/)丨[預覽](https://www.efu.me/) +[文档](https://solitude.js.org/)丨[預覽](https://everfu.github.io/Solitude/)
-![Screenshot](.github/screenshot.webp) +![Screenshot](.github/screenshot.avif) ## 特性 diff --git a/_config.yml b/_config.yml index 96b8646a..a6de9288 100644 --- a/_config.yml +++ b/_config.yml @@ -329,6 +329,7 @@ page: # post default settings post: default: + top_cover: true # 顶部描述 / Top description # 文章默认图片 # default cover cover: @@ -760,7 +761,7 @@ post_ai: # latex 公式支持 # latex formula support -# docs: https://solitude.js.org/configuration/extra#数学公式 +# docs: https://solitude.js.org/config/extend.html#数学公式 katex: enable: false per_page: false # 是否在每页都加载 / Whether to load on each page @@ -776,6 +777,9 @@ comment: count: false # 评论数展示 pv: false # 是否使用評論統計頁面訪問 avatar: https://cravatar.cn # Gravatar link + hot_tip: # 多人互动 + enable: false # 开启后将在文章列表显示多人互动 + count: 3 # 设置大于多少评论时显示 # twikoo 配置信息 # twikoo settings @@ -822,8 +826,15 @@ giscus: dark: dark option: -# 中控台扩展 : 最新评论 + 标签 + 文章 -console_plus: false +# 中控台 +console: + enable: false # 开启后显示中控台 + recentComment: # 开启后显示最近评论 + enable: false # 开启前请先配置评论 + storage: .2 # 缓存时间 + card: + tags: true # 开启后显示 标签 + archive: true # 开启后显示 归档 # 站点验证 # Site verification @@ -862,7 +873,7 @@ extends: # PWA # https://developer.mozilla.org/zh-CN/docs/Web/Progressive_web_apps -# docs: https://solitude.js.org/configuration/extra#pwa +# docs: https://solitude.js.org/config/extra#pwa pwa: enable: false manifest: /manifest.json # manifest.json 文件路径 @@ -931,11 +942,43 @@ memorial: enable: false # 日期, (M-D) # Date, (M-D) - # eg: 7-8, 9-18, 12-13 ... + # eg: 7-7, 9-18, 12-13 ... date: - - "7-8" #七八卢沟桥事变 - - "9-18" #九一八事变/建军节 - - "12-13" #南京国家公祭日 + - "7-7" # 七七事变 + - "9-18" # 九一八事变/建军节 + - "12-13" # 南京国家公祭日 + +# 诱骗 +# lure +lure: + enable: false + # 跳出 + # Jump out + jump: "404 Not Found" + # 切回 + # Switch back + back: "ヾ(≧∇≦*)ゝ嘿嘿,上当了吧" + +# 文章过期提醒 +# Article expiration reminder +expire: + enable: false + # 过期时间 + # Expiration time + time: 30 + position: top # top / bottom + # 过期提示 + # Expiration prompt + text_prev: "本文已于" + text_next: "天前过期,如果内容不符,请联系站长更新。" + +# 背景图片 +# Background image +background: + enable: false + opacity: .2 + dark: https://bu.dusays.com/2023/09/29/651685ce667d1.jpg + light: https://bu.dusays.com/2023/09/29/651685cc18d39.jpg # CDN # Don't modify the following settings unless you know how they work @@ -958,6 +1001,7 @@ CDN: option: solitude_css: https://cdn2.codesign.qq.com/icons/7pOrz0WXB5ZWJPX/latest/iconfont.css + busuanzi_qj_js: https://pv.lemonso.com/js # algolia_search: # instantsearch: # pjax: diff --git a/languages/default.yml b/languages/default.yml index 7ceb13a6..b90725db 100644 --- a/languages/default.yml +++ b/languages/default.yml @@ -5,6 +5,7 @@ upload: 'datetime: ' totalk: You don't need to delete blank lines, just type in your comments. loading: Loading... day: ' days' +hot-tip: Hot theme: dark: Dark diff --git a/languages/en.yml b/languages/en.yml index f6311ed3..3d9b2795 100755 --- a/languages/en.yml +++ b/languages/en.yml @@ -5,6 +5,7 @@ upload: 'datetime: ' totalk: You don't need to delete blank lines, just type in your comments. loading: Loading... day: ' days' +hot-tip: Hot theme: dark: Dark diff --git a/languages/zh-CN.yml b/languages/zh-CN.yml index ebfdf987..52b9d351 100755 --- a/languages/zh-CN.yml +++ b/languages/zh-CN.yml @@ -5,6 +5,7 @@ upload: 发布时间: totalk: 无需删除空行,直接输入评论即可 loading: 加载中... day: ' 天' +hot-tip: 多人互动 # Language: 简体中文 theme: diff --git a/languages/zh-TW.yml b/languages/zh-TW.yml index 8cbaf040..94a1da44 100755 --- a/languages/zh-TW.yml +++ b/languages/zh-TW.yml @@ -5,6 +5,7 @@ upload: 發佈時間: totalk: 無需刪除空行,直接輸入評論即可 loading: 加載中... day: ' 天' +hot-tip: 多人互動 # Language: 繁體中文 (台灣) theme: diff --git a/layout/includes/console.pug b/layout/includes/console.pug index b07e5af3..e0030fbe 100644 --- a/layout/includes/console.pug +++ b/layout/includes/console.pug @@ -1,33 +1,46 @@ +- const { recentComment, card } = theme.console +- const { cache } = recentComment +- const limit = 6 +- const { use } = theme.comment + div#console div.close-btn(onclick="sco.hideConsole()") i.solitude.st-close-fill - if theme.console_plus - div.console-card-group - if theme.recent_comments.enable && theme.recent_comments.img - div.console-card-group-left - div.console-card#card-newest-comments(onclick="sco.hideConsole()") - div.card-content - div.author-content-item-tips= _p('console.comment_tip') - div.author-content-item-title - | #{_p('console.comment_title')} - if theme.recent_comments.enable - a.recent-comment-more(href=url_for(theme.recent_comments.page) title=_p('console.recent_comment_more')) - i.solitude.st-right-btn-fill - a.recent-comment-image(href=url_for(theme.recent_comments.page)) - img(src=theme.recent_comments.img) - - div.console-card-group-right - div.console-card.tags(onclick="sco.hideConsole()") + div.console-card-group + if use && recentComment.enable + div.console-card-group-left + div.console-card#card-newest-comments(onclick="sco.hideConsole()") div.card-content - div.author-content-item-tips= _p('console.tag_tip') - div.author-content-item-title= _p('console.tag_title') - div.card-tag-cloud - each tag in site.tags.find({ parent: { $exists: false } }).data - a(href=url_for(tag.path))= tag.name - sup= tag.length - - div.console-card.history(onclick="sco.hideConsole()") - include ./widgets/aside/asideArchive.pug + div.author-content-item-tips= _p('console.comment_tip') + div.author-content-item-title + | #{_p('console.comment_title')} + if theme.recent_comments.enable + a.recent-comment-more(href=url_for(theme.recent_comments.page) title=_p('console.recent_comment_more')) + i.solitude.st-right-btn-fill + #console_recentcomments + case use[0] + when 'Twikoo' + include ./widgets/page/recentcomment/twikoo + when 'Valine' + include ./widgets/page/recentcomment/valine + when 'Waline' + include ./widgets/page/recentcomment/waline + when 'Artalk' + include ./widgets/page/recentcomment/artalk + if card.tags || card.archive + div.console-card-group-right + if card.tags + div.console-card.tags(onclick="sco.hideConsole()") + div.card-content + div.author-content-item-tips= _p('console.tag_tip') + div.author-content-item-title= _p('console.tag_title') + div.card-tag-cloud + each tag in site.tags.find({ parent: { $exists: false } }).data + a(href=url_for(tag.path))= tag.name + sup= tag.length + if card.archive + div.console-card.history(onclick="sco.hideConsole()") + include ./widgets/aside/asideArchive.pug div.button-group div.console-btn-item diff --git a/layout/includes/head/config.pug b/layout/includes/head/config.pug index 4d782591..cd913e87 100644 --- a/layout/includes/head/config.pug +++ b/layout/includes/head/config.pug @@ -132,6 +132,24 @@ } } + let lure = false + if (theme.lure.enable) { + lure = { + jump: theme.lure.jump, + back: theme.lure.back, + } + } + + let expire = false + if (theme.expire.enable) { + expire = { + time: theme.expire.time, + position: theme.expire.position, + text_prev: theme.expire.text_prev, + text_next: theme.expire.text_next, + } + } + script. const GLOBAL_CONFIG = { root: '!{config.root}', @@ -167,4 +185,6 @@ script. lightbox: '!{ theme.mediumZoom ? "mediumZoom" : (theme.fancybox ? "fancybox" : "null")}', post_ai: !{post_ai}, right_menu: !{rightMenu ? JSON.stringify(rightMenu) : false}, + lure: !{lure ? JSON.stringify(lure) : false}, + expire: !{expire ? JSON.stringify(expire) : false}, }; \ No newline at end of file diff --git a/layout/includes/header.pug b/layout/includes/header.pug index 38b53e90..eb46132d 100644 --- a/layout/includes/header.pug +++ b/layout/includes/header.pug @@ -1,4 +1,6 @@ -header#page-header(class=is_post() ? 'post-bg' : 'not-top-img') +- const not_cover = !(typeof page.not_cover ==='undefined' ? false : page.not_cover) +header#page-header(class=is_post() && theme.post.default.top_cover && not_cover ? 'post-bg' : 'not-top-img') include ./nav.pug if is_post() - include ./widgets/post/postMeta.pug \ No newline at end of file + if theme.post.default.top_cover && !page.not_cover + include ./widgets/post/postMeta.pug \ No newline at end of file diff --git a/layout/includes/layout.pug b/layout/includes/layout.pug index 12db85b8..b0ad79d8 100644 --- a/layout/includes/layout.pug +++ b/layout/includes/layout.pug @@ -9,12 +9,17 @@ html(lang=config.language, data-theme="light") if theme.display_mode.universe canvas#universe + // background img + if theme.background.enable + #global_bg + // loading if theme.loading.fullpage include ./loading.pug // console - include ./console.pug + if theme.console.enable + include ./console.pug // sidebar include ./sidebar.pug diff --git a/layout/includes/page/recentcomment.pug b/layout/includes/page/recentcomment.pug index e29b7c60..34f35c54 100644 --- a/layout/includes/page/recentcomment.pug +++ b/layout/includes/page/recentcomment.pug @@ -4,7 +4,7 @@ include ../widgets/page/banner if enable && use - #comments-page + #console_recentcomments case use[0] when 'Twikoo' include ../widgets/page/recentcomment/twikoo diff --git a/layout/includes/widgets/home/banner.pug b/layout/includes/widgets/home/banner.pug index 41edcfb6..eabef46a 100644 --- a/layout/includes/widgets/home/banner.pug +++ b/layout/includes/widgets/home/banner.pug @@ -1,6 +1,8 @@ +- const { title, url, icon} = theme.hometop.banner + div.banners-title - div.banners-title-big!= theme.hometop.banner.title - div.banners-title-small= theme.hometop.banner.url + div.banners-title-big!= title + div.banners-title-small= url - var group = theme.hometop.group if group div.banners-links @@ -11,13 +13,14 @@ if group i.solitude(class=array[1]) .banners-link-title= label -div.tags-group-all - .tags-group-wrapper - each i in [1,2] - - var keys = Object.keys(theme.hometop.banner.icon) - - var pairs = keys.map((val, i) => i % 2 ? [keys[i - 1], val] : []).filter(x => x.length) - each pair in pairs - .tags-group-icon-pair - each key in pair - .tags-group-icon(style=`background: ${theme.hometop.banner.icon[key].color}`) - img.nolazyload(src=theme.hometop.banner.icon[key].img, title=key) \ No newline at end of file +if icon + div.tags-group-all + .tags-group-wrapper + each i in [1,2] + - var keys = Object.keys(icon) + - var pairs = keys.map((val, i) => i % 2 ? [keys[i - 1], val] : []).filter(x => x.length) + each pair in pairs + .tags-group-icon-pair + each key in pair + .tags-group-icon(style=`background: ${icon[key].color}`) + img.nolazyload(src=icon[key].img, title=key) \ No newline at end of file diff --git a/layout/includes/widgets/home/hot/index.pug b/layout/includes/widgets/home/hot/index.pug new file mode 100644 index 00000000..477e7eb3 --- /dev/null +++ b/layout/includes/widgets/home/hot/index.pug @@ -0,0 +1,7 @@ +- const { count } = theme.comment.hot_tip +- const { use } = theme.comment + +if use + case use[0] + when 'Twikoo' + include ./twikoo \ No newline at end of file diff --git a/layout/includes/widgets/home/hot/twikoo.pug b/layout/includes/widgets/home/hot/twikoo.pug new file mode 100644 index 00000000..315ba113 --- /dev/null +++ b/layout/includes/widgets/home/hot/twikoo.pug @@ -0,0 +1,46 @@ +script. + function updatePostsBasedOnComments() { + const location = window.location + const posts = Array.from(document.querySelectorAll('.recent-post-item[onclick] .post_cover a')).map(item => item.href.replace(location, '/')) + + function get() { + twikoo.getCommentsCount({ + envId: "!{theme.twikoo.envId}", + urls: posts, + includeReply: true + }).then(function (response) { + response.forEach(function (comment) { + if (comment.count > !{count}) { + const postElement = document.querySelector(`.recent-post-item[onclick*="${comment.url}"]`); + if (postElement) { + const infoTopTips = postElement.querySelector(".recent-post-info-top-tips"), + originalSpan = infoTopTips ? infoTopTips.querySelector(".original") : null; + if (originalSpan) { + const hotTip = createHotTipElement(); + infoTopTips.insertBefore(hotTip, originalSpan); + } + } + } + }); + }).catch(function (error) { + console.error("Error fetching comments:", error); + }); + } + + function createHotTipElement() { + const hotTip = document.createElement("span"); + hotTip.classList.add("hot-tip"); + + const icon = document.createElement("i"); + icon.classList.add("solitude", "st-fire-fill"); + hotTip.appendChild(icon); + + const commentCount = document.createTextNode("!{_p('hot-tip')}"); + hotTip.appendChild(commentCount); + + return hotTip; + } + + if (typeof twikoo === 'object') get() + else utils.getScript('!{url_for(theme.cdn.twikoo)}').then(get) + } \ No newline at end of file diff --git a/layout/includes/widgets/nav/right.pug b/layout/includes/widgets/nav/right.pug index e8a9436f..c19449ab 100644 --- a/layout/includes/widgets/nav/right.pug +++ b/layout/includes/widgets/nav/right.pug @@ -11,7 +11,7 @@ if theme.search.enable .nav-button#search-button a.site-page.social-icon.search(href="javascript:void(0);", title=_p('nav.search')) i.solitude.st-search-line -if theme.nav.right.console +if theme.console.enable .nav-button#nav-console a.console_switchbutton(onclick="sco.showConsole()", title=_p('nav.console'), href="javascript:void(0);") i.solitude.st-dashboard-fill diff --git a/layout/includes/widgets/page/links/banner.pug b/layout/includes/widgets/page/links/banner.pug index 4b911ff5..c11234dd 100644 --- a/layout/includes/widgets/page/links/banner.pug +++ b/layout/includes/widgets/page/links/banner.pug @@ -28,4 +28,5 @@ .tags-group-icon-pair each y in pair a.tags-group-icon(href=url_for(y.link), title=y.name) - img(src=y.avatar + (site.data.links.banner_suffix || ''), title=y.name) \ No newline at end of file + img(src=y.avatar + (site.data.links.banner_suffix || ''), title=y.name) + span.tags-group-title=y.name \ No newline at end of file diff --git a/layout/includes/widgets/page/recentcomment/artalk.pug b/layout/includes/widgets/page/recentcomment/artalk.pug index c0a6520b..61f5e6c1 100644 --- a/layout/includes/widgets/page/recentcomment/artalk.pug +++ b/layout/includes/widgets/page/recentcomment/artalk.pug @@ -2,11 +2,11 @@ script(pjax). (async () => { - document.querySelector('#comments-page').textContent = `#{__("loading")}` + document.querySelector('#console_recentcomments').textContent = `#{__("loading")}` const emojiReg = /]+ atk-emoticon="[^"]+">/g let cache = utils.saveToLocal.get('artalk-recent-comments') if (cache) { - setHtml(document.querySelector('#comments-page'), cache) + setHtml(document.querySelector('#console_recentcomments'), cache) return } let ls = [] @@ -37,7 +37,7 @@ script(pjax). content: formatContent(i.content) }) } - setHtml(document.querySelector('#comments-page'), ls) + setHtml(document.querySelector('#console_recentcomments'), ls) utils.saveToLocal.set('artalk-recent-comments', ls, !{cache}) }) diff --git a/layout/includes/widgets/page/recentcomment/twikoo.pug b/layout/includes/widgets/page/recentcomment/twikoo.pug index f3429d14..e68ada11 100644 --- a/layout/includes/widgets/page/recentcomment/twikoo.pug +++ b/layout/includes/widgets/page/recentcomment/twikoo.pug @@ -2,11 +2,11 @@ script(pjax). (async () => { - document.querySelector('#comments-page').textContent = `#{__("loading")}` + document.querySelector('#console_recentcomments').textContent = `#{__("loading")}` const emojiReg = /]+>/g let cache = utils.saveToLocal.get('twikoo-recent-comments') if (cache) { - setHtml(document.querySelector('#comments-page'), cache) + setHtml(document.querySelector('#console_recentcomments'), cache) return } let ls = [] @@ -44,7 +44,7 @@ script(pjax). time: i.created }) } - setHtml(document.querySelector('#comments-page'), ls) + setHtml(document.querySelector('#console_recentcomments'), ls) utils.saveToLocal.set('twikoo-recent-comments', ls, !{cache}) }); diff --git a/layout/includes/widgets/page/recentcomment/valine.pug b/layout/includes/widgets/page/recentcomment/valine.pug index e51811e7..9d39e159 100644 --- a/layout/includes/widgets/page/recentcomment/valine.pug +++ b/layout/includes/widgets/page/recentcomment/valine.pug @@ -2,11 +2,11 @@ script(pjax). (async () => { - document.querySelector('#comments-page').textContent = `#{__("loading")}` + document.querySelector('#console_recentcomments').textContent = `#{__("loading")}` const emojiReg = /:[a-z0-9_\u4e00-\u9fa5]+:/g let cache = utils.saveToLocal.get('valine-recent-comments') if (cache) { - setHtml(document.querySelector('#comments-page'), cache) + setHtml(document.querySelector('#console_recentcomments'), cache) return } let ls = [] @@ -42,7 +42,7 @@ script(pjax). content: formatContent(i.comment) }) } - setHtml(document.querySelector('#comments-page'), ls) + setHtml(document.querySelector('#console_recentcomments'), ls) utils.saveToLocal.set('valine-recent-comments', ls, !{cache}) }) diff --git a/layout/includes/widgets/page/recentcomment/waline.pug b/layout/includes/widgets/page/recentcomment/waline.pug index 38c397b2..35a76821 100644 --- a/layout/includes/widgets/page/recentcomment/waline.pug +++ b/layout/includes/widgets/page/recentcomment/waline.pug @@ -1,10 +1,10 @@ script(pjax). (async () => { - document.querySelector('#comments-page').textContent = `#{__("loading")}` + document.querySelector('#console_recentcomments').textContent = `#{__("loading")}` const emojiReg = /]+ class="wl-emoji">/g let cache = utils.saveToLocal.get('waline-recent-comments') if (cache) { - setHtml(document.querySelector('#comments-page'), cache) + setHtml(document.querySelector('#console_recentcomments'), cache) return } let ls = [] @@ -34,7 +34,7 @@ script(pjax). content: formatContent(i.comment) }) } - setHtml(document.querySelector('#comments-page'), ls) + setHtml(document.querySelector('#console_recentcomments'), ls) utils.saveToLocal.set('waline-recent-comments', ls, !{cache}) }) diff --git a/layout/includes/widgets/post/postInfo.pug b/layout/includes/widgets/post/postInfo.pug new file mode 100644 index 00000000..8965d967 --- /dev/null +++ b/layout/includes/widgets/post/postInfo.pug @@ -0,0 +1,80 @@ +#post-info + #post-firstinfo + .meta-firstline + - var cc = page.reprint ? _p('post.reprint') : _p('post.original') + a.post-meta-original(title=_p('post.cc').replace(/\$\{cc}/, cc))= cc + if page.categories.data.length > 0 + span.post-meta-categories + a.post-meta-categories(href=url_for('/' + page.categories.data[0].path))= page.categories.data[0].name + .tag_share + .post-meta__tag-list + each tag in page.tags.data + a.post-meta__tags(href=url_for(tag.path)) + span.tags-name.tags-punctuation= tag.name + h1.post-title= page.title + #post-meta + .meta-secondline + if theme.post.meta.date + span.post-meta-date(title=_p('post.posted') + ' ' + full_date(page.date)) + i.post-meta-icon.solitude.st-calendar-todo-fill + time(datetime=date_xml(page.date))= date_xml(page.date) + if theme.post.meta.updated + span.post-meta-date(title=_p('post.updated') + ' ' + full_date(page.updated)) + i.post-meta-icon.solitude.st-refresh-line + time(datetime=date_xml(page.updated))= date_xml(page.updated) + if theme.wordcount + span.post-meta-wordcount + if theme.post.meta.wordcount + i.post-meta-icon.solitude.st-word-fill(title=_p('post.wordcount')) + span.word-count= wordcount(page.content) + span.post-meta-separator + if theme.post.meta.readtime + i.post-meta-icon.solitude.st-clock-fill(title=_p('post.minread')) + span= min2read(page.content) + " min" + if theme.post.meta.locate + span.post-meta-position(title=_p('post.ip') + page.locate) + i.post-meta-icon.solitude.st-map-pin-fill + span= page.locate + if theme.post.meta.pv + a.post-meta-pv(href=url_for(page.path), title=_p('post.pv')) + i.post-meta-icon.solitude.st-fire-fill + if theme.comment.use && theme.comment.pv + case theme.comment.use[0] + when "Twikoo" + span#twikoo_visitors + i.solitude.st-loading-line + when "Waline" + span.waline-pageview-count + i.solitude.st-loading-line + when "Valine" + span.leancloud_visitors(id=url_for(page.path)) + span.leancloud-visitors-count + i.solitude.st-loading-line + when 'Artalk' + span#ArtalkPV + i.solitude.st-loading-line + else + if theme.busuanzi + if theme.busuanzi_use === 0 + span#busuanzi_value_page_pv + i.solitude.st-loading-line + else + span#busuanzi_page_pv + i.solitude.st-loading-line + if theme.post.meta.comment && page.comment && theme.comment.count && theme.comment.use + span.post-meta-commentcount(title=_p('post.comment'), onclick="sco.scrollTo('post-comment')") + i.solitude.st-chat-fill + a(href=url_for(page.path) + "#post-comment") + case theme.comment.use[0] + when "Twikoo" + span.twikoo-count + i.solitude.st-loading-line + when "Waline" + span.waline-comment-count + i.solitude.st-loading-line + when "Valine" + span.valine-comment-count(data-xid=url_for(page.path) itemprop="commentCount") + i.solitude.st-loading-line + when 'Artalk' + span.artalk-count + i.solitude.st-loading-line \ No newline at end of file diff --git a/layout/includes/widgets/post/postMeta.pug b/layout/includes/widgets/post/postMeta.pug index 668add01..f9689a09 100644 --- a/layout/includes/widgets/post/postMeta.pug +++ b/layout/includes/widgets/post/postMeta.pug @@ -1,84 +1,4 @@ .coverdiv#coverdiv img#post-cover.nolazyload(src=url_for(page.cover), alt=page.title) -#post-info - #post-firstinfo - .meta-firstline - - var cc = page.reprint ? _p('post.reprint') : _p('post.original') - a.post-meta-original(title=_p('post.cc').replace(/\$\{cc}/, cc))= cc - if page.categories.data.length > 0 - span.post-meta-categories - a.post-meta-categories(href=url_for('/' + page.categories.data[0].path))= page.categories.data[0].name - .tag_share - .post-meta__tag-list - each tag in page.tags.data - a.post-meta__tags(href=url_for(tag.path)) - span.tags-name.tags-punctuation= tag.name - h1.post-title= page.title - #post-meta - .meta-secondline - if theme.post.meta.date - span.post-meta-date(title=_p('post.posted') + ' ' + full_date(page.date)) - i.post-meta-icon.solitude.st-calendar-todo-fill - time(datetime=date_xml(page.date))= date_xml(page.date) - if theme.post.meta.updated - span.post-meta-date(title=_p('post.updated') + ' ' + full_date(page.updated)) - i.post-meta-icon.solitude.st-refresh-line - time(datetime=date_xml(page.updated))= date_xml(page.updated) - if theme.wordcount - span.post-meta-wordcount - if theme.post.meta.wordcount - i.post-meta-icon.solitude.st-word-fill(title=_p('post.wordcount')) - span.word-count= wordcount(page.content) - span.post-meta-separator - if theme.post.meta.readtime - i.post-meta-icon.solitude.st-clock-fill(title=_p('post.minread')) - span= min2read(page.content) + " min" - if theme.post.meta.locate - span.post-meta-position(title=_p('post.ip') + page.locate) - i.post-meta-icon.solitude.st-map-pin-fill - span= page.locate - if theme.post.meta.pv - a.post-meta-pv(href=url_for(page.path), title=_p('post.pv')) - i.post-meta-icon.solitude.st-fire-fill - if theme.comment.use && theme.comment.pv - case theme.comment.use[0] - when "Twikoo" - span#twikoo_visitors - i.solitude.st-loading-line - when "Waline" - span.waline-pageview-count - i.solitude.st-loading-line - when "Valine" - span.leancloud_visitors(id=url_for(page.path)) - span.leancloud-visitors-count - i.solitude.st-loading-line - when 'Artalk' - span#ArtalkPV - i.solitude.st-loading-line - else - if theme.busuanzi - if theme.busuanzi_use === 0 - span#busuanzi_value_page_pv - i.solitude.st-loading-line - else - span#busuanzi_page_pv - i.solitude.st-loading-line - if theme.post.meta.comment && page.comment && theme.comment.count && theme.comment.use - span.post-meta-commentcount(title=_p('post.comment'), onclick="sco.scrollTo('post-comment')") - i.solitude.st-chat-fill - a(href=url_for(page.path) + "#post-comment") - case theme.comment.use[0] - when "Twikoo" - span.twikoo-count - i.solitude.st-loading-line - when "Waline" - span.waline-comment-count - i.solitude.st-loading-line - when "Valine" - span.valine-comment-count(data-xid=url_for(page.path) itemprop="commentCount") - i.solitude.st-loading-line - when 'Artalk' - span.artalk-count - i.solitude.st-loading-line - +include ./postInfo include ./wave \ No newline at end of file diff --git a/layout/index.pug b/layout/index.pug index 2ef74e06..afd2c590 100644 --- a/layout/index.pug +++ b/layout/index.pug @@ -12,6 +12,8 @@ block content #category-bar include ./includes/widgets/home/categoryBar .recent-posts#recent-posts + if theme.comment.hot_tip.enable + include ./includes/widgets/home/hot/index.pug if theme.carousel && is_home_first_page() include ./includes/widgets/home/carousel.pug for post, index in page.posts.sort("-sticky" || "-date").data diff --git a/layout/post.pug b/layout/post.pug index 20a73347..5a623261 100644 --- a/layout/post.pug +++ b/layout/post.pug @@ -3,9 +3,12 @@ extends includes/layout.pug block content main.layout#content-inner #post - if theme.post_ai.enable && page.ai - include includes/widgets/post/post-ai - article.post-content#article-container!= page.content + if page.not_cover + include includes/widgets/post/postInfo + article.post-content#article-container + if theme.post_ai.enable && page.ai + include includes/widgets/post/post-ai + != page.content include includes/widgets/post/copyright .post-tools-right .tag_share diff --git a/scripts/event/merge_config.js b/scripts/event/merge_config.js index 8648e2b2..fbd2447d 100644 --- a/scripts/event/merge_config.js +++ b/scripts/event/merge_config.js @@ -13,7 +13,6 @@ hexo.extend.filter.register('before_generate', () => { menu: null, right: { random: false, - console: false, custom: [], } }, @@ -119,6 +118,7 @@ hexo.extend.filter.register('before_generate', () => { }, post: { default: { + top_cover: true, cover: ['/img/default.avif'], locate: 'China, Changsha', copyright: { @@ -306,6 +306,10 @@ hexo.extend.filter.register('before_generate', () => { lazyload: false, count: false, avatar: 'https://cravatar.cn', + hot_tip: { + enable: true, + count: 3 + } }, twikoo: { envId: 'your envId', @@ -333,6 +337,17 @@ hexo.extend.filter.register('before_generate', () => { site: 'your site-name', option: null, }, + console: { + enable: false, + recentComment: { + enable: false, + storage: .2, + }, + card: { + tags: true, + archive: true + } + }, verify_site: [], css_prefix: false, font: { @@ -376,6 +391,24 @@ hexo.extend.filter.register('before_generate', () => { }, custom_list: [] }, + lure: { + enable: false, + jump: '404 Not Found', + back: 'ヾ(≧∇≦*)ゝ嘿嘿,上当了吧' + }, + expire: { + enable: false, + time: 30, + position: 'top', + text_prev: '本文已于', + text_next: '天前过期,如果内容不符,请联系站长更新。', + }, + background: { + enable: false, + dark: 'https://bu.dusays.com/2023/09/29/651685ce667d1.jpg', + light: 'https://bu.dusays.com/2023/09/29/651685cc18d39.jpg', + opacity: .2, + }, CDN: { internal: 'local', third_party: 'cdnjs', diff --git a/scripts/filter/checkThemeConfig.js b/scripts/filter/checkThemeConfig.js index 2eec7f50..ce502a4d 100644 --- a/scripts/filter/checkThemeConfig.js +++ b/scripts/filter/checkThemeConfig.js @@ -4,11 +4,6 @@ hexo.extend.filter.register('before_post_render', () => { const data = hexo.locals.get('data'); const logger = hexo.log; const theme = hexo.theme.config; - if (theme.hometop.enable && !theme.hometop.banner.icon) { - logger.error('\n 启用banner的情况下,必须提供 icon 图片!\n 请在主题配置文件中设置 hometop.banner.icon 选项。'); - logger.error('\n If banner is enabled, icon image must be supplied! \n Please set the hometop.banner.icon option in the theme configuration file.'); - process.exit(-1); - } if (theme.says.enable && !data.essay) { logger.error('\n 启用说说的情况下,必须提供 essay 数据文件!\n 请新建 essay.yaml。'); logger.error('\n If says is enabled, essay data must be supplied! \n Please create essay.yaml.'); diff --git a/source/css/_comments/comment.styl b/source/css/_comments/comment.styl index 77cdc6b4..7645b0b9 100644 --- a/source/css/_comments/comment.styl +++ b/source/css/_comments/comment.styl @@ -53,10 +53,9 @@ .post-comment background var(--efu-card-bg) -div#post-comment - margin-top 2rem - #post-comment + .post & + padding 0 2rem > div.comment-head > div.comment-privacy display block @@ -100,7 +99,7 @@ div#post-comment .comment-head font-size .8em - margin-bottom .5rem + margin .5rem 0 position relative if hexo-config('comment.use')[1] diff --git a/source/css/_global/index.styl b/source/css/_global/index.styl index 904cb324..fb8d60a1 100644 --- a/source/css/_global/index.styl +++ b/source/css/_global/index.styl @@ -401,7 +401,8 @@ i.solitude box-shadow none border none padding 0 1rem - background var(--efu-background) + > #post + padding 0 .show opacity 1 !important @@ -428,4 +429,19 @@ if hexo-config('memorial.enable') -moz-filter grayscale(100%) -ms-filter grayscale(100%) -o-filter grayscale(100%) - filter grayscale(100%) \ No newline at end of file + filter grayscale(100%) + +if hexo-config('background.enable') + #global_bg + position fixed + z-index 999 + opacity hexo-config('background.opacity') + width 100% + height 100% + background-image url(hexo-config('background.light')) + background-size cover + pointer-events none + background-repeat no-repeat + + [data-theme=dark] & + background-image url(hexo-config('background.dark')) \ No newline at end of file diff --git a/source/css/_layout/article-container.styl b/source/css/_layout/article-container.styl index 228666d5..2c084836 100644 --- a/source/css/_layout/article-container.styl +++ b/source/css/_layout/article-container.styl @@ -2,6 +2,10 @@ overflow-wrap break-word +maxWidth768() overflow hidden + padding .5rem + + .post & + padding 1rem 2rem iframe border-radius 12px diff --git a/source/css/_layout/console.styl b/source/css/_layout/console.styl index ee33dc09..0991932b 100644 --- a/source/css/_layout/console.styl +++ b/source/css/_layout/console.styl @@ -28,7 +28,7 @@ .console-card-group display flex - justify-content space-between + justify-content center align-items center margin 0 30px transform translateY(20px) diff --git a/source/css/_layout/expire.styl b/source/css/_layout/expire.styl new file mode 100644 index 00000000..8edaa145 --- /dev/null +++ b/source/css/_layout/expire.styl @@ -0,0 +1,13 @@ +if hexo-config("expire.enable") + .expire + display flex + align-items center + border-radius 8px + background-color rgba(255,0,0,.5) + border-left 5px solid var(--efu-red) + padding 10px 16px + color var(--efu-white) + + i.solitude + color var(--efu-white) + margin-right 8px \ No newline at end of file diff --git a/source/css/_layout/header.styl b/source/css/_layout/header.styl index 056d2b94..13a3280a 100644 --- a/source/css/_layout/header.styl +++ b/source/css/_layout/header.styl @@ -567,12 +567,6 @@ .nav-button cursor pointer -#site-name - .iconfont - font-size 20px - font-weight 400 - line-height 48px - #site-logo width 121px @@ -738,14 +732,15 @@ if hexo-config('nav.group') background-color var(--efu-main) .post - if hexo-config('nav.group') - .back-home-button - color var(--efu-white) - - &:hover - background var(--efu-white-op) + .post-bg + if hexo-config('nav.group') + .back-home-button color var(--efu-white) - cursor pointer + + &:hover + background var(--efu-white-op) + color var(--efu-white) + cursor pointer #nav #site-name @@ -761,6 +756,12 @@ if hexo-config('nav.group') #site-name &:after color var(--efu-card-bg) + .not-top-img + #nav + a + &:hover + +minWidth900() + background var(--efu-lighttext) .back-menu-list display flex diff --git a/source/css/_page/_home/home-top.styl b/source/css/_page/_home/home-top.styl index c4214a7c..e29e21e7 100644 --- a/source/css/_page/_home/home-top.styl +++ b/source/css/_page/_home/home-top.styl @@ -25,6 +25,7 @@ .recent-post-group display flex flex-direction row + justify-content space-between flex-wrap wrap align-content space-between gap .5rem @@ -91,6 +92,10 @@ position relative box-shadow var(--efu-shadow-border) + &:nth-last-child(2):nth-child(1), + &:nth-last-child(1):nth-child(2) + width calc(100% / 2 - 0.5rem) + +maxWidth1200() width 200px min-width 200px @@ -244,6 +249,7 @@ .banner-button-group bottom: 1rem + .banners-links display flex position absolute diff --git a/source/css/_page/_home/home.styl b/source/css/_page/_home/home.styl index 56d36139..8d6ba77e 100644 --- a/source/css/_page/_home/home.styl +++ b/source/css/_page/_home/home.styl @@ -21,4 +21,7 @@ if hexo-config('aside.position') == 0 order 2 else #home - order 1 \ No newline at end of file + order 1 + +if hexo-config('comment.hot_tip.enable') + @import "hot-tip.styl" \ No newline at end of file diff --git a/source/css/_page/_home/hot-tip.styl b/source/css/_page/_home/hot-tip.styl new file mode 100644 index 00000000..ec1c4a14 --- /dev/null +++ b/source/css/_page/_home/hot-tip.styl @@ -0,0 +1,11 @@ +.hot-tip + display flex + color var(--efu-red) + font-size .5rem + position relative + margin-right 8px + align-items center + gap 1px + + i + font-size 10px \ No newline at end of file diff --git a/source/css/_page/index.styl b/source/css/_page/index.styl index defa73ff..ec009a48 100644 --- a/source/css/_page/index.styl +++ b/source/css/_page/index.styl @@ -6,7 +6,7 @@ @import "error.styl" -if hexo-config('recent_comments.enable') +if hexo-config('recent_comments.enable') || (hexo-config('console.enable') && hexo-config('console.recentComment.enable')) @import "recentcomment.styl" if hexo-config('says.enable') diff --git a/source/css/_page/links.styl b/source/css/_page/links.styl index e742a33a..08547b23 100644 --- a/source/css/_page/links.styl +++ b/source/css/_page/links.styl @@ -1,6 +1,24 @@ .flink#banners margin-bottom: .5rem +.tags-group-title + font-size 14px + color var(--efu-card-bg) + background var(--efu-lighttext) + position absolute + width 100% + height 100% + display flex + border-radius 120px + align-items center + justify-content center + opacity 0 + transition .3s + +.flink .tags-group-icon:hover .tags-group-title + opacity 1 + backdrop-filter saturate(180%) blur(20px) + .flink#article-container margin-top 1rem @@ -67,7 +85,10 @@ width calc(25% - 16px) +maxWidth768() - width calc(33.3333% - 16px) + width calc(100% / 3 - 16px) + + +maxWidth600() + width calc(100% / 2 - 16px) .img border-radius 0 diff --git a/source/css/_page/other.styl b/source/css/_page/other.styl index 0c8b592c..001b8b53 100644 --- a/source/css/_page/other.styl +++ b/source/css/_page/other.styl @@ -13,6 +13,7 @@ div#banners animation slide-in .6s .1s backwards #home_top & + height 100% +maxWidth1200() height calc(328px + .5rem) @@ -122,6 +123,7 @@ div#banners border-radius 50% /.tags-group-icon + position relative width 120px height 120px border-radius 30px diff --git a/source/css/_page/recentcomment.styl b/source/css/_page/recentcomment.styl index 8ca5a168..511da1c3 100644 --- a/source/css/_page/recentcomment.styl +++ b/source/css/_page/recentcomment.styl @@ -1,4 +1,4 @@ -div#comments-page +div#console_recentcomments display flex flex-wrap wrap gap 12px @@ -20,6 +20,9 @@ div#comments-page display flex flex-direction column + .console-card & + width calc(100% / 2 - 8px) + +maxWidth900() width calc(100% / 2 - 6px) @@ -69,7 +72,7 @@ div#comments-page font-size 12px line-height 12px -#comments-page .comment-info img +#console_recentcomments .comment-info img width 30px height 30px object-fit cover diff --git a/source/css/_post/copyright.styl b/source/css/_post/copyright.styl index a9bd1b9e..665f2403 100644 --- a/source/css/_post/copyright.styl +++ b/source/css/_post/copyright.styl @@ -4,7 +4,7 @@ border-width 1px transition 0.3s position relative - margin 80px 0 .5rem + margin 1rem 2rem .5rem border-radius 12px padding 34px 0 20px 0 border var(--style-border-always) diff --git a/source/css/_post/meta.styl b/source/css/_post/meta.styl index cacba57f..735c73bd 100644 --- a/source/css/_post/meta.styl +++ b/source/css/_post/meta.styl @@ -136,242 +136,251 @@ &.loaded display block - #post-info + #post-info + top 0 + position absolute + padding 0 3rem + margin 0 auto + color var(--efu-white) + max-width 1400px + display flex + flex-direction column + align-items flex-start + height calc(100% + 0px) + justify-content center + animation slide-in .6s 0s backwards + width 100% + text-align center + + +minWidth1300() + height calc(100% + 0px) top 0 - position absolute - padding 0 3rem - margin 0 auto - color var(--efu-white) - max-width 1400px display flex - flex-direction column - align-items flex-start - height calc(100% + 0px) justify-content center - animation slide-in .6s 0s backwards - width 100% - text-align center + + +maxWidth900() + bottom 1.5rem + text-align left + + +maxWidth768() + padding 0 6% + justify-content normal + padding-top 18rem + + .post-title + color var(--efu-white) + font-weight 700 + font-size 2.3rem + line-height 1.2 + text-align left + margin 1rem 0 1rem 0 + -webkit-line-clamp 2 + padding 0 + overflow hidden + + +maxWidth768() + font-size 1.2rem + -webkit-line-clamp 3 + margin .2rem auto + text-align center + z-index 1 +minWidth1300() - height calc(100% + 0px) - top 0 - display flex - justify-content center + width 1100px + font-size 2.6rem !important - +maxWidth900() - bottom 1.5rem - text-align left + #post-meta + margin-top .4rem + transition .3s + display flex + user-select none + color var(--light-grey) + font-size 95% +maxWidth768() - padding 0 6% - justify-content normal - padding-top 18rem - - .post-title - color var(--efu-white) - font-weight 700 - font-size 2.3rem - line-height 1.2 - text-align left - margin 1rem 0 1rem 0 - -webkit-line-clamp 2 - padding 0 - overflow hidden + font-size 90% + padding 0 2rem - +maxWidth768() - font-size 1.2rem - -webkit-line-clamp 3 - margin .2rem auto - text-align center - z-index 1 - - +minWidth1300() - width 1100px - font-size 2.6rem !important - - #post-meta - margin-top .4rem - transition .3s - display flex - user-select none + a color var(--light-grey) - font-size 95% + transition all .3s ease-out 0s - +maxWidth768() - font-size 90% - padding 0 2rem + i + font-size 16px + margin-right 4px - a - color var(--light-grey) - transition all .3s ease-out 0s + > div + text-align left - i - font-size 16px - margin-right 4px + .meta-secondline + display flex + flex-direction row + flex-wrap wrap + justify-content flex-start + align-items center - > div - text-align left + +maxWidth768() + justify-content center - .meta-secondline - display flex - flex-direction row - flex-wrap wrap - justify-content flex-start + > span + display: flex align-items center + line-height 1 + margin 0 .5rem +maxWidth768() - justify-content center + line-height 1.5 - > span - display: flex - align-items center - line-height 1 - margin 0 .5rem + > span:first-child + margin-left 0 - +maxWidth768() - line-height 1.5 + .post-meta-date, .post-meta-wordcount, .post-meta-position, .post-meta-pv + opacity .6 - > span:first-child - margin-left 0 + .post-meta-separator + margin 0 1rem 0 0 - .post-meta-date, .post-meta-wordcount, .post-meta-position, .post-meta-pv - opacity .6 - - .post-meta-separator - margin 0 1rem 0 0 + .post-meta-pv + margin-right 8px + padding 0 8px + display flex + align-items center + border-radius 12px - .post-meta-pv - margin-right 8px - padding 0 8px - display flex - align-items center - border-radius 12px + &:hover + opacity 1 + background var(--efu-white-op) + text-decoration none + color var(--efu-white) - &:hover - opacity 1 - background var(--efu-white-op) - text-decoration none - color var(--efu-white) + .post-meta-pv-cv + margin-left .8rem - .post-meta-pv-cv - margin-left .8rem + #busuanzi_value_page_pv + font-weight 800 - #busuanzi_value_page_pv - font-weight 800 + .post-meta-commentcount + opacity .6 + cursor pointer + transition .3s + border-radius 12px + padding 8px - .post-meta-commentcount - opacity .6 - cursor pointer - transition .3s - border-radius 12px - padding 8px + &:hover + opacity 1 + background var(--efu-white-op) - &:hover - opacity 1 - background var(--efu-white-op) + .post-meta-wechat + margin-right .8rem + opacity .6 + transition .3s + cursor pointer - .post-meta-wechat - margin-right .8rem - opacity .6 - transition .3s - cursor pointer + &:hover + opacity 1 + background var(--efu-white-op) - &:hover - opacity 1 - background var(--efu-white-op) + #post-firstinfo + text-align left + display flex + white-space nowrap + user-select none - #post-firstinfo - text-align left - display flex + +maxWidth768() white-space nowrap - user-select none + margin 0 auto + z-index 1 - +maxWidth768() - white-space nowrap - margin 0 auto - z-index 1 + .tag_share + display none - .tag_share - display none + .meta-firstline + display flex + align-items center + height 32px - .meta-firstline + +maxWidth768() + margin-bottom .4rem + + .post-meta-original + background var(--efu-white-op) + color var(--efu-white) + padding 0 .5rem + font-size .7rem + margin auto + border-radius 8px + font-weight 700 + line-height 32px + width 100% + height 100% display flex - align-items center - height 32px - - +maxWidth768() - margin-bottom .4rem - .post-meta-original - background var(--efu-white-op) - color var(--efu-white) - padding 0 .5rem - font-size .7rem - margin auto + &:hover + color var(--efu-main) + background var(--efu-white) border-radius 8px - font-weight 700 - line-height 32px - width 100% - height 100% + + .tag_share + margin-left .5rem + + .post-meta__tag-list display flex + flex-direction row + align-items center - &:hover - color var(--efu-main) - background var(--efu-white) - border-radius 8px + +maxWidth768() + display none - .tag_share - margin-left .5rem + &::-webkit-scrollbar + display none - .post-meta__tag-list + .post-meta__tags + color var(--efu-white) + opacity .8 + margin-right 8px + padding 0 8px + border-radius 12px display flex - flex-direction row align-items center + flex-direction row + + &:hover + color var(--efu-white) + opacity 1 + background var(--efu-white-op) +maxWidth768() - display none + margin 0 .5rem 0 0 - &::-webkit-scrollbar - display none + span.post-meta-categories + background-color var(--efu-white-op) + border-radius 8px + line-height 32px + height 32px + transition .3s - .post-meta__tags - color var(--efu-white) - opacity .8 - margin-right 8px - padding 0 8px - border-radius 12px - display flex - align-items center - flex-direction row - - &:hover - color var(--efu-white) - opacity 1 - background var(--efu-white-op) - - +maxWidth768() - margin 0 .5rem 0 0 - - span.post-meta-categories - background-color var(--efu-white-op) - border-radius 8px - line-height 32px - height 32px - transition .3s + &:not(:first-child) + margin-left 8px - &:not(:first-child) - margin-left 8px + &:hover + background-color var(--efu-white) - &:hover - background-color var(--efu-white) + a.post-meta-categories + color var(--efu-white) + font-size .7rem + width 100% + height 100% + display flex + padding 0 .5rem - a.post-meta-categories - color var(--efu-white) - font-size .7rem - width 100% - height 100% - display flex - padding 0 .5rem + &:hover + color var(--efu-main) - &:hover - color var(--efu-main) \ No newline at end of file +#post #post-info + height auto + position unset + padding 1rem 2rem + background var(--efu-main) + border-radius 12px 12px 0 0 + +minWidth768() + min-height 250px \ No newline at end of file diff --git a/source/css/_post/pagination.styl b/source/css/_post/pagination.styl index 7ea09858..5947f090 100644 --- a/source/css/_post/pagination.styl +++ b/source/css/_post/pagination.styl @@ -1,4 +1,5 @@ #post #pagination + width auto overflow hidden position inherit border var(--style-border-always) @@ -33,15 +34,11 @@ box-shadow var(--efu-shadow-border) &.pagination-post - margin-top 1.5rem + margin 0 2rem background var(--efu-card-bg) +minWidth768() border-radius 12px - margin-top 1rem - - +minWidth1300() - margin-top 0 .next-post, .prev-post, .next-post.pull-right, .prev-post.pull-left background var(--efu-secondbg) diff --git a/source/css/_post/relatedPost.styl b/source/css/_post/relatedPost.styl index fd385c40..94fd8b20 100644 --- a/source/css/_post/relatedPost.styl +++ b/source/css/_post/relatedPost.styl @@ -1,5 +1,5 @@ .relatedPosts - margin-top 2rem + margin 2rem 2rem 0 user-select none .relatedPosts-list > div diff --git a/source/css/_post/tools.styl b/source/css/_post/tools.styl index 26b8dc2b..7697ac9b 100644 --- a/source/css/_post/tools.styl +++ b/source/css/_post/tools.styl @@ -198,12 +198,12 @@ .post-tools-right - padding-right: 0 display: flex align-items: center flex-direction: row justify-content: space-between flex-wrap: wrap + padding 0 2rem .tag_share .post-meta__tag-list diff --git a/source/js/main.js b/source/js/main.js index 308c78a4..ba94cea7 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -3,7 +3,7 @@ const sidebarFn = () => { const $mobileSidebarMenus = document.getElementById('sidebar-menus'); const $menuMask = document.getElementById('menu-mask'); const $body = document.body; - + const toggleMobileSidebar = (isOpen) => { utils.sidebarPaddingR(); $body.style.overflow = isOpen ? 'hidden' : ''; @@ -18,7 +18,7 @@ const sidebarFn = () => { } $toggleMenu.addEventListener('click', () => toggleMobileSidebar(true)); $menuMask.addEventListener('click', closeMobileSidebar); - + window.addEventListener('resize', () => { if (utils.isHidden($toggleMenu) && $mobileSidebarMenus.classList.contains('open')) { closeMobileSidebar(); @@ -107,11 +107,13 @@ const asideStatus = () => { const status = utils.saveToLocal.get('aside-status'); document.documentElement.classList.toggle('hide-aside', status === 'hide'); } + function initThemeColor() { const currentTop = window.scrollY || document.documentElement.scrollTop; const themeColor = currentTop > 0 ? '--efu-card-bg' : PAGE_CONFIG.is_post ? '--efu-main' : '--efu-background'; applyThemeColor(getComputedStyle(document.documentElement).getPropertyValue(themeColor)); } + function applyThemeColor(color) { const themeColorMeta = document.querySelector('meta[name="theme-color"]'); const appleMobileWebAppMeta = document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]'); @@ -121,6 +123,7 @@ function applyThemeColor(color) { document.body.style.backgroundColor = color; } } + const handleThemeChange = mode => { const themeChange = window.globalFn?.themeChange || {} for (let key in themeChange) { @@ -213,7 +216,7 @@ const sco = { document.documentElement.setAttribute('data-theme', newMode); utils.saveToLocal.set('theme', newMode, 0.02); utils.snackbarShow(GLOBAL_CONFIG.lang.theme[newMode], false, 2000); - if(typeof rm === 'object') rm.mode(!isDarkMode) && rm.hideRightMenu(); + if (typeof rm === 'object') rm.mode(!isDarkMode) && rm.hideRightMenu(); handleThemeChange(newMode); }, hideTodayCard: () => document.getElementById('todayCard').classList.add('hide'), @@ -241,7 +244,7 @@ const sco = { inputs.forEach(selector => { const el = document.querySelector(selector); if (el) { - el.dispatchEvent(new Event('input', { bubble: true, cancelable: true })); + el.dispatchEvent(new Event('input', {bubble: true, cancelable: true})); el.value = '> ' + txt.replace(/\n/g, '\n> ') + '\n\n'; utils.scrollToDest(utils.getEleTop(document.getElementById('post-comment')), 300); el.focus(); @@ -298,11 +301,11 @@ const sco = { } const greetings = [ - { start: 0, end: 5, text: nick ? prefix : lang.goodnight }, - { start: 6, end: 10, text: nick ? prefix : lang.morning }, - { start: 11, end: 14, text: nick ? prefix : lang.noon }, - { start: 15, end: 18, text: nick ? prefix : lang.afternoon }, - { start: 19, end: 24, text: nick ? prefix : lang.night }, + {start: 0, end: 5, text: nick ? prefix : lang.goodnight}, + {start: 6, end: 10, text: nick ? prefix : lang.morning}, + {start: 11, end: 14, text: nick ? prefix : lang.noon}, + {start: 15, end: 18, text: nick ? prefix : lang.afternoon}, + {start: 19, end: 24, text: nick ? prefix : lang.night}, ]; const greeting = greetings.find(g => hours >= g.start && hours <= g.end); el.innerText = greeting.text; @@ -325,7 +328,7 @@ const sco = { categoriesBarActive() { const categoryBar = document.querySelector("#category-bar"); const currentPath = decodeURIComponent(window.location.pathname); - const isHomePage = currentPath === "/"; + const isHomePage = currentPath === GLOBAL_CONFIG.root; if (categoryBar) { const categoryItems = categoryBar.querySelectorAll(".category-bar-item"); categoryItems.forEach(item => item.classList.remove("select")); @@ -343,9 +346,9 @@ const sco = { const isScrollBarAtEnd = () => scrollBar.scrollLeft + scrollBar.clientWidth >= scrollBar.scrollWidth - 8; const scroll = () => { if (isScrollBarAtEnd()) { - scrollBar.scroll({ left: 0, behavior: "smooth" }); + scrollBar.scroll({left: 0, behavior: "smooth"}); } else { - scrollBar.scrollBy({ left: scrollBar.clientWidth, behavior: "smooth" }); + scrollBar.scrollBy({left: scrollBar.clientWidth, behavior: "smooth"}); } }; scrollBar.addEventListener("scroll", () => { @@ -528,6 +531,7 @@ const addHighlight = () => { }) } } + class toc { static init() { const tocContainer = document.getElementById('card-toc') @@ -544,11 +548,13 @@ class toc { }) this.active(el) } + static active(toc) { const $article = document.getElementById('article-container') const $tocContent = document.getElementById('toc-content') const list = $article.querySelectorAll('h1,h2,h3,h4,h5,h6') let detectItem = '' + function autoScroll(el) { const activePosition = el.getBoundingClientRect().top const sidebarScrollTop = $tocContent.scrollTop @@ -559,6 +565,7 @@ class toc { $tocContent.scrollTop = sidebarScrollTop - 150 } } + function findHeadPosition(top) { if (top === 0) return false let currentIndex = '' @@ -582,6 +589,7 @@ class toc { } } } + window.tocScrollFn = utils.throttle(function () { const currentTop = window.scrollY || document.documentElement.scrollTop findHeadPosition(currentTop) @@ -589,11 +597,13 @@ class toc { window.addEventListener('scroll', tocScrollFn) } } + class tabs { static init() { this.clickFnOfTabs(); this.backToTop(); } + static clickFnOfTabs() { document.querySelectorAll('#article-container .tab > button').forEach((item) => { item.addEventListener('click', function (e) { @@ -614,6 +624,7 @@ class tabs { }); }); } + static backToTop() { document.querySelectorAll('#article-container .tabs .tab-to-top').forEach((item) => { item.addEventListener('click', function () { @@ -621,11 +632,41 @@ class tabs { }); }); } + + static lureAddListener() { + if (!GLOBAL_CONFIG.lure) return; + let title = document.title; + document.addEventListener('visibilitychange', () => { + const {lure} = GLOBAL_CONFIG; + if (document.visibilityState === 'hidden') { + document.title = lure.jump; + } else if (document.visibilityState === 'visible') { + document.title = lure.back; + setTimeout(() => { + document.title = title; + }, 2000); + } + }); + } + + static expireAddListener() { + const {expire} = GLOBAL_CONFIG; + if (!expire) return; + const post_date = document.querySelector('.post-meta-date time'); + if (!post_date) return; + const ex = Math.ceil((new Date().getTime() - new Date(post_date.getAttribute('datetime')).getTime()) / 1000 / 60 / 60 / 24); + if (expire.time > ex) return; + const ele = document.createElement('div'); + ele.className = 'expire'; + ele.innerHTML = `${expire.text_prev}${-(expire.time - ex)}${expire.text_next}`; + const articleContainer = document.getElementById('article-container'); + articleContainer.insertAdjacentElement(expire.position === 'top' ? 'afterbegin' : 'beforeend', ele); + } } window.refreshFn = () => { const {is_home, is_page, page, is_post} = PAGE_CONFIG; - const {runtime, lazyload, lightbox, randomlink, covercolor, post_ai} = GLOBAL_CONFIG; + const {runtime, lazyload, lightbox, randomlink, covercolor, post_ai, lure, expire} = GLOBAL_CONFIG; const timeSelector = (is_home ? '.post-meta-date time' : is_post ? '.post-meta-date time' : '.datatime') + ', .webinfo-item time'; document.body.setAttribute('data-type', page); sco.changeTimeFormat(document.querySelectorAll(timeSelector)); @@ -637,13 +678,20 @@ window.refreshFn = () => { post_ai && is_post && efu_ai.init(); sco.switchComments(); initObserver(); - if (is_home) showTodayCard(); + if (is_home){ + showTodayCard(); + typeof updatePostsBasedOnComments === 'function' && updatePostsBasedOnComments() + } if (is_post || is_page) { addHighlight(); tabs.init(); } + if (is_post) { + if (expire) tabs.expireAddListener(); + } if (covercolor.enable) coverColor(); if (PAGE_CONFIG.toc) toc.init(); + if (lure) tabs.lureAddListener(); } document.addEventListener('DOMContentLoaded', () => { [addCopyright, sco.initConsoleState, window.refreshFn, asideStatus, () => window.onscroll = percent].forEach(fn => fn()); @@ -654,7 +702,7 @@ document.addEventListener('visibilitychange', () => { } }); window.onkeydown = e => { - const { keyCode, ctrlKey, shiftKey } = e; + const {keyCode, ctrlKey, shiftKey} = e; if (keyCode === 123 || (ctrlKey && shiftKey && keyCode === 67)) { utils.snackbarShow(GLOBAL_CONFIG.lang.f12, false, 3000); }