Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yilmazdurmaz/68dad794d16532d951c6977d10de8083 to your computer and use it in GitHub Desktop.
Save yilmazdurmaz/68dad794d16532d951c6977d10de8083 to your computer and use it in GitHub Desktop.
Blocks BlockAdBlock scripts
// ==UserScript==
// @name BlockAdblock Blocker
// @version 1.0
// @namespace http://tampermonkey.net/
// @description Blocks block-adblock
// @match *://**/*
// @grant none
// @run-at document-start
// ==/UserScript==
(() => {
const originalEval = window.eval;
const keywords = ['advertising', 'ad', 'blocker', 'disabled', 'understand', 'site', 'income', 'okay', 'http://blockadblock.com', ''];
window.eval = str => {
// Check for keywords
const matches = keywords.filter(v => str.includes(v));
if (matches.length / keywords.length > 0.85) {
console.log(`[ABBB] Probability of being ad-related: ${(matches.length / keywords.length) * 100}%`);
// Check if it contains the base64 charset in a variable
if (str.match(/[A-Za-z]+='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'/)) {
console.log(` >> It contains the base64 charset`);
// Check if it will clear the body element
if (str.includes(`document.body.innerHTML=''`)) {
console.log(` >> It'll clear your dom. Blocked.`);
return;
}
}
}
return originalEval(str);
};
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment