// ==UserScript==
// @name Bloqueador Universal de Anúncios
// @namespace http://tampermonkey.net/
// @version 3.0
// @description O bloqueador de anúncios mais agressivo para todos os sites
// @author _PeDeCoca
// @match *://*/*
// @match http://*/*
// @match https://*/*
// @grant GM_addStyle
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @grant GM_webRequest
// @run-at document-start
// @license MIT
// ==/UserScript==
(function() {
'use strict';
// Estilos do ícone do escudo
const iconStyles = `
#adblock-indicator {
position: fixed;
top: 10px;
right: 10px;
width: 40px;
height: 40px;
cursor: pointer;
z-index: 9999999;
display: flex;
align-items: center;
justify-content: center;
font-size: 25px;
background: white;
border-radius: 50%;
transition: all 0.3s ease;
}
#adblock-indicator::before {
content: '🛡️';
position: relative;
z-index: 2;
}
#adblock-indicator::after {
content: '';
position: absolute;
inset: -3px;
background: conic-gradient(
from 0deg,
#ff0000,
#ff7300,
#fffb00,
#48ff00,
#00ffd5,
#002bff,
#7a00ff,
#ff00c8,
#ff0000
);
border-radius: 50%;
z-index: 0;
animation: rotate 3s linear infinite, glow 2s ease-in-out infinite alternate;
opacity: 0.8;
}
#adblock-indicator:hover {
transform: scale(1.1);
}
#adblock-indicator:hover::after {
animation: rotate 1s linear infinite, glow 1s ease-in-out infinite alternate;
opacity: 1;
}
@keyframes rotate {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
@keyframes glow {
0% {
filter: hue-rotate(0deg) brightness(1) blur(2px);
transform: rotate(0deg) scale(1);
}
100% {
filter: hue-rotate(360deg) brightness(1.2) blur(3px);
transform: rotate(360deg) scale(1.05);
}
}
`;
// Seletores para bloqueio agressivo de anúncios
const aggressiveAdStyles = `
/* Seletores específicos de anúncios */
ins.adsbygoogle,
.adsbygoogle,
iframe[src*="adsbygoogle"],
[id*="google_ads_"],
[id*="adcontainer"],
[class*="adsbygoogle"],
[data-ad-client],
[id*="doubleclick"],
/* Seletores adicionais */
[id*="taboola"],
[id*="outbrain"],
[class*="partner-ads"],
[class*="commercial-unit"],
[data-ad],
[data-native-ad],
[data-advertisement],
[data-adslot],
[data-ad-placement],
[data-ad-unit],
[data-admanager],
[data-ad-client],
[data-ad-slot],
[data-ad-format],
[data-adsbygoogle-status],
[data-ad-status],
/* Padrões comuns de containers de anúncios */
.ad-container,
.ad-wrapper,
.advertisement,
.advertising,
.sponsor-container,
.sponsored-content,
.promoted-content,
.native-ad,
.premium-ad,
.sticky-ad,
.top-ad,
.side-ad,
.bottom-ad,
/* Alvos adicionais */
[class*="-ad-"],
[id*="-ad-"],
[class*="sponsored"],
[class*="promotion"],
[class*="advertisement"],
[class*="adsense"],
[id*="adsense"],
[data-purpose*="advertisement"],
[aria-label*="Advertisement"],
/* Padrões comuns de redes de anúncios */
[src*="serving-sys.com"],
[src*="pubmatic"],
[src*="criteo"],
[src*="outbrain"],
[src*="taboola"],
[src*="adnxs"],
[src*="yieldmo"],
[src*="amazon-adsystem"] {
display: none !important;
visibility: hidden !important;
opacity: 0 !important;
pointer-events: none !important;
height: 0 !important;
min-height: 0 !important;
max-height: 0 !important;
overflow: hidden !important;
position: absolute !important;
top: -9999px !important;
left: -9999px !important;
z-index: -999 !important;
}
`;
// Adiciona ambos os estilos
GM_addStyle(iconStyles + aggressiveAdStyles);
const ultraBlocker = {
// Adiciona o indicador visual do bloqueador
addIndicator() {
const indicator = document.createElement('div');
indicator.id = 'adblock-indicator';
indicator.title = 'AdBlock Ativado - Clique para entrar em contato discord: _PeDeCoca';
indicator.addEventListener('click', () => {
window.open('https://discord.com/users/_PeDeCoca', '_blank');
});
document.body.appendChild(indicator);
},
// Inicialização do bloqueador
init() {
this.addIndicator();
this.injectAntiAdBlockKiller();
if (!this.isSafeSite()) {
this.setupAggressiveSkipper();
this.blockGoogleAds();
}
// Always run these safer methods
this.setupObserver();
this.blockAdvancedAds();
this.setupFetchBlocker();
this.setupNetworkBlocker(); // Add network blocker
// Add continuous monitoring
this.startContinuousMonitoring();
// Replace aggressive removal with safer version
setInterval(() => {
this.safeAdRemoval();
}, 2000);
},
// Lista de sites e elementos seguros
safeList: {
domains: [
'google.',
'duckduckgo.com',
'bing.com',
'yahoo.com',
'github.com',
'stackoverflow.com',
'gitlab.com'
],
selectors: [
'nav',
'header',
'main',
'footer',
'.search',
'.navigation',
'.menu',
'.content'
]
},
// Verifica se é um site seguro
isSafeSite() {
return this.safeList.domains.some(domain => window.location.hostname.includes(domain));
},
// Verifica se é um elemento crítico que não deve ser bloqueado
isCriticalElement(element) {
return this.safeList.selectors.some(selector =>
element.matches(selector) || element.closest(selector)
);
},
// Lista de motores de busca
searchEngines: [
'google.com',
'google.',
'duckduckgo.com',
'bing.com',
'yahoo.com',
'yandex.com',
'baidu.com'
],
// Verifica se é um motor de busca
isSearchEngine() {
return this.searchEngines.some(domain => window.location.hostname.includes(domain));
},
// Remove elementos de anúncios
removeAdElements() {
if (this.isSearchEngine()) return; // Skip for search engines
const adSelectors = [
'.ad-showing',
'.ytp-ad-overlay-container',
'.video-ads',
'.ytp-ad-overlay-slot'
];
adSelectors.forEach(selector => {
document.querySelectorAll(selector).forEach(el => {
try {
el.style.display = 'none';
} catch (e) {}
});
});
},
// Configuração do pulador agressivo de anúncios
setupAggressiveSkipper() {
if (this.isSearchEngine()) return; // Skip for search engines
setInterval(() => {
const video = document.querySelector('video');
if (video) {
// Força o pulo de qualquer conteúdo publicitário
if (document.querySelector('.ad-showing')) {
video.currentTime = video.duration;
video.playbackRate = 16;
this.clickSkipBtn();
}
// Remove anúncios sobrepostos
this.removeAdElements();
}
}, 50);
},
// Clica no botão de pular anúncio
clickSkipBtn() {
const skipBtns = [
'.ytp-ad-skip-button',
'.videoAdUiSkipButton',
'.ytp-ad-skip-button-modern'
];
skipBtns.forEach(btn => {
const skipButton = document.querySelector(btn);
if (skipButton) skipButton.click();
});
},
// Sistema anti-detecção de bloqueador
injectAntiAdBlockKiller() {
try {
// Use a proxy to intercept property access
const handler = {
get: (target, prop) => {
if (prop === 'adBlocker') return false;
if (prop === 'google_ad_status') return 1;
if (prop === 'ytInitialPlayerResponse') {
return {
adPlacements: [],
playerAds: [],
adSlots: [],
videoDetails: { isLiveContent: false }
};
}
return target[prop];
}
};
// Create proxy for window object
if (typeof unsafeWindow !== 'undefined') {
const windowProxy = new Proxy(unsafeWindow, handler);
Object.defineProperty(window, '__proto__', {
get: () => windowProxy
});
}
// Alternative method using getters
try {
Object.defineProperties(window, {
'adBlocker': {
get: () => false,
configurable: true
},
'google_ad_status': {
get: () => 1,
configurable: true
}
});
} catch (e) {
console.log('Fallback getter setup');
}
// Remove existing ad detectors
const removeAdDetectors = () => {
const detectors = [
'detectAdBlock',
'onAdBlockStart',
'adBlockDetected',
'getAdsStatus',
'checkAdBlock'
];
detectors.forEach(name => {
try {
window[name] = undefined;
delete window[name];
} catch (e) {}
});
};
removeAdDetectors();
setInterval(removeAdDetectors, 1000);
} catch (e) {
console.log('Using minimal anti-adblock');
// Minimal fallback that won't trigger errors
try {
window.adBlocker = false;
} catch (e) {}
}
},
// Interceptação de requisições XHR
hijackXHR() {
const XHR = XMLHttpRequest.prototype;
const open = XHR.open;
const send = XHR.send;
XHR.open = function(method, url) {
if (url.includes('/api/stats/')) {
arguments[1] = 'about:blank';
}
return open.apply(this, arguments);
};
XHR.send = function(data) {
if (this.responseType === 'json' && data?.includes('adPlacements')) {
return;
}
return send.apply(this, arguments);
};
},
// Bypass de verificações premium
bypassPremiumChecks() {
Object.defineProperty(window, 'ytplayer', {
get: () => ({
config: {
loaded: true,
args: {
raw_player_response: {
adPlacements: [],
videoDetails: {
isPrivate: false,
isLive: false,
isLowLatencyLiveStream: false,
isUpcoming: false
}
}
}
}
})
});
},
// Observador de mudanças no DOM
setupObserver() {
const safeRemove = (element) => {
try {
if (element && element.parentNode) {
element.style.display = 'none';
setTimeout(() => {
try {
element.remove();
} catch (e) {}
}, 0);
}
} catch (e) {}
};
const observer = new MutationObserver((mutations) => {
if (this.isSafeSite()) return;
mutations.forEach(mutation => {
mutation.addedNodes.forEach(node => {
if (node.nodeType === 1 && !this.isCriticalElement(node)) {
if (node.matches('[id*="google_ads_"],[class*="adsbygoogle"]')) {
node.style.display = 'none';
}
}
});
});
});
observer.observe(document.documentElement, {
childList: true,
subtree: true
});
},
// Bloqueio de anúncios do Google
blockGoogleAds() {
// Padrões de bloqueio
const blockPatterns = [
'googlesyndication.com',
'doubleclick.net',
'google-analytics.com',
'/pagead/',
'ad.doubleclick.net'
];
// Remove scripts existentes
document.querySelectorAll('script').forEach(script => {
if (blockPatterns.some(pattern => script.src.includes(pattern))) {
script.remove();
}
});
// Previne carregamento de novos scripts
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
mutation.addedNodes.forEach((node) => {
if (node.tagName === 'SCRIPT' &&
blockPatterns.some(pattern => node.src?.includes(pattern))) {
node.remove();
}
});
});
});
observer.observe(document.documentElement, {
childList: true,
subtree: true
});
},
// Observador do player de vídeo
setupPlayerObserver() {
// Observer específico para o player
const observer = new MutationObserver(() => {
// Remove classe de anúncio do player
const player = document.querySelector('.html5-video-player');
if (player) {
player.classList.remove('ad-showing', 'ad-interrupting', 'ad-created');
}
// Força o skip de anúncios
const video = document.querySelector('video');
if (video && document.querySelector('[class*="ad-showing"]')) {
video.currentTime = video.duration;
const skipButton = document.querySelector('.ytp-ad-skip-button');
if (skipButton) skipButton.click();
}
// Remove containers de anúncios
[
'.ytp-ad-player-overlay-layout',
'.ytp-ad-player-overlay-layout__player-card-container',
'.ytp-ad-persistent-progress-bar-container',
'.video-ads.ytp-ad-module',
'[class*="ytp-ad-"]'
].forEach(selector => {
document.querySelectorAll(selector).forEach(el => el.remove());
});
});
observer.observe(document.documentElement, {
childList: true,
subtree: true,
attributes: true,
attributeFilter: ['class']
});
},
// Remoção segura de anúncios
safeAdRemoval() {
if (this.isSafeSite()) return;
const adPatterns = [
'ad-', 'ads-', 'adv-', 'sponsored', 'advertisement',
'google_ads', 'adsystem', 'adsbygoogle'
];
document.querySelectorAll('[class*="ad-"],[id*="ad-"],[class*="ads"],[id*="ads"]').forEach(el => {
if (!this.isCriticalElement(el) &&
adPatterns.some(pattern => el.className.includes(pattern) || el.id.includes(pattern))) {
el.style.display = 'none';
}
});
},
// Sobrescreve o player do YouTube
overrideYTPlayer() {
// Força a recriação do objeto player sem anúncios
if (typeof window.ytplayer !== 'undefined' && window.ytplayer.config) {
window.ytplayer.config.args.raw_player_response.adPlacements = [];
window.ytplayer.config.args.raw_player_response.playerAds = [];
}
},
// Bloqueio avançado de anúncios
blockAdvancedAds() {
if (this.isSearchEngine()) {
// Simplified ad blocking for search engines
const safeAdPatterns = [
'doubleclick.net',
'googlesyndication.com',
'adsystem.com'
];
const safeRemoveAds = () => {
document.querySelectorAll('iframe').forEach(frame => {
if (safeAdPatterns.some(pattern => frame.src?.includes(pattern))) {
frame.style.display = 'none';
}
});
};
setInterval(safeRemoveAds, 1000);
return;
}
if (this.isSafeSite()) {
// Minimal blocking for safe sites
const safeAdPatterns = [
'doubleclick.net',
'googlesyndication.com',
'adsystem.com'
];
const safeRemoveAds = () => {
document.querySelectorAll('iframe[src],div[data-ad]').forEach(el => {
if (!this.isCriticalElement(el) &&
safeAdPatterns.some(pattern => el.src?.includes(pattern) ||
el.getAttribute('data-ad')?.includes(pattern))) {
el.style.display = 'none';
}
});
};
setInterval(safeRemoveAds, 2000);
return;
}
const adPatterns = [
'advertisement',
'sponsored',
'promotion',
'banner-ad',
'ad-container',
'ad-wrapper'
];
const removeAds = () => {
document.querySelectorAll('*').forEach(element => {
// Only check specific ad-related attributes
const attrs = ['id', 'class', 'data-ad'];
for (let attr of attrs) {
const value = element.getAttribute(attr);
if (value && adPatterns.some(pattern => value.toLowerCase().includes(pattern))) {
element.style.display = 'none';
break;
}
}
});
};
setInterval(removeAds, 1000);
},
// Bloqueador de requisições de rede
setupNetworkBlocker() {
const blockRequest = request => {
return this.blockPatterns.some(pattern =>
request.url.includes(pattern) ||
request.initiator?.includes(pattern)
);
};
if (typeof GM_webRequest !== 'undefined') {
GM_webRequest.onBeforeRequest.addListener(
details => ({ cancel: blockRequest(details) }),
{ urls: ["<all_urls>"] },
["blocking"]
);
}
},
// Bloqueador de requisições fetch
setupFetchBlocker() {
const originalFetch = window.fetch;
window.fetch = async function(...args) {
const url = args[0]?.url || args[0];
if (typeof url === 'string' && (
url.includes('doubleclick.net') ||
url.includes('googlesyndication.com') ||
url.includes('/pagead/') ||
url.includes('ad.doubleclick.net') ||
url.includes('googleadservices.com') ||
url.includes('adsystem.com')
)) {
return new Response('{}');
}
return originalFetch.apply(this, args);
};
},
// Monitoramento contínuo
startContinuousMonitoring() {
// Verifica novos anúncios a cada segundo
setInterval(() => {
this.checkForNewAds();
}, 1000);
// Observa mudanças dinâmicas de conteúdo
const dynamicObserver = new MutationObserver(() => {
this.checkForNewAds();
});
dynamicObserver.observe(document.body, {
childList: true,
subtree: true,
attributes: true,
attributeFilter: ['class', 'id', 'style']
});
},
// Verifica novos anúncios
checkForNewAds() {
// Padrões de anúncios para verificação
const adPatterns = [
'[id*="ad-"],[class*="ad-"]',
'[id*="ads"],[class*="ads"]',
'[id*="google_ads"],[class*="adsbygoogle"]',
'[data-ad]',
'[data-adunit]',
'[data-adtest]',
'iframe[src*="ads"]',
'iframe[src*="doubleclick"]',
'iframe[src*="adsystem"]',
'.video-ads',
'.ytp-ad-overlay-container',
'[class*="sponsored"]',
'[class*="advertisement"]'
];
adPatterns.forEach(pattern => {
document.querySelectorAll(pattern).forEach(element => {
if (!element.dataset.adblockChecked && !this.isCriticalElement(element)) {
element.style.display = 'none';
element.dataset.adblockChecked = 'true';
}
});
});
if (document.querySelector('video')) {
this.checkVideoAds();
}
},
// Verifica anúncios em vídeos
checkVideoAds() {
const video = document.querySelector('video');
const player = document.querySelector('.html5-video-player');
if (video && (
player?.classList.contains('ad-showing') ||
document.querySelector('.video-ads') ||
document.querySelector('.ytp-ad-player-overlay')
)) {
video.currentTime = video.duration;
video.playbackRate = 16;
this.clickSkipBtn();
}
}
};
// Inicialização do bloqueador
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => ultraBlocker.init());
} else {
ultraBlocker.init();
}
// Bloqueio avançado de requisições com mais padrões
const originalFetch = unsafeWindow.fetch;
unsafeWindow.fetch = async function(...args) {
const url = args[0]?.url || args[0];
if (typeof url === 'string' && (
url.includes('doubleclick.net') ||
url.includes('googlesyndication.com') ||
url.includes('/pagead/') ||
url.includes('google-analytics.com') ||
url.includes('youtube.com/api/stats/ads') ||
url.includes('youtube.com/pagead/') ||
url.includes('youtube.com/get_midroll_') ||
url.includes('youtube.com/ptracking') ||
url.includes('youtube.com/annotations_invideo') ||
url.includes('youtube.com/api/stats/watchtime') ||
url.includes('ad.doubleclick.net') ||
url.includes('googleadservices.com') ||
url.includes('adsystem.com') ||
url.includes('analytics') ||
url.includes('pagead') ||
url.includes('measured') ||
url.includes('tracking') ||
url.includes('stats') ||
url.includes('atr')
)) {
return new Response(JSON.stringify({
playerResponse: {
adPlacements: [],
playbackTracking: {},
videoDetails: {
isLiveContent: false
}
}
}));
}
return originalFetch.apply(this, args);
};
})();