干掉广告
This commit is contained in:
58
popup.js
58
popup.js
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user