From 1283b01a41e9dd42bb2ad9415ba53382da5b9ff7 Mon Sep 17 00:00:00 2001 From: QLHazyCoder <2825305047@qq.com> Date: Sat, 11 Apr 2026 17:28:38 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8A=A8=E6=80=81=E8=B0=83=E6=95=B4=20?= =?UTF-8?q?Toast=20=E6=8F=90=E7=A4=BA=E6=A1=86=E7=9A=84=E9=A1=B6=E9=83=A8?= =?UTF-8?q?=E5=81=8F=E7=A7=BB=E9=87=8F=EF=BC=8C=E4=BC=98=E5=8C=96=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sidepanel/sidepanel.css | 2 +- sidepanel/sidepanel.js | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sidepanel/sidepanel.css b/sidepanel/sidepanel.css index 3fb033f..9582a62 100644 --- a/sidepanel/sidepanel.css +++ b/sidepanel/sidepanel.css @@ -756,7 +756,7 @@ header { #toast-container { position: fixed; - top: 12px; + top: var(--toast-top-offset, 12px); left: 12px; right: 12px; z-index: 1000; diff --git a/sidepanel/sidepanel.js b/sidepanel/sidepanel.js index 981e730..d18d6c0 100644 --- a/sidepanel/sidepanel.js +++ b/sidepanel/sidepanel.js @@ -44,6 +44,7 @@ const btnAutoStartClose = document.getElementById('btn-auto-start-close'); const btnAutoStartCancel = document.getElementById('btn-auto-start-cancel'); const btnAutoStartRestart = document.getElementById('btn-auto-start-restart'); const btnAutoStartContinue = document.getElementById('btn-auto-start-continue'); +const pageHeader = document.querySelector('header'); const STEP_DEFAULT_STATUSES = { 1: 'pending', 2: 'pending', @@ -113,6 +114,13 @@ function dismissToast(toast) { toast.addEventListener('animationend', () => toast.remove()); } +function updateToastOffset() { + if (!toastContainer) return; + const headerBottom = pageHeader?.getBoundingClientRect().bottom ?? 0; + const offset = Math.max(12, Math.ceil(headerBottom + 8)); + document.documentElement.style.setProperty('--toast-top-offset', `${offset}px`); +} + function resetActionModalButtons() { const buttons = [btnAutoStartCancel, btnAutoStartRestart, btnAutoStartContinue]; buttons.forEach((button) => {