This commit is contained in:
Jerry
2023-11-24 16:42:34 +08:00
Unverified
parent 7923a15e17
commit 63fb690d02
20 changed files with 637 additions and 62 deletions
+18 -8
View File
@@ -109,14 +109,24 @@ beautify()
line-height: 1em
if hexo-config('anchor.click_to_scroll')
a.headerlink
position: absolute
top: 0
right: 0
left 0
bottom: 0
width 100%
height: 100%
h1,
h2,
h3,
h4,
h5,
h6
a:not(.headerlink)
position relative
z-index 10
a.headerlink
position: absolute
top: 0
right: 0
left 0
bottom: 0
width 100%
height: 100%
ol,
ul
+3 -2
View File
@@ -33,15 +33,16 @@
margin: 20px auto
.menus_items
padding: 0 5px
padding: 0 10px
.site-page
@extend .limit-one-line
position: relative
display: block
padding: 6px 30px 6px 22px
padding: 3px 28px 3px 20px
color: var(--font-color)
font-size: 1.15em
border-radius: 6px
&:hover
background: var(--text-bg-hover)
-1
View File
@@ -53,7 +53,6 @@
.search-result
margin: 0 0 8px
word-break: break-word
.search-result-list
overflow-y: overlay
+17 -18
View File
@@ -66,7 +66,7 @@ document.addEventListener('DOMContentLoaded', function () {
const { highlightCopy, highlightLang, highlightHeightLimit, plugin } = highLight
const isHighlightShrink = GLOBAL_CONFIG_SITE.isHighlightShrink
const isShowTool = highlightCopy || highlightLang || isHighlightShrink !== undefined
const $figureHighlight = plugin === 'highlighjs' ? document.querySelectorAll('figure.highlight') : document.querySelectorAll('pre[class*="language-"]')
const $figureHighlight = plugin === 'highlight.js' ? document.querySelectorAll('figure.highlight') : document.querySelectorAll('pre[class*="language-"]')
if (!((isShowTool || highlightHeightLimit) && $figureHighlight.length)) return
@@ -75,23 +75,23 @@ document.addEventListener('DOMContentLoaded', function () {
const highlightShrinkEle = isHighlightShrink !== undefined ? '<i class="fas fa-angle-down expand"></i>' : ''
const highlightCopyEle = highlightCopy ? '<div class="copy-notice"></div><i class="fas fa-paste copy-button"></i>' : ''
const copy = (text, ctx) => {
const alertInfo = (ele, text) => {
if (GLOBAL_CONFIG.Snackbar !== undefined) {
btf.snackbarShow(text)
} else {
const prevEle = ele.previousElementSibling
prevEle.textContent = text
prevEle.style.opacity = 1
setTimeout(() => { prevEle.style.opacity = 0 }, 800)
}
}
const copy = ctx => {
if (document.queryCommandSupported && document.queryCommandSupported('copy')) {
document.execCommand('copy')
if (GLOBAL_CONFIG.Snackbar !== undefined) {
btf.snackbarShow(GLOBAL_CONFIG.copy.success)
} else {
const prevEle = ctx.previousElementSibling
prevEle.textContent = GLOBAL_CONFIG.copy.success
prevEle.style.opacity = 1
setTimeout(() => { prevEle.style.opacity = 0 }, 700)
}
alertInfo(ctx, GLOBAL_CONFIG.copy.success)
} else {
if (GLOBAL_CONFIG.Snackbar !== undefined) {
btf.snackbarShow(GLOBAL_CONFIG.copy.noSupport)
} else {
ctx.previousElementSibling.textContent = GLOBAL_CONFIG.copy.noSupport
}
alertInfo(ctx, GLOBAL_CONFIG.copy.noSupport)
}
}
@@ -105,8 +105,7 @@ document.addEventListener('DOMContentLoaded', function () {
range.selectNodeContents($buttonParent.querySelectorAll(`${preCodeSelector}`)[0])
selection.removeAllRanges()
selection.addRange(range)
const text = selection.toString()
copy(text, ele.lastChild)
copy(ele.lastChild)
selection.removeAllRanges()
$buttonParent.classList.remove('copy-true')
}
@@ -783,7 +782,7 @@ document.addEventListener('DOMContentLoaded', function () {
const commentContainer = document.getElementById('post-comment')
const handleSwitchBtn = () => {
commentContainer.classList.toggle('move')
if (!switchDone) {
if (!switchDone && typeof loadOtherComment === 'function') {
switchDone = true
loadOtherComment()
}