ServerX commited on
Commit
f9a2505
·
verified ·
1 Parent(s): 9ba24f8

Upload adblock.js

Browse files
Files changed (1) hide show
  1. adblock.js +70 -0
adblock.js ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ document.addEventListener('DOMContentLoaded', () => {
2
+ const iframe = document.getElementById('gameContainer');
3
+ const loader = document.getElementById('loader');
4
+
5
+ const adBlockConfig = {
6
+ scripts: [
7
+ /adservice|adsystem|doubleclick|googletag|adserver|advert|tracking|analytics/gi,
8
+ /nannyirrationalacquainted|prosecutorremarkablegodforsaken|recordedthereby/gi
9
+ ],
10
+ elements: [
11
+ 'div[class*="ad"]',
12
+ 'iframe[src*="ads"]',
13
+ 'ins.adsbygoogle',
14
+ '#___gcse_0',
15
+ '.gsc-adBlock',
16
+ '[id*="ad-container"]',
17
+ '[class*="banner"]',
18
+ 'img.menu-search'
19
+ ]
20
+ };
21
+
22
+ function nuclearAdBlock() {
23
+ try {
24
+ const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
25
+
26
+ // Block scripts
27
+ iframeDoc.querySelectorAll('script').forEach(script => {
28
+ if(adBlockConfig.scripts.some(regex => regex.test(script.src))) {
29
+ script.remove();
30
+ }
31
+ });
32
+
33
+ // Block elements
34
+ adBlockConfig.elements.forEach(selector => {
35
+ iframeDoc.querySelectorAll(selector).forEach(el => el.remove());
36
+ });
37
+
38
+ // Inject CSS
39
+ const style = iframeDoc.createElement('style');
40
+ style.textContent = adBlockConfig.elements.join(',') +
41
+ '{display:none!important;height:0!important;width:0!important;opacity:0!important;visibility:hidden!important}';
42
+ iframeDoc.head.appendChild(style);
43
+
44
+ } catch(e) {
45
+ console.error('Adblock Error:', e);
46
+ }
47
+ }
48
+
49
+ // Initialize
50
+ iframe.src = 'https://gam.onl';
51
+
52
+ iframe.onload = () => {
53
+ nuclearAdBlock();
54
+ iframe.style.visibility = 'visible';
55
+ loader.remove();
56
+
57
+ // Continuous protection
58
+ const observer = new MutationObserver(nuclearAdBlock);
59
+ observer.observe(iframe.contentDocument.documentElement, {
60
+ childList: true,
61
+ subtree: true,
62
+ attributes: true
63
+ });
64
+ };
65
+
66
+ // Handle errors
67
+ iframe.onerror = () => {
68
+ loader.textContent = 'Errore di caricamento!';
69
+ };
70
+ });