Skip to content

Commit d6a616e

Browse files
Add the stuff lol
1 parent ed3cb79 commit d6a616e

File tree

3 files changed

+255
-0
lines changed

3 files changed

+255
-0
lines changed

disable-adblock/index.html

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Ad Block Detector Demo</title>
8+
<style>
9+
body {
10+
background-color: #000000;
11+
color: #ffffff;
12+
margin: 0;
13+
padding: 0;
14+
display: flex;
15+
justify-content: center;
16+
align-items: center;
17+
height: 100vh;
18+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
19+
}
20+
21+
.ad-block-message {
22+
background-color: #0F0F0F;
23+
color: #fff;
24+
padding: 20px;
25+
border-radius: 5px;
26+
text-align: center;
27+
font-size: 24px;
28+
}
29+
30+
.button {
31+
background-color: #00B2FF;
32+
border: none;
33+
color: white;
34+
padding: 7px 9px;
35+
text-align: center;
36+
text-decoration: none;
37+
display: inline-block;
38+
font-size: 24px;
39+
margin: 2px 2px;
40+
cursor: pointer;
41+
border-radius: 5px;
42+
transition: background-color 0.3s;
43+
}
44+
45+
.button:hover {
46+
background-color: #009ADC;
47+
}
48+
</style>
49+
</head>
50+
51+
<body>
52+
<div class="ad-block-message">
53+
<p>Your using ad block! >:(</p>
54+
<a href="../" class="button">Check again!</a>
55+
<a href="https://github.com/OddDevelopment/Simple-Adblock-Detector?tab=readme-ov-file#how-to-setup-right-now" class="button">Setup now</a>
56+
</div>
57+
</body>
58+
59+
</html>

index.html

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Ad Block Detector Demo</title>
8+
<style>
9+
body {
10+
background-color: #000000;
11+
color: #ffffff;
12+
margin: 0;
13+
padding: 0;
14+
display: flex;
15+
justify-content: center;
16+
align-items: center;
17+
height: 100vh;
18+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
19+
}
20+
21+
.ad-block-message {
22+
background-color: #0F0F0F;
23+
color: #fff;
24+
padding: 20px;
25+
border-radius: 5px;
26+
text-align: center;
27+
font-size: 24px;
28+
}
29+
30+
.button {
31+
background-color: #00B2FF;
32+
border: none;
33+
color: white;
34+
padding: 7px 9px;
35+
text-align: center;
36+
text-decoration: none;
37+
display: inline-block;
38+
font-size: 24px;
39+
margin: 2px 2px;
40+
cursor: pointer;
41+
border-radius: 5px;
42+
transition: background-color 0.3s;
43+
}
44+
45+
.button:hover {
46+
background-color: #009ADC;
47+
}
48+
</style>
49+
</head>
50+
51+
<body>
52+
<div class="ad-block-message">
53+
<p>You don't have ad block enabled! :)</p>
54+
<a href="https://github.com/OddDevelopment/Simple-Adblock-Detector" class="button">Github</a>
55+
<a href="https://github.com/OddDevelopment/Simple-Adblock-Detector?tab=readme-ov-file#how-to-setup-right-now" class="button">Setup now</a>
56+
</div>
57+
<script src="simpleblocker.js"></script>
58+
</body>
59+
60+
</html>

simpleblocker.js

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
const outbrainErrorCheck = async () => {
2+
try {
3+
const resp = await fetch("https://widgets.outbrain.com/outbrain.js");
4+
const text = await resp.text();
5+
6+
return false;
7+
} catch (e) {
8+
return true;
9+
}
10+
}
11+
12+
const adligatureErrorCheck = async () => {
13+
try {
14+
const resp = await fetch("https://adligature.com/", {
15+
mode: "no-cors"
16+
});
17+
const text = await resp.text();
18+
19+
return false;
20+
} catch (e) {
21+
return true;
22+
}
23+
}
24+
25+
const quantserveErrorCheck = async () => {
26+
try {
27+
const resp = await fetch("https://secure.quantserve.com/quant.js", {
28+
mode: "no-cors"
29+
});
30+
const text = await resp.text();
31+
32+
return false;
33+
} catch (e) {
34+
return true;
35+
}
36+
}
37+
38+
const adligatureCssErrorCheck = async () => {
39+
try {
40+
const resp = await fetch("https://cdn.adligature.com/work.ink/prod/rules.css", {
41+
mode: "no-cors"
42+
});
43+
const text = await resp.text();
44+
45+
return false;
46+
} catch (e) {
47+
return true;
48+
}
49+
}
50+
51+
const srvtrackErrorCheck = async () => {
52+
try {
53+
const resp = await fetch("https://srvtrck.com/assets/css/LineIcons.css", {
54+
mode: "no-cors"
55+
});
56+
const text = await resp.text();
57+
58+
return false;
59+
} catch (e) {
60+
return true;
61+
}
62+
}
63+
64+
const yieldkitCheck = async () => {
65+
try {
66+
const resp = await fetch("https://js.srvtrck.com/v1/js?api_key=40710abb89ad9e06874a667b2bc7dee7&site_id=1f10f78243674fcdba586e526cb8ef08", {
67+
mode: "no-cors"
68+
});
69+
const text = await resp.text();
70+
71+
return false;
72+
} catch (e) {
73+
return true;
74+
}
75+
}
76+
77+
const setIntervalCheck = () => {
78+
return new Promise((resolve) => {
79+
const timeout = setTimeout(() => {
80+
resolve(true);
81+
}, 2000);
82+
83+
const interval = setInterval(() => {
84+
const a0b = "a0b";
85+
if (a0b == "a0b") {
86+
clearInterval(interval);
87+
clearTimeout(timeout);
88+
resolve(false);
89+
}
90+
}, 100);
91+
});
92+
}
93+
94+
const idCheck = async () => {
95+
const bannerIds = ['AdHeader', 'AdContainer', 'AD_Top', 'homead', 'ad-lead'];
96+
const bannerString = bannerIds.map((bannerId) => `<div id="${bannerId}">&nbsp;</div>`).join('');
97+
const dataContainer = document.createElement("div");
98+
99+
dataContainer.innerHTML = bannerString;
100+
document.body.append(dataContainer);
101+
102+
let adblocker = false;
103+
bannerIds.forEach(id => {
104+
const elem = document.getElementById(id);
105+
106+
if (!elem || elem.offsetHeight == 0) {
107+
adblocker = true;
108+
}
109+
110+
elem?.remove();
111+
})
112+
113+
return adblocker;
114+
}
115+
116+
const detectedAdblock = async () => {
117+
const resp = await Promise.all([
118+
outbrainErrorCheck(),
119+
adligatureErrorCheck(),
120+
quantserveErrorCheck(),
121+
adligatureCssErrorCheck(),
122+
srvtrackErrorCheck(),
123+
setIntervalCheck(),
124+
yieldkitCheck()
125+
]);
126+
127+
const isNotUsingAdblocker = resp.every(r => r == false);
128+
129+
return !isNotUsingAdblocker;
130+
};
131+
132+
detectedAdblock().then(result => {
133+
if (result) {
134+
window.location.href = "./disable-adblock";
135+
}
136+
});

0 commit comments

Comments
 (0)