Skip to content

Commit

Permalink
Add the stuff lol
Browse files Browse the repository at this point in the history
  • Loading branch information
OddDevelopment committed Apr 30, 2024
1 parent ed3cb79 commit d6a616e
Show file tree
Hide file tree
Showing 3 changed files with 255 additions and 0 deletions.
59 changes: 59 additions & 0 deletions disable-adblock/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ad Block Detector Demo</title>
<style>
body {
background-color: #000000;
color: #ffffff;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.ad-block-message {
background-color: #0F0F0F;
color: #fff;
padding: 20px;
border-radius: 5px;
text-align: center;
font-size: 24px;
}

.button {
background-color: #00B2FF;
border: none;
color: white;
padding: 7px 9px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 24px;
margin: 2px 2px;
cursor: pointer;
border-radius: 5px;
transition: background-color 0.3s;
}

.button:hover {
background-color: #009ADC;
}
</style>
</head>

<body>
<div class="ad-block-message">
<p>Your using ad block! >:(</p>
<a href="../" class="button">Check again!</a>
<a href="https://github.com/OddDevelopment/Simple-Adblock-Detector?tab=readme-ov-file#how-to-setup-right-now" class="button">Setup now</a>
</div>
</body>

</html>
60 changes: 60 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ad Block Detector Demo</title>
<style>
body {
background-color: #000000;
color: #ffffff;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.ad-block-message {
background-color: #0F0F0F;
color: #fff;
padding: 20px;
border-radius: 5px;
text-align: center;
font-size: 24px;
}

.button {
background-color: #00B2FF;
border: none;
color: white;
padding: 7px 9px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 24px;
margin: 2px 2px;
cursor: pointer;
border-radius: 5px;
transition: background-color 0.3s;
}

.button:hover {
background-color: #009ADC;
}
</style>
</head>

<body>
<div class="ad-block-message">
<p>You don't have ad block enabled! :)</p>
<a href="https://github.com/OddDevelopment/Simple-Adblock-Detector" class="button">Github</a>
<a href="https://github.com/OddDevelopment/Simple-Adblock-Detector?tab=readme-ov-file#how-to-setup-right-now" class="button">Setup now</a>
</div>
<script src="simpleblocker.js"></script>
</body>

</html>
136 changes: 136 additions & 0 deletions simpleblocker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
const outbrainErrorCheck = async () => {
try {
const resp = await fetch("https://widgets.outbrain.com/outbrain.js");
const text = await resp.text();

return false;
} catch (e) {
return true;
}
}

const adligatureErrorCheck = async () => {
try {
const resp = await fetch("https://adligature.com/", {
mode: "no-cors"
});
const text = await resp.text();

return false;
} catch (e) {
return true;
}
}

const quantserveErrorCheck = async () => {
try {
const resp = await fetch("https://secure.quantserve.com/quant.js", {
mode: "no-cors"
});
const text = await resp.text();

return false;
} catch (e) {
return true;
}
}

const adligatureCssErrorCheck = async () => {
try {
const resp = await fetch("https://cdn.adligature.com/work.ink/prod/rules.css", {
mode: "no-cors"
});
const text = await resp.text();

return false;
} catch (e) {
return true;
}
}

const srvtrackErrorCheck = async () => {
try {
const resp = await fetch("https://srvtrck.com/assets/css/LineIcons.css", {
mode: "no-cors"
});
const text = await resp.text();

return false;
} catch (e) {
return true;
}
}

const yieldkitCheck = async () => {
try {
const resp = await fetch("https://js.srvtrck.com/v1/js?api_key=40710abb89ad9e06874a667b2bc7dee7&site_id=1f10f78243674fcdba586e526cb8ef08", {
mode: "no-cors"
});
const text = await resp.text();

return false;
} catch (e) {
return true;
}
}

const setIntervalCheck = () => {
return new Promise((resolve) => {
const timeout = setTimeout(() => {
resolve(true);
}, 2000);

const interval = setInterval(() => {
const a0b = "a0b";
if (a0b == "a0b") {
clearInterval(interval);
clearTimeout(timeout);
resolve(false);
}
}, 100);
});
}

const idCheck = async () => {
const bannerIds = ['AdHeader', 'AdContainer', 'AD_Top', 'homead', 'ad-lead'];
const bannerString = bannerIds.map((bannerId) => `<div id="${bannerId}">&nbsp;</div>`).join('');
const dataContainer = document.createElement("div");

dataContainer.innerHTML = bannerString;
document.body.append(dataContainer);

let adblocker = false;
bannerIds.forEach(id => {
const elem = document.getElementById(id);

if (!elem || elem.offsetHeight == 0) {
adblocker = true;
}

elem?.remove();
})

return adblocker;
}

const detectedAdblock = async () => {
const resp = await Promise.all([
outbrainErrorCheck(),
adligatureErrorCheck(),
quantserveErrorCheck(),
adligatureCssErrorCheck(),
srvtrackErrorCheck(),
setIntervalCheck(),
yieldkitCheck()
]);

const isNotUsingAdblocker = resp.every(r => r == false);

return !isNotUsingAdblocker;
};

detectedAdblock().then(result => {
if (result) {
window.location.href = "./disable-adblock";
}
});

0 comments on commit d6a616e

Please sign in to comment.