2025-05-27 15:46:31 +08:00

64 lines
1.9 KiB
JavaScript
Executable File

const pwdModal = document.getElementById("pwd-modal");
document.getElementById("health_btn").addEventListener("click", function () {
window.location.href = "/health";
});
document.getElementById("setting_btn").addEventListener("click", function () {
pwdModal.style.display = "flex";
});
document.getElementById("learning_btn").addEventListener("click", function () {
window.location.href = "/learning";
});
document.getElementById("help_btn").addEventListener("click", function () {
window.location.href = "/help";
});
// document.getElementById("ir-btn").addEventListener("click", function () {
// window.location.href = "/ir_list";
// });
document.getElementById("ir-btn").addEventListener("click", function () {
window.location.href = "/thermal";
});
// 确保 DOM 加载完成后执行代码
document.addEventListener("DOMContentLoaded", () => {
// 获取相关元素
const musicTile = document.querySelector(".tile.music");
const popup = document.getElementById("iframe-popup");
const iframe = document.getElementById("music-iframe");
// 点击触发区域时显示 popup
musicTile.addEventListener("click", () => {
popup.style.display = "flex";
iframe.style.visibility = "visible"; // 点击时显示 iframe
});
// 点击 popup 背景遮罩时隐藏 popup
popup.addEventListener("click", (e) => {
if (e.target === popup) {
popup.style.display = "none";
iframe.style.visibility = "hidden"; // 关闭时隐藏 iframe
}
});
});
async function pwdConfirm() {
const pwdInput = document.getElementById("pwd-input");
if (pwdInput.value === "jsfb") {
pwdModal.style.display = "none";
window.location.href = "/setting";
} else {
pwdModal.style.display = "none";
let pwdErrorText = await getPopupText("pwdErrorText");
showPopup(pwdErrorText, { confirm: true, cancel: false });
}
}
function pwdCancel() {
pwdModal.style.display = "none";
}