hexo-theme-redefine-x 2.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/ISSUE_TEMPLATE/bug-chinese.yml +115 -0
- package/.github/ISSUE_TEMPLATE/bug-english.yml +106 -0
- package/.github/ISSUE_TEMPLATE/enhancement-chinese.yml +55 -0
- package/.github/ISSUE_TEMPLATE/enhancement-english.yml +55 -0
- package/.github/workflows/build-and-commit.yml +49 -0
- package/.github/workflows/npm-publish.yml +34 -0
- package/.github/workflows/stale-issues.yml +20 -0
- package/CHANGELOG_REDEFINE_X.md +236 -0
- package/CODE_OF_CONDUCT.md +128 -0
- package/CONTRIBUTING.md +51 -0
- package/DONATION.md +82 -0
- package/LICENSE +674 -0
- package/README.md +135 -0
- package/README_zh-CN.md +138 -0
- package/README_zh-TW.md +137 -0
- package/TODO.md +215 -0
- package/_config.yml +489 -0
- package/languages/en.yml +93 -0
- package/languages/es.yml +92 -0
- package/languages/fr.yml +92 -0
- package/languages/ja.yml +92 -0
- package/languages/zh-CN.yml +95 -0
- package/languages/zh-TW.yml +94 -0
- package/layout/404.ejs +1 -0
- package/layout/archive.ejs +1 -0
- package/layout/category.ejs +1 -0
- package/layout/components/comments/comment.ejs +22 -0
- package/layout/components/comments/giscus.ejs +42 -0
- package/layout/components/comments/gitalk.ejs +47 -0
- package/layout/components/comments/twikoo.ejs +50 -0
- package/layout/components/comments/waline.ejs +34 -0
- package/layout/components/footer/footer.ejs +99 -0
- package/layout/components/header/head.ejs +222 -0
- package/layout/components/header/navbar.ejs +163 -0
- package/layout/components/header/preloader.ejs +148 -0
- package/layout/components/header/progress-bar.ejs +12 -0
- package/layout/components/plugins/aplayer.ejs +3 -0
- package/layout/components/scripts.ejs +90 -0
- package/layout/components/sidebar/author.ejs +6 -0
- package/layout/components/sidebar/avatar.ejs +3 -0
- package/layout/components/sidebar/statistics.ejs +14 -0
- package/layout/components/swup.ejs +27 -0
- package/layout/index.ejs +1 -0
- package/layout/layout.ejs +13 -0
- package/layout/page.ejs +57 -0
- package/layout/pages/archive/archive.ejs +3 -0
- package/layout/pages/bookmarks/bookmarks.ejs +68 -0
- package/layout/pages/category/categories.ejs +11 -0
- package/layout/pages/category/category-detail.ejs +6 -0
- package/layout/pages/friends/friends-link.ejs +59 -0
- package/layout/pages/home/home-article.ejs +52 -0
- package/layout/pages/home/home-background.ejs +33 -0
- package/layout/pages/home/home-banner.ejs +234 -0
- package/layout/pages/home/home-content.ejs +62 -0
- package/layout/pages/home/home-sidebar.ejs +78 -0
- package/layout/pages/masonry/masonry.ejs +28 -0
- package/layout/pages/notfound/notfound.ejs +8 -0
- package/layout/pages/page-template.ejs +23 -0
- package/layout/pages/post/article-content.ejs +153 -0
- package/layout/pages/post/article-copyright.ejs +69 -0
- package/layout/pages/post/article-info.ejs +78 -0
- package/layout/pages/post/post-tools.ejs +17 -0
- package/layout/pages/post/toc.ejs +15 -0
- package/layout/pages/shuoshuo/essays.ejs +23 -0
- package/layout/pages/tag/tag-detail.ejs +6 -0
- package/layout/pages/tag/tags.ejs +24 -0
- package/layout/post.ejs +1 -0
- package/layout/tag.ejs +1 -0
- package/layout/tags.ejs +1 -0
- package/layout/utils/image-viewer.ejs +3 -0
- package/layout/utils/local-search.ejs +20 -0
- package/layout/utils/paginator.ejs +8 -0
- package/layout/utils/posts-list.ejs +28 -0
- package/layout/utils/side-tools.ejs +51 -0
- package/package.json +45 -0
- package/scripts/config-export.js +66 -0
- package/scripts/data-handle.js +37 -0
- package/scripts/events/404.js +16 -0
- package/scripts/events/welcome.js +141 -0
- package/scripts/filters/delete-mask-handle.js +27 -0
- package/scripts/filters/encrypt.js +202 -0
- package/scripts/filters/img-handle.js +9 -0
- package/scripts/filters/lazyload-handle.js +350 -0
- package/scripts/filters/lib/hbe.default.js +15 -0
- package/scripts/filters/link-handle.js +42 -0
- package/scripts/filters/stylus-handle.js +9 -0
- package/scripts/filters/table-handle.js +11 -0
- package/scripts/helpers/meta-helpers.js +38 -0
- package/scripts/helpers/page-helpers.js +153 -0
- package/scripts/helpers/recommendation-helpers.js +367 -0
- package/scripts/helpers/theme-helpers.js +251 -0
- package/scripts/helpers/waline-helpers.js +33 -0
- package/scripts/modules/btn.js +85 -0
- package/scripts/modules/btns.js +71 -0
- package/scripts/modules/folding.js +34 -0
- package/scripts/modules/note-large.js +72 -0
- package/scripts/modules/note.js +64 -0
- package/scripts/modules/tabs.js +99 -0
- package/source/assets/hbe.style.css +220 -0
- package/source/assets/odometer-theme-minimal.css +81 -0
- package/source/css/build/tailwind.css +2 -0
- package/source/css/common/animated.styl +71 -0
- package/source/css/common/basic.styl +239 -0
- package/source/css/common/codeblock/code-block.styl +158 -0
- package/source/css/common/codeblock/code-theme.styl +82 -0
- package/source/css/common/codeblock/highlight.styl +189 -0
- package/source/css/common/codeblock/hljs-themes/dark/a11y-dark.styl +18 -0
- package/source/css/common/codeblock/hljs-themes/dark/agate.styl +18 -0
- package/source/css/common/codeblock/hljs-themes/dark/atom-one-dark.styl +18 -0
- package/source/css/common/codeblock/hljs-themes/dark/github-dark.styl +18 -0
- package/source/css/common/codeblock/hljs-themes/dark/monokai-sublime.styl +18 -0
- package/source/css/common/codeblock/hljs-themes/dark/night-owl.styl +18 -0
- package/source/css/common/codeblock/hljs-themes/dark/nord.styl +18 -0
- package/source/css/common/codeblock/hljs-themes/dark/tokyo-night-dark.styl +18 -0
- package/source/css/common/codeblock/hljs-themes/dark/vs2015.styl +18 -0
- package/source/css/common/codeblock/hljs-themes/light/atom-one-light.styl +18 -0
- package/source/css/common/codeblock/hljs-themes/light/default.styl +18 -0
- package/source/css/common/codeblock/hljs-themes/light/github.styl +18 -0
- package/source/css/common/colors.styl +112 -0
- package/source/css/common/markdown.styl +337 -0
- package/source/css/common/redefine-theme.styl +65 -0
- package/source/css/common/theme.styl +72 -0
- package/source/css/common/variables.styl +145 -0
- package/source/css/layout/_modules/aplayer.styl +799 -0
- package/source/css/layout/_modules/buttons.styl +42 -0
- package/source/css/layout/_modules/folding.styl +180 -0
- package/source/css/layout/_modules/notes.styl +181 -0
- package/source/css/layout/_modules/tabs.styl +105 -0
- package/source/css/layout/_partials/404.styl +14 -0
- package/source/css/layout/_partials/archive-list.styl +49 -0
- package/source/css/layout/_partials/article-copyright-info.styl +27 -0
- package/source/css/layout/_partials/article-meta-info.styl +62 -0
- package/source/css/layout/_partials/comments/comment.styl +11 -0
- package/source/css/layout/_partials/comments/gitalk.styl +529 -0
- package/source/css/layout/_partials/comments/twikoo.styl +62 -0
- package/source/css/layout/_partials/comments/waline.styl +1151 -0
- package/source/css/layout/_partials/footer.styl +59 -0
- package/source/css/layout/_partials/home-banner.styl +48 -0
- package/source/css/layout/_partials/image-viewer.styl +37 -0
- package/source/css/layout/_partials/local-search.styl +137 -0
- package/source/css/layout/_partials/navbar.styl +309 -0
- package/source/css/layout/_partials/page-template.styl +147 -0
- package/source/css/layout/_partials/paginator.styl +65 -0
- package/source/css/layout/_partials/post-tools.styl +43 -0
- package/source/css/layout/_partials/progress-bar.styl +33 -0
- package/source/css/layout/_partials/side-tools.styl +87 -0
- package/source/css/layout/_partials/tagcloud.styl +136 -0
- package/source/css/layout/_partials/toc.styl +105 -0
- package/source/css/layout/animations.styl +42 -0
- package/source/css/layout/archive-content.styl +8 -0
- package/source/css/layout/article-content.styl +257 -0
- package/source/css/layout/bookmarks.styl +8 -0
- package/source/css/layout/category-content.styl +21 -0
- package/source/css/layout/category-list.styl +119 -0
- package/source/css/layout/home-content.styl +114 -0
- package/source/css/layout/home-sidebar.styl +126 -0
- package/source/css/layout/page.styl +144 -0
- package/source/css/layout/tag-content.styl +30 -0
- package/source/css/style.styl +26 -0
- package/source/css/tailwind.source.css +236 -0
- package/source/fontawesome/all.min.css +6 -0
- package/source/fontawesome/brands.min.css +6 -0
- package/source/fontawesome/duotone.min.css +6 -0
- package/source/fontawesome/fontawesome.min.css +6 -0
- package/source/fontawesome/light.min.css +6 -0
- package/source/fontawesome/regular.min.css +6 -0
- package/source/fontawesome/sharp-solid.min.css +6 -0
- package/source/fontawesome/solid.min.css +6 -0
- package/source/fontawesome/svg-with-js.min.css +6 -0
- package/source/fontawesome/thin.min.css +6 -0
- package/source/fontawesome/v4-font-face.min.css +6 -0
- package/source/fontawesome/v4-shims.min.css +6 -0
- package/source/fontawesome/v5-font-face.min.css +6 -0
- package/source/fonts/Chillax/Chillax-Variable.eot +0 -0
- package/source/fonts/Chillax/Chillax-Variable.ttf +0 -0
- package/source/fonts/Chillax/Chillax-Variable.woff +0 -0
- package/source/fonts/Chillax/Chillax-Variable.woff2 +0 -0
- package/source/fonts/Chillax/chillax.css +39 -0
- package/source/fonts/Geist/GeistVF.ttf +0 -0
- package/source/fonts/Geist/GeistVF.woff +0 -0
- package/source/fonts/Geist/GeistVF.woff2 +0 -0
- package/source/fonts/Geist/geist.css +16 -0
- package/source/fonts/GeistMono/GeistMonoVF.ttf +0 -0
- package/source/fonts/GeistMono/GeistMonoVF.woff +0 -0
- package/source/fonts/GeistMono/GeistMonoVF.woff2 +0 -0
- package/source/fonts/GeistMono/geist-mono.css +16 -0
- package/source/images/bookmark-placeholder.svg +9 -0
- package/source/images/loading.svg +5 -0
- package/source/images/redefine-avatar.svg +1 -0
- package/source/images/redefine-favicon.svg +1 -0
- package/source/images/redefine-logo.svg +1 -0
- package/source/images/redefine-logo.webp +0 -0
- package/source/images/redefine-og.webp +0 -0
- package/source/images/wallhaven-wqery6-dark.webp +0 -0
- package/source/images/wallhaven-wqery6-light.webp +0 -0
- package/source/js/build/layouts/bookmarkNav.js +2 -0
- package/source/js/build/layouts/bookmarkNav.js.map +1 -0
- package/source/js/build/layouts/categoryList.js +2 -0
- package/source/js/build/layouts/categoryList.js.map +1 -0
- package/source/js/build/layouts/essays.js +2 -0
- package/source/js/build/layouts/essays.js.map +1 -0
- package/source/js/build/layouts/lazyload.js +2 -0
- package/source/js/build/layouts/lazyload.js.map +1 -0
- package/source/js/build/layouts/navbarShrink.js +2 -0
- package/source/js/build/layouts/navbarShrink.js.map +1 -0
- package/source/js/build/layouts/toc.js +2 -0
- package/source/js/build/layouts/toc.js.map +1 -0
- package/source/js/build/libs/APlayer.min.js +2 -0
- package/source/js/build/libs/Swup.min.js +2 -0
- package/source/js/build/libs/SwupPreloadPlugin.min.js +1 -0
- package/source/js/build/libs/SwupProgressPlugin.min.js +1 -0
- package/source/js/build/libs/SwupScriptsPlugin.min.js +1 -0
- package/source/js/build/libs/SwupScrollPlugin.min.js +1 -0
- package/source/js/build/libs/SwupSlideTheme.min.js +1 -0
- package/source/js/build/libs/Typed.min.js +10 -0
- package/source/js/build/libs/anime.min.js +8 -0
- package/source/js/build/libs/mermaid.min.js +2314 -0
- package/source/js/build/libs/minimasonry.min.js +1 -0
- package/source/js/build/libs/moment-with-locales.min.js +2 -0
- package/source/js/build/libs/moment.min.js +2 -0
- package/source/js/build/libs/odometer.min.js +2 -0
- package/source/js/build/libs/pangu.min.js +9 -0
- package/source/js/build/libs/pjax.min.js +1 -0
- package/source/js/build/libs/waline.js +84 -0
- package/source/js/build/main.js +2 -0
- package/source/js/build/main.js.map +1 -0
- package/source/js/build/plugins/aplayer.js +2 -0
- package/source/js/build/plugins/aplayer.js.map +1 -0
- package/source/js/build/plugins/hbe.js +2 -0
- package/source/js/build/plugins/hbe.js.map +1 -0
- package/source/js/build/plugins/masonry.js +2 -0
- package/source/js/build/plugins/masonry.js.map +1 -0
- package/source/js/build/plugins/mermaid.js +2 -0
- package/source/js/build/plugins/mermaid.js.map +1 -0
- package/source/js/build/plugins/pangu.js +2 -0
- package/source/js/build/plugins/pangu.js.map +1 -0
- package/source/js/build/plugins/tabs.js +2 -0
- package/source/js/build/plugins/tabs.js.map +1 -0
- package/source/js/build/plugins/typed.js +2 -0
- package/source/js/build/plugins/typed.js.map +1 -0
- package/source/js/build/tools/codeBlock.js +2 -0
- package/source/js/build/tools/codeBlock.js.map +1 -0
- package/source/js/build/tools/imageViewer.js +2 -0
- package/source/js/build/tools/imageViewer.js.map +1 -0
- package/source/js/build/tools/lightDarkSwitch.js +2 -0
- package/source/js/build/tools/lightDarkSwitch.js.map +1 -0
- package/source/js/build/tools/localSearch.js +2 -0
- package/source/js/build/tools/localSearch.js.map +1 -0
- package/source/js/build/tools/runtime.js +2 -0
- package/source/js/build/tools/runtime.js.map +1 -0
- package/source/js/build/tools/scrollTopBottom.js +2 -0
- package/source/js/build/tools/scrollTopBottom.js.map +1 -0
- package/source/js/build/tools/tocToggle.js +2 -0
- package/source/js/build/tools/tocToggle.js.map +1 -0
- package/source/js/build/utils.js +2 -0
- package/source/js/build/utils.js.map +1 -0
- package/source/js/build.js +148 -0
- package/source/js/layouts/bookmarkNav.js +65 -0
- package/source/js/layouts/categoryList.js +53 -0
- package/source/js/layouts/essays.js +25 -0
- package/source/js/layouts/lazyload.js +199 -0
- package/source/js/layouts/navbarShrink.js +135 -0
- package/source/js/layouts/toc.js +115 -0
- package/source/js/libs/APlayer.min.js +2 -0
- package/source/js/libs/APlayer.min.js.map +1 -0
- package/source/js/libs/Swup.min.js +2 -0
- package/source/js/libs/Swup.min.js.map +1 -0
- package/source/js/libs/SwupPreloadPlugin.min.js +1 -0
- package/source/js/libs/SwupPreloadPlugin.min.js.map +1 -0
- package/source/js/libs/SwupProgressPlugin.min.js +1 -0
- package/source/js/libs/SwupScriptsPlugin.min.js +1 -0
- package/source/js/libs/SwupScrollPlugin.min.js +1 -0
- package/source/js/libs/SwupScrollPlugin.min.js.map +1 -0
- package/source/js/libs/SwupSlideTheme.min.js +1 -0
- package/source/js/libs/Typed.min.js +10 -0
- package/source/js/libs/anime.min.js +8 -0
- package/source/js/libs/mermaid.min.js +2314 -0
- package/source/js/libs/mermaid.min.js.map +7 -0
- package/source/js/libs/minimasonry.min.js +1 -0
- package/source/js/libs/moment-with-locales.min.js +2 -0
- package/source/js/libs/moment.min.js +2 -0
- package/source/js/libs/odometer.min.js +2 -0
- package/source/js/libs/pangu.min.js +9 -0
- package/source/js/libs/pjax.min.js +1 -0
- package/source/js/libs/waline.js +84 -0
- package/source/js/libs/waline.js.map +1 -0
- package/source/js/main.js +95 -0
- package/source/js/plugins/aplayer.js +33 -0
- package/source/js/plugins/hbe.js +350 -0
- package/source/js/plugins/masonry.js +115 -0
- package/source/js/plugins/mermaid.js +7 -0
- package/source/js/plugins/pangu.js +12 -0
- package/source/js/plugins/tabs.js +29 -0
- package/source/js/plugins/typed.js +62 -0
- package/source/js/tools/codeBlock.js +48 -0
- package/source/js/tools/imageViewer.js +194 -0
- package/source/js/tools/lightDarkSwitch.js +165 -0
- package/source/js/tools/localSearch.js +327 -0
- package/source/js/tools/runtime.js +28 -0
- package/source/js/tools/scrollTopBottom.js +34 -0
- package/source/js/tools/tocToggle.js +58 -0
- package/source/js/utils.js +383 -0
- package/source/webfonts/fa-brands-400.ttf +0 -0
- package/source/webfonts/fa-brands-400.woff2 +0 -0
- package/source/webfonts/fa-duotone-900.ttf +0 -0
- package/source/webfonts/fa-duotone-900.woff2 +0 -0
- package/source/webfonts/fa-light-300.ttf +0 -0
- package/source/webfonts/fa-light-300.woff2 +0 -0
- package/source/webfonts/fa-regular-400.ttf +0 -0
- package/source/webfonts/fa-regular-400.woff2 +0 -0
- package/source/webfonts/fa-sharp-solid-900.ttf +0 -0
- package/source/webfonts/fa-sharp-solid-900.woff2 +0 -0
- package/source/webfonts/fa-solid-900.ttf +0 -0
- package/source/webfonts/fa-solid-900.woff2 +0 -0
- package/source/webfonts/fa-thin-100.ttf +0 -0
- package/source/webfonts/fa-thin-100.woff2 +0 -0
- package/source/webfonts/fa-v4compatibility.ttf +0 -0
- package/source/webfonts/fa-v4compatibility.woff2 +0 -0
- package/vercel.json +7 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<div class="side-tools-container">
|
|
2
|
+
<ul class="hidden-tools-list">
|
|
3
|
+
<li class="right-bottom-tools tool-font-adjust-plus flex justify-center items-center">
|
|
4
|
+
<i class="fa-regular fa-magnifying-glass-plus"></i>
|
|
5
|
+
</li>
|
|
6
|
+
|
|
7
|
+
<li class="right-bottom-tools tool-font-adjust-minus flex justify-center items-center">
|
|
8
|
+
<i class="fa-regular fa-magnifying-glass-minus"></i>
|
|
9
|
+
</li>
|
|
10
|
+
|
|
11
|
+
<li class="right-bottom-tools tool-dark-light-toggle flex justify-center items-center">
|
|
12
|
+
<i class="fa-regular fa-moon"></i>
|
|
13
|
+
</li>
|
|
14
|
+
|
|
15
|
+
<!-- rss -->
|
|
16
|
+
<% if (theme.plugins.feed.enable && config.feed) { %>
|
|
17
|
+
<li class="right-bottom-tools rss flex justify-center items-center">
|
|
18
|
+
<a class="flex justify-center items-center" href="<%= '/' + config.feed.path %>" target="_blank">
|
|
19
|
+
<i class="fa-regular fa-rss"></i>
|
|
20
|
+
</a>
|
|
21
|
+
</li>
|
|
22
|
+
<% } %>
|
|
23
|
+
|
|
24
|
+
<% if (theme.global.scroll_progress.percentage !== true) { %>
|
|
25
|
+
<li class="right-bottom-tools tool-scroll-to-top flex justify-center items-center">
|
|
26
|
+
<i class="fa-regular fa-arrow-up"></i>
|
|
27
|
+
</li>
|
|
28
|
+
<% } %>
|
|
29
|
+
|
|
30
|
+
<li class="right-bottom-tools tool-scroll-to-bottom flex justify-center items-center">
|
|
31
|
+
<i class="fa-regular fa-arrow-down"></i>
|
|
32
|
+
</li>
|
|
33
|
+
</ul>
|
|
34
|
+
|
|
35
|
+
<ul class="visible-tools-list">
|
|
36
|
+
<li class="right-bottom-tools toggle-tools-list flex justify-center items-center">
|
|
37
|
+
<i class="fa-regular fa-cog <% if (theme.global.side_tools && theme.global.side_tools.gear_rotation !== false) { %>fa-spin<% } %>"></i>
|
|
38
|
+
</li>
|
|
39
|
+
<% if (theme.global.scroll_progress.percentage === true) { %>
|
|
40
|
+
<li class="right-bottom-tools tool-scroll-to-top flex justify-center items-center">
|
|
41
|
+
<i class="arrow-up fas fa-arrow-up"></i>
|
|
42
|
+
<span class="percent"></span>
|
|
43
|
+
</li>
|
|
44
|
+
<% } %>
|
|
45
|
+
<% if (theme.plugins.aplayer.enable && theme.plugins.aplayer.type === "mini") { %>
|
|
46
|
+
<li class="right-bottom-tools tool-aplayer flex justify-center items-center">
|
|
47
|
+
|
|
48
|
+
</li>
|
|
49
|
+
<% } %>
|
|
50
|
+
</ul>
|
|
51
|
+
</div>
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hexo-theme-redefine-x",
|
|
3
|
+
"version": "2.8.5",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "Redefine-X your writing with Hexo Theme Redefine-X. A customized fork of hexo-theme-redefine.",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"npm:publish": "npm run build && npm publish",
|
|
8
|
+
"build": "npm run build:css && npm run build:js",
|
|
9
|
+
"build:css": "npx @tailwindcss/cli -i source/css/tailwind.source.css -o source/css/build/tailwind.css --minify",
|
|
10
|
+
"build:js": "node source/js/build.js",
|
|
11
|
+
"watch:css": "npx @tailwindcss/cli -i source/css/tailwind.source.css -o source/css/build/tailwind.css --watch --minify",
|
|
12
|
+
"release": "npx standard-version",
|
|
13
|
+
"release:minor": "npx standard-version --release-as minor",
|
|
14
|
+
"release:patch": "npx standard-version --release-as patch",
|
|
15
|
+
"release:major": "npx standard-version --release-as major"
|
|
16
|
+
},
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/Jason-JP-Yang/hexo-theme-Redefine-X.git"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"hexo",
|
|
23
|
+
"theme",
|
|
24
|
+
"redefine",
|
|
25
|
+
"redefine-x",
|
|
26
|
+
"simple",
|
|
27
|
+
"pure",
|
|
28
|
+
"powerful",
|
|
29
|
+
"hexo-theme"
|
|
30
|
+
],
|
|
31
|
+
"author": "Jason-JP-Yang",
|
|
32
|
+
"license": "GPL-3.0",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/Jason-JP-Yang/hexo-theme-Redefine-X/issues"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://redefine-x-docs.jason-yang.top/zh",
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"eslint": "^8.47.0",
|
|
39
|
+
"glob-promise": "^6.0.7",
|
|
40
|
+
"postcss": "^8.4.47",
|
|
41
|
+
"standard-version": "^9.5.0",
|
|
42
|
+
"tailwindcss": "^4.1.11",
|
|
43
|
+
"terser": "^5.36.0"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/* main hexo */
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const url = require("url");
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const yaml = require("js-yaml");
|
|
9
|
+
const { version } = require("../package.json");
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Export theme config to js
|
|
13
|
+
*/
|
|
14
|
+
hexo.extend.helper.register("export_config", function () {
|
|
15
|
+
let hexo_config = {
|
|
16
|
+
hostname: new URL(this.config.url).hostname || this.config.url,
|
|
17
|
+
root: this.config.root,
|
|
18
|
+
language: this.config.language,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
if (this.config.search) {
|
|
22
|
+
hexo_config.path = this.config.search.path;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let theme_config = {
|
|
26
|
+
articles: this.theme.articles,
|
|
27
|
+
colors: this.theme.colors,
|
|
28
|
+
global: this.theme.global,
|
|
29
|
+
home_banner: this.theme.home_banner,
|
|
30
|
+
plugins: this.theme.plugins,
|
|
31
|
+
version: version,
|
|
32
|
+
code_block: this.theme.code_block,
|
|
33
|
+
navbar: this.theme.navbar,
|
|
34
|
+
page_templates: this.theme.page_templates,
|
|
35
|
+
home: this.theme.home,
|
|
36
|
+
|
|
37
|
+
footerStart: this.theme.footer.start,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const languageDir = path.join(__dirname, "../languages");
|
|
41
|
+
let file = fs
|
|
42
|
+
.readdirSync(languageDir)
|
|
43
|
+
.find((v) => v === `${this.config.language}.yml`);
|
|
44
|
+
file = languageDir + "/" + (file ? file : "en.yml");
|
|
45
|
+
let languageContent = fs.readFileSync(file, "utf8");
|
|
46
|
+
try {
|
|
47
|
+
languageContent = yaml.load(languageContent);
|
|
48
|
+
} catch (e) {
|
|
49
|
+
console.log(e);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let data_config = {
|
|
53
|
+
masonry: false,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
if (this.theme.masonry) {
|
|
57
|
+
data_config.masonry = true;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return `<script id="hexo-configurations">
|
|
61
|
+
window.config = ${JSON.stringify(hexo_config)};
|
|
62
|
+
window.theme = ${JSON.stringify(theme_config)};
|
|
63
|
+
window.lang_ago = ${JSON.stringify(languageContent["ago"])};
|
|
64
|
+
window.data = ${JSON.stringify(data_config)};
|
|
65
|
+
</script>`;
|
|
66
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
hexo.on('generateBefore', function () {
|
|
2
|
+
|
|
3
|
+
if (hexo.locals.get) {
|
|
4
|
+
const data = hexo.locals.get('data');
|
|
5
|
+
|
|
6
|
+
if (data) {
|
|
7
|
+
// theme config file handle
|
|
8
|
+
if (data._config) {
|
|
9
|
+
hexo.theme.config = data._config;
|
|
10
|
+
|
|
11
|
+
} else if (data.redefine) {
|
|
12
|
+
hexo.theme.config = data.redefine;
|
|
13
|
+
|
|
14
|
+
} else if (data._redefine) {
|
|
15
|
+
hexo.theme.config = data._redefine;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// friends link file handle
|
|
19
|
+
if (data.links || data.link) {
|
|
20
|
+
hexo.theme.config.links = (data.links || data.link);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (data.essays || data.essay || data.shuoshuo) {
|
|
24
|
+
hexo.theme.config.essays = (data.essays || data.essay || data.shuoshuo);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (data.masonry || data.gallery || data.photos) {
|
|
28
|
+
hexo.theme.config.masonry = (data.masonry || data.gallery || data.photos);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (data.bookmarks || data.tools) {
|
|
32
|
+
hexo.theme.config.bookmarks = data.bookmarks || data.tools;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme Redefine
|
|
3
|
+
* 404 error page
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
hexo.extend.generator.register('404', function (locals) {
|
|
7
|
+
return {
|
|
8
|
+
path: '404.html',
|
|
9
|
+
layout: '404',
|
|
10
|
+
data: {
|
|
11
|
+
title: 'Page Not Found',
|
|
12
|
+
type: 'notfound',
|
|
13
|
+
page: locals.pages.findOne({ path: '404.html' })
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme Redefine
|
|
3
|
+
* welcome.js
|
|
4
|
+
*/
|
|
5
|
+
const { version } = require("../../package.json");
|
|
6
|
+
const https = require("https");
|
|
7
|
+
|
|
8
|
+
hexo.on("ready", async () => {
|
|
9
|
+
const timeout = 3000;
|
|
10
|
+
|
|
11
|
+
async function fetchRedefineInfo() {
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
https
|
|
14
|
+
.get(
|
|
15
|
+
`https://redefine-version.ohevan.com/api/v2/info`,
|
|
16
|
+
{ timeout: timeout },
|
|
17
|
+
(response) => {
|
|
18
|
+
if (response.statusCode < 200 || response.statusCode > 299) {
|
|
19
|
+
logFailedInfo();
|
|
20
|
+
return reject(
|
|
21
|
+
new Error(
|
|
22
|
+
`Failed to load page, status code: ${response.statusCode}`,
|
|
23
|
+
),
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
let data = "";
|
|
27
|
+
response.on("data", (chunk) => {
|
|
28
|
+
data += chunk;
|
|
29
|
+
});
|
|
30
|
+
response.on("end", () => {
|
|
31
|
+
try {
|
|
32
|
+
const jsonData = JSON.parse(data);
|
|
33
|
+
|
|
34
|
+
if (jsonData.status !== "success") {
|
|
35
|
+
logFailedInfo();
|
|
36
|
+
return reject(
|
|
37
|
+
new Error(`Failed to fetch data: ${jsonData.message}`),
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const redefineData = jsonData.data;
|
|
42
|
+
|
|
43
|
+
logInfo(redefineData);
|
|
44
|
+
checkVersionAndCDNAvailability(redefineData);
|
|
45
|
+
resolve();
|
|
46
|
+
} catch (error) {
|
|
47
|
+
logFailedInfo();
|
|
48
|
+
reject(new Error(`JSON parse failed: ${error.message}`));
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
)
|
|
53
|
+
.on("error", (error) => {
|
|
54
|
+
reject(error);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
try {
|
|
60
|
+
await fetchRedefineInfo();
|
|
61
|
+
} catch (error) {
|
|
62
|
+
hexo.log.warn(`Check latest version failed: ${error}`);
|
|
63
|
+
hexo.locals.set(`cdnTestStatus_cdnjs`, 404);
|
|
64
|
+
hexo.locals.set(`cdnTestStatus_zstatic`, 404);
|
|
65
|
+
hexo.locals.set(`cdnTestStatus_npmMirror`, 404);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
function logInfo(data) {
|
|
70
|
+
hexo.log.info(
|
|
71
|
+
`
|
|
72
|
+
+=====================================================================================+
|
|
73
|
+
| |
|
|
74
|
+
| ██████╗ ███████╗██████╗ ███████╗███████╗██╗███╗ ██╗███████╗ ██╗ ██╗ |
|
|
75
|
+
| ██╔══██╗██╔════╝██╔══██╗██╔════╝██╔════╝██║████╗ ██║██╔════╝ ╚██╗██╔╝ |
|
|
76
|
+
| ██████╔╝█████╗ ██║ ██║█████╗ █████╗ ██║██╔██╗ ██║█████╗█████╗╚███╔╝ |
|
|
77
|
+
| ██╔══██╗██╔══╝ ██║ ██║██╔══╝ ██╔══╝ ██║██║╚██╗██║██╔══╝╚════╝██╔██╗ |
|
|
78
|
+
| ██║ ██║███████╗██████╔╝███████╗██║ ██║██║ ╚████║███████╗ ██╔╝ ██╗ |
|
|
79
|
+
| ╚═╝ ╚═╝╚══════╝╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚═╝ |
|
|
80
|
+
| |
|
|
81
|
+
| current v${version} latest v${data.npmVersion} |
|
|
82
|
+
| https://github.com/Jason-JP-Yang/hexo-theme-Redefine-X |
|
|
83
|
+
+=====================================================================================+
|
|
84
|
+
`,
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function logFailedInfo() {
|
|
89
|
+
hexo.log.info(
|
|
90
|
+
`
|
|
91
|
+
+=====================================================================================+
|
|
92
|
+
| |
|
|
93
|
+
| ██████╗ ███████╗██████╗ ███████╗███████╗██╗███╗ ██╗███████╗ ██╗ ██╗ |
|
|
94
|
+
| ██╔══██╗██╔════╝██╔══██╗██╔════╝██╔════╝██║████╗ ██║██╔════╝ ╚██╗██╔╝ |
|
|
95
|
+
| ██████╔╝█████╗ ██║ ██║█████╗ █████╗ ██║██╔██╗ ██║█████╗█████╗╚███╔╝ |
|
|
96
|
+
| ██╔══██╗██╔══╝ ██║ ██║██╔══╝ ██╔══╝ ██║██║╚██╗██║██╔══╝╚════╝██╔██╗ |
|
|
97
|
+
| ██║ ██║███████╗██████╔╝███████╗██║ ██║██║ ╚████║███████╗ ██╔╝ ██╗ |
|
|
98
|
+
| ╚═╝ ╚═╝╚══════╝╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚═╝ |
|
|
99
|
+
| |
|
|
100
|
+
| current v${version} fetch latest failed |
|
|
101
|
+
| https://github.com/Jason-JP-Yang/hexo-theme-Redefine-X |
|
|
102
|
+
+=====================================================================================+
|
|
103
|
+
`,
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function checkVersionAndCDNAvailability(data) {
|
|
108
|
+
if (data.npmVersion > version) {
|
|
109
|
+
hexo.log.warn(
|
|
110
|
+
`\x1b[33m-X%s\x1b[0m`,
|
|
111
|
+
`Redefine v${version} is outdated, please update to v${data.npmVersion}!`,
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (data.npmMirrorCDN) {
|
|
116
|
+
hexo.log.info(
|
|
117
|
+
`\x1b[32m%s\x1b[0m`,
|
|
118
|
+
`CDN available: NPMMirror (Recommended)`,
|
|
119
|
+
);
|
|
120
|
+
hexo.locals.set(`cdnTestStatus_npmMirror`, 200);
|
|
121
|
+
} else {
|
|
122
|
+
hexo.log.warn(`\x1b[31m%s\x1b[0m`, `NPMMirror CDN is unavailable yet.`);
|
|
123
|
+
hexo.locals.set(`cdnTestStatus_npmMirror`, 404);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (data.zstaticCDN) {
|
|
127
|
+
hexo.log.info(`\x1b[32m%s\x1b[0m`, `CDN available: ZStatic`);
|
|
128
|
+
hexo.locals.set(`cdnTestStatus_zstatic`, 200);
|
|
129
|
+
} else {
|
|
130
|
+
hexo.log.warn(`\x1b[31m%s\x1b[0m`, `ZStatic CDN is unavailable yet.`);
|
|
131
|
+
hexo.locals.set(`cdnTestStatus_zstatic`, 404);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (data.cdnjsCDN) {
|
|
135
|
+
hexo.log.info(`\x1b[32m%s\x1b[0m`, `CDN available: CDNJS`);
|
|
136
|
+
hexo.locals.set(`cdnTestStatus_cdnjs`, 200);
|
|
137
|
+
} else {
|
|
138
|
+
hexo.log.warn(`\x1b[31m%s\x1b[0m`, `CDNJS CDN is unavailable yet.`);
|
|
139
|
+
hexo.locals.set(`cdnTestStatus_cdnjs`, 404);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* delete mask */
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
hexo.extend.filter.register(
|
|
6
|
+
"after_post_render",
|
|
7
|
+
function (data) {
|
|
8
|
+
const theme = this.theme;
|
|
9
|
+
|
|
10
|
+
// 处理del标签的代码
|
|
11
|
+
const regPureDelTag = /<del(?:\s+[^>]*)?>((?:(?!<\/?del[\s>])[^])*)<\/del>/g;
|
|
12
|
+
|
|
13
|
+
data.content = data.content.replace(
|
|
14
|
+
regPureDelTag,
|
|
15
|
+
function (match, html) {
|
|
16
|
+
// 只有在配置为true时才添加mask类
|
|
17
|
+
if (theme.config.articles.style.delete_mask === true) {
|
|
18
|
+
return `<del class="mask">${html}</del>`;
|
|
19
|
+
}
|
|
20
|
+
return match;
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
return data;
|
|
25
|
+
},
|
|
26
|
+
0
|
|
27
|
+
);
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/* main hexo, __dirname */
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const crypto = require("crypto");
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
const path = require("path");
|
|
8
|
+
const log = hexo.log;
|
|
9
|
+
const { hbeTheme } = require("./lib/hbe.default.js");
|
|
10
|
+
|
|
11
|
+
const defaultConfig = {
|
|
12
|
+
abstract:
|
|
13
|
+
"Here's something encrypted, password is required to continue reading.",
|
|
14
|
+
message: "Hey, password is required here.",
|
|
15
|
+
theme: "default",
|
|
16
|
+
wrong_pass_message:
|
|
17
|
+
"Oh, this is an invalid password. Check and try again, please.",
|
|
18
|
+
wrong_hash_message:
|
|
19
|
+
"OOPS, these decrypted content may changed, but you can still have a look.",
|
|
20
|
+
silent: false,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const keySalt = textToArray("too young too simple");
|
|
24
|
+
const ivSalt = textToArray("sometimes naive!");
|
|
25
|
+
|
|
26
|
+
// As we can't detect the wrong password with AES-CBC,
|
|
27
|
+
// so adding an empty tag and check it when decrption.
|
|
28
|
+
const knownPrefix = "<hbe-prefix></hbe-prefix>";
|
|
29
|
+
|
|
30
|
+
// disable log
|
|
31
|
+
var silent = false;
|
|
32
|
+
// use default theme
|
|
33
|
+
var theme = "default";
|
|
34
|
+
|
|
35
|
+
hexo.extend.filter.register(
|
|
36
|
+
"after_post_render",
|
|
37
|
+
(data) => {
|
|
38
|
+
const tagEncryptPairs = [];
|
|
39
|
+
|
|
40
|
+
let password = data.password;
|
|
41
|
+
let tagUsed = false;
|
|
42
|
+
|
|
43
|
+
// use a empty password to disable category encryption
|
|
44
|
+
if (password === "") {
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (hexo.config.encrypt === undefined) {
|
|
49
|
+
hexo.config.encrypt = [];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if ("encrypt" in hexo.config && "tags" in hexo.config.encrypt) {
|
|
53
|
+
hexo.config.encrypt.tags.forEach((tagObj) => {
|
|
54
|
+
tagEncryptPairs[tagObj.name] = tagObj.password;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (data.tags) {
|
|
59
|
+
data.tags.forEach((cTag) => {
|
|
60
|
+
if (tagEncryptPairs.hasOwnProperty(cTag.name)) {
|
|
61
|
+
tagUsed = password ? tagUsed : cTag.name;
|
|
62
|
+
password = password || tagEncryptPairs[cTag.name];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (password == undefined) {
|
|
68
|
+
return data;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
password = password.toString();
|
|
72
|
+
|
|
73
|
+
// make sure toc can work.
|
|
74
|
+
data.origin = data.content;
|
|
75
|
+
|
|
76
|
+
// Let's rock n roll
|
|
77
|
+
const config = Object.assign(defaultConfig, hexo.config.encrypt, data);
|
|
78
|
+
silent = config.silent;
|
|
79
|
+
theme = config.theme.trim().toLowerCase();
|
|
80
|
+
|
|
81
|
+
// deprecate the template keyword
|
|
82
|
+
if (config.template) {
|
|
83
|
+
dlog(
|
|
84
|
+
"warn",
|
|
85
|
+
'Looks like you use a deprecated property "template" to set up template, consider to use "theme"? See https://github.com/D0n9X1n/hexo-blog-encrypt#encrypt-theme',
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// read theme from file
|
|
90
|
+
let template = hbeTheme;
|
|
91
|
+
|
|
92
|
+
if (tagUsed === false) {
|
|
93
|
+
dlog(
|
|
94
|
+
"info",
|
|
95
|
+
`hexo-blog-encrypt: encrypting "${data.title.trim()}" based on the password configured in Front-matter with theme: ${theme}.`,
|
|
96
|
+
);
|
|
97
|
+
} else {
|
|
98
|
+
dlog(
|
|
99
|
+
"info",
|
|
100
|
+
`hexo-blog-encrypt: encrypting "${data.title.trim()}" based on Tag: "${tagUsed}" with theme ${theme}.`,
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
data.content = knownPrefix + data.content.trim();
|
|
105
|
+
data.encrypt = true;
|
|
106
|
+
|
|
107
|
+
const key = crypto.pbkdf2Sync(password, keySalt, 1024, 32, "sha256");
|
|
108
|
+
const iv = crypto.pbkdf2Sync(password, ivSalt, 512, 16, "sha256");
|
|
109
|
+
|
|
110
|
+
const cipher = crypto.createCipheriv("aes-256-cbc", key, iv);
|
|
111
|
+
const hmac = crypto.createHmac("sha256", key);
|
|
112
|
+
|
|
113
|
+
let encryptedData = cipher.update(data.content, "utf8", "hex");
|
|
114
|
+
hmac.update(data.content, "utf8");
|
|
115
|
+
encryptedData += cipher.final("hex");
|
|
116
|
+
const hmacDigest = hmac.digest("hex");
|
|
117
|
+
|
|
118
|
+
data.content = template
|
|
119
|
+
.replace(/{{hbeEncryptedData}}/g, encryptedData)
|
|
120
|
+
.replace(/{{hbeHmacDigest}}/g, hmacDigest)
|
|
121
|
+
.replace(/{{hbeWrongPassMessage}}/g, config.wrong_pass_message)
|
|
122
|
+
.replace(/{{hbeWrongHashMessage}}/g, config.wrong_hash_message)
|
|
123
|
+
.replace(/{{hbeMessage}}/g, config.message);
|
|
124
|
+
data.content += `<link href="${hexo.config.root}css/hbe.style.css" rel="stylesheet" type="text/css"><script data-swup-reload-script type="module" src="${hexo.config.root}js/plugins/hbe.js"></script>
|
|
125
|
+
<script data-swup-reload-script type="module">
|
|
126
|
+
import {initHBE} from "${hexo.config.root}js/plugins/hbe.js";
|
|
127
|
+
console.log("hexo-blog-encrypt: loaded.");
|
|
128
|
+
initHBE();
|
|
129
|
+
</script>
|
|
130
|
+
`;
|
|
131
|
+
data.excerpt = data.more = config.abstract;
|
|
132
|
+
|
|
133
|
+
return data;
|
|
134
|
+
},
|
|
135
|
+
1000,
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
hexo.extend.generator.register("hexo-blog-encrypt", () => [
|
|
139
|
+
{
|
|
140
|
+
data: () =>
|
|
141
|
+
fs.createReadStream(
|
|
142
|
+
path.resolve(__dirname, `../../source/assets/hbe.style.css`),
|
|
143
|
+
),
|
|
144
|
+
path: `css/hbe.style.css`,
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
data: () =>
|
|
148
|
+
fs.createReadStream(
|
|
149
|
+
path.resolve(__dirname, "../../source/js/plugins/hbe.js"),
|
|
150
|
+
),
|
|
151
|
+
path: "js/plugins/hbe.js",
|
|
152
|
+
},
|
|
153
|
+
]);
|
|
154
|
+
|
|
155
|
+
// log function
|
|
156
|
+
function dlog(level, x) {
|
|
157
|
+
switch (level) {
|
|
158
|
+
case "warn":
|
|
159
|
+
log.warn(x);
|
|
160
|
+
break;
|
|
161
|
+
|
|
162
|
+
case "info":
|
|
163
|
+
default:
|
|
164
|
+
if (silent) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
log.info(x);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Utils functions
|
|
173
|
+
function textToArray(s) {
|
|
174
|
+
var i = s.length;
|
|
175
|
+
var n = 0;
|
|
176
|
+
var ba = new Array();
|
|
177
|
+
|
|
178
|
+
for (var j = 0; j < i; ) {
|
|
179
|
+
var c = s.codePointAt(j);
|
|
180
|
+
if (c < 128) {
|
|
181
|
+
ba[n++] = c;
|
|
182
|
+
j++;
|
|
183
|
+
} else if (c > 127 && c < 2048) {
|
|
184
|
+
ba[n++] = (c >> 6) | 192;
|
|
185
|
+
ba[n++] = (c & 63) | 128;
|
|
186
|
+
j++;
|
|
187
|
+
} else if (c > 2047 && c < 65536) {
|
|
188
|
+
ba[n++] = (c >> 12) | 224;
|
|
189
|
+
ba[n++] = ((c >> 6) & 63) | 128;
|
|
190
|
+
ba[n++] = (c & 63) | 128;
|
|
191
|
+
j++;
|
|
192
|
+
} else {
|
|
193
|
+
ba[n++] = (c >> 18) | 240;
|
|
194
|
+
ba[n++] = ((c >> 12) & 63) | 128;
|
|
195
|
+
ba[n++] = ((c >> 6) & 63) | 128;
|
|
196
|
+
ba[n++] = (c & 63) | 128;
|
|
197
|
+
j += 2;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return new Uint8Array(ba);
|
|
202
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
hexo.extend.filter.register('after_post_render', function(data) {
|
|
2
|
+
if (this.theme.config.articles.style.image_caption !== false) {
|
|
3
|
+
const class_name='image-caption';
|
|
4
|
+
if (data.layout === 'post' || data.layout === 'page' || data.layout === 'about') {
|
|
5
|
+
data.content = data.content.replace(/(<img [^>]*alt="([^"]+)"[^>]*>)/g, `<figure class="${class_name}">$1<figcaption>$2</figcaption></figure>`);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return data;
|
|
9
|
+
});
|