From 507453671ad91cf9611f7f102d58c9c4e0271faa Mon Sep 17 00:00:00 2001 From: Jerry <16351105+jerryc127@users.noreply.github.com> Date: Sat, 1 Aug 2020 01:50:01 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E9=81=A9=E9=85=8Dhexo=205.0.0=20?= =?UTF-8?q?=E4=BF=AE=E5=BE=A9toc=E9=BB=9E=E6=93=8A=E4=B8=8D=E6=9C=83?= =?UTF-8?q?=E8=B7=B3=E8=BD=89=E7=9A=84bugs=20:bug:=20=E9=81=A9=E9=85=8Dhex?= =?UTF-8?q?o=205.0.0=20=E4=BF=AE=E5=BE=A9toc=E9=BB=9E=E6=93=8A=E4=B8=8D?= =?UTF-8?q?=E6=9C=83=E8=B7=B3=E8=BD=89=E7=9A=84bugs=20:beers:=20=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=95=B4=E7=90=86=20:beers:=20UI=E5=BE=AE=E8=AA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LICENSE | 204 +++++++++++++++++- README.md | 23 +- README_CN.md | 23 +- _config.yml | 42 ++-- layout/404.pug | 2 +- layout/flink.pug | 2 +- layout/includes/additional-js.pug | 53 ++--- layout/includes/comments/js.pug | 16 -- layout/includes/header/menu_item.pug | 45 ++-- layout/includes/header/nav.pug | 2 +- layout/includes/layout.pug | 5 +- layout/includes/mixins/post-ui.pug | 6 +- layout/includes/search/index.pug | 5 - layout/includes/share/index.pug | 7 - layout/includes/share/share-js.pug | 4 - layout/includes/third-party/canvas-nest.pug | 1 - .../third-party/canvas-ribbon-piao.pug | 1 - layout/includes/third-party/canvas-ribbon.pug | 3 - .../{ => third-party}/chat/chatra.pug | 0 .../includes/{ => third-party}/chat/crisp.pug | 0 .../{ => third-party}/chat/daovoice.pug | 0 .../{ => third-party}/chat/gitter.pug | 0 .../includes/{ => third-party}/chat/index.pug | 0 .../includes/{ => third-party}/chat/tidio.pug | 0 .../{ => third-party}/comments/disqus.pug | 0 .../{ => third-party}/comments/disqusjs.pug | 0 .../comments/facebook_comments.pug | 0 .../{ => third-party}/comments/gitalk.pug | 0 .../{ => third-party}/comments/index.pug | 0 layout/includes/third-party/comments/js.pug | 16 ++ .../{ => third-party}/comments/livere.pug | 0 .../{ => third-party}/comments/utterances.pug | 0 .../{ => third-party}/comments/valine.pug | 0 layout/includes/third-party/effect.pug | 28 +++ .../includes/{ => third-party}/math/index.pug | 3 + .../includes/{ => third-party}/math/katex.pug | 0 .../{ => third-party}/math/mathjax.pug | 0 .../third-party/{ => math}/mermaid.pug | 0 .../{ => third-party}/search/algolia.pug | 0 layout/includes/third-party/search/index.pug | 4 + .../{ => third-party}/search/local-search.pug | 0 .../{ => third-party}/share/add-this.pug | 0 .../{ => third-party}/share/addtoany.pug | 0 layout/includes/third-party/share/index.pug | 7 + .../includes/third-party/share/share-js.pug | 3 + layout/page.pug | 6 +- layout/post.pug | 4 +- package.json | 31 ++- source/css/_global/index.styl | 4 +- source/css/_highlight/diff.styl | 2 +- source/css/_highlight/theme.styl | 7 +- source/css/_layout/comments.styl | 2 + source/css/_layout/post.styl | 3 +- source/css/_layout/relatedposts.styl | 2 +- source/css/_layout/sidebar.styl | 2 +- source/js/main.js | 21 +- 56 files changed, 385 insertions(+), 204 deletions(-) delete mode 100644 layout/includes/comments/js.pug delete mode 100644 layout/includes/search/index.pug delete mode 100644 layout/includes/share/index.pug delete mode 100644 layout/includes/share/share-js.pug delete mode 100644 layout/includes/third-party/canvas-nest.pug delete mode 100644 layout/includes/third-party/canvas-ribbon-piao.pug delete mode 100644 layout/includes/third-party/canvas-ribbon.pug rename layout/includes/{ => third-party}/chat/chatra.pug (100%) rename layout/includes/{ => third-party}/chat/crisp.pug (100%) rename layout/includes/{ => third-party}/chat/daovoice.pug (100%) rename layout/includes/{ => third-party}/chat/gitter.pug (100%) rename layout/includes/{ => third-party}/chat/index.pug (100%) rename layout/includes/{ => third-party}/chat/tidio.pug (100%) rename layout/includes/{ => third-party}/comments/disqus.pug (100%) rename layout/includes/{ => third-party}/comments/disqusjs.pug (100%) rename layout/includes/{ => third-party}/comments/facebook_comments.pug (100%) rename layout/includes/{ => third-party}/comments/gitalk.pug (100%) rename layout/includes/{ => third-party}/comments/index.pug (100%) create mode 100644 layout/includes/third-party/comments/js.pug rename layout/includes/{ => third-party}/comments/livere.pug (100%) rename layout/includes/{ => third-party}/comments/utterances.pug (100%) rename layout/includes/{ => third-party}/comments/valine.pug (100%) create mode 100644 layout/includes/third-party/effect.pug rename layout/includes/{ => third-party}/math/index.pug (89%) rename layout/includes/{ => third-party}/math/katex.pug (100%) rename layout/includes/{ => third-party}/math/mathjax.pug (100%) rename layout/includes/third-party/{ => math}/mermaid.pug (100%) rename layout/includes/{ => third-party}/search/algolia.pug (100%) create mode 100644 layout/includes/third-party/search/index.pug rename layout/includes/{ => third-party}/search/local-search.pug (100%) rename layout/includes/{ => third-party}/share/add-this.pug (100%) rename layout/includes/{ => third-party}/share/addtoany.pug (100%) create mode 100644 layout/includes/third-party/share/index.pug create mode 100644 layout/includes/third-party/share/share-js.pug diff --git a/LICENSE b/LICENSE index 472ac23..7a4a3ea 100644 --- a/LICENSE +++ b/LICENSE @@ -1,8 +1,202 @@ -MIT License -Copyright (c) -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/README.md b/README.md index 1aea826..556b435 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,14 @@ # hexo-theme-butterfly -Version -Author -Hexo +[![GitHub version](https://badge.fury.io/gh/jerryc127%2Fhexo-theme-butterfly.svg)](https://badge.fury.io/gh/jerryc127%2Fhexo-theme-butterfly) +[![npm version](https://badge.fury.io/js/hexo-theme-butterfly.svg)](https://badge.fury.io/js/hexo-theme-butterfly) +![hexo version](https://img.shields.io/badge/hexo-4.0+-0e83c) +![npm download](https://img.shields.io/npm/dw/hexo-theme-butterfly) node.js +![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly) -Demo: 👍 [Butterfly](https://demo.jerryc.me/) || 🤞 [JerryC](https://jerryc.me/) +Demo: 👍 [Butterfly](https://demo.jerryc.me/) || 🤞 [JerryC](https://jerryc.me/) +Docs: [Butterfly Docs](https://demo.jerryc.me/posts/21cfbf15/) Based on [hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody) theme. @@ -33,18 +36,6 @@ git clone -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/bu > npm install hexo-renderer-pug hexo-renderer-stylus -## Documentation - -Find in [Butterfly Docs](https://demo.jerryc.me/posts/21cfbf15/). it supports `zh-TW` and `zh-CN` - -You can also join the Chat Group. - -[💬 Join QQ Group [recommend]](https://jq.qq.com/?_wv=1027&k=5KI3Jqb) - -[💬 Join Telegram Group](https://t.me/hexo_butterfly) - - - ## Screenshots ![image](https://user-images.githubusercontent.com/16351105/58887365-1272f780-8718-11e9-9329-3292c6ba20d4.png) diff --git a/README_CN.md b/README_CN.md index c951209..fc90a1a 100644 --- a/README_CN.md +++ b/README_CN.md @@ -1,11 +1,14 @@ # hexo-theme-butterfly -Version -Author -Hexo +[![GitHub version](https://badge.fury.io/gh/jerryc127%2Fhexo-theme-butterfly.svg)](https://badge.fury.io/gh/jerryc127%2Fhexo-theme-butterfly) +[![npm version](https://badge.fury.io/js/hexo-theme-butterfly.svg)](https://badge.fury.io/js/hexo-theme-butterfly) +![hexo version](https://img.shields.io/badge/hexo-4.0+-0e83c) +![npm download](https://img.shields.io/npm/dw/hexo-theme-butterfly) node.js +![license](https://img.shields.io/github/license/jerryc127/hexo-theme-butterfly) -Demo: 👍 [Butterfly](https://demo.jerryc.me/) || 🤞 [JerryC](https://jerryc.me/) +預覽: 👍 [Butterfly](https://demo.jerryc.me/) || 🤞 [JerryC](https://jerryc.me/) +文檔: [Butterfly Docs](https://demo.jerryc.me/posts/21cfbf15/) 一款基於[hexo-theme-melody](https://github.com/Molunerfinn/hexo-theme-melody)修改的主題 @@ -30,17 +33,7 @@ git clone -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/bu theme: butterfly ``` ->如果你沒有pug以及stylus的渲染器,請下載安裝: npm install hexo-renderer-pug hexo-renderer-stylus --save or yarn add hexo-renderer-pug hexo-renderer-stylus - -## 文檔 - -可查看[Butterfly Docs](https://demo.jerryc.me/posts/21cfbf15/) - -你也可以加入群組 - -[ 💬 QQ群 [推薦]](https://jq.qq.com/?_wv=1027&k=5KI3Jqb) - -[ 💬 Telegram群](https://t.me/hexo_butterfly) +>如果你沒有pug以及stylus的渲染器,請下載安裝: npm install hexo-renderer-pug hexo-renderer-stylus --save ## 截圖 diff --git a/_config.yml b/_config.yml index 8142cc5..7f52dc6 100644 --- a/_config.yml +++ b/_config.yml @@ -7,15 +7,15 @@ # name || link || icon menu: - Home: / || fas fa-home - Archives: /archives/ || fas fa-archive - Tags: /tags/ || fas fa-tags - Categories: /categories/ || fas fa-folder-open - List||fas fa-list: - - Music || /music/ || fas fa-music - - Movie || /movies/ || fas fa-video - Link: /link/ || fas fa-link - About: /about/ || fas fa-heart + # Home: / || fas fa-home + # Archives: /archives/ || fas fa-archive + # Tags: /tags/ || fas fa-tags + # Categories: /categories/ || fas fa-folder-open + # List||fas fa-list: + # - Music || /music/ || fas fa-music + # - Movie || /movies/ || fas fa-video + # Link: /link/ || fas fa-link + # About: /about/ || fas fa-heart # Code Blocks (代碼相關) # -------------------------------------- @@ -38,8 +38,8 @@ copy: # formal: # icon: link || the description social: - fab fa-github: https://github.com/xxxxx || Github - fas fa-envelope: mailto:xxxxxx@gmail.com || Email + # fab fa-github: https://github.com/xxxxx || Github + # fas fa-envelope: mailto:xxxxxx@gmail.com || Email # search (搜索) # -------------------------------------- @@ -184,12 +184,12 @@ post_copyright: reward: enable: false QR_code: - - img: /img/wechat.jpg - link: - text: wechat - - img: /img/alipay.jpg - link: - text: alipay + # - img: /img/wechat.jpg + # link: + # text: wechat + # - img: /img/alipay.jpg + # link: + # text: alipay # Related Articles related_post: @@ -564,7 +564,7 @@ hr_icon: # the subtitle on homepage (主頁subtitle) subtitle: - enable: true + enable: false # Typewriter Effect (打字效果) effect: true # loop (循環打字) @@ -582,8 +582,6 @@ subtitle: # 開頭不允許轉義字元,如需要,請把整個句子用雙引號包住 # 如果關閉打字效果,subtitle只會顯示sub的第一行文字 sub: - - 今日事,今日畢 - - Never put off till tomorrow what you can do today # Loading Animation (加載動畫) preloader: false @@ -714,7 +712,9 @@ note: pjax: false # Inject the css and script (aplayer/meting) -aplayerInject: false +aplayerInject: + enable: false + per_page: true # Snackbar (Toast Notification 彈窗) # https://github.com/polonel/SnackBar diff --git a/layout/404.pug b/layout/404.pug index 0e6c394..1e7191b 100644 --- a/layout/404.pug +++ b/layout/404.pug @@ -26,5 +26,5 @@ html(lang=config.language data-theme=theme.display_mode) i.fas.fa-rocket = _p('error404.back_button') - !=partial('includes/search/index', {}, {cache:theme.fragment_cache}) + !=partial('includes/third-party/search/index', {}, {cache:theme.fragment_cache}) include includes/additional-js.pug diff --git a/layout/flink.pug b/layout/flink.pug index 5ed16e3..fab186c 100644 --- a/layout/flink.pug +++ b/layout/flink.pug @@ -19,6 +19,6 @@ != page.content if page.comments !== false && theme.comments && theme.comments.use - var commentsJsLoad = true - !=partial('includes/comments/index', {}, {cache:theme.fragment_cache}) + !=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache}) diff --git a/layout/includes/additional-js.pug b/layout/includes/additional-js.pug index 9d76da4..2e00ca6 100644 --- a/layout/includes/additional-js.pug +++ b/layout/includes/additional-js.pug @@ -8,8 +8,7 @@ div if theme.medium_zoom script(src=url_for(theme.CDN.medium_zoom)) - - if theme.fancybox + else if theme.fancybox script(src=url_for(theme.CDN.fancybox)) if theme.instantpage @@ -18,43 +17,16 @@ div if theme.lazyload.enable script(src=url_for(theme.CDN.lazyload) async) - if theme.fireworks && theme.fireworks.enable - script(src=url_for(theme.CDN.anime)) - script(src=url_for(theme.CDN.fireworks)) - if (theme.snackbar && theme.snackbar.enable) script(src=url_for(theme.CDN.snackbar)) if theme.pangu && theme.pangu.enable - include ./third-party/pangu.pug - - if (theme.canvas_ribbon && theme.canvas_ribbon.enable) - include ./third-party/canvas-ribbon.pug - - if (theme.canvas_ribbon_piao && theme.canvas_ribbon_piao.enable) - include ./third-party/canvas-ribbon-piao.pug - - if (theme.canvas_nest && theme.canvas_nest.enable) - include ./third-party/canvas-nest.pug - - if theme.activate_power_mode.enable - script(src=url_for(theme.CDN.activate_power_mode)) - script. - POWERMODE.colorful = #{theme.activate_power_mode.colorful}; - POWERMODE.shake = #{theme.activate_power_mode.shake}; - document.body.addEventListener('input', POWERMODE); - - //- 鼠標特效 - if theme.click_heart - script(src=url_for(theme.CDN.click_heart) async) - - if theme.ClickShowText && theme.ClickShowText.enable - script(src=url_for(theme.CDN.ClickShowText) async) + !=partial('includes/third-party/pangu.pug', {}, {cache:theme.fragment_cache}) //- search - if theme.algolia_search && theme.algolia_search.enable + if theme.algolia_search.enable script(src=url_for(theme.CDN.algolia_js)) - else if theme.local_search && theme.local_search.enable + else if theme.local_search.enable script(src=url_for(theme.CDN.local_search)) if theme.preloader @@ -64,23 +36,22 @@ div if is_home() && theme.subtitle.enable include ./third-party/subtitle.pug - include ./math/index.pug - - //- mermaid - if theme.mermaid.enable - include ./third-party/mermaid.pug + include ./third-party/math/index.pug if commentsJsLoad - include ./comments/js.pug + include ./third-party/comments/js.pug if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv script(async src=url_for(theme.CDN.busuanzi)) !=fragment_cache('injectBottom', function(){return injectHtml(theme.inject.bottom)}) - !=partial('includes/chat/index', {}, {cache:theme.fragment_cache}) - if theme.aplayerInject && !config.aplayer.asset_inject - if theme.pjax + !=partial('includes/third-party/effect', {}, {cache:theme.fragment_cache}) + + !=partial('includes/third-party/chat/index', {}, {cache:theme.fragment_cache}) + + if theme.aplayerInject && theme.aplayerInject.enable + if theme.pjax || theme.aplayerInject.per_page include ./head/aplayer.pug else if page.aplayer include ./head/aplayer.pug diff --git a/layout/includes/comments/js.pug b/layout/includes/comments/js.pug deleted file mode 100644 index 4c2dae7..0000000 --- a/layout/includes/comments/js.pug +++ /dev/null @@ -1,16 +0,0 @@ -each name in theme.comments.use - case name - when 'Valine' - !=partial('includes/comments/valine', {}, {cache:theme.fragment_cache}) - when 'Disqus' - include ./disqus.pug - when 'Disqusjs' - include ./disqusjs.pug - when 'Livere' - !=partial('includes/comments/livere', {}, {cache:theme.fragment_cache}) - when 'Gitalk' - include ./gitalk.pug - when 'Utterances' - !=partial('includes/comments/utterances', {}, {cache:theme.fragment_cache}) - when 'Facebook Comments' - !=partial('includes/comments/facebook_comments', {}, {cache:theme.fragment_cache}) diff --git a/layout/includes/header/menu_item.pug b/layout/includes/header/menu_item.pug index fdcec60..8b58c96 100644 --- a/layout/includes/header/menu_item.pug +++ b/layout/includes/header/menu_item.pug @@ -1,22 +1,23 @@ -.menus_items - each value, label in theme.menu - if !Array.isArray(value) - .menus_item - a.site-page(href=url_for(trim(value.split('||')[0]))) - if value.split('||')[1] - i.fa-fw(class=trim(value.split('||')[1])) - span=' '+label - else - .menus_item - a.site-page(href='javascript:void(0);') - if label.split('||')[1] - i.fa-fw(class=trim(label.split('||')[1])) - span=' '+ trim(label.split('||')[0]) - i.fas.fa-chevron-down.expand - ul.menus_item_child - each i in value - li - a.site-page(href=url_for(trim(i.split('||')[1]))) - if i.split('||')[2] - i.fa-fw(class=trim(i.split('||')[2])) - span=' '+trim(i.split('||')[0]) \ No newline at end of file +if theme.menu + .menus_items + each value, label in theme.menu + if !Array.isArray(value) + .menus_item + a.site-page(href=url_for(trim(value.split('||')[0]))) + if value.split('||')[1] + i.fa-fw(class=trim(value.split('||')[1])) + span=' '+label + else + .menus_item + a.site-page(href='javascript:void(0);') + if label.split('||')[1] + i.fa-fw(class=trim(label.split('||')[1])) + span=' '+ trim(label.split('||')[0]) + i.fas.fa-chevron-down.expand + ul.menus_item_child + each i in value + li + a.site-page(href=url_for(trim(i.split('||')[1]))) + if i.split('||')[2] + i.fa-fw(class=trim(i.split('||')[2])) + span=' '+trim(i.split('||')[0]) \ No newline at end of file diff --git a/layout/includes/header/nav.pug b/layout/includes/header/nav.pug index 79bf9d6..eab38aa 100644 --- a/layout/includes/header/nav.pug +++ b/layout/includes/header/nav.pug @@ -3,7 +3,7 @@ nav#nav a#site-name.blog_title(href=url_for('/')) #[=config.title] span.pull-right.menus - if (theme.algolia_search.enable || theme.local_search && theme.local_search.enable) + if (theme.algolia_search.enable || theme.local_search.enable) #search_button a.site-page.social-icon.search i.fas.fa-search.fa-fw diff --git a/layout/includes/layout.pug b/layout/includes/layout.pug index 6e52f4e..467aca9 100644 --- a/layout/includes/layout.pug +++ b/layout/includes/layout.pug @@ -8,9 +8,6 @@ html(lang=config.language data-theme=theme.display_mode) if theme.preloader !=partial('includes/loading/loading', {}, {cache:theme.fragment_cache}) - if theme.fireworks && theme.fireworks.enable - canvas.fireworks - !=partial('includes/mobile-sidebar/index', {}, {cache:theme.fragment_cache}) #body-wrap @@ -41,5 +38,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}) + !=partial('includes/third-party/search/index', {}, {cache:theme.fragment_cache}) 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 af16eaf..51543c6 100644 --- a/layout/includes/mixins/post-ui.pug +++ b/layout/includes/mixins/post-ui.pug @@ -19,17 +19,17 @@ mixin postUI(posts) if (is_home() && (article.top || article.sticky > 0)) span.article-meta i.fas.fa-thumbtack.article-meta__icon.sticky - span.sticky.article-meta-label= _p('sticky') + span.sticky= _p('sticky') span.article-meta__separator | if (theme.post_meta.page.date_type) span.post-meta-date if (theme.post_meta.page.date_type === 'both') i.far.fa-calendar-alt - span.article-meta-label= _p('post.created') + span.article-meta-label=_p('post.created') time.post-meta-date-created(datetime=date_xml(article.date) title=_p('post.created') + ' ' + full_date(article.date))=date(article.date, config.date_format) span.article-meta__separator | i.fas.fa-history - span.article-meta-label= _p('post.updated') + span.article-meta-label=_p('post.updated') time.post-meta-date-updated(datetime=date_xml(article.updated) title=_p('post.updated') + ' ' + full_date(article.updated))=date(article.updated, config.date_format) else - let data_type_updated = theme.post_meta.page.date_type === 'updated' diff --git a/layout/includes/search/index.pug b/layout/includes/search/index.pug deleted file mode 100644 index 19dd228..0000000 --- a/layout/includes/search/index.pug +++ /dev/null @@ -1,5 +0,0 @@ -if (theme.algolia_search.enable) - include ./algolia.pug -if (theme.local_search) - if (!theme.algolia_search.enable && theme.local_search.enable) - include ./local-search.pug \ No newline at end of file diff --git a/layout/includes/share/index.pug b/layout/includes/share/index.pug deleted file mode 100644 index ae33e48..0000000 --- a/layout/includes/share/index.pug +++ /dev/null @@ -1,7 +0,0 @@ -.post_share - if theme.addThis.enable - !=partial('includes/share/add-this', {}, {cache:theme.fragment_cache}) - else if theme.sharejs && theme.sharejs.enable - include ./share-js.pug - else if theme.addtoany.enable - !=partial('includes/share/addtoany', {}, {cache:theme.fragment_cache}) diff --git a/layout/includes/share/share-js.pug b/layout/includes/share/share-js.pug deleted file mode 100644 index b611f5e..0000000 --- a/layout/includes/share/share-js.pug +++ /dev/null @@ -1,4 +0,0 @@ -if (theme.sharejs && theme.sharejs.enable) - .social-share(data-image=url_for(page.cover|| theme.avatar.img) data-sites= theme.sharejs.sites) - link(rel="stylesheet" href=url_for(theme.CDN.sharejs_css)) - script(src=url_for(theme.CDN.sharejs) defer) \ No newline at end of file diff --git a/layout/includes/third-party/canvas-nest.pug b/layout/includes/third-party/canvas-nest.pug deleted file mode 100644 index f232128..0000000 --- a/layout/includes/third-party/canvas-nest.pug +++ /dev/null @@ -1 +0,0 @@ -script#canvas_nest(defer color=theme.canvas_nest.color opacity=theme.canvas_nest.opacity zIndex=theme.canvas_nest.zIndex count=theme.canvas_nest.count mobile=`${theme.canvas_nest.mobile}` src=url_for(theme.CDN.canvas_nest)) \ No newline at end of file diff --git a/layout/includes/third-party/canvas-ribbon-piao.pug b/layout/includes/third-party/canvas-ribbon-piao.pug deleted file mode 100644 index 47b4460..0000000 --- a/layout/includes/third-party/canvas-ribbon-piao.pug +++ /dev/null @@ -1 +0,0 @@ -script(defer id="ribbon_piao" mobile=`${theme.canvas_ribbon_piao.mobile}` src=url_for(theme.CDN.canvas_ribbon_piao)) \ No newline at end of file diff --git a/layout/includes/third-party/canvas-ribbon.pug b/layout/includes/third-party/canvas-ribbon.pug deleted file mode 100644 index 9fc03fc..0000000 --- a/layout/includes/third-party/canvas-ribbon.pug +++ /dev/null @@ -1,3 +0,0 @@ -script(defer id="ribbon" src=url_for(theme.CDN.canvas_ribbon) size=theme.canvas_ribbon.size -alpha=theme.canvas_ribbon.alpha zIndex=theme.canvas_ribbon.zIndex mobile=`${theme.canvas_ribbon.mobile}` data-click=`${theme.canvas_ribbon.click_to_change}`) - diff --git a/layout/includes/chat/chatra.pug b/layout/includes/third-party/chat/chatra.pug similarity index 100% rename from layout/includes/chat/chatra.pug rename to layout/includes/third-party/chat/chatra.pug diff --git a/layout/includes/chat/crisp.pug b/layout/includes/third-party/chat/crisp.pug similarity index 100% rename from layout/includes/chat/crisp.pug rename to layout/includes/third-party/chat/crisp.pug diff --git a/layout/includes/chat/daovoice.pug b/layout/includes/third-party/chat/daovoice.pug similarity index 100% rename from layout/includes/chat/daovoice.pug rename to layout/includes/third-party/chat/daovoice.pug diff --git a/layout/includes/chat/gitter.pug b/layout/includes/third-party/chat/gitter.pug similarity index 100% rename from layout/includes/chat/gitter.pug rename to layout/includes/third-party/chat/gitter.pug diff --git a/layout/includes/chat/index.pug b/layout/includes/third-party/chat/index.pug similarity index 100% rename from layout/includes/chat/index.pug rename to layout/includes/third-party/chat/index.pug diff --git a/layout/includes/chat/tidio.pug b/layout/includes/third-party/chat/tidio.pug similarity index 100% rename from layout/includes/chat/tidio.pug rename to layout/includes/third-party/chat/tidio.pug diff --git a/layout/includes/comments/disqus.pug b/layout/includes/third-party/comments/disqus.pug similarity index 100% rename from layout/includes/comments/disqus.pug rename to layout/includes/third-party/comments/disqus.pug diff --git a/layout/includes/comments/disqusjs.pug b/layout/includes/third-party/comments/disqusjs.pug similarity index 100% rename from layout/includes/comments/disqusjs.pug rename to layout/includes/third-party/comments/disqusjs.pug diff --git a/layout/includes/comments/facebook_comments.pug b/layout/includes/third-party/comments/facebook_comments.pug similarity index 100% rename from layout/includes/comments/facebook_comments.pug rename to layout/includes/third-party/comments/facebook_comments.pug diff --git a/layout/includes/comments/gitalk.pug b/layout/includes/third-party/comments/gitalk.pug similarity index 100% rename from layout/includes/comments/gitalk.pug rename to layout/includes/third-party/comments/gitalk.pug diff --git a/layout/includes/comments/index.pug b/layout/includes/third-party/comments/index.pug similarity index 100% rename from layout/includes/comments/index.pug rename to layout/includes/third-party/comments/index.pug diff --git a/layout/includes/third-party/comments/js.pug b/layout/includes/third-party/comments/js.pug new file mode 100644 index 0000000..23f9d71 --- /dev/null +++ b/layout/includes/third-party/comments/js.pug @@ -0,0 +1,16 @@ +each name in theme.comments.use + case name + when 'Valine' + !=partial('includes/third-party/comments/valine', {}, {cache:theme.fragment_cache}) + when 'Disqus' + include ./disqus.pug + when 'Disqusjs' + include ./disqusjs.pug + when 'Livere' + !=partial('includes/third-party/comments/livere', {}, {cache:theme.fragment_cache}) + when 'Gitalk' + include ./gitalk.pug + when 'Utterances' + !=partial('includes/third-party/comments/utterances', {}, {cache:theme.fragment_cache}) + when 'Facebook Comments' + !=partial('includes/third-party/comments/facebook_comments', {}, {cache:theme.fragment_cache}) diff --git a/layout/includes/comments/livere.pug b/layout/includes/third-party/comments/livere.pug similarity index 100% rename from layout/includes/comments/livere.pug rename to layout/includes/third-party/comments/livere.pug diff --git a/layout/includes/comments/utterances.pug b/layout/includes/third-party/comments/utterances.pug similarity index 100% rename from layout/includes/comments/utterances.pug rename to layout/includes/third-party/comments/utterances.pug diff --git a/layout/includes/comments/valine.pug b/layout/includes/third-party/comments/valine.pug similarity index 100% rename from layout/includes/comments/valine.pug rename to layout/includes/third-party/comments/valine.pug diff --git a/layout/includes/third-party/effect.pug b/layout/includes/third-party/effect.pug new file mode 100644 index 0000000..335a70c --- /dev/null +++ b/layout/includes/third-party/effect.pug @@ -0,0 +1,28 @@ +if theme.fireworks && theme.fireworks.enable + canvas.fireworks + script(src=url_for(theme.CDN.anime)) + script(src=url_for(theme.CDN.fireworks)) + +if (theme.canvas_ribbon && theme.canvas_ribbon.enable) + script(defer id="ribbon" src=url_for(theme.CDN.canvas_ribbon) size=theme.canvas_ribbon.size + alpha=theme.canvas_ribbon.alpha zIndex=theme.canvas_ribbon.zIndex mobile=`${theme.canvas_ribbon.mobile}` data-click=`${theme.canvas_ribbon.click_to_change}`) + +if (theme.canvas_ribbon_piao && theme.canvas_ribbon_piao.enable) + script(defer id="ribbon_piao" mobile=`${theme.canvas_ribbon_piao.mobile}` src=url_for(theme.CDN.canvas_ribbon_piao)) + +if (theme.canvas_nest && theme.canvas_nest.enable) + script#canvas_nest(defer color=theme.canvas_nest.color opacity=theme.canvas_nest.opacity zIndex=theme.canvas_nest.zIndex count=theme.canvas_nest.count mobile=`${theme.canvas_nest.mobile}` src=url_for(theme.CDN.canvas_nest)) + +if theme.activate_power_mode.enable + script(src=url_for(theme.CDN.activate_power_mode)) + script. + POWERMODE.colorful = #{theme.activate_power_mode.colorful}; + POWERMODE.shake = #{theme.activate_power_mode.shake}; + document.body.addEventListener('input', POWERMODE); + +//- 鼠標特效 +if theme.click_heart + script(src=url_for(theme.CDN.click_heart) async) + +if theme.ClickShowText && theme.ClickShowText.enable + script(src=url_for(theme.CDN.ClickShowText) async) diff --git a/layout/includes/math/index.pug b/layout/includes/third-party/math/index.pug similarity index 89% rename from layout/includes/math/index.pug rename to layout/includes/third-party/math/index.pug index 68b3416..4ce6692 100644 --- a/layout/includes/math/index.pug +++ b/layout/includes/third-party/math/index.pug @@ -13,3 +13,6 @@ if theme.katex && theme.katex.enable else if page.katex include ./katex.pug + +if theme.mermaid.enable + include ./mermaid.pug \ No newline at end of file diff --git a/layout/includes/math/katex.pug b/layout/includes/third-party/math/katex.pug similarity index 100% rename from layout/includes/math/katex.pug rename to layout/includes/third-party/math/katex.pug diff --git a/layout/includes/math/mathjax.pug b/layout/includes/third-party/math/mathjax.pug similarity index 100% rename from layout/includes/math/mathjax.pug rename to layout/includes/third-party/math/mathjax.pug diff --git a/layout/includes/third-party/mermaid.pug b/layout/includes/third-party/math/mermaid.pug similarity index 100% rename from layout/includes/third-party/mermaid.pug rename to layout/includes/third-party/math/mermaid.pug diff --git a/layout/includes/search/algolia.pug b/layout/includes/third-party/search/algolia.pug similarity index 100% rename from layout/includes/search/algolia.pug rename to layout/includes/third-party/search/algolia.pug diff --git a/layout/includes/third-party/search/index.pug b/layout/includes/third-party/search/index.pug new file mode 100644 index 0000000..c1bd03a --- /dev/null +++ b/layout/includes/third-party/search/index.pug @@ -0,0 +1,4 @@ +if theme.algolia_search.enable + include ./algolia.pug +else if theme.local_search.enable + include ./local-search.pug \ No newline at end of file diff --git a/layout/includes/search/local-search.pug b/layout/includes/third-party/search/local-search.pug similarity index 100% rename from layout/includes/search/local-search.pug rename to layout/includes/third-party/search/local-search.pug diff --git a/layout/includes/share/add-this.pug b/layout/includes/third-party/share/add-this.pug similarity index 100% rename from layout/includes/share/add-this.pug rename to layout/includes/third-party/share/add-this.pug diff --git a/layout/includes/share/addtoany.pug b/layout/includes/third-party/share/addtoany.pug similarity index 100% rename from layout/includes/share/addtoany.pug rename to layout/includes/third-party/share/addtoany.pug diff --git a/layout/includes/third-party/share/index.pug b/layout/includes/third-party/share/index.pug new file mode 100644 index 0000000..41892a6 --- /dev/null +++ b/layout/includes/third-party/share/index.pug @@ -0,0 +1,7 @@ +.post_share + if theme.addThis.enable + !=partial('includes/third-party/share/add-this', {}, {cache:theme.fragment_cache}) + else if theme.sharejs.enable + include ./share-js.pug + else if theme.addtoany.enable + !=partial('includes/third-party/share/addtoany', {}, {cache:theme.fragment_cache}) diff --git a/layout/includes/third-party/share/share-js.pug b/layout/includes/third-party/share/share-js.pug new file mode 100644 index 0000000..538c905 --- /dev/null +++ b/layout/includes/third-party/share/share-js.pug @@ -0,0 +1,3 @@ +.social-share(data-image=url_for(page.cover|| theme.avatar.img) data-sites= theme.sharejs.sites) +link(rel="stylesheet" href=url_for(theme.CDN.sharejs_css)) +script(src=url_for(theme.CDN.sharejs) defer) \ No newline at end of file diff --git a/layout/page.pug b/layout/page.pug index 49939e9..099db09 100644 --- a/layout/page.pug +++ b/layout/page.pug @@ -10,7 +10,7 @@ block content !=cloudTags({source: site.tags, minfontsize: 15, maxfontsize: 30, limit: 0}) if page.comments !== false && theme.comments && theme.comments.use - var commentsJsLoad = true - !=partial('includes/comments/index', {}, {cache:theme.fragment_cache}) + !=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache}) else if page.type === 'link' include flink.pug else if page.type === 'categories' @@ -22,7 +22,7 @@ block content div!= list_categories() if page.comments !== false && theme.comments && theme.comments.use - var commentsJsLoad = true - !=partial('includes/comments/index', {}, {cache:theme.fragment_cache}) + !=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache}) else #page if theme.douban && theme.douban.meta @@ -31,4 +31,4 @@ block content #article-container!= page.content if page.comments !== false && theme.comments && theme.comments.use - var commentsJsLoad = true - !=partial('includes/comments/index', {}, {cache:theme.fragment_cache}) \ No newline at end of file + !=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache}) \ No newline at end of file diff --git a/layout/post.pug b/layout/post.pug index 0be5a2b..aef16e0 100644 --- a/layout/post.pug +++ b/layout/post.pug @@ -9,7 +9,7 @@ block content .post-meta__tag-list each item, index in page.tags.data a(href=url_for(item.path)).post-meta__tags #[=item.name] - include includes/share/index.pug + include includes/third-party/share/index.pug if theme.reward.enable !=partial('includes/post/reward', {}, {cache:theme.fragment_cache}) @@ -24,5 +24,5 @@ block content if page.comments !== false && theme.comments && theme.comments.use - var commentsJsLoad = true - !=partial('includes/comments/index', {}, {cache:theme.fragment_cache}) + !=partial('includes/third-party/comments/index', {}, {cache:theme.fragment_cache}) \ No newline at end of file diff --git a/package.json b/package.json index 62cb05d..4d3f88b 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,31 @@ { "name": "hexo-theme-butterfly", - "version": "3.0.0-rc2-dev", - "private": true, - "engines": { - "node": ">=8.10.0" - }, + "version": "3.0.0-rc1", "description": "A Simple and Card UI Design theme for Hexo", + "main": "package.json", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, "keywords": [ "hexo", "theme", "butterfly", - "Card UI Design" + "Card UI Design", + "Jerry" ], - "repository": "https://github.com/jerryc127/hexo-theme-butterfly.git", + "repository": { + "type" : "git", + "url" : "https://github.com/jerryc127/hexo-theme-butterfly.git" + }, + "bugs": { + "url": "https://github.com/jerryc127/hexo-theme-butterfly/issues", + "email": "wong@jerryc.me" + }, + "dependencies": { + "hexo-renderer-marked": "^3.0.0", + "hexo-renderer-pug": "^1.0.0" + }, + "homepage": "https://demo.jerryc.me/", "author": "Jerry ", - "license": "MIT" -} \ No newline at end of file + "license": "Apache-2.0" +} diff --git a/source/css/_global/index.styl b/source/css/_global/index.styl index a5c92fe..4877bc4 100644 --- a/source/css/_global/index.styl +++ b/source/css/_global/index.styl @@ -245,11 +245,11 @@ if hexo-config('avatar.effect') == true #mobile-sidebar-menus &.open - transform: translate3d(-100%, 0px, 0px) + transform: translate3d(-100%, 0, 0) for i in 1 2 3 4 > :nth-child({i}) - animation: sidebarItem (i / 5)s + animation: sidebarItem (i / 5) s @keyframes scroll-down-effect 0% diff --git a/source/css/_highlight/diff.styl b/source/css/_highlight/diff.styl index 85f47e4..6bb5106 100644 --- a/source/css/_highlight/diff.styl +++ b/source/css/_highlight/diff.styl @@ -3,7 +3,7 @@ figure.highlight table &::-webkit-scrollbar-thumb background: $highlight-scrollbar - + pre .deletion color: $highlight-deletion diff --git a/source/css/_highlight/theme.styl b/source/css/_highlight/theme.styl index eb4e9da..2219861 100644 --- a/source/css/_highlight/theme.styl +++ b/source/css/_highlight/theme.styl @@ -25,7 +25,7 @@ if $highlight_theme == 'default' } $highlight-scrollbar = darken($highlight-background, 6) -if $highlight_theme == 'darker' || $highlight_theme == 'mac' +if $highlight_theme == 'darker' || ($highlight_theme == 'mac') $highlight-background = #212121 $highlight-current-line = #282a2e $highlight-selection = #61616150 @@ -40,7 +40,7 @@ if $highlight_theme == 'darker' || $highlight_theme == 'mac' $highlight-purple = #C792EA $highlight-deletion = #BF42BF $highlight-addition = #105EDE - $highlight-mac-border = rgba(0,0,0,.4) + $highlight-mac-border = rgba(0, 0, 0, .4) $highlight-gutter = { color: alpha($highlight-foreground, .5), bg-color: $highlight-background @@ -101,7 +101,7 @@ if $highlight_theme == 'ocean' } $highlight-scrollbar = darken($highlight-background, 5) -if $highlight_theme == 'light' || $highlight_theme == 'mac light' +if $highlight_theme == 'light' || ($highlight_theme == 'mac light') $highlight-background = #F6F8FA $highlight-current-line = #00346e $highlight-selection = #80CBC440 @@ -127,7 +127,6 @@ if $highlight_theme == 'light' || $highlight_theme == 'mac light' } $highlight-scrollbar = darken($highlight-background, 8) - if $highlight_theme == false $highlight-background = #F6F8FA $highlight-foreground = #90A4AE diff --git a/source/css/_layout/comments.styl b/source/css/_layout/comments.styl index 7eac0ae..66ac5ce 100644 --- a/source/css/_layout/comments.styl +++ b/source/css/_layout/comments.styl @@ -19,6 +19,8 @@ border-radius: 8px background: $comments-switch-bg else + vertical-align: middle + > span display: none diff --git a/source/css/_layout/post.styl b/source/css/_layout/post.styl index b7feb78..3c49bd3 100644 --- a/source/css/_layout/post.styl +++ b/source/css/_layout/post.styl @@ -69,8 +69,7 @@ beautify() padding-left: .6rem @media screen and (max-width: $sm) - padding-left: 0.2rem - + padding-left: .2rem li &:not(.tab) diff --git a/source/css/_layout/relatedposts.styl b/source/css/_layout/relatedposts.styl index 6c271ba..a80c07d 100644 --- a/source/css/_layout/relatedposts.styl +++ b/source/css/_layout/relatedposts.styl @@ -49,5 +49,5 @@ .relatedPosts_title @extend .limit-more-line - -webkit-line-clamp: 2 color: var(--white) + -webkit-line-clamp: 2 diff --git a/source/css/_layout/sidebar.styl b/source/css/_layout/sidebar.styl index 0c860e3..adc965f 100644 --- a/source/css/_layout/sidebar.styl +++ b/source/css/_layout/sidebar.styl @@ -26,9 +26,9 @@ left: auto z-index: 103 width: $mobile-sidebar-width + box-shadow: none opacity: 1 transition: all .4s - box-shadow: none .toc-child display: block !important diff --git a/source/js/main.js b/source/js/main.js index 73422c5..5bcbe45 100644 --- a/source/js/main.js +++ b/source/js/main.js @@ -182,7 +182,7 @@ const sidebarFn = () => { closeMobileSidebar('toc') } else { e.preventDefault() - scrollToDest($(this).attr('href')) + scrollToDest(decodeURI($(this).attr('href'))) } }) } @@ -464,7 +464,7 @@ const tocFn = function () { // find head position & add active class // DOM Hierarchy: // ol.toc > (li.toc-item, ...) - // li.toc-item > (a.toc-link, ol.toc-child > (li.toc-item, ...)) + // li.toc-item > (a.toc-link, ol.toc-2child > (li.toc-item, ...)) const findHeadPosition = function (top) { // assume that we are not in the post page if no TOC link be found, // thus no need to update the status @@ -477,7 +477,7 @@ const tocFn = function () { list.each(function () { const head = $(this) if (top > head.offset().top - 25) { - currentId = '#' + $(this).attr('id') + currentId = '#' + encodeURI($(this).attr('id')) } }) @@ -602,10 +602,10 @@ const clickFnOfSubMenu = function () { /** * 複製時加上版權信息 */ -const addCopyright = function () { +const addCopyright = () => { const copyright = GLOBAL_CONFIG.copyright - document.body.oncopy = function (event) { - event.preventDefault() + document.body.oncopy = (e) => { + e.preventDefault() let textFont; const copyFont = window.getSelection(0).toString() if (copyFont.length > copyright.limitCount) { textFont = copyFont + '\n' + '\n' + '\n' + @@ -616,10 +616,9 @@ const addCopyright = function () { } else { textFont = copyFont } - if (event.clipboardData) { - return event.clipboardData.setData('text', textFont) + if (e.clipboardData) { + return e.clipboardData.setData('text', textFont) } else { - // 兼容IE return window.clipboardData.setData('text', textFont) } } @@ -628,7 +627,7 @@ const addCopyright = function () { /** * 網頁運行時間 */ -const addRuntime = function () { +const addRuntime = () => { const $runtimeCount = $('#webinfo-runtime-count') if ($runtimeCount.length) { const publishDate = $runtimeCount.attr('publish_date') @@ -649,7 +648,6 @@ const addTableWrap = function () { /** * 百度推送 */ - const pushToBaidu = () => { const bp = document.createElement('script') const curProtocol = window.location.protocol.split(':')[0] @@ -666,7 +664,6 @@ const pushToBaidu = () => { /** * tag-hide */ - const clickFnOfTagHide = function () { const $hideInline = $('.hide-button') if ($hideInline.length) {