干掉广告

This commit is contained in:
dela
2026-01-13 14:44:44 +08:00
parent 63bfeca740
commit 079f832f5b
3 changed files with 0 additions and 354 deletions

View File

@@ -567,61 +567,3 @@ function loadData() {
loadAddresses();
loadNames();
}
// ==========================================
// Telegram 广告弹窗逻辑
// ==========================================
const telegramModal = document.getElementById("telegramModal");
const modalCloseBtn = document.getElementById("modalCloseBtn");
const modalTimer = document.getElementById("modalTimer");
let countdownInterval = null;
let autoCloseTimeout = null;
function showTelegramModal() {
telegramModal.classList.add("show");
let seconds = 5;
modalTimer.textContent = seconds;
// 倒计时
countdownInterval = setInterval(() => {
seconds--;
if (seconds > 0) {
modalTimer.textContent = seconds;
} else {
modalTimer.textContent = "0";
clearInterval(countdownInterval);
}
}, 1000);
// 5秒后自动关闭
autoCloseTimeout = setTimeout(() => {
closeTelegramModal();
}, 5000);
}
function closeTelegramModal() {
telegramModal.classList.remove("show");
if (countdownInterval) {
clearInterval(countdownInterval);
countdownInterval = null;
}
if (autoCloseTimeout) {
clearTimeout(autoCloseTimeout);
autoCloseTimeout = null;
}
}
if (modalCloseBtn) {
modalCloseBtn.addEventListener("click", (e) => {
e.preventDefault();
closeTelegramModal();
});
}
// 延迟显示广告,避免一打开就弹
if (telegramModal && modalCloseBtn && modalTimer) {
setTimeout(() => {
showTelegramModal();
}, 300);
}