From c134d4fc86e3172c38367b604762cd2879da0fa7 Mon Sep 17 00:00:00 2001 From: Jerry Date: Tue, 24 Mar 2020 19:03:51 +0800 Subject: [PATCH 01/37] =?UTF-8?q?:bug:=20fix:=20=E4=BF=AE=E5=BE=A9highligh?= =?UTF-8?q?t=5Fshrink=E8=A8=AD=E7=82=BAfalse=E6=99=82,=E5=B0=8E=E8=87=B4sc?= =?UTF-8?q?ript=E5=A0=B1=E9=8C=AF=E7=9A=84bug=20:bug:=20fix:=20=E4=BF=AE?= =?UTF-8?q?=E5=BE=A9highlight=5Fshrink=E8=A8=AD=E7=82=BAtrue=E6=99=82,?= =?UTF-8?q?=E6=8C=89=E9=88=95=E9=BB=9E=E6=93=8A=E7=84=A1=E5=8F=8D=E6=87=89?= =?UTF-8?q?,=E6=B2=92=E6=9C=89=E6=89=93=E9=96=8B=E4=BB=A3=E7=A2=BC?= =?UTF-8?q?=E6=A1=86=E7=9A=84bug=20:bug:=20fix:=20=E4=BF=AE=E5=BE=A9?= =?UTF-8?q?=E8=87=AA=E5=8B=95=E5=88=87=E6=8F=9Bdarkmode=E6=99=82=EF=BC=8C?= =?UTF-8?q?=E5=88=87=E6=8F=9B=E6=8C=89=E9=88=95icon=E6=B2=92=E6=9C=89?= =?UTF-8?q?=E8=AE=8A=E6=9B=B4=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layout/includes/head/config.pug | 2 +- source/js/main.js | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/layout/includes/head/config.pug b/layout/includes/head/config.pug index 88a8633..74e4b91 100644 --- a/layout/includes/head/config.pug +++ b/layout/includes/head/config.pug @@ -112,7 +112,7 @@ script. baiduPush: !{baiduPush}, highlightCopy: !{highlightCopy}, highlightLang: !{highlightLang}, - highlightShrink: !{highlightShrink}, + highlightShrink: '!{highlightShrink}', isFontAwesomeV5: !{isFontAwesomeV5} } diff --git a/source/js/main.js b/source/js/main.js index 67b359b..7762900 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -271,16 +271,16 @@ $(function () { * 代碼收縮 */ const $highlightTools = $('.highlight-tools') - if (isHighlightShrink === true) { + if (isHighlightShrink === 'true') { $highlightTools.append('') - } else if (isHighlightShrink === false) { + } else if (isHighlightShrink === 'false') { $highlightTools.append('') } $(document).on('click', '.highlight-tools >.code-expand', function () { var $table = $(this).parent().next() if ($(this).hasClass('code-closed')) { - $table.css('display', '') + $table.css('display', 'block') $(this).removeClass('code-closed') } else { $table.css('display', 'none') @@ -668,8 +668,7 @@ $(function () { var isFontAwesomeV5 = GLOBAL_CONFIG.isFontAwesomeV5 var $darkModeButtom = $('#darkmode') if (typeof autoChangeMode !== 'undefined') { - if (Cookies.get('theme') === 'dark') changeLightIcon() - else changeDarkIcon() + document.documentElement.getAttribute('data-theme') === 'dark' ? changeLightIcon() : changeDarkIcon() } function changeLightIcon () { From 559afab632d9284bad1f8fadebdcc3ec912956d1 Mon Sep 17 00:00:00 2001 From: Jerry Date: Sat, 28 Mar 2020 03:20:36 +0800 Subject: [PATCH 02/37] =?UTF-8?q?:bookmark:=202.2.5=E7=99=BC=E4=BD=88=20?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=86=85=E5=AE=B9=E8=AB=8B=E7=9C=8B=20https:?= =?UTF-8?q?//github.com/jerryc127/hexo-theme-butterfly/releases?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- README_CN.md | 2 +- _config.yml | 28 +++- languages/default.yml | 1 + languages/en.yml | 1 + languages/zh-CN.yml | 1 + languages/zh-TW.yml | 7 +- layout/404.pug | 82 ++-------- layout/includes/additional-js.pug | 2 +- layout/includes/head.pug | 19 ++- layout/includes/head/config.pug | 31 ++-- layout/includes/head/config_site.pug | 5 +- layout/includes/head/darkmode.pug | 16 +- layout/includes/head/noscript.pug | 9 ++ .../{index-js.pug => head/subtitle.pug} | 48 +++--- layout/includes/header/header.pug | 19 ++- layout/includes/header/index.pug | 4 +- layout/includes/header/post-info.pug | 94 +++++++----- layout/includes/header/social.pug | 4 + layout/includes/layout.pug | 12 +- layout/includes/mixins/UI.pug | 23 ++- layout/includes/mixins/article-sort.pug | 2 +- layout/includes/recent-posts.pug | 24 ++- layout/includes/rightside.pug | 2 +- layout/includes/sidebar.pug | 24 +-- layout/includes/widget/card_ad.pug | 2 + layout/includes/widget/card_author.pug | 4 +- layout/includes/widget/card_recent_post.pug | 4 +- layout/includes/widget/card_webinfo.pug | 4 + layout/includes/widget/index.pug | 2 + layout/post.pug | 8 +- package.json | 2 +- scripts/filters/post-lazyload.js | 7 +- scripts/helpers/list-archives.js | 2 +- source/css/_global/index.styl | 28 +++- source/css/_layout/aside.styl | 4 - source/css/_layout/flink.styl | 3 + source/css/_layout/gallery.styl | 3 + source/css/_layout/head.styl | 145 +++++++++--------- source/css/_layout/page.styl | 1 + source/js/main.js | 121 +++++++-------- 41 files changed, 415 insertions(+), 387 deletions(-) create mode 100644 layout/includes/head/noscript.pug rename layout/includes/{index-js.pug => head/subtitle.pug} (69%) create mode 100644 layout/includes/header/social.pug create mode 100644 layout/includes/widget/card_ad.pug diff --git a/README.md b/README.md index 2486840..0707089 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # hexo-theme-butterfly -Version +Version Author Hexo node.js diff --git a/README_CN.md b/README_CN.md index 295d892..1ab85d3 100644 --- a/README_CN.md +++ b/README_CN.md @@ -1,6 +1,6 @@ # hexo-theme-butterfly -Version +Version Author Hexo node.js diff --git a/_config.yml b/_config.yml index a60630f..2ae3fc3 100644 --- a/_config.yml +++ b/_config.yml @@ -49,12 +49,12 @@ copy: # social settings # formal: -# icon: link +# icon: link || the description # --------------- social: - fa fa-github: https://github.com/jerryc127 - fa fa-envelope: mailto:xxxxxxxx@gmail.com - fa fa-rss: /atom.xml + fa fa-github: https://github.com/jerryc127 || Github + fa fa-envelope: mailto:xxxxxxx@gmail.com || Email + fa fa-rss: /atom.xml || RSS #### search #### # Algolia search @@ -70,7 +70,7 @@ algolia_search: hits_stats: "${hits} results found in ${time} ms" # Local search -# Please see doc for more details: https://jerryc.me/posts/21cfbf15/#本地搜索 +# Please see doc for more details: https://docs.jerryc.me/config.html#本地搜索 # --------------- local_search: enable: false @@ -79,7 +79,7 @@ local_search: hits_empty: "We didn't find any results for the search: ${query}" # if there are no result # MathJax -# Please see doc for more details: https://jerryc.me/posts/21cfbf15/#MathJax +# Please see doc for more details: https://docs.jerryc.me/config.html#mathjax # --------------- mathjax: enable: false @@ -168,9 +168,12 @@ post_meta: categories: true # true or false 文章頁是否顯示分類 tags: true # true or false 文章頁是否顯示標籤 -# Please see doc for more details: https://jerryc.me/posts/21cfbf15/#字數統計 +# Please see doc for more details: https://docs.jerryc.me/config.html#字數統計 wordcount: enable: false + post_wordcount: true + min2read: true + total_wordcount: true toc: enable: true @@ -313,6 +316,13 @@ google_adsense: client: enable_page_level_ads: true +# 廣告插入位置 +# 適用於開啓手動廣告的配置 +# ad: +# index: +# aside: +# post: + #### 站長驗證 #### # Google Webmaster tools verification setting # See: https://www.google.com/webmasters/ @@ -347,6 +357,10 @@ related_post: limit: 6 # 顯示推薦文章數目 date_type: created # or created or updated 文章日期顯示創建日或者更新日 +# figcaption +# 圖片描述文字 +photofigcaption: false + #### 美化/效果 #### #-------------------------------- diff --git a/languages/default.yml b/languages/default.yml index 29894f9..441e6d5 100644 --- a/languages/default.yml +++ b/languages/default.yml @@ -66,6 +66,7 @@ aside: headline: Info article_name: Article runtime_name: Run time + site_wordcount: Total Count site_uv_name: UV site_pv_name: PV diff --git a/languages/en.yml b/languages/en.yml index 29894f9..441e6d5 100644 --- a/languages/en.yml +++ b/languages/en.yml @@ -66,6 +66,7 @@ aside: headline: Info article_name: Article runtime_name: Run time + site_wordcount: Total Count site_uv_name: UV site_pv_name: PV diff --git a/languages/zh-CN.yml b/languages/zh-CN.yml index 9b4e224..a78d07e 100644 --- a/languages/zh-CN.yml +++ b/languages/zh-CN.yml @@ -68,6 +68,7 @@ aside: headline: 网站资讯 article_name: 文章数目 runtime_name: 已运行时间 + site_wordcount: 本站总字数 site_uv_name: 本站访客数 site_pv_name: 本站总访问量 diff --git a/languages/zh-TW.yml b/languages/zh-TW.yml index 8aad902..bbdf11a 100644 --- a/languages/zh-TW.yml +++ b/languages/zh-TW.yml @@ -24,8 +24,8 @@ post: created: 發表於 updated: 更新於 wordcount: 字數總計 - min2read: "閲讀時長: %s 分鐘" - page_pv: 閲讀量 + min2read: "閱讀時長: %s 分鐘" + page_pv: 閱讀量 comments: 評論數 copyright: author: 文章作者 @@ -68,6 +68,7 @@ aside: headline: 網站資訊 article_name: 文章數目 runtime_name: 已運行時間 + site_wordcount: 本站總字數 site_uv_name: 本站訪客數 site_pv_name: 本站總訪問量 @@ -77,7 +78,7 @@ bookmark: title: 添加書籤 rightside: - readmode_title: 閲讀模式 + readmode_title: 閱讀模式 font_plus_title: 放大字體 font_minus_title: 縮小字體 translate_title: 簡繁轉換 diff --git a/layout/404.pug b/layout/404.pug index 8ae9438..4dc3c92 100644 --- a/layout/404.pug +++ b/layout/404.pug @@ -1,87 +1,23 @@ +- var top_img = theme.error_404.background || theme.default_top_img +- var bg_img = `background-image: url(${top_img})` + doctype html html(lang=config.language data-theme=theme.display_mode) head - - var pageTitle = _p('error_title') - - var tabTitle = pageTitle + ' | ' + config.title - - var pageDescription = page.description || page.title || config.description - - var pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords - - var pageAuthor = config.email ? config.author + ',' + config.email : config.author - - var pageCopyright = config.copyright || config.author - - var without_html = url.replace('index.html', '') - - var top_img = theme.error_404.background || theme.default_top_img - - var bg_img = `background-image: url(${top_img})` - - - meta(charset='UTF-8') - meta(http-equiv="X-UA-Compatible" content="IE=edge") - meta(name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5") - title= tabTitle - meta(name="description" content=pageDescription) - if pageKeywords - meta(name="keywords" content=pageKeywords) - meta(name="author" content=pageAuthor) - meta(name="copyright" content=pageCopyright) - meta(name ="format-detection" content="telephone=no") - !=favicon_tag(theme.favicon || config.favicon) - //- 預解析 - include includes/head/dns_prefetch.pug - //- 網站驗證 - include includes/head/site_verification.pug - //- Open_Graph - include includes/head/Open_Graph.pug - //- PWA - if (theme.pwa && theme.pwa.enable) - include includes/head/pwa - - script(src=url_for(theme.CDN.js_cookies)) - - if theme.darkmode.enable - include includes/head/darkmode.pug - - each item in theme.CDN_USE.css - link(rel='stylesheet', href=url_for(item)) - - if theme.fontawesome_v5 && theme.fontawesome_v5.enable - link(rel='stylesheet', href=url_for(theme.CDN.fontawesome_v5)) - else - link(rel='stylesheet', href=url_for(theme.CDN.fontawesome_v4)) - - if (theme.snackbar && theme.snackbar.enable) - link(rel='stylesheet', href=url_for(theme.CDN.snackbar_css)) - - if theme.canonical - link(rel="canonical" href=without_html) - - if theme.algolia_search.enable - link(rel="stylesheet" type="text/css" href=url_for(theme.CDN.algolia_search_css)) - script(src=url_for(theme.CDN.algolia_search) defer) - - //- google_adsense - include includes/head/google_adsense.pug - - //- analytics - include includes/head/analytics.pug - - if theme.blog_title_font.font_link - link(rel='stylesheet', href=url_for(theme.blog_title_font.font_link)) - - include includes/head/config.pug - include includes/head/config_site.pug - + include includes/head.pug body if theme.fireworks && theme.fireworks.enable canvas.fireworks + + include includes/mobile-sidebar/index.pug + nav#nav.error-no-found(style=bg_img) include includes/header/header.pug #error_info.is-center h1#error_title= '404' - #error_subtitle= theme.error_404.subtitle - include includes/mobile-sidebar/index.pug + #error_subtitle= theme.error_404.subtitle include includes/rightside.pug + include includes/search/index.pug each item in theme.CDN_USE.js script(src=url_for(item)) include includes/additional-js.pug - include includes/search/index.pug - - - diff --git a/layout/includes/additional-js.pug b/layout/includes/additional-js.pug index 9f7804a..4393e51 100644 --- a/layout/includes/additional-js.pug +++ b/layout/includes/additional-js.pug @@ -62,4 +62,4 @@ if theme.mermaid.enable include ./math/mermaid.pug if is_home() - include index-js.pug \ No newline at end of file + include ./head/subtitle.pug \ No newline at end of file diff --git a/layout/includes/head.pug b/layout/includes/head.pug index 696306f..febb1ee 100644 --- a/layout/includes/head.pug +++ b/layout/includes/head.pug @@ -1,16 +1,19 @@ -- var pageTitle = page.title || config.title || '' +- var pageTitle - if (is_archive()) pageTitle = _p('page.archives') -- if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag -- if (is_category()) pageTitle = _p('page.category') + ': ' + page.category -- if (is_month()) pageTitle += ': ' + page.month + '/' + page.year -- if (is_year()) pageTitle += ': ' + page.year +- else if (is_tag()) pageTitle = _p('page.tag') + ': ' + page.tag +- else if (is_category()) pageTitle = _p('page.category') + ': ' + page.category +- else if (is_month()) pageTitle += ': ' + page.month + '/' + page.year +- else if (is_year()) pageTitle += ': ' + page.year +- else if (is_current('/404.html', [strict])) pageTitle = _p('error_title') +- else pageTitle = page.title || config.title || '' + - var isSubtitle = config.subtitle ? ' - ' + config.subtitle : '' - var tabTitle = is_home() || !pageTitle ? config.title + isSubtitle : pageTitle + ' | ' + config.title -- pageTitle ? '' : pageTitle = config.title || '' - var pageDescription = page.description || page.title || config.description -- var pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords +- var pageKeywords - if (page.tags && page.tags.data) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',') +- else pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords - var pageAuthor = config.email ? config.author + ',' + config.email : config.author - var pageCopyright = config.copyright || config.author - var without_html = url.replace('index.html', '') @@ -97,4 +100,6 @@ if theme.blog_title_font.font_link //- global config !=partial('includes/head/config', {}, {cache:theme.fragment_cache}) + include ./head/config_site.pug +include ./head/noscript.pug diff --git a/layout/includes/head/config.pug b/layout/includes/head/config.pug index 74e4b91..63e854b 100644 --- a/layout/includes/head/config.pug +++ b/layout/includes/head/config.pug @@ -42,7 +42,7 @@ copyright = JSON.stringify({ languages: { author: _p("copy_copyright.author") + ': ' + config.author, - link: _p("copy_copyright.link") + ': ' + without_html, + link: _p("copy_copyright.link") + ': ', source: _p("copy_copyright.source") + ': ' + config.title, info: _p("copy_copyright.info") } @@ -62,7 +62,6 @@ if (theme.snackbar && theme.snackbar.enable) { Snackbar = JSON.stringify({ bookmark: { - title: _p("Snackbar.bookmark.title"), message_prev: _p("Snackbar.bookmark.message_prev"), message_next: _p("Snackbar.bookmark.message_next") }, @@ -76,16 +75,6 @@ }) } - var highlightCopy = theme.highlight_copy - var highlightLang = theme.highlight_lang - var highlightShrink = theme.highlight_shrink - var runtime = theme.runtimeshow.enable - var fancybox = theme.fancybox.enable - var medium_zoom = theme.medium_zoom.enable - var baiduPush = theme.baidu_push && theme.baidu_push.enable - var isFontAwesomeV5 = theme.fontawesome_v5 && theme.fontawesome_v5.enable - - script. var GLOBAL_CONFIG = { root: '!{config.root}', @@ -98,22 +87,22 @@ script. noSupport: '!{_p("copy.noSupport")}' }, bookmark: { - title: '!{_p("Snackbar.bookmark.title")}', message_prev: '!{_p("Snackbar.bookmark.message_prev")}', message_next: '!{_p("Snackbar.bookmark.message_next")}' }, runtime_unit: '!{_p("runtime_unit")}', - runtime: !{runtime}, + runtime: !{theme.runtimeshow.enable}, copyright: !{copyright}, ClickShowText: !{ClickShowText}, - medium_zoom: !{medium_zoom}, - fancybox: !{fancybox}, + medium_zoom: !{theme.medium_zoom.enable}, + fancybox: !{theme.fancybox.enable}, Snackbar: !{Snackbar}, - baiduPush: !{baiduPush}, - highlightCopy: !{highlightCopy}, - highlightLang: !{highlightLang}, - highlightShrink: '!{highlightShrink}', - isFontAwesomeV5: !{isFontAwesomeV5} + baiduPush: !{theme.baidu_push && theme.baidu_push.enable}, + highlightCopy: !{theme.highlight_copy}, + highlightLang: !{theme.highlight_lang}, + highlightShrink: '!{theme.highlight_shrink}', + isFontAwesomeV5: !{theme.fontawesome_v5 && theme.fontawesome_v5.enable}, + isPhotoFigcaption: !{theme.photofigcaption} } diff --git a/layout/includes/head/config_site.pug b/layout/includes/head/config_site.pug index 1e5ed9e..1d7ae99 100644 --- a/layout/includes/head/config_site.pug +++ b/layout/includes/head/config_site.pug @@ -1,6 +1,7 @@ script. var GLOBAL_CONFIG_SITE = { isPost: !{is_post()}, - isHome: !{is_home()} - } + isHome: !{is_home()}, + isSidebar: !{is_post() && page.toc !== false && theme.toc.enable && (toc(page.content) !== '' || page.encrypt == true )} + } diff --git a/layout/includes/head/darkmode.pug b/layout/includes/head/darkmode.pug index e6adeab..bd5961f 100644 --- a/layout/includes/head/darkmode.pug +++ b/layout/includes/head/darkmode.pug @@ -1,20 +1,20 @@ script. - const autoChangeMode = '#{theme.darkmode.autoChangeMode}' + var autoChangeMode = '#{theme.darkmode.autoChangeMode}' var t = Cookies.get("theme") if (autoChangeMode == '1'){ - const isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches - const isLightMode = window.matchMedia("(prefers-color-scheme: light)").matches - const isNotSpecified = window.matchMedia("(prefers-color-scheme: no-preference)").matches - const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified + var isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches + var isLightMode = window.matchMedia("(prefers-color-scheme: light)").matches + var isNotSpecified = window.matchMedia("(prefers-color-scheme: no-preference)").matches + var hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified if (t === undefined){ if (isLightMode) activateLightMode() else if (isDarkMode) activateDarkMode() else if (isNotSpecified || hasNoSupport){ console.log('You specified no preference for a color scheme or your browser does not support it. I Schedule dark mode during night time.') - now = new Date(); - hour = now.getHours(); - isNight = hour < 6 || hour >= 18 + var now = new Date() + var hour = now.getHours() + var isNight = hour < 6 || hour >= 18 isNight ? activateDarkMode() : activateLightMode() } } else if (t == 'light') activateLightMode() diff --git a/layout/includes/head/noscript.pug b/layout/includes/head/noscript.pug new file mode 100644 index 0000000..de8a2d8 --- /dev/null +++ b/layout/includes/head/noscript.pug @@ -0,0 +1,9 @@ +noscript. + \ No newline at end of file diff --git a/layout/includes/index-js.pug b/layout/includes/head/subtitle.pug similarity index 69% rename from layout/includes/index-js.pug rename to layout/includes/head/subtitle.pug index cdbb734..b216f0c 100644 --- a/layout/includes/index-js.pug +++ b/layout/includes/head/subtitle.pug @@ -1,22 +1,22 @@ if theme.subtitle.enable - - let source = theme.subtitle.source - - let subtitleEffect = theme.subtitle.effect + - var source = theme.subtitle.source + - var subtitleEffect = theme.subtitle.effect if subtitleEffect script(src=url_for(theme.CDN.typed)) if source == '1' script. - let subtitleEffect = !{subtitleEffect} + var subtitleEffect = !{subtitleEffect} fetch('https://api.ooopn.com/ciba/api.php',) .then(function (res){ return res.json(); }) .then(function (data) { if (subtitleEffect){ - let sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(","); - let both = sub.unshift(data['ciba-en'],data.ciba) - let typed = new Typed("#subtitle", { + var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(","); + var both = sub.unshift(data['ciba-en'],data.ciba) + var typed = new Typed("#subtitle", { strings: sub, startDelay: 300, typeSpeed: 150, @@ -33,17 +33,17 @@ if theme.subtitle.enable else if source == '2' script. - let subtitleEffect = !{subtitleEffect} + var subtitleEffect = !{subtitleEffect} fetch('https://v1.hitokoto.cn') .then(function (res){ return res.json(); }) .then(function (data) { if (subtitleEffect){ - let from = '出自 ' + data.from - let sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(","); - let both = sub.unshift(data.hitokoto,from) - let typed = new Typed("#subtitle", { + var from = '出自 ' + data.from + var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(","); + var both = sub.unshift(data.hitokoto,from) + var typed = new Typed("#subtitle", { strings: sub, startDelay: 300, typeSpeed: 150, @@ -61,13 +61,13 @@ if theme.subtitle.enable else if source == "3" script(type="text/javascript" src="http://yijuzhan.com/api/word.php?m=js") script. - let subtitleEffect = !{subtitleEffect} - let con = str[0]; + var subtitleEffect = !{subtitleEffect} + var con = str[0]; if (subtitleEffect){ - let from = "出自 " + str[1]; - let sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(","); - let both = sub.unshift(con,from) - let typed = new Typed("#subtitle", { + var from = "出自 " + str[1]; + var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(","); + var both = sub.unshift(con,from) + var typed = new Typed("#subtitle", { strings: sub, startDelay: 300, typeSpeed: 150, @@ -81,13 +81,13 @@ if theme.subtitle.enable else if source == '4' script(type="text/javascript" src="https://sdk.jinrishici.com/v2/browser/jinrishici.js" charset="utf-8") script. - let subtitleEffect = !{subtitleEffect} + var subtitleEffect = !{subtitleEffect} jinrishici.load(function(result) { if (subtitleEffect){ - let sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(","); - let content = result.data.content; - let both = sub.unshift(content) - let typed = new Typed("#subtitle", { + var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(","); + var content = result.data.content; + var both = sub.unshift(content) + var typed = new Typed("#subtitle", { strings: sub, startDelay: 300, typeSpeed: 150, @@ -102,9 +102,9 @@ if theme.subtitle.enable else - var subtitle = theme.subtitle.sub[0] script. - let subtitleEffect = !{subtitleEffect} + var subtitleEffect = !{subtitleEffect} if (subtitleEffect){ - let typed = new Typed("#subtitle", { + var typed = new Typed("#subtitle", { strings: '!{theme.subtitle.sub}'.split(","), startDelay: 300, typeSpeed: 150, diff --git a/layout/includes/header/header.pug b/layout/includes/header/header.pug index 9346dd0..e6a22cc 100644 --- a/layout/includes/header/header.pug +++ b/layout/includes/header/header.pug @@ -1,15 +1,18 @@ #page-header span#blog_name.pull_left a#site-name.blog_title(href=url_for('/')) #[=config.title] - span.toggle-menu.pull_right.close - a.site-page - i.fa.fa-bars.fa-fw(aria-hidden="true") + span.pull_right.menus + if (theme.algolia_search.enable || theme.local_search && theme.local_search.enable) + #search_button + a.site-page.social-icon.search + i.fa.fa-search.fa-fw + span=' '+_p('search') .menus_items include ./menu_item.pug - if (theme.algolia_search.enable || theme.local_search && theme.local_search.enable) - span#search_button.pull_right - a.site-page.social-icon.search - i.fa.fa-search.fa-fw - span=' '+_p('search') + span.toggle-menu.close + a.site-page + i.fa.fa-bars.fa-fw(aria-hidden="true") + + diff --git a/layout/includes/header/index.pug b/layout/includes/header/index.pug index b3c9d9d..3198591 100644 --- a/layout/includes/header/index.pug +++ b/layout/includes/header/index.pug @@ -33,9 +33,7 @@ if theme.douban span#subtitle if(theme.social) #site_social_icons - each url, icon in theme.social - a.social-icon(href=url target="_blank") - i(class=icon aria-hidden="true") + !=partial('includes/header/social', {}, {cache:theme.fragment_cache}) #scroll_down i.fa.fa-angle-down.scroll-down-effects else if is_post() diff --git a/layout/includes/header/post-info.pug b/layout/includes/header/post-info.pug index fd533d8..9f7a011 100644 --- a/layout/includes/header/post-info.pug +++ b/layout/includes/header/post-info.pug @@ -1,51 +1,65 @@ #post-info #post-title .posttitle= page.title || _p('no_title') + #post-meta - if (theme.post_meta.post.date_type) - if (theme.post_meta.post.date_type === 'both') - time.post-meta__date - i.fa.fa-calendar(aria-hidden="true") - =' '+_p('post.created')+' '+date(page.date, config.date_format) - span.post-meta__separator | - i.fa.fa-history(aria-hidden="true") - =' '+_p('post.updated')+' '+date(page.updated, config.date_format) - else - - var data_type_update = theme.post_meta.post.date_type === 'updated' - - var date_type = data_type_update ? 'updated' : 'date' - - var date_icon = data_type_update ? 'fa-history' :'fa-calendar' - - var data_info = data_type_update ? _p('post.updated') : _p('post.created') - time.post-meta__date - i.fa(class=date_icon aria-hidden="true") - =' ' + data_info + ' ' + date(page[date_type], config.date_format) - - if (theme.post_meta.post.categories && page.categories.data.length > 0) + .meta-firstline if (theme.post_meta.post.date_type) - span.post-meta__separator | - span - each item, index in page.categories.data - i.fa.fa-inbox.post-meta__icon(aria-hidden="true") - a(href=url_for(item.path)).post-meta__categories #[=item.name] - if (index < page.categories.data.length - 1) - i.fa.fa-angle-right.post-meta__separator(aria-hidden="true") - .post-meta-wordcount - if (theme.wordcount && theme.wordcount.enable) - - var wordCountIcon = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-file-word' : 'fa fa-file-word-o' - i.post-meta__icon(class=wordCountIcon aria-hidden="true") - span= _p('post.wordcount') + ':' - span.word-count= wordcount(page.content) - span.post-meta__separator | - - var readCountIcon = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-clock' : 'fa fa-clock-o' - i.post-meta__icon(class=readCountIcon aria-hidden="true") - span= _p('post.min2read', min2read(page.content, {cn: 350, en: 160})) - .post-meta-pv-cv - if (theme.wordcount && theme.wordcount.enable && theme.busuanzi.page_pv) + if (theme.post_meta.post.date_type === 'both') + time.post-meta__date + span.post-meta__date-created(title= _p('post.created')+' '+full_date(page.date)) + i.fa.fa-calendar(aria-hidden="true") + =' '+_p('post.created')+' '+date(page.date, config.date_format) + span.post-meta__separator | + span.post-meta__date-updated(title= _p('post.updated')+' '+full_date(page.updated)) + i.fa.fa-history(aria-hidden="true") + =' '+_p('post.updated')+' '+date(page.updated, config.date_format) + else + - var data_type_update = theme.post_meta.post.date_type === 'updated' + - var date_type = data_type_update ? 'updated' : 'date' + - var date_icon = data_type_update ? 'fa-history' :'fa-calendar' + - var data_info = data_type_update ? _p('post.updated') : _p('post.created') + time.post-meta__date(title=data_info + ' ' + full_date(page[date_type])) + i.fa(class=date_icon aria-hidden="true") + =' ' + data_info + ' ' + date(page[date_type], config.date_format) + + if (theme.post_meta.post.categories && page.categories.data.length > 0) + span.post-meta__categories + if (theme.post_meta.post.date_type) + span.post-meta__separator | + + each item, index in page.categories.data + i.fa.fa-inbox.post-meta__icon(aria-hidden="true") + a(href=url_for(item.path)).post-meta__categories #[=item.name] + if (index < page.categories.data.length - 1) + i.fa.fa-angle-right.post-meta__separator(aria-hidden="true") + + .meta-secondline + - let postWordcount = theme.wordcount.enable && (theme.wordcount.post_wordcount || theme.wordcount.min2read) + if (postWordcount) + span.post-meta-wordcount + if theme.wordcount.post_wordcount + - var wordCountIcon = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-file-word' : 'fa fa-file-word-o' + i.post-meta__icon(class=wordCountIcon aria-hidden="true") + span= _p('post.wordcount') + ':' + span.word-count= wordcount(page.content) + if theme.wordcount.min2read + span.post-meta__separator | + if theme.wordcount.min2read + - var readCountIcon = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-clock' : 'fa fa-clock-o' + i.post-meta__icon(class=readCountIcon aria-hidden="true") + span= _p('post.min2read', min2read(page.content, {cn: 350, en: 160})) + + .meta-thirdline + span.post-meta-pv-cv + if (postWordcount && theme.busuanzi.page_pv) span.post-meta__separator | if theme.busuanzi.page_pv i.fa.fa-eye.post-meta__icon(aria-hidden="true") span=_p('post.page_pv') + ':' span#busuanzi_value_page_pv - + + span.post-meta-commentcount - var commentCount = theme.fontawesome_v5 && theme.fontawesome_v5.enable ? 'far fa-comments' : 'fa fa-comment-o' if ((theme.disqus && theme.disqus.enable && theme.disqus.count && page.comments !== false) || (theme.disqusjs && theme.disqusjs.enable && theme.disqusjs.count && page.comments !== false)) if (theme.busuanzi && theme.busuanzi.page_pv) @@ -54,14 +68,14 @@ span= _p('post.comments') + ':' span.disqus-comment-count.comment-count a(href=full_url_for(page.path) + '#disqus_thread') - if (theme.valine && theme.valine.enable && theme.valine.count && page.comments !== false) + else if (theme.valine && theme.valine.enable && theme.valine.count && page.comments !== false) if (theme.busuanzi && theme.busuanzi.page_pv) span.post-meta__separator | i.post-meta__icon(class=commentCount aria-hidden="true") span= _p('post.comments') + ':' a(href=url_for(page.path) + '#post-comment' itemprop="discussionUrl") span.valine-comment-count.comment-count(data-xid=url_for(page.path) itemprop="commentCount") - if (theme.gitalk && theme.gitalk.enable && theme.gitalk.count && page.comments !== false) + else if (theme.gitalk && theme.gitalk.enable && theme.gitalk.count && page.comments !== false) if (theme.busuanzi && theme.busuanzi.page_pv) span.post-meta__separator | i.post-meta__icon(class=commentCount aria-hidden="true") diff --git a/layout/includes/header/social.pug b/layout/includes/header/social.pug new file mode 100644 index 0000000..6c0a49e --- /dev/null +++ b/layout/includes/header/social.pug @@ -0,0 +1,4 @@ +each url, icon in theme.social + a.social-icon(href=trim(url.split('||')[0]) target="_blank" + title=url.split('||')[1] === undefined ? '' : trim(url.split('||')[1])) + i(class=icon aria-hidden="true") \ No newline at end of file diff --git a/layout/includes/layout.pug b/layout/includes/layout.pug index a56961d..e86899c 100644 --- a/layout/includes/layout.pug +++ b/layout/includes/layout.pug @@ -1,5 +1,4 @@ - var hideAside = !theme.aside.enable || page.aside === false ? 'hide-aside' : '' -- var autoOpenSidebar = theme.auto_open_sidebar.enable === true ? 'on' : '' doctype html html(lang=config.language data-theme=theme.display_mode) @@ -8,10 +7,11 @@ html(lang=config.language data-theme=theme.display_mode) body if theme.fireworks && theme.fireworks.enable canvas.fireworks + !=partial('includes/mobile-sidebar/index', {}, {cache:theme.fragment_cache}) - if (is_post() && page.toc != false && theme.toc.enable) - i.fa.fa-arrow-right#toggle-sidebar(aria-hidden="true" class=autoOpenSidebar) - include ./sidebar.pug + + include ./sidebar.pug + #body-wrap if theme.background - var is_photo = theme.background.substring(3,0) === 'url' ? 'photo':'color' @@ -36,10 +36,14 @@ html(lang=config.language data-theme=theme.display_mode) - var is_bg = theme.footer_bg == false ? 'color' : 'photo' footer#footer(style=footer_bg data-type=is_bg) !=partial('includes/footer', {}, {cache:theme.fragment_cache}) + include ./rightside.pug + !=partial('includes/search/index', {}, {cache:theme.fragment_cache}) + each item in theme.CDN_USE.js script(src=url_for(item)) + include ./additional-js.pug diff --git a/layout/includes/mixins/UI.pug b/layout/includes/mixins/UI.pug index be072ec..5cedd81 100644 --- a/layout/includes/mixins/UI.pug +++ b/layout/includes/mixins/UI.pug @@ -19,15 +19,19 @@ mixin UI_NEW(posts) if (theme.post_meta.page.date_type) if (theme.post_meta.page.date_type === 'both') time.post-meta__date - i.fa.fa-calendar(aria-hidden="true") - =date(article.date, config.date_format) + span.post-meta__date-created(title=_p('post.created') + ' ' + full_date(article.date)) + i.fa.fa-calendar(aria-hidden="true") + =date(article.date, config.date_format) span.article-meta__separator | - i.fa.fa-history(aria-hidden="true") - =date(article.updated, config.date_format) + span.post-meta__date-updated(title=_p('post.updated') + ' ' + full_date(article.updated)) + i.fa.fa-history(aria-hidden="true") + =date(article.updated, config.date_format) else - - var date_type = theme.post_meta.page.date_type === 'updated' ? 'updated' : 'date' - - var date_icon = theme.post_meta.page.date_type === 'updated' ? 'fa-history' :'fa-calendar' - time.post-meta__date + - var data_type_updated = theme.post_meta.page.date_type === 'updated' + - var date_type = data_type_updated ? 'updated' : 'date' + - var date_icon = data_type_updated ? 'fa-history' :'fa-calendar' + - var date_title = data_type_updated ? _p('post.updated') : _p('post.created') + time.post-meta__date(title=date_title + ' ' + full_date(article[date_type])) i.fa(class=date_icon aria-hidden="true") =date(article[date_type], config.date_format) if (theme.post_meta.page.categories && article.categories.data.length > 0) @@ -53,4 +57,9 @@ mixin UI_NEW(posts) .content!= expert else .content!= article.description + + if theme.ad && theme.ad.index + if (index + 1) % 3 == 0 + .recent-post-item.ad_height!=theme.ad.index + - }) \ No newline at end of file diff --git a/layout/includes/mixins/article-sort.pug b/layout/includes/mixins/article-sort.pug index 41801d1..25bf57a 100644 --- a/layout/includes/mixins/article-sort.pug +++ b/layout/includes/mixins/article-sort.pug @@ -15,6 +15,6 @@ mixin articleSort(posts) .article-sort-post a.article-sort-item__post(href=url_for(article.path)) i.fa.fa-clock-o(aria-hidden="true") - time.article-sort-item__time= date(article.date) + time.article-sort-item__time(title=_p('post.created') + ' ' + full_date(article.date))= date(article.date, config.date_format) .article-sort-item__title= article.title || 'No Title' - }) \ No newline at end of file diff --git a/layout/includes/recent-posts.pug b/layout/includes/recent-posts.pug index b5a27bd..46fb9de 100644 --- a/layout/includes/recent-posts.pug +++ b/layout/includes/recent-posts.pug @@ -23,15 +23,19 @@ each article , index in page.posts.data if (theme.post_meta.page.date_type) if (theme.post_meta.page.date_type === 'both') time.post-meta__date - i.fa.fa-calendar(aria-hidden="true") - =date(article.date, config.date_format) + span.post-meta__date-created(title=_p('post.created') + ' ' + full_date(article.date)) + i.fa.fa-calendar(aria-hidden="true") + =date(article.date, config.date_format) span.article-meta__separator | - i.fa.fa-history(aria-hidden="true") - =date(article.updated, config.date_format) + span.post-meta__date-updated(title=_p('post.updated') + ' ' + full_date(article.updated)) + i.fa.fa-history(aria-hidden="true") + =date(article.updated, config.date_format) else - - var date_type = theme.post_meta.page.date_type === 'updated' ? 'updated' : 'date' - - var date_icon = theme.post_meta.page.date_type === 'updated' ? 'fa-history' :'fa-calendar' - time.post-meta__date + - var data_type_updated = theme.post_meta.page.date_type === 'updated' + - var date_type = data_type_updated ? 'updated' : 'date' + - var date_icon = data_type_updated ? 'fa-history' :'fa-calendar' + - var date_title = data_type_updated ? _p('post.updated') : _p('post.created') + time.post-meta__date(title=date_title + ' ' + full_date(article[date_type])) i.fa(class=date_icon aria-hidden="true") =date(article[date_type], config.date_format) if (theme.post_meta.page.categories && article.categories.data.length > 0) @@ -56,4 +60,8 @@ each article , index in page.posts.data - content.length > theme.auto_excerpt.length ? expert += ' ...' : '' .content!= expert else - .content!= article.description \ No newline at end of file + .content!= article.description + + if theme.ad && theme.ad.index + if (index + 1) % 3 == 0 + .recent-post-item.ad_height!=theme.ad.index diff --git a/layout/includes/rightside.pug b/layout/includes/rightside.pug index 0c64a3e..88b1ad8 100644 --- a/layout/includes/rightside.pug +++ b/layout/includes/rightside.pug @@ -18,6 +18,6 @@ section#rightside.rightside if is_post() && page.comments !== false && isComment a#to_comment(href="#post-comment" title=_p("rightside.scroll_to_comment")) i.scroll_to_comment.fa.fa-comments - if is_post() && page.toc != false && theme.toc.enable + if is_post() && page.toc !== false && theme.toc.enable && (toc(page.content) !== '' || page.encrypt == true ) i#mobile-toc-button.fa.fa-list-ul.close(title=_p("rightside.toc") aria-hidden="true") i.fa.fa-arrow-up#go-up(title=_p("rightside.back_to_top") aria-hidden="true") diff --git a/layout/includes/sidebar.pug b/layout/includes/sidebar.pug index ac6d5be..435c73a 100644 --- a/layout/includes/sidebar.pug +++ b/layout/includes/sidebar.pug @@ -1,12 +1,16 @@ -#sidebar - - const showToc = is_post() && page.toc != false && theme.toc.enable - - - let tocNumber - if (page.toc_number !== undefined) tocNumber = page.toc_number - else if (theme.toc.number !== undefined) tocNumber = theme.toc.number - else tocNumber = true - - - if(showToc) +- let showToc = is_post() && page.toc !== false && theme.toc.enable && (toc(page.content) !== '' || page.encrypt == true ) +- let autoOpenSidebar = theme.auto_open_sidebar.enable === true ? 'on' : '' + +- + let tocNumber + if (page.toc_number !== undefined) tocNumber = page.toc_number + else if (theme.toc.number !== undefined) tocNumber = theme.toc.number + else tocNumber = true +- + +if(showToc) + i.fa.fa-arrow-right#toggle-sidebar(aria-hidden="true" class=autoOpenSidebar) + #sidebar .sidebar-toc div.sidebar-toc__title= _p('sidebar.catalog') div.sidebar-toc__progress @@ -18,4 +22,4 @@ div.sidebar-toc__content.toc-div-class(style="display:none")!=toc(page.origin, {list_number: tocNumber}) else div.sidebar-toc__content!=toc(page.content, {list_number: tocNumber}) - \ No newline at end of file + \ No newline at end of file diff --git a/layout/includes/widget/card_ad.pug b/layout/includes/widget/card_ad.pug new file mode 100644 index 0000000..c05f774 --- /dev/null +++ b/layout/includes/widget/card_ad.pug @@ -0,0 +1,2 @@ +.card-widget.card-ad + != theme.ad.aside diff --git a/layout/includes/widget/card_author.pug b/layout/includes/widget/card_author.pug index 426697d..c138153 100644 --- a/layout/includes/widget/card_author.pug +++ b/layout/includes/widget/card_author.pug @@ -31,6 +31,4 @@ if(theme.social) .card-info-social-icons.is-center - each url, icon in theme.social - a.social-icon(href=url target="_blank") - i(class=icon aria-hidden="true") + include ../header/social.pug diff --git a/layout/includes/widget/card_recent_post.pug b/layout/includes/widget/card_recent_post.pug index d82fa17..3408887 100644 --- a/layout/includes/widget/card_recent_post.pug +++ b/layout/includes/widget/card_recent_post.pug @@ -20,8 +20,6 @@ img.aside-post-bg(src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` title=title alt=title) .aside-post-title(class=no_cover) .aside-post_title(href=url_for(link) title=article.title || _p('no_title'))= article.title || _p('no_title') - if (theme.post_meta.page.date_type) - - var date_type = theme.post_meta.page.date_type == 'updated' ? 'updated' : 'date' - time.aside-post_meta.post-meta__date #[=date(article[date_type], config.date_format)] + time.aside-post_meta.post-meta__date(title=_p('post.created') + ' ' + full_date(article.date)) #[=date(article.date, config.date_format)] - }) diff --git a/layout/includes/widget/card_webinfo.pug b/layout/includes/widget/card_webinfo.pug index 17903af..5e0f852 100644 --- a/layout/includes/widget/card_webinfo.pug +++ b/layout/includes/widget/card_webinfo.pug @@ -12,6 +12,10 @@ .webinfo-item .webinfo-runtime-name= _p('aside.card_webinfo.runtime_name') + " :" #webinfo-runtime-count.webinfo-runtime-count(start_date=theme.runtimeshow.start_date) + if theme.wordcount.enable && theme.wordcount.total_wordcount + .webinfo-item + .webinfo-site-wordcount-name=_p('aside.card_webinfo.site_wordcount') + " :" + .webinfo-site-wordcount=totalcount(site) if theme.busuanzi.site_uv .webinfo-item .webinfo-site-uv-name= _p('aside.card_webinfo.site_uv_name') + " :" diff --git a/layout/includes/widget/index.pug b/layout/includes/widget/index.pug index 1bd1b48..dc789d4 100644 --- a/layout/includes/widget/index.pug +++ b/layout/includes/widget/index.pug @@ -7,6 +7,8 @@ if theme.aside.enable !=partial('includes/widget/card_announcement', {}, {cache:theme.fragment_cache}) if theme.aside.card_recent_post !=partial('includes/widget/card_recent_post', {}, {cache:theme.fragment_cache}) + if theme.ad && theme.ad.aside + !=partial('includes/widget/card_ad', {}, {cache:theme.fragment_cache}) if theme.aside.card_categories !=partial('includes/widget/card_categories', {}, {cache:theme.fragment_cache}) if theme.aside.card_tags diff --git a/layout/post.pug b/layout/post.pug index b76c765..0411099 100644 --- a/layout/post.pug +++ b/layout/post.pug @@ -8,13 +8,17 @@ block content if (theme.post_meta.post.tags) .post-meta__tag-list each item, index in page.tags.data - a(href=url_for(item.path)).post-meta__tags #[=item.name] + a(href=url_for(item.path)).post-meta__tags #[=item.name] !=partial('includes/share/index', {}, {cache:theme.fragment_cache}) if theme.reward.enable !=partial('includes/post/reward', {}, {cache:theme.fragment_cache}) + + //- ad + if theme.ad && theme.ad.post + .post-ad!=theme.ad.post + include includes/pagination.pug - if theme.related_post && theme.related_post.enable != related_posts(page,site.posts) if page.comments !== false diff --git a/package.json b/package.json index e4c0363..4fdd627 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { "name": "hexo-theme-butterfly", - "version": "2.2.0", + "version": "2.2.5", "description": "A Hexo Theme: Butterfly" } \ No newline at end of file diff --git a/scripts/filters/post-lazyload.js b/scripts/filters/post-lazyload.js index e3c8177..c0a6624 100644 --- a/scripts/filters/post-lazyload.js +++ b/scripts/filters/post-lazyload.js @@ -1,11 +1,10 @@ 'use strict'; -const fs = require('hexo-fs'); const url_for = require('hexo-util').url_for.bind(hexo); function lazyProcess(htmlContent) { var bg = url_for(hexo.theme.config.lodding_bg.post); - return htmlContent.replace(//gi, (str, p1, p2, p3) => { + return htmlContent.replace(//gi, (str, p1, p2, p3) => { if (/data-src/gi.test(str)) { return str; } @@ -14,10 +13,10 @@ function lazyProcess(htmlContent) { return classStr.replace(p1, `${p1} lazyload`); }) str = str.replace(p2, `${bg}`) - return str.replace(p3, `${p3} data-src="${p2}"`); + return str.replace('>', ` data-src="${p2}">`); } str = str.replace(p2, `${bg}`) - return str.replace(p3, `${p3} class="lazyload" data-src="${p2}"`); + return str.replace(p3, ` class="lazyload" data-src="${p2}" ${p3}`); }); } diff --git a/scripts/helpers/list-archives.js b/scripts/helpers/list-archives.js index 10738bc..534d4fe 100644 --- a/scripts/helpers/list-archives.js +++ b/scripts/helpers/list-archives.js @@ -89,7 +89,7 @@ hexo.extend.helper.register("list_archives", function(options = {}) { } if (data.length > limit) { - result += `
  • `; + result += `
  • `; result += `Version -======= Version ->>>>>>> dev Author Hexo node.js diff --git a/README_CN.md b/README_CN.md index 408c4b8..2357f7e 100644 --- a/README_CN.md +++ b/README_CN.md @@ -1,10 +1,6 @@ # hexo-theme-butterfly -<<<<<<< HEAD -Version -======= Version ->>>>>>> dev Author Hexo node.js diff --git a/languages/zh-TW.yml b/languages/zh-TW.yml index da12658..95cb5d3 100644 --- a/languages/zh-TW.yml +++ b/languages/zh-TW.yml @@ -67,11 +67,7 @@ aside: card_webinfo: headline: 網站資訊 article_name: 文章數目 -<<<<<<< HEAD - runtime_name: 已運行時間 -======= runtime_name: 已執行時間 ->>>>>>> dev site_wordcount: 本站總字數 site_uv_name: 本站訪客數 site_pv_name: 本站總訪問量 @@ -84,13 +80,8 @@ bookmark: rightside: readmode_title: 閱讀模式 -<<<<<<< HEAD - font_plus_title: 放大字體 - font_minus_title: 縮小字體 -======= font_plus_title: 放大字型 font_minus_title: 縮小字型 ->>>>>>> dev translate_title: 簡繁轉換 night_mode_title: 夜間模式 back_to_top: 回到頂部 diff --git a/layout/404.pug b/layout/404.pug index 73e6140..b6c2d8c 100644 --- a/layout/404.pug +++ b/layout/404.pug @@ -20,11 +20,5 @@ html(lang=config.language data-theme=theme.display_mode) h1#error_title= '404' #error_subtitle= theme.error_404.subtitle include includes/rightside.pug -<<<<<<< HEAD - include includes/search/index.pug - each item in theme.CDN_USE.js - script(src=url_for(item)) -======= !=partial('includes/search/index', {}, {cache:theme.fragment_cache}) ->>>>>>> dev include includes/additional-js.pug diff --git a/layout/includes/additional-js.pug b/layout/includes/additional-js.pug index 66c9ddb..57ec278 100644 --- a/layout/includes/additional-js.pug +++ b/layout/includes/additional-js.pug @@ -66,13 +66,9 @@ if theme.mermaid.enable include ./math/mermaid.pug if is_home() -<<<<<<< HEAD - include ./head/subtitle.pug -======= include ./head/subtitle.pug !=fragment_cache('injectBottom', function(){return injectHtml(theme.inject.bottom)}) if theme.preloader - !=partial('includes/loading/loading-js', {}, {cache:theme.fragment_cache}) ->>>>>>> dev + !=partial('includes/loading/loading-js', {}, {cache:theme.fragment_cache}) \ No newline at end of file diff --git a/layout/includes/head.pug b/layout/includes/head.pug index bd73505..92a66d5 100644 --- a/layout/includes/head.pug +++ b/layout/includes/head.pug @@ -10,16 +10,10 @@ - var isSubtitle = config.subtitle ? ' - ' + config.subtitle : '' - var tabTitle = is_home() || !pageTitle ? config.title + isSubtitle : pageTitle + ' | ' + config.title -<<<<<<< HEAD -- var pageDescription = page.description || page.title || config.description -- var pageKeywords -- if (page.tags && page.tags.data) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',') -======= - var pageDescription = page_description() - var pageKeywords - if (page.keywords) pageKeywords = Array.isArray(page.keywords) ? (page.keywords).join(',') : ([]).join(',') || page.keywords - else if (page.tags && page.tags.length) pageKeywords = page.tags.data.map(function(tag) {return tag.name;}).join(',') ->>>>>>> dev - else pageKeywords = Array.isArray(config.keywords) ? (config.keywords).join(','): ([]).join(',') || config.keywords - var pageAuthor = config.email ? config.author + ',' + config.email : config.author - var pageCopyright = config.copyright || config.author @@ -106,8 +100,5 @@ if theme.blog_title_font.font_link include ./head/config_site.pug include ./head/noscript.pug -<<<<<<< HEAD -======= -!=fragment_cache('injectHead', function(){return injectHtml(theme.inject.head)}) ->>>>>>> dev +!=fragment_cache('injectHead', function(){return injectHtml(theme.inject.head)}) \ No newline at end of file diff --git a/layout/includes/head/subtitle.pug b/layout/includes/head/subtitle.pug index b216f0c..e3be0dc 100644 --- a/layout/includes/head/subtitle.pug +++ b/layout/includes/head/subtitle.pug @@ -7,103 +7,117 @@ if theme.subtitle.enable if source == '1' script. - var subtitleEffect = !{subtitleEffect} - fetch('https://api.ooopn.com/ciba/api.php',) - .then(function (res){ - return res.json(); - }) - .then(function (data) { - if (subtitleEffect){ - var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(","); - var both = sub.unshift(data['ciba-en'],data.ciba) - var typed = new Typed("#subtitle", { - strings: sub, - startDelay: 300, - typeSpeed: 150, - loop: !{theme.subtitle.loop}, - backSpeed: 50 - }); - }else{ - document.getElementById("subtitle").innerHTML = data['ciba-en'] - } - }) - .catch(function (err) { - console.error(err); - }) + var subtitleType = function () { + var subtitleEffect = !{ subtitleEffect } + fetch('https://api.btstu.cn/yan/api.php?charset=utf-8&encode=json',) + .then(function (res) { + return res.json() + }) + .then(function (data) { + if (subtitleEffect) { + var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(',') + var both = sub.unshift(data.text) + var typed = new Typed('#subtitle', { + strings: sub, + startDelay: 300, + typeSpeed: 150, + loop: !{theme.subtitle.loop}, + backSpeed: 50, + }) + } else { + document.getElementById('subtitle').innerHTML = data.text + } + }) + .catch(function (err) { + console.error(err) + }) + } + window.addEventListener('load', subtitleType) else if source == '2' script. - var subtitleEffect = !{subtitleEffect} - fetch('https://v1.hitokoto.cn') - .then(function (res){ - return res.json(); - }) - .then(function (data) { - if (subtitleEffect){ - var from = '出自 ' + data.from - var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(","); - var both = sub.unshift(data.hitokoto,from) - var typed = new Typed("#subtitle", { - strings: sub, - startDelay: 300, - typeSpeed: 150, - loop: !{theme.subtitle.loop}, - backSpeed: 50 - }); - }else{ - document.getElementById("subtitle").innerHTML = data.hitokoto - } - }) - .catch(function (err) { - console.error(err); - }) - - else if source == "3" - script(type="text/javascript" src="http://yijuzhan.com/api/word.php?m=js") - script. - var subtitleEffect = !{subtitleEffect} - var con = str[0]; - if (subtitleEffect){ - var from = "出自 " + str[1]; - var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(","); - var both = sub.unshift(con,from) - var typed = new Typed("#subtitle", { - strings: sub, - startDelay: 300, - typeSpeed: 150, - loop: !{theme.subtitle.loop}, - backSpeed: 50 - }); - }else{ - document.getElementById("subtitle").innerHTML = con + var subtitleType = function () { + var subtitleEffect = !{ subtitleEffect } + fetch('https://v1.hitokoto.cn') + .then(function (res) { + return res.json() + }) + .then(function (data) { + if (subtitleEffect) { + var from = '出自 ' + data.from + var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(',') + var both = sub.unshift(data.hitokoto, from) + var typed = new Typed('#subtitle', { + strings: sub, + startDelay: 300, + typeSpeed: 150, + loop: !{theme.subtitle.loop}, + backSpeed: 50, + }) + } else { + document.getElementById('subtitle').innerHTML = data.hitokoto + } + }) + .catch(function (err) { + console.error(err) + }) } + window.addEventListener('load', subtitleType) + + else if source == '3' + script. + var subtitleType = function () { + loadScript('http://yijuzhan.com/api/word.php?m=js', function () { + var subtitleEffect = !{ subtitleEffect } + var con = str[0] + if (subtitleEffect) { + var from = '出自 ' + str[1] + var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(',') + var both = sub.unshift(con, from) + var typed = new Typed('#subtitle', { + strings: sub, + startDelay: 300, + typeSpeed: 150, + loop: !{theme.subtitle.loop}, + backSpeed: 50, + }) + } else { + document.getElementById('subtitle').innerHTML = con + } + }) + } + window.addEventListener('load', subtitleType) else if source == '4' - script(type="text/javascript" src="https://sdk.jinrishici.com/v2/browser/jinrishici.js" charset="utf-8") script. - var subtitleEffect = !{subtitleEffect} - jinrishici.load(function(result) { - if (subtitleEffect){ - var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(","); - var content = result.data.content; - var both = sub.unshift(content) - var typed = new Typed("#subtitle", { - strings: sub, - startDelay: 300, - typeSpeed: 150, - loop: !{theme.subtitle.loop}, - backSpeed: 50 - }); - }else{ - document.getElementById("subtitle").innerHTML = result.data.content - } - }) + var subtitleType = function () { + loadScript('https://sdk.jinrishici.com/v2/browser/jinrishici.js',function () { + var subtitleEffect = !{ subtitleEffect } + jinrishici.load(function (result) { + if (subtitleEffect) { + var sub = '!{theme.subtitle.sub}'.length == 0 ? new Array() : '!{theme.subtitle.sub}'.split(',') + var content = result.data.content + var both = sub.unshift(content) + var typed = new Typed('#subtitle', { + strings: sub, + startDelay: 300, + typeSpeed: 150, + loop: !{theme.subtitle.loop}, + backSpeed: 50, + }) + } else { + document.getElementById('subtitle').innerHTML = result.data.content + } + }) + } + ) + } + window.addEventListener('load', subtitleType) else - - var subtitle = theme.subtitle.sub[0] script. var subtitleEffect = !{subtitleEffect} - if (subtitleEffect){ + if (subtitleEffect) { var typed = new Typed("#subtitle", { strings: '!{theme.subtitle.sub}'.split(","), startDelay: 300, @@ -111,6 +125,6 @@ if theme.subtitle.enable loop: !{theme.subtitle.loop}, backSpeed: 50 }) - }else{ - document.getElementById("subtitle").innerHTML = '!{subtitle}' - } + } else { + document.getElementById("subtitle").innerHTML = '!{theme.subtitle.sub[0]}' + } diff --git a/layout/includes/header/header.pug b/layout/includes/header/header.pug index 6fc23e5..3737e76 100644 --- a/layout/includes/header/header.pug +++ b/layout/includes/header/header.pug @@ -8,16 +8,6 @@ a.site-page.social-icon.search i.fa.fa-search.fa-fw span=' '+_p('search') -<<<<<<< HEAD - .menus_items - include ./menu_item.pug - - span.toggle-menu.close - a.site-page - i.fa.fa-bars.fa-fw(aria-hidden="true") - - -======= !=fragment_cache('menus', function(){return partial('includes/header/menu_item')}) span.toggle-menu.close @@ -25,4 +15,3 @@ i.fa.fa-bars.fa-fw(aria-hidden="true") ->>>>>>> dev diff --git a/layout/includes/header/index.pug b/layout/includes/header/index.pug index 727eb51..2c6ede4 100644 --- a/layout/includes/header/index.pug +++ b/layout/includes/header/index.pug @@ -33,11 +33,7 @@ if theme.douban span#subtitle if(theme.social) #site_social_icons -<<<<<<< HEAD - !=partial('includes/header/social', {}, {cache:theme.fragment_cache}) -======= !=fragment_cache('social', function(){return partial('includes/header/social')}) ->>>>>>> dev #scroll_down i.fa.fa-angle-down.scroll-down-effects else if is_post() diff --git a/layout/includes/header/post-info.pug b/layout/includes/header/post-info.pug index b5d066d..7bee8bc 100644 --- a/layout/includes/header/post-info.pug +++ b/layout/includes/header/post-info.pug @@ -69,22 +69,14 @@ span.disqus-comment-count.comment-count a(href=full_url_for(page.path) + '#disqus_thread') else if (theme.valine && theme.valine.enable && theme.valine.count && page.comments !== false) -<<<<<<< HEAD - if (theme.busuanzi && theme.busuanzi.page_pv) -======= if (postWordcount || theme.busuanzi.page_pv) ->>>>>>> dev span.post-meta__separator | i.post-meta__icon(class=commentCount aria-hidden="true") span= _p('post.comments') + ':' a(href=url_for(page.path) + '#post-comment' itemprop="discussionUrl") span.valine-comment-count.comment-count(data-xid=url_for(page.path) itemprop="commentCount") else if (theme.gitalk && theme.gitalk.enable && theme.gitalk.count && page.comments !== false) -<<<<<<< HEAD - if (theme.busuanzi && theme.busuanzi.page_pv) -======= if (postWordcount || theme.busuanzi.page_pv) ->>>>>>> dev span.post-meta__separator | i.post-meta__icon(class=commentCount aria-hidden="true") span= _p('post.comments') + ':' diff --git a/layout/includes/layout.pug b/layout/includes/layout.pug index fc13c50..134b02f 100644 --- a/layout/includes/layout.pug +++ b/layout/includes/layout.pug @@ -41,17 +41,5 @@ html(lang=config.language data-theme=theme.display_mode) !=partial('includes/footer', {}, {cache:theme.fragment_cache}) include ./rightside.pug - !=partial('includes/search/index', {}, {cache:theme.fragment_cache}) -<<<<<<< HEAD - - each item in theme.CDN_USE.js - script(src=url_for(item)) - - include ./additional-js.pug - - - -======= - include ./additional-js.pug ->>>>>>> dev + include ./additional-js.pug \ No newline at end of file diff --git a/layout/includes/mixins/post-ui.pug b/layout/includes/mixins/post-ui.pug index 940d622..4cca5ce 100644 --- a/layout/includes/mixins/post-ui.pug +++ b/layout/includes/mixins/post-ui.pug @@ -62,16 +62,7 @@ mixin postUI(posts) .content!= expert else .content!= article.description -<<<<<<< HEAD:layout/includes/mixins/UI.pug - - if theme.ad && theme.ad.index - if (index + 1) % 3 == 0 - .recent-post-item.ad_height!=theme.ad.index - - - }) -======= if theme.ad && theme.ad.index if (index + 1) % 3 == 0 .recent-post-item.ad_height!=theme.ad.index ->>>>>>> dev:layout/includes/mixins/post-ui.pug diff --git a/layout/includes/recent-posts.pug b/layout/includes/recent-posts.pug deleted file mode 100644 index 46fb9de..0000000 --- a/layout/includes/recent-posts.pug +++ /dev/null @@ -1,67 +0,0 @@ -each article , index in page.posts.data - .recent-post-item - - var link = article.link || article.path - - var title = article.title || _p('no_title') - - var leftOrRight = index%2 == 0 ? 'left_radius' : 'right_radius' - - var post_cover = article.cover - - var no_cover = article.cover === false || !theme.cover.index_enable ? 'no-cover' : '' - if post_cover && theme.cover.index_enable - .post_cover(class=leftOrRight) - a(href=url_for(link) title=title) - if theme.lazyload.enable - img.post_bg.lazyload(data-src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` alt=title) - else - img.post_bg(src=`${post_cover}` onerror=`this.onerror=null;this.src='`+ url_for(theme.lodding_bg.post_page) + `'` alt=title) - .recent-post-info(class=no_cover) - a.article-title(href=url_for(link) title=title)= title - .article-meta-wrap - if (article.top) - span.article-meta - i.fa.fa-thumb-tack.article-meta__icon.sticky - span.sticky= _p('sticky') - span.article-meta__separator | - if (theme.post_meta.page.date_type) - if (theme.post_meta.page.date_type === 'both') - time.post-meta__date - span.post-meta__date-created(title=_p('post.created') + ' ' + full_date(article.date)) - i.fa.fa-calendar(aria-hidden="true") - =date(article.date, config.date_format) - span.article-meta__separator | - span.post-meta__date-updated(title=_p('post.updated') + ' ' + full_date(article.updated)) - i.fa.fa-history(aria-hidden="true") - =date(article.updated, config.date_format) - else - - var data_type_updated = theme.post_meta.page.date_type === 'updated' - - var date_type = data_type_updated ? 'updated' : 'date' - - var date_icon = data_type_updated ? 'fa-history' :'fa-calendar' - - var date_title = data_type_updated ? _p('post.updated') : _p('post.created') - time.post-meta__date(title=date_title + ' ' + full_date(article[date_type])) - i.fa(class=date_icon aria-hidden="true") - =date(article[date_type], config.date_format) - if (theme.post_meta.page.categories && article.categories.data.length > 0) - span.article-meta - span.article-meta__separator | - each item, index in article.categories.data - i.fa.fa-inbox.article-meta__icon(aria-hidden="true") - a(href=url_for(item.path)).article-meta__categories #[=item.name] - if (index < article.categories.data.length - 1) - i.fa.fa-angle-right(aria-hidden="true") - if (theme.post_meta.page.tags && article.tags.data.length > 0) - span.article-meta.tags - span.article-meta__separator | - each item, index in article.tags.data - i.fa.fa-tag.article-meta__icon(aria-hidden="true") - a(href=url_for(item.path)).article-meta__tags #[=item.name] - if (index < article.tags.data.length - 1) - span.article-meta__link - - if theme.auto_excerpt && theme.auto_excerpt.enable - - const content = strip_html(article.content) - - let expert = content.substring(0, theme.auto_excerpt.length) - - content.length > theme.auto_excerpt.length ? expert += ' ...' : '' - .content!= expert - else - .content!= article.description - - if theme.ad && theme.ad.index - if (index + 1) % 3 == 0 - .recent-post-item.ad_height!=theme.ad.index diff --git a/layout/includes/widget/card_author.pug b/layout/includes/widget/card_author.pug index 7588da4..3cae470 100644 --- a/layout/includes/widget/card_author.pug +++ b/layout/includes/widget/card_author.pug @@ -31,8 +31,4 @@ if(theme.social) .card-info-social-icons.is-center -<<<<<<< HEAD - include ../header/social.pug -======= !=fragment_cache('social', function(){return partial('includes/header/social')}) ->>>>>>> dev diff --git a/layout/includes/widget/index.pug b/layout/includes/widget/index.pug index 61d8c48..f37e6c5 100644 --- a/layout/includes/widget/index.pug +++ b/layout/includes/widget/index.pug @@ -9,11 +9,7 @@ if theme.aside.enable !=partial('includes/widget/card_recent_post', {}, {cache:theme.fragment_cache}) if theme.ad && theme.ad.aside !=partial('includes/widget/card_ad', {}, {cache:theme.fragment_cache}) -<<<<<<< HEAD - if theme.aside.card_categories -======= if theme.aside.card_categories.enable ->>>>>>> dev !=partial('includes/widget/card_categories', {}, {cache:theme.fragment_cache}) if theme.aside.card_tags.enable !=partial('includes/widget/card_tags', {}, {cache:theme.fragment_cache}) diff --git a/package.json b/package.json index 26f0b9b..a962bf1 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,5 @@ { "name": "hexo-theme-butterfly", -<<<<<<< HEAD - "version": "2.2.5", - "description": "A Hexo Theme: Butterfly" -======= "version": "2.3.0", "private": true, "engines": { @@ -19,5 +15,4 @@ "repository": "https://github.com/jerryc127/hexo-theme-butterfly.git", "author": "Jerry ", "license": "MIT" ->>>>>>> dev } \ No newline at end of file diff --git a/scripts/filters/post-lazyload.js b/scripts/filters/post-lazyload.js deleted file mode 100644 index c0a6624..0000000 --- a/scripts/filters/post-lazyload.js +++ /dev/null @@ -1,29 +0,0 @@ -'use strict'; - -const url_for = require('hexo-util').url_for.bind(hexo); - -function lazyProcess(htmlContent) { - var bg = url_for(hexo.theme.config.lodding_bg.post); - return htmlContent.replace(//gi, (str, p1, p2, p3) => { - if (/data-src/gi.test(str)) { - return str; - } - if (/class="(.*?)"/gi.test(str)){ - str = str.replace(/class="(.*?)"/gi, (classStr, p1) => { - return classStr.replace(p1, `${p1} lazyload`); - }) - str = str.replace(p2, `${bg}`) - return str.replace('>', ` data-src="${p2}">`); - } - str = str.replace(p2, `${bg}`) - return str.replace(p3, ` class="lazyload" data-src="${p2}" ${p3}`); - }); -} - -var processPost = function(data) { - if (!hexo.theme.config.lazyload.enable) return; - data.content = lazyProcess.call(this, data.content); - return data; -}; - -hexo.extend.filter.register('after_post_render', processPost); \ No newline at end of file diff --git a/scripts/helpers/list-archives.js b/scripts/helpers/list-archives.js deleted file mode 100644 index 534d4fe..0000000 --- a/scripts/helpers/list-archives.js +++ /dev/null @@ -1,103 +0,0 @@ -"use strict"; - -hexo.extend.helper.register("list_archives", function(options = {}) { - const { config } = this; - const archiveDir = config.archive_dir; - const { timezone } = config; - const lang = this.page.lang || this.page.language || config.language; - let { format } = options; - const type = options.type || "monthly"; - const { style = "list", transform, separator = ", " } = options; - const showCount = Object.prototype.hasOwnProperty.call(options, "show_count") - ? options.show_count - : true; - const order = options.order || -1; - const limit = 8; - let result = ""; - - var more_button; - if (lang === "zh-CN") { - more_button = "查看更多"; - } else if (lang === "zh-TW") { - more_button = "查看更多"; - } else { - more_button = "More"; - } - - if (!format) { - format = type === "monthly" ? "MMMM YYYY" : "YYYY"; - } - - const posts = this.site.posts.sort("date", order); - if (!posts.length) return result; - - const data = []; - let length = 0; - - posts.forEach(post => { - // Clone the date object to avoid pollution - let date = post.date.clone(); - - if (timezone) date = date.tz(timezone); - if (lang) date = date.locale(lang); - - const year = date.year(); - const month = date.month() + 1; - const name = date.format(format); - const lastData = data[length - 1]; - - if (!lastData || lastData.name !== name) { - length = data.push({ - name, - year, - month, - count: 1 - }); - } else { - lastData.count++; - } - }); - - const link = item => { - let url = `${archiveDir}/${item.year}/`; - - if (type === "monthly") { - if (item.month < 10) url += "0"; - url += `${item.month}/`; - } - - return this.url_for(url); - }; - - result += `"; - return result; -}); diff --git a/source/css/_global/index.styl b/source/css/_global/index.styl index 1ba9649..834e24a 100644 --- a/source/css/_global/index.styl +++ b/source/css/_global/index.styl @@ -192,13 +192,10 @@ img:not([src]) .img-alt margin: -.5rem 0 .5rem -<<<<<<< HEAD -======= color: $font-black &:hover text-decoration: none !important ->>>>>>> dev // hexo tag video .video-container @@ -222,11 +219,7 @@ img:not([src]) font-size: 20px .post-ad -<<<<<<< HEAD - margin: 2rem 0 !important -======= margin: 2rem 0 ->>>>>>> dev .ad_height display: block !important @@ -239,11 +232,6 @@ img:not([src]) #nav animation: nav-effect 1s -<<<<<<< HEAD -// #page-header -// animation: header-effect 1s -======= ->>>>>>> dev #site_title, #site_subtitle animation: titlescale 1s @@ -284,14 +272,10 @@ if hexo-config('avatar.effect') == true animation: tocsidebarRtoL .4s .sidebar-toc__progress -<<<<<<< HEAD - animation: tocsidebarRtoL .7s -======= animation: tocsidebarRtoL .6s ->>>>>>> dev .sidebar-toc__content - animation: tocsidebarRtoL .9s + animation: tocsidebarRtoL .7s @keyframes scroll-down-effect 0% @@ -315,21 +299,6 @@ if hexo-config('avatar.effect') == true opacity: 1 transform: translateY(0) -<<<<<<< HEAD -@keyframes header-effect - 0% - opacity: 0 - - 60% - opacity: 0 - transform: translateY(-30px) - - 100% - opacity: 1 - transform: translateY(0) - -======= ->>>>>>> dev @keyframes headerNoOpacity 0% transform: translateY(-50px) diff --git a/source/css/_layout/head.styl b/source/css/_layout/head.styl index a8d9f3d..8a92ab5 100644 --- a/source/css/_layout/head.styl +++ b/source/css/_layout/head.styl @@ -246,24 +246,15 @@ content: '' li -<<<<<<< HEAD - padding: 1px 10px list-style: none - text-align: center -======= - list-style: none ->>>>>>> dev &:hover background: $theme-color a -<<<<<<< HEAD -======= display: inline-block padding: .3rem .7rem width: 100% ->>>>>>> dev color: $font-black text-shadow: none @@ -321,13 +312,9 @@ .post-meta-pv-cv .post-meta__separator:first-child -<<<<<<< HEAD - display: none -======= display: none if !hexo-config('busuanzi.page_pv') .post-meta-commentcount .post-meta__separator - display: none ->>>>>>> dev + display: none \ No newline at end of file diff --git a/source/js/main.js b/source/js/main.js index cc233ed..8f05040 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -263,29 +263,11 @@ $(function () { /** * 代碼收縮 */ -<<<<<<< HEAD - const $highlightTools = $('.highlight-tools') - if (isHighlightShrink === 'true') { - $highlightTools.append('') - } else if (isHighlightShrink === 'false') { - $highlightTools.append('') - } - - $(document).on('click', '.highlight-tools >.code-expand', function () { - var $table = $(this).parent().next() - if ($(this).hasClass('code-closed')) { - $table.css('display', 'block') - $(this).removeClass('code-closed') - } else { - $table.css('display', 'none') - $(this).addClass('code-closed') -======= const $highlightTools = $('.highlight-tools') if (isHighlightShrink === 'true') { $highlightTools.append('') } else if (isHighlightShrink === 'false') { $highlightTools.append('') ->>>>>>> dev } $(document).on('click', '.highlight-tools >.code-expand', function () { @@ -790,21 +772,5 @@ $(function () { } } }) -<<<<<<< HEAD - }) - - function addPhotoFigcaption () { - var images = $('#article-container img') - images.each(function (i, o) { - var $this = $(o) - if ($this.attr('alt')) { - var t = $('
    ' + $this.attr('alt') + '
    ') - $this.after(t) - } - }) } - if (GLOBAL_CONFIG.isPhotoFigcaption) addPhotoFigcaption() -======= - } ->>>>>>> dev }) From 727a2d97d983990a5b1be8093285fd83a70f5530 Mon Sep 17 00:00:00 2001 From: Jerry <16351105+jerryc127@users.noreply.github.com> Date: Sat, 18 Jul 2020 23:30:37 +0800 Subject: [PATCH 04/37] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=BE=A9=E5=AD=90?= =?UTF-8?q?=E7=9B=AE=E9=8C=84=E4=B8=8B=EF=BC=8C404=E9=A0=81=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E2=80=98=E5=9B=9E=E5=88=B0=E9=A6=96=E9=A0=81=E2=80=99?= =?UTF-8?q?=E9=8F=88=E6=8E=A5=E9=8C=AF=E8=AA=A4=E7=9A=84bugs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layout/404.pug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/404.pug b/layout/404.pug index 2de0d72..0e6c394 100644 --- a/layout/404.pug +++ b/layout/404.pug @@ -22,7 +22,7 @@ html(lang=config.language data-theme=theme.display_mode) .error-info h1.error_title= '404' .error_subtitle= theme.error_404.subtitle - a.button--animated(href=url_for(config.root)) + a.button--animated(href=config.root) i.fas.fa-rocket = _p('error404.back_button') From 67201ac58d5d82d5a55bf70b62df02418f8e3aa5 Mon Sep 17 00:00:00 2001 From: Jerry <16351105+jerryc127@users.noreply.github.com> Date: Sat, 1 Aug 2020 22:47:34 +0800 Subject: [PATCH 05/37] =?UTF-8?q?:pencil:=20=E6=9B=B4=E6=94=B9=E6=B3=A8?= =?UTF-8?q?=E9=87=8B=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index 7f52dc6..a91983a 100644 --- a/_config.yml +++ b/_config.yml @@ -252,7 +252,7 @@ comments: # - Disqus text: true # Display the comment name next to the button # lazyload: The comment system will be load when comment element enters the browser's viewport. - # If you set it to false, the comment count will be invalid + # If you set it to true, the comment count will be invalid lazyload: false count: false # Display comment count in top_img From e984efa35c316d24588a53d659ab346761e9120d Mon Sep 17 00:00:00 2001 From: Jerry <16351105+jerryc127@users.noreply.github.com> Date: Sun, 6 Sep 2020 22:11:59 +0800 Subject: [PATCH 06/37] =?UTF-8?q?fix:=20=E4=BF=AE=E5=BE=A9=E9=96=8B?= =?UTF-8?q?=E5=95=9F=20prismjs=20=E5=BE=8C=EF=BC=8C=20=E5=9C=A8=E4=BD=8E?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E7=9A=84=20safari=20=E6=9C=83=E5=87=BA?= =?UTF-8?q?=E7=8F=BE=20js=20=E5=A0=B1=E9=8C=AF=E7=9A=84=20Bugs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/js/main.js b/source/js/main.js index a4df270..1cb4463 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -196,7 +196,7 @@ $(function () { const isHighlightLang = GLOBAL_CONFIG.highlight.highlightLang const isHighlightShrink = GLOBAL_CONFIG_SITE.isHighlightShrink const isShowTool = isHighlightCopy || isHighlightLang || isHighlightShrink !== undefined - const $figureHighlight = GLOBAL_CONFIG.highlight.plugin === 'highlighjs' ? $('figure.highlight') : $('pre[class*="language-"') + const $figureHighlight = GLOBAL_CONFIG.highlight.plugin === 'highlighjs' ? $('figure.highlight') : $('pre[class*="language-"]') if (isShowTool && $figureHighlight.length) { const isPrismjs = GLOBAL_CONFIG.highlight.plugin === 'prismjs' From 8e4c20f6d421578919f954eaf2a0ecfde4d2341e Mon Sep 17 00:00:00 2001 From: Jerry <16351105+jerryc127@users.noreply.github.com> Date: Sun, 6 Sep 2020 22:13:37 +0800 Subject: [PATCH 07/37] =?UTF-8?q?label:=20=E6=9B=B4=E6=96=B0=203.1.1=20cho?= =?UTF-8?q?re:=20update=20hexo-renderer-stylus=20to=202.0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c43ca7d..aa26932 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "3.1.0", + "version": "3.1.1", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { @@ -23,7 +23,7 @@ "email": "wong@jerryc.me" }, "dependencies": { - "hexo-renderer-stylus": "^2.0.0", + "hexo-renderer-stylus": "^2.0.1", "hexo-renderer-pug": "^1.0.0" }, "homepage": "https://demo.jerryc.me/", From cd78f639dd60de2e28ae32feec68541665fedf90 Mon Sep 17 00:00:00 2001 From: gcmiao Date: Thu, 10 Sep 2020 21:09:23 +0200 Subject: [PATCH 08/37] Add a flag for allowing to disable aside.card_author.button --- layout/includes/widget/card_author.pug | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/layout/includes/widget/card_author.pug b/layout/includes/widget/card_author.pug index 5b1c8e4..8fe086c 100644 --- a/layout/includes/widget/card_author.pug +++ b/layout/includes/widget/card_author.pug @@ -27,9 +27,10 @@ .headline= _p('aside.categories') .length_num= site.categories.length - a#card-info-btn.button--animated(href=theme.aside.card_author.button.link) - i(class=theme.aside.card_author.button.icon) - span=theme.aside.card_author.button.text + if theme.aside.card_author.button.enable + a#card-info-btn.button--animated(href=theme.aside.card_author.button.link) + i(class=theme.aside.card_author.button.icon) + span=theme.aside.card_author.button.text if(theme.social) .card-info-social-icons.is-center From d4b69051aaf18a37f45f10c3bcb1a9ca535d8177 Mon Sep 17 00:00:00 2001 From: Jerry Wong Date: Sat, 12 Sep 2020 02:41:12 +0800 Subject: [PATCH 09/37] Revert "Add a flag for allowing to disable aside.card_author.button" --- layout/includes/widget/card_author.pug | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/layout/includes/widget/card_author.pug b/layout/includes/widget/card_author.pug index 8fe086c..5b1c8e4 100644 --- a/layout/includes/widget/card_author.pug +++ b/layout/includes/widget/card_author.pug @@ -27,10 +27,9 @@ .headline= _p('aside.categories') .length_num= site.categories.length - if theme.aside.card_author.button.enable - a#card-info-btn.button--animated(href=theme.aside.card_author.button.link) - i(class=theme.aside.card_author.button.icon) - span=theme.aside.card_author.button.text + a#card-info-btn.button--animated(href=theme.aside.card_author.button.link) + i(class=theme.aside.card_author.button.icon) + span=theme.aside.card_author.button.text if(theme.social) .card-info-social-icons.is-center From 4a69c623fc5d205ca483ebb8faeea239e2eb4d57 Mon Sep 17 00:00:00 2001 From: Jerry Date: Sun, 27 Dec 2020 15:51:00 +0800 Subject: [PATCH 10/37] =?UTF-8?q?fix:=20=E4=BF=AE=E5=BE=A9=E9=96=8B?= =?UTF-8?q?=E5=95=9Fgitalk=E8=A9=95=E8=AB=96=E6=95=B8=E5=BE=8C=E8=88=87toc?= =?UTF-8?q?=E8=A1=9D=E7=AA=81=E7=9A=84bug=20close=20#462=20fix:=20?= =?UTF-8?q?=E4=BF=AE=E5=BE=A9jquery=E5=9C=A8=E4=B8=80=E4=BA=9B=E4=BB=8B?= =?UTF-8?q?=E9=9D=A2=E4=BB=8D=E7=84=B6=E8=BC=89=E5=85=A5=E5=95=8F=E9=A1=8C?= =?UTF-8?q?=20fix:=20=E4=BF=AE=E5=BE=A9medium=20zoom=20=E5=A0=B1=E9=8C=AF?= =?UTF-8?q?=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layout/includes/header/post-info.pug | 2 +- package.json | 2 +- source/js/main.js | 62 ++++++++++++++-------------- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/layout/includes/header/post-info.pug b/layout/includes/header/post-info.pug index 96f1e9b..316a506 100644 --- a/layout/includes/header/post-info.pug +++ b/layout/includes/header/post-info.pug @@ -77,7 +77,7 @@ else if whichCount === 'Gitalk' +countBlock a(href=url_for(page.path) + '#post-comment') - span.gitalk-#card-toc + span.gitalk-comment-count else if whichCount === 'Twikoo' +countBlock a(href=url_for(page.path) + '#post-comment') diff --git a/package.json b/package.json index 3039164..11aed36 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "3.4.1", + "version": "3.4.2", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { diff --git a/source/js/main.js b/source/js/main.js index 15a8081..f32b446 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -247,40 +247,38 @@ document.addEventListener('DOMContentLoaded', function () { * fancybox和 mediumZoom */ const addFancybox = function (ele) { - if (ele.length) { - const runFancybox = (ele) => { - ele.each(function (i, o) { - const $this = $(o) - const lazyloadSrc = $this.attr('data-lazy-src') || $this.attr('src') - const dataCaption = $this.attr('alt') || '' - $this.wrap(``) - }) + const runFancybox = (ele) => { + ele.each(function (i, o) { + const $this = $(o) + const lazyloadSrc = $this.attr('data-lazy-src') || $this.attr('src') + const dataCaption = $this.attr('alt') || '' + $this.wrap(``) + }) - $().fancybox({ - selector: '[data-fancybox]', - loop: true, - transitionEffect: 'slide', - protect: true, - buttons: ['slideShow', 'fullScreen', 'thumbs', 'close'], - hash: false - }) - } + $().fancybox({ + selector: '[data-fancybox]', + loop: true, + transitionEffect: 'slide', + protect: true, + buttons: ['slideShow', 'fullScreen', 'thumbs', 'close'], + hash: false + }) + } - if (typeof $.fancybox === 'undefined') { - $('head').append(``) - $.getScript(`${GLOBAL_CONFIG.source.fancybox.js}`, function () { - runFancybox($(ele)) - }) - } else { + if (typeof $.fancybox === 'undefined') { + $('head').append(``) + $.getScript(`${GLOBAL_CONFIG.source.fancybox.js}`, function () { runFancybox($(ele)) - } + }) + } else { + runFancybox($(ele)) } } const addMediumZoom = () => { const zoom = mediumZoom(document.querySelectorAll('#article-container :not(a)>img')) zoom.on('open', e => { - const photoBg = $(document.documentElement).attr('data-theme') === 'dark' ? '#121212' : '#fff' + const photoBg = document.documentElement.getAttribute('data-theme') === 'dark' ? '#121212' : '#fff' zoom.update({ background: photoBg }) @@ -288,15 +286,17 @@ document.addEventListener('DOMContentLoaded', function () { } const jqLoadAndRun = () => { - const isFancybox = GLOBAL_CONFIG.lightbox === 'fancybox' - const $fancyboxEle = isFancybox ? document.querySelectorAll('#article-container :not(a):not(.gallery-group) > img, #article-container > img') : null + const $fancyboxEle = GLOBAL_CONFIG.lightbox === 'fancybox' + ? document.querySelectorAll('#article-container :not(a):not(.gallery-group) > img, #article-container > img') + : [] + const fbLengthNoZero = $fancyboxEle.length > 0 const $jgEle = document.querySelectorAll('#article-container .justified-gallery') - const jgEleLength = $jgEle.length + const jgLengthNoZero = $jgEle.length > 0 - if (jgEleLength || $fancyboxEle !== null) { + if (jgLengthNoZero || fbLengthNoZero) { btf.isJqueryLoad(() => { - jgEleLength && runJustifiedGallery($jgEle) - isFancybox && addFancybox($fancyboxEle) + jgLengthNoZero && runJustifiedGallery($jgEle) + fbLengthNoZero && addFancybox($fancyboxEle) }) } } From 637da0702b5dd3471628220286dbbc0bc557fb10 Mon Sep 17 00:00:00 2001 From: Jerry Date: Tue, 30 Mar 2021 01:31:17 +0800 Subject: [PATCH 11/37] =?UTF-8?q?fix:=20=E4=BF=AE=E5=BE=A9=20github-issues?= =?UTF-8?q?=20=E6=9C=80=E6=96=B0=E8=A9=95=E8=AB=96=20=E7=8D=B2=E5=8F=96?= =?UTF-8?q?=E7=9A=84url=E6=A0=BC=E5=BC=8F=20bug=20fix:=20=E7=95=B6?= =?UTF-8?q?=E6=A8=99=E9=A1=8C=E6=9C=89=E7=AC=A6=E8=99=9F'=E6=99=82?= =?UTF-8?q?=EF=BC=8Cdisqus=20=E5=92=8C=20disqusjs=20=E7=84=A1=E6=B3=95?= =?UTF-8?q?=E5=8A=A0=E8=BC=89=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layout/includes/third-party/comments/disqus.pug | 4 +++- layout/includes/third-party/comments/disqusjs.pug | 5 +++-- .../third-party/newest-comments/github-issues.pug | 14 ++++---------- package.json | 2 +- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/layout/includes/third-party/comments/disqus.pug b/layout/includes/third-party/comments/disqus.pug index fd44d2a..4c2c727 100644 --- a/layout/includes/third-party/comments/disqus.pug +++ b/layout/includes/third-party/comments/disqus.pug @@ -1,9 +1,11 @@ +- let disqusPageTitle = page.title.replace(/'/ig,"\\'") + script. function loadDisqus () { var disqus_config = function () { this.page.url = '!{ page.permalink }' this.page.identifier = '!{ page.path }' - this.page.title = '!{ page.title }' + this.page.title = '!{ disqusPageTitle }' }; window.disqusReset = () => { diff --git a/layout/includes/third-party/comments/disqusjs.pug b/layout/includes/third-party/comments/disqusjs.pug index 0e8d2f9..d1310b9 100644 --- a/layout/includes/third-party/comments/disqusjs.pug +++ b/layout/includes/third-party/comments/disqusjs.pug @@ -1,4 +1,6 @@ - let disqusjsApi = theme.disqusjs.api || 'https://disqus.skk.moe/disqus/' +- let disqusjsPageTitle = page.title.replace(/'/ig,"\\'") + script. function loadDisqusjs () { function addDisqusjsCSS () { @@ -15,7 +17,7 @@ script. siteName: '!{theme.disqusjs.siteName}', identifier: '!{ page.path }', url: '!{ page.permalink }', - title: '!{ page.title }', + title: '!{ disqusjsPageTitle }', api: '!{disqusjsApi}', apikey: '!{theme.disqusjs.apikey}', nocomment: '!{theme.disqusjs.nocomment}', @@ -55,4 +57,3 @@ if is_post() && !theme.comments.lazyload && theme.comments.count && theme.commen } else { DISQUSWIDGETS.getCount({reset: true}); } - diff --git a/layout/includes/third-party/newest-comments/github-issues.pug b/layout/includes/third-party/newest-comments/github-issues.pug index e561f95..bfc4341 100644 --- a/layout/includes/third-party/newest-comments/github-issues.pug +++ b/layout/includes/third-party/newest-comments/github-issues.pug @@ -15,15 +15,13 @@ script. } const findTrueUrl = (array) => { - let url = '' Promise.all(array.map(item => fetch(item.url).then(resp => resp.json()).then(data => { + const urlArray = data.body.match(/(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?/ig) if (data.user.login === 'utterances-bot') { - url = data.body.match(/https?\:\/\/[^\" ]+/ig).slice(-1) - return url[0] + return urlArray.pop() } else { - url = data.body.match(/https?\:\/\/[^\" ]+/i) - return url[0] + return urlArray.shift() } }) )).then(res => { @@ -104,8 +102,4 @@ script. newestCommentInit() document.addEventListener('pjax:complete', newestCommentInit) - }) - - - - + }) \ No newline at end of file diff --git a/package.json b/package.json index ac48e90..1b51e2e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "3.7.0", + "version": "3.7.1", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { From c439930786785805cf8eb64f64c7b0cb2f8e64bd Mon Sep 17 00:00:00 2001 From: Jerry Date: Sun, 9 May 2021 00:52:09 +0800 Subject: [PATCH 12/37] =?UTF-8?q?fix:=20=E4=BF=AE=E5=BE=A9=E6=A8=99?= =?UTF-8?q?=E9=A1=8C/=E5=8D=9A=E5=AE=A2=E5=90=8D=E6=9C=89=20=E2=80=98=20?= =?UTF-8?q?=E6=99=82=EF=BC=8Cpjax=20=E6=9C=83=E5=A0=B1=E9=8C=AF=E7=9A=84bu?= =?UTF-8?q?g=20improvement:=20css=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layout/includes/head/config_site.pug | 4 +++- package.json | 2 +- source/css/_layout/post.styl | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/layout/includes/head/config_site.pug b/layout/includes/head/config_site.pug index 2dbd463..1d78e98 100644 --- a/layout/includes/head/config_site.pug +++ b/layout/includes/head/config_site.pug @@ -6,11 +6,13 @@ 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,"\\'") - script#config-diff. var GLOBAL_CONFIG_SITE = { - title: '!{pageTitle}', + title: '!{titleVal}', isPost: !{is_post()}, isHome: !{is_home()}, isHighlightShrink: !{isHighlightShrink}, diff --git a/package.json b/package.json index e61a077..9b224fa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "3.7.5", + "version": "3.7.6", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { diff --git a/source/css/_layout/post.styl b/source/css/_layout/post.styl index c4f9099..2785ae1 100644 --- a/source/css/_layout/post.styl +++ b/source/css/_layout/post.styl @@ -185,6 +185,9 @@ no-beautify() else no-beautify() + > :last-child + margin-bottom: 0 !important + #post .tag_share .post-meta From 54c6a509c74d0926663158dfe00d3f7beac28319 Mon Sep 17 00:00:00 2001 From: Jerry Date: Sat, 5 Jun 2021 00:35:23 +0800 Subject: [PATCH 13/37] =?UTF-8?q?breaking=20changes:=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=20waline=20=E7=9A=84=20emojiCDN=20=E5=92=8C=20emojiMaps=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=20fix:=20=E4=BF=AE=E5=BE=A9=20=E5=8D=87?= =?UTF-8?q?=E7=B4=9A=E5=88=B0=20waline=201.x=20=E8=80=8C=E5=87=BA=E7=8F=BE?= =?UTF-8?q?=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 1 - layout/includes/third-party/card-post-count/waline.pug | 2 +- layout/includes/third-party/comments/waline.pug | 6 ------ layout/includes/third-party/newest-comments/waline.pug | 7 +++---- package.json | 2 +- 5 files changed, 5 insertions(+), 13 deletions(-) diff --git a/_config.yml b/_config.yml index dbd1363..5df17fa 100644 --- a/_config.yml +++ b/_config.yml @@ -331,7 +331,6 @@ valine: waline: serverURL: # Waline server address url avatar: monsterid # gravatar style https://zh-tw.gravatar.com/site/implement/images/#default-image - emojiCDN: # emoji CDN bg: # waline background visitor: false option: diff --git a/layout/includes/third-party/card-post-count/waline.pug b/layout/includes/third-party/card-post-count/waline.pug index f823c1e..e748d86 100644 --- a/layout/includes/third-party/card-post-count/waline.pug +++ b/layout/includes/third-party/card-post-count/waline.pug @@ -3,7 +3,7 @@ script. function loadWaline () { function initWaline () { let initData = { - el: '#waline-wrap', + el: null, serverURL: '!{theme.waline.serverURL}', } diff --git a/layout/includes/third-party/comments/waline.pug b/layout/includes/third-party/comments/waline.pug index 0804536..275da02 100644 --- a/layout/includes/third-party/comments/waline.pug +++ b/layout/includes/third-party/comments/waline.pug @@ -1,7 +1,3 @@ -- let emojiMaps = '""' -if site.data.waline - - emojiMaps = JSON.stringify(site.data.waline) - script. function loadWaline () { function initWaline () { @@ -10,8 +6,6 @@ script. serverURL: '!{theme.waline.serverURL}', avatar: '#{theme.waline.avatar}', path: location.pathname, - emojiCDN: '#{theme.waline.emojiCDN}', - emojiMaps: !{emojiMaps}, visitor: #{theme.waline.visitor}, dark: '[data-theme="dark"]' }, !{JSON.stringify(theme.waline.option)})) diff --git a/layout/includes/third-party/newest-comments/waline.pug b/layout/includes/third-party/newest-comments/waline.pug index 8a09847..580beae 100644 --- a/layout/includes/third-party/newest-comments/waline.pug +++ b/layout/includes/third-party/newest-comments/waline.pug @@ -53,11 +53,10 @@ script. const getComment = () => { const loadWaline = () => { Waline.Widget.RecentComments({ - el: '#card-newest-comments .aside-list', serverURL: '!{theme.waline.serverURL}', count: !{theme.newest_comments.limit} - }).then(comments => { - const walineArray = comments.map(function (e) { + }).then(res => { + const walineArray = res.comments.map(e => { return { 'content': changeContent(e.comment), 'avatar': getIcon(e.QQAvatar,e.mail), @@ -91,4 +90,4 @@ script. newestCommentInit() document.addEventListener('pjax:complete', newestCommentInit) - }) + }) \ No newline at end of file diff --git a/package.json b/package.json index 0bbc312..f4c9c2f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "3.7.7", + "version": "3.7.8", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { From 7c859ef66d8d70b4da67913c5397a1f19475b2fd Mon Sep 17 00:00:00 2001 From: Jerry Date: Tue, 20 Jul 2021 23:09:57 +0800 Subject: [PATCH 14/37] =?UTF-8?q?fix:=20=E4=BF=AE=E5=BE=A9=20footer=20?= =?UTF-8?q?=E5=9C=A8=E9=83=A8=E5=88=86=E7=80=8F=E8=A6=BD=E5=99=A8=E6=B2=92?= =?UTF-8?q?=E6=9C=89=E9=A1=AF=E7=A4=BA=E5=9C=A8=E5=BA=95=E9=83=A8=E7=9A=84?= =?UTF-8?q?=20bug=20close=20#616?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- source/css/_layout/head.styl | 8 ++++---- source/css/_page/common.styl | 2 +- source/css/var.styl | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 4a9118b..6bfab0b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "3.8.1", + "version": "3.8.2", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { diff --git a/source/css/_layout/head.styl b/source/css/_layout/head.styl index cefba44..bcd740a 100644 --- a/source/css/_layout/head.styl +++ b/source/css/_layout/head.styl @@ -9,7 +9,7 @@ // index &.full_page - min-height: $index_top_img_height + height: $index_top_img_height background-attachment: fixed #site-info @@ -70,7 +70,7 @@ // page &.not-home-page - min-height: 20rem + height: 20rem +maxWidth768() height: 14rem @@ -86,7 +86,7 @@ // post &.post-bg - min-height: 20rem + height: 20rem +maxWidth768() height: 18rem @@ -118,7 +118,7 @@ &.not-top-img margin-bottom: .5rem - min-height: 60px + height: 60px background: 0 #nav diff --git a/source/css/_page/common.styl b/source/css/_page/common.styl index 4076804..c695216 100644 --- a/source/css/_page/common.styl +++ b/source/css/_page/common.styl @@ -1,7 +1,7 @@ #body-wrap display: flex flex-direction: column - height: 100vh + min-height: 100vh .layout display: flex diff --git a/source/css/var.styl b/source/css/var.styl index 6205406..87e1503 100644 --- a/source/css/var.styl +++ b/source/css/var.styl @@ -33,7 +33,7 @@ $font-color = #1F2D3D $rem = 20px $text-line-height = 2 $web-bg = hexo-config('background') && unquote(hexo-config('background')) -$index_top_img_height = hexo-config('index_top_img_height') ? convert(hexo-config('index_top_img_height')) : 100% +$index_top_img_height = hexo-config('index_top_img_height') ? convert(hexo-config('index_top_img_height')) : 100vh $index_site_info_top = hexo-config('index_site_info_top') ? convert(hexo-config('index_site_info_top')) : 43% // Global color & SVG $light-blue = $theme-color From 641fb56b22daf602af8f3b6ff8134c354e1a2977 Mon Sep 17 00:00:00 2001 From: Jerry Date: Tue, 20 Jul 2021 23:19:14 +0800 Subject: [PATCH 15/37] =?UTF-8?q?improvement:=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E8=A8=BB=E9=87=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_config.yml b/_config.yml index fa6cadb..830d498 100644 --- a/_config.yml +++ b/_config.yml @@ -461,9 +461,9 @@ google_adsense: # -------------------------------------- site_verification: - # - name: google_site_verification + # - name: google-site-verification # content: xxxxxx - # - name: baidu_site_verification + # - name: baidu-site-verification # content: xxxxxxx # Beautify/Effect (美化/效果) From 101cb45b90a4b8ad6222201db3580869bf252eac Mon Sep 17 00:00:00 2001 From: Jerry Date: Fri, 30 Jul 2021 01:00:32 +0800 Subject: [PATCH 16/37] =?UTF-8?q?fix:=20Waline=20=E8=A9=95=E8=AB=96?= =?UTF-8?q?=E7=B3=BB=E7=B5=B1=20=E8=A8=AD=E7=BD=AE=20avatarCDN=20=E7=84=A1?= =?UTF-8?q?=E6=95=88=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layout/includes/third-party/comments/waline.pug | 11 +++++++---- package.json | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/layout/includes/third-party/comments/waline.pug b/layout/includes/third-party/comments/waline.pug index ae1a382..2407e4a 100644 --- a/layout/includes/third-party/comments/waline.pug +++ b/layout/includes/third-party/comments/waline.pug @@ -1,14 +1,17 @@ +- const { serverURL, avatar, avatarCDN, visitor, option } = theme.waline + script. function loadWaline () { function initWaline () { const waline = new Waline(Object.assign({ el: '#waline-wrap', - serverURL: '!{theme.waline.serverURL}', - avatar: '#{theme.waline.avatar}', + serverURL: '!{serverURL}', + avatar: '#{avatar}', + avatarCDN: '!{avatarCDN || "https://sdn.geekzu.org/avatar/"}', path: location.pathname, - visitor: #{theme.waline.visitor}, + visitor: !{visitor}, dark: 'html[data-theme="dark"]' - }, !{JSON.stringify(theme.waline.option)})) + }, !{JSON.stringify(option)})) } if (typeof Waline === 'function') initWaline() diff --git a/package.json b/package.json index 6bfab0b..edd6bd6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "3.8.2", + "version": "3.8.3", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { From de8e35d0d0a54f024ca4f748083490ad0f8d4cce Mon Sep 17 00:00:00 2001 From: Jerry Date: Sat, 18 Sep 2021 22:10:50 +0800 Subject: [PATCH 17/37] =?UTF-8?q?fix:=20=E4=BF=AE=E5=BE=A9=E9=96=8B?= =?UTF-8?q?=E5=95=9F=20photofigcaption=20=E5=BE=8C=EF=BC=8C=E5=B0=8E?= =?UTF-8?q?=E8=87=B4=20inlineImg=20=E6=A8=99=E7=B1=A4=E5=A4=96=E6=8E=9B?= =?UTF-8?q?=E9=A1=AF=E7=A4=BA=E9=8C=AF=E4=BA=82=E7=9A=84=20bug=20close=20#?= =?UTF-8?q?667=20fix:=20=E4=BF=AE=E5=BE=A9=E4=BD=BF=E7=94=A8=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E6=90=9C=E7=B4=A2=E6=99=82=EF=BC=8C=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E9=85=8D=E7=BD=AE=E7=82=BA=E4=B8=8D=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=96=87=E7=AB=A0=E5=85=A7=E5=AE=B9=E6=9C=83=E7=84=A1?= =?UTF-8?q?=E6=B3=95=E4=BD=BF=E7=94=A8=E6=90=9C=E7=B4=A2=E7=9A=84=20bug=20?= =?UTF-8?q?close=20#666=20fix:=20=E4=BF=AE=E5=BE=A9=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E5=B0=8E=E8=87=B4=E7=9B=B8=E9=97=9C=E6=96=87=E7=AB=A0=E9=8F=88?= =?UTF-8?q?=E6=8E=A5=E5=87=BA=E9=8C=AF=E7=9A=84=20bug=20close=20#549=20imp?= =?UTF-8?q?rovement:=20=E8=AA=BF=E6=95=B4=E4=BB=A3=E7=A2=BC=E6=A1=86?= =?UTF-8?q?=E6=BB=BE=E5=8B=95=E6=A2=9D=E9=A1=8F=E8=89=B2=20close=20#651=20?= =?UTF-8?q?improvement:=20=E7=95=B6=E5=9C=96=E7=89=87=E6=B2=92=E6=9C=89=20?= =?UTF-8?q?figcaption=20=E6=99=82=EF=BC=8C=E4=B8=8D=E6=9C=83=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=20figcaption=20=E4=BB=A3=E7=A2=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++-- scripts/helpers/related_post.js | 34 ++++++-------------------------- source/css/_highlight/theme.styl | 6 +++--- source/js/main.js | 5 +++-- source/js/search/local-search.js | 3 ++- 5 files changed, 16 insertions(+), 36 deletions(-) diff --git a/package.json b/package.json index edd6bd6..6b7b5e8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "3.8.3", + "version": "3.8.4", "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/helpers/related_post.js b/scripts/helpers/related_post.js index 1e7efd4..2f8371a 100644 --- a/scripts/helpers/related_post.js +++ b/scripts/helpers/related_post.js @@ -46,11 +46,7 @@ hexo.extend.helper.register('related_posts', function (currentPost, allPosts) { if (relatedPosts.length > 0) { result += '