From 7c294e0482257516f5031d268a26c87c45fb5546 Mon Sep 17 00:00:00 2001 From: Open-super Date: Mon, 8 Feb 2021 14:12:09 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=96=B0=E5=A2=9EHexoPlusPlus=E7=9A=84?= =?UTF-8?q?=E8=AF=B4=E8=AF=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 16 ++++++++++++++++ layout/includes/head.pug | 4 ++++ layout/includes/page/hpptalk.pug | 12 ++++++++++++ layout/page.pug | 2 ++ package.json | 2 +- 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 layout/includes/page/hpptalk.pug diff --git a/_config.yml b/_config.yml index b4761c6..6dd44af 100644 --- a/_config.yml +++ b/_config.yml @@ -795,6 +795,22 @@ artitalk: appKey: option: +# HexoPlusPlus All home +# see https://hexoplusplus.js.org +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 + limit: 0 + start: 0 + themecss: # Default config: https://cdn.jsdelivr.net/gh/HexoPlusPlus/CDN@master/theme/hpp_user_talk/Butter_Fly_1.css + option: + + info: + enable: false + # Pjax [Beta] # It may contain bugs and unstable, give feedback when you find the bugs. # https://github.com/MoOx/pjax diff --git a/layout/includes/head.pug b/layout/includes/head.pug index 35b95c3..8010cae 100644 --- a/layout/includes/head.pug +++ b/layout/includes/head.pug @@ -49,6 +49,10 @@ 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 + 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) 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 new file mode 100644 index 0000000..12b52ad --- /dev/null +++ b/layout/includes/page/hpptalk.pug @@ -0,0 +1,12 @@ +if top_img === false + h1.page-title= page.title + +#hpp_talk +script. + + new hpp_talk({ + id:"hpp_talk", + domain: "!{theme.hexoplusplus.domain}", + limit: !{theme.hexoplusplus.talk.limit}, + start: !{theme.hexoplusplus.talk.start} + }); \ No newline at end of file diff --git a/layout/page.pug b/layout/page.pug index 7287546..0f2733c 100644 --- a/layout/page.pug +++ b/layout/page.pug @@ -11,6 +11,8 @@ block content include includes/page/categories.pug when 'artitalk' include includes/page/artitalk.pug + when 'hpptalk' + include includes/page/hpptalk.pug default include includes/page/default-page.pug diff --git a/package.json b/package.json index 4421098..dd8f300 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "3.6.2", + "version": "3.6.3", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { From e85315b256aff63890afd7f878ab9daf60c91e4c Mon Sep 17 00:00:00 2001 From: choosk <77675898+ladjeek-actions@users.noreply.github.com> Date: Mon, 8 Feb 2021 14:13:57 +0800 Subject: [PATCH 2/6] Update _config.yml --- _config.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/_config.yml b/_config.yml index 6dd44af..84ed4e2 100644 --- a/_config.yml +++ b/_config.yml @@ -808,9 +808,6 @@ hexoplusplus: themecss: # Default config: https://cdn.jsdelivr.net/gh/HexoPlusPlus/CDN@master/theme/hpp_user_talk/Butter_Fly_1.css option: - info: - enable: false - # Pjax [Beta] # It may contain bugs and unstable, give feedback when you find the bugs. # https://github.com/MoOx/pjax From 3eb7f23997a31c2eaf1143c6df980fae15ea1a04 Mon Sep 17 00:00:00 2001 From: choosk <77675898+ladjeek-actions@users.noreply.github.com> Date: Mon, 8 Feb 2021 14:20:58 +0800 Subject: [PATCH 3/6] Update hpptalk.pug --- layout/includes/page/hpptalk.pug | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/layout/includes/page/hpptalk.pug b/layout/includes/page/hpptalk.pug index 12b52ad..b4aca5a 100644 --- a/layout/includes/page/hpptalk.pug +++ b/layout/includes/page/hpptalk.pug @@ -3,10 +3,9 @@ if top_img === false #hpp_talk script. - new hpp_talk({ id:"hpp_talk", domain: "!{theme.hexoplusplus.domain}", limit: !{theme.hexoplusplus.talk.limit}, start: !{theme.hexoplusplus.talk.start} - }); \ No newline at end of file + }); From 1683998280904b33796371cb1ad9d3c9bfcc3d2f Mon Sep 17 00:00:00 2001 From: choosk <77675898+ladjeek-actions@users.noreply.github.com> Date: Mon, 8 Feb 2021 14:34:25 +0800 Subject: [PATCH 4/6] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dd8f300..4421098 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hexo-theme-butterfly", - "version": "3.6.3", + "version": "3.6.2", "description": "A Simple and Card UI Design theme for Hexo", "main": "package.json", "scripts": { From 092e6c5e2589103195c75c9cd3e5ec6ddaaf66d8 Mon Sep 17 00:00:00 2001 From: Open-super Date: Tue, 9 Feb 2021 21:20:55 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=B8=BA=20Butterfly=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=20HexoPlusPlus=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 From b063554dd2cd02963f8f2773c62a691a42bda73d Mon Sep 17 00:00:00 2001 From: Jerry Date: Thu, 11 Feb 2021 01:19:07 +0800 Subject: [PATCH 6/6] update update --- _config.yml | 13 +++++-------- layout/includes/head.pug | 3 --- layout/includes/page/hpptalk.pug | 18 ++++++++++++++++-- 3 files changed, 21 insertions(+), 13 deletions(-) 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