From ce274ee718fb41ada66256ac6f993253d57c7686 Mon Sep 17 00:00:00 2001 From: Ever Fu Date: Wed, 21 Aug 2024 14:27:54 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E2=9C=A8=20=E5=A2=9E=E5=8A=A0=E5=AF=B9=20C?= =?UTF-8?q?hart.js=20=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 9 +- layout/includes/inject/body.pug | 203 +++++++++++---------- layout/includes/widgets/post/copyright.pug | 2 +- plugins.yml | 7 +- scripts/helper/inject_head_js.js | 20 +- scripts/tags/chart.js | 27 +++ source/js/utils.js | 8 +- 7 files changed, 158 insertions(+), 118 deletions(-) create mode 100644 scripts/tags/chart.js diff --git a/_config.yml b/_config.yml index b5127814..6b77505e 100644 --- a/_config.yml +++ b/_config.yml @@ -297,8 +297,8 @@ post: enable: true author: url: /about/ # Author link - # Default icon is not filled in - # 不填显示默认图标 + # Default use site.icon + # 默认使用 site.icon img: # License # 许可证 @@ -626,6 +626,11 @@ mediumZoom: false # mediumZoom mermaid: false # --------------------------- end --------------------------- +# --------------------------- start --------------------------- +# Chart.js +chart: false +# --------------------------- end --------------------------- + # --------------------------- start --------------------------- # OpenGraph OpenGraph: diff --git a/layout/includes/inject/body.pug b/layout/includes/inject/body.pug index 60b05299..a9a5a2a1 100644 --- a/layout/includes/inject/body.pug +++ b/layout/includes/inject/body.pug @@ -1,112 +1,115 @@ - page.type = is_post() ? 'post' : page.type mixin katex - if theme.katex.copytex - script(src=url_for(theme.cdn.katex_copytex)) - script. - (() => { - document.querySelectorAll('#article-container span.katex-display').forEach(item => { - utils.wrap(item, 'div', {class: 'katex-wrap'}) - }) - })(); + if theme.katex.copytex + script(src=url_for(theme.cdn.katex_copytex)) + script. + (() => { + document.querySelectorAll('#article-container span.katex-display').forEach(item => { + utils.wrap(item, 'div', {class: 'katex-wrap'}) + }) + })(); div - script(src=url_for(theme.cdn.utils)) - script(src=url_for(theme.cdn.main)) - script(src=url_for(theme.cdn.waterfall)) - script(src=url_for(theme.cdn.pjax)) - - if theme.post.share.enable && theme.post.share.list && theme.post.share.list.includes('qrcode') - script(src=url_for(theme.cdn.qrcode)) - - if theme.mermaid - script(src=url_for(theme.cdn.mermaid_js)) - - if theme.display_mode.universe - script(src=url_for(theme.cdn.universe_js)) - script. - dark() - - if theme.right_menu.enable && theme.right_menu.translate.enable - script(src=url_for(theme.cdn.translate_js)) - - if theme.katex && theme.katex.enable - if theme.katex.per_page && (is_post() || is_page()) - +katex - else if page.katex - +katex - - if theme.lazyload.enable - script(src=url_for(theme.cdn.lazyload)) - script(src=url_for(theme.cdn.snackbar)) - if theme.lightbox - if theme.mediumZoom - script(src=url_for(theme.cdn.medium_zoom)) - if theme.fancybox - script(src=url_for(theme.cdn.fancyapps_ui)) - if (theme.says.home_mini && theme.says.enable) || theme.carousel - script(src=url_for(theme.cdn.swiper_js)) - - if theme.post_ai.enable - script(src=url_for(theme.cdn.efu_ai)) - - if theme.capsule.enable || theme.music.enable || theme.says.enable + script(src=url_for(theme.cdn.utils)) + script(src=url_for(theme.cdn.main)) + script(src=url_for(theme.cdn.waterfall)) + script(src=url_for(theme.cdn.pjax)) + + if theme.post.share.enable && theme.post.share.list && theme.post.share.list.includes('qrcode') + script(src=url_for(theme.cdn.qrcode)) + + if theme.mermaid + script(src=url_for(theme.cdn.mermaid_js)) + + if theme.chart + script(src=url_for(theme.cdn.chart_js)) + + if theme.display_mode.universe + script(src=url_for(theme.cdn.universe_js)) + script. + dark() + + if theme.right_menu.enable && theme.right_menu.translate.enable + script(src=url_for(theme.cdn.translate_js)) + + if theme.katex && theme.katex.enable + if theme.katex.per_page && (is_post() || is_page()) + +katex + else if page.katex + +katex + + if theme.lazyload.enable + script(src=url_for(theme.cdn.lazyload)) + script(src=url_for(theme.cdn.snackbar)) + if theme.lightbox + if theme.mediumZoom + script(src=url_for(theme.cdn.medium_zoom)) + if theme.fancybox + script(src=url_for(theme.cdn.fancyapps_ui)) + if (theme.says.home_mini && theme.says.enable) || theme.carousel + script(src=url_for(theme.cdn.swiper_js)) + + if theme.post_ai.enable + script(src=url_for(theme.cdn.efu_ai)) + + if theme.capsule.enable || theme.music.enable || theme.says.enable + script. + var meting_api = '!{theme.meting_api}'; + script(src=url_for(theme.cdn.aplayer_js)) + script(src=url_for(theme.cdn.meting_js)) + + if theme.post.covercolor.enable + case theme.post.covercolor.mode + when 'local' + script(src=url_for(theme.cdn.cover_local)) + when 'api' script. - var meting_api = '!{theme.meting_api}'; - script(src=url_for(theme.cdn.aplayer_js)) - script(src=url_for(theme.cdn.meting_js)) - - if theme.post.covercolor.enable - case theme.post.covercolor.mode - when 'local' - script(src=url_for(theme.cdn.cover_local)) - when 'api' - script. - const coverColorConfig = { - api: '!{theme.post.covercolor.api}', - time: !{theme.post.covercolor.time} - } - script(src=url_for(theme.cdn.cover_api)) - - if theme.loading.pace - script(src=url_for(theme.cdn.pace_js)) - - if theme.search.enable && theme.search.type === "algolia" - script(src=url_for(theme.cdn.instantsearch)) - script(src=url_for(theme.cdn.algolia_search)) - - if theme.right_menu.enable - script(src=url_for(theme.cdn.right_menu_js)) - - if theme.extends.body - each item in theme.extends.body - != item - - .js-pjax - if is_home() && theme.says.enable && theme.says.home_mini - script. - sco.initbbtalk() - if page.type === 'says' && theme.says.enable - script. - GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".bber-content-img img")); - sco.changeTimeFormat(document.querySelectorAll('.bber-info-time time')) - if comment_js - include ../widgets/third-party/comments/js - if theme.mermaid - script. - mermaid.run(); - if is_home() && theme.carousel && site.posts.data.filter(item => item.recommend === true).slice(0, 6) || false - script. - carousel_swiper() - if theme.busuanzi && (theme.aside.siteinfo.uv || theme.aside.siteinfo.pv) - if theme.busuanzi_use === 0 - script(defer pjax src=url_for(theme.cdn.busuanzi_js)) - else - script(defer pjax src=url_for(theme.cdn.busuanzi_qj_js)) + const coverColorConfig = { + api: '!{theme.post.covercolor.api}', + time: !{theme.post.covercolor.time} + } + script(src=url_for(theme.cdn.cover_api)) + + if theme.loading.pace + script(src=url_for(theme.cdn.pace_js)) + + if theme.search.enable && theme.search.type === "algolia" + script(src=url_for(theme.cdn.instantsearch)) + script(src=url_for(theme.cdn.algolia_search)) + + if theme.right_menu.enable + script(src=url_for(theme.cdn.right_menu_js)) + + if theme.extends.body + each item in theme.extends.body + != item + + .js-pjax + if is_home() && theme.says.enable && theme.says.home_mini + script. + sco.initbbtalk() + if page.type === 'says' && theme.says.enable + script. + GLOBAL_CONFIG.lightbox && utils.lightbox(document.querySelectorAll(".bber-content-img img")); + sco.changeTimeFormat(document.querySelectorAll('.bber-info-time time')) + if comment_js + include ../widgets/third-party/comments/js + if theme.mermaid + script. + mermaid.run(); + if is_home() && theme.carousel && site.posts.data.filter(item => item.recommend === true).slice(0, 6) || false + script. + carousel_swiper() + if theme.busuanzi && (theme.aside.siteinfo.uv || theme.aside.siteinfo.pv) + if theme.busuanzi_use === 0 + script(defer pjax src=url_for(theme.cdn.busuanzi_js)) + else + script(defer pjax src=url_for(theme.cdn.busuanzi_qj_js)) if theme.footer.randomlink - include ../widgets/randomlink.pug + include ../widgets/randomlink.pug // pjax != partial("includes/widgets/third-party/pjax", {}, {cache: true}) diff --git a/layout/includes/widgets/post/copyright.pug b/layout/includes/widgets/post/copyright.pug index 31beec83..a926b89c 100644 --- a/layout/includes/widgets/post/copyright.pug +++ b/layout/includes/widgets/post/copyright.pug @@ -71,4 +71,4 @@ a(href=url_for(theme.post.default.copyright.licenurl)) | #{theme.post.default.copyright.license} = _p('post.copyright.original_end') - a(href=url_for("/")) #{config.title} \ No newline at end of file + a(href=url_for("/")) #{config.title} diff --git a/plugins.yml b/plugins.yml index b5b49bd1..fa2feeac 100644 --- a/plugins.yml +++ b/plugins.yml @@ -109,8 +109,13 @@ fancyapps_css: other_name: fancyapps-ui mermaid_js: name: mermaid - file: dist/mermaid.min.js + file: dist/mermaid.js version: 10.9.1 +chart_js: + name: chart.js + file: dist/chart.umd.js + version: 4.4.1 + other_name: Chart.js blueimp_md5: name: blueimp-md5 file: js/md5.min.js diff --git a/scripts/helper/inject_head_js.js b/scripts/helper/inject_head_js.js index 74f3a054..f0cdcc98 100644 --- a/scripts/helper/inject_head_js.js +++ b/scripts/helper/inject_head_js.js @@ -21,13 +21,13 @@ hexo.extend.helper.register('inject_head_js', function () { }, get: function getWithExpiry(key) { const itemStr = localStorage.getItem(key) - + if (!itemStr) { return undefined } const item = JSON.parse(itemStr) const now = new Date() - + if (now.getTime() > item.expiry) { localStorage.removeItem(key) return undefined @@ -62,24 +62,30 @@ hexo.extend.helper.register('inject_head_js', function () { script.onload = script.onreadystatechange = null resolve() } - + Object.keys(attr).forEach(key => { script.setAttribute(key, attr[key]) }) - + document.head.appendChild(script) }), addGlobalFn: (key, fn, name = false, parent = window) => { const globalFn = parent.globalFn || {} const keyObj = globalFn[key] || {} - + if (name && keyObj[name]) return - + name = name || Object.keys(keyObj).length keyObj[name] = fn globalFn[key] = keyObj parent.globalFn = globalFn }, + addEventListenerPjax: (ele, event, fn, option = false) => { + ele.addEventListener(event, fn, option) + utils.addGlobalFn('pjax', () => { + ele.removeEventListener(event, fn, option) + }) + }, } ` return `` @@ -88,4 +94,4 @@ hexo.extend.helper.register('inject_head_js', function () { hexo.extend.helper.register('packageVersion', function () { const {version} = require('../../package.json') return version -}) \ No newline at end of file +}) diff --git a/scripts/tags/chart.js b/scripts/tags/chart.js new file mode 100644 index 00000000..a5add1cf --- /dev/null +++ b/scripts/tags/chart.js @@ -0,0 +1,27 @@ +/** + * Chart.js tag for Solitude theme + */ + +'use strict' + +const chart = (args, content) => { + const id = Math.random().toString(36).substr(2, 9); + return ` +
+ + +
`; +} + +hexo.extend.tag.register('chart', chart, {ends: true}) diff --git a/source/js/utils.js b/source/js/utils.js index 7b088b4a..e3b97481 100644 --- a/source/js/utils.js +++ b/source/js/utils.js @@ -101,12 +101,6 @@ }, isMobile: () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), isHidden: e => 0 === e.offsetHeight && 0 === e.offsetWidth, - addEventListenerPjax: (ele, event, fn, option = false) => { - ele.addEventListener(event, fn, option) - utils.addGlobalFn('pjax', () => { - ele.removeEventListener(event, fn, option) - }) - }, animateIn: (ele, text) => { Object.assign(ele.style, {display: 'block', animation: text}); }, @@ -205,4 +199,4 @@ }, } window.utils = {...window.utils, ...utilsFn}; -})() \ No newline at end of file +})() From edeb3f98aa200a7f641da758545fa3f84b4c2bcf Mon Sep 17 00:00:00 2001 From: Ever Fu Date: Wed, 21 Aug 2024 14:29:37 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E2=9C=A8=20=E6=9B=B4=E6=96=B0=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- README_zh-Hans.md | 6 +++--- README_zh-Hant.md | 4 ++-- package.json | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 11edeaac..f257f0b3 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ English丨[简体中文](README_zh-Hans.md)丨[繁体中文](README_zh-Hant.md) [![discord](https://img.shields.io/discord/1266610921942548553?style=for-the-badge&logo=discord&label=discord&logoColor=white)](https://discord.gg/HZXAnK4Sut) ![JetBrains](https://img.shields.io/badge/jetbrains-support-black?logo=jetbrains&style=for-the-badge) -[Documentation](https://solitude.js.org/)丨[Preview](https://everfu.github.io/Solitude/) +[Documentation](https://solitude.js.org/)丨[Preview](https://solitude.js.org/preview/) diff --git a/README_zh-Hans.md b/README_zh-Hans.md index 0fa3cf9e..1e9ca478 100644 --- a/README_zh-Hans.md +++ b/README_zh-Hans.md @@ -5,7 +5,7 @@

Solitude

一款优雅的 Hexo 主题,支持懒加载、PWA、Latex 以及多种评论系统。 - + 主题设计由 [@张洪Heo](https://github.com/zhheo) 全权授权 ![npm package](https://img.shields.io/npm/v/hexo-theme-solitude?style=for-the-badge) @@ -20,7 +20,7 @@ [![discord](https://img.shields.io/discord/1266610921942548553?style=for-the-badge&logo=discord&label=discord&logoColor=white)](https://discord.gg/HZXAnK4Sut) ![JetBrains](https://img.shields.io/badge/jetbrains-support-black?logo=jetbrains&style=for-the-badge) -[文档](https://solitude.js.org/)丨[预览](https://everfu.github.io/Solitude/) +[文档](https://solitude.js.org/)丨[预览](https://solitude.js.org/preview/zh/) @@ -58,7 +58,7 @@ ```yaml theme: solitude ``` - + 前往 [文档](https://solitude.js.org/) 获取更多信息。 ## 赞助者 diff --git a/README_zh-Hant.md b/README_zh-Hant.md index 0eeb4db6..4c6c86b8 100644 --- a/README_zh-Hant.md +++ b/README_zh-Hant.md @@ -20,7 +20,7 @@ [![discord](https://img.shields.io/discord/1266610921942548553?style=for-the-badge&logo=discord&label=discord&logoColor=white)](https://discord.gg/HZXAnK4Sut) ![JetBrains](https://img.shields.io/badge/jetbrains-support-black?logo=jetbrains&style=for-the-badge) -[文档](https://solitude.js.org/)丨[預覽](https://everfu.github.io/Solitude/) +[文档](https://solitude.js.org/)丨[預覽](https://solitude.js.org/preview/zh/) @@ -36,7 +36,7 @@ - 評論(Twikoo、Waline、Valine、Artalk、Giscus),支援雙評論 - 晝夜切換(ColorMode) - 燈箱(medium-zoom、fancybox) -- 數學公式(Latex) +- 數學公式(Latex) - 特色頁面:即刻短文、我的裝備、在線工具、音樂館、友鏈魚塘、相冊頁、豆瓣頁、留言彈幕頁。 - 文章功能:AI 摘要、代碼高亮。 diff --git a/package.json b/package.json index 0cd3386c..6cd5488a 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "hexo-theme-solitude", "version": "2.0.9", - "description": "A beautiful, powerful, and efficient Hexo theme developed by EverFu.", + "description": "A beautiful, powerful, and efficient Hexo theme developed by Ever Fu.", "main": "package.json", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" @@ -11,7 +11,7 @@ "theme", "solitude", "Card UI Design", - "EverFu", + "Ever Fu", "hexo-theme-solitude" ], "repository": { @@ -26,7 +26,7 @@ "url": "https://github.com/everfu/hexo-theme-solitude/issues", "email": "o@everfu.org" }, - "homepage": "https://everfu.github.io/Solitude/", + "homepage": "https://solitude.js.org", "author": "Hexo-Theme-Solitude", "license": "MIT" } From a7ce8576cb7393e4e63b02f9b4b3bd24c6b26c6a Mon Sep 17 00:00:00 2001 From: Ever Fu Date: Wed, 21 Aug 2024 14:30:39 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E2=9C=A8=20=E8=A1=A5=E5=85=85=20Chart=20?= =?UTF-8?q?=E7=9A=84=E9=BB=98=E8=AE=A4=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/event/merge_config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/event/merge_config.js b/scripts/event/merge_config.js index f5b939ad..1b41e9ce 100644 --- a/scripts/event/merge_config.js +++ b/scripts/event/merge_config.js @@ -266,6 +266,7 @@ hexo.extend.filter.register('before_generate', () => { fancybox: false, mediumZoom: false, mermaid: false, + chart: false, OpenGraph: { enable: false, options: null From 19dfc2d7c48d9c0690bd3c7e96a5141c469328ad Mon Sep 17 00:00:00 2001 From: Ever Fu Date: Wed, 21 Aug 2024 15:11:16 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E2=9C=A8=20=E5=A2=9E=E5=8A=A0=E5=AF=B9=20T?= =?UTF-8?q?ypeit.js=20=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 5 + layout/includes/inject/body.pug | 3 + plugins.yml | 5 + scripts/event/merge_config.js | 849 ++++++++++++++++---------------- scripts/tags/typeit.js | 29 ++ 5 files changed, 467 insertions(+), 424 deletions(-) create mode 100644 scripts/tags/typeit.js diff --git a/_config.yml b/_config.yml index 6b77505e..d4b5f451 100644 --- a/_config.yml +++ b/_config.yml @@ -631,6 +631,11 @@ mermaid: false chart: false # --------------------------- end --------------------------- +# --------------------------- start --------------------------- +# typeit +typeit: false +# --------------------------- end --------------------------- + # --------------------------- start --------------------------- # OpenGraph OpenGraph: diff --git a/layout/includes/inject/body.pug b/layout/includes/inject/body.pug index a9a5a2a1..c13416a3 100644 --- a/layout/includes/inject/body.pug +++ b/layout/includes/inject/body.pug @@ -25,6 +25,9 @@ div if theme.chart script(src=url_for(theme.cdn.chart_js)) + if theme.typeit + script(src=url_for(theme.cdn.typeit_js)) + if theme.display_mode.universe script(src=url_for(theme.cdn.universe_js)) script. diff --git a/plugins.yml b/plugins.yml index fa2feeac..043e5aac 100644 --- a/plugins.yml +++ b/plugins.yml @@ -116,6 +116,11 @@ chart_js: file: dist/chart.umd.js version: 4.4.1 other_name: Chart.js +typeit_js: + name: typeit + file: index.umd.min.js + version: 8.8.4 + other_name: typeit blueimp_md5: name: blueimp-md5 file: js/md5.min.js diff --git a/scripts/event/merge_config.js b/scripts/event/merge_config.js index 1b41e9ce..fb07cb5b 100644 --- a/scripts/event/merge_config.js +++ b/scripts/event/merge_config.js @@ -1,429 +1,430 @@ hexo.extend.filter.register('before_generate', () => { - const defaultConfig = { - site: { - name: { - class: 'text', - custom: 'Solitude' - }, - siteIcon: '/img/pwa/favicon.ico', - icon: 'icon' - }, - nav: { - group: null, - menu: null, - right: { - random: false, - custom: [], - } - }, - hometop: { - enable: false, - banner: { - title: 'Solitude', - url: 'A simple theme for Hexo', - icon: null, - }, - group: null, - recommendList: { - sup: 'Recommend', - title: 'Solitude Docs', - url: 'https://solitude.js.org/', - img: '/img/default.avif', - color: 'none', - } - }, - aside: { - home: { - noSticky: 'about', - Sticky: 'allInfo' - }, - post: { - noSticky: 'about', - Sticky: 'allInfo' - }, - page: { - noSticky: 'about', - Sticky: 'allInfo' - }, - card: { - style: 0, - author: { - img: '/img/logo.png', - sticker: '/img/happy-sticker.avif', - }, - url: '/about/', - background: null, - content1: 'Solitude', - content2: 'A simple theme for Hexo', - sayhello: { - morning: 'Good Morning', - noon: 'Good Noon', - afternoon: 'Good Afternoon', - night: 'Good Night', - goodnight: 'Good Night', - }, - sayhello2: ['Welcome to Solitude', 'A simple theme for Hexo', 'Enjoy your time', 'Have a nice day', 'Good luck'], - information: null, - }, - flip: { - favicon: '', - face: '', - backface: '', - backcolor: 'var(--efu-blue)' - }, - newest_comment: { - enable: false, - storage: .5, - limit: 5 - }, - toc: { - post: true, - page: false, - vague: true, - }, - tags: { - enable: true, - limit: 20, - highlight: false, - list: [], - }, - archive: { - enable: true, - type: 'month' - }, - siteinfo: { - postcount: true, - wordcount: false, - pv: true, - uv: true, - updatetime: true, - runtimeenable: true, - runtime: "2023-04-20 00:00:00", - }, - }, - index_post_list: { - direction: 'column', - column: 2, - content: false, - length: 500, - cover: 'both' - }, - page: { - error: true, - tags: true, - categories: true, - archives: 0, - default: { - cover: ['/img/default.avif'], - } - }, - post: { - default: { - top_cover: true, - cover: ['/img/default.avif'], - locate: 'China, Changsha', - copyright: { - enable: true, - license: 'CC BY-NC-SA 4.0', - licenurl: 'https://creativecommons.org/licenses/by-nc-sa/4.0/', - } - }, - meta: { - date: false, - updated: false, - locate: false, - wordcount: false, - readtime: false, - pv: false, - uv: false, - comment: false, - }, - award: { - enable: false, - appreciators: '/', - title: '感谢您的赞赏。', - desc: '因为有你们的支持,我才体会到写文章的价值。', - list: [], - }, - rss: null, - covercolor: { - enable: false, - mode: 'local', - api: 'https://api.qjqq.cn/api/Imgcolor?img=', - time: 43200000, - }, - share: { - enable: false, - list: [] - }, - footer: { - enable: true, - desc: "The article from Solitude", - button: { - enable: true, - name: 'Learn More', - url: '/' - } - } - }, - theme_color: { - dark: "#ffc848", - dark_op: "#f2b94b23", - dark_op_deep: "#f2b94bdd", - dark_none: "#f2b94b00", - light: "#425AEF", - light_op: "#4259ef23", - light_op_deep: "#4259efdd", - light_none: "#4259ef01" - }, - display_mode: { - type: 'auto', - universe: false - }, - related_post: { - enable: false, - limit: 2, - date_type: 'created' - }, - footer: { - information: { - author: false, - left: null, - right: null, - }, - group: null, - randomlink: false, - privacy: null, - license: null, - links: [{ - name: 'Solitude', - url: 'https://github.com/everfu/hexo-theme-solitude', - }] - }, - errorpage: { - img: 'https://7.isyangs.cn/34/65f2e65eae32a-34.png', - text: '404 Not Found', - recommendList: true - }, - says: { - enable: false, - home_mini: false, - style: 1, - strip: 30 - }, - recent_comments: { - enable: false, - limit: 50, - console: false, - page: '/recentcomments/' - }, - envelope: { - enable: false, - line: 10, - speed: 20, - hover: true, - loop: true, - page: '/message/' - }, - meting_api: "https://meting.qjqq.cn/?server=:server&type=:type&id=:id&auth=:auth&r=:r", - music: { - enable: false, - id: '8407304077', - server: 'netease', - type: 'playlist', - volume: 0.8, - mutex: true, - }, - capsule: { - enable: false, - id: '8407304077', - server: 'netease', - type: 'playlist', - }, - keyboard: { - enable: false, - list: [] - }, - lazyload: { - enable: false, - field: 'site', - placeholder: '/img/loading.avif', - errorimg: '/img/error_load.avif' - }, - loading: { - fullpage: false, - pace: true, - }, - highlight: { - enable: true, - limit: 200, - copy: true, - expand: true, - theme: 'default', - color: 'default', - }, - lightbox: false, - fancybox: false, - mediumZoom: false, - mermaid: false, - chart: false, - OpenGraph: { - enable: false, - options: null - }, + const defaultConfig = { + site: { + name: { + class: 'text', + custom: 'Solitude' + }, + siteIcon: '/img/pwa/favicon.ico', + icon: 'icon' + }, + nav: { + group: null, + menu: null, + right: { + random: false, + custom: [], + } + }, + hometop: { + enable: false, + banner: { + title: 'Solitude', + url: 'A simple theme for Hexo', + icon: null, + }, + group: null, + recommendList: { + sup: 'Recommend', + title: 'Solitude Docs', + url: 'https://solitude.js.org/', + img: '/img/default.avif', + color: 'none', + } + }, + aside: { + home: { + noSticky: 'about', + Sticky: 'allInfo' + }, + post: { + noSticky: 'about', + Sticky: 'allInfo' + }, + page: { + noSticky: 'about', + Sticky: 'allInfo' + }, + card: { + style: 0, + author: { + img: '/img/logo.png', + sticker: '/img/happy-sticker.avif', + }, + url: '/about/', + background: null, + content1: 'Solitude', + content2: 'A simple theme for Hexo', + sayhello: { + morning: 'Good Morning', + noon: 'Good Noon', + afternoon: 'Good Afternoon', + night: 'Good Night', + goodnight: 'Good Night', + }, + sayhello2: ['Welcome to Solitude', 'A simple theme for Hexo', 'Enjoy your time', 'Have a nice day', 'Good luck'], + information: null, + }, + flip: { + favicon: '', + face: '', + backface: '', + backcolor: 'var(--efu-blue)' + }, + newest_comment: { + enable: false, + storage: .5, + limit: 5 + }, + toc: { + post: true, + page: false, + vague: true, + }, + tags: { + enable: true, + limit: 20, + highlight: false, + list: [], + }, + archive: { + enable: true, + type: 'month' + }, + siteinfo: { + postcount: true, wordcount: false, - busuanzi: false, - search: { - enable: false, - type: 'local', - tags: [], - algolia: null, - local: { - preload: false, - CDN: null, - } - }, - rightside: { - enable: false - }, - copy: { - enable: true, - copyright: { - enable: false, - limit: 50 - } - }, - post_ai: { - enable: false, - modelName: 'GPT 3', - key: 'your key', - talk: 'I am a AI.', - randomPost: false, - tips: 'AI is not perfect, please use it with caution.' - }, - katex: { - enable: false, - per_page: false, - copytex: false, - }, - comment: { - use: null, - commentBarrage: false, - lazyload: false, - count: false, - avatar: 'https://gravatar.com/avatar', - hot_tip: { - enable: true, - count: 3 - } - }, - twikoo: { - envId: 'your envId', - region: null, - style: true, - accessToken: null, - option: null, - }, - waline: { - envId: 'your envId', - pageview: true, - option: null, - }, - valine: { - appId: 'your appId', - appKey: 'your appKey', - serverURLs: 'your serverURLs', - avatar: 'monsterid', - visitor: false, - style: true, - option: null, - }, - artalk: { - server: 'your server', - 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: { - 'font-size': '16px', - 'code-font-size': '16px', - 'font-family': 'PingFang SC, Hiragino Sans GB,Microsoft YaHei', - 'code-font-family': 'monospace, monospace', - }, - extends: { - head: [], - body: [], - }, - pwa: { - enable: false, - manifest: '/manifest.json', - theme_color: "#006a73", - mask_icon: '/img/pwa/favicon.ico', - apple_touch_icon: '/img/pwa/favicon.ico', - bookmark_icon: '/img/pwa/favicon.ico', - favicon_32_32: '/img/pwa/favicon_32.ico', - favicon_16_16: '/img/pwa/favicon_16.ico' - }, - google_adsense: { - enable: false, - auto_ads: false, - aside_card: false, - post_card: false, - post_content: false, - enable_page_level_ads: false, - js: 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js', - client: '', - slot: '', - }, - right_menu: { - enable: false, - commentBarrage: false, - translate: { - enable: false, - defaultEncoding: 2, - translateDelay: 0, - }, - 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', - version: true, - custom_format: 'https://cdn.staticfile.net/${cdnjs_name}/${version}/${min_cdnjs_file}', - option: { - solitude_css: 'https://cdn2.codesign.qq.com/icons/7pOrz0WXB5ZWJPX/latest/iconfont.css', - } + pv: true, + uv: true, + updatetime: true, + runtimeenable: true, + runtime: "2023-04-20 00:00:00", + }, + }, + index_post_list: { + direction: 'column', + column: 2, + content: false, + length: 500, + cover: 'both' + }, + page: { + error: true, + tags: true, + categories: true, + archives: 0, + default: { + cover: ['/img/default.avif'], + } + }, + post: { + default: { + top_cover: true, + cover: ['/img/default.avif'], + locate: 'China, Changsha', + copyright: { + enable: true, + license: 'CC BY-NC-SA 4.0', + licenurl: 'https://creativecommons.org/licenses/by-nc-sa/4.0/', + } + }, + meta: { + date: false, + updated: false, + locate: false, + wordcount: false, + readtime: false, + pv: false, + uv: false, + comment: false, + }, + award: { + enable: false, + appreciators: '/', + title: '感谢您的赞赏。', + desc: '因为有你们的支持,我才体会到写文章的价值。', + list: [], + }, + rss: null, + covercolor: { + enable: false, + mode: 'local', + api: 'https://api.qjqq.cn/api/Imgcolor?img=', + time: 43200000, + }, + share: { + enable: false, + list: [] + }, + footer: { + enable: true, + desc: "The article from Solitude", + button: { + enable: true, + name: 'Learn More', + url: '/' } + } + }, + theme_color: { + dark: "#ffc848", + dark_op: "#f2b94b23", + dark_op_deep: "#f2b94bdd", + dark_none: "#f2b94b00", + light: "#425AEF", + light_op: "#4259ef23", + light_op_deep: "#4259efdd", + light_none: "#4259ef01" + }, + display_mode: { + type: 'auto', + universe: false + }, + related_post: { + enable: false, + limit: 2, + date_type: 'created' + }, + footer: { + information: { + author: false, + left: null, + right: null, + }, + group: null, + randomlink: false, + privacy: null, + license: null, + links: [{ + name: 'Solitude', + url: 'https://github.com/everfu/hexo-theme-solitude', + }] + }, + errorpage: { + img: 'https://7.isyangs.cn/34/65f2e65eae32a-34.png', + text: '404 Not Found', + recommendList: true + }, + says: { + enable: false, + home_mini: false, + style: 1, + strip: 30 + }, + recent_comments: { + enable: false, + limit: 50, + console: false, + page: '/recentcomments/' + }, + envelope: { + enable: false, + line: 10, + speed: 20, + hover: true, + loop: true, + page: '/message/' + }, + meting_api: "https://meting.qjqq.cn/?server=:server&type=:type&id=:id&auth=:auth&r=:r", + music: { + enable: false, + id: '8407304077', + server: 'netease', + type: 'playlist', + volume: 0.8, + mutex: true, + }, + capsule: { + enable: false, + id: '8407304077', + server: 'netease', + type: 'playlist', + }, + keyboard: { + enable: false, + list: [] + }, + lazyload: { + enable: false, + field: 'site', + placeholder: '/img/loading.avif', + errorimg: '/img/error_load.avif' + }, + loading: { + fullpage: false, + pace: true, + }, + highlight: { + enable: true, + limit: 200, + copy: true, + expand: true, + theme: 'default', + color: 'default', + }, + lightbox: false, + fancybox: false, + mediumZoom: false, + mermaid: false, + chart: false, + typeit: false, + OpenGraph: { + enable: false, + options: null + }, + wordcount: false, + busuanzi: false, + search: { + enable: false, + type: 'local', + tags: [], + algolia: null, + local: { + preload: false, + CDN: null, + } + }, + rightside: { + enable: false + }, + copy: { + enable: true, + copyright: { + enable: false, + limit: 50 + } + }, + post_ai: { + enable: false, + modelName: 'GPT 3', + key: 'your key', + talk: 'I am a AI.', + randomPost: false, + tips: 'AI is not perfect, please use it with caution.' + }, + katex: { + enable: false, + per_page: false, + copytex: false, + }, + comment: { + use: null, + commentBarrage: false, + lazyload: false, + count: false, + avatar: 'https://gravatar.com/avatar', + hot_tip: { + enable: true, + count: 3 + } + }, + twikoo: { + envId: 'your envId', + region: null, + style: true, + accessToken: null, + option: null, + }, + waline: { + envId: 'your envId', + pageview: true, + option: null, + }, + valine: { + appId: 'your appId', + appKey: 'your appKey', + serverURLs: 'your serverURLs', + avatar: 'monsterid', + visitor: false, + style: true, + option: null, + }, + artalk: { + server: 'your server', + 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: { + 'font-size': '16px', + 'code-font-size': '16px', + 'font-family': 'PingFang SC, Hiragino Sans GB,Microsoft YaHei', + 'code-font-family': 'monospace, monospace', + }, + extends: { + head: [], + body: [], + }, + pwa: { + enable: false, + manifest: '/manifest.json', + theme_color: "#006a73", + mask_icon: '/img/pwa/favicon.ico', + apple_touch_icon: '/img/pwa/favicon.ico', + bookmark_icon: '/img/pwa/favicon.ico', + favicon_32_32: '/img/pwa/favicon_32.ico', + favicon_16_16: '/img/pwa/favicon_16.ico' + }, + google_adsense: { + enable: false, + auto_ads: false, + aside_card: false, + post_card: false, + post_content: false, + enable_page_level_ads: false, + js: 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js', + client: '', + slot: '', + }, + right_menu: { + enable: false, + commentBarrage: false, + translate: { + enable: false, + defaultEncoding: 2, + translateDelay: 0, + }, + 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', + version: true, + custom_format: 'https://cdn.staticfile.net/${cdnjs_name}/${version}/${min_cdnjs_file}', + option: { + solitude_css: 'https://cdn2.codesign.qq.com/icons/7pOrz0WXB5ZWJPX/latest/iconfont.css', + } } - hexo.theme.config = Object.assign(defaultConfig, hexo.theme.config) + } + hexo.theme.config = Object.assign(defaultConfig, hexo.theme.config) }, 1) diff --git a/scripts/tags/typeit.js b/scripts/tags/typeit.js new file mode 100644 index 00000000..dcef932b --- /dev/null +++ b/scripts/tags/typeit.js @@ -0,0 +1,29 @@ +/** + * Typeit.js tag for Solitude theme + */ + +'use strict' + +const typeit = ([tag, options], content) => { + const id = Math.random().toString(36).substr(2, 9); + tag = tag || 'div'; + return ` +
+ <${tag} id="typeit-${id}"> + +
` +} + +hexo.extend.tag.register('typeit', typeit, {ends: true}) From ac411d4a819e20a7a2f9bfb1eac781f9f33f8aa5 Mon Sep 17 00:00:00 2001 From: Ever Fu Date: Wed, 21 Aug 2024 16:35:13 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=F0=9F=94=A5=20=E4=BF=AE=E5=A4=8D=E7=81=AF?= =?UTF-8?q?=E7=AE=B1=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/tags/gallery.js | 2 +- source/js/main.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/tags/gallery.js b/scripts/tags/gallery.js index a50b05ba..85bfe51b 100644 --- a/scripts/tags/gallery.js +++ b/scripts/tags/gallery.js @@ -34,4 +34,4 @@ const gallery = (args, content) => { } hexo.extend.tag.register('gallery', gallery, {ends: true}) -hexo.extend.tag.register('galleryGroup', galleryBox) \ No newline at end of file +hexo.extend.tag.register('galleryGroup', galleryBox) diff --git a/source/js/main.js b/source/js/main.js index 47292fbc..b917ddbf 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -666,7 +666,7 @@ window.refreshFn = () => { runtime && sco.addRuntime(); [scrollFn, sidebarFn, sco.addPhotoFigcaption, sco.setTimeState, sco.tagPageActive, sco.categoriesBarActive, sco.listenToPageInputPress, sco.addNavBackgroundInit, sco.refreshWaterFall].forEach(fn => fn()); lazyload.enable && utils.lazyloadImg(); - lightbox && utils.lightbox(document.querySelectorAll("#article-container img:not(.flink-avatar,.gallery-group img)")); + lightbox && utils.lightbox(document.querySelectorAll("#article-container img:not(.flink-avatar,.gallery-group img, .no-lightbox)")); randomlink && randomLinksList(); post_ai && is_post && efu_ai.init(); sco.switchComments(); From e148d0fc222de2fb6ebedee09023a70cf00fa2d9 Mon Sep 17 00:00:00 2001 From: Ever Fu Date: Wed, 21 Aug 2024 18:25:46 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E2=9C=A8=20=E8=B0=83=E6=95=B4=E9=A6=96?= =?UTF-8?q?=E9=A1=B5=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layout/includes/widgets/home/topGroup.pug | 10 ++-- source/css/_layout/recent-post.styl | 56 +++++++++++------------ source/css/_page/_home/home-top.styl | 10 ++-- 3 files changed, 37 insertions(+), 39 deletions(-) diff --git a/layout/includes/widgets/home/topGroup.pug b/layout/includes/widgets/home/topGroup.pug index afb5b752..26075fdc 100644 --- a/layout/includes/widgets/home/topGroup.pug +++ b/layout/includes/widgets/home/topGroup.pug @@ -1,12 +1,12 @@ - var filteredPosts = site.posts.data.filter(item => item.recommend === true).slice(0,6) -.recent-post-group +.top-post-group each post in filteredPosts - .recent-post-item + .top-post-item .post_cover a(href=url_for(post.path), title=post.title) - span.recent-post-top-text= _p('home.recommend') + span.top-post-top-text= _p('home.recommend') img.post_bg(alt=post.title, src=url_for(post.cover)) - .recent-post-info + .top-post-info a.article-title(href=url_for(post.path), title=post.title)= post.title mixin todayCardContent @@ -29,4 +29,4 @@ case theme.hometop.recommendList.url.startsWith('/') window.open("#{theme.hometop.recommendList.url}", "_blank"); } .todayCard#todayCard(onclick="GoTodayCard()") - +todayCardContent() \ No newline at end of file + +todayCardContent() diff --git a/source/css/_layout/recent-post.styl b/source/css/_layout/recent-post.styl index 350a546c..d0794527 100644 --- a/source/css/_layout/recent-post.styl +++ b/source/css/_layout/recent-post.styl @@ -8,18 +8,7 @@ padding 0 if hexo-config('index_post_list.direction') == "column" - #recent-posts - position relative - +minWidth1300() - display flex - flex-wrap wrap - gap .5rem - transition width .3s - - +maxWidth768() - padding 0 1rem - - > .recent-post-item + .recent-post-item box-shadow var(--efu-shadow-light2black) display flex align-items center @@ -230,6 +219,16 @@ if hexo-config('index_post_list.direction') == "column" .sticky color var(--efu-fontcolor) + #recent-posts + position relative + +minWidth1300() + display flex + flex-wrap wrap + gap .5rem + transition width .3s + + +maxWidth768() + padding 0 1rem if hexo-config('index_post_list.direction') == "column" && hexo-config('index_post_list.column') == 2 #recent-posts @@ -249,23 +248,9 @@ if hexo-config('index_post_list.direction') == "column" flex 1 1 33.3% max-width 32.6% box-shadow var(--efu-shadow-border) - -else if hexo-config('index_post_list.direction') == "row" - #recent-posts - position relative - display flex - flex-wrap wrap - justify-content space-between - align-items flex-start - align-content flex-start - user-select none - gap .5rem - transition width .3s - +maxWidth768() - padding 0 1rem - - > .recent-post-item +else if hexo-config('index_post_list.direction') == "row" + .recent-post-item display flex align-items center animation slide-in .6s .4s backwards @@ -473,4 +458,17 @@ else if hexo-config('index_post_list.direction') == "row" margin 0 .4rem 0 0 .sticky - color var(--efu-fontcolor) \ No newline at end of file + color var(--efu-fontcolor) + #recent-posts + position relative + display flex + flex-wrap wrap + justify-content space-between + align-items flex-start + align-content flex-start + user-select none + gap .5rem + transition width .3s + + +maxWidth768() + padding 0 1rem diff --git a/source/css/_page/_home/home-top.styl b/source/css/_page/_home/home-top.styl index c18d3590..4217f5ed 100644 --- a/source/css/_page/_home/home-top.styl +++ b/source/css/_page/_home/home-top.styl @@ -22,7 +22,7 @@ &::-webkit-scrollbar display none - .recent-post-group + .top-post-group display flex flex-direction row justify-content start @@ -76,7 +76,7 @@ position relative animation slide-in .6s .1s backwards - .recent-post-item + .top-post-item display flex flex-direction column width calc(100% / 3 - 0.5rem) @@ -100,7 +100,7 @@ width 200px min-width 200px - &:hover .post_cover a .recent-post-top-text + &:hover .post_cover a .top-post-top-text left 0 .post_cover @@ -116,7 +116,7 @@ width 100% background var(--efu-secondbg) - .recent-post-top-text + .top-post-top-text position absolute top 0 left -50px @@ -132,7 +132,7 @@ if $language == 'en-US' left -90px - /.recent-post-info + /.top-post-info padding .3rem .5rem .3rem .5rem transition .3s From 798be7e6b5ffeeccfc1efa93cca34afe81ec70e3 Mon Sep 17 00:00:00 2001 From: Ever Fu Date: Wed, 21 Aug 2024 19:04:11 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E2=9C=A8=20=E6=96=B0=E5=A2=9E=E6=96=87?= =?UTF-8?q?=E7=AB=A0=E5=A4=96=E6=8C=82=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/tags/article.js | 39 +++++++++++++++++++++++ source/css/_layout/article-container.styl | 4 +-- 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 scripts/tags/article.js diff --git a/scripts/tags/article.js b/scripts/tags/article.js new file mode 100644 index 00000000..d83bad58 --- /dev/null +++ b/scripts/tags/article.js @@ -0,0 +1,39 @@ +'use strict' + +const article = ([path]) => { + const post = hexo.locals.get("posts").data.find(post => post.path === path); + if (!post) { + return ''; + } + const tags = post.tags.map(tag => ``).join(''); + const category = post.categories.data.length > 0 ? `` : ''; + return ` +
+
+ + ${post.title} + +
+ +
`; +} + +hexo.extend.tag.register('article', article) diff --git a/source/css/_layout/article-container.styl b/source/css/_layout/article-container.styl index 094e5d11..82c50fd7 100644 --- a/source/css/_layout/article-container.styl +++ b/source/css/_layout/article-container.styl @@ -99,7 +99,7 @@ line-height 2 box-shadow var(--efu-shadow-border) - img + img:not(.post_bg) border-radius 12px object-fit cover display block @@ -215,4 +215,4 @@ if hexo-config('mediumZoom') z-index 10 .medium-zoom-image--opened - z-index 11 \ No newline at end of file + z-index 11 From 077dcafbd9054d5224ce026d6bb61fb3b3ef9333 Mon Sep 17 00:00:00 2001 From: Ever Fu Date: Wed, 21 Aug 2024 19:06:10 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E2=9C=A8=20v2.0.10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6cd5488a..df503873 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-solitude", - "version": "2.0.9", + "version": "2.0.10", "description": "A beautiful, powerful, and efficient Hexo theme developed by Ever Fu.", "main": "package.json", "scripts": {