fix: 修復網站壓縮後,mermaid 會無法生成顯示的Bugs

feat: Valine 增加 option 設置
This commit is contained in:
Jerry committed 2020-10-07 15:36:52 +08:00
1 parent 335fc25811
commit b078ebef14
7 files changed
+19 -8

No files matched your search

+1
View File
@@ -317,6 +317,7 @@ valine:
emojiCDN: # emoji CDN emojiCDN: # emoji CDN
enableQQ: false # enable the Nickname box to automatically get QQ Nickname and QQ Avatar enableQQ: false # enable the Nickname box to automatically get QQ Nickname and QQ Avatar
requiredFields: nick,mail # required fields (nick/mail) requiredFields: nick,mail # required fields (nick/mail)
option:
# utterances # utterances
# https://utteranc.es/ # https://utteranc.es/
+8 -2
View File
@@ -1,3 +1,4 @@
- let option = theme.valine.option ? JSON.stringify(theme.valine.option) : false
- let emojiMaps = '""' - let emojiMaps = '""'
if site.data.valine if site.data.valine
- emojiMaps = JSON.stringify(site.data.valine) - emojiMaps = JSON.stringify(site.data.valine)
@@ -5,7 +6,7 @@ if site.data.valine
script. script.
function loadValine () { function loadValine () {
function initValine () { function initValine () {
const initData = { let initData = {
el: '#vcomment', el: '#vcomment',
appId: '#{theme.valine.appId}', appId: '#{theme.valine.appId}',
appKey: '#{theme.valine.appKey}', appKey: '#{theme.valine.appKey}',
@@ -25,7 +26,12 @@ script.
if (!{Boolean(theme.valine.requiredFields)}) { if (!{Boolean(theme.valine.requiredFields)}) {
initData.requiredFields= ('!{theme.valine.requiredFields}'.split(',')) initData.requiredFields= ('!{theme.valine.requiredFields}'.split(','))
} }
if (!{Boolean(option)}) {
const otherData = !{option}
initData = Object.assign({}, initData, otherData)
}
const valine = new Valine(initData) const valine = new Valine(initData)
} }
+1 -1
View File
@@ -41,7 +41,7 @@ script.
} }
} }
var script = document.createElement('script') const script = document.createElement('script')
script.src = '!{theme.CDN.mathjax}' script.src = '!{theme.CDN.mathjax}'
script.id = 'MathJax-script' script.id = 'MathJax-script'
script.async = true script.async = true
Loaded 3 of 7 files, more files were not shown because too many files have changed in this diff. Show more