diff --git a/_config.yml b/_config.yml index 6d6c3af..d28c3f0 100644 --- a/_config.yml +++ b/_config.yml @@ -795,18 +795,13 @@ artitalk: appKey: option: -# HexoPlusPlus All home +# HexoPlusPlus Talk # see https://hexoplusplus.js.org hexoplusplus: - enable: false domain: talk: - 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 + limit: 10 start: 0 - 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] @@ -965,4 +960,6 @@ 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 \ No newline at end of file + artitalk: https://cdn.jsdelivr.net/npm/artitalk + hpptalk: https://cdn.jsdelivr.net/gh/HexoPlusPlus/HexoPlusPlus/talk_user.js + hpptalk_css: https://cdn.jsdelivr.net/gh/HexoPlusPlus/HexoPlusPlus/talk.css diff --git a/layout/includes/head.pug b/layout/includes/head.pug index 543ad71..35b95c3 100644 --- a/layout/includes/head.pug +++ b/layout/includes/head.pug @@ -49,9 +49,6 @@ if (theme.pwa && theme.pwa.enable) 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 - link(rel='stylesheet', href=url_for(theme.hexoplusplus.talk.hpptalk_css)) - if (theme.snackbar && theme.snackbar.enable) link(rel='stylesheet', href=url_for(theme.CDN.snackbar_css) media="print" onload="this.media='all'") diff --git a/layout/includes/page/hpptalk.pug b/layout/includes/page/hpptalk.pug index 056835a..5969f73 100644 --- a/layout/includes/page/hpptalk.pug +++ b/layout/includes/page/hpptalk.pug @@ -1,3 +1,5 @@ +- let hpptalkOption = theme.hexoplusplus.talk.option ? JSON.stringify(theme.hexoplusplus.talk.option) : false + if top_img === false h1.page-title= page.title @@ -9,16 +11,28 @@ script. domain: '!{theme.hexoplusplus.domain}', limit: !{theme.hexoplusplus.talk.limit}, start: !{theme.hexoplusplus.talk.start}, - themecss: '!{theme.hexoplusplus.talk.themecss}', + } + + if (!{Boolean(hpptalkOption)}) { + const otherSetting = !{hpptalkOption} + setting = Object.assign(setting, otherSetting) } const init = () => { new hpp_talk(setting) } + const addCss = () => { + const link = document.createElement('link') + link.rel = 'stylesheet' + link.href = '!{url_for(theme.CDN.hpptalk_css)}' + document.head.appendChild(link) + } + if (typeof hpp_talk === 'function') { init() } else { - getScript('!{theme.hexoplusplus.talk.hpptalk}').then(init) + addCss() + getScript('!{url_for(theme.CDN.hpptalk)}').then(init) } })() \ No newline at end of file