From 56ea059fc0da329ceeb2de2aed81f99a687ecd7b Mon Sep 17 00:00:00 2001 From: Vaica <94612053+zqlit@users.noreply.github.com> Date: Wed, 24 Jun 2026 20:22:40 +0800 Subject: [PATCH] =?UTF-8?q?2022=20=E4=B8=BB=E9=A2=98bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2026-06-24-测试-20260624174421/index.md | 16 +- themes/Ying/assets/css/critical.css | 16 + themes/Ying/assets/css/main.css | 119 +- themes/Ying/assets/css/shortcodes.css | 1164 ++++++++++++++--- themes/Ying/assets/js/main.js | 4 +- themes/Ying/assets/js/shortcodes.js | 202 ++- .../layouts/_default/_markup/render-link.html | 4 +- themes/Ying/layouts/_default/single.html | 2 +- themes/Ying/layouts/partials/footer.html | 6 +- themes/Ying/layouts/partials/head.html | 21 +- themes/Ying/layouts/shortcodes/bilibili.html | 24 + themes/Ying/layouts/shortcodes/livephoto.html | 57 +- .../Ying/layouts/shortcodes/music-card.html | 17 +- themes/Ying/layouts/shortcodes/video.html | 18 +- themes/Ying/layouts/shortcodes/voice.html | 20 +- .../Ying/static/image/background/bg-dark.svg | 1 + 16 files changed, 1357 insertions(+), 334 deletions(-) create mode 100644 themes/Ying/layouts/shortcodes/bilibili.html create mode 100644 themes/Ying/static/image/background/bg-dark.svg diff --git a/content/posts/2026/2026-06-24-测试-20260624174421/index.md b/content/posts/2026/2026-06-24-测试-20260624174421/index.md index d3f1c21b..43846a6e 100644 --- a/content/posts/2026/2026-06-24-测试-20260624174421/index.md +++ b/content/posts/2026/2026-06-24-测试-20260624174421/index.md @@ -1,6 +1,6 @@ --- title: 测试 -date: '2026-06-24T00:00:00.000Z' +date: '2026-06-24T10:30:00.000Z' slug: '20260624174421' draft: false categories: @@ -13,10 +13,6 @@ layout: post {{< voice src="1782294286938-voice.oga" >}} - - - - {{< 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" >}} +## Bilibili 视频嵌入 + +{{< bilibili bvid="BV1agJV6kEBH" >}} + + +## Live Photo 实况照片 + +{{< livephoto src="1782294568482-BAACAgQA.mp4" cover="1782294566846-AgACAgQA.jpg" >}} + ![image](1782294630552-AgACAgQA.jpg) - diff --git a/themes/Ying/assets/css/critical.css b/themes/Ying/assets/css/critical.css index 7cac3936..f2b8cb7d 100644 --- a/themes/Ying/assets/css/critical.css +++ b/themes/Ying/assets/css/critical.css @@ -53,6 +53,22 @@ body { [data-theme="dark"] body { color: var(--text-content-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; } /* 主容器 - 关键布局 */ diff --git a/themes/Ying/assets/css/main.css b/themes/Ying/assets/css/main.css index f12209c7..bad0403e 100644 --- a/themes/Ying/assets/css/main.css +++ b/themes/Ying/assets/css/main.css @@ -40,10 +40,22 @@ html { [data-theme="dark"] body { color: var(--text-content-dark-color); background-color: var(--background-dark-color); - background-image: none !important; - background-repeat: initial !important; - background-size: initial !important; - background-attachment: initial !important; + background-image: url(/image/background/deno.webp) !important; + background-repeat: round !important; + background-size: contain !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 { @@ -219,6 +231,11 @@ code::-webkit-scrollbar { border-radius: 4px; display: flex; flex-direction: column; + padding-bottom: 40px; +} + +.code-fold-container.collapsed { + padding-bottom: 0; } .code-fold-container.collapsed .highlight, @@ -257,10 +274,16 @@ code::-webkit-scrollbar { } .code-fold-container:not(.collapsed) .code-expand-btn { - position: sticky; - bottom: 10px; - margin: 10px auto 0; - transform: none; + position: absolute !important; + bottom: 10px !important; + left: 50% !important; + 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 */ @@ -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 { display: flex; align-items: center; gap: 12px; - padding: 12px 16px; + padding: 14px 16px; margin: 1rem 0; border: 1px solid rgba(0, 0, 0, 0.08); 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; - color: #1e1e1e; + color: #1a1a1a; font-size: 14px; line-height: 1.5; max-width: 100%; - transition: all 0.2s ease; - box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04); + transition: all 0.25s ease; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); } a.link-card:hover { border-color: rgba(0, 0, 0, 0.15); - box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); - transform: translateY(-1px); + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08); + transform: translateY(-2px); text-decoration: none !important; } a.link-card .link-card-icon { - width: 24px; - height: 24px; - border-radius: 5px; + width: 28px; + height: 28px; + border-radius: 8px; 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 { flex: 1; min-width: 0; display: flex; flex-direction: column; - gap: 1px; + gap: 2px; } a.link-card .link-card-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; - font-size: 13.5px; - color: rgba(30, 30, 30, 0.92); + font-size: 14px; + color: #1a1a1a; } a.link-card .link-card-url { font-size: 11px; - color: rgba(30, 30, 30, 0.45); + color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; + font-family: -apple-system, BlinkMacSystemFont, 'SF Mono', Monaco, monospace; } a.link-card .link-card-arrow { flex-shrink: 0; - color: rgba(30, 30, 30, 0.3); - font-size: 13px; - transition: color 0.2s; + color: #999; + font-size: 14px; + transition: all 0.25s ease; } 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 { - border-color: rgba(148, 163, 184, 0.15); - background: linear-gradient(135deg, rgba(30, 41, 59, 0.7), rgba(15, 23, 42, 0.5)); - color: #e2e8f0; - box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15); + border-color: rgba(255, 255, 255, 0.08); + background: rgba(30, 30, 30, 0.85); + color: #e5e5e5; + box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); } [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 { - color: rgba(226, 232, 240, 0.96); + color: #e5e5e5; } [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 { - color: rgba(226, 232, 240, 0.3); + color: #666; } [data-theme="dark"] a.link-card:hover .link-card-arrow { - color: rgba(226, 232, 240, 0.6); + color: #ccc; } /* Reward System */ @@ -5886,3 +5924,10 @@ a.link-card:hover .link-card-arrow { border: none; border-radius: 12px; } + +/* 移动端隐藏阅读时间 */ +@media (max-width: 768px) { + .meta-item-reading-time { + display: none; + } +} diff --git a/themes/Ying/assets/css/shortcodes.css b/themes/Ying/assets/css/shortcodes.css index 52dd0bb6..d4ee8a0d 100644 --- a/themes/Ying/assets/css/shortcodes.css +++ b/themes/Ying/assets/css/shortcodes.css @@ -31,6 +31,9 @@ /* 功能性颜色 */ --theme-color: #07c160; /* 微信绿 */ + --theme-main: #07c160; + --theme-main-20: rgba(7, 193, 96, 0.2); + --theme-main-30: rgba(7, 193, 96, 0.3); --border-main: #eeeeee; --border-quote: #dfe2e5; --shadow-main: rgba(0, 0, 0, 0.03); @@ -66,6 +69,9 @@ --text-quote: #999999; --border-main: #333333; + --theme-main: #07c160; + --theme-main-20: rgba(7, 193, 96, 0.25); + --theme-main-30: rgba(7, 193, 96, 0.35); --border-quote: #444444; --shadow-main: rgba(0, 0, 0, 0.3); --shadow-header: rgba(0, 0, 0, 0.5); @@ -77,96 +83,140 @@ } /* ========================================================================== - Voice Bubble - 语音气泡(1:1 移植自 Amigo) + Voice Bubble - 语音气泡(主题风格 + 头像昵称) ========================================================================== */ +.amigo-voice-wrapper { + display: flex; + align-items: flex-start; + gap: 10px; + margin: 12px 0 12px 16px; +} + +.amigo-voice-user { + display: flex; + flex-direction: column; + align-items: center; + gap: 4px; + flex-shrink: 0; +} + +.amigo-voice-avatar { + width: 36px; + height: 36px; + border-radius: 50%; + object-fit: cover; + border: 1px solid var(--border-main); +} + +.amigo-voice-name { + font-size: 11px; + color: var(--text-muted); + line-height: 1; + white-space: nowrap; +} + .amigo-voice-bubble { position: relative; - background: #42c27a; - color: #111; - width: auto; - max-width: 200px; - min-width: 100px; - height: 36px; - border-radius: 8px; - display: inline-flex; + display: flex; align-items: center; - justify-content: flex-start; - padding: 0 18px; - font-size: 18px; - font-weight: 500; + gap: 10px; + background: var(--bg-card); + border-radius: 12px; + padding: 10px 14px; + min-width: 120px; + max-width: 240px; cursor: pointer; -webkit-user-select: none; user-select: none; - transition: background 0.2s, transform 0.1s; + transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); + border: 1px solid var(--border-main); } -/* 左侧尾巴 */ -.amigo-voice-bubble::before { - content: ""; - position: absolute; - left: -8px; - top: 14px; - width: 0; - height: 0; - border-right: 10px solid #42c27a; - border-top: 6px solid transparent; - border-bottom: 6px solid transparent; +.amigo-voice-bubble:hover { + transform: translateY(-1px); + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); } .amigo-voice-bubble:active { - transform: scale(0.97); + transform: scale(0.96); } .amigo-voice-bubble.is-playing { - background: #38b56e; + background: var(--theme-main); + border: none; + padding: 11px 15px; + transform: scale(1.02); + box-shadow: 0 4px 16px var(--theme-main-20); } -.amigo-voice-bubble.is-playing::before { - border-right-color: #38b56e; +.amigo-voice-bubble.is-playing:hover { + transform: scale(1.04) translateY(-1px); + box-shadow: 0 6px 20px var(--theme-main-30); +} + +.amigo-voice-bubble.is-playing .amigo-voice-icon span { + background: #ffffff !important; +} + +.amigo-voice-bubble.is-playing .amigo-voice-duration { + color: #ffffff !important; + font-weight: 600; } -/* 语音图标动画 */ .amigo-voice-icon { display: flex; align-items: center; gap: 2px; - height: 16px; - margin-right: 8px; + flex-shrink: 0; } .amigo-voice-icon span { display: block; - width: 3px; + width: 2px; border-radius: 2px; - background: currentColor; - animation: amigo-voice-wave 1.2s ease-in-out infinite; + background: var(--text-muted); + transition: background 0.2s ease; } -.amigo-voice-icon span:nth-child(1) { - height: 8px; - animation-delay: 0s; +.amigo-voice-icon span:nth-child(1) { height: 8px; } +.amigo-voice-icon span:nth-child(2) { height: 14px; } +.amigo-voice-icon span:nth-child(3) { height: 6px; } + +.amigo-voice-bubble.is-playing .amigo-voice-icon span { + animation: voiceWaveApple 0.45s ease-in-out infinite alternate; } -.amigo-voice-icon span:nth-child(2) { - height: 12px; - animation-delay: 0.15s; -} +.amigo-voice-bubble.is-playing .amigo-voice-icon span:nth-child(1) { animation-delay: 0s; } +.amigo-voice-bubble.is-playing .amigo-voice-icon span:nth-child(2) { animation-delay: 0.1s; } +.amigo-voice-bubble.is-playing .amigo-voice-icon span:nth-child(3) { animation-delay: 0.2s; } -.amigo-voice-icon span:nth-child(3) { - height: 6px; - animation-delay: 0.3s; -} - -@keyframes amigo-voice-wave { - 0%, 100% { transform: scaleY(0.5); } - 50% { transform: scaleY(1); } +@keyframes voiceWaveApple { + 0% { + transform: scaleY(0.5); + opacity: 0.7; + } + 100% { + transform: scaleY(1); + opacity: 1; + } } .amigo-voice-duration { - color: #111; - font-size: 16px; + font-size: 13px; font-weight: 500; + color: var(--text-main); + font-variant-numeric: tabular-nums; +} + +.amigo-voice-unread { + position: absolute; + right: 6px; + top: 6px; + width: 8px; + height: 8px; + background: var(--theme-main); + border-radius: 50%; } /* 首页语音气泡:柔和风格 */ @@ -200,37 +250,214 @@ } /* ========================================================================== - Music Card - 音乐卡片(1:1 移植自 Amigo) + Bilibili - B站视频嵌入 ========================================================================== */ +.amigo-bilibili-wrapper { + position: relative; + width: 100%; + max-width: 100%; + padding-bottom: var(--padding-bottom, 56.25%); + margin: 16px 0; + border-radius: 12px; + overflow: hidden; + background: #000; + box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1); +} + +.amigo-bilibili-inner { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; +} + +.amigo-bilibili-inner iframe { + width: 100%; + height: 100%; + border: none; + display: block; +} + +[data-theme="dark"] .amigo-bilibili-wrapper { + box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3); +} + +/* ========================================================================== + Live Photo - 实况照片 + ========================================================================== */ + +.amigo-livephoto { + position: relative; + width: 100%; + max-width: 100%; + margin: 16px 0; + border-radius: 12px; + overflow: hidden; + cursor: pointer; + -webkit-user-select: none; + user-select: none; + background: var(--bg-card); + box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08); + transition: box-shadow 0.2s ease; +} + +.amigo-livephoto:hover { + box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12); +} + +.amigo-livephoto:active { + transform: scale(0.99); +} + +.amigo-livephoto-badge { + position: absolute; + top: 12px; + left: 12px; + z-index: 10; + display: flex; + align-items: center; + gap: 8px; +} + +.amigo-livephoto-live { + display: inline-flex; + align-items: center; + justify-content: center; + height: 28px; + padding: 0 12px; + border-radius: 14px; + background: rgba(0, 0, 0, 0.6); + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); + color: #ffffff; + font-size: 12px; + font-weight: 600; + letter-spacing: 0.5px; +} + +.amigo-livephoto-sound { + display: inline-flex; + align-items: center; + justify-content: center; + width: 28px; + height: 28px; + border: none; + border-radius: 50%; + background: rgba(0, 0, 0, 0.6); + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10px); + color: #ffffff; + cursor: pointer; + padding: 0; + transition: all 0.2s ease; +} + +.amigo-livephoto-sound:hover { + background: rgba(0, 0, 0, 0.8); + transform: scale(1.1); +} + +.amigo-livephoto-sound svg { + width: 16px; + height: 16px; +} + +.amigo-livephoto-sound-on { + display: none; +} + +.amigo-livephoto:not(.is-muted) .amigo-livephoto-sound-off { + display: none; +} + +.amigo-livephoto:not(.is-muted) .amigo-livephoto-sound-on { + display: block; +} + +.amigo-livephoto-img { + width: 100%; + height: auto; + display: block; + object-fit: cover; + transition: opacity 0.3s ease; +} + +.amigo-livephoto-video { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + object-fit: cover; + opacity: 0; + pointer-events: none; + transition: opacity 0.3s ease; +} + +.amigo-livephoto.is-playing .amigo-livephoto-img { + opacity: 0; +} + +.amigo-livephoto.is-playing .amigo-livephoto-video { + opacity: 1; +} + +[data-theme="dark"] .amigo-livephoto { + box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3); +} + +[data-theme="dark"] .amigo-livephoto:hover { + box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4); +} + +/* ========================================================================== + Music Card - 音乐卡片(Apple 风格) + ========================================================================== */ + +.amigo-music-card-mark { + display: flex; + justify-content: center; + width: 100%; + margin: 16px 0; +} + .amigo-music-card { --music-accent: #d43c33; --music-progress: 0%; - --music-card-bg: #f7f7f8; - --music-card-border: rgba(0, 0, 0, 0.05); - --music-card-hover-border: rgba(0, 0, 0, 0.08); - --music-card-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75); - --music-cover-bg: #ececef; - --music-cover-image-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08); + --music-card-bg: #f5f5f7; + --music-card-border: rgba(0, 0, 0, 0.06); + --music-card-hover-border: rgba(0, 0, 0, 0.1); + --music-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06); + --music-cover-bg: #e8e8ed; + --music-cover-image-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08); --music-title-color: var(--text-main); --music-artist-color: var(--text-desc); --music-meta-color: var(--text-muted); - --music-button-border: rgba(0, 0, 0, 0.05); - --music-button-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 248, 249, 0.92)); + --music-button-border: rgba(0, 0, 0, 0.08); + --music-button-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 248, 249, 0.9)); --music-button-color: color-mix(in srgb, var(--music-accent) 60%, #111 40%); - --music-button-shadow: 0 6px 12px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04); - --music-track-bg: rgba(0, 0, 0, 0.06); - --music-track-fill-shadow: 0 1px 3px color-mix(in srgb, var(--music-accent) 30%, transparent); + --music-button-shadow: 0 4px 10px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.05); + --music-track-bg: rgba(0, 0, 0, 0.08); + --music-track-fill-shadow: 0 1px 2px color-mix(in srgb, var(--music-accent) 25%, transparent); --music-thumb-bg: #fff; --music-thumb-border: var(--music-accent); - --music-thumb-shadow: 0 1px 4px rgba(0, 0, 0, 0.15); - --music-equalizer-bg: rgba(0, 0, 0, 0.55); - padding: 12px; - border-radius: 14px; + --music-thumb-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); + --music-equalizer-bg: rgba(0, 0, 0, 0.5); + width: 100%; + max-width: 500px; + padding: 10px 14px; + border-radius: 16px; border: 1px solid var(--music-card-border); background: var(--music-card-bg); box-shadow: var(--music-card-shadow); - transition: border-color 0.2s ease; + transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); +} + +.amigo-music-card:hover { + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08); + border-color: var(--music-card-hover-border); } .amigo-music-card__hero { @@ -404,37 +631,69 @@ font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1; + letter-spacing: 0.01em; + color: var(--music-meta-color); } .amigo-music-card__time--current { grid-area: current; - text-align: left; - color: var(--music-meta-color); + justify-self: start; } .amigo-music-card__time--duration { grid-area: duration; - text-align: right; - color: var(--music-meta-color); + justify-self: end; } .amigo-music-card__seek-wrap { grid-area: seek; position: relative; + min-width: 0; height: var(--music-thumb-size); - display: flex; - align-items: center; + overflow: visible; +} + +.amigo-music-card__seek-wrap::before, +.amigo-music-card__seek-wrap::after { + content: ""; + position: absolute; + top: 50%; + left: 0; + right: 0; + height: var(--music-track-height); + border-radius: 999px; + transform: translateY(-50%); + pointer-events: none; +} + +.amigo-music-card__seek-wrap::before { + background: var(--music-track-bg); +} + +.amigo-music-card__seek-wrap::after { + right: auto; + width: max(0px, calc(var(--music-progress) - (var(--music-thumb-size) / 2))); + background: var(--music-accent); + box-shadow: var(--music-track-fill-shadow); } .amigo-music-card__seek { + position: absolute; + inset: 0; + z-index: 3; + width: 100%; + height: var(--music-thumb-size); + margin: 0; -webkit-appearance: none; appearance: none; - width: 100%; - height: var(--music-track-height); - border-radius: 999px; - background: var(--music-track-bg); - outline: none; + background: 0 0; cursor: pointer; + opacity: 0; +} + +.amigo-music-card__seek::-webkit-slider-runnable-track { + height: var(--music-thumb-size); + background: 0 0; } .amigo-music-card__seek::-webkit-slider-thumb { @@ -442,41 +701,59 @@ appearance: none; width: var(--music-thumb-size); height: var(--music-thumb-size); + margin-top: 0; + border: 0; border-radius: 50%; - background: var(--music-thumb-bg); - border: 2px solid var(--music-thumb-border); - box-shadow: var(--music-thumb-shadow); - cursor: pointer; + background: 0 0; + box-shadow: none; +} + +.amigo-music-card__seek::-moz-range-track { + height: var(--music-thumb-size); + background: 0 0; + border: 0; +} + +.amigo-music-card__seek::-moz-range-progress { + background: 0 0; } .amigo-music-card__seek::-moz-range-thumb { width: var(--music-thumb-size); height: var(--music-thumb-size); + border: 0; border-radius: 50%; - background: var(--music-thumb-bg); - border: 2px solid var(--music-thumb-border); - box-shadow: var(--music-thumb-shadow); - cursor: pointer; + background: 0 0; + box-sizing: border-box; + box-shadow: none; } .amigo-music-card__seek-thumb { position: absolute; - left: 0; top: 50%; - transform: translate(-50%, -50%); + left: clamp(0px, calc(var(--music-progress) - (var(--music-thumb-size) / 2)), calc(100% - var(--music-thumb-size))); + z-index: 2; width: var(--music-thumb-size); height: var(--music-thumb-size); + border: 2px solid var(--music-thumb-border); border-radius: 50%; background: var(--music-thumb-bg); - border: 2px solid var(--music-thumb-border); - box-shadow: var(--music-thumb-shadow); + box-sizing: border-box; + transform: translateY(-50%); pointer-events: none; - opacity: 0; - transition: opacity 0.15s ease; + box-shadow: var(--music-thumb-shadow); } -.amigo-music-card__seek:active ~ .amigo-music-card__seek-thumb { - opacity: 1; +.amigo-music-card .sr-only { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border: 0; } /* 响应式 */ @@ -656,29 +933,81 @@ 强制优先级 - 覆盖 ying 主题默认样式 ========================================================================== */ -/* 强制使用 Amigo 语音样式 */ +/* 强制使用主题风格语音样式 */ +.article-content .amigo-voice-wrapper, +.article-text .amigo-voice-wrapper, +.post-content .amigo-voice-wrapper, +main .amigo-voice-wrapper, +.amigo-voice-wrapper { + display: flex !important; + align-items: flex-start !important; + gap: 10px !important; + margin: 12px 0 12px 16px !important; + padding: 0 !important; + border: none !important; + background: none !important; +} + +.article-content .amigo-voice-user, +.article-text .amigo-voice-user, +.post-content .amigo-voice-user, +main .amigo-voice-user, +.amigo-voice-user { + display: flex !important; + flex-direction: column !important; + align-items: center !important; + gap: 4px !important; + flex-shrink: 0 !important; +} + +.article-content .amigo-voice-avatar, +.article-text .amigo-voice-avatar, +.post-content .amigo-voice-avatar, +main .amigo-voice-avatar, +.amigo-voice-avatar { + width: 36px !important; + height: 36px !important; + border-radius: 50% !important; + object-fit: cover !important; + border: 1px solid var(--border-main) !important; + margin: 0 !important; + padding: 0 !important; +} + +.article-content .amigo-voice-name, +.article-text .amigo-voice-name, +.post-content .amigo-voice-name, +main .amigo-voice-name, +.amigo-voice-name { + font-size: 11px !important; + color: var(--text-muted) !important; + line-height: 1 !important; + white-space: nowrap !important; + margin: 0 !important; + padding: 0 !important; + font-weight: normal !important; +} + .article-content .amigo-voice-bubble, .article-text .amigo-voice-bubble, .post-content .amigo-voice-bubble, main .amigo-voice-bubble, .amigo-voice-bubble { position: relative !important; - background: #42c27a !important; - color: #111 !important; - width: auto !important; - max-width: 200px !important; - min-width: 100px !important; - height: 36px !important; - border-radius: 8px !important; - display: inline-flex !important; + display: flex !important; align-items: center !important; - justify-content: flex-start !important; - padding: 0 18px !important; - font-size: 18px !important; - font-weight: 500 !important; + gap: 10px !important; + background: var(--bg-card) !important; + border-radius: 12px !important; + padding: 10px 14px !important; + min-width: 120px !important; + max-width: 240px !important; cursor: pointer !important; - border: none !important; - box-shadow: none !important; + transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important; + border: 1px solid var(--border-main) !important; + height: auto !important; + -webkit-user-select: none !important; + user-select: none !important; } .article-content .amigo-voice-bubble::before, @@ -686,16 +1015,25 @@ main .amigo-voice-bubble, .post-content .amigo-voice-bubble::before, main .amigo-voice-bubble::before, .amigo-voice-bubble::before { - content: "" !important; - position: absolute !important; - left: -8px !important; - top: 14px !important; - width: 0 !important; - height: 0 !important; - border-right: 10px solid #42c27a !important; - border-top: 6px solid transparent !important; - border-bottom: 6px solid transparent !important; - display: block !important; + display: none !important; +} + +.article-content .amigo-voice-bubble:hover, +.article-text .amigo-voice-bubble:hover, +.post-content .amigo-voice-bubble:hover, +main .amigo-voice-bubble:hover, +.amigo-voice-bubble:hover { + transform: translateY(-1px) !important; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important; + background: var(--bg-card) !important; +} + +.article-content .amigo-voice-bubble:active, +.article-text .amigo-voice-bubble:active, +.post-content .amigo-voice-bubble:active, +main .amigo-voice-bubble:active, +.amigo-voice-bubble:active { + transform: scale(0.96) !important; } .article-content .amigo-voice-bubble.is-playing, @@ -703,15 +1041,47 @@ main .amigo-voice-bubble::before, .post-content .amigo-voice-bubble.is-playing, main .amigo-voice-bubble.is-playing, .amigo-voice-bubble.is-playing { - background: #38b56e !important; + background: var(--theme-main) !important; + border: none !important; + padding: 11px 15px !important; + transform: scale(1.02) !important; + box-shadow: 0 4px 16px var(--theme-main-20) !important; } -.article-content .amigo-voice-bubble.is-playing::before, -.article-text .amigo-voice-bubble.is-playing::before, -.post-content .amigo-voice-bubble.is-playing::before, -main .amigo-voice-bubble.is-playing::before, -.amigo-voice-bubble.is-playing::before { - border-right-color: #38b56e !important; +.article-content .amigo-voice-bubble.is-playing:hover, +.article-text .amigo-voice-bubble.is-playing:hover, +.post-content .amigo-voice-bubble.is-playing:hover, +main .amigo-voice-bubble.is-playing:hover, +.amigo-voice-bubble.is-playing:hover { + transform: scale(1.04) translateY(-1px) !important; + box-shadow: 0 6px 20px var(--theme-main-30) !important; +} + +.article-content .amigo-voice-bubble.is-playing .amigo-voice-icon span, +.article-text .amigo-voice-bubble.is-playing .amigo-voice-icon span, +.post-content .amigo-voice-bubble.is-playing .amigo-voice-icon span, +main .amigo-voice-bubble.is-playing .amigo-voice-icon span, +.amigo-voice-bubble.is-playing .amigo-voice-icon span { + background: #ffffff !important; +} + +.article-content .amigo-voice-bubble.is-playing .amigo-voice-duration, +.article-text .amigo-voice-bubble.is-playing .amigo-voice-duration, +.post-content .amigo-voice-bubble.is-playing .amigo-voice-duration, +main .amigo-voice-bubble.is-playing .amigo-voice-duration, +.amigo-voice-bubble.is-playing .amigo-voice-duration { + color: #ffffff !important; + font-weight: 600 !important; +} + +.article-content .amigo-voice-content, +.article-text .amigo-voice-content, +.post-content .amigo-voice-content, +main .amigo-voice-content, +.amigo-voice-content { + display: flex !important; + align-items: center !important; + gap: 10px !important; } .article-content .amigo-voice-icon, @@ -722,8 +1092,13 @@ main .amigo-voice-icon, display: flex !important; align-items: center !important; gap: 2px !important; - height: 16px !important; - margin-right: 8px !important; + flex-shrink: 0 !important; + margin-right: 0 !important; + width: auto !important; + height: auto !important; + background: none !important; + border-radius: 0 !important; + justify-content: flex-start !important; } .article-content .amigo-voice-icon span, @@ -731,11 +1106,13 @@ main .amigo-voice-icon, .post-content .amigo-voice-icon span, main .amigo-voice-icon span, .amigo-voice-icon span { + position: static !important; display: block !important; - width: 3px !important; + width: 2px !important; border-radius: 2px !important; - background: currentColor !important; - animation: amigo-voice-wave 1.2s ease-in-out infinite !important; + background: var(--text-muted) !important; + transition: background 0.2s ease !important; + left: auto !important; } .article-content .amigo-voice-icon span:nth-child(1), @@ -744,7 +1121,6 @@ main .amigo-voice-icon span, main .amigo-voice-icon span:nth-child(1), .amigo-voice-icon span:nth-child(1) { height: 8px !important; - animation-delay: 0s !important; } .article-content .amigo-voice-icon span:nth-child(2), @@ -752,8 +1128,7 @@ main .amigo-voice-icon span:nth-child(1), .post-content .amigo-voice-icon span:nth-child(2), main .amigo-voice-icon span:nth-child(2), .amigo-voice-icon span:nth-child(2) { - height: 12px !important; - animation-delay: 0.15s !important; + height: 14px !important; } .article-content .amigo-voice-icon span:nth-child(3), @@ -762,7 +1137,49 @@ main .amigo-voice-icon span:nth-child(2), main .amigo-voice-icon span:nth-child(3), .amigo-voice-icon span:nth-child(3) { height: 6px !important; - animation-delay: 0.3s !important; +} + +.article-content .amigo-voice-bubble.is-playing .amigo-voice-icon span, +.article-text .amigo-voice-bubble.is-playing .amigo-voice-icon span, +.post-content .amigo-voice-bubble.is-playing .amigo-voice-icon span, +main .amigo-voice-bubble.is-playing .amigo-voice-icon span, +.amigo-voice-bubble.is-playing .amigo-voice-icon span { + animation: voiceWaveApple 0.45s ease-in-out infinite alternate !important; +} + +.article-content .amigo-voice-bubble.is-playing .amigo-voice-icon span:nth-child(1), +.article-text .amigo-voice-bubble.is-playing .amigo-voice-icon span:nth-child(1), +.post-content .amigo-voice-bubble.is-playing .amigo-voice-icon span:nth-child(1), +main .amigo-voice-bubble.is-playing .amigo-voice-icon span:nth-child(1), +.amigo-voice-bubble.is-playing .amigo-voice-icon span:nth-child(1) { + animation-delay: 0s !important; +} + +.article-content .amigo-voice-bubble.is-playing .amigo-voice-icon span:nth-child(2), +.article-text .amigo-voice-bubble.is-playing .amigo-voice-icon span:nth-child(2), +.post-content .amigo-voice-bubble.is-playing .amigo-voice-icon span:nth-child(2), +main .amigo-voice-bubble.is-playing .amigo-voice-icon span:nth-child(2), +.amigo-voice-bubble.is-playing .amigo-voice-icon span:nth-child(2) { + animation-delay: 0.1s !important; +} + +.article-content .amigo-voice-bubble.is-playing .amigo-voice-icon span:nth-child(3), +.article-text .amigo-voice-bubble.is-playing .amigo-voice-icon span:nth-child(3), +.post-content .amigo-voice-bubble.is-playing .amigo-voice-icon span:nth-child(3), +main .amigo-voice-bubble.is-playing .amigo-voice-icon span:nth-child(3), +.amigo-voice-bubble.is-playing .amigo-voice-icon span:nth-child(3) { + animation-delay: 0.2s !important; +} + +@keyframes voiceWaveApple { + 0% { + transform: scaleY(0.5); + opacity: 0.7; + } + 100% { + transform: scaleY(1); + opacity: 1; + } } .article-content .amigo-voice-duration, @@ -770,14 +1187,275 @@ main .amigo-voice-icon span:nth-child(3), .post-content .amigo-voice-duration, main .amigo-voice-duration, .amigo-voice-duration { - color: #111 !important; - font-size: 16px !important; + font-size: 13px !important; font-weight: 500 !important; + color: var(--text-main) !important; + font-variant-numeric: tabular-nums !important; + margin: 0 !important; + padding: 0 !important; } -@keyframes amigo-voice-wave { - 0%, 100% { transform: scaleY(0.5); } - 50% { transform: scaleY(1); } +.article-content .amigo-voice-unread, +.article-text .amigo-voice-unread, +.post-content .amigo-voice-unread, +main .amigo-voice-unread, +.amigo-voice-unread { + position: absolute !important; + right: 6px !important; + top: 6px !important; + width: 8px !important; + height: 8px !important; + background: var(--theme-main) !important; + border-radius: 50% !important; + border: none !important; + font-style: normal !important; + pointer-events: none !important; +} + +/* ========================================================================== + Bilibili 强制优先级 + ========================================================================== */ + +.article-content .amigo-bilibili-wrapper, +.article-text .amigo-bilibili-wrapper, +.post-content .amigo-bilibili-wrapper, +main .amigo-bilibili-wrapper, +.amigo-bilibili-wrapper { + position: relative !important; + width: 100% !important; + max-width: 100% !important; + padding-bottom: var(--padding-bottom, 56.25%) !important; + margin: 16px 0 !important; + border-radius: 12px !important; + overflow: hidden !important; + background: #000 !important; + box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1) !important; + padding: 0 0 var(--padding-bottom, 56.25%) 0 !important; +} + +.article-content .amigo-bilibili-inner, +.article-text .amigo-bilibili-inner, +.post-content .amigo-bilibili-inner, +main .amigo-bilibili-inner, +.amigo-bilibili-inner { + position: absolute !important; + top: 0 !important; + left: 0 !important; + width: 100% !important; + height: 100% !important; + padding: 0 !important; + margin: 0 !important; +} + +.article-content .amigo-bilibili-inner iframe, +.article-text .amigo-bilibili-inner iframe, +.post-content .amigo-bilibili-inner iframe, +main .amigo-bilibili-inner iframe, +.amigo-bilibili-inner iframe { + width: 100% !important; + height: 100% !important; + border: none !important; + display: block !important; + margin: 0 !important; + padding: 0 !important; +} + +/* ========================================================================== + Live Photo 强制优先级 + ========================================================================== */ + +.article-content .amigo-livephoto, +.article-text .amigo-livephoto, +.post-content .amigo-livephoto, +main .amigo-livephoto, +.amigo-livephoto { + position: relative !important; + width: 100% !important; + max-width: 100% !important; + margin: 16px 0 !important; + border-radius: 12px !important; + overflow: hidden !important; + cursor: pointer !important; + -webkit-user-select: none !important; + user-select: none !important; + background: var(--bg-card) !important; + box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08) !important; + transition: box-shadow 0.2s ease !important; + padding: 0 !important; + border: none !important; +} + +.article-content .amigo-livephoto:hover, +.article-text .amigo-livephoto:hover, +.post-content .amigo-livephoto:hover, +main .amigo-livephoto:hover, +.amigo-livephoto:hover { + box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12) !important; +} + +.article-content .amigo-livephoto:active, +.article-text .amigo-livephoto:active, +.post-content .amigo-livephoto:active, +main .amigo-livephoto:active, +.amigo-livephoto:active { + transform: scale(0.99) !important; +} + +.article-content .amigo-livephoto-badge, +.article-text .amigo-livephoto-badge, +.post-content .amigo-livephoto-badge, +main .amigo-livephoto-badge, +.amigo-livephoto-badge { + position: absolute !important; + top: 12px !important; + left: 12px !important; + z-index: 10 !important; + display: flex !important; + align-items: center !important; + gap: 8px !important; + margin: 0 !important; + padding: 0 !important; +} + +.article-content .amigo-livephoto-live, +.article-text .amigo-livephoto-live, +.post-content .amigo-livephoto-live, +main .amigo-livephoto-live, +.amigo-livephoto-live { + display: inline-flex !important; + align-items: center !important; + justify-content: center !important; + height: 28px !important; + padding: 0 12px !important; + border-radius: 14px !important; + background: rgba(0, 0, 0, 0.6) !important; + backdrop-filter: blur(10px) !important; + -webkit-backdrop-filter: blur(10px) !important; + color: #ffffff !important; + font-size: 12px !important; + font-weight: 600 !important; + letter-spacing: 0.5px !important; + line-height: 1 !important; + margin: 0 !important; +} + +.article-content .amigo-livephoto-sound, +.article-text .amigo-livephoto-sound, +.post-content .amigo-livephoto-sound, +main .amigo-livephoto-sound, +.amigo-livephoto-sound { + display: inline-flex !important; + align-items: center !important; + justify-content: center !important; + width: 28px !important; + height: 28px !important; + border: none !important; + border-radius: 50% !important; + background: rgba(0, 0, 0, 0.6) !important; + backdrop-filter: blur(10px) !important; + -webkit-backdrop-filter: blur(10px) !important; + color: #ffffff !important; + cursor: pointer !important; + padding: 0 !important; + transition: all 0.2s ease !important; + margin: 0 !important; + line-height: 1 !important; +} + +.article-content .amigo-livephoto-sound:hover, +.article-text .amigo-livephoto-sound:hover, +.post-content .amigo-livephoto-sound:hover, +main .amigo-livephoto-sound:hover, +.amigo-livephoto-sound:hover { + background: rgba(0, 0, 0, 0.8) !important; + transform: scale(1.1) !important; +} + +.article-content .amigo-livephoto-sound svg, +.article-text .amigo-livephoto-sound svg, +.post-content .amigo-livephoto-sound svg, +main .amigo-livephoto-sound svg, +.amigo-livephoto-sound svg { + width: 16px !important; + height: 16px !important; + margin: 0 !important; + padding: 0 !important; +} + +.article-content .amigo-livephoto-sound-on, +.article-text .amigo-livephoto-sound-on, +.post-content .amigo-livephoto-sound-on, +main .amigo-livephoto-sound-on, +.amigo-livephoto-sound-on { + display: none !important; +} + +.article-content .amigo-livephoto:not(.is-muted) .amigo-livephoto-sound-off, +.article-text .amigo-livephoto:not(.is-muted) .amigo-livephoto-sound-off, +.post-content .amigo-livephoto:not(.is-muted) .amigo-livephoto-sound-off, +main .amigo-livephoto:not(.is-muted) .amigo-livephoto-sound-off, +.amigo-livephoto:not(.is-muted) .amigo-livephoto-sound-off { + display: none !important; +} + +.article-content .amigo-livephoto:not(.is-muted) .amigo-livephoto-sound-on, +.article-text .amigo-livephoto:not(.is-muted) .amigo-livephoto-sound-on, +.post-content .amigo-livephoto:not(.is-muted) .amigo-livephoto-sound-on, +main .amigo-livephoto:not(.is-muted) .amigo-livephoto-sound-on, +.amigo-livephoto:not(.is-muted) .amigo-livephoto-sound-on { + display: block !important; +} + +.article-content .amigo-livephoto-img, +.article-text .amigo-livephoto-img, +.post-content .amigo-livephoto-img, +main .amigo-livephoto-img, +.amigo-livephoto-img { + width: 100% !important; + height: auto !important; + display: block !important; + object-fit: cover !important; + transition: opacity 0.3s ease !important; + margin: 0 !important; + padding: 0 !important; + border: none !important; + border-radius: 0 !important; +} + +.article-content .amigo-livephoto-video, +.article-text .amigo-livephoto-video, +.post-content .amigo-livephoto-video, +main .amigo-livephoto-video, +.amigo-livephoto-video { + position: absolute !important; + top: 0 !important; + left: 0 !important; + width: 100% !important; + height: 100% !important; + object-fit: cover !important; + opacity: 0 !important; + pointer-events: none !important; + transition: opacity 0.3s ease !important; + margin: 0 !important; + padding: 0 !important; + border: none !important; + border-radius: 0 !important; +} + +.article-content .amigo-livephoto.is-playing .amigo-livephoto-img, +.article-text .amigo-livephoto.is-playing .amigo-livephoto-img, +.post-content .amigo-livephoto.is-playing .amigo-livephoto-img, +main .amigo-livephoto.is-playing .amigo-livephoto-img, +.amigo-livephoto.is-playing .amigo-livephoto-img { + opacity: 0 !important; +} + +.article-content .amigo-livephoto.is-playing .amigo-livephoto-video, +.article-text .amigo-livephoto.is-playing .amigo-livephoto-video, +.post-content .amigo-livephoto.is-playing .amigo-livephoto-video, +main .amigo-livephoto.is-playing .amigo-livephoto-video, +.amigo-livephoto.is-playing .amigo-livephoto-video { + opacity: 1 !important; } /* ========================================================================== @@ -790,19 +1468,19 @@ main .amigo-voice-duration, main .amigo-music-card, .amigo-music-card { --music-accent: #d43c33 !important; - --music-card-bg: #f7f7f8 !important; - --music-card-border: rgba(0, 0, 0, 0.05) !important; - --music-cover-bg: #ececef !important; - --music-title-color: #333333 !important; - --music-artist-color: #777777 !important; - padding: 12px !important; - border-radius: 14px !important; + --music-card-bg: #f5f5f7 !important; + --music-card-border: rgba(0, 0, 0, 0.06) !important; + --music-cover-bg: #e8e8ed !important; + --music-title-color: #1d1d1f !important; + --music-artist-color: #6e6e73 !important; + padding: 10px 14px !important; + border-radius: 16px !important; border: 1px solid var(--music-card-border) !important; background: var(--music-card-bg) !important; - box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75) !important; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06) !important; display: block !important; - max-width: 400px !important; - margin: 16px 0 !important; + max-width: 500px !important; + margin: 16px auto !important; } .article-content .amigo-music-card__hero, @@ -938,8 +1616,11 @@ main .amigo-music-card[data-playing="true"] .amigo-music-card__play-icon, .post-content .amigo-music-card__timeline, main .amigo-music-card__timeline, .amigo-music-card__timeline { + --music-track-height: 4px !important; + --music-thumb-size: 12px !important; display: grid !important; grid-template-columns: auto minmax(0, 1fr) auto !important; + grid-template-areas: "seek seek seek" "current . duration" !important; align-items: center !important; margin-top: 6px !important; row-gap: 6px !important; @@ -956,18 +1637,80 @@ main .amigo-music-card__time, font-weight: 500 !important; font-variant-numeric: tabular-nums !important; line-height: 1 !important; + letter-spacing: 0.01em !important; color: #999 !important; } +.article-content .amigo-music-card__time--current, +.article-text .amigo-music-card__time--current, +.post-content .amigo-music-card__time--current, +main .amigo-music-card__time--current, +.amigo-music-card__time--current { + grid-area: current !important; + justify-self: start !important; + text-align: left !important; +} + +.article-content .amigo-music-card__time--duration, +.article-text .amigo-music-card__time--duration, +.post-content .amigo-music-card__time--duration, +main .amigo-music-card__time--duration, +.amigo-music-card__time--duration { + grid-area: duration !important; + justify-self: end !important; + text-align: right !important; +} + .article-content .amigo-music-card__seek-wrap, .article-text .amigo-music-card__seek-wrap, .post-content .amigo-music-card__seek-wrap, main .amigo-music-card__seek-wrap, .amigo-music-card__seek-wrap { + grid-area: seek !important; position: relative !important; - height: 12px !important; - display: flex !important; - align-items: center !important; + min-width: 0 !important; + height: var(--music-thumb-size) !important; + overflow: visible !important; +} + +.article-content .amigo-music-card__seek-wrap::before, +.article-text .amigo-music-card__seek-wrap::before, +.post-content .amigo-music-card__seek-wrap::before, +main .amigo-music-card__seek-wrap::before, +.amigo-music-card__seek-wrap::before, +.article-content .amigo-music-card__seek-wrap::after, +.article-text .amigo-music-card__seek-wrap::after, +.post-content .amigo-music-card__seek-wrap::after, +main .amigo-music-card__seek-wrap::after, +.amigo-music-card__seek-wrap::after { + content: "" !important; + position: absolute !important; + top: 50% !important; + left: 0 !important; + right: 0 !important; + height: var(--music-track-height) !important; + border-radius: 999px !important; + transform: translateY(-50%) !important; + pointer-events: none !important; +} + +.article-content .amigo-music-card__seek-wrap::before, +.article-text .amigo-music-card__seek-wrap::before, +.post-content .amigo-music-card__seek-wrap::before, +main .amigo-music-card__seek-wrap::before, +.amigo-music-card__seek-wrap::before { + background: rgba(0, 0, 0, 0.06) !important; +} + +.article-content .amigo-music-card__seek-wrap::after, +.article-text .amigo-music-card__seek-wrap::after, +.post-content .amigo-music-card__seek-wrap::after, +main .amigo-music-card__seek-wrap::after, +.amigo-music-card__seek-wrap::after { + right: auto !important; + width: max(0px, calc(var(--music-progress) - (var(--music-thumb-size) / 2))) !important; + background: var(--music-accent) !important; + box-shadow: 0 1px 3px color-mix(in srgb, var(--music-accent) 30%, transparent) !important; } .article-content .amigo-music-card__seek, @@ -975,18 +1718,29 @@ main .amigo-music-card__seek-wrap, .post-content .amigo-music-card__seek, main .amigo-music-card__seek, .amigo-music-card__seek { + position: absolute !important; + inset: 0 !important; + z-index: 3 !important; + width: 100% !important; + height: var(--music-thumb-size) !important; + margin: 0 !important; -webkit-appearance: none !important; appearance: none !important; - width: 100% !important; - height: 4px !important; - border-radius: 999px !important; - background: rgba(0, 0, 0, 0.06) !important; - outline: none !important; + background: 0 0 !important; cursor: pointer !important; - margin: 0 !important; + opacity: 0 !important; padding: 0 !important; } +.article-content .amigo-music-card__seek::-webkit-slider-runnable-track, +.article-text .amigo-music-card__seek::-webkit-slider-runnable-track, +.post-content .amigo-music-card__seek::-webkit-slider-runnable-track, +main .amigo-music-card__seek::-webkit-slider-runnable-track, +.amigo-music-card__seek::-webkit-slider-runnable-track { + height: var(--music-thumb-size) !important; + background: 0 0 !important; +} + .article-content .amigo-music-card__seek::-webkit-slider-thumb, .article-text .amigo-music-card__seek::-webkit-slider-thumb, .post-content .amigo-music-card__seek::-webkit-slider-thumb, @@ -994,13 +1748,83 @@ main .amigo-music-card__seek::-webkit-slider-thumb, .amigo-music-card__seek::-webkit-slider-thumb { -webkit-appearance: none !important; appearance: none !important; - width: 12px !important; - height: 12px !important; + width: var(--music-thumb-size) !important; + height: var(--music-thumb-size) !important; + margin-top: 0 !important; + border: 0 !important; + border-radius: 50% !important; + background: 0 0 !important; + box-shadow: none !important; +} + +.article-content .amigo-music-card__seek::-moz-range-track, +.article-text .amigo-music-card__seek::-moz-range-track, +.post-content .amigo-music-card__seek::-moz-range-track, +main .amigo-music-card__seek::-moz-range-track, +.amigo-music-card__seek::-moz-range-track { + height: var(--music-thumb-size) !important; + background: 0 0 !important; + border: 0 !important; +} + +.article-content .amigo-music-card__seek::-moz-range-progress, +.article-text .amigo-music-card__seek::-moz-range-progress, +.post-content .amigo-music-card__seek::-moz-range-progress, +main .amigo-music-card__seek::-moz-range-progress, +.amigo-music-card__seek::-moz-range-progress { + background: 0 0 !important; +} + +.article-content .amigo-music-card__seek::-moz-range-thumb, +.article-text .amigo-music-card__seek::-moz-range-thumb, +.post-content .amigo-music-card__seek::-moz-range-thumb, +main .amigo-music-card__seek::-moz-range-thumb, +.amigo-music-card__seek::-moz-range-thumb { + width: var(--music-thumb-size) !important; + height: var(--music-thumb-size) !important; + border: 0 !important; + border-radius: 50% !important; + background: 0 0 !important; + box-sizing: border-box !important; + box-shadow: none !important; +} + +.article-content .amigo-music-card__seek-thumb, +.article-text .amigo-music-card__seek-thumb, +.post-content .amigo-music-card__seek-thumb, +main .amigo-music-card__seek-thumb, +.amigo-music-card__seek-thumb { + position: absolute !important; + top: 50% !important; + left: clamp(0px, calc(var(--music-progress) - (var(--music-thumb-size) / 2)), calc(100% - var(--music-thumb-size))) !important; + z-index: 2 !important; + width: var(--music-thumb-size) !important; + height: var(--music-thumb-size) !important; + border: 2px solid var(--music-accent) !important; border-radius: 50% !important; background: #fff !important; - border: 2px solid var(--music-accent) !important; + box-sizing: border-box !important; + transform: translateY(-50%) !important; + pointer-events: none !important; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15) !important; - cursor: pointer !important; + opacity: 1 !important; + display: block !important; +} + +.article-content .amigo-music-card .sr-only, +.article-text .amigo-music-card .sr-only, +.post-content .amigo-music-card .sr-only, +main .amigo-music-card .sr-only, +.amigo-music-card .sr-only { + position: absolute !important; + width: 1px !important; + height: 1px !important; + padding: 0 !important; + margin: -1px !important; + overflow: hidden !important; + clip: rect(0, 0, 0, 0) !important; + white-space: nowrap !important; + border: 0 !important; } /* 深色模式 */ @@ -1027,11 +1851,11 @@ main .amigo-music-card__seek::-webkit-slider-thumb, box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.2) !important; } -[data-theme="dark"] .amigo-music-card__seek, -[data-theme="dark"] .article-content .amigo-music-card__seek, -[data-theme="dark"] .article-text .amigo-music-card__seek, -[data-theme="dark"] .post-content .amigo-music-card__seek, -[data-theme="dark"] main .amigo-music-card__seek { +[data-theme="dark"] .amigo-music-card__seek-wrap::before, +[data-theme="dark"] .article-content .amigo-music-card__seek-wrap::before, +[data-theme="dark"] .article-text .amigo-music-card__seek-wrap::before, +[data-theme="dark"] .post-content .amigo-music-card__seek-wrap::before, +[data-theme="dark"] main .amigo-music-card__seek-wrap::before { background: rgba(255, 255, 255, 0.08) !important; } diff --git a/themes/Ying/assets/js/main.js b/themes/Ying/assets/js/main.js index 0190525a..44c04725 100644 --- a/themes/Ying/assets/js/main.js +++ b/themes/Ying/assets/js/main.js @@ -2,7 +2,7 @@ document.addEventListener('DOMContentLoaded', function() { // 文章图片灯箱 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 退回动画 @@ -10,7 +10,7 @@ document.addEventListener('DOMContentLoaded', function() { var clickedImg = null; 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; }, true); diff --git a/themes/Ying/assets/js/shortcodes.js b/themes/Ying/assets/js/shortcodes.js index 4a9b3ab1..77d24d4c 100644 --- a/themes/Ying/assets/js/shortcodes.js +++ b/themes/Ying/assets/js/shortcodes.js @@ -8,34 +8,20 @@ // ============================================================ function initLivePhotoShortcodes() { - document.querySelectorAll('.live-photo').forEach(function(livePhoto) { + document.querySelectorAll('.amigo-livephoto').forEach(function(livePhoto) { if (livePhoto.__liveBound) return; livePhoto.__liveBound = true; - var video = livePhoto.querySelector('video.live-photo-video') || livePhoto.querySelector('video'); - var posterImg = livePhoto.querySelector('img.live-photo-poster') || livePhoto.querySelector('img'); - var toggleBtn = livePhoto.querySelector('.live-photo-toggle-btn'); - var muteBtn = livePhoto.querySelector('.live-photo-mute-btn'); + var video = livePhoto.querySelector('.amigo-livephoto-video'); + var posterImg = livePhoto.querySelector('.amigo-livephoto-img'); + var soundBtn = livePhoto.querySelector('.amigo-livephoto-sound'); - if (!video || !toggleBtn || !muteBtn) return; + if (!video) return; var HOVER_DELAY = 500; var hoverTimer = null; var isLoaded = 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 }); - } + var isUserToggled = false; function ensureLoaded() { if (isLoaded) return; @@ -50,69 +36,66 @@ function initLivePhotoShortcodes() { function setMuted(isMuted) { video.muted = !!isMuted; - if (isMuted) video.setAttribute('muted', ''); - else video.removeAttribute('muted'); - muteBtn.setAttribute('data-muted', isMuted ? 'true' : 'false'); + if (isMuted) { + video.setAttribute('muted', ''); + livePhoto.classList.add('is-muted'); + } else { + video.removeAttribute('muted'); + livePhoto.classList.remove('is-muted'); + } } - setMuted(true); - function playVideo() { ensureLoaded(); livePhoto.classList.add('is-playing'); - toggleBtn.setAttribute('data-state', 'live'); try { video.play(); } catch (e) {} } function stopVideo() { livePhoto.classList.remove('is-playing'); - toggleBtn.setAttribute('data-state', 'static'); try { video.pause(); video.currentTime = 0; } catch (e) {} } - // Toggle button click - toggleBtn.addEventListener('click', function(e) { - e.stopPropagation(); + function togglePlay() { if (livePhoto.classList.contains('is-playing')) { + isUserToggled = false; stopVideo(); } else { + isUserToggled = true; playVideo(); } + } + + // Click to toggle + livePhoto.addEventListener('click', function() { + togglePlay(); }); - // Mute button click - muteBtn.addEventListener('click', function(e) { - e.stopPropagation(); - setMuted(!video.muted); - }); + // Sound button click + if (soundBtn) { + soundBtn.addEventListener('click', function(e) { + e.stopPropagation(); + setMuted(!video.muted); + }); + } - // Hover to play - livePhoto.addEventListener('mouseenter', function() { - hoverTimer = setTimeout(playVideo, HOVER_DELAY); - }); + // Hover to play (desktop) + if ('ontouchstart' in window === false) { + livePhoto.addEventListener('mouseenter', function() { + if (isUserToggled) return; + hoverTimer = setTimeout(playVideo, HOVER_DELAY); + }); - livePhoto.addEventListener('mouseleave', function() { - clearTimeout(hoverTimer); - if (toggleBtn.getAttribute('data-state') !== 'live') { - stopVideo(); - } - }); + livePhoto.addEventListener('mouseleave', function() { + clearTimeout(hoverTimer); + if (!isUserToggled) { + stopVideo(); + } + }); + } - // Mobile touch - livePhoto.addEventListener('touchstart', function() { - if (livePhoto.classList.contains('is-playing')) { - stopVideo(); - } else { - playVideo(); - } - }); - - // Video ended - video.addEventListener('ended', function() { - if (toggleBtn.getAttribute('data-state') !== 'live') { - stopVideo(); - } - }); + // Initialize muted state + setMuted(livePhoto.classList.contains('is-muted')); }); } @@ -147,24 +130,24 @@ function initVoiceBubbles() { if (isPlaying) { audio.pause(); audio.currentTime = 0; - bubble.classList.remove('playing'); + bubble.classList.remove('is-playing'); isPlaying = false; } else { // 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) { - other.classList.remove('playing'); + other.classList.remove('is-playing'); } }); audio.play(); - bubble.classList.add('playing'); + bubble.classList.add('is-playing'); isPlaying = true; } }); audio.addEventListener('ended', function() { - bubble.classList.remove('playing'); + bubble.classList.remove('is-playing'); isPlaying = false; }); }); @@ -190,6 +173,7 @@ function initMusicCards() { if (!audioSrc) return; audio = new Audio(audioSrc); + card.__audio = audio; // Load metadata audio.addEventListener('loadedmetadata', function() { @@ -201,7 +185,9 @@ function initMusicCards() { audio.addEventListener('timeupdate', function() { if (currentTime) currentTime.textContent = formatTime(audio.currentTime); if (seekInput && audio.duration) { + var progress = (audio.currentTime / audio.duration) * 100; seekInput.value = (audio.currentTime / audio.duration * 1000).toString(); + card.style.setProperty('--music-progress', progress + '%'); } }); @@ -209,18 +195,26 @@ function initMusicCards() { function togglePlay() { if (isPlaying) { audio.pause(); - card.classList.remove('playing'); + card.setAttribute('data-playing', 'false'); + if (playBtn) playBtn.setAttribute('aria-pressed', 'false'); isPlaying = false; } else { // 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) { - 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(); - card.classList.add('playing'); + card.setAttribute('data-playing', 'true'); + if (playBtn) playBtn.setAttribute('aria-pressed', 'true'); isPlaying = true; } } @@ -238,14 +232,17 @@ function initMusicCards() { if (seekInput) { seekInput.addEventListener('input', function() { if (audio.duration) { + var progress = (parseFloat(seekInput.value) / 1000) * 100; audio.currentTime = (parseFloat(seekInput.value) / 1000) * audio.duration; + card.style.setProperty('--music-progress', progress + '%'); } }); } // Ended audio.addEventListener('ended', function() { - card.classList.remove('playing'); + card.setAttribute('data-playing', 'false'); + if (playBtn) playBtn.setAttribute('aria-pressed', 'false'); isPlaying = false; }); }); @@ -257,6 +254,55 @@ function formatTime(seconds) { 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 // ============================================================ @@ -273,10 +319,24 @@ document.addEventListener('DOMContentLoaded', initAllShortcodes); // Page load 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:success', initAllShortcodes); // Also listen for custom events that some PJAX libraries fire document.addEventListener('page:loaded', 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); +}); diff --git a/themes/Ying/layouts/_default/_markup/render-link.html b/themes/Ying/layouts/_default/_markup/render-link.html index 6d07bc1a..0461c62c 100644 --- a/themes/Ying/layouts/_default/_markup/render-link.html +++ b/themes/Ying/layouts/_default/_markup/render-link.html @@ -13,7 +13,7 @@ {{- $faviconUrl := printf "https://api.usj.cc/api/favicon?url=%s" $domain.Host -}} {{- if $isBareUrl -}} - + {{ $domain.Host }} {{ $url }} @@ -22,7 +22,7 @@ {{- else -}} - + {{ $displayText }} {{ $domain.Host }} diff --git a/themes/Ying/layouts/_default/single.html b/themes/Ying/layouts/_default/single.html index aedd81f2..67ff7c98 100644 --- a/themes/Ying/layouts/_default/single.html +++ b/themes/Ying/layouts/_default/single.html @@ -8,7 +8,7 @@ 作者: {{ .Params.author | default .Site.Params.author.name }} 浏览: 字数: {{ .WordCount }} - 阅读: 约 {{ .ReadingTime }} 分钟 + 阅读: 约 {{ .ReadingTime }} 分钟 {{ with .GetTerms "categories" }} 分类: {{ range . }} diff --git a/themes/Ying/layouts/partials/footer.html b/themes/Ying/layouts/partials/footer.html index 8d0f3fa4..f77a14ef 100644 --- a/themes/Ying/layouts/partials/footer.html +++ b/themes/Ying/layouts/partials/footer.html @@ -63,9 +63,10 @@ {{ $mypjax := resources.Get "js/modules/mypjax.js" }} {{ $pangu := resources.Get "js/modules/pangu.js" }} {{ $linkify := resources.Get "js/modules/linkify.js" }} +{{ $shortcodesJs := resources.Get "js/shortcodes.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 }} @@ -170,9 +171,8 @@ {{/* ====== 5. 延迟加载的非关键JS ====== */}} {{ $toast := resources.Get "js/modules/toast.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 }}