This commit is contained in:
myw
2024-11-02 18:58:20 +08:00
parent d7bfcf36c9
commit f91ce41a66
23 changed files with 661 additions and 320 deletions

View File

@@ -37,18 +37,42 @@
& > *:last-child
margin-bottom: 0
.shuoshuo-tag
display: inline-block
margin-right: 8px
padding: 0 8px
width: fit-content
border: 1px solid $light-blue
border-radius: 12px
color: $light-blue
font-size: .85em
cursor: default
transition: all .2s ease-in-out
.shuoshuo-footer
display: flex
align-items: center
&:hover
background: $light-blue
color: var(--white)
&.flex-between
justify-content: space-between
&.flex-end
justify-content: flex-end
.shuoshuo-tag
display: inline-block
margin-right: 8px
padding: 0 8px
width: fit-content
border: 1px solid $light-blue
border-radius: 12px
color: $light-blue
font-size: .85em
cursor: default
transition: all .2s ease-in-out
&:hover
background: $light-blue
color: var(--white)
.shuoshuo-comment-btn
padding: 2px
color: #90a4ae
cursor: pointer
&:hover
color: $light-blue
.shuoshuo-comment
padding-top: 10px
&.no-comment
display: none

View File

@@ -806,22 +806,6 @@ document.addEventListener('DOMContentLoaded', () => {
btf.addEventListenerPjax(cardCategory, 'click', handleToggleBtn, true)
}
const switchComments = () => {
const switchBtn = document.getElementById('switch-btn')
if (!switchBtn) return
let switchDone = false
const postComment = document.getElementById('post-comment')
const handleSwitchBtn = () => {
postComment.classList.toggle('move')
if (!switchDone && typeof loadOtherComment === 'function') {
switchDone = true
loadOtherComment()
}
}
btf.addEventListenerPjax(switchBtn, 'click', handleSwitchBtn)
}
const addPostOutdateNotice = () => {
const { limitDay, messagePrev, messageNext, position } = GLOBAL_CONFIG.noticeOutdate
const diffDay = btf.diffDate(GLOBAL_CONFIG_SITE.postUpdate)
@@ -924,7 +908,7 @@ document.addEventListener('DOMContentLoaded', () => {
scrollFn()
forPostFn()
switchComments()
!GLOBAL_CONFIG_SITE.isShuoshuo && btf.switchComments(document)
openMobileMenu()
}

View File

@@ -290,6 +290,22 @@
Object.keys(keyObj).forEach(i => keyObj[i]())
delete globalFn[key]
},
switchComments: (el = document, path) => {
const switchBtn = el.querySelector('#switch-btn')
if (!switchBtn) return
let switchDone = false
const postComment = el.querySelector('#post-comment')
const handleSwitchBtn = () => {
postComment.classList.toggle('move')
if (!switchDone && typeof loadOtherComment === 'function') {
switchDone = true
loadOtherComment(el, path)
}
}
btf.addEventListenerPjax(switchBtn, 'click', handleSwitchBtn)
}
}