mirror of
https://github.com/Ad-closeNN/blog-fuwari.git
synced 2026-05-31 02:20:05 -04:00
Squashed commit of the following:
commit54078a69f8Author: Ad-closeNN <1709301095@qq.com> Date: Thu Aug 7 23:33:17 2025 +0800 2025/8/7 commitf65632b1e8Author: Ad-closeNN <1709301095@qq.com> Date: Thu Aug 7 18:45:38 2025 +0800 Finish commit7986271c89Author: Ad-closeNN <1709301095@qq.com> Date: Thu Aug 7 17:41:57 2025 +0800 Delete umami.md commitfc0208cf4fAuthor: Ad-closeNN <1709301095@qq.com> Date: Thu Aug 7 17:38:53 2025 +0800 测试第一篇文章 commit690d1290e4Author: Ad-closeNN <1709301095@qq.com> Date: Thu Aug 7 11:56:58 2025 +0800 feat: 博客访问量测试 commit135830db3cAuthor: Ad-closeNN <1709301095@qq.com> Date: Thu Aug 7 00:30:57 2025 +0800 25/8/6
This commit is contained in:
@@ -140,12 +140,66 @@ const bannerOffset =
|
||||
<style define:vars={{
|
||||
configHue,
|
||||
'page-width': `${PAGE_WIDTH}rem`,
|
||||
}}></style> <!-- defines global css variables. This will be applied to <html> <body> and some other elements idk why -->
|
||||
/* https://github.com/afoim/fuwari/commit/aad0a7734be5f6e96a54a3aed51e49760ab3162a */
|
||||
'bg-url': siteConfig.background.src ? `url(${siteConfig.background.src})` : 'none',
|
||||
'bg-enable': siteConfig.background.enable ? '1' : '0',
|
||||
'bg-position': siteConfig.background.position || 'center',
|
||||
'bg-size': siteConfig.background.size || 'cover',
|
||||
'bg-repeat': siteConfig.background.repeat || 'no-repeat',
|
||||
'bg-attachment': siteConfig.background.attachment || 'fixed',
|
||||
'bg-opacity': (siteConfig.background.opacity || 0.3).toString()
|
||||
}}>
|
||||
:root {
|
||||
--bg-url: var(--bg-url);
|
||||
--bg-enable: var(--bg-enable);
|
||||
--bg-position: var(--bg-position);
|
||||
--bg-size: var(--bg-size);
|
||||
--bg-repeat: var(--bg-repeat);
|
||||
--bg-attachment: var(--bg-attachment);
|
||||
--bg-opacity: var(--bg-opacity);
|
||||
}
|
||||
|
||||
/* Background image configuration */
|
||||
body {
|
||||
--bg-url: var(--bg-url);
|
||||
--bg-enable: var(--bg-enable);
|
||||
--bg-position: var(--bg-position);
|
||||
--bg-size: var(--bg-size);
|
||||
--bg-repeat: var(--bg-repeat);
|
||||
--bg-attachment: var(--bg-attachment);
|
||||
--bg-opacity: var(--bg-opacity);
|
||||
}
|
||||
|
||||
body::before {
|
||||
content: '' !important;
|
||||
position: fixed !important;
|
||||
top: 0 !important;
|
||||
left: 0 !important;
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
background-image: var(--bg-url) !important;
|
||||
background-position: var(--bg-position) !important;
|
||||
background-size: var(--bg-size) !important;
|
||||
background-repeat: var(--bg-repeat) !important;
|
||||
background-attachment: var(--bg-attachment) !important;
|
||||
opacity: 0 !important;
|
||||
pointer-events: none !important;
|
||||
z-index: -1 !important;
|
||||
display: block !important;
|
||||
transition: opacity 0.3s ease-in-out !important;
|
||||
}
|
||||
|
||||
body.bg-loaded::before {
|
||||
opacity: calc(var(--bg-opacity) * var(--bg-enable)) !important;
|
||||
}
|
||||
</style> <!-- defines global css variables. This will be applied to <html> <body> and some other elements idk why -->
|
||||
|
||||
|
||||
<slot name="head"></slot>
|
||||
|
||||
<link rel="alternate" type="application/rss+xml" title={profileConfig.name} href={`${Astro.site}rss.xml`}/>
|
||||
<!-- Umami分析(自建) -->
|
||||
<script defer src="https://umami.adclosenn.top/script.js" data-website-id="7610548d-677b-40cb-9ebd-31dc14e16be7"></script>
|
||||
|
||||
</head>
|
||||
<body class=" min-h-screen transition " class:list={[{"lg:is-home": isHomePage, "enable-banner": enableBanner}]}
|
||||
@@ -501,7 +555,27 @@ window.onresize = () => {
|
||||
offset = offset - offset % 4;
|
||||
document.documentElement.style.setProperty('--banner-height-extend', `${offset}px`);
|
||||
}
|
||||
// Background image loading detection https://github.com/afoim/fuwari/commit/aad0a7734be5f6e96a54a3aed51e49760ab3162a
|
||||
const bgUrl = getComputedStyle(document.documentElement).getPropertyValue('--bg-url').trim();
|
||||
const bgEnable = getComputedStyle(document.documentElement).getPropertyValue('--bg-enable').trim();
|
||||
|
||||
if (bgUrl && bgUrl !== 'none' && bgEnable === '1') {
|
||||
const img = new Image();
|
||||
const urlMatch = bgUrl.match(/url\(["']?([^"')]+)["']?\)/);
|
||||
if (urlMatch) {
|
||||
img.onload = function() {
|
||||
// 背景图片完全加载后,显示背景并启用卡片透明效果
|
||||
document.body.classList.add('bg-loaded');
|
||||
document.documentElement.style.setProperty('--card-bg', 'var(--card-bg-transparent)');
|
||||
document.documentElement.style.setProperty('--float-panel-bg', 'var(--float-panel-bg-transparent)');
|
||||
};
|
||||
img.onerror = function() {
|
||||
// Keep cards opaque if background image fails to load
|
||||
console.warn('Background image failed to load, keeping cards opaque');
|
||||
};
|
||||
img.src = urlMatch[1];
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
Reference in New Issue
Block a user