2022 主题bug修复

This commit is contained in:
Vaica committed 2026-06-24 20:22:40 +08:00
1 parent a6b1098d60
commit 56ea059fc0
16 files changed
+1338 -315

No files matched your search

@@ -1,6 +1,6 @@
--- ---
title: 测试 title: 测试
date: '2026-06-24T00:00:00.000Z' date: '2026-06-24T10:30:00.000Z'
slug: '20260624174421' slug: '20260624174421'
draft: false draft: false
categories: categories:
@@ -13,10 +13,6 @@ layout: post
{{< voice src="1782294286938-voice.oga" >}} {{< voice src="1782294286938-voice.oga" >}}
{{< music-card src="1782294426951-music.mp3" name="日落大道" artist="梁博" cover="1782294519691-cover.jpg" >}} {{< music-card src="1782294426951-music.mp3" name="日落大道" artist="梁博" cover="1782294519691-cover.jpg" >}}
@@ -29,7 +25,15 @@ layout: post
{{< video src="1782294568482-BAACAgQA.mp4" caption="file" >}} {{< video src="1782294568482-BAACAgQA.mp4" caption="file" >}}
## Bilibili 视频嵌入
{{< bilibili bvid="BV1agJV6kEBH" >}}
## Live Photo 实况照片
{{< livephoto src="1782294568482-BAACAgQA.mp4" cover="1782294566846-AgACAgQA.jpg" >}}
![image](1782294630552-AgACAgQA.jpg) ![image](1782294630552-AgACAgQA.jpg)
+16
View File
@@ -53,6 +53,22 @@ body {
[data-theme="dark"] body { [data-theme="dark"] body {
color: var(--text-content-dark-color); color: var(--text-content-dark-color);
background-color: var(--background-dark-color); background-color: var(--background-dark-color);
background-image: url(/image/background/deno.webp);
background-repeat: round;
background-size: contain;
background-attachment: fixed;
}
[data-theme="dark"] body::before {
content: '';
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.4);
pointer-events: none;
z-index: -1;
} }
/* 主容器 - 关键布局 */ /* 主容器 - 关键布局 */
+82 -37
View File
@@ -40,10 +40,22 @@ html {
[data-theme="dark"] body { [data-theme="dark"] body {
color: var(--text-content-dark-color); color: var(--text-content-dark-color);
background-color: var(--background-dark-color); background-color: var(--background-dark-color);
background-image: none !important; background-image: url(/image/background/deno.webp) !important;
background-repeat: initial !important; background-repeat: round !important;
background-size: initial !important; background-size: contain !important;
background-attachment: initial !important; background-attachment: fixed !important;
}
[data-theme="dark"] body::before {
content: '';
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.4);
pointer-events: none;
z-index: -1;
} }
[data-theme="dark"] .main { [data-theme="dark"] .main {
@@ -219,6 +231,11 @@ code::-webkit-scrollbar {
border-radius: 4px; border-radius: 4px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding-bottom: 40px;
}
.code-fold-container.collapsed {
padding-bottom: 0;
} }
.code-fold-container.collapsed .highlight, .code-fold-container.collapsed .highlight,
@@ -257,10 +274,16 @@ code::-webkit-scrollbar {
} }
.code-fold-container:not(.collapsed) .code-expand-btn { .code-fold-container:not(.collapsed) .code-expand-btn {
position: sticky; position: absolute !important;
bottom: 10px; bottom: 10px !important;
margin: 10px auto 0; left: 50% !important;
transform: none; margin: 0 !important;
transform: translateX(-50%) !important;
display: flex !important;
justify-content: center !important;
align-items: center !important;
width: auto !important;
padding: 0 !important;
} }
/* Button Pill Style */ /* Button Pill Style */
@@ -5400,88 +5423,103 @@ html[data-theme="light"] .atk-loading-spinner svg circle {
/* Link Card - only in post content */ /* Link Card - Minimal Black/White Style */
a.link-card { a.link-card {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 12px; gap: 12px;
padding: 12px 16px; padding: 14px 16px;
margin: 1rem 0; margin: 1rem 0;
border: 1px solid rgba(0, 0, 0, 0.08); border: 1px solid rgba(0, 0, 0, 0.08);
border-radius: 12px; border-radius: 12px;
background: linear-gradient(135deg, rgba(0, 0, 0, 0.015), rgba(0, 0, 0, 0.005)); background: rgba(255, 255, 255, 0.85);
text-decoration: none !important; text-decoration: none !important;
color: #1e1e1e; color: #1a1a1a;
font-size: 14px; font-size: 14px;
line-height: 1.5; line-height: 1.5;
max-width: 100%; max-width: 100%;
transition: all 0.2s ease; transition: all 0.25s ease;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
} }
a.link-card:hover { a.link-card:hover {
border-color: rgba(0, 0, 0, 0.15); border-color: rgba(0, 0, 0, 0.15);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
transform: translateY(-1px); transform: translateY(-2px);
text-decoration: none !important; text-decoration: none !important;
} }
a.link-card .link-card-icon { a.link-card .link-card-icon {
width: 24px; width: 28px;
height: 24px; height: 28px;
border-radius: 5px; border-radius: 8px;
flex-shrink: 0; flex-shrink: 0;
object-fit: contain; object-fit: cover;
background: #f5f5f5;
padding: 4px;
transition: all 0.25s ease;
}
a.link-card:hover .link-card-icon {
background: #eee;
} }
a.link-card .link-card-body { a.link-card .link-card-body {
flex: 1; flex: 1;
min-width: 0; min-width: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 1px; gap: 2px;
} }
a.link-card .link-card-title { a.link-card .link-card-title {
font-weight: 500; font-weight: 500;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
font-size: 13.5px; font-size: 14px;
color: rgba(30, 30, 30, 0.92); color: #1a1a1a;
} }
a.link-card .link-card-url { a.link-card .link-card-url {
font-size: 11px; font-size: 11px;
color: rgba(30, 30, 30, 0.45); color: #666;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
font-family: -apple-system, BlinkMacSystemFont, 'SF Mono', Monaco, monospace;
} }
a.link-card .link-card-arrow { a.link-card .link-card-arrow {
flex-shrink: 0; flex-shrink: 0;
color: rgba(30, 30, 30, 0.3); color: #999;
font-size: 13px; font-size: 14px;
transition: color 0.2s; transition: all 0.25s ease;
} }
a.link-card:hover .link-card-arrow { a.link-card:hover .link-card-arrow {
color: rgba(30, 30, 30, 0.6); color: #333;
transform: translateX(2px);
} }
[data-theme="dark"] a.link-card { [data-theme="dark"] a.link-card {
border-color: rgba(148, 163, 184, 0.15); border-color: rgba(255, 255, 255, 0.08);
background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.5)); background: rgba(30, 30, 30, 0.85);
color: #e2e8f0; color: #e5e5e5;
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
} }
[data-theme="dark"] a.link-card:hover { [data-theme="dark"] a.link-card:hover {
border-color: rgba(148, 163, 184, 0.3); border-color: rgba(255, 255, 255, 0.15);
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] a.link-card .link-card-icon {
background: #2a2a2a;
}
[data-theme="dark"] a.link-card:hover .link-card-icon {
background: #333;
} }
[data-theme="dark"] a.link-card .link-card-title { [data-theme="dark"] a.link-card .link-card-title {
color: rgba(226, 232, 240, 0.96); color: #e5e5e5;
} }
[data-theme="dark"] a.link-card .link-card-url { [data-theme="dark"] a.link-card .link-card-url {
color: rgba(226, 232, 240, 0.4); color: #888;
} }
[data-theme="dark"] a.link-card .link-card-arrow { [data-theme="dark"] a.link-card .link-card-arrow {
color: rgba(226, 232, 240, 0.3); color: #666;
} }
[data-theme="dark"] a.link-card:hover .link-card-arrow { [data-theme="dark"] a.link-card:hover .link-card-arrow {
color: rgba(226, 232, 240, 0.6); color: #ccc;
} }
/* Reward System */ /* Reward System */
@@ -5886,3 +5924,10 @@ a.link-card:hover .link-card-arrow {
border: none; border: none;
border-radius: 12px; border-radius: 12px;
} }
/* 移动端隐藏阅读时间 */
@media (max-width: 768px) {
.meta-item-reading-time {
display: none;
}
}
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -2,7 +2,7 @@
document.addEventListener('DOMContentLoaded', function() { document.addEventListener('DOMContentLoaded', function() {
// 文章图片灯箱 // 文章图片灯箱
if (window.ViewImage) { if (window.ViewImage) {
ViewImage.init('.post-content img'); ViewImage.init('.post-content img:not(.amigo-music-card__cover):not(.amigo-voice-avatar):not(.amigo-livephoto-img)');
} }
// 灯箱增强:滚动关闭 + fade scale 退回动画 // 灯箱增强:滚动关闭 + fade scale 退回动画
@@ -10,7 +10,7 @@ document.addEventListener('DOMContentLoaded', function() {
var clickedImg = null; var clickedImg = null;
document.addEventListener('click', function(e) { document.addEventListener('click', function(e) {
var img = e.target.closest('.post-content img'); var img = e.target.closest('.post-content img:not(.amigo-music-card__cover):not(.amigo-voice-avatar):not(.amigo-livephoto-img)');
if (img) clickedImg = img; if (img) clickedImg = img;
}, true); }, true);
+120 -60
View File
@@ -8,34 +8,20 @@
// ============================================================ // ============================================================
function initLivePhotoShortcodes() { function initLivePhotoShortcodes() {
document.querySelectorAll('.live-photo').forEach(function(livePhoto) { document.querySelectorAll('.amigo-livephoto').forEach(function(livePhoto) {
if (livePhoto.__liveBound) return; if (livePhoto.__liveBound) return;
livePhoto.__liveBound = true; livePhoto.__liveBound = true;
var video = livePhoto.querySelector('video.live-photo-video') || livePhoto.querySelector('video'); var video = livePhoto.querySelector('.amigo-livephoto-video');
var posterImg = livePhoto.querySelector('img.live-photo-poster') || livePhoto.querySelector('img'); var posterImg = livePhoto.querySelector('.amigo-livephoto-img');
var toggleBtn = livePhoto.querySelector('.live-photo-toggle-btn'); var soundBtn = livePhoto.querySelector('.amigo-livephoto-sound');
var muteBtn = livePhoto.querySelector('.live-photo-mute-btn');
if (!video || !toggleBtn || !muteBtn) return; if (!video) return;
var HOVER_DELAY = 500; var HOVER_DELAY = 500;
var hoverTimer = null; var hoverTimer = null;
var isLoaded = false; var isLoaded = false;
var isUserToggled = false;
function syncAspectFromPoster() {
if (!posterImg) return;
var w = posterImg.naturalWidth || 0;
var h = posterImg.naturalHeight || 0;
if (!w || !h) return;
livePhoto.style.setProperty('--live-photo-aspect', w + ' / ' + h);
}
if (posterImg && posterImg.complete) {
syncAspectFromPoster();
} else if (posterImg) {
posterImg.addEventListener('load', syncAspectFromPoster, { once: true });
}
function ensureLoaded() { function ensureLoaded() {
if (isLoaded) return; if (isLoaded) return;
@@ -50,69 +36,66 @@ function initLivePhotoShortcodes() {
function setMuted(isMuted) { function setMuted(isMuted) {
video.muted = !!isMuted; video.muted = !!isMuted;
if (isMuted) video.setAttribute('muted', ''); if (isMuted) {
else video.removeAttribute('muted'); video.setAttribute('muted', '');
muteBtn.setAttribute('data-muted', isMuted ? 'true' : 'false'); livePhoto.classList.add('is-muted');
} else {
video.removeAttribute('muted');
livePhoto.classList.remove('is-muted');
}
} }
setMuted(true);
function playVideo() { function playVideo() {
ensureLoaded(); ensureLoaded();
livePhoto.classList.add('is-playing'); livePhoto.classList.add('is-playing');
toggleBtn.setAttribute('data-state', 'live');
try { video.play(); } catch (e) {} try { video.play(); } catch (e) {}
} }
function stopVideo() { function stopVideo() {
livePhoto.classList.remove('is-playing'); livePhoto.classList.remove('is-playing');
toggleBtn.setAttribute('data-state', 'static');
try { video.pause(); video.currentTime = 0; } catch (e) {} try { video.pause(); video.currentTime = 0; } catch (e) {}
} }
// Toggle button click function togglePlay() {
toggleBtn.addEventListener('click', function(e) {
e.stopPropagation();
if (livePhoto.classList.contains('is-playing')) { if (livePhoto.classList.contains('is-playing')) {
isUserToggled = false;
stopVideo(); stopVideo();
} else { } else {
isUserToggled = true;
playVideo(); playVideo();
} }
}
// Click to toggle
livePhoto.addEventListener('click', function() {
togglePlay();
}); });
// Mute button click // Sound button click
muteBtn.addEventListener('click', function(e) { if (soundBtn) {
soundBtn.addEventListener('click', function(e) {
e.stopPropagation(); e.stopPropagation();
setMuted(!video.muted); setMuted(!video.muted);
}); });
}
// Hover to play // Hover to play (desktop)
if ('ontouchstart' in window === false) {
livePhoto.addEventListener('mouseenter', function() { livePhoto.addEventListener('mouseenter', function() {
if (isUserToggled) return;
hoverTimer = setTimeout(playVideo, HOVER_DELAY); hoverTimer = setTimeout(playVideo, HOVER_DELAY);
}); });
livePhoto.addEventListener('mouseleave', function() { livePhoto.addEventListener('mouseleave', function() {
clearTimeout(hoverTimer); clearTimeout(hoverTimer);
if (toggleBtn.getAttribute('data-state') !== 'live') { if (!isUserToggled) {
stopVideo(); stopVideo();
} }
}); });
}
// Mobile touch // Initialize muted state
livePhoto.addEventListener('touchstart', function() { setMuted(livePhoto.classList.contains('is-muted'));
if (livePhoto.classList.contains('is-playing')) {
stopVideo();
} else {
playVideo();
}
});
// Video ended
video.addEventListener('ended', function() {
if (toggleBtn.getAttribute('data-state') !== 'live') {
stopVideo();
}
});
}); });
} }
@@ -147,24 +130,24 @@ function initVoiceBubbles() {
if (isPlaying) { if (isPlaying) {
audio.pause(); audio.pause();
audio.currentTime = 0; audio.currentTime = 0;
bubble.classList.remove('playing'); bubble.classList.remove('is-playing');
isPlaying = false; isPlaying = false;
} else { } else {
// Stop other playing voices // Stop other playing voices
document.querySelectorAll('.amigo-voice-bubble.playing').forEach(function(other) { document.querySelectorAll('.amigo-voice-bubble.is-playing').forEach(function(other) {
if (other !== bubble) { if (other !== bubble) {
other.classList.remove('playing'); other.classList.remove('is-playing');
} }
}); });
audio.play(); audio.play();
bubble.classList.add('playing'); bubble.classList.add('is-playing');
isPlaying = true; isPlaying = true;
} }
}); });
audio.addEventListener('ended', function() { audio.addEventListener('ended', function() {
bubble.classList.remove('playing'); bubble.classList.remove('is-playing');
isPlaying = false; isPlaying = false;
}); });
}); });
@@ -190,6 +173,7 @@ function initMusicCards() {
if (!audioSrc) return; if (!audioSrc) return;
audio = new Audio(audioSrc); audio = new Audio(audioSrc);
card.__audio = audio;
// Load metadata // Load metadata
audio.addEventListener('loadedmetadata', function() { audio.addEventListener('loadedmetadata', function() {
@@ -201,7 +185,9 @@ function initMusicCards() {
audio.addEventListener('timeupdate', function() { audio.addEventListener('timeupdate', function() {
if (currentTime) currentTime.textContent = formatTime(audio.currentTime); if (currentTime) currentTime.textContent = formatTime(audio.currentTime);
if (seekInput && audio.duration) { if (seekInput && audio.duration) {
var progress = (audio.currentTime / audio.duration) * 100;
seekInput.value = (audio.currentTime / audio.duration * 1000).toString(); seekInput.value = (audio.currentTime / audio.duration * 1000).toString();
card.style.setProperty('--music-progress', progress + '%');
} }
}); });
@@ -209,18 +195,26 @@ function initMusicCards() {
function togglePlay() { function togglePlay() {
if (isPlaying) { if (isPlaying) {
audio.pause(); audio.pause();
card.classList.remove('playing'); card.setAttribute('data-playing', 'false');
if (playBtn) playBtn.setAttribute('aria-pressed', 'false');
isPlaying = false; isPlaying = false;
} else { } else {
// Stop other playing music // Stop other playing music
document.querySelectorAll('.amigo-music-card.playing').forEach(function(other) { document.querySelectorAll('.amigo-music-card[data-playing="true"]').forEach(function(other) {
if (other !== card) { if (other !== card) {
other.classList.remove('playing'); other.setAttribute('data-playing', 'false');
var otherPlayBtn = other.querySelector('.amigo-music-card__play');
if (otherPlayBtn) otherPlayBtn.setAttribute('aria-pressed', 'false');
var otherAudio = other.__audio;
if (otherAudio) {
try { otherAudio.pause(); } catch(e) {}
}
} }
}); });
audio.play(); audio.play();
card.classList.add('playing'); card.setAttribute('data-playing', 'true');
if (playBtn) playBtn.setAttribute('aria-pressed', 'true');
isPlaying = true; isPlaying = true;
} }
} }
@@ -238,14 +232,17 @@ function initMusicCards() {
if (seekInput) { if (seekInput) {
seekInput.addEventListener('input', function() { seekInput.addEventListener('input', function() {
if (audio.duration) { if (audio.duration) {
var progress = (parseFloat(seekInput.value) / 1000) * 100;
audio.currentTime = (parseFloat(seekInput.value) / 1000) * audio.duration; audio.currentTime = (parseFloat(seekInput.value) / 1000) * audio.duration;
card.style.setProperty('--music-progress', progress + '%');
} }
}); });
} }
// Ended // Ended
audio.addEventListener('ended', function() { audio.addEventListener('ended', function() {
card.classList.remove('playing'); card.setAttribute('data-playing', 'false');
if (playBtn) playBtn.setAttribute('aria-pressed', 'false');
isPlaying = false; isPlaying = false;
}); });
}); });
@@ -257,6 +254,55 @@ function formatTime(seconds) {
return m + ':' + (s < 10 ? '0' : '') + s; return m + ':' + (s < 10 ? '0' : '') + s;
} }
// ============================================================
// Cleanup functions for PJAX
// ============================================================
function cleanupVoiceBubbles() {
document.querySelectorAll('.amigo-voice-bubble').forEach(function(bubble) {
if (bubble.__audio) {
try {
bubble.__audio.pause();
bubble.__audio.src = '';
bubble.__audio = null;
} catch (e) {}
}
bubble.__voiceBound = false;
});
}
function cleanupMusicCards() {
document.querySelectorAll('.amigo-music-card').forEach(function(card) {
if (card.__audio) {
try {
card.__audio.pause();
card.__audio.src = '';
card.__audio = null;
} catch (e) {}
}
card.__musicBound = false;
});
}
function cleanupLivePhotos() {
document.querySelectorAll('.amigo-livephoto').forEach(function(livePhoto) {
var video = livePhoto.querySelector('video');
if (video) {
try {
video.pause();
video.src = '';
} catch (e) {}
}
livePhoto.__liveBound = false;
});
}
function cleanupAllShortcodes() {
cleanupVoiceBubbles();
cleanupMusicCards();
cleanupLivePhotos();
}
// ============================================================ // ============================================================
// Initialize all shortcodes // Initialize all shortcodes
// ============================================================ // ============================================================
@@ -273,10 +319,24 @@ document.addEventListener('DOMContentLoaded', initAllShortcodes);
// Page load // Page load
window.addEventListener('load', initAllShortcodes); window.addEventListener('load', initAllShortcodes);
// PJAX support - re-initialize after page transition // If DOM is already ready (script loaded late), initialize immediately
if (document.readyState === 'interactive' || document.readyState === 'complete') {
initAllShortcodes();
}
// PJAX support - cleanup before and re-initialize after page transition
document.addEventListener('pjax:beforeSend', cleanupAllShortcodes);
document.addEventListener('pjax:complete', initAllShortcodes); document.addEventListener('pjax:complete', initAllShortcodes);
document.addEventListener('pjax:success', initAllShortcodes); document.addEventListener('pjax:success', initAllShortcodes);
// Also listen for custom events that some PJAX libraries fire // Also listen for custom events that some PJAX libraries fire
document.addEventListener('page:loaded', initAllShortcodes); document.addEventListener('page:loaded', initAllShortcodes);
document.addEventListener('page:change', initAllShortcodes); document.addEventListener('page:change', initAllShortcodes);
document.addEventListener('turbo:load', initAllShortcodes);
document.addEventListener('turbo:before-render', cleanupAllShortcodes);
// History API based navigation
document.addEventListener('popstate', function() {
cleanupAllShortcodes();
setTimeout(initAllShortcodes, 10);
});
@@ -13,7 +13,7 @@
{{- $faviconUrl := printf "https://api.usj.cc/api/favicon?url=%s" $domain.Host -}} {{- $faviconUrl := printf "https://api.usj.cc/api/favicon?url=%s" $domain.Host -}}
{{- if $isBareUrl -}} {{- if $isBareUrl -}}
<a class="link-card" href="/tiaozhuan.html?target={{ $url | base64Encode }}" target="_blank" rel="noopener"> <a class="link-card" href="/tiaozhuan.html?target={{ $url | base64Encode }}" target="_blank" rel="noopener">
<img class="link-card-icon" src="{{ $faviconUrl }}" alt="" loading="lazy" onerror="this.style.display='none'"> <img class="link-card-icon" src="{{ $faviconUrl }}" alt="" loading="lazy" onerror="this.src='/image/avatar/tx7.jpg';this.onerror=null;">
<span class="link-card-body"> <span class="link-card-body">
<span class="link-card-title">{{ $domain.Host }}</span> <span class="link-card-title">{{ $domain.Host }}</span>
<span class="link-card-url">{{ $url }}</span> <span class="link-card-url">{{ $url }}</span>
@@ -22,7 +22,7 @@
</a> </a>
{{- else -}} {{- else -}}
<a class="link-card" href="/tiaozhuan.html?target={{ $url | base64Encode }}" target="_blank" rel="noopener"> <a class="link-card" href="/tiaozhuan.html?target={{ $url | base64Encode }}" target="_blank" rel="noopener">
<img class="link-card-icon" src="{{ $faviconUrl }}" alt="" loading="lazy" onerror="this.style.display='none'"> <img class="link-card-icon" src="{{ $faviconUrl }}" alt="" loading="lazy" onerror="this.src='/image/avatar/tx7.jpg';this.onerror=null;">
<span class="link-card-body"> <span class="link-card-body">
<span class="link-card-title">{{ $displayText }}</span> <span class="link-card-title">{{ $displayText }}</span>
<span class="link-card-url">{{ $domain.Host }}</span> <span class="link-card-url">{{ $domain.Host }}</span>
+1 -1
View File
@@ -8,7 +8,7 @@
<span class="meta-item">作者: {{ .Params.author | default .Site.Params.author.name }}</span> <span class="meta-item">作者: {{ .Params.author | default .Site.Params.author.name }}</span>
<span class="meta-item">浏览: <span id="busuanzi_value_page_uv"></span></span> <span class="meta-item">浏览: <span id="busuanzi_value_page_uv"></span></span>
<span class="meta-item">字数: {{ .WordCount }}</span> <span class="meta-item">字数: {{ .WordCount }}</span>
<span class="meta-item">阅读: 约 {{ .ReadingTime }} 分钟</span> <span class="meta-item meta-item-reading-time">阅读: 约 {{ .ReadingTime }} 分钟</span>
{{ with .GetTerms "categories" }} {{ with .GetTerms "categories" }}
<span class="meta-item">分类: <span class="meta-item">分类:
{{ range . }} {{ range . }}
+3 -3
View File
@@ -63,9 +63,10 @@
{{ $mypjax := resources.Get "js/modules/mypjax.js" }} {{ $mypjax := resources.Get "js/modules/mypjax.js" }}
{{ $pangu := resources.Get "js/modules/pangu.js" }} {{ $pangu := resources.Get "js/modules/pangu.js" }}
{{ $linkify := resources.Get "js/modules/linkify.js" }} {{ $linkify := resources.Get "js/modules/linkify.js" }}
{{ $shortcodesJs := resources.Get "js/shortcodes.js" }}
{{ $main := resources.Get "js/main.js" }} {{ $main := resources.Get "js/main.js" }}
{{ $coreScripts := slice $iconfont $uikit $viewimage $utils $loader $cache $search $floatingTools $nprogress $pjaxLib $mypjax $pangu $linkify $main | resources.Concat "js/core.js" | resources.Minify | resources.Fingerprint }} {{ $coreScripts := slice $iconfont $uikit $viewimage $utils $loader $cache $search $floatingTools $nprogress $pjaxLib $mypjax $pangu $linkify $shortcodesJs $main | resources.Concat "js/core.js" | resources.Minify | resources.Fingerprint }}
<script defer src="{{ $coreScripts.RelPermalink }}"></script> <script defer src="{{ $coreScripts.RelPermalink }}"></script>
@@ -170,9 +171,8 @@
{{/* ====== 5. 延迟加载的非关键JS ====== */}} {{/* ====== 5. 延迟加载的非关键JS ====== */}}
{{ $toast := resources.Get "js/modules/toast.js" }} {{ $toast := resources.Get "js/modules/toast.js" }}
{{ $easylazyload := resources.Get "js/modules/lazyload.js" }} {{ $easylazyload := resources.Get "js/modules/lazyload.js" }}
{{ $shortcodesJs := resources.Get "js/shortcodes.js" }}
{{ $deferredScripts := slice $toast $easylazyload $shortcodesJs | resources.Concat "js/deferred.js" | resources.Minify | resources.Fingerprint }} {{ $deferredScripts := slice $toast $easylazyload | resources.Concat "js/deferred.js" | resources.Minify | resources.Fingerprint }}
<script> <script>
// 使用requestIdleCallback在浏览器空闲时加载 // 使用requestIdleCallback在浏览器空闲时加载
+16 -5
View File
@@ -146,11 +146,22 @@
background-attachment: {{ .Site.Params.style.backgroundAttachment | default "fixed" }} !important; background-attachment: {{ .Site.Params.style.backgroundAttachment | default "fixed" }} !important;
} }
[data-theme="dark"] body { [data-theme="dark"] body {
background-image: none !important; background-image: url(/image/background/deno.webp) !important;
background-size: initial !important; background-size: contain !important;
background-repeat: initial !important; background-repeat: round !important;
background-position: initial !important; background-position: center !important;
background-attachment: initial !important; background-attachment: fixed !important;
}
[data-theme="dark"] body::before {
content: '' !important;
position: fixed !important;
top: 0 !important;
left: 0 !important;
width: 100% !important;
height: 100% !important;
background-color: rgba(0, 0, 0, 0.4) !important;
pointer-events: none !important;
z-index: -1 !important;
} }
@media (max-width: 768px) { @media (max-width: 768px) {
body { body {
@@ -0,0 +1,24 @@
{{- $bvid := .Get "bvid" | default (.Get 0) -}}
{{- $page := .Get "page" | default "1" -}}
{{- $danmaku := .Get "danmaku" | default "1" -}}
{{- $autoplay := .Get "autoplay" | default "0" -}}
{{- $ratio := .Get "ratio" | default "16:9" -}}
{{- $ratioParts := split $ratio ":" -}}
{{- $ratioW := index $ratioParts 0 -}}
{{- $ratioH := index $ratioParts 1 -}}
{{- $paddingBottom := (mul (div (float $ratioH) (float $ratioW)) 100) -}}
<div class="amigo-bilibili-wrapper" style="--padding-bottom: {{ $paddingBottom }}%">
<div class="amigo-bilibili-inner">
<iframe
src="//player.bilibili.com/player.html?bvid={{ $bvid }}&page={{ $page }}&danmaku={{ $danmaku }}&autoplay={{ $autoplay }}&high_quality=1"
scrolling="no"
border="0"
frameborder="no"
framespacing="0"
allowfullscreen="true"
loading="lazy">
</iframe>
</div>
</div>
+28 -25
View File
@@ -1,35 +1,38 @@
{{- $imageRaw := .Get "image" | default (.Get "src") -}} {{- $src := .Get "src" | default "" -}}
{{- $alt := .Get "alt" | default "Live Photo" -}} {{- $cover := .Get "cover" | default "" -}}
{{- $videoRaw := .Get "video" | default (replaceRE "\\.(avif|webp|jpg|jpeg|png|gif)$" ".mp4" $imageRaw) -}} {{- $muted := .Get "muted" | default "true" -}}
{{- $image := $imageRaw -}}
{{- $video := $videoRaw -}}
{{- if and $imageRaw (not (findRE "^(https?://|/)" $imageRaw)) -}} {{- if and $src (not (findRE "^(https?://|/)" $src)) -}}
{{- with .Page.Resources.GetMatch $imageRaw -}} {{- with .Page.Resources.GetMatch $src -}}
{{- $image = .RelPermalink -}} {{- $src = .RelPermalink -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- if and $videoRaw (not (findRE "^(https?://|/)" $videoRaw)) -}} {{- if and $cover (not (findRE "^(https?://|/)" $cover)) -}}
{{- with .Page.Resources.GetMatch $videoRaw -}} {{- with .Page.Resources.GetMatch $cover -}}
{{- $video = .RelPermalink -}} {{- $cover = .RelPermalink -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- $style := .Get "style" -}}
<div class="live-photo"{{ with $style }}{{ printf " style=%q" (. | safeCSS) | safeHTMLAttr }}{{ end }}> <div class="amigo-livephoto {{ if eq $muted "true" }}is-muted{{ end }}" data-src="{{ $src }}" data-cover="{{ $cover }}">
<img class="live-photo-poster" src="{{ $image }}" alt="{{ $alt }}" loading="lazy" data-keep="1" no-view> <div class="amigo-livephoto-badge">
<video class="live-photo-video" data-src="{{ $video }}" poster="{{ $image }}" muted playsinline loop preload="metadata" aria-label="{{ $alt }}"></video> <span class="amigo-livephoto-live">LIVE</span>
<div class="live-photo-controls-group"> <button class="amigo-livephoto-sound" type="button" aria-label="切换声音">
<button type="button" class="live-photo-control-btn live-photo-toggle-btn" data-state="static" aria-label="Toggle Live Photo"> <svg class="amigo-livephoto-sound-off" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<i class="icon-live" aria-hidden="true"></i> <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon>
<span class="live-photo-live-label">实况</span> <path d="M15.54 8.46a5 5 0 0 1 0 7.07"></path>
</button> <line x1="23" y1="9" x2="17" y2="15"></line>
<button type="button" class="live-photo-control-btn live-photo-mute-btn" data-muted="true" aria-label="Toggle Mute"> <line x1="17" y1="9" x2="23" y2="15"></line>
<i class="ri-volume-up-line live-photo-mute-icon icon-unmuted" aria-hidden="true"></i> </svg>
<i class="ri-volume-mute-line live-photo-mute-icon icon-muted" aria-hidden="true"></i> <svg class="amigo-livephoto-sound-on" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<span class="live-photo-mute-label">静音</span> <polygon points="11 5 6 9 2 9 2 15 6 15 11 19 11 5"></polygon>
<path d="M15.54 8.46a5 5 0 0 1 0 7.07"></path>
<path d="M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07"></path>
</svg>
</button> </button>
</div> </div>
<div class="warning" style="opacity: 0;"></div> <img class="amigo-livephoto-img" src="{{ $cover }}" alt="Live Photo" loading="lazy">
<video class="amigo-livephoto-video" preload="none" loop playsinline muted>
<source src="{{ $src }}" type="video/mp4">
</video>
</div> </div>
+16 -1
View File
@@ -3,9 +3,23 @@
{{ $name := .Get "name" | default "未知歌曲" }} {{ $name := .Get "name" | default "未知歌曲" }}
{{ $artist := .Get "artist" | default "未知艺术家" }} {{ $artist := .Get "artist" | default "未知艺术家" }}
{{ $accent := .Get "accent" | default "#d43c33" }} {{ $accent := .Get "accent" | default "#d43c33" }}
{{- if and $src (not (findRE "^(https?://|/)" $src)) -}}
{{- with .Page.Resources.GetMatch $src -}}
{{- $src = .RelPermalink -}}
{{- end -}}
{{- end -}}
{{- if and $cover (not (findRE "^(https?://|/)" $cover)) -}}
{{- with .Page.Resources.GetMatch $cover -}}
{{- $cover = .RelPermalink -}}
{{- end -}}
{{- end -}}
{{ $isApi := strings.HasPrefix $src "https://open.motues.top/music" }} {{ $isApi := strings.HasPrefix $src "https://open.motues.top/music" }}
<div class="amigo-music-card-mark amigo-music-card" data-amigo-music-card="1" data-src="{{ $src }}" data-name="{{ $name }}" data-artist="{{ $artist }}" data-is-api="{{ if $isApi }}true{{ else }}false{{ end }}" style="--music-accent:{{ $accent }}"> <div class="amigo-music-card-mark">
<div class="amigo-music-card" data-amigo-music-card="1" data-src="{{ $src }}" data-name="{{ $name }}" data-artist="{{ $artist }}" data-is-api="{{ if $isApi }}true{{ else }}false{{ end }}" style="--music-accent:{{ $accent }}">
<div class="amigo-music-card__hero"> <div class="amigo-music-card__hero">
<div class="amigo-music-card__art"> <div class="amigo-music-card__art">
<img class="amigo-music-card__cover amigo-music-card__cover--image" src="{{ $cover }}" alt="{{ $name }} cover" loading="lazy" data-keep="1"> <img class="amigo-music-card__cover amigo-music-card__cover--image" src="{{ $cover }}" alt="{{ $name }} cover" loading="lazy" data-keep="1">
@@ -31,3 +45,4 @@
</div> </div>
</div> </div>
</div> </div>
</div>
+14 -4
View File
@@ -43,9 +43,19 @@
{{ $muted := .Get "muted" | default "false" }} {{ $muted := .Get "muted" | default "false" }}
{{ $isGifMode := or (eq $loop "true") (eq $muted "true") }} {{ $isGifMode := or (eq $loop "true") (eq $muted "true") }}
{{ $videoSrc := $src }} {{ $videoSrc := $src }}
{{ if not (hasPrefix $src "http") }} {{ $posterSrc := $poster }}
{{ $videoSrc = printf "/%s/%s" .Page.Slug $src }}
{{ end }} {{- if and $src (not (findRE "^(https?://|/)" $src)) -}}
{{- with .Page.Resources.GetMatch $src -}}
{{- $videoSrc = .RelPermalink -}}
{{- end -}}
{{- end -}}
{{- if and $poster (not (findRE "^(https?://|/)" $poster)) -}}
{{- with .Page.Resources.GetMatch $poster -}}
{{- $posterSrc = .RelPermalink -}}
{{- end -}}
{{- end -}}
{{ if $isGifMode }} {{ if $isGifMode }}
{{/* GIF 模式:图片标签显示,自动循环 */}} {{/* GIF 模式:图片标签显示,自动循环 */}}
@@ -59,7 +69,7 @@
{{/* 视频模式:自定义播放器 */}} {{/* 视频模式:自定义播放器 */}}
<div class="video-wrap"> <div class="video-wrap">
<figure class="video-player" onclick="toggleVideo(this)"> <figure class="video-player" onclick="toggleVideo(this)">
<video preload="metadata" playsinline webkit-playsinline {{ with $poster }}poster="{{ . }}"{{ end }}> <video preload="metadata" playsinline webkit-playsinline {{ with $posterSrc }}poster="{{ . }}"{{ end }}>
<source src="{{ $videoSrc }}"> <source src="{{ $videoSrc }}">
</video> </video>
<div class="video-play-icon"> <div class="video-play-icon">
+10
View File
@@ -6,12 +6,22 @@
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- $author := .Site.Params.author.name | default "小赵" -}}
{{- $avatar := .Site.Params.author.avatar | default "/image/avatar/tx7.jpg" -}}
{{- $isToday := eq (.Page.Date.Format "2006-01-02") (now.Format "2006-01-02") -}} {{- $isToday := eq (.Page.Date.Format "2006-01-02") (now.Format "2006-01-02") -}}
<div class="amigo-voice-wrapper">
<div class="amigo-voice-user">
<img class="amigo-voice-avatar" src="{{ $avatar }}" alt="{{ $author }}" loading="lazy">
<span class="amigo-voice-name">{{ $author }}</span>
</div>
<div class="amigo-voice-bubble" data-src="{{ $src }}"> <div class="amigo-voice-bubble" data-src="{{ $src }}">
<div class="amigo-voice-content">
<div class="amigo-voice-icon"> <div class="amigo-voice-icon">
<span></span><span></span><span></span> <span></span><span></span><span></span>
</div> </div>
<span class="amigo-voice-duration">″</span> <span class="amigo-voice-duration">″</span>
</div>
{{ if $isToday }}<i class="amigo-voice-unread"></i>{{ end }} {{ if $isToday }}<i class="amigo-voice-unread"></i>{{ end }}
</div> </div>
</div>
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><path d="M1024 512C1024 229.376 794.624 0 512 0S0 229.376 0 512s229.376 512 512 512 512-229.376 512-512zM501.76 199.68l40.96 10.24 30.72-30.72-10.24 40.96 40.96 20.48-40.96 10.24v40.96l-20.48-30.72-51.2 10.24 30.72-40.96-20.48-30.72z m-122.88 327.68L286.72 455.68l-92.16 71.68 30.72-112.64-92.16-71.68h122.88l30.72-112.64 40.96 112.64h112.64L348.16 414.72l30.72 112.64z m184.32 92.16v40.96l-20.48-30.72-51.2 10.24 30.72-40.96-20.48-30.72 40.96 10.24 30.72-30.72-10.24 40.96 40.96 20.48-40.96 10.24z m122.88-71.68l-30.72-20.48-40.96 20.48 20.48-40.96-40.96-20.48h40.96l20.48-40.96 10.24 40.96 40.96-10.24-30.72 30.72 10.24 40.96z m-20.48-184.32l-20.48 40.96v-40.96l-51.2-10.24 40.96-20.48v-40.96l30.72 30.72 40.96-20.48-30.72 40.96 40.96 30.72-51.2-10.24z" fill="#6b21a8"></path><path d="M327.68 343.04l-40.96-112.64-30.72 112.64H133.12l92.16 71.68-30.72 112.64 92.16-71.68 92.16 71.68-30.72-112.64 92.16-71.68zM542.72 261.12l20.48 30.72v-40.96l40.96-10.24-40.96-20.48 10.24-40.96-30.72 30.72-40.96-10.24 20.48 30.72-30.72 40.96zM706.56 302.08l-40.96 20.48-30.72-30.72v40.96l-40.96 20.48 51.2 10.24v40.96l20.48-40.96 51.2 10.24-40.96-30.72zM665.6 486.4l-10.24-40.96-20.48 40.96h-40.96l40.96 20.48-20.48 40.96 40.96-20.48 30.72 20.48-10.24-40.96 30.72-30.72zM573.44 547.84l-30.72 30.72-40.96-10.24 20.48 30.72-30.72 40.96 51.2-10.24 20.48 30.72v-40.96l40.96-10.24-40.96-20.48z" fill="#78350f"></path></svg>

After

Width:  |  Height:  |  Size: 1.4 KiB