From 092e6c5e2589103195c75c9cd3e5ec6ddaaf66d8 Mon Sep 17 00:00:00 2001 From: Open-super Date: Tue, 9 Feb 2021 21:20:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=20Butterfly=20=E6=B7=BB=E5=8A=A0=20He?= =?UTF-8?q?xoPlusPlus=5FTalk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 9 +++++---- layout/includes/head.pug | 1 - layout/includes/page/hpptalk.pug | 23 ++++++++++++++++++----- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/_config.yml b/_config.yml index 84ed4e2..6d6c3af 100644 --- a/_config.yml +++ b/_config.yml @@ -801,11 +801,12 @@ hexoplusplus: enable: false domain: talk: - hpptalk: https://cdn.jsdelivr.net/gh/HexoPlusPlus/HexoPlusPlus@1.1.0/talk_user.js # Here should be the limit must be written version number - hpptalk_css: https://cdn.jsdelivr.net/gh/HexoPlusPlus/HexoPlusPlus@1.1.0/talk.css # Here should be the limit must be written version number + hpptalk: https://cdn.jsdelivr.net/gh/HexoPlusPlus/HexoPlusPlus@main/src/talk_user.js # Here should be the limit must be written version number + hpptalk_css: https://cdn.jsdelivr.net/gh/HexoPlusPlus/HexoPlusPlus@main/src/talk.css # Here should be the limit must be written version number limit: 0 start: 0 - themecss: # Default config: https://cdn.jsdelivr.net/gh/HexoPlusPlus/CDN@master/theme/hpp_user_talk/Butter_Fly_1.css + themecss: https://cdn.jsdelivr.net/gh/HexoPlusPlus/CDN@master/plugin/theme/hpp_user_talk/Pofato.css # Default config: https://cdn.jsdelivr.net/gh/HexoPlusPlus/CDN@master/theme/hpp_user_talk/Butter_Fly_1.css / https://cdn.jsdelivr.net/gh/HexoPlusPlus/CDN@master/plugin/theme/hpp_user_talk/Pofato.css + # In order to adapt to the night mode of the Butterfly theme, you can select the CSS in the upper comment or write your own option: # Pjax [Beta] @@ -964,4 +965,4 @@ CDN: prismjs_lineNumber_js: https://cdn.jsdelivr.net/npm/prismjs/plugins/line-numbers/prism-line-numbers.min.js prismjs_autoloader: https://cdn.jsdelivr.net/npm/prismjs/plugins/autoloader/prism-autoloader.min.js - artitalk: https://cdn.jsdelivr.net/npm/artitalk + artitalk: https://cdn.jsdelivr.net/npm/artitalk \ No newline at end of file diff --git a/layout/includes/head.pug b/layout/includes/head.pug index 8010cae..543ad71 100644 --- a/layout/includes/head.pug +++ b/layout/includes/head.pug @@ -50,7 +50,6 @@ link(rel='stylesheet', href=url_for(theme.CDN.main_css)) link(rel='stylesheet', href=url_for(theme.CDN.fontawesome) media="print" onload="this.media='all'") if theme.hexoplusplus.enable - script(src=url_for(theme.hexoplusplus.talk.hpptalk)) link(rel='stylesheet', href=url_for(theme.hexoplusplus.talk.hpptalk_css)) if (theme.snackbar && theme.snackbar.enable) diff --git a/layout/includes/page/hpptalk.pug b/layout/includes/page/hpptalk.pug index b4aca5a..056835a 100644 --- a/layout/includes/page/hpptalk.pug +++ b/layout/includes/page/hpptalk.pug @@ -3,9 +3,22 @@ if top_img === false #hpp_talk script. - new hpp_talk({ - id:"hpp_talk", - domain: "!{theme.hexoplusplus.domain}", + (()=>{ + let setting = { + id: "hpp_talk", + domain: '!{theme.hexoplusplus.domain}', limit: !{theme.hexoplusplus.talk.limit}, - start: !{theme.hexoplusplus.talk.start} - }); + start: !{theme.hexoplusplus.talk.start}, + themecss: '!{theme.hexoplusplus.talk.themecss}', + } + + const init = () => { + new hpp_talk(setting) + } + + if (typeof hpp_talk === 'function') { + init() + } else { + getScript('!{theme.hexoplusplus.talk.hpptalk}').then(init) + } + })() \ No newline at end of file