mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-10 21:17:07 +08:00
Merge branch 'jerryc127:dev' into dev
This commit is contained in:
@@ -52,7 +52,7 @@ div
|
|||||||
!= partial("includes/third-party/umami_analytics", {}, { cache: true })
|
!= partial("includes/third-party/umami_analytics", {}, { cache: true })
|
||||||
|
|
||||||
if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv
|
if theme.busuanzi.site_uv || theme.busuanzi.site_pv || theme.busuanzi.page_pv
|
||||||
script(async data-pjax src=url_for(theme.asset.busuanzi) || '//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js')
|
script(async data-pjax src=theme.asset.busuanzi ? url_for(theme.asset.busuanzi) : '//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js')
|
||||||
|
|
||||||
!= partial('includes/third-party/search/index', {}, { cache: true })
|
!= partial('includes/third-party/search/index', {}, { cache: true })
|
||||||
|
|
||||||
|
|||||||
12
layout/includes/third-party/umami_analytics.pug
vendored
12
layout/includes/third-party/umami_analytics.pug
vendored
@@ -62,8 +62,8 @@ script.
|
|||||||
const pagePV = document.getElementById('umamiPV')
|
const pagePV = document.getElementById('umamiPV')
|
||||||
if (pagePV) {
|
if (pagePV) {
|
||||||
const data = await getData(true)
|
const data = await getData(true)
|
||||||
if (data && data.pageviews && typeof data.pageviews.value !== 'undefined') {
|
if (data && data.pageviews) {
|
||||||
pagePV.textContent = data.pageviews.value
|
pagePV.textContent = typeof data.pageviews.value !== 'undefined' ? data.pageviews.value : data.pageviews
|
||||||
} else {
|
} else {
|
||||||
console.warn('Umami Analytics: Invalid page view data received')
|
console.warn('Umami Analytics: Invalid page view data received')
|
||||||
}
|
}
|
||||||
@@ -75,8 +75,8 @@ script.
|
|||||||
|
|
||||||
if (config.site_uv) {
|
if (config.site_uv) {
|
||||||
const siteUV = document.getElementById('umami-site-uv')
|
const siteUV = document.getElementById('umami-site-uv')
|
||||||
if (siteUV && data && data.visitors && typeof data.visitors.value !== 'undefined') {
|
if (siteUV && data && data.visitors) {
|
||||||
siteUV.textContent = data.visitors.value
|
siteUV.textContent = typeof data.visitors.value !== 'undefined' ? data.visitors.value : data.visitors
|
||||||
} else if (siteUV) {
|
} else if (siteUV) {
|
||||||
console.warn('Umami Analytics: Invalid site UV data received')
|
console.warn('Umami Analytics: Invalid site UV data received')
|
||||||
}
|
}
|
||||||
@@ -84,8 +84,8 @@ script.
|
|||||||
|
|
||||||
if (config.site_pv) {
|
if (config.site_pv) {
|
||||||
const sitePV = document.getElementById('umami-site-pv')
|
const sitePV = document.getElementById('umami-site-pv')
|
||||||
if (sitePV && data && data.pageviews && typeof data.pageviews.value !== 'undefined') {
|
if (sitePV && data && data.pageviews) {
|
||||||
sitePV.textContent = data.pageviews.value
|
sitePV.textContent = typeof data.pageviews.value !== 'undefined' ? data.pageviews.value : data.pageviews
|
||||||
} else if (sitePV) {
|
} else if (sitePV) {
|
||||||
console.warn('Umami Analytics: Invalid site PV data received')
|
console.warn('Umami Analytics: Invalid site PV data received')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hexo-theme-butterfly",
|
"name": "hexo-theme-butterfly",
|
||||||
"version": "5.5.2",
|
"version": "5.5.3-b1",
|
||||||
"description": "A Simple and Card UI Design theme for Hexo",
|
"description": "A Simple and Card UI Design theme for Hexo",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -113,6 +113,10 @@ $code-block
|
|||||||
margin: 2px
|
margin: 2px
|
||||||
|
|
||||||
i
|
i
|
||||||
|
display: inline-flex
|
||||||
|
justify-content: center
|
||||||
|
align-items: center
|
||||||
|
padding: 5px
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
transition: all .3s
|
transition: all .3s
|
||||||
|
|
||||||
@@ -128,7 +132,7 @@ $code-block
|
|||||||
|
|
||||||
if !$highlight_macstyle
|
if !$highlight_macstyle
|
||||||
& > .macStyle
|
& > .macStyle
|
||||||
padding: 0
|
margin: 0
|
||||||
|
|
||||||
.code-lang
|
.code-lang
|
||||||
flex: 1 1 auto
|
flex: 1 1 auto
|
||||||
@@ -182,6 +186,7 @@ if $highlight_macstyle
|
|||||||
.highlight-tools
|
.highlight-tools
|
||||||
.macStyle
|
.macStyle
|
||||||
display: flex
|
display: flex
|
||||||
|
padding: 3px
|
||||||
|
|
||||||
& > *
|
& > *
|
||||||
margin-right: 8px
|
margin-right: 8px
|
||||||
|
|||||||
@@ -84,10 +84,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
const buttonRect = ele.getBoundingClientRect()
|
const buttonRect = ele.getBoundingClientRect()
|
||||||
const scrollTop = window.pageYOffset || document.documentElement.scrollTop
|
const scrollTop = window.pageYOffset || document.documentElement.scrollTop
|
||||||
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft
|
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft
|
||||||
const finalTop = buttonRect.top + scrollTop - 40
|
|
||||||
const finalLeft = buttonRect.left + scrollLeft + buttonRect.width / 2
|
const finalLeft = buttonRect.left + scrollLeft + buttonRect.width / 2
|
||||||
|
|
||||||
const topValue = ele.closest('figure.highlight').classList.contains('code-fullpage') ? finalTop + 60 : finalTop
|
// Show tooltip below button if too close to top
|
||||||
|
const normalTop = buttonRect.top + scrollTop - 40
|
||||||
|
const shouldShowBelow = buttonRect.top < 60 || normalTop < 10
|
||||||
|
|
||||||
|
const topValue = shouldShowBelow ? buttonRect.top + scrollTop + buttonRect.height + 10 : normalTop
|
||||||
|
|
||||||
newEle.style.cssText = `
|
newEle.style.cssText = `
|
||||||
top: ${topValue + 10}px;
|
top: ${topValue + 10}px;
|
||||||
@@ -111,6 +114,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
}, 800)
|
}, 800)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const copy = async (text, ctx) => {
|
const copy = async (text, ctx) => {
|
||||||
try {
|
try {
|
||||||
await navigator.clipboard.writeText(text)
|
await navigator.clipboard.writeText(text)
|
||||||
|
|||||||
Reference in New Issue
Block a user