From 43790dec07ea34e0fe90f3d854b6c9b020e64d34 Mon Sep 17 00:00:00 2001 From: Jerry Date: Tue, 20 Jul 2021 23:56:40 +0800 Subject: [PATCH 01/16] =?UTF-8?q?breaking=20changes:=20=E7=B2=BE=E7=B0=A1?= =?UTF-8?q?=E5=90=84=E8=A9=95=E8=AB=96=E7=9A=84=E9=85=8D=E7=BD=AE=20fix:?= =?UTF-8?q?=20=E4=BF=AE=E5=BE=A9footer=20=E5=9C=A8=E9=83=A8=E5=88=86?= =?UTF-8?q?=E7=80=8F=E8=A6=BD=E5=99=A8=E6=B2=92=E6=9C=89=E9=A1=AF=E7=A4=BA?= =?UTF-8?q?=E5=9C=A8=E5=BA=95=E9=83=A8=E7=9A=84=20bug=20improvement:=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E8=A8=BB?= =?UTF-8?q?=E9=87=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 23 +++---------------- .../third-party/comments/disqusjs.pug | 11 +++------ .../includes/third-party/comments/gitalk.pug | 5 ---- .../includes/third-party/comments/valine.pug | 8 ------- package.json | 2 +- source/css/_global/index.styl | 4 ++-- source/css/_layout/head.styl | 8 +++---- source/css/_page/common.styl | 2 +- source/css/var.styl | 2 +- 9 files changed, 15 insertions(+), 50 deletions(-) diff --git a/_config.yml b/_config.yml index fa6cadb59..a09855500 100644 --- a/_config.yml +++ b/_config.yml @@ -281,12 +281,8 @@ disqus: # https://github.com/SukkaW/DisqusJS disqusjs: shortname: - siteName: apikey: - api: - nocomment: # display when a blog post or an article has no comment attached - admin: - adminLabel: + option: # livere (來必力) # https://www.livere.com/ @@ -301,11 +297,6 @@ gitalk: repo: owner: admin: - language: en # en, zh-CN, zh-TW, es-ES, fr, ru - perPage: 10 # Pagination size, with maximum 100. - distractionFreeMode: false # Facebook-like distraction free mode. - pagerDirection: last # Comment sorting direction, available values are last and first. - createIssueManually: false # Gitalk will create a corresponding github issue for your every single page automatically option: # valine @@ -313,17 +304,9 @@ gitalk: valine: appId: # leancloud application app id appKey: # leancloud application app key - pageSize: 10 # comment list page size avatar: monsterid # gravatar style https://valine.js.org/#/avatar - lang: en # i18n: zh-CN/zh-TW/en/ja - placeholder: Please leave your footprints # valine comment input placeholder (like: Please leave your footprints) - guest_info: nick,mail,link # valine comment header info (nick/mail/link) - recordIP: false # Record reviewer IP serverURLs: # This configuration is suitable for domestic custom domain name users, overseas version will be automatically detected (no need to manually fill in) bg: # valine background - emojiCDN: # emoji CDN - enableQQ: false # enable the Nickname box to automatically get QQ Nickname and QQ Avatar - requiredFields: nick,mail # required fields (nick/mail) visitor: false option: @@ -461,9 +444,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 (美化/效果) diff --git a/layout/includes/third-party/comments/disqusjs.pug b/layout/includes/third-party/comments/disqusjs.pug index e88849aee..268c16f3e 100644 --- a/layout/includes/third-party/comments/disqusjs.pug +++ b/layout/includes/third-party/comments/disqusjs.pug @@ -1,4 +1,3 @@ -- let disqusjsApi = theme.disqusjs.api || 'https://disqus.skk.moe/disqus/' - let disqusjsPageTitle = page.title.replace(/'/ig,"\\'") script. @@ -12,20 +11,16 @@ script. function initDisqusjs () { window.DISQUS = null - new DisqusJS({ + new DisqusJS(Object.assign({ shortname: '!{theme.disqusjs.shortname}', - siteName: '!{theme.disqusjs.siteName}', identifier: '!{ page.path }', url: '!{ page.permalink }', title: '!{ disqusjsPageTitle }', - api: '!{disqusjsApi}', apikey: '!{theme.disqusjs.apikey}', - nocomment: '!{theme.disqusjs.nocomment}', - admin: '!{theme.disqusjs.admin}', - adminLabel: '!{theme.disqusjs.adminLabel}' - }); + },!{JSON.stringify(theme.disqusjs.option)})) } + window.disqusReset = initDisqusjs if (window.disqusJsLoad) initDisqusjs() diff --git a/layout/includes/third-party/comments/gitalk.pug b/layout/includes/third-party/comments/gitalk.pug index 8e78386a0..06ecfd964 100644 --- a/layout/includes/third-party/comments/gitalk.pug +++ b/layout/includes/third-party/comments/gitalk.pug @@ -15,11 +15,6 @@ script. owner: '!{theme.gitalk.owner}', admin: ['!{theme.gitalk.admin}'], id: '!{md5(page.path)}', - language: '!{theme.gitalk.language}', - perPage: !{theme.gitalk.perPage}, - distractionFreeMode: !{theme.gitalk.distractionFreeMode}, - pagerDirection: '!{theme.gitalk.pagerDirection}', - createIssueManually: !{theme.gitalk.createIssueManually}, updateCountCallback: commentCount },!{JSON.stringify(theme.gitalk.option)})) diff --git a/layout/includes/third-party/comments/valine.pug b/layout/includes/third-party/comments/valine.pug index d5121bc82..91b3110d8 100644 --- a/layout/includes/third-party/comments/valine.pug +++ b/layout/includes/third-party/comments/valine.pug @@ -9,18 +9,10 @@ script. el: '#vcomment', appId: '#{theme.valine.appId}', appKey: '#{theme.valine.appKey}', - placeholder: '#{theme.valine.placeholder}', avatar: '#{theme.valine.avatar}', - meta: '#{theme.valine.guest_info }'.split(','), - pageSize: '#{theme.valine.pageSize}', - lang: '#{theme.valine.lang}', - recordIP: #{theme.valine.recordIP}, serverURLs: '#{theme.valine.serverURLs}', - emojiCDN: '#{theme.valine.emojiCDN}', emojiMaps: !{emojiMaps}, - enableQQ: #{theme.valine.enableQQ}, path: window.location.pathname, - requiredFields: [!{theme.valine.requiredFields ? JSON.stringify(theme.valine.requiredFields).split(',') : ''}], visitor: #{theme.valine.visitor} }, !{JSON.stringify(theme.valine.option)})) } diff --git a/package.json b/package.json index 4a9118bf5..c8b5a00e1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "3.8.1", + "version": "4.0.0-b1", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { diff --git a/source/css/_global/index.styl b/source/css/_global/index.styl index 058667193..8edc7f8c7 100644 --- a/source/css/_global/index.styl +++ b/source/css/_global/index.styl @@ -27,8 +27,8 @@ --blockquote-bg: $blockquote-background-color --reward-pop: $reward-pop-up-bg --toc-link-color: $toc-link-color - --card-box-shadow: 0 3px 8px 6px rgba(7, 17, 27, .06) - --card-hover-box-shadow: 0 3px 8px 6px rgba(7, 17, 27, .15) + --card-box-shadow: 0 3px 8px 6px rgba(7, 17, 27, .05) + --card-hover-box-shadow: 0 3px 8px 6px rgba(7, 17, 27, .09) html height: 100% diff --git a/source/css/_layout/head.styl b/source/css/_layout/head.styl index cefba44f2..bcd740a8e 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 40768049a..c69521646 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 620540648..87e1503d5 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 45d6ced50792a149ec0a090e4d35cc431f082faa Mon Sep 17 00:00:00 2001 From: Jerry Date: Fri, 30 Jul 2021 01:09:55 +0800 Subject: [PATCH 02/16] =?UTF-8?q?=E4=BF=AE=E5=BE=A9=20Waline=20=E8=A9=95?= =?UTF-8?q?=E8=AB=96=E7=B3=BB=E7=B5=B1=20=E8=A8=AD=E7=BD=AE=20avatarCDN=20?= =?UTF-8?q?=E7=84=A1=E6=95=88=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 14 ++++++++++---- README_CN.md | 17 ++++++++++++----- layout/includes/third-party/comments/waline.pug | 11 +++++++---- package.json | 2 +- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 54757a8ca..900186839 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Docs: 📖 [Butterfly Docs](https://butterfly.js.org/posts/21cfbf15/) Based on [hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody) theme. -## Installation +## 💻 Installation ### GIT @@ -48,7 +48,7 @@ In Hexo site root directory npm i hexo-theme-butterfly ``` -## Configuration +## ⚙ Configuration Set theme in the hexo work folder's root config file `_config.yml`: @@ -58,7 +58,7 @@ npm i hexo-theme-butterfly > npm install hexo-renderer-pug hexo-renderer-stylus -## Features +## 🎉 Features - [x] Card UI Design - [X] Support sub-menu @@ -97,7 +97,13 @@ npm i hexo-theme-butterfly - [x] Lazyload images - [x] Instantpage/Pangu/Snackbar notification toast/PWA...... -## Screenshots +## ✨ Contributors + + + + + +## 📷 Screenshots ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-1.jpg) ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-2.jpg) diff --git a/README_CN.md b/README_CN.md index 672126914..8dc6794c3 100644 --- a/README_CN.md +++ b/README_CN.md @@ -20,7 +20,7 @@ 一款基於[hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody)修改的主題 -## 安裝 +## 💻 安裝 ### Git 安裝 @@ -48,7 +48,8 @@ git clone -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/bu npm i hexo-theme-butterfly ``` -## 應用主題 +## ⚙ 應用主題 + 修改hexo配置文件`_config.yml`,把主題改為`Butterfly` ``` @@ -57,7 +58,7 @@ theme: butterfly >如果你沒有pug以及stylus的渲染器,請下載安裝: npm install hexo-renderer-pug hexo-renderer-stylus --save -## 特色 +## 🎉 特色 - [x] 卡片化設計 - [X] 支持二級目錄 @@ -96,11 +97,17 @@ theme: butterfly - [x] 圖片懶加載 - [x] Instantpage/Pangu/Snackbar彈窗/PWA...... -## 截圖 +## ✨ 贡献者 + + + + + +## 📷 截圖 ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-1.jpg) ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-2.jpg) ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-3.jpg) ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN@m2/img/butterfly-readme-screenshots-4.jpg) ![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-1.png) -![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-2.png) \ No newline at end of file +![](https://cdn.jsdelivr.net/gh/jerryc127/CDN/img/theme-butterfly-readme-homepage-2.png) diff --git a/layout/includes/third-party/comments/waline.pug b/layout/includes/third-party/comments/waline.pug index ae1a3822e..2407e4a7c 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 c8b5a00e1..42f73d8b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "4.0.0-b1", + "version": "4.0.0-b2", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { From f1bf2413a0f67bd410c7ca0a8a5fcf577ee4318f Mon Sep 17 00:00:00 2001 From: Jerry Date: Sun, 8 Aug 2021 15:36:22 +0800 Subject: [PATCH 03/16] =?UTF-8?q?breaking=20changes:=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20fancybox=20=E5=88=B0=204=20improvement:=20=E7=B6=B2=E7=AB=99?= =?UTF-8?q?=E8=B3=87=E6=96=99=E9=A1=AF=E7=A4=BA=EF=BC=8C=E4=BD=86=E6=A8=99?= =?UTF-8?q?=E7=B1=A4=E5=92=8C=E5=88=86=E9=A1=9E=E7=82=BA0=E6=99=82?= =?UTF-8?q?=EF=BC=8C=E6=95=B8=E9=87=8F=E9=A1=AF=E7=A4=BA=E7=82=BA=200?= =?UTF-8?q?=EF=BC=8C=E8=80=8C=E4=B8=8D=E6=98=AF=E9=9A=B1=E8=97=8F=20improv?= =?UTF-8?q?ement:=20subtitle=20=E4=BB=A3=E7=A2=BC=E5=84=AA=E5=8C=96?= =?UTF-8?q?=EF=BC=8C=201.=E7=95=B6source=E8=A8=AD=E7=82=BAfalse=EF=BC=8C?= =?UTF-8?q?=E5=90=8C=E6=99=82sub=E4=B9=9F=E6=B2=92=E6=9C=89=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=8C=E5=B0=87=E6=9C=83=E8=AE=80=E5=8F=96hexo?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E7=9A=84=20subtitle,2.?= =?UTF-8?q?=E7=84=A1=E9=A0=88=E4=BD=BF=E7=94=A8=E8=BD=89=E7=BE=A9=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=20improvement:=20=E7=A6=81=E6=AD=A2ios=E9=BB=9E?= =?UTF-8?q?=E6=93=8A=E6=90=9C=E7=B4=A2=E6=A1=86=EF=BC=8C=E9=A0=81=E9=9D=A2?= =?UTF-8?q?=E6=94=BE=E5=A4=A7=E7=9A=84=E5=95=8F=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 11 +-- layout/includes/head.pug | 2 +- layout/includes/page/flink.pug | 2 +- layout/includes/sidebar.pug | 33 +++---- layout/includes/third-party/subtitle.pug | 74 ++++++++------- layout/includes/widget/card_author.pug | 29 +++--- package.json | 2 +- scripts/tag/gallery.js | 2 +- source/css/_global/index.styl | 3 - source/css/_layout/post.styl | 1 + source/css/_layout/sidebar.styl | 15 ++- source/css/_tags/gallery.styl | 2 +- source/js/main.js | 116 ++++++++++++----------- 13 files changed, 141 insertions(+), 151 deletions(-) diff --git a/_config.yml b/_config.yml index a09855500..586808d9f 100644 --- a/_config.yml +++ b/_config.yml @@ -595,16 +595,13 @@ subtitle: loop: true # source調用第三方服務 # source: false 關閉調用 - # source: 1 調用搏天api的隨機語錄(簡體) + # source: 1 調用搏天 api 的隨機語錄(簡體) # source: 2 調用一言網的一句話(簡體) # source: 3 調用一句網(簡體) # source: 4 調用今日詩詞(簡體) # subtitle 會先顯示 source , 再顯示 sub 的內容 source: false - # 如果有英文逗號' , ',請使用轉義字元 , - # 如果有英文雙引號' " ',請使用轉義字元 " - # 開頭不允許轉義字元,如需要,請把整個句子用雙引號包住 - # 如果關閉打字效果,subtitle只會顯示sub的第一行文字 + # 如果關閉打字效果,subtitle 只會顯示 sub 的第一行文字 sub: # Loading Animation (加載動畫) @@ -876,8 +873,8 @@ CDN: pangu: https://cdn.jsdelivr.net/npm/pangu/dist/browser/pangu.min.js # photo - fancybox_css: https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css - fancybox: https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js + fancybox_css: https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css + fancybox: https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.js medium_zoom: https://cdn.jsdelivr.net/npm/medium-zoom/dist/medium-zoom.min.js # snackbar diff --git a/layout/includes/head.pug b/layout/includes/head.pug index 5708d7ce5..3c1c96d3a 100644 --- a/layout/includes/head.pug +++ b/layout/includes/head.pug @@ -20,7 +20,7 @@ meta(charset='UTF-8') meta(http-equiv="X-UA-Compatible" content="IE=edge") -meta(name="viewport" content="width=device-width,initial-scale=1") +meta(name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no") title= tabTitle if pageKeywords meta(name="keywords" content=pageKeywords) diff --git a/layout/includes/page/flink.pug b/layout/includes/page/flink.pug index 65b91d86b..104d288ae 100644 --- a/layout/includes/page/flink.pug +++ b/layout/includes/page/flink.pug @@ -13,7 +13,7 @@ each item in i.link_list .flink-list-item a(href=url_for(item.link) title=item.name target="_blank") - .flink-item-icon + .flink-item-icon.not-lightbox img(src=url_for(item.avatar) onerror=`this.onerror=null;this.src='` + url_for(theme.error_img.flink) + `'` alt=item.name ) .flink-item-name= item.name .flink-item-desc(title=item.descr)= item.descr diff --git a/layout/includes/sidebar.pug b/layout/includes/sidebar.pug index d8a66a37c..45a97ee04 100644 --- a/layout/includes/sidebar.pug +++ b/layout/includes/sidebar.pug @@ -3,26 +3,21 @@ #sidebar-menus .avatar-img.is-center img(src=url_for(theme.avatar.img) onerror=`onerror=null;src='${theme.error_img.flink}'` alt="avatar") - .site-data - if site.posts.length - .data-item.is-center - .data-item-link - a(href=url_for(config.archive_dir) + '/') - .headline= _p('aside.articles') - .length-num= site.posts.length + .site-data.is-center + .data-item + a(href=url_for(config.archive_dir) + '/') + .headline= _p('aside.articles') + .length-num= site.posts.length - if site.tags.length - .data-item.is-center - .data-item-link - a(href=url_for(config.tag_dir) + '/' ) - .headline= _p('aside.tags') - .length-num= site.tags.length + .data-item + a(href=url_for(config.tag_dir) + '/' ) + .headline= _p('aside.tags') + .length-num= site.tags.length + + .data-item + a(href=url_for(config.category_dir) + '/') + .headline= _p('aside.categories') + .length-num= site.categories.length - if site.categories.length - .data-item.is-center - .data-item-link - a(href=url_for(config.category_dir) + '/') - .headline= _p('aside.categories') - .length-num= site.categories.length hr !=partial('includes/header/menu_item', {}, {cache: true}) diff --git a/layout/includes/third-party/subtitle.pug b/layout/includes/third-party/subtitle.pug index ee0f58371..1b2720c74 100644 --- a/layout/includes/third-party/subtitle.pug +++ b/layout/includes/third-party/subtitle.pug @@ -1,4 +1,5 @@ -- let source = theme.subtitle.source +- const { effect,loop,source,sub } = theme.subtitle +- let subContent = sub || new Array() case source when 1 @@ -7,14 +8,14 @@ case source fetch('https://api.btstu.cn/yan/api.php?charset=utf-8&encode=json') .then(response => response.json()) .then(data => { - if (!{theme.subtitle.effect}) { - var sub = "!{theme.subtitle.sub}".length == 0 ? new Array() : "!{theme.subtitle.sub}".split(',') - var both = sub.unshift(data.text) - typed = new Typed('#subtitle', { + if (!{effect}) { + const sub = !{JSON.stringify(subContent)} + sub.unshift(data.text) + window.typed = new Typed('#subtitle', { strings: sub, startDelay: 300, typeSpeed: 150, - loop: !{theme.subtitle.loop}, + loop: !{loop}, backSpeed: 50, }) } else { @@ -23,7 +24,7 @@ case source }) } - if (!{theme.subtitle.effect}) { + if (!{effect}) { if (typeof Typed === 'function') { subtitleType() } else { @@ -39,15 +40,15 @@ case source fetch('https://v1.hitokoto.cn') .then(response => response.json()) .then(data => { - if (!{theme.subtitle.effect}) { - 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', { + if (!{effect}) { + const from = '出自 ' + data.from + const sub = !{JSON.stringify(subContent)} + sub.unshift(data.hitokoto, from) + window.typed = new Typed('#subtitle', { strings: sub, startDelay: 300, typeSpeed: 150, - loop: !{theme.subtitle.loop}, + loop: !{loop}, backSpeed: 50, }) } else { @@ -56,7 +57,7 @@ case source }) } - if (!{theme.subtitle.effect}) { + if (!{effect}) { if (typeof Typed === 'function') { subtitleType() } else { @@ -70,16 +71,16 @@ case source script. function subtitleType () { getScript('https://yijuzhan.com/api/word.php?m=js').then(() => { - var con = str[0] - if (!{theme.subtitle.effect}) { - 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', { + const con = str[0] + if (!{effect}) { + const from = '出自 ' + str[1] + const sub = !{JSON.stringify(subContent)} + sub.unshift(con, from) + window.typed = new Typed('#subtitle', { strings: sub, startDelay: 300, typeSpeed: 150, - loop: !{theme.subtitle.loop}, + loop: !{loop}, backSpeed: 50, }) } else { @@ -88,7 +89,7 @@ case source }) } - if (!{theme.subtitle.effect}) { + if (!{effect}) { if (typeof Typed === 'function') { subtitleType() } else { @@ -102,16 +103,16 @@ case source script. function subtitleType () { getScript('https://sdk.jinrishici.com/v2/browser/jinrishici.js').then(() => { - jinrishici.load(function (result) { - if (!{theme.subtitle.effect}) { - 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', { + jinrishici.load(result =>{ + if (!{effect}) { + const sub = !{JSON.stringify(subContent)} + const content = result.data.content + sub.unshift(content) + window.typed = new Typed('#subtitle', { strings: sub, startDelay: 300, typeSpeed: 150, - loop: !{theme.subtitle.loop}, + loop: !{loop}, backSpeed: 50, }) } else { @@ -121,7 +122,7 @@ case source }) } - if (!{theme.subtitle.effect}) { + if (!{effect}) { if (typeof Typed === 'function') { subtitleType() } else { @@ -132,22 +133,23 @@ case source } default + - subContent = subContent.length ? subContent : new Array(config.subtitle) script. function subtitleType () { - if (!{theme.subtitle.effect}) { - var typed = new Typed("#subtitle", { - strings: "!{theme.subtitle.sub}".split(","), + if (!{effect}) { + window.typed = new Typed("#subtitle", { + strings: !{JSON.stringify(subContent)}, startDelay: 300, typeSpeed: 150, - loop: !{theme.subtitle.loop}, + loop: !{loop}, backSpeed: 50 }) } else { - document.getElementById("subtitle").innerHTML = '!{theme.subtitle.sub[0]}' + document.getElementById("subtitle").innerHTML = '!{subContent[0]}' } } - if (!{theme.subtitle.effect}) { + if (!{effect}) { if (typeof Typed === 'function') { subtitleType() } else { diff --git a/layout/includes/widget/card_author.pug b/layout/includes/widget/card_author.pug index 57b1f9dad..dd8cc7b1c 100644 --- a/layout/includes/widget/card_author.pug +++ b/layout/includes/widget/card_author.pug @@ -6,24 +6,21 @@ if theme.aside.card_author.enable .author-info__name= config.author .author-info__description!= theme.aside.card_author.description || config.description - .card-info-data - if site.posts.length - .card-info-data-item.is-center - a(href=url_for(config.archive_dir) + '/') - .headline= _p('aside.articles') - .length-num= site.posts.length + .card-info-data.is-center + .card-info-data-item + a(href=url_for(config.archive_dir) + '/') + .headline= _p('aside.articles') + .length-num= site.posts.length - if site.tags.length - .card-info-data-item.is-center - a(href=url_for(config.tag_dir) + '/') - .headline= _p('aside.tags') - .length-num= site.tags.length + .card-info-data-item + a(href=url_for(config.tag_dir) + '/') + .headline= _p('aside.tags') + .length-num= site.tags.length - if site.categories.length - .card-info-data-item.is-center - a(href=url_for(config.category_dir) + '/') - .headline= _p('aside.categories') - .length-num= site.categories.length + .card-info-data-item + a(href=url_for(config.category_dir) + '/') + .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) diff --git a/package.json b/package.json index 42f73d8b2..a4f0af3bd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "4.0.0-b2", + "version": "4.0.0-b3", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { diff --git a/scripts/tag/gallery.js b/scripts/tag/gallery.js index 6bec4c452..82067c126 100644 --- a/scripts/tag/gallery.js +++ b/scripts/tag/gallery.js @@ -19,7 +19,7 @@ function galleryGroup (args) { const img = urlFor(args[3]) return ` -