hexo-theme-stellar 1.44.0 → 2.0.0-rc.2
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/CHANGELOG.md +63 -5
- package/CONTRIBUTING.md +29 -120
- package/README.md +66 -73
- package/README_EN.md +66 -73
- package/_config.yml +890 -743
- package/_data/icons.yml +43 -171
- package/_data/widgets.yml +1 -1
- package/assets/icon-v2-x512.webp +0 -0
- package/languages/en.yml +59 -2
- package/languages/zh-CN.yml +59 -2
- package/languages/zh-TW.yml +59 -2
- package/layout/404.ejs +7 -4
- package/layout/_partial/comments/artalk/layout.ejs +3 -2
- package/layout/_partial/comments/beaudar/layout.ejs +2 -2
- package/layout/_partial/comments/giscus/layout.ejs +2 -5
- package/layout/_partial/comments/layout.ejs +11 -40
- package/layout/_partial/comments/twikoo/layout.ejs +3 -2
- package/layout/_partial/comments/utterances/layout.ejs +2 -2
- package/layout/_partial/comments/waline/layout.ejs +3 -2
- package/layout/_partial/components/collection-item.ejs +30 -13
- package/layout/_partial/components/collection.ejs +2 -2
- package/layout/_partial/cover/index.ejs +5 -2
- package/layout/_partial/cover/wiki_cover.ejs +39 -28
- package/layout/_partial/dropdown.ejs +26 -14
- package/layout/_partial/head.ejs +96 -69
- package/layout/_partial/main/article/contributors.ejs +12 -9
- package/layout/_partial/main/article/post_footer.ejs +47 -0
- package/layout/_partial/main/article/post_read_next.ejs +22 -0
- package/layout/_partial/main/article/post_related.ejs +14 -0
- package/layout/_partial/main/article/post_tags.ejs +12 -0
- package/layout/_partial/main/article/share.ejs +55 -0
- package/layout/_partial/main/footer.ejs +11 -10
- package/layout/_partial/main/{navbar/nav_tabs_blog.ejs → listing_nav/blog.ejs} +21 -18
- package/layout/_partial/main/listing_nav/wiki.ejs +56 -0
- package/layout/_partial/main/navbar/article_banner.ejs +39 -35
- package/layout/_partial/main/navbar/breadcrumb/blog.ejs +15 -28
- package/layout/_partial/main/navbar/breadcrumb/note.ejs +12 -5
- package/layout/_partial/main/navbar/breadcrumb/wiki.ejs +15 -11
- package/layout/_partial/main/navbar/dateinfo.ejs +28 -12
- package/layout/_partial/main/navbar/ghinfo.ejs +5 -3
- package/layout/_partial/main/notebook/note_card.ejs +12 -17
- package/layout/_partial/main/notebook/note_tags.ejs +3 -4
- package/layout/_partial/main/notebook/notebook_card.ejs +11 -4
- package/layout/_partial/main/pin_slider.ejs +48 -43
- package/layout/_partial/main/post_list/archive_item.ejs +8 -4
- package/layout/_partial/main/post_list/latest_post_card.ejs +10 -4
- package/layout/_partial/main/post_list/post_card.ejs +39 -90
- package/layout/_partial/main/post_list/topic_card.ejs +7 -5
- package/layout/_partial/main/post_list/wiki_card.ejs +16 -13
- package/layout/_partial/menubtn.ejs +3 -3
- package/layout/_partial/primitives/item.ejs +8 -0
- package/layout/_partial/primitives/navigation.ejs +17 -0
- package/layout/_partial/primitives/region.ejs +16 -0
- package/layout/_partial/primitives/section.ejs +8 -0
- package/layout/_partial/primitives/shell.ejs +35 -0
- package/layout/_partial/regions/widgets.ejs +84 -0
- package/layout/_partial/scripts/defines.ejs +46 -76
- package/layout/_partial/scripts/runtime.ejs +55 -0
- package/layout/_partial/scripts.ejs +18 -42
- package/layout/_partial/search/dialog.ejs +33 -0
- package/layout/_partial/search/shortcut.ejs +1 -0
- package/layout/_partial/sidebar/brand.ejs +127 -0
- package/layout/_partial/sidebar/menu.ejs +59 -14
- package/layout/_partial/sidebar/search.ejs +58 -41
- package/layout/_partial/widgets/actions.ejs +25 -0
- package/layout/_partial/widgets/author.ejs +9 -5
- package/layout/_partial/widgets/components/linklist.ejs +1 -2
- package/layout/_partial/widgets/ghissues.ejs +7 -10
- package/layout/_partial/widgets/ghrepo.ejs +23 -16
- package/layout/_partial/widgets/ghuser.ejs +3 -3
- package/layout/_partial/widgets/recent.ejs +25 -21
- package/layout/_partial/widgets/related.ejs +25 -34
- package/layout/_partial/widgets/settings.ejs +17 -0
- package/layout/_partial/widgets/tagtree.ejs +18 -10
- package/layout/_partial/widgets/toc.ejs +17 -9
- package/layout/_partial/widgets/tree.ejs +12 -13
- package/layout/archive.ejs +20 -13
- package/layout/categories.ejs +4 -3
- package/layout/collection-preview.ejs +8 -9
- package/layout/index.ejs +32 -43
- package/layout/index_topic.ejs +6 -13
- package/layout/index_wiki.ejs +17 -34
- package/layout/layout.ejs +195 -65
- package/layout/notebooks.ejs +3 -3
- package/layout/notes.ejs +4 -4
- package/layout/page.ejs +95 -50
- package/layout/settings.ejs +109 -0
- package/layout/tags.ejs +4 -3
- package/{THIRD-PARTY-NOTICES.md → legal/THIRD-PARTY-NOTICES.md} +8 -4
- package/package.json +28 -6
- package/scripts/commands/stellar.js +55 -0
- package/scripts/events/index.js +15 -9
- package/scripts/events/lib/authors.js +9 -7
- package/scripts/events/lib/config-hot-reload.js +65 -0
- package/scripts/events/lib/config-schema.js +20 -0
- package/scripts/events/lib/config.js +22 -63
- package/scripts/events/lib/content-config.js +5 -0
- package/scripts/events/lib/doc_tree.js +99 -9
- package/scripts/events/lib/links.js +6 -3
- package/scripts/events/lib/notebooks.js +200 -8
- package/scripts/events/lib/utils.js +4 -4
- package/scripts/events/lib/version-check.js +57 -3
- package/scripts/filters/index.js +2 -27
- package/scripts/filters/lib/img_lazyload.js +4 -126
- package/scripts/filters/lib/img_onerror.js +14 -17
- package/scripts/filters/lib/page-view-model.js +152 -0
- package/scripts/generators/404.js +13 -8
- package/scripts/generators/author.js +16 -11
- package/scripts/generators/notebooks.js +68 -39
- package/scripts/generators/search.js +62 -67
- package/scripts/generators/settings.js +43 -0
- package/scripts/generators/stellar-icons.js +13 -5
- package/scripts/generators/topic.js +24 -13
- package/scripts/generators/wiki.js +49 -21
- package/scripts/helpers/ai_label.js +6 -12
- package/scripts/helpers/brand.js +17 -0
- package/scripts/helpers/browser_runtime_manifest.js +12 -0
- package/scripts/helpers/caption.js +8 -0
- package/scripts/helpers/category_color.js +13 -13
- package/scripts/helpers/collection.js +18 -0
- package/scripts/helpers/comments_model.js +14 -0
- package/scripts/helpers/extension_assets.js +8 -0
- package/scripts/helpers/json_ld.js +16 -7
- package/scripts/helpers/mdrender.js +3 -9
- package/scripts/helpers/menu.js +9 -0
- package/scripts/helpers/post_view_model.js +23 -0
- package/scripts/helpers/regions.js +37 -0
- package/scripts/helpers/scrollreveal.js +7 -7
- package/scripts/helpers/search_domain.js +34 -0
- package/scripts/helpers/service_provider.js +9 -0
- package/scripts/helpers/settings.js +16 -0
- package/scripts/helpers/share_action.js +8 -0
- package/scripts/helpers/stellar_config.js +12 -0
- package/scripts/helpers/stellar_data.js +8 -0
- package/scripts/helpers/stellar_info.js +21 -16
- package/scripts/helpers/stellar_inject.js +9 -0
- package/scripts/helpers/ui_classes.js +12 -0
- package/scripts/lib/ai_label.js +14 -11
- package/scripts/lib/brand.js +41 -0
- package/scripts/lib/browser-runtime.js +115 -0
- package/scripts/lib/caption.js +21 -0
- package/scripts/lib/collection-pipeline/adapters/notebook.js +62 -0
- package/scripts/lib/collection-pipeline/adapters/post.js +20 -0
- package/scripts/lib/collection-pipeline/adapters/topic.js +82 -0
- package/scripts/lib/collection-pipeline/adapters/wiki.js +20 -0
- package/scripts/lib/collection-pipeline/index.js +169 -0
- package/scripts/lib/collection-pipeline/registry.js +27 -0
- package/scripts/lib/collection-pipeline/shared.js +164 -0
- package/scripts/lib/comments.js +60 -0
- package/scripts/lib/config-inject.js +20 -0
- package/scripts/lib/config-schema.js +1095 -0
- package/scripts/lib/content-config.js +157 -0
- package/scripts/lib/content-defaults.js +56 -0
- package/scripts/lib/content-membership.js +233 -0
- package/scripts/lib/contribution-contract.js +165 -0
- package/scripts/lib/contribution-registry.js +429 -0
- package/scripts/lib/doc_tree.js +46 -44
- package/scripts/lib/doctor.js +296 -0
- package/scripts/lib/front-matter.js +29 -0
- package/scripts/lib/hero-effect-registry.js +262 -0
- package/scripts/lib/html-images.js +128 -0
- package/scripts/lib/internal-constants.js +152 -0
- package/scripts/lib/layout-config.js +62 -0
- package/scripts/lib/mdrender_html.js +36 -23
- package/scripts/lib/menu.js +36 -0
- package/scripts/lib/model-schema.js +90 -0
- package/scripts/lib/models/index.js +1542 -0
- package/scripts/lib/new-note.js +172 -0
- package/scripts/lib/page-view-model-registry.js +103 -0
- package/scripts/lib/regions.js +132 -0
- package/scripts/lib/runtime-data.js +23 -0
- package/scripts/lib/safe-path.js +44 -0
- package/scripts/lib/search-domain.js +59 -0
- package/scripts/lib/seo.js +10 -10
- package/scripts/lib/service-provider.js +12 -0
- package/scripts/lib/settings.js +16 -0
- package/scripts/lib/share-services.js +96 -0
- package/scripts/lib/source-config.js +27 -0
- package/scripts/lib/theme-metadata.js +22 -0
- package/scripts/lib/ui-capabilities.js +32 -0
- package/scripts/lib/widget-registry.js +150 -0
- package/scripts/lib/wiki_readme.js +15 -11
- package/scripts/schema/config-rules.js +290 -0
- package/scripts/schema/config-schema.js +163 -0
- package/scripts/schema/content-config-rules.js +264 -0
- package/scripts/schema/content-config-schema.js +321 -0
- package/scripts/schema/model-schema.js +971 -0
- package/scripts/schema/schema-utils.js +48 -0
- package/scripts/tags/index.js +2 -3
- package/scripts/tags/lib/albums.js +6 -6
- package/scripts/tags/lib/banner.js +10 -4
- package/scripts/tags/lib/box.js +1 -1
- package/scripts/tags/lib/button.js +1 -1
- package/scripts/tags/lib/chat.js +9 -31
- package/scripts/tags/lib/checkbox.js +6 -1
- package/scripts/tags/lib/copy.js +4 -1
- package/scripts/tags/lib/dropdown.js +6 -4
- package/scripts/tags/lib/emoji.js +5 -10
- package/scripts/tags/lib/friends.js +4 -4
- package/scripts/tags/lib/gallery.js +7 -7
- package/scripts/tags/lib/ghcard.js +5 -3
- package/scripts/tags/lib/gist.js +16 -0
- package/scripts/tags/lib/grid.js +4 -2
- package/scripts/tags/lib/hashtag.js +1 -1
- package/scripts/tags/lib/icon.js +1 -1
- package/scripts/tags/lib/image.js +1 -1
- package/scripts/tags/lib/link.js +6 -3
- package/scripts/tags/lib/mark.js +8 -3
- package/scripts/tags/lib/md.js +1 -1
- package/scripts/tags/lib/note.js +1 -1
- package/scripts/tags/lib/okr.js +18 -1
- package/scripts/tags/lib/posters.js +6 -6
- package/scripts/tags/lib/quot.js +15 -5
- package/scripts/tags/lib/rating.js +7 -4
- package/scripts/tags/lib/sites.js +8 -6
- package/scripts/tags/lib/tip.js +6 -6
- package/scripts/tags/lib/toc.js +2 -2
- package/scripts/tags/lib/vote.js +8 -5
- package/source/css/_appearances/_mixins.styl +258 -0
- package/source/css/_appearances/card.styl +30 -0
- package/source/css/_appearances/flat.styl +44 -0
- package/source/css/_appearances/glass.styl +138 -0
- package/source/css/_appearances/minimal.styl +325 -0
- package/source/css/_common/base.styl +5 -9
- package/source/css/_common/blockquote.styl +0 -1
- package/source/css/_common/button.styl +1 -1
- package/source/css/_common/device.styl +24 -42
- package/source/css/_common/dropdown.styl +20 -14
- package/source/css/_common/highlight.styl +5 -12
- package/source/css/_common/icon.styl +38 -0
- package/source/css/_common/input.styl +33 -0
- package/source/css/_common/loading.styl +2 -2
- package/source/css/_common/svg.styl +0 -8
- package/source/css/_components/collection.styl +21 -64
- package/source/css/_components/layout.styl +524 -84
- package/source/css/_components/list.styl +36 -22
- package/source/css/_components/main.styl +16 -19
- package/source/css/_components/md.styl +8 -13
- package/source/css/_components/pages/article-indent.styl +1 -1
- package/source/css/_components/pages/article-story.styl +7 -6
- package/source/css/_components/pages/article-tech.styl +5 -5
- package/source/css/_components/pages/collection-preview.styl +1 -5
- package/source/css/_components/pages/settings.styl +184 -0
- package/source/css/_components/partial/article-banner.styl +2 -2
- package/source/css/_components/partial/article-footer.styl +0 -32
- package/source/css/_components/partial/article-share.styl +48 -0
- package/source/css/_components/partial/article-tags.styl +1 -1
- package/source/css/_components/partial/cover.styl +13 -13
- package/source/css/_components/partial/listing-nav.styl +68 -0
- package/source/css/_components/partial/paginator.styl +1 -1
- package/source/css/_components/pin-slider.styl +3 -3
- package/source/css/_components/sidebar/brand.styl +135 -0
- package/source/css/_components/sidebar/footer.styl +14 -31
- package/source/css/_components/sidebar/nav-area.styl +4 -0
- package/source/css/_components/sidebar/search.styl +176 -26
- package/source/css/_components/sidebar/sidebar.styl +76 -110
- package/source/css/_components/tag-plugins/banner.styl +16 -28
- package/source/css/_components/tag-plugins/checkbox.styl +7 -22
- package/source/css/_components/tag-plugins/copy.styl +3 -5
- package/source/css/_components/tag-plugins/gallery.styl +2 -2
- package/source/css/_components/tag-plugins/grid.styl +3 -0
- package/source/css/_components/tag-plugins/image.styl +2 -1
- package/source/css/_components/tag-plugins/link.styl +0 -1
- package/source/css/_components/tag-plugins/mark.styl +19 -4
- package/source/css/_components/tag-plugins/mdrender.styl +2 -2
- package/source/css/_components/tag-plugins/navbar.styl +23 -17
- package/source/css/_components/tag-plugins/note.styl +2 -2
- package/source/css/_components/tag-plugins/okr.styl +1 -2
- package/source/css/_components/tag-plugins/quot.styl +5 -0
- package/source/css/_components/tag-plugins/rating.styl +3 -2
- package/source/css/_components/tag-plugins/timeline.styl +1 -1
- package/source/css/_components/tag-plugins/tip.styl +1 -1
- package/source/css/_components/tag-plugins/vote.styl +3 -2
- package/source/css/_components/widgets/ghrepo.styl +2 -1
- package/source/css/_components/widgets/ghuser.styl +4 -6
- package/source/css/_components/widgets/settings.styl +49 -0
- package/source/css/_components/widgets/timeline.styl +2 -2
- package/source/css/_components/widgets/toc.styl +12 -33
- package/source/css/_components/widgets/widgets.styl +14 -19
- package/source/css/_components/wiki-card.styl +2 -2
- package/source/css/_custom.styl +26 -32
- package/source/css/_defines/func.styl +47 -37
- package/source/css/_defines/theme_base.styl +8 -10
- package/source/css/_plugins/card-hover.styl +1 -1
- package/source/css/_plugins/copycode.styl +16 -19
- package/source/css/_plugins/index.styl +3 -8
- package/source/css/_plugins/lazyload.styl +1 -1
- package/source/css/main.styl +12 -0
- package/source/js/main.js +302 -59
- package/source/js/plugins/adaptive-text.js +33 -16
- package/source/js/plugins/card-hover.js +2 -24
- package/source/js/plugins/copycode.js +10 -16
- package/source/js/plugins/voice.js +51 -48
- package/source/js/profile.js +316 -0
- package/source/js/runtime/asset-loader.js +61 -0
- package/source/js/runtime/extension-registry.js +149 -0
- package/source/js/runtime/extensions/card-hover.js +5 -0
- package/source/js/runtime/extensions/color-scheme-switch.js +101 -0
- package/source/js/runtime/extensions/comments.js +200 -0
- package/source/js/runtime/extensions/deferred-icons.js +53 -0
- package/source/js/{plugins → runtime/extensions}/dropdown.js +69 -30
- package/source/js/runtime/extensions/feature.js +200 -0
- package/source/js/runtime/extensions/hero-effect.js +179 -0
- package/source/js/runtime/extensions/reveal.js +80 -0
- package/source/js/runtime/extensions/search.js +23 -0
- package/source/js/{services.js → runtime/extensions/services.js} +67 -54
- package/source/js/runtime/extensions/settings.js +235 -0
- package/source/js/runtime/hero-effects/ferrofluid.js +385 -0
- package/source/js/{plugins → runtime/hero-effects}/galaxy.js +53 -177
- package/source/js/runtime/hero-effects/light-rays.js +293 -0
- package/source/js/runtime/index.js +75 -0
- package/source/js/runtime/legacy-request-adapter.js +47 -0
- package/source/js/runtime/request-cache.js +219 -0
- package/source/js/search/algolia-search.js +76 -51
- package/source/js/search/highlight.js +1 -1
- package/source/js/search/local-search.js +96 -57
- package/source/js/search/shortcut.js +31 -20
- package/source/js/services/friends_and_posts.js +6 -1
- package/source/js/services/rating.js +14 -6
- package/source/js/services/siteinfo.js +3 -7
- package/source/js/services/timeline.js +1 -1
- package/source/js/services/vote.js +7 -5
- package/source/js/services/weibo.js +1 -1
- package/source/js/utils.js +19 -444
- package/.claude/skills/stellar-theme-dev/SKILL.md +0 -51
- package/_data/chat_users.yml +0 -0
- package/layout/_partial/comments/artalk/script.ejs +0 -76
- package/layout/_partial/comments/beaudar/script.ejs +0 -33
- package/layout/_partial/comments/giscus/script.ejs +0 -31
- package/layout/_partial/comments/script.ejs +0 -3
- package/layout/_partial/comments/twikoo/script.ejs +0 -25
- package/layout/_partial/comments/utterances/script.ejs +0 -33
- package/layout/_partial/comments/waline/script.ejs +0 -43
- package/layout/_partial/main/article/article_footer.ejs +0 -164
- package/layout/_partial/main/article/article_tags.ejs +0 -16
- package/layout/_partial/main/article/read_next.ejs +0 -63
- package/layout/_partial/main/article/related_posts.ejs +0 -16
- package/layout/_partial/main/navbar/nav_tabs_wiki.ejs +0 -52
- package/layout/_partial/scripts/bootstrap.ejs +0 -37
- package/layout/_partial/scripts/lazyload.ejs +0 -89
- package/layout/_partial/sidebar/grad-def.ejs +0 -26
- package/layout/_partial/sidebar/index_leftbar.ejs +0 -191
- package/layout/_partial/sidebar/index_rightbar.ejs +0 -94
- package/layout/_partial/sidebar/logo.ejs +0 -99
- package/layout/_plugins/adaptive_text.ejs +0 -11
- package/layout/_plugins/card_hover.ejs +0 -32
- package/layout/_plugins/copycode.ejs +0 -17
- package/layout/_plugins/fancybox.ejs +0 -53
- package/layout/_plugins/heti.ejs +0 -21
- package/layout/_plugins/index.ejs +0 -50
- package/layout/_plugins/mathjax.ejs +0 -49
- package/layout/_plugins/mermaid.ejs +0 -33
- package/layout/_plugins/preload.ejs +0 -9
- package/layout/_plugins/scrollreveal.ejs +0 -102
- package/layout/_plugins/search/algolia_search.ejs +0 -12
- package/layout/_plugins/search/local_search.ejs +0 -9
- package/layout/_plugins/swiper.ejs +0 -27
- package/layout/_plugins/tianli_gpt.ejs +0 -14
- package/scripts/commands/new-note.js +0 -49
- package/scripts/events/lib/merge_posts.js +0 -48
- package/scripts/events/lib/topic_tree.js +0 -48
- package/scripts/helpers/related_posts.js +0 -51
- package/scripts/helpers/subtitle.js +0 -8
- package/scripts/lib/notebooks.js +0 -181
- package/scripts/lib/subtitle.js +0 -28
- package/scripts/tags/lib/about.js +0 -48
- package/source/css/_components/page-transition.styl +0 -22
- package/source/css/_components/partial/navbar.styl +0 -51
- package/source/css/_components/sidebar/logo.styl +0 -111
- package/source/css/_components/tag-plugins/about.styl +0 -56
- package/source/css/_components/widgets/tree.styl +0 -0
- package/source/css/_plugins/scrollreveal.styl +0 -6
- package/source/css/_plugins/tianli_gpt.styl +0 -213
- package/source/css/plugins/mermaid.styl +0 -137
- package/source/js/icons.js +0 -60
- package/source/js/services/fcircle.js +0 -35
- package/source/js/theme.js +0 -61
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
|
|
3
|
-
const wiki = theme.wiki.tree[page.wiki]
|
|
4
|
-
const topic = theme.topic.tree[page.topic]
|
|
5
|
-
const notebook = theme.notebooks.tree[page.notebook]
|
|
6
|
-
|
|
7
|
-
if (page.leftbar == null) {
|
|
8
|
-
const { site_tree } = theme
|
|
9
|
-
var sidebar
|
|
10
|
-
if (is_home()) {
|
|
11
|
-
sidebar = site_tree.home.leftbar
|
|
12
|
-
} else if (page.layout === 'notebooks') {
|
|
13
|
-
// 笔记本列表页
|
|
14
|
-
sidebar = site_tree.notebooks.leftbar
|
|
15
|
-
} else if (page.layout === 'notes') {
|
|
16
|
-
// 笔记列表页
|
|
17
|
-
sidebar = notebook ? notebook.leftbar : site_tree.notes.leftbar
|
|
18
|
-
} else if (notebook) {
|
|
19
|
-
// 笔记本文章内页
|
|
20
|
-
sidebar = page.leftbar ?? notebook.note_leftbar
|
|
21
|
-
} else if (is_category() || is_tag() || is_archive() || ['categories', 'tags', 'archives'].includes(page.layout)) {
|
|
22
|
-
sidebar = site_tree.index_blog.leftbar
|
|
23
|
-
} else if (page.layout === 'index_topic') {
|
|
24
|
-
// 专栏列表页等同于博客列表页
|
|
25
|
-
sidebar = site_tree.index_blog.leftbar
|
|
26
|
-
} else if (page.topic?.length > 0) {
|
|
27
|
-
// 专栏文章内页等同于普通文章内页
|
|
28
|
-
sidebar = site_tree.post.leftbar
|
|
29
|
-
} else if (page.layout === 'index_wiki') {
|
|
30
|
-
sidebar = site_tree.index_wiki.leftbar
|
|
31
|
-
} else if (page.wiki?.length > 0) {
|
|
32
|
-
sidebar = site_tree.wiki.leftbar
|
|
33
|
-
} else if (page.layout === '404') {
|
|
34
|
-
sidebar = site_tree.error_page.leftbar
|
|
35
|
-
} else if (page.layout === 'page') {
|
|
36
|
-
sidebar = site_tree.page.leftbar
|
|
37
|
-
} else if (page.layout === 'post') {
|
|
38
|
-
sidebar = site_tree.post.leftbar
|
|
39
|
-
} else if (page.layout == null) {
|
|
40
|
-
sidebar = site_tree.page.leftbar
|
|
41
|
-
} else {
|
|
42
|
-
sidebar = []
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (topic?.leftbar) {
|
|
46
|
-
sidebar = topic.leftbar
|
|
47
|
-
}
|
|
48
|
-
if (wiki?.leftbar) {
|
|
49
|
-
sidebar = wiki.leftbar
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
page.leftbar = sidebar
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
// parse array string
|
|
57
|
-
if (typeof page.leftbar == 'string') {
|
|
58
|
-
page.leftbar = page.leftbar.replace(/ /g, '').split(',');
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
function layoutTitle(main, url, sub) {
|
|
63
|
-
var el = '';
|
|
64
|
-
el += '<a class="title" href="' + pretty_url(url || "/") + '">';
|
|
65
|
-
el += '<div class="main">' + main + '</div>';
|
|
66
|
-
if (sub) {
|
|
67
|
-
let arr = sub.split('|');
|
|
68
|
-
if (arr.length > 1) {
|
|
69
|
-
el += '<div class="sub normal cap">' + arr.shift().trim() + '</div>';
|
|
70
|
-
el += '<div class="sub hover cap" style="opacity:0">' + arr.join('|') + '</div>';
|
|
71
|
-
} else {
|
|
72
|
-
el += '<div class="sub cap">' + sub + '</div>';
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
el += '</a>';
|
|
76
|
-
return el;
|
|
77
|
-
}
|
|
78
|
-
function layoutWidgets() {
|
|
79
|
-
var el = '';
|
|
80
|
-
el += '<div class="widgets">';
|
|
81
|
-
// 左栏共用的 SVG 渐变定义(供激活书签等彩色图标使用,见 grad-def.ejs)
|
|
82
|
-
el += partial('grad-def', {id: 'leftbar-active-icon-grad'})
|
|
83
|
-
// 导航区放进组件滚动区,一起滚动
|
|
84
|
-
el += layoutNavArea()
|
|
85
|
-
if (page.leftbar) {
|
|
86
|
-
page.leftbar.forEach((w, i) => {
|
|
87
|
-
let name = ''
|
|
88
|
-
let widget = {}
|
|
89
|
-
if (typeof w == 'string') {
|
|
90
|
-
name = w
|
|
91
|
-
} else if (typeof w == 'object' && w.override) {
|
|
92
|
-
name = w.override
|
|
93
|
-
}
|
|
94
|
-
if (name in theme.widgets) {
|
|
95
|
-
Object.assign(widget, theme.widgets[name])
|
|
96
|
-
}
|
|
97
|
-
if (typeof w == 'object' && (w.override || w.layout)) {
|
|
98
|
-
Object.assign(widget, w)
|
|
99
|
-
}
|
|
100
|
-
if (widget && widget.layout) {
|
|
101
|
-
el += partial('../widgets/' + widget.layout, {item: widget})
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
el += '</div>';
|
|
106
|
-
return el;
|
|
107
|
-
}
|
|
108
|
-
function layoutSearch() {
|
|
109
|
-
if (!page.leftbar) {
|
|
110
|
-
return ''
|
|
111
|
-
}
|
|
112
|
-
var search = {}
|
|
113
|
-
if (page.search) {
|
|
114
|
-
search = page.search
|
|
115
|
-
} else if (wiki?.search) {
|
|
116
|
-
search = wiki.search
|
|
117
|
-
} else if (topic?.search) {
|
|
118
|
-
search = topic.search
|
|
119
|
-
}
|
|
120
|
-
return partial('search', {item: search})
|
|
121
|
-
}
|
|
122
|
-
function layoutFooterDiv() {
|
|
123
|
-
const { social } = theme.footer
|
|
124
|
-
if (social == null) {
|
|
125
|
-
return ''
|
|
126
|
-
}
|
|
127
|
-
var el = '<footer class="footer dis-select">';
|
|
128
|
-
el += '<div class="social-wrap" style="--item-grad:url(#footer-social-icon-grad)">';
|
|
129
|
-
el += partial('grad-def', {id: 'footer-social-icon-grad'})
|
|
130
|
-
for (let id of Object.keys(social)) {
|
|
131
|
-
let item = social[id];
|
|
132
|
-
if (id === 'spacer') {
|
|
133
|
-
el += '<span class="social-spacer" aria-hidden="true"></span>';
|
|
134
|
-
} else if (item?.type === 'dropdown') {
|
|
135
|
-
el += partial('../dropdown', {
|
|
136
|
-
item: item,
|
|
137
|
-
rootClass: 'social-dropdown',
|
|
138
|
-
triggerClass: 'social',
|
|
139
|
-
showTitle: false
|
|
140
|
-
})
|
|
141
|
-
} else if (item?.icon && (item.url || item.onclick)) {
|
|
142
|
-
el += '<a class="social"';
|
|
143
|
-
if (item.title) {
|
|
144
|
-
el += ' title="' + escape_html(item.title) + '"';
|
|
145
|
-
}
|
|
146
|
-
if (item.url) {
|
|
147
|
-
el += ' href="' + escape_html(url_for(item.url)) + '"';
|
|
148
|
-
if (item.url.includes('://')) {
|
|
149
|
-
el += ' target="_blank" rel="external nofollow noopener noreferrer"';
|
|
150
|
-
} else {
|
|
151
|
-
el += ' rel="noopener noreferrer"';
|
|
152
|
-
}
|
|
153
|
-
} else if (item.onclick) {
|
|
154
|
-
item.onclick = item.onclick.replace(/"|\'/g, '"');
|
|
155
|
-
el += ' onclick="' + item.onclick + '"';
|
|
156
|
-
}
|
|
157
|
-
el += '>';
|
|
158
|
-
el += icon(item.icon, 'no-lazy')
|
|
159
|
-
el += '</a>';
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
el += '</div>';
|
|
163
|
-
el += '</footer>';
|
|
164
|
-
return el;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function layoutLogo() {
|
|
168
|
-
return partial('logo', {where: 'sidebar'})
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function layoutNavArea() {
|
|
172
|
-
var el = ''
|
|
173
|
-
if (page.menu == false) {
|
|
174
|
-
return el
|
|
175
|
-
}
|
|
176
|
-
// wiki 内容页默认隐藏导航区,page.menu 或 wiki.menu 为 true 时显示
|
|
177
|
-
if (page.wiki?.length > 0) {
|
|
178
|
-
if (page.menu !== true && wiki?.menu !== true) {
|
|
179
|
-
return el
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
el += `<div class="nav-area">`
|
|
183
|
-
el += partial('menu', {where: 'sidebar'})
|
|
184
|
-
el += `</div>`
|
|
185
|
-
return el
|
|
186
|
-
}
|
|
187
|
-
%>
|
|
188
|
-
<%- layoutLogo() %>
|
|
189
|
-
<%- layoutSearch() %>
|
|
190
|
-
<%- layoutWidgets() %>
|
|
191
|
-
<%- layoutFooterDiv() %>
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
|
|
3
|
-
const wiki = theme.wiki.tree[page.wiki]
|
|
4
|
-
const topic = theme.topic.tree[page.topic]
|
|
5
|
-
const notebook = theme.notebooks.tree[page.notebook]
|
|
6
|
-
|
|
7
|
-
if (page.rightbar == null) {
|
|
8
|
-
const { site_tree } = theme
|
|
9
|
-
var sidebar
|
|
10
|
-
if (is_home()) {
|
|
11
|
-
sidebar = site_tree.home.rightbar
|
|
12
|
-
} else if (page.layout === 'notebooks') {
|
|
13
|
-
// 笔记本列表页
|
|
14
|
-
sidebar = site_tree.notebooks.rightbar
|
|
15
|
-
} else if (page.layout === 'notes') {
|
|
16
|
-
// 笔记列表页
|
|
17
|
-
sidebar = notebook ? notebook.rightbar : site_tree.notes.rightbar
|
|
18
|
-
} else if (notebook) {
|
|
19
|
-
// 笔记本文章内页
|
|
20
|
-
sidebar = page.rightbar ?? notebook.note_rightbar
|
|
21
|
-
} else if (is_category() || is_tag() || is_archive() || ['categories', 'tags', 'archives'].includes(page.layout)) {
|
|
22
|
-
sidebar = site_tree.index_blog.rightbar
|
|
23
|
-
} else if (page.layout === 'index_topic') {
|
|
24
|
-
// 专栏列表页等同于博客列表页
|
|
25
|
-
sidebar = site_tree.index_blog.rightbar
|
|
26
|
-
} else if (page.topic?.length > 0) {
|
|
27
|
-
// 专栏文章内页等同于普通文章内页
|
|
28
|
-
sidebar = site_tree.post.rightbar
|
|
29
|
-
} else if (page.layout === 'index_wiki') {
|
|
30
|
-
sidebar = site_tree.index_wiki.rightbar
|
|
31
|
-
} else if (page.wiki?.length > 0) {
|
|
32
|
-
sidebar = site_tree.wiki.rightbar
|
|
33
|
-
} else if (page.layout === '404') {
|
|
34
|
-
sidebar = site_tree.error_page.rightbar
|
|
35
|
-
} else if (page.layout === 'page') {
|
|
36
|
-
sidebar = site_tree.page.rightbar
|
|
37
|
-
} else if (page.layout === 'post') {
|
|
38
|
-
sidebar = site_tree.post.rightbar
|
|
39
|
-
} else if (page.layout == null) {
|
|
40
|
-
sidebar = site_tree.page.rightbar
|
|
41
|
-
} else {
|
|
42
|
-
sidebar = []
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (topic?.rightbar) {
|
|
46
|
-
sidebar = topic.rightbar
|
|
47
|
-
}
|
|
48
|
-
if (wiki?.rightbar) {
|
|
49
|
-
sidebar = wiki.rightbar
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
page.rightbar = sidebar
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
// parse array string
|
|
57
|
-
if (typeof page.rightbar == 'string') {
|
|
58
|
-
page.rightbar = page.rightbar.replace(/ /g, '').split(',');
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function layoutWidgets() {
|
|
62
|
-
if (page.rightbar == null || page.rightbar.length == 0) {
|
|
63
|
-
return ''
|
|
64
|
-
}
|
|
65
|
-
var el = ''
|
|
66
|
-
if (page.rightbar) {
|
|
67
|
-
page.rightbar.forEach((w, i) => {
|
|
68
|
-
let name = ''
|
|
69
|
-
let widget = {}
|
|
70
|
-
if (typeof w == 'string') {
|
|
71
|
-
name = w
|
|
72
|
-
} else if (typeof w == 'object' && w.override) {
|
|
73
|
-
name = w.override
|
|
74
|
-
}
|
|
75
|
-
if (name in theme.widgets) {
|
|
76
|
-
Object.assign(widget, theme.widgets[name])
|
|
77
|
-
}
|
|
78
|
-
if (typeof w == 'object' && (w.override || w.layout)) {
|
|
79
|
-
Object.assign(widget, w)
|
|
80
|
-
}
|
|
81
|
-
if (widget && widget.layout) {
|
|
82
|
-
el += partial('../widgets/' + widget.layout, {item: widget})
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
if (el.trim().length > 0) {
|
|
87
|
-
return `<div class="widgets">${el}</div>`
|
|
88
|
-
} else {
|
|
89
|
-
return ''
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
%>
|
|
94
|
-
<%- layoutWidgets() %>
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
var logo = theme.logo
|
|
3
|
-
if (page.logo) {
|
|
4
|
-
logo = Object.assign({}, logo, page.logo)
|
|
5
|
-
} else if (theme.wiki.tree[page.wiki]) {
|
|
6
|
-
const proj = theme.wiki.tree[page.wiki]
|
|
7
|
-
var l = proj.logo
|
|
8
|
-
if (l) {
|
|
9
|
-
if (l.title.includes('](') == false) {
|
|
10
|
-
l.title = `[${l.title}](${url_for(proj.homepage?.path || '')})`
|
|
11
|
-
}
|
|
12
|
-
logo = l
|
|
13
|
-
} else if (proj.name || proj.icon) {
|
|
14
|
-
logo = {
|
|
15
|
-
icon: proj.icon || theme.default.project,
|
|
16
|
-
title: `[${proj.name || proj.title}](${url_for(proj.homepage?.path || '')})`,
|
|
17
|
-
subtitle: proj.subtitle
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// logo.icon, logo.title, logo.subtitle, logo.url
|
|
23
|
-
function layoutTitle(main, url, sub) {
|
|
24
|
-
var el = ''
|
|
25
|
-
el += `<a class="title" href="${url || "/"}">`
|
|
26
|
-
el += `<div class="main">${main}</div>`
|
|
27
|
-
if (sub) {
|
|
28
|
-
const arr = sub.split('|')
|
|
29
|
-
if (arr.length > 1) {
|
|
30
|
-
el += `<div class="sub normal cap">${arr.shift().trim()}</div>`
|
|
31
|
-
el += `<div class="sub hover cap" style="opacity:0">${arr.join('|')}</div>`
|
|
32
|
-
} else {
|
|
33
|
-
el += `<div class="sub cap">${sub}</div>`
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
el += `</a>`
|
|
37
|
-
return el
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function layoutBack() {
|
|
41
|
-
if (where != 'sidebar' || !page.wiki) {
|
|
42
|
-
return ''
|
|
43
|
-
}
|
|
44
|
-
// 开关:page 的 wiki_home 优先,其次 wiki 定义的 wiki_home,默认显示
|
|
45
|
-
const wiki = theme.wiki.tree[page.wiki]
|
|
46
|
-
const enabled = page.wiki_home ?? wiki?.wiki_home ?? true
|
|
47
|
-
if (enabled === false) {
|
|
48
|
-
return ''
|
|
49
|
-
}
|
|
50
|
-
var el = ''
|
|
51
|
-
el += `<div class="wiki-home-wrap">`
|
|
52
|
-
el += `<a class="wiki-home cap" href="${pretty_url(theme.site_tree.index_wiki.base_dir)}">`
|
|
53
|
-
el += icon('default:arrow-left', '', true)
|
|
54
|
-
el += `<span>${__('btn.all_wiki')}</span>`
|
|
55
|
-
el += `</a>`
|
|
56
|
-
el += `</div>`
|
|
57
|
-
return el
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function layoutDiv() {
|
|
61
|
-
if (where == 'main') {
|
|
62
|
-
if (page.header == false) {
|
|
63
|
-
return ''
|
|
64
|
-
}
|
|
65
|
-
// 内容页如果未设置 header 则不显示
|
|
66
|
-
if (page.header == null) {
|
|
67
|
-
if (!page.nav_tabs) { // 如果有 nav_tabs 就代表是列表页
|
|
68
|
-
if (page.layout === 'post' || page.layout === 'page' || page.wiki) {
|
|
69
|
-
return ''
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
var el = ''
|
|
75
|
-
el += `<header class="header${where == 'main' ? ' mobile-only' : ''}">`
|
|
76
|
-
el += `<div class="logo-wrap">`
|
|
77
|
-
if (logo.icon) {
|
|
78
|
-
el += `<div class="icon"><img no-lazy class="icon" src="${md_text(logo.icon)}"></div>`
|
|
79
|
-
} else if (md_text(logo.avatar)) {
|
|
80
|
-
el += `<a class="avatar" href="${url_for(md_link(logo.avatar) || '/')}">`
|
|
81
|
-
if (theme.style.animated_avatar.animate) {
|
|
82
|
-
el += `<div class="bg"></div>`
|
|
83
|
-
}
|
|
84
|
-
el += `<img no-lazy class="avatar" src="${md_text(logo.avatar)}">`
|
|
85
|
-
el += `</a>`
|
|
86
|
-
}
|
|
87
|
-
const main = md_text(logo.title)
|
|
88
|
-
if (main) {
|
|
89
|
-
let url = md_link(logo.title)
|
|
90
|
-
el += layoutTitle(main, url, md_text(logo.subtitle))
|
|
91
|
-
}
|
|
92
|
-
el += `</div>`
|
|
93
|
-
el += '</header>'
|
|
94
|
-
return el
|
|
95
|
-
}
|
|
96
|
-
%>
|
|
97
|
-
|
|
98
|
-
<%- layoutBack() %>
|
|
99
|
-
<%- layoutDiv() %>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
stellar.initPlugin(() => {
|
|
3
|
-
const els = Array.prototype.slice.call(document.querySelectorAll('[data-text-adaptive]'));
|
|
4
|
-
if (els.length === 0) return;
|
|
5
|
-
utils.js('/js/color.js').then(() => utils.js('/js/plugins/adaptive-text.js')).then(() => {
|
|
6
|
-
if (typeof applyAdaptiveText === 'function') {
|
|
7
|
-
applyAdaptiveText(els);
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
}, 'adaptive-text');
|
|
11
|
-
</script>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
var spotlightColor = typeof conf.spotlight_color === 'string' && conf.spotlight_color.trim().length > 0
|
|
3
|
-
? conf.spotlight_color.trim()
|
|
4
|
-
: 'rgba(255, 255, 255, 0.25)';
|
|
5
|
-
var maxTilt = Number(conf.max_tilt);
|
|
6
|
-
if (conf.max_tilt == null || conf.max_tilt === '' || !Number.isFinite(maxTilt)) {
|
|
7
|
-
maxTilt = 3;
|
|
8
|
-
}
|
|
9
|
-
maxTilt = Math.max(0, Math.min(8, maxTilt));
|
|
10
|
-
var cardHoverConfig = {
|
|
11
|
-
spotlightColor: spotlightColor,
|
|
12
|
-
maxTilt: maxTilt
|
|
13
|
-
};
|
|
14
|
-
var cardHoverConfigJson = JSON.stringify(cardHoverConfig).replace(/</g, '\\u003c');
|
|
15
|
-
%>
|
|
16
|
-
<script>
|
|
17
|
-
stellar.initPlugin(() => {
|
|
18
|
-
let disposed = false;
|
|
19
|
-
ctx.card_hover = <%- cardHoverConfigJson %>;
|
|
20
|
-
utils.js('/js/plugins/card-hover.js', { defer: true }).then(() => {
|
|
21
|
-
if (!disposed && stellar.cardHover && typeof stellar.cardHover.mountAll === 'function') {
|
|
22
|
-
stellar.cardHover.mountAll(document);
|
|
23
|
-
}
|
|
24
|
-
}).catch(() => {});
|
|
25
|
-
return () => {
|
|
26
|
-
disposed = true;
|
|
27
|
-
if (stellar.cardHover && typeof stellar.cardHover.destroy === 'function') {
|
|
28
|
-
stellar.cardHover.destroy();
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
}, 'card-hover');
|
|
32
|
-
</script>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
stellar.initPlugin(() => {
|
|
3
|
-
const codeElements = document.querySelectorAll('.code');
|
|
4
|
-
if (codeElements.length > 0) {
|
|
5
|
-
ctx.copycode = {
|
|
6
|
-
default_text: `<%- conf.default_text %>`,
|
|
7
|
-
success_text: `<%- conf.success_text %>`,
|
|
8
|
-
toast: `<%- conf.toast %>`,
|
|
9
|
-
};
|
|
10
|
-
utils.js('/js/plugins/copycode.js', { defer: true }).then(() => {
|
|
11
|
-
if (typeof createCopyButtons === 'function') {
|
|
12
|
-
createCopyButtons(codeElements);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}, 'copycode');
|
|
17
|
-
</script>
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
ctx.fancybox = {
|
|
3
|
-
mode: `<%- conf.mode || 'auto' %>`,
|
|
4
|
-
selector: `<%- conf.selector %>`,
|
|
5
|
-
css: `<%- conf.css %>`,
|
|
6
|
-
js: `<%- conf.js %>`
|
|
7
|
-
};
|
|
8
|
-
// auto=按需:页面存在可弹窗图片才加载;global=全局:所有页面加载
|
|
9
|
-
const isGlobal = ctx.fancybox.mode === 'global';
|
|
10
|
-
// 评论区图片(artalk/twikoo/waline)显示较小,自动支持放大;
|
|
11
|
-
// 仅绑定各评论服务的评论内容区,编辑器、表情面板等非内容区图片不弹窗
|
|
12
|
-
var selector = '[data-fancybox]:not(.error), .with-fancybox .atk-content img:not([atk-emoticon]):not([class*="emo"]), .with-fancybox .tk-content img:not([atk-emoticon]):not([class*="emo"]), .with-fancybox .wl-content img:not([atk-emoticon]):not([class*="emo"])';
|
|
13
|
-
if (ctx.fancybox.selector) {
|
|
14
|
-
selector += `, ${ctx.fancybox.selector}`
|
|
15
|
-
}
|
|
16
|
-
var needFancybox = isGlobal;
|
|
17
|
-
if (!needFancybox) {
|
|
18
|
-
needFancybox = document.querySelectorAll(selector).length !== 0;
|
|
19
|
-
if (!needFancybox) {
|
|
20
|
-
// 图片型评论系统容器:评论区图片小图需要 fancybox
|
|
21
|
-
const withFancybox = document.getElementsByClassName('with-fancybox');
|
|
22
|
-
if (withFancybox != undefined && withFancybox.length > 0) {
|
|
23
|
-
needFancybox = true;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (!needFancybox) {
|
|
27
|
-
// 动态数据服务:memos 渲染的图片需要 fancybox
|
|
28
|
-
const memos = document.getElementsByClassName('ds-memos');
|
|
29
|
-
if (memos != undefined && memos.length > 0) {
|
|
30
|
-
needFancybox = true;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
if (needFancybox) {
|
|
35
|
-
utils.css(`<%- url_for('/css/plugins/fancybox.css') %>?v=<%- stellar_info('version') %>`);
|
|
36
|
-
utils.css(ctx.fancybox.css);
|
|
37
|
-
utils.js(ctx.fancybox.js, { defer: true }).then(function () {
|
|
38
|
-
if (isGlobal) {
|
|
39
|
-
// 全局模式:正文所有非内联图片均可弹窗
|
|
40
|
-
selector += ', .md-text img:not(.inline):not([atk-emoticon])';
|
|
41
|
-
}
|
|
42
|
-
Fancybox.bind(selector, {
|
|
43
|
-
hideScrollbar: false,
|
|
44
|
-
Thumbs: {
|
|
45
|
-
autoStart: false,
|
|
46
|
-
},
|
|
47
|
-
caption: (fancybox, slide) => {
|
|
48
|
-
return slide.triggerEl.alt || slide.triggerEl.dataset.caption || null
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
</script>
|
package/layout/_plugins/heti.ejs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
utils.css(`<%- conf.css %>`);
|
|
3
|
-
utils.js(`<%- conf.js %>`, { defer: true }).then(function () {
|
|
4
|
-
const heti = new Heti('.heti');
|
|
5
|
-
|
|
6
|
-
// Copied from heti.autoSpacing() without DOMContentLoaded.
|
|
7
|
-
// https://github.com/sivan/heti/blob/eadee6a3b748b3b7924a9e7d5b395d4bce479c9a/js/heti-addon.js
|
|
8
|
-
//
|
|
9
|
-
// We managed to minimize the code modification to ensure .autoSpacing()
|
|
10
|
-
// is synced with upstream; therefore, we use `.bind()` to emulate the
|
|
11
|
-
// behavior of .autoSpacing() so we can even modify almost no code.
|
|
12
|
-
void (function () {
|
|
13
|
-
const $$rootList = document.querySelectorAll(this.rootSelector)
|
|
14
|
-
|
|
15
|
-
for (let $$root of $$rootList) {
|
|
16
|
-
this.spacingElement($$root)
|
|
17
|
-
}
|
|
18
|
-
}).bind(heti)();
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
</script>
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
// 防御:bootstrap 被第三方优化器改写/移除导致 window.stellar.initPlugin 缺失时,
|
|
3
|
-
// 在此补一个等价注册点:utils 就绪时直接委托,未就绪时入队,utils 加载后自动补跑。
|
|
4
|
-
if (typeof window.stellar === 'undefined' || typeof window.stellar.initPlugin !== 'function') {
|
|
5
|
-
window.stellar = window.stellar || {};
|
|
6
|
-
window.stellar._pluginQueue = window.stellar._pluginQueue || [];
|
|
7
|
-
window.stellar.initPlugin = function (fn, name, options) {
|
|
8
|
-
if (typeof utils === 'object' && typeof utils.initPlugin === 'function') {
|
|
9
|
-
return utils.initPlugin(fn, name, options);
|
|
10
|
-
}
|
|
11
|
-
window.stellar._pluginQueue.push({ fn: fn, name: name, options: options || {} });
|
|
12
|
-
};
|
|
13
|
-
window.stellar._flushPlugins = function () {
|
|
14
|
-
var pending = window.stellar._pluginQueue.splice(0);
|
|
15
|
-
if (typeof utils !== 'object' || typeof utils.initPlugin !== 'function') return;
|
|
16
|
-
for (var i = 0; i < pending.length; i++) {
|
|
17
|
-
try {
|
|
18
|
-
utils.initPlugin(pending[i].fn, pending[i].name, pending[i].options);
|
|
19
|
-
} catch (e) {
|
|
20
|
-
console.error('[Stellar] 插件补注册失败:', e);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
</script>
|
|
26
|
-
<%
|
|
27
|
-
function loadPlugins() {
|
|
28
|
-
var el = ''
|
|
29
|
-
|
|
30
|
-
// search
|
|
31
|
-
if (theme.search[theme.search.service]) {
|
|
32
|
-
el += `<script>window.addEventListener('DOMContentLoaded', function () { utils.js('/js/search/shortcut.js', { defer: true }); });</script>`;
|
|
33
|
-
el += partial(`search/${theme.search.service}`, {conf: theme.search[theme.search.service]});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// others
|
|
37
|
-
for (let id of Object.keys(theme.plugins)) {
|
|
38
|
-
const conf = Object.assign({}, theme.plugins[id], page[id])
|
|
39
|
-
if (page[id] == true || conf.enable) {
|
|
40
|
-
if (conf.inject?.length > 0) {
|
|
41
|
-
el += conf.inject
|
|
42
|
-
} else {
|
|
43
|
-
el += partial(`${id}`, {conf: conf})
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return el
|
|
48
|
-
}
|
|
49
|
-
%>
|
|
50
|
-
<%- loadPlugins() %>
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
<% if (conf.v3) { %>
|
|
2
|
-
<script>
|
|
3
|
-
window.MathJax = {
|
|
4
|
-
tex: {
|
|
5
|
-
inlineMath: [
|
|
6
|
-
["$", "$"],
|
|
7
|
-
["\\(", "\\)"],
|
|
8
|
-
],
|
|
9
|
-
processEscapes: true,
|
|
10
|
-
skipTags: ["script", "noscript", "style", "textarea", "pre", "code"],
|
|
11
|
-
},
|
|
12
|
-
startup: {
|
|
13
|
-
ready() {
|
|
14
|
-
MathJax.startup.defaultReady();
|
|
15
|
-
MathJax.typesetPromise().then(() => {
|
|
16
|
-
const math = document.querySelectorAll("mjx-container");
|
|
17
|
-
math.forEach((element) => {
|
|
18
|
-
if (element.parentNode) {
|
|
19
|
-
element.parentNode.classList.add("has-jax");
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
</script>
|
|
27
|
-
<% } %>
|
|
28
|
-
<script id="MathJax-script" src="<%- conf.js %>" async></script>
|
|
29
|
-
<% if (!conf.v3) { %>
|
|
30
|
-
<script type="text/x-mathjax-config">
|
|
31
|
-
MathJax.Hub.Config({
|
|
32
|
-
tex2jax: {
|
|
33
|
-
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
|
|
34
|
-
processEscapes: true
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
MathJax.Hub.Config({
|
|
38
|
-
tex2jax: {
|
|
39
|
-
skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
MathJax.Hub.Queue(function() {
|
|
43
|
-
var all = MathJax.Hub.getAllJax(), i;
|
|
44
|
-
for(i=0; i < all.length; i += 1) {
|
|
45
|
-
all[i].SourceElement().parentNode.className += ' has-jax';
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
</script>
|
|
49
|
-
<% } %>
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
<script defer type="text/javascript" src="<%- conf.js %>"></script>
|
|
2
|
-
<script>
|
|
3
|
-
stellar.initPlugin(() => {
|
|
4
|
-
const els = document.querySelectorAll('.mermaid');
|
|
5
|
-
if (els.length > 0) {
|
|
6
|
-
if (<%- conf.style_optimization === true %>) {
|
|
7
|
-
utils.css(`<%- url_for('/css/plugins/mermaid.css') %>?v=<%- stellar_info('version') %>`);
|
|
8
|
-
}
|
|
9
|
-
const mermaid_config = {
|
|
10
|
-
startOnLoad: false,
|
|
11
|
-
theme:
|
|
12
|
-
"<%- theme.style.prefers_theme %>" == "auto" &&
|
|
13
|
-
window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
14
|
-
? "dark"
|
|
15
|
-
: "<%- conf.theme %>",
|
|
16
|
-
logLevel: 3,
|
|
17
|
-
flowchart: {
|
|
18
|
-
useMaxWidth: false,
|
|
19
|
-
htmlLabels: true,
|
|
20
|
-
curve: "linear"
|
|
21
|
-
},
|
|
22
|
-
gantt: {
|
|
23
|
-
axisFormat: "%Y/%m/%d"
|
|
24
|
-
},
|
|
25
|
-
sequence: {
|
|
26
|
-
actorMargin: 50
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
mermaid.initialize(mermaid_config);
|
|
30
|
-
mermaid.run();
|
|
31
|
-
}
|
|
32
|
-
}, 'mermaid');
|
|
33
|
-
</script>
|