Skip to content

Commit

Permalink
Fixed delayed function.
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfcon committed Nov 18, 2024
1 parent b20a255 commit 7a17ac7
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions RIP-hltv-BET.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -28,13 +28,6 @@ const filters = [
'[class^="column-"]:not([class*="col-box"])'
];

// Use ADBlock way to block some annoy element
(function removeFilters() {
var $hiddenStyle = $('<style type="text/css"></style>');
$($('head')[0]).append($hiddenStyle);
$hiddenStyle.append(filters + "{display: none !important; visibility: hidden !important;}");
})();

function removeBackgroundAds() {
document.body.removeAttribute("data-href");
document.body.removeAttribute("style");
Expand All @@ -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);
Expand All @@ -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 = $('<style type="text/css"></style>');
$($('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)

0 comments on commit 7a17ac7

Please sign in to comment.