From b078ebef147d032da6498a7c45cefc0eeafd8a3e Mon Sep 17 00:00:00 2001 From: Jerry Date: Wed, 7 Oct 2020 15:36:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=BE=A9=E7=B6=B2=E7=AB=99?= =?UTF-8?q?=E5=A3=93=E7=B8=AE=E5=BE=8C=EF=BC=8Cmermaid=20=E6=9C=83?= =?UTF-8?q?=E7=84=A1=E6=B3=95=E7=94=9F=E6=88=90=E9=A1=AF=E7=A4=BA=E7=9A=84?= =?UTF-8?q?Bugs=20feat=EF=BC=9A=20Valine=20=E5=A2=9E=E5=8A=A0=20option=20?= =?UTF-8?q?=E8=A8=AD=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 1 + layout/includes/third-party/comments/valine.pug | 10 ++++++++-- layout/includes/third-party/math/mathjax.pug | 2 +- package.json | 2 +- scripts/helpers/related_post.js | 2 +- scripts/tags/mermaid.js | 4 +++- source/css/_mode/darkmode.styl | 6 ++++-- 7 files changed, 19 insertions(+), 8 deletions(-) diff --git a/_config.yml b/_config.yml index 3f92437..5cd10a1 100644 --- a/_config.yml +++ b/_config.yml @@ -317,6 +317,7 @@ valine: emojiCDN: # emoji CDN enableQQ: false # enable the Nickname box to automatically get QQ Nickname and QQ Avatar requiredFields: nick,mail # required fields (nick/mail) + option: # utterances # https://utteranc.es/ diff --git a/layout/includes/third-party/comments/valine.pug b/layout/includes/third-party/comments/valine.pug index ac7e3d1..6e09a81 100644 --- a/layout/includes/third-party/comments/valine.pug +++ b/layout/includes/third-party/comments/valine.pug @@ -1,3 +1,4 @@ +- let option = theme.valine.option ? JSON.stringify(theme.valine.option) : false - let emojiMaps = '""' if site.data.valine - emojiMaps = JSON.stringify(site.data.valine) @@ -5,7 +6,7 @@ if site.data.valine script. function loadValine () { function initValine () { - const initData = { + let initData = { el: '#vcomment', appId: '#{theme.valine.appId}', appKey: '#{theme.valine.appKey}', @@ -25,7 +26,12 @@ script. if (!{Boolean(theme.valine.requiredFields)}) { initData.requiredFields= ('!{theme.valine.requiredFields}'.split(',')) } - + + if (!{Boolean(option)}) { + const otherData = !{option} + initData = Object.assign({}, initData, otherData) + } + const valine = new Valine(initData) } diff --git a/layout/includes/third-party/math/mathjax.pug b/layout/includes/third-party/math/mathjax.pug index d28b3b8..c87965f 100644 --- a/layout/includes/third-party/math/mathjax.pug +++ b/layout/includes/third-party/math/mathjax.pug @@ -41,7 +41,7 @@ script. } } - var script = document.createElement('script') + const script = document.createElement('script') script.src = '!{theme.CDN.mathjax}' script.id = 'MathJax-script' script.async = true diff --git a/package.json b/package.json index ad087f2..2dfee5e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "3.2.0", + "version": "3.3.0-b1", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { diff --git a/scripts/helpers/related_post.js b/scripts/helpers/related_post.js index 5691e79..ee06e06 100644 --- a/scripts/helpers/related_post.js +++ b/scripts/helpers/related_post.js @@ -71,7 +71,7 @@ hexo.extend.helper.register('related_posts', function (currentPost, allPosts) { lazySrc + '="' + this.url_for(cover) + - '">' + '" alt="cover">' if (dateType === 'created') { result += '
' + diff --git a/scripts/tags/mermaid.js b/scripts/tags/mermaid.js index f1a85d4..d8f8b15 100644 --- a/scripts/tags/mermaid.js +++ b/scripts/tags/mermaid.js @@ -6,8 +6,10 @@ 'use strict' +const { escapeHTML } = require('hexo-util') + function mermaid (args, content) { - return `
${content}
` + return `
${escapeHTML(content)}
` } hexo.extend.tag.register('mermaid', mermaid, { ends: true }) diff --git a/source/css/_mode/darkmode.styl b/source/css/_mode/darkmode.styl index fc38a7b..bc34b0a 100644 --- a/source/css/_mode/darkmode.styl +++ b/source/css/_mode/darkmode.styl @@ -48,6 +48,9 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark' code background: $code-background + .aplayer + filter: brightness(.8) + // 頭部 #page-header & > #nav.fixed, @@ -103,8 +106,7 @@ if hexo-config('darkmode.enable') || hexo-config('display_mode') == 'dark' .error-img, #article-container iframe, img, - .gist, - .aplayer + .gist filter: brightness(.8) #aside_content .aside-list > .aside-list-item:not(:last-child)