From 7a17ac7b4bd15dcc839ee2bc55e285b216847d2a Mon Sep 17 00:00:00 2001 From: Frank <472730949@qq.com> Date: Mon, 18 Nov 2024 17:26:28 +0800 Subject: [PATCH] Fixed delayed function. --- RIP-hltv-BET.user.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/RIP-hltv-BET.user.js b/RIP-hltv-BET.user.js index 7205828..68c577e 100644 --- a/RIP-hltv-BET.user.js +++ b/RIP-hltv-BET.user.js @@ -2,7 +2,7 @@ // @name RIP HLTV BET // @name:zh-CN HLTV 广告去除插件 // @namespace https://github.com/wolfcon/RIP-HLTV-BET -// @version 2.1 +// @version 2.2 // @description Remove hltv.org Annoy AD // @description:zh-cn 清除那些🤮背景赌博广告. // @author Frank @@ -28,13 +28,6 @@ const filters = [ '[class^="column-"]:not([class*="col-box"])' ]; -// Use ADBlock way to block some annoy element -(function removeFilters() { - var $hiddenStyle = $(''); - $($('head')[0]).append($hiddenStyle); - $hiddenStyle.append(filters + "{display: none !important; visibility: hidden !important;}"); -})(); - function removeBackgroundAds() { document.body.removeAttribute("data-href"); document.body.removeAttribute("style"); @@ -54,6 +47,9 @@ function removeTopAds() { } } +removeTopAds(); +removeBackgroundAds(); + // Set a loop to avoid cleaning failed when loading problem occurs let topAdsInterval = setInterval(removeTopAds, 250); let backgroundAdsInterval = setInterval(removeBackgroundAds, 250); @@ -64,6 +60,14 @@ setTimeout(function() { console.log("Sick Ilya! Let's fucking Go!😂"); }, 5000); + +// Use ADBlock way to block some annoy element +(function removeFilters() { + var $hiddenStyle = $(''); + $($('head')[0]).append($hiddenStyle); + $hiddenStyle.append(filters + "{display: none !important; visibility: hidden !important;}"); +})(); + const hiddenStyle = document.createElement("style") hiddenStyle.innerText = "#betting {display: none}" document.head.appendChild(hiddenStyle)