diff --git a/.coderabbit.yaml b/.coderabbit.yaml new file mode 100644 index 00000000..43e301ef --- /dev/null +++ b/.coderabbit.yaml @@ -0,0 +1,15 @@ +# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json +language: "en-US" +early_access: false +reviews: + profile: "chill" + request_changes_workflow: false + high_level_summary: true + poem: false + review_status: true + collapse_walkthrough: true + auto_review: + enabled: true + drafts: false +chat: + auto_reply: true diff --git a/.github/workflows/preview-deployment.yml b/.github/workflows/preview-deployment.yml index 772bb9e3..118fc34f 100644 --- a/.github/workflows/preview-deployment.yml +++ b/.github/workflows/preview-deployment.yml @@ -1,13 +1,15 @@ name: Vercel Preview Deployment + env: VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + on: workflow_dispatch: push: branches: - dev - pull_request: # Trigger the workflow on pull request activities + pull_request_target: branches: - dev - main @@ -15,21 +17,28 @@ on: jobs: preview-deployment: runs-on: ubuntu-latest + environment: + name: ${{ github.event_name == 'pull_request_target' && 'PR Preview' || 'Preview' }} + url: ${{ steps.deploy-to-vercel.outputs.preview-url }} steps: - - id: script + - name: Determine checkout details + id: checkout-details uses: actions/github-script@v7 with: script: | - const isPr = [ 'pull_request', 'pull_request_target' ].includes(context.eventName) - core.setOutput('ref', isPr ? context.payload.pull_request.head.ref : context.ref) - core.setOutput('repo', isPr ? context.payload.pull_request.head.repo.full_name : context.repo.full_name) + const isPr = context.eventName === 'pull_request_target' + const ref = isPr ? context.payload.pull_request.head.ref : context.ref + const repo = isPr ? context.payload.pull_request.head.repo.full_name : context.repo.full_name + core.setOutput('ref', ref) + core.setOutput('repo', repo) - name: Checkout theme repository uses: actions/checkout@v4 with: - path: 'theme' # Checkout the theme repository into a directory named 'theme' - ref: ${{ steps.script.outputs.ref }} - repository: ${{ steps.script.outputs.repo }} + path: 'theme' + ref: ${{ steps.checkout-details.outputs.ref }} + repository: ${{ steps.checkout-details.outputs.repo }} + - name: Setup Node.js uses: actions/setup-node@v4 @@ -98,6 +107,7 @@ jobs: run: echo "HEXO_SITE_DIR=${{ github.workspace }}/hexo-site" >> $GITHUB_ENV - name: Deploy to Vercel Action + id: deploy-to-vercel uses: EvanNotFound/vercel-deployment-for-github-actions@v1.1.0 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/DONATION.md b/DONATION.md index 3bfef251..fc57bcb8 100644 --- a/DONATION.md +++ b/DONATION.md @@ -33,7 +33,7 @@ A big thank you to all the friends who have sponsored this project. Your support | ![IMG_0382](https://user-images.githubusercontent.com/68590232/223455834-d2e5ab6e-9d75-4bbf-adfb-2c519d6b4582.JPG) | ![IMG_9570](https://user-images.githubusercontent.com/68590232/223463950-f7276ef8-0198-4070-8541-697ec25e5b9a.png) | ![IMG_0385](https://user-images.githubusercontent.com/68590232/223459896-593e105e-89f3-4631-8cab-cb7798a53bf1.jpg) | -赞助完以后,请各位加我微信 `do-not-go-plzzz` 联系我添加 GitHub 账号和网站链接! +赞助完以后,请各位加我微信,在 [evannotfound.com/contact](https://evannotfound.com/contact) 联系我添加 GitHub 账号和网站链接! After making a donation, if you want to get in touch with me, please add me on Discord with my username `evannotfound`. 感谢! @@ -77,4 +77,4 @@ Thank you! | Oct 16 | 沈*昊 | ¥20.00 | 微信赞赏码 | - | | Oct 24 | Neptune. | ¥14.99 | 微信赞赏码 | - | | Nov 26 | **青 | ¥25.00 | 支付宝 | - | -| Nov 27 | :-) | ¥16.66 | 微信 | - | \ No newline at end of file +| Nov 27 | :-) | ¥16.66 | 微信 | - | diff --git a/_config.yml b/_config.yml index fa2a2431..235f6db0 100755 --- a/_config.yml +++ b/_config.yml @@ -46,7 +46,7 @@ colors: # SITE CUSTOMIZATION >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> start # Docs: https://redefine-docs.ohevan.com/basic/global global: - # Custom fonts + # Custom global fonts fonts: # Chinese fonts chinese: @@ -58,6 +58,11 @@ global: enable: false # Whether to enable custom english fonts family: # Font family url: # Font URL to CSS file + # Custom title fonts (navbar, sidebar) + title: + enable: false # Whether to enable custom title fonts + family: # Font family + url: # Font URL to CSS file # Content max width content_max_width: 1000px # Sidebar width @@ -80,7 +85,9 @@ global: # Whether to enable single page experience (using swup). See https://swup.js.org/. similar to pjax single_page: true # Whether to enable Preloader. - preloader: true + preloader: + enable: false + custom_message: # Custom message. If empty, the site title will be displayed # Whether to enable open graph open_graph: true # Google Analytics @@ -122,6 +129,7 @@ home_banner: text: [] # subtitle text, array hitokoto: # 一言配置 enable: false # Whether to enable hitokoto + show_author: false # Whether to show author api: https://v1.hitokoto.cn # API URL, can add types, see https://developer.hitokoto.cn/sentence/#%E5%8F%A5%E5%AD%90%E7%B1%BB%E5%9E%8B-%E5%8F%82%E6%95%B0 typing_speed: 100 # Typing speed (ms) backing_speed: 80 # Backing speed (ms) @@ -241,6 +249,8 @@ home: # ...... # you can add more # Article date format article_date_format: auto # auto, relative, YYYY-MM-DD, YYYY-MM-DD HH:mm:ss etc. + # Article excerpt length + excerpt_length: 200 # Max length of article excerpt # Article categories visibility categories: enable: true # Whether to enable @@ -285,6 +295,9 @@ articles: code_block: copy: true # Whether to enable code block copy button style: mac # mac | simple + highlight_theme: # Color scheme for highlightjs code highlighting. For preview, see https://highlightjs.org/examples + light: github # light mode theme, support: github, atom-one-light, default + dark: vs2015 # dark mode theme, support: github-dark, monokai-sublime, vs2015, night-owl, atom-one-dark, nord, tokyo-night-dark, a11y-dark, agate font: # Custom font enable: false # Whether to enable family: # Font family @@ -446,7 +459,7 @@ cdn: # Whether to enable CDN enable: false # CDN Provider - provider: npmmirror # npmmirror, zstatic, sustech, staticfile, bootcdn, cdnjs, jsdelivr, unpkg, custom + provider: npmmirror # npmmirror, zstatic, sustech, cdnjs, jsdelivr, unpkg, custom # Custom CDN URL # format example: https://cdn.custom.com/hexo-theme-redefine/${version}/source/${path} # The ${path} must leads to the root of the "source" folder of the theme diff --git a/languages/en.yml b/languages/en.yml index 04e9442e..7a1eeb03 100755 --- a/languages/en.yml +++ b/languages/en.yml @@ -27,6 +27,7 @@ archive: Archive archives: Archives top: TOP sticky: Sticky +go-back-home: Go Back Home # ---------------------------------------- @@ -34,7 +35,6 @@ sticky: Sticky # ---------------------------------------- about: About changelog: Changelog -status: Status links: Links link: Link friends: Friends @@ -50,7 +50,7 @@ site_pv: TOTAL PAGE VIEWS read_more: Read more wordcount: Words min2read: Mins - +status: Status # ---------------------------------------- # Footer diff --git a/languages/ja.yml b/languages/ja.yml index e20867d1..49b4ca82 100644 --- a/languages/ja.yml +++ b/languages/ja.yml @@ -2,7 +2,7 @@ # 网站翻译 # ---------------------------------------- search: 検索... -toc: このページの目次 +toc: 目次 prev: 前のページ next: 次のページ prev_posts: 前一篇 @@ -24,6 +24,7 @@ comment: コメント comments: コメント top: トップ sticky: 屋根 +go-back-home: トップページに戻ります # ---------------------------------------- # 菜单翻译 diff --git a/languages/zh-CN.yml b/languages/zh-CN.yml index 50cc6d4b..92fc95bc 100755 --- a/languages/zh-CN.yml +++ b/languages/zh-CN.yml @@ -1,8 +1,8 @@ # ---------------------------------------- # 网站翻译 # ---------------------------------------- -search: 搜索... -toc: 此页目录 +search: 站内搜索您需要的内容... +toc: 目录 prev: 上一页 next: 下一页 prev_posts: 上一篇 @@ -24,6 +24,7 @@ comment: 评论 comments: 评论 top: 置顶 sticky: 置顶 +go-back-home: 回到首页 # ---------------------------------------- # 菜单翻译 @@ -61,7 +62,7 @@ seconds: 秒 optimized_by: 并由 Evan 进行优化 rights: 版权所有 -site_posts: "共 %s 篇文章" +site_posts: "共撰写了 %s 篇文章" site_wordcount: "共 %s 字" # ---------------------------------------- @@ -91,4 +92,4 @@ ago: create_time: 创建 update_time: 更新 -expired: "这篇文章最后更新于 %s 天前,内容可能已经过时。" \ No newline at end of file +expired: "这篇文章最后更新于 %s 天前,内容可能已经过时。" diff --git a/languages/zh-TW.yml b/languages/zh-TW.yml index 3d7e8806..c023b968 100755 --- a/languages/zh-TW.yml +++ b/languages/zh-TW.yml @@ -1,8 +1,8 @@ # ---------------------------------------- # 网站翻译 # ---------------------------------------- -search: 搜尋... -toc: 此頁目錄 +search: 站內搜尋您想要的內容... +toc: 目錄 prev: 上一頁 next: 下一頁 prev_posts: 上一篇 @@ -24,6 +24,7 @@ comment: 留言 comments: 留言 top: 頂端 sticky: 置頂 +go-back-home: 回到首頁 # ---------------------------------------- # 菜单翻译 @@ -90,4 +91,4 @@ ago: create_time: 撰寫 update_time: 更新 -expired: "这篇文章最後更新於 %s 天前,內容可能已經過時。" \ No newline at end of file +expired: "这篇文章最後更新於 %s 天前,內容可能已經過時。" diff --git a/layout/_partials/404-template.ejs b/layout/_partials/404-template.ejs index e6a3b231..d1529535 100644 --- a/layout/_partials/404-template.ejs +++ b/layout/_partials/404-template.ejs @@ -1,8 +1,8 @@
-

404 Page Not Found

+

404
Page Not Found

- Go Back Home + __("go-back-home")
-
\ No newline at end of file + diff --git a/layout/_partials/comments/gitalk.ejs b/layout/_partials/comments/gitalk.ejs index 035fe55c..678a261c 100755 --- a/layout/_partials/comments/gitalk.ejs +++ b/layout/_partials/comments/gitalk.ejs @@ -7,7 +7,7 @@ ) { %>
+ src="https://cdnjs.cloudflare.com/ajax/libs/gitalk/1.8.0/gitalk.min.js">
`; + data.content += ` + +`; data.excerpt = data.more = config.abstract; return data; @@ -142,7 +148,7 @@ hexo.extend.generator.register("hexo-blog-encrypt", () => [ fs.createReadStream( path.resolve(__dirname, "../../source/js/plugins/hbe.js"), ), - path: "lib/hbe.js", + path: "js/plugins/hbe.js", }, ]); diff --git a/scripts/helpers/themeHelpers.js b/scripts/helpers/themeHelpers.js index 51af5d48..c9d02b07 100755 --- a/scripts/helpers/themeHelpers.js +++ b/scripts/helpers/themeHelpers.js @@ -92,9 +92,8 @@ hexo.extend.helper.register("renderJS", function (path) { const _js = hexo.extend.helper.get("js").bind(hexo); const cdnProviders = { - staticfile: "https://cdn.staticfile.net/hexo-theme-redefine/:version/:path", - bootcdn: - "https://cdn.bootcdn.net/ajax/libs/hexo-theme-redefine/:version/:path", + // FUCK STATICFILE, CDN POISONING + // FUCK BOOTCDN, CDN POISONING sustech: "https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/hexo-theme-redefine/:version/:path", zstatic: @@ -105,7 +104,7 @@ hexo.extend.helper.register("renderJS", function (path) { jsdelivr: "https://cdn.jsdelivr.net/npm/hexo-theme-redefine@:version/source/:path", aliyun: - "https://evan.beee.top/projects/hexo-theme-redefine/:version/source/:path", + "https://evan.beee.top/projects/hexo-theme-redefine@:version/source/:path", npmmirror: "https://registry.npmmirror.com/hexo-theme-redefine/:version/files/source/:path", custom: this.theme.cdn.custom_url, @@ -113,7 +112,7 @@ hexo.extend.helper.register("renderJS", function (path) { const cdnPathHandle = (path) => { const cdnBase = - cdnProviders[this.theme.cdn.provider] || cdnProviders.staticfile; + cdnProviders[this.theme.cdn.provider] || cdnProviders.npmmirror; let jsScript; if (this.theme.cdn.enable) { @@ -151,9 +150,8 @@ hexo.extend.helper.register("renderJSModule", function (path) { const _js = hexo.extend.helper.get("js").bind(hexo); const cdnProviders = { - staticfile: "https://cdn.staticfile.net/hexo-theme-redefine/:version/:path", - bootcdn: - "https://cdn.bootcdn.net/ajax/libs/hexo-theme-redefine/:version/:path", + // FUCK STATICFILE, CDN POISONING + // FUCK BOOTCDN, CDN POISONING sustech: "https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/hexo-theme-redefine/:version/:path", zstatic: @@ -164,7 +162,7 @@ hexo.extend.helper.register("renderJSModule", function (path) { jsdelivr: "https://cdn.jsdelivr.net/npm/hexo-theme-redefine@:version/source/:path", aliyun: - "https://evan.beee.top/projects/hexo-theme-redefine/:version/source/:path", + "https://evan.beee.top/projects/hexo-theme-redefine@:version/source/:path", npmmirror: "https://registry.npmmirror.com/hexo-theme-redefine/:version/files/source/:path", custom: this.theme.cdn.custom_url, @@ -172,7 +170,7 @@ hexo.extend.helper.register("renderJSModule", function (path) { const cdnPathHandle = (path) => { const cdnBase = - cdnProviders[this.theme.cdn.provider] || cdnProviders.staticfile; + cdnProviders[this.theme.cdn.provider] || cdnProviders.npmmirror; let jsModuleScript; if (this.theme.cdn.enable) { @@ -210,9 +208,8 @@ hexo.extend.helper.register("renderJSPath", function (path) { const _url_for = hexo.extend.helper.get("url_for").bind(hexo); const cdnProviders = { - staticfile: "https://cdn.staticfile.net/hexo-theme-redefine/:version/:path", - bootcdn: - "https://cdn.bootcdn.net/ajax/libs/hexo-theme-redefine/:version/:path", + // FUCK STATICFILE, CDN POISONING + // FUCK BOOTCDN, CDN POISONING sustech: "https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/hexo-theme-redefine/:version/:path", zstatic: @@ -223,7 +220,7 @@ hexo.extend.helper.register("renderJSPath", function (path) { jsdelivr: "https://cdn.jsdelivr.net/npm/hexo-theme-redefine@:version/source/:path", aliyun: - "https://evan.beee.top/projects/hexo-theme-redefine/:version/source/:path", + "https://evan.beee.top/projects/hexo-theme-redefine@:version/source/:path", npmmirror: "https://registry.npmmirror.com/hexo-theme-redefine/:version/files/source/:path", custom: this.theme.cdn.custom_url, @@ -231,7 +228,7 @@ hexo.extend.helper.register("renderJSPath", function (path) { const cdnPathHandle = (path) => { const cdnBase = - cdnProviders[this.theme.cdn.provider] || cdnProviders.staticfile; + cdnProviders[this.theme.cdn.provider] || cdnProviders.npmmirror; let jsScript; if (this.theme.cdn.enable) { @@ -267,9 +264,8 @@ hexo.extend.helper.register("renderCSS", function (path) { const _css = hexo.extend.helper.get("css").bind(hexo); const cdnProviders = { - staticfile: "https://cdn.staticfile.net/hexo-theme-redefine/:version/:path", - bootcdn: - "https://cdn.bootcdn.net/ajax/libs/hexo-theme-redefine/:version/:path", + // FUCK STATICFILE, CDN POISONING + // FUCK BOOTCDN, CDN POISONING sustech: "https://mirrors.sustech.edu.cn/cdnjs/ajax/libs/hexo-theme-redefine/:version/:path", zstatic: @@ -280,7 +276,7 @@ hexo.extend.helper.register("renderCSS", function (path) { jsdelivr: "https://cdn.jsdelivr.net/npm/hexo-theme-redefine@:version/source/:path", aliyun: - "https://evan.beee.top/projects/hexo-theme-redefine/:version/source/:path", + "https://evan.beee.top/projects/hexo-theme-redefine@:version/source/:path", npmmirror: "https://registry.npmmirror.com/hexo-theme-redefine/:version/files/source/:path", custom: this.theme.cdn.custom_url, @@ -288,7 +284,7 @@ hexo.extend.helper.register("renderCSS", function (path) { const cdnPathHandle = (path) => { const cdnBase = - cdnProviders[this.theme.cdn.provider] || cdnProviders.staticfile; + cdnProviders[this.theme.cdn.provider] || cdnProviders.npmmirror; let cssLink; if (this.theme.cdn.enable) { diff --git a/source/css/common/codeblock/code-theme.styl b/source/css/common/codeblock/code-theme.styl index 9c0c263e..22b06461 100755 --- a/source/css/common/codeblock/code-theme.styl +++ b/source/css/common/codeblock/code-theme.styl @@ -1,53 +1,47 @@ @import '../variables.styl' -$code-foreground = lighten($default-text-color, 2%) -$code-background = darken($background-color, 5%) -$highlight-foreground = lighten($default-text-color, 2%) -$highlight-background = #fafafa -$highlight-gutter-color = #373D3F -$highlight-gutter-bg-color = #EEEEEE -$highlight-keyword = #d73a49 -$highlight-link = #d73a49 -$highlight-built-in = #6f42c1 -$highlight-number = #005cc5 -$highlight-string = #032f62 -$highlight-regexp = #e36209 -$highlight-subst = #24292e -$highlight-comment = #6a737d -$highlight-doctag = #22863a -$highlight-variable = #005cc5 -$highlight-attr = #22863a -$highlight-bullet = #6f42c1 -$highlight-addition = #abe338 -$highlight-deletion = #ffa07a -$night-code-foreground = lighten($dark-default-text-color, 2%) -$night-code-background = lighten($dark-background-color, 10%) -$night-highlight-foreground = lighten($dark-default-text-color, 2%) -$night-highlight-background = #21252b -$night-highlight-gutter-color = #bebec6 -$night-highlight-gutter-bg-color = #21252b -$dark-highlight-keyword = #569CD6 -$dark-highlight-link = #569CD6 -$dark-highlight-built-in = #4EC9B0 -$dark-highlight-number = #B8D7A3 -$dark-highlight-string = #D69D85 -$dark-highlight-regexp = #9A5334 -$dark-highlight-subst = #DCDCDC -$dark-highlight-comment = #57A64A -$dark-highlight-doctag = #608B4E -$dark-highlight-meta = #9B9B9B -$dark-highlight-variable = #BD63C5 -$dark-highlight-attr = #9CDCFE -$dark-highlight-section = gold -$dark-highlight-bullet = #D7BA7D -$dark-highlight-addition = #144212 -$dark-highlight-deletion = #600 +if (hexo-config('articles.code_block.highlight_theme.light') == 'github') { + @import 'hljs-themes/light/github.styl' +} else if (hexo-config('articles.code_block.highlight_theme.light') == 'atom-one-light') { + @import 'hljs-themes/light/atom-one-light.styl' +} else if (hexo-config('articles.code_block.highlight_theme.light') == 'default') { + @import 'hljs-themes/light/default.styl' +} else { + @import 'hljs-themes/light/github.styl' +} + +if (hexo-config('articles.code_block.highlight_theme.dark') == 'github-dark') { + @import 'hljs-themes/dark/github-dark.styl' +} else if (hexo-config('articles.code_block.highlight_theme.dark') == 'vs2015') { + @import 'hljs-themes/dark/vs2015.styl' +} else if (hexo-config('articles.code_block.highlight_theme.dark') == 'atom-one-dark') { + @import 'hljs-themes/dark/atom-one-dark.styl' +} else if (hexo-config('articles.code_block.highlight_theme.dark') == 'a11y-dark') { + @import 'hljs-themes/dark/a11y-dark.styl' +} else if (hexo-config('articles.code_block.highlight_theme.dark') == 'agate') { + @import 'hljs-themes/dark/agate.styl' +} else if (hexo-config('articles.code_block.highlight_theme.dark') == 'monokai-sublime') { + @import 'hljs-themes/dark/monokai-sublime.styl' +} else if (hexo-config('articles.code_block.highlight_theme.dark') == 'night-owl') { + @import 'hljs-themes/dark/night-owl.styl' +} else if (hexo-config('articles.code_block.highlight_theme.dark') == 'nord') { + @import 'hljs-themes/dark/nord.styl' +} else if (hexo-config('articles.code_block.highlight_theme.dark') == 'tokyo-night-dark') { + @import 'hljs-themes/dark/tokyo-night-dark.styl' +} else { + @import 'hljs-themes/dark/github-dark.styl' +} + +$highlight-gutter-color = #6a737d +$highlight-gutter-bg-color = #f6f8fa +$dark-highlight-gutter-color = #8b949e +$dark-highlight-gutter-bg-color = #161b22 code-theme(mode) - --code-foreground: mode == 'light' ? $code-foreground : $night-code-foreground - --code-background: mode == 'light' ? $code-background : $night-code-background - --highlight-background: mode == 'light' ? $highlight-background : $night-highlight-background - --highlight-foreground: mode == 'light' ? $highlight-foreground : $night-highlight-foreground + --code-foreground: mode == 'light' ? $highlight-foreground : $dark-code-foreground + --code-background: mode == 'light' ? $highlight-background : $dark-code-background + --highlight-background: mode == 'light' ? $highlight-background : $dark-highlight-background + --highlight-foreground: mode == 'light' ? $highlight-foreground : $dark-highlight-foreground --highlight-keyword: mode == 'light' ? $highlight-keyword : $dark-highlight-keyword --highlight-link: mode == 'light' ? $highlight-link : $dark-highlight-link --highlight-built-in: mode == 'light' ? $highlight-built-in : $dark-highlight-built-in diff --git a/source/css/common/codeblock/highlight.styl b/source/css/common/codeblock/highlight.styl index 72c6ecc2..98b612b6 100755 --- a/source/css/common/codeblock/highlight.styl +++ b/source/css/common/codeblock/highlight.styl @@ -28,10 +28,12 @@ code padding 3px 4px word-wrap break-word border-radius $redefine-border-radius-xsmall - font-size 0.875rem !important color var(--code-foreground) background var(--code-background) +.main-content code + font-size: 0.9em + pre @extend $code-block font-size 0.9rem !important diff --git a/source/css/common/codeblock/hljs-themes/dark/a11y-dark.styl b/source/css/common/codeblock/hljs-themes/dark/a11y-dark.styl new file mode 100644 index 00000000..bcd607b6 --- /dev/null +++ b/source/css/common/codeblock/hljs-themes/dark/a11y-dark.styl @@ -0,0 +1,18 @@ +$highlight-foreground = #f8f8f2 +$highlight-background = #2b2b2b +$highlight-keyword = #dcc6e0 +$highlight-link = #f5ab35 +$highlight-built-in = #f5ab35 +$highlight-number = #f5ab35 +$highlight-string = #abe338 +$highlight-regexp = #ffa07a +$highlight-subst = #f8f8f2 +$highlight-comment = #d4d0ab +$highlight-doctag = #dcc6e0 +$highlight-meta = #f5ab35 +$highlight-variable = #ffa07a +$highlight-attr = #ffd700 +$highlight-section = #00e0e0 +$highlight-bullet = #abe338 +$highlight-addition = #abe338 +$highlight-deletion = #ffa07a \ No newline at end of file diff --git a/source/css/common/codeblock/hljs-themes/dark/agate.styl b/source/css/common/codeblock/hljs-themes/dark/agate.styl new file mode 100644 index 00000000..2fe22435 --- /dev/null +++ b/source/css/common/codeblock/hljs-themes/dark/agate.styl @@ -0,0 +1,18 @@ +$highlight-foreground = #fff +$highlight-background = #333 +$highlight-keyword = #fcc28c +$highlight-link = #c6b4f0 +$highlight-built-in = #fcc28c +$highlight-number = #d36363 +$highlight-string = #a2fca2 +$highlight-regexp = #c6b4f0 +$highlight-subst = #fff +$highlight-comment = #888 +$highlight-doctag = #fff +$highlight-meta = #fc9b9b +$highlight-variable = #ade5fc +$highlight-attr = #7bd694 +$highlight-section = #62c8f3 +$highlight-bullet = #b8d8a2 +$highlight-addition = #a2fca2 +$highlight-deletion = #fc9b9b \ No newline at end of file diff --git a/source/css/common/codeblock/hljs-themes/dark/atom-one-dark.styl b/source/css/common/codeblock/hljs-themes/dark/atom-one-dark.styl new file mode 100644 index 00000000..c4fdf510 --- /dev/null +++ b/source/css/common/codeblock/hljs-themes/dark/atom-one-dark.styl @@ -0,0 +1,18 @@ +$dark-highlight-foreground = #abb2bf +$dark-highlight-background = #282c34 +$dark-highlight-keyword = #c678dd +$dark-highlight-link = #61aeee +$dark-highlight-built-in = #e6c07b +$dark-highlight-number = #d19a66 +$dark-highlight-string = #98c379 +$dark-highlight-regexp = #98c379 +$dark-highlight-subst = #e06c75 +$dark-highlight-comment = #5c6370 +$dark-highlight-doctag = #c678dd +$dark-highlight-meta = #61aeee +$dark-highlight-variable = #d19a66 +$dark-highlight-attr = #d19a66 +$dark-highlight-section = #e06c75 +$dark-highlight-bullet = #61aeee +$dark-highlight-addition = #98c379 +$dark-highlight-deletion = #e06c75 \ No newline at end of file diff --git a/source/css/common/codeblock/hljs-themes/dark/github-dark.styl b/source/css/common/codeblock/hljs-themes/dark/github-dark.styl new file mode 100644 index 00000000..f6fb35e9 --- /dev/null +++ b/source/css/common/codeblock/hljs-themes/dark/github-dark.styl @@ -0,0 +1,18 @@ +$dark-highlight-foreground = #c9d1d9 +$dark-highlight-background = #0d1117 +$dark-highlight-keyword = #ff7b72 +$dark-highlight-link = #ff7b72 +$dark-highlight-built-in = #ffa657 +$dark-highlight-number = #79c0ff +$dark-highlight-string = #a5d6ff +$dark-highlight-regexp = #a5d6ff +$dark-highlight-subst = #c9d1d9 +$dark-highlight-comment = #8b949e +$dark-highlight-doctag = #ff7b72 +$dark-highlight-meta = #79c0ff +$dark-highlight-variable = #79c0ff +$dark-highlight-attr = #79c0ff +$dark-highlight-section = #1f6feb +$dark-highlight-bullet = #f2cc60 +$dark-highlight-addition = #aff5b4 +$dark-highlight-deletion = #ffdcd7 \ No newline at end of file diff --git a/source/css/common/codeblock/hljs-themes/dark/monokai-sublime.styl b/source/css/common/codeblock/hljs-themes/dark/monokai-sublime.styl new file mode 100644 index 00000000..05f11dab --- /dev/null +++ b/source/css/common/codeblock/hljs-themes/dark/monokai-sublime.styl @@ -0,0 +1,18 @@ +$dark-highlight-foreground = #f8f8f2 +$dark-highlight-background = #23241f +$dark-highlight-keyword = #f92672 +$dark-highlight-link = #ae81ff +$dark-highlight-built-in = #e6db74 +$dark-highlight-number = #ae81ff +$dark-highlight-string = #e6db74 +$dark-highlight-regexp = #ae81ff +$dark-highlight-subst = #f8f8f2 +$dark-highlight-comment = #75715e +$dark-highlight-doctag = #f92672 +$dark-highlight-meta = #75715e +$dark-highlight-variable = #e6db74 +$dark-highlight-attr = #f92672 +$dark-highlight-section = #a6e22e +$dark-highlight-bullet = #ae81ff +$dark-highlight-addition = #e6db74 +$dark-highlight-deletion = #75715e \ No newline at end of file diff --git a/source/css/common/codeblock/hljs-themes/dark/night-owl.styl b/source/css/common/codeblock/hljs-themes/dark/night-owl.styl new file mode 100644 index 00000000..68666fb8 --- /dev/null +++ b/source/css/common/codeblock/hljs-themes/dark/night-owl.styl @@ -0,0 +1,18 @@ +$highlight-foreground = #d6deeb +$highlight-background = #011627 +$highlight-keyword = #c792ea +$highlight-link = #ff869a +$highlight-built-in = #addb67 +$highlight-number = #F78C6C +$highlight-string = #ecc48d +$highlight-regexp = #5ca7e4 +$highlight-subst = #d3423e +$highlight-comment = #637777 +$highlight-doctag = #7fdbca +$highlight-meta = #82aaff +$highlight-variable = #addb67 +$highlight-attr = #7fdbca +$highlight-section = #82b1ff +$highlight-bullet = #d9f5dd +$highlight-addition = #addb67ff +$highlight-deletion = #EF535090 \ No newline at end of file diff --git a/source/css/common/codeblock/hljs-themes/dark/nord.styl b/source/css/common/codeblock/hljs-themes/dark/nord.styl new file mode 100644 index 00000000..f793e054 --- /dev/null +++ b/source/css/common/codeblock/hljs-themes/dark/nord.styl @@ -0,0 +1,18 @@ +$dark-highlight-foreground = #D8DEE9 +$dark-highlight-background = #2E3440 +$dark-highlight-keyword = #81A1C1 +$dark-highlight-link = #81A1C1 +$dark-highlight-built-in = #8FBCBB +$dark-highlight-number = #B48EAD +$dark-highlight-string = #A3BE8C +$dark-highlight-regexp = #EBCB8B +$dark-highlight-subst = #D8DEE9 +$dark-highlight-comment = #4C566A +$dark-highlight-doctag = #8FBCBB +$dark-highlight-meta = #5E81AC +$dark-highlight-variable = #D8DEE9 +$dark-highlight-attr = #8FBCBB +$dark-highlight-section = #88C0D0 +$dark-highlight-bullet = #81A1C1 +$dark-highlight-addition = rgba(163, 190, 140, 0.5) +$dark-highlight-deletion = rgba(191, 97, 106, 0.5) \ No newline at end of file diff --git a/source/css/common/codeblock/hljs-themes/dark/tokyo-night-dark.styl b/source/css/common/codeblock/hljs-themes/dark/tokyo-night-dark.styl new file mode 100644 index 00000000..3397b26c --- /dev/null +++ b/source/css/common/codeblock/hljs-themes/dark/tokyo-night-dark.styl @@ -0,0 +1,18 @@ +$highlight-foreground = #9aa5ce +$highlight-background = #1a1b26 +$highlight-keyword = #bb9af7 +$highlight-link = #ff9e64 +$highlight-built-in = #e0af68 +$highlight-number = #ff9e64 +$highlight-string = #9ece6a +$highlight-regexp = #f7768e +$highlight-subst = #7dcfff +$highlight-comment = #565f89 +$highlight-doctag = #f7768e +$highlight-meta = #565f89 +$highlight-variable = #ff9e64 +$highlight-attr = #bb9af7 +$highlight-section = #7aa2f7 +$highlight-bullet = #9ece6a +$highlight-addition = #9ece6a +$highlight-deletion = #f7768e \ No newline at end of file diff --git a/source/css/common/codeblock/hljs-themes/dark/vs2015.styl b/source/css/common/codeblock/hljs-themes/dark/vs2015.styl new file mode 100644 index 00000000..e5620d76 --- /dev/null +++ b/source/css/common/codeblock/hljs-themes/dark/vs2015.styl @@ -0,0 +1,18 @@ +$dark-highlight-foreground = #DCDCDC +$dark-highlight-background = #1E1E1E +$dark-highlight-keyword = #569CD6 +$dark-highlight-link = #569CD6 +$dark-highlight-built-in = #4EC9B0 +$dark-highlight-number = #B8D7A3 +$dark-highlight-string = #D69D85 +$dark-highlight-regexp = #9A5334 +$dark-highlight-subst = #DCDCDC +$dark-highlight-comment = #57A64A +$dark-highlight-doctag = #608B4E +$dark-highlight-meta = #9B9B9B +$dark-highlight-variable = #BD63C5 +$dark-highlight-attr = #9CDCFE +$dark-highlight-section = gold +$dark-highlight-bullet = #D7BA7D +$dark-highlight-addition = #144212 +$dark-highlight-deletion = #600 \ No newline at end of file diff --git a/source/css/common/codeblock/hljs-themes/light/atom-one-light.styl b/source/css/common/codeblock/hljs-themes/light/atom-one-light.styl new file mode 100644 index 00000000..088adf9c --- /dev/null +++ b/source/css/common/codeblock/hljs-themes/light/atom-one-light.styl @@ -0,0 +1,18 @@ +$highlight-foreground = #383a42 +$highlight-background = #fafafa +$highlight-keyword = #a626a4 +$highlight-link = #4078f2 +$highlight-built-in = #c18401 +$highlight-number = #986801 +$highlight-string = #50a14f +$highlight-regexp = #50a14f +$highlight-subst = #e45649 +$highlight-comment = #a0a1a7 +$highlight-doctag = #a626a4 +$highlight-meta = #4078f2 +$highlight-variable = #986801 +$highlight-attr = #986801 +$highlight-section = #e45649 +$highlight-bullet = #4078f2 +$highlight-addition = #50a14f +$highlight-deletion = #e45649 \ No newline at end of file diff --git a/source/css/common/codeblock/hljs-themes/light/default.styl b/source/css/common/codeblock/hljs-themes/light/default.styl new file mode 100644 index 00000000..1f30c173 --- /dev/null +++ b/source/css/common/codeblock/hljs-themes/light/default.styl @@ -0,0 +1,18 @@ +$highlight-foreground = #444 +$highlight-background = #F3F3F3 +$highlight-keyword = #444 +$highlight-link = #ab5656 +$highlight-built-in = #397300 +$highlight-number = #880000 +$highlight-string = #880000 +$highlight-regexp = #ab5656 +$highlight-subst = #444 +$highlight-comment = #697070 +$highlight-doctag = #444 +$highlight-meta = #1f7199 +$highlight-variable = #ab5656 +$highlight-attr = #444 +$highlight-section = #880000 +$highlight-bullet = #397300 +$highlight-addition = #397300 +$highlight-deletion = #880000 \ No newline at end of file diff --git a/source/css/common/codeblock/hljs-themes/light/github.styl b/source/css/common/codeblock/hljs-themes/light/github.styl new file mode 100644 index 00000000..db36afa9 --- /dev/null +++ b/source/css/common/codeblock/hljs-themes/light/github.styl @@ -0,0 +1,18 @@ +$highlight-foreground = #24292e +$highlight-background = #fdfdfd +$highlight-keyword = #d73a49 +$highlight-link = #d73a49 /* Following the pattern, link should have the same color as keyword */ +$highlight-built-in = #e36209 +$highlight-number = #005cc5 +$highlight-string = #032f62 +$highlight-regexp = #032f62 +$highlight-subst = #24292e +$highlight-comment = #6a737d +$highlight-doctag = #d73a49 +$highlight-meta = #005cc5 /* Mapped based on the pattern for constant */ +$highlight-variable = #005cc5 +$highlight-attr = #005cc5 +$highlight-section = #005cc5 +$highlight-bullet = #735c0f +$highlight-addition = #22863a +$highlight-deletion = #b31d28 \ No newline at end of file diff --git a/source/css/layout/_partials/archive-list.styl b/source/css/layout/_partials/archive-list.styl index a478be22..bafe98ef 100755 --- a/source/css/layout/_partials/archive-list.styl +++ b/source/css/layout/_partials/archive-list.styl @@ -18,12 +18,12 @@ $article-date-font-size = 1rem color var(--third-text-color) &::after - width 10px - height 10px + width 12px + height 12px display block - top 1em + top 20px position absolute - left -6px + left -7px border-radius 10px content '' border 2px solid var(--third-text-color) @@ -35,16 +35,15 @@ $article-date-font-size = 1rem span.article-title position relative - padding-left 15px display block &::after content "" width 7px height 7px - background var(--background-color) - border 2px solid var(--third-text-color) + background var(--fourth-text-color) + border 1px solid var(--border-color) position absolute - left 0 + left -1.79rem top 0.5em border-radius 50px \ No newline at end of file diff --git a/source/css/layout/_partials/navbar.styl b/source/css/layout/_partials/navbar.styl index 132dd479..85003d9c 100755 --- a/source/css/layout/_partials/navbar.styl +++ b/source/css/layout/_partials/navbar.styl @@ -73,6 +73,9 @@ $logo-image-box-width = 34px line-height 1 color var(--first-text-color) transform translateY(1px) + if hexo-config('global.fonts.title.enable') { + font-family hexo-config('global.fonts.title.family') + } h1 margin 0 diff --git a/source/css/layout/home-sidebar.styl b/source/css/layout/home-sidebar.styl index 8389479a..7b94dd01 100755 --- a/source/css/layout/home-sidebar.styl +++ b/source/css/layout/home-sidebar.styl @@ -77,6 +77,9 @@ color var(--second-text-color) font-family 'Chillax-Variable', sans-serif text-align center + if hexo-config('global.fonts.title.enable') { + font-family hexo-config('global.fonts.title.family') + } .announcement font-size 0.9rem diff --git a/source/js/plugins/hbe.js b/source/js/plugins/hbe.js index 2b6bc4aa..769ff4f2 100755 --- a/source/js/plugins/hbe.js +++ b/source/js/plugins/hbe.js @@ -1,12 +1,13 @@ -(() => { - "use strict"; +import { main } from "../main.js"; +import { initTOC } from "../layouts/toc.js"; +export function initHBE() { const cryptoObj = window.crypto || window.msCrypto; const storage = window.localStorage; const storageName = "hexo-blog-encrypt:#" + window.location.pathname; - const keySalt = textToArray("hexo-blog-encrypt的作者们都是大帅比!"); - const ivSalt = textToArray("hexo-blog-encrypt是地表最强Hexo加密插件!"); + const keySalt = textToArray("too young too simple"); + const ivSalt = textToArray("sometimes naive!"); // As we can't detect the wrong password with AES-CBC, // so adding an empty div and check it when decrption. @@ -235,24 +236,9 @@ } }); - // support theme-next refresh - window.NexT && - NexT.boot && - typeof NexT.boot.refresh === "function" && - NexT.boot.refresh(); - - // TOC part - var tocDiv = document.getElementById("toc-div"); - if (tocDiv) { - tocDiv.style.display = "inline"; - } - - var tocDivs = document.getElementsByClassName("toc-div-class"); - if (tocDivs && tocDivs.length > 0) { - for (var idx = 0; idx < tocDivs.length; idx++) { - tocDivs[idx].style.display = "inline"; - } - } + // // load Redefine Page components + main.refresh(); + initTOC(); // trigger event var event = new Event("hexo-blog-decrypt"); @@ -344,4 +330,6 @@ } hbeLoader(); -})(); +} + +// initHBE(); diff --git a/source/js/plugins/typed.js b/source/js/plugins/typed.js index 7b8a115e..3977e931 100644 --- a/source/js/plugins/typed.js +++ b/source/js/plugins/typed.js @@ -38,7 +38,11 @@ export default function initTyped(id) { fetch(usrHitokotoAPI) .then((response) => response.json()) .then((data) => { - typing(data.hitokoto); + if (data.from_who && theme.home_banner.subtitle.hitokoto.show_author) { + typing(data.hitokoto + "——" + data.from_who); + } else { + typing(data.hitokoto); + } }) .catch(console.error); } else { diff --git a/source/js/tools/imageViewer.js b/source/js/tools/imageViewer.js index f23e91b2..095b1071 100644 --- a/source/js/tools/imageViewer.js +++ b/source/js/tools/imageViewer.js @@ -3,14 +3,27 @@ export default function imageViewer() { let scale = 1; let isMouseDown = false; let dragged = false; - let currentImgIndex = 0; + let currentImgIndex = 0; let lastMouseX = 0; let lastMouseY = 0; let translateX = 0; let translateY = 0; const maskDom = document.querySelector(".image-viewer-container"); + if (!maskDom) { + console.warn( + "Image viewer container not found. Exiting imageViewer function.", + ); + return; + } + const targetImg = maskDom.querySelector("img"); + if (!targetImg) { + console.warn( + "Target image not found in image viewer container. Exiting imageViewer function.", + ); + return; + } const showHandle = (isShow) => { document.body.style.overflow = isShow ? "hidden" : "auto"; @@ -48,7 +61,7 @@ export default function imageViewer() { isMouseDown = true; lastMouseX = event.clientX; lastMouseY = event.clientY; - targetImg.style.cursor = 'grabbing'; + targetImg.style.cursor = "grabbing"; }; let lastTime = 0; @@ -68,7 +81,7 @@ export default function imageViewer() { lastMouseX = event.clientX; lastMouseY = event.clientY; targetImg.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scale})`; - dragged = true; + dragged = true; } }; @@ -77,7 +90,7 @@ export default function imageViewer() { event.stopPropagation(); } isMouseDown = false; - targetImg.style.cursor = 'grab'; + targetImg.style.cursor = "grab"; }; targetImg.addEventListener("wheel", zoomHandle, { passive: false }); @@ -87,7 +100,7 @@ export default function imageViewer() { targetImg.addEventListener("mouseleave", dragEndHandle, { passive: false }); maskDom.addEventListener("click", (event) => { - if (!dragged) { + if (!dragged) { isBigImage = false; showHandle(isBigImage); scale = 1; @@ -95,9 +108,9 @@ export default function imageViewer() { translateY = 0; targetImg.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scale})`; } - dragged = false; + dragged = false; }); - + const imgDoms = document.querySelectorAll( ".markdown-body img, .masonry-item img, #shuoshuo-content img", ); @@ -115,42 +128,43 @@ export default function imageViewer() { } }; - imgDoms.forEach((img, index) => { - img.addEventListener("click", () => { - currentImgIndex = index; - isBigImage = true; - showHandle(isBigImage); - targetImg.src = img.src; - document.addEventListener("keydown", escapeKeyListener); + if (imgDoms.length > 0) { + imgDoms.forEach((img, index) => { + img.addEventListener("click", () => { + currentImgIndex = index; + isBigImage = true; + showHandle(isBigImage); + targetImg.src = img.src; + document.addEventListener("keydown", escapeKeyListener); + }); }); - }); - const handleArrowKeys = (event) => { - if (!isBigImage) return; - - if (event.key === "ArrowUp" || event.key === "ArrowLeft") { - currentImgIndex = (currentImgIndex - 1 + imgDoms.length) % imgDoms.length; - } else if (event.key === "ArrowDown" || event.key === "ArrowRight") { - currentImgIndex = (currentImgIndex + 1) % imgDoms.length; - } else { - return; - } - - const currentImg = imgDoms[currentImgIndex]; - let newSrc = currentImg.src; - - if (currentImg.hasAttribute("lazyload")) { - newSrc = currentImg.getAttribute("data-src"); - currentImg.src = newSrc; - currentImg.removeAttribute("lazyload"); - } + const handleArrowKeys = (event) => { + if (!isBigImage) return; - targetImg.src = newSrc; -}; + if (event.key === "ArrowUp" || event.key === "ArrowLeft") { + currentImgIndex = + (currentImgIndex - 1 + imgDoms.length) % imgDoms.length; + } else if (event.key === "ArrowDown" || event.key === "ArrowRight") { + currentImgIndex = (currentImgIndex + 1) % imgDoms.length; + } else { + return; + } + + const currentImg = imgDoms[currentImgIndex]; + let newSrc = currentImg.src; + + if (currentImg.hasAttribute("lazyload")) { + newSrc = currentImg.getAttribute("data-src"); + currentImg.src = newSrc; + currentImg.removeAttribute("lazyload"); + } - document.addEventListener("keydown", handleArrowKeys); + targetImg.src = newSrc; + }; - if (!imgDoms.length && maskDom) { - maskDom.parentNode.removeChild(maskDom); + document.addEventListener("keydown", handleArrowKeys); + } else { + // console.warn("No images found to attach image viewer functionality."); } }