mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-08-09 03:58:51 +08:00
update
This commit is contained in:
@@ -3,9 +3,15 @@ name: npm publish
|
|||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [created]
|
types: [created]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write # OIDC 必須
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
# Setup .npmrc file to publish to npm
|
# Setup .npmrc file to publish to npm
|
||||||
@@ -13,7 +19,9 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: '20.x'
|
node-version: '20.x'
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npm publish
|
|
||||||
|
- run: npm publish --provenance --access public
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
+5
-1
@@ -659,7 +659,7 @@ artalk:
|
|||||||
# --------------------------------------
|
# --------------------------------------
|
||||||
|
|
||||||
chat:
|
chat:
|
||||||
# Choose: chatra/tidio/crisp
|
# Choose: chatra/tidio/crisp/knocket
|
||||||
# Leave it empty if you don't need chat
|
# Leave it empty if you don't need chat
|
||||||
use:
|
use:
|
||||||
# Chat Button [recommend]
|
# Chat Button [recommend]
|
||||||
@@ -680,6 +680,10 @@ tidio:
|
|||||||
crisp:
|
crisp:
|
||||||
website_id:
|
website_id:
|
||||||
|
|
||||||
|
# https://trtc.io/solutions/knocket
|
||||||
|
knocket:
|
||||||
|
identifier:
|
||||||
|
|
||||||
# --------------------------------------
|
# --------------------------------------
|
||||||
# Analysis
|
# Analysis
|
||||||
# --------------------------------------
|
# --------------------------------------
|
||||||
|
|||||||
+2
@@ -5,3 +5,5 @@ case theme.chat.use
|
|||||||
include ./tidio.pug
|
include ./tidio.pug
|
||||||
when 'crisp'
|
when 'crisp'
|
||||||
include ./crisp.pug
|
include ./crisp.pug
|
||||||
|
when 'knocket'
|
||||||
|
include ./knocket.pug
|
||||||
+44
@@ -0,0 +1,44 @@
|
|||||||
|
//- Knocket live chat — https://trtc.io/solutions/knocket
|
||||||
|
script.
|
||||||
|
(() => {
|
||||||
|
const id = '#{theme.knocket.identifier}'
|
||||||
|
if (!id) return
|
||||||
|
|
||||||
|
btf.getScript(`https://trtc.io/knocket-sdk/sdk.js?identifier=${id}`).then(() => {
|
||||||
|
const isChatBtn = !{theme.chat.rightside_button}
|
||||||
|
const isChatHideShow = !{theme.chat.button_hide_show}
|
||||||
|
|
||||||
|
const getWidget = () => document.getElementById('contact-widget-auto')
|
||||||
|
|
||||||
|
if (isChatBtn) {
|
||||||
|
const hide = () => { const w = getWidget(); if (w) w.style.display = 'none' }
|
||||||
|
const show = () => { const w = getWidget(); if (w) w.style.display = '' }
|
||||||
|
|
||||||
|
// Hide the native Knocket floating button
|
||||||
|
const observer = new MutationObserver(() => {
|
||||||
|
if (getWidget()) { hide(); observer.disconnect() }
|
||||||
|
})
|
||||||
|
observer.observe(document.body, { childList: true, subtree: true })
|
||||||
|
hide()
|
||||||
|
|
||||||
|
window.chatBtnFn = () => {
|
||||||
|
const w = getWidget()
|
||||||
|
if (!w) return
|
||||||
|
if (w.style.display === 'none') show()
|
||||||
|
else hide()
|
||||||
|
}
|
||||||
|
|
||||||
|
document.getElementById('chat-btn').style.display = 'block'
|
||||||
|
} else if (isChatHideShow) {
|
||||||
|
const observer = new MutationObserver(() => {
|
||||||
|
if (getWidget()) observer.disconnect()
|
||||||
|
})
|
||||||
|
observer.observe(document.body, { childList: true, subtree: true })
|
||||||
|
|
||||||
|
window.chatBtn = {
|
||||||
|
hide: () => { const w = getWidget(); if (w) w.style.display = 'none' },
|
||||||
|
show: () => { const w = getWidget(); if (w) w.style.display = '' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})()
|
||||||
@@ -394,6 +394,9 @@ module.exports = {
|
|||||||
crisp: {
|
crisp: {
|
||||||
website_id: null
|
website_id: null
|
||||||
},
|
},
|
||||||
|
knocket: {
|
||||||
|
identifier: null
|
||||||
|
},
|
||||||
google_tag_manager: {
|
google_tag_manager: {
|
||||||
tag_id: null,
|
tag_id: null,
|
||||||
domain: 'https://www.googletagmanager.com'
|
domain: 'https://www.googletagmanager.com'
|
||||||
|
|||||||
Reference in New Issue
Block a user