Download adblock.js from ServerX/game.onl: direct link, hf CLI and curl.
- Browser
- Download file 2.35 kB
-
https://huggingface.co/spaces/ServerX/game.onl/resolve/main/adblock.js
- Command line
-
hf download hf://spaces/ServerX/game.onl/adblock.js
-
curl -L -o adblock.js https://huggingface.co/spaces/ServerX/game.onl/resolve/main/adblock.js
2.35 kB
| document.addEventListener('DOMContentLoaded', () => { | |
| const iframe = document.getElementById('gameContainer'); | |
| const loader = document.getElementById('loader'); | |
| const adBlockConfig = { | |
| scripts: [ | |
| /adservice|adsystem|doubleclick|googletag|adserver|advert|tracking|analytics/gi, | |
| /nannyirrationalacquainted|prosecutorremarkablegodforsaken|recordedthereby/gi | |
| ], | |
| elements: [ | |
| 'div[class*="ad"]', | |
| 'iframe[src*="ads"]', | |
| 'ins.adsbygoogle', | |
| '#___gcse_0', | |
| '.gsc-adBlock', | |
| '[id*="ad-container"]', | |
| '[class*="banner"]', | |
| 'img.menu-search' | |
| ] | |
| }; | |
| function nuclearAdBlock() { | |
| try { | |
| const iframeDoc = iframe.contentDocument || iframe.contentWindow.document; | |
| // Block scripts | |
| iframeDoc.querySelectorAll('script').forEach(script => { | |
| if(adBlockConfig.scripts.some(regex => regex.test(script.src))) { | |
| script.remove(); | |
| } | |
| }); | |
| // Block elements | |
| adBlockConfig.elements.forEach(selector => { | |
| iframeDoc.querySelectorAll(selector).forEach(el => el.remove()); | |
| }); | |
| // Inject CSS | |
| const style = iframeDoc.createElement('style'); | |
| style.textContent = adBlockConfig.elements.join(',') + | |
| '{display:none!important;height:0!important;width:0!important;opacity:0!important;visibility:hidden!important}'; | |
| iframeDoc.head.appendChild(style); | |
| } catch(e) { | |
| console.error('Adblock Error:', e); | |
| } | |
| } | |
| // Initialize | |
| iframe.src = 'https://gam.onl'; | |
| iframe.onload = () => { | |
| nuclearAdBlock(); | |
| iframe.style.visibility = 'visible'; | |
| loader.remove(); | |
| // Continuous protection | |
| const observer = new MutationObserver(nuclearAdBlock); | |
| observer.observe(iframe.contentDocument.documentElement, { | |
| childList: true, | |
| subtree: true, | |
| attributes: true | |
| }); | |
| }; | |
| // Handle errors | |
| iframe.onerror = () => { | |
| loader.textContent = 'Errore di caricamento!'; | |
| }; | |
| }); |