mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-08 12:07:06 +08:00
breaking change:
1. 部分配置更改 feat: 1. 移除 messenger 聊天插件 2. 更新 fackbook 版本號 3. 增加 香港繁體、日文和韓語 4. 使用的新的複製api 代替舊的 5. 增加 umami 分析 6. 增加 umami 獲取訪問量/訪客數 7. snackbar 增加透明度 8. 文章頁下, nav fixed 下 顯示文章標題 improvement: 1. 代碼優化 2. 修改部分用語 3. 回復之前的相對時間邏輯 4. timeline tag 樣式優化 5. 優化 seo 6. 優化 artalk 的最新評論 fix: 1. tag-hide toggle 圓角問題 2. lazyload 為 false 時,artalk 無法正常加載評論的 bug 3. 修復 gallery 出現抖動的 bug
This commit is contained in:
@@ -15,10 +15,13 @@
|
||||
text-rendering: auto
|
||||
-webkit-font-smoothing: antialiased
|
||||
|
||||
addBorderRadius(x = 6)
|
||||
addBorderRadius(x = 6, hide = false)
|
||||
if hexo-config('rounded_corners_ui')
|
||||
border-radius: unit(x, 'px')
|
||||
|
||||
if hide
|
||||
overflow: hidden
|
||||
|
||||
// card hover
|
||||
.cardHover
|
||||
background: var(--card-bg)
|
||||
|
||||
@@ -6,13 +6,4 @@ if hexo-config('chat.rightside_button') == true
|
||||
width: 1px !important
|
||||
height: 1px !important
|
||||
opacity: 0 !important
|
||||
pointer-events: none
|
||||
|
||||
if hexo-config('chat.use') == 'messenger'
|
||||
.fb_dialog,
|
||||
.fb-customerchat
|
||||
visibility: hidden !important
|
||||
width: 1px !important
|
||||
height: 1px !important
|
||||
opacity: 0 !important
|
||||
pointer-events: none
|
||||
pointer-events: none
|
||||
@@ -128,6 +128,9 @@
|
||||
height: 60px
|
||||
background: 0
|
||||
|
||||
.title-seo
|
||||
display: none
|
||||
|
||||
#nav
|
||||
background: rgba(255, 255, 255, .8)
|
||||
box-shadow: 0 5px 6px -5px rgba(133, 133, 133, .6)
|
||||
@@ -157,6 +160,12 @@
|
||||
.site-name
|
||||
text-shadow: none
|
||||
|
||||
& > a:first-child
|
||||
display: none
|
||||
|
||||
& > a:last-child
|
||||
display: inline
|
||||
|
||||
a,
|
||||
span.site-page,
|
||||
#toggle-menu
|
||||
@@ -195,8 +204,10 @@
|
||||
max-height: calc(100vh - 170px)
|
||||
|
||||
#page
|
||||
h1.page-title
|
||||
margin: 8px 0 20px
|
||||
.page-title
|
||||
margin: 0 0 10px
|
||||
font-weight: bold
|
||||
font-size: 2em
|
||||
|
||||
// for not top_img
|
||||
#post
|
||||
@@ -301,6 +312,9 @@
|
||||
height: 36px
|
||||
vertical-align: middle
|
||||
|
||||
.nav-page-title
|
||||
display: none
|
||||
|
||||
#toggle-menu
|
||||
display: none
|
||||
padding: 2px 0 0 6px
|
||||
|
||||
@@ -139,8 +139,9 @@ if hexo-config('math.use')
|
||||
&:before
|
||||
content: none
|
||||
|
||||
.snackbar-css
|
||||
border-radius: 5px !important
|
||||
.snackbar-container.snackbar-css
|
||||
addBorderRadius(5)
|
||||
opacity: .85 !important
|
||||
|
||||
.abc-music-sheet
|
||||
margin: 0 0 20px
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
|
||||
&.year
|
||||
font-size: 1.43em
|
||||
margin-bottom: 10px
|
||||
|
||||
&:hover
|
||||
&:before
|
||||
|
||||
@@ -22,6 +22,6 @@
|
||||
+maxWidth768()
|
||||
font-size: 2em
|
||||
|
||||
h1.page-title
|
||||
.page-title
|
||||
& + .tag-cloud-list
|
||||
text-align: left
|
||||
|
||||
@@ -127,8 +127,12 @@
|
||||
&:hover
|
||||
background: var(--btn-hover-color)
|
||||
|
||||
i
|
||||
margin-left: 8px
|
||||
|
||||
i
|
||||
margin-left: 4px
|
||||
transition: all .3s
|
||||
|
||||
.loading-container
|
||||
display: inline-block
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
.toggle
|
||||
margin-bottom: 20px
|
||||
border: 1px solid $tag-hide-toggle-bg
|
||||
addBorderRadius()
|
||||
addBorderRadius(5, true)
|
||||
|
||||
& > .toggle-button
|
||||
padding: 6px 15px
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#article-container
|
||||
.timeline
|
||||
margin: 0 0 20px 10px
|
||||
padding: 14px 20px 5px
|
||||
margin: 0 10px 20px
|
||||
padding: 14px 0 5px 20px
|
||||
border-left: 2px solid var(--timeline-color, $theme-color)
|
||||
|
||||
for $type in $color-types
|
||||
|
||||
@@ -18,20 +18,20 @@ $chinseFont = $language == 'zh-CN' ? 'Microsoft YaHei' : 'Microsoft JhengHei'
|
||||
$dafault-font-family = -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Lato, Roboto, 'PingFang SC', $chinseFont, sans-serif
|
||||
$dafault-code-font = consolas, Menlo, 'PingFang SC', $chinseFont, sans-serif
|
||||
|
||||
$font-family = hexo-config('font.font-family') ? unquote(hexo-config('font.font-family')) : $dafault-font-family
|
||||
$code-font-family = hexo-config('font.code-font-family') ? unquote(hexo-config('font.code-font-family')) : $dafault-code-font
|
||||
$site-name-font = hexo-config('blog_title_font.font-family') && unquote(hexo-config('blog_title_font.font-family'))
|
||||
$font-family = hexo-config('font.font_family') ? unquote(hexo-config('font.font_family')) : $dafault-font-family
|
||||
$code-font-family = hexo-config('font.code_font_family') ? unquote(hexo-config('font.code_font_family')) : $dafault-code-font
|
||||
$site-name-font = hexo-config('blog_title_font.font_family') && unquote(hexo-config('blog_title_font.font_family'))
|
||||
// hr
|
||||
$hrEnable = hexo-config('hr_icon') && hexo-config('hr_icon.enable')
|
||||
$hr-icon = $hrEnable && hexo-config('hr_icon.icon') ? hexo-config('hr_icon.icon') : '\f0c4'
|
||||
$hr-icon-top = $hrEnable && hexo-config('hr_icon.icon-top') ? convert(hexo-config('hr_icon.icon-top')) : -10px
|
||||
$hr-icon-top = $hrEnable && hexo-config('hr_icon.icon_top') ? convert(hexo-config('hr_icon.icon_top')) : -10px
|
||||
// page beatutify
|
||||
$beautifyEnable = hexo-config('beautify.enable')
|
||||
$title-prefix-icon = $beautifyEnable && hexo-config('beautify.title-prefix-icon') ? hexo-config('beautify.title-prefix-icon') : '\f0c1'
|
||||
$title-prefix-icon-color = $beautifyEnable && hexo-config('beautify.title-prefix-icon-color') ? convert(hexo-config('beautify.title-prefix-icon-color')) : $light-red
|
||||
$title-prefix-icon = $beautifyEnable && hexo-config('beautify.title_prefix_icon') ? hexo-config('beautify.title_prefix_icon') : '\f0c1'
|
||||
$title-prefix-icon-color = $beautifyEnable && hexo-config('beautify.title_prefix_icon_color') ? convert(hexo-config('beautify.title_prefix_icon_color')) : $light-red
|
||||
// Global Variables
|
||||
$font-size = hexo-config('font.global-font-size') ? convert(hexo-config('font.global-font-size')) : 14px
|
||||
$code-font-size = hexo-config('font.code-font-size') ? convert(hexo-config('font.code-font-size')) : var(--global-font-size)
|
||||
$font-size = hexo-config('font.global_font_size') ? convert(hexo-config('font.global_font_size')) : 14px
|
||||
$code-font-size = hexo-config('font.code_font_size') ? convert(hexo-config('font.code_font_size')) : var(--global-font-size)
|
||||
$font-color = #1F2D3D
|
||||
$text-line-height = 2
|
||||
$index_top_img_height = hexo-config('index_top_img_height') ? convert(hexo-config('index_top_img_height')) : 100vh
|
||||
|
||||
@@ -82,11 +82,12 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
}
|
||||
|
||||
const copy = ctx => {
|
||||
if (document.queryCommandSupported && document.queryCommandSupported('copy')) {
|
||||
document.execCommand('copy')
|
||||
const copy = async (text, ctx) => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(text)
|
||||
alertInfo(ctx, GLOBAL_CONFIG.copy.success)
|
||||
} else {
|
||||
} catch (err) {
|
||||
console.error('Failed to copy: ', err)
|
||||
alertInfo(ctx, GLOBAL_CONFIG.copy.noSupport)
|
||||
}
|
||||
}
|
||||
@@ -95,14 +96,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const highlightCopyFn = (ele, clickEle) => {
|
||||
const $buttonParent = ele.parentNode
|
||||
$buttonParent.classList.add('copy-true')
|
||||
const selection = window.getSelection()
|
||||
const range = document.createRange()
|
||||
const preCodeSelector = isPrismjs ? 'pre code' : 'table .code pre'
|
||||
range.selectNodeContents($buttonParent.querySelector(`${preCodeSelector}`))
|
||||
selection.removeAllRanges()
|
||||
selection.addRange(range)
|
||||
copy(clickEle.previousElementSibling)
|
||||
selection.removeAllRanges()
|
||||
const codeElement = $buttonParent.querySelector(preCodeSelector)
|
||||
if (!codeElement) return
|
||||
copy(codeElement.innerText, clickEle.previousElementSibling)
|
||||
$buttonParent.classList.remove('copy-true')
|
||||
}
|
||||
|
||||
@@ -238,8 +235,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
gap: 5,
|
||||
isConstantSize: true,
|
||||
sizeRange: [150, 600],
|
||||
useResizeObserver: true,
|
||||
observeChildren: true,
|
||||
// useResizeObserver: true,
|
||||
// observeChildren: true,
|
||||
useTransform: true
|
||||
// useRecycle: false
|
||||
})
|
||||
|
||||
@@ -20,19 +20,31 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
|
||||
const translateBody = (fobj) => {
|
||||
const objs = typeof fobj === 'object' ? fobj.childNodes : document.body.childNodes
|
||||
for (let i = 0; i < objs.length; i++) {
|
||||
const obj = objs.item(i)
|
||||
if ('BR|HR'.includes(obj.tagName) || obj === translateButtonObject) continue
|
||||
const nodes = typeof fobj === 'object' ? fobj.childNodes : document.body.childNodes
|
||||
|
||||
if (obj.title) obj.title = translateText(obj.title)
|
||||
if (obj.alt) obj.alt = translateText(obj.alt)
|
||||
if (obj.placeholder) obj.placeholder = translateText(obj.placeholder)
|
||||
if (obj.tagName === 'INPUT' && obj.value && obj.type !== 'text' && obj.type !== 'hidden') {
|
||||
obj.value = translateText(obj.value)
|
||||
for (const node of nodes) {
|
||||
// Skip BR, HR tags, or the translate button object
|
||||
if (['BR', 'HR'].includes(node.tagName) || node === translateButtonObject) continue
|
||||
|
||||
if (node.nodeType === Node.ELEMENT_NODE) {
|
||||
const { tagName, title, alt, placeholder, value, type } = node
|
||||
|
||||
// Translate title, alt, placeholder
|
||||
if (title) node.title = translateText(title)
|
||||
if (alt) node.alt = translateText(alt)
|
||||
if (placeholder) node.placeholder = translateText(placeholder)
|
||||
|
||||
// Translate input value except text and hidden types
|
||||
if (tagName === 'INPUT' && value && type !== 'text' && type !== 'hidden') {
|
||||
node.value = translateText(value)
|
||||
}
|
||||
|
||||
// Recursively translate child nodes
|
||||
translateBody(node)
|
||||
} else if (node.nodeType === Node.TEXT_NODE) {
|
||||
// Translate text node data
|
||||
node.data = translateText(node.data)
|
||||
}
|
||||
if (obj.nodeType === 3) obj.data = translateText(obj.data)
|
||||
else translateBody(obj)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -98,10 +98,10 @@
|
||||
|
||||
if (!more) return Math.floor(diffDay)
|
||||
|
||||
if (diffMonth > 24) return datePost.toISOString().slice(0, 10)
|
||||
if (diffMonth >= 3) return `${Math.floor(diffMonth)} ${dateSuffix.month}`
|
||||
if (diffDay >= 3) return `${Math.floor(diffDay)} ${dateSuffix.day}`
|
||||
if (diffHour >= 3) return `${Math.floor(diffHour)} ${dateSuffix.hour}`
|
||||
if (diffMonth > 12) return datePost.toISOString().slice(0, 10)
|
||||
if (diffMonth >= 1) return `${Math.floor(diffMonth)} ${dateSuffix.month}`
|
||||
if (diffDay >= 1) return `${Math.floor(diffDay)} ${dateSuffix.day}`
|
||||
if (diffHour >= 1) return `${Math.floor(diffHour)} ${dateSuffix.hour}`
|
||||
if (diffMin >= 1) return `${Math.floor(diffMin)} ${dateSuffix.min}`
|
||||
return dateSuffix.just
|
||||
},
|
||||
@@ -145,18 +145,19 @@
|
||||
requestAnimationFrame(animate)
|
||||
},
|
||||
|
||||
animateIn: (ele, text) => {
|
||||
animateIn: (ele, animation) => {
|
||||
ele.style.display = 'block'
|
||||
ele.style.animation = text
|
||||
ele.style.animation = animation
|
||||
},
|
||||
|
||||
animateOut: (ele, text) => {
|
||||
ele.addEventListener('animationend', function f () {
|
||||
animateOut: (ele, animation) => {
|
||||
const handleAnimationEnd = () => {
|
||||
ele.style.display = ''
|
||||
ele.style.animation = ''
|
||||
ele.removeEventListener('animationend', f)
|
||||
})
|
||||
ele.style.animation = text
|
||||
ele.removeEventListener('animationend', handleAnimationEnd)
|
||||
}
|
||||
ele.addEventListener('animationend', handleAnimationEnd)
|
||||
ele.style.animation = animation
|
||||
},
|
||||
|
||||
wrap: (selector, eleType, options) => {
|
||||
|
||||
Reference in New Issue
Block a user