From 53bfb592becb8aff74c979a91c4bf2b8ba4404fd Mon Sep 17 00:00:00 2001 From: MKStoler1024 <158786854+MKStoler1024@users.noreply.github.com> Date: Thu, 16 Jan 2025 03:43:52 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=BC=A9=E6=94=BE=E8=AE=BE=E7=BD=AE=E5=8A=9F=E8=83=BD=E5=B9=B6?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- exam/index.html | 2 ++ exam/script.js | 17 +++++++++++------ exam/styles.css | 8 ++++---- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/exam/index.html b/exam/index.html index e23ac6b..bbb1036 100644 --- a/exam/index.html +++ b/exam/index.html @@ -47,6 +47,8 @@ + + diff --git a/exam/script.js b/exam/script.js index 92d4d1a..b1d2567 100644 --- a/exam/script.js +++ b/exam/script.js @@ -15,9 +15,11 @@ document.addEventListener("DOMContentLoaded", () => { const offsetTimeInput = document.getElementById("offset-time"); const roomInput = document.getElementById("room-input"); const roomElem = document.getElementById("room"); + const zoomInput = document.getElementById("zoom-input"); let offsetTime = getCookie("offsetTime") || 0; let room = getCookie("room") || ""; + let zoomLevel = getCookie("zoomLevel") || 1; offsetTime = parseInt(offsetTime); roomElem.textContent = room; @@ -37,14 +39,11 @@ document.addEventListener("DOMContentLoaded", () => { function displayExamInfo(data) { // Display exam name - const prefix = "考试安排"; - const currentText = examNameElem.textContent; - const newText = `${data.examName}`; - examNameElem.textContent = currentText.replace(/考试安排.*/, newText); + const examNameText = data.examName; + const roomText = roomElem.textContent; + examNameElem.innerHTML = `${examNameText} ${roomText}`; // Display message messageElem.textContent = data.message; - roomElem.style.position = "absolute"; - roomElem.style.right = "20px"; } function updateCurrentTime() { @@ -149,6 +148,7 @@ document.addEventListener("DOMContentLoaded", () => { settingsBtn.addEventListener("click", () => { offsetTimeInput.value = offsetTime; roomInput.value = room; + zoomInput.value = zoomLevel; settingsModal.style.display = "block"; }); @@ -161,12 +161,17 @@ document.addEventListener("DOMContentLoaded", () => { saveSettingsBtn.addEventListener("click", () => { offsetTime = parseInt(offsetTimeInput.value); room = roomInput.value; + zoomLevel = parseFloat(zoomInput.value); setCookie("offsetTime", offsetTime, 365); setCookie("room", room, 365); + setCookie("zoomLevel", zoomLevel, 365); roomElem.textContent = room; + document.body.style.zoom = zoomLevel; settingsModal.style.display = "none"; }); + document.body.style.zoom = zoomLevel; + // Utility function to set a cookie function setCookie(name, value, days) { const d = new Date(); diff --git a/exam/styles.css b/exam/styles.css index d7984b4..c86a690 100644 --- a/exam/styles.css +++ b/exam/styles.css @@ -60,10 +60,9 @@ body { padding: 20px; max-width: 1400px; /* 增加主体部分宽度 */ margin: auto; - background-color: #1f1f1f; + background-color: rgba(31, 31, 31, 0.8); /* 使用rgba设置背景透明度 */ border-radius: 8px; box-shadow: 0 0 20px rgba(0, 0, 0, 0.5); - opacity: 0.8; } h1 { @@ -81,8 +80,9 @@ h1 { font-size: 3.5rem; font-weight: bold; color: #e0e0e0; - position: absolute; - right: 20px; + position: relative; + right: 0; + margin-left: 20px; /* 调整位置使其保持在container中 */ } #message {