From 2c72df4e337b2b96ec92f55ef3ab87bafded3312 Mon Sep 17 00:00:00 2001 From: "D.Yang" Date: Sun, 24 Nov 2024 13:26:41 +0800 Subject: [PATCH] anti adblock --- src/components/CheckAdBlocked.svelte | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/CheckAdBlocked.svelte b/src/components/CheckAdBlocked.svelte index b034c16f..48f97682 100644 --- a/src/components/CheckAdBlocked.svelte +++ b/src/components/CheckAdBlocked.svelte @@ -98,8 +98,13 @@ } onMount(() => { - const interval = setInterval(checkAdBlocker, 5000); - return () => clearInterval(interval); + // 延迟 5 秒后开始第一次检测,给页面足够的加载时间 + setTimeout(() => { + checkAdBlocker(); + // 之后每 30 秒检测一次 + const interval = setInterval(checkAdBlocker, 30000); + return () => clearInterval(interval); + }, 5000); });