mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-06-05 21:01:46 +08:00
update
This commit is contained in:
+11
-7
@@ -301,8 +301,7 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
let initTop = 0
|
||||
let isChatShow = true
|
||||
const $header = document.getElementById('page-header')
|
||||
const isChatBtnHide = typeof chatBtnHide === 'function'
|
||||
const isChatBtnShow = typeof chatBtnShow === 'function'
|
||||
const isChatBtn = typeof chatBtn !== 'undefined'
|
||||
const isShowPercent = GLOBAL_CONFIG.percent.rightside
|
||||
|
||||
// 當滾動條小于 56 的時候
|
||||
@@ -324,14 +323,14 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
if (currentTop > 56) {
|
||||
if (isDown) {
|
||||
if ($header.classList.contains('nav-visible')) $header.classList.remove('nav-visible')
|
||||
if (isChatBtnShow && isChatShow === true) {
|
||||
chatBtnHide()
|
||||
if (isChatBtn && isChatShow === true) {
|
||||
window.chatBtn.hide()
|
||||
isChatShow = false
|
||||
}
|
||||
} else {
|
||||
if (!$header.classList.contains('nav-visible')) $header.classList.add('nav-visible')
|
||||
if (isChatBtnHide && isChatShow === false) {
|
||||
chatBtnShow()
|
||||
if (isChatBtn && isChatShow === false) {
|
||||
window.chatBtn.show()
|
||||
isChatShow = true
|
||||
}
|
||||
}
|
||||
@@ -545,10 +544,12 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
saveToLocal.set('aside-status', saveStatus, 2)
|
||||
$htmlDom.toggle('hide-aside')
|
||||
},
|
||||
|
||||
runMobileToc: () => {
|
||||
if (window.getComputedStyle(document.getElementById('card-toc')).getPropertyValue('opacity') === '0') window.mobileToc.open()
|
||||
else window.mobileToc.close()
|
||||
},
|
||||
toggleChatDisplay: () => {
|
||||
window.chatBtnFn()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -573,6 +574,9 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
case 'hide-aside-btn':
|
||||
rightSideFn.hideAsideBtn()
|
||||
break
|
||||
case 'chat-btn':
|
||||
rightSideFn.toggleChatDisplay()
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
+4
-11
@@ -186,10 +186,9 @@ const btf = {
|
||||
},
|
||||
|
||||
unwrap: el => {
|
||||
const elParentNode = el.parentNode
|
||||
if (elParentNode !== document.body) {
|
||||
elParentNode.parentNode.insertBefore(el, elParentNode)
|
||||
elParentNode.parentNode.removeChild(elParentNode)
|
||||
const parent = el.parentNode
|
||||
if (parent && parent !== document.body) {
|
||||
parent.replaceChild(el, parent)
|
||||
}
|
||||
},
|
||||
|
||||
@@ -211,13 +210,7 @@ const btf = {
|
||||
const service = GLOBAL_CONFIG.lightbox
|
||||
|
||||
if (service === 'mediumZoom') {
|
||||
const zoom = mediumZoom(ele)
|
||||
zoom.on('open', e => {
|
||||
const photoBg = document.documentElement.getAttribute('data-theme') === 'dark' ? '#121212' : '#fff'
|
||||
zoom.update({
|
||||
background: photoBg
|
||||
})
|
||||
})
|
||||
mediumZoom(ele, { background: 'var(--zoom-bg)' })
|
||||
}
|
||||
|
||||
if (service === 'fancybox') {
|
||||
|
||||
Reference in New Issue
Block a user