From 7210f5b431b3e53147538b1ba056da02b24fa121 Mon Sep 17 00:00:00 2001 From: Jerry Date: Wed, 18 Aug 2021 00:07:31 +0800 Subject: [PATCH] =?UTF-8?q?breaking=20changes:=20toc=20=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=EF=BC=8C=E9=A0=81=E9=9D=A2=E6=94=AF=E6=8C=81?= =?UTF-8?q?=20toc=20=E9=A1=AF=E7=A4=BA=20close=20#636=20feat:=20=E4=BB=A3?= =?UTF-8?q?=E7=A2=BC=E6=A1=86=E8=A8=AD=E7=BD=AE=E9=AB=98=E5=BA=A6=E9=99=90?= =?UTF-8?q?=E5=88=B6=EF=BC=8C=E5=B1=95=E9=96=8B=E5=BE=8C=E6=8C=89=E9=88=95?= =?UTF-8?q?=E4=B8=8D=E6=9C=83=E6=B6=88=E5=A4=B1=EF=BC=8C=E5=8F=AF=E9=BB=9E?= =?UTF-8?q?=E6=93=8A=E5=86=8D=E6=AC=A1=E6=91=BA=E7=96=8A=20close=20#637=20?= =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20no-lightbox=20class=20=E5=81=B5?= =?UTF-8?q?=E6=B8=AC=EF=BC=8C=E5=8F=AF=E9=85=8D=E7=BD=AE=20fancybox=20?= =?UTF-8?q?=E5=92=8C=20medium-zoom=20=E4=B8=8D=E6=87=89=E7=94=A8=E6=96=BC?= =?UTF-8?q?=E5=9C=96=E7=89=87=20#636=20fix:=20=E4=BF=AE=E5=BE=A9=E9=96=8B?= =?UTF-8?q?=E5=95=9F=20lazyload=20=E6=99=82=EF=BC=8C=20fancybox=20?= =?UTF-8?q?=E7=9A=84=E7=B8=AE=E7=95=A5=E5=9C=96=E9=A1=AF=E7=A4=BA=20lazylo?= =?UTF-8?q?ad=20=E5=8A=A0=E8=BC=89=E5=9C=96=E7=89=87=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 3 ++- layout/category.pug | 4 ++-- layout/includes/head/config_site.pug | 17 +++++++++++++---- layout/includes/header/post-info.pug | 2 +- layout/includes/page/flink.pug | 4 ++-- layout/includes/rightside.pug | 6 +++--- layout/includes/widget/index.pug | 4 +++- package.json | 4 ++-- scripts/tag/gallery.js | 4 ++-- source/css/_highlight/highlight.styl | 6 +++++- source/js/main.js | 6 +++--- 11 files changed, 38 insertions(+), 22 deletions(-) diff --git a/_config.yml b/_config.yml index 586808d..ae2a6f2 100644 --- a/_config.yml +++ b/_config.yml @@ -175,7 +175,8 @@ index_post_content: # toc (目錄) toc: - enable: true + post: true + page: false number: true style_simple: false diff --git a/layout/category.pug b/layout/category.pug index 5dc21d5..234a0af 100644 --- a/layout/category.pug +++ b/layout/category.pug @@ -3,9 +3,9 @@ extends includes/layout.pug block content if theme.category_ui == 'index' include ./includes/mixins/post-ui.pug - #recent-posts.recent-posts.category_ui + #recent-posts.recent-posts.category_ui +postUI - include includes/pagination.pug + include includes/pagination.pug else include ./includes/mixins/article-sort.pug #category diff --git a/layout/includes/head/config_site.pug b/layout/includes/head/config_site.pug index 1d78e98..220c55f 100644 --- a/layout/includes/head/config_site.pug +++ b/layout/includes/head/config_site.pug @@ -1,13 +1,22 @@ - + const titleVal = pageTitle.replace(/'/ig,"\\'") + let isHighlightShrink if (theme.highlight_shrink == 'none') isHighlightShrink = 'undefined' else if (page.highlight_shrink === true || page.highlight_shrink === false) isHighlightShrink = page.highlight_shrink else isHighlightShrink = theme.highlight_shrink - var pageToc = page.toc === true || page.toc === false ? page.toc : theme.toc.enable - var showToc = is_post() && theme.aside.enable && pageToc && (toc(page.content) !== '' || page.encrypt == true ) - - let titleVal = pageTitle.replace(/'/ig,"\\'") + var showToc = false + if (theme.aside.enable) { + let tocEnable = false + if (is_post()) { + if (theme.toc.post) tocEnable = true + } else if (is_page()) { + if (theme.toc.page) tocEnable = true + } + const pageToc = page.toc === true || page.toc === false ? page.toc : tocEnable + showToc = pageToc && (toc(page.content) !== '' || page.encrypt == true ) + } - script#config-diff. diff --git a/layout/includes/header/post-info.pug b/layout/includes/header/post-info.pug index 45c430a..61b2e7b 100644 --- a/layout/includes/header/post-info.pug +++ b/layout/includes/header/post-info.pug @@ -108,4 +108,4 @@ when 'Facebook Comments' +countBlock a(href=url_for(page.path) + '#post-comment') - span.fb-comments-count(data-href=urlNoIndex()) + span.fb-comments-count(data-href=urlNoIndex()) \ No newline at end of file diff --git a/layout/includes/page/flink.pug b/layout/includes/page/flink.pug index 104d288..c986f59 100644 --- a/layout/includes/page/flink.pug +++ b/layout/includes/page/flink.pug @@ -13,8 +13,8 @@ each item in i.link_list .flink-list-item a(href=url_for(item.link) title=item.name target="_blank") - .flink-item-icon.not-lightbox - img(src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name ) + .flink-item-icon + img.no-lightbox(src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name ) .flink-item-name= item.name .flink-item-desc(title=item.descr)= item.descr != page.content diff --git a/layout/includes/rightside.pug b/layout/includes/rightside.pug index a52f6a1..0e0bdf5 100644 --- a/layout/includes/rightside.pug +++ b/layout/includes/rightside.pug @@ -21,13 +21,13 @@ if (theme.readmode || theme.translate.enable || (theme.darkmode.enable && theme.darkmode.button) || theme.change_font_size) button#rightside_config(type="button" title=_p("rightside.setting")) i.fas.fa-cog.fa-spin - if showToc - button#mobile-toc-button.close(type="button" title=_p("rightside.toc")) - i.fas.fa-list-ul else if theme.translate.enable || (theme.darkmode.enable && theme.darkmode.button) || theme.change_font_size button#rightside_config(type="button" title=_p("rightside.setting")) i.fas.fa-cog.fa-spin + if showToc + button#mobile-toc-button.close(type="button" title=_p("rightside.toc")) + i.fas.fa-list-ul if theme.chat_btn button#chat_btn(type="button" title=_p("rightside.chat_btn")) i.fas.fa-sms diff --git a/layout/includes/widget/index.pug b/layout/includes/widget/index.pug index f9b9930..9d523d2 100644 --- a/layout/includes/widget/index.pug +++ b/layout/includes/widget/index.pug @@ -7,7 +7,7 @@ else !=partial('includes/widget/card_author', {}, {cache: true}) !=partial('includes/widget/card_announcement', {}, {cache: true}) - !=partial('includes/widget/card_top_self', {}, {cache: true}) + !=partial('includes/widget/card_top_self', {}, {cache: true}) .sticky_layout if showToc include ./card_post_toc.pug @@ -20,6 +20,8 @@ !=partial('includes/widget/card_top_self', {}, {cache: true}) .sticky_layout + if showToc + include ./card_post_toc.pug !=partial('includes/widget/card_recent_post', {}, {cache: true}) !=partial('includes/widget/card_ad', {}, {cache: true}) !=partial('includes/widget/card_newest_comment', {}, {cache: true}) diff --git a/package.json b/package.json index a4f0af3..de4578d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "4.0.0-b3", + "version": "4.0.0-b4", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { @@ -20,7 +20,7 @@ }, "bugs": { "url": "https://github.com/jerryc127/hexo-theme-butterfly/issues", - "email": "btf@immyw.com" + "email": "i@immyw.com" }, "dependencies": { "hexo-renderer-stylus": "^2.0.1", diff --git a/scripts/tag/gallery.js b/scripts/tag/gallery.js index 82067c1..21ebb55 100644 --- a/scripts/tag/gallery.js +++ b/scripts/tag/gallery.js @@ -19,8 +19,8 @@ function galleryGroup (args) { const img = urlFor(args[3]) return ` -