Advanced AdBlocker + Toggle Panel + GM Storage (TR+EN)

TR+EN reklam engelleyici + anti-adblock bypass + panel toggle + GM storage domain listeleri + pause/ads/warnings hatırlama

当前为 2025-08-31 提交的版本,查看 最新版本

// ==UserScript==
// @name         Advanced AdBlocker + Toggle Panel + GM Storage (TR+EN)
// @namespace    http://tampermonkey.net/
// @version      6.7
// @description  TR+EN reklam engelleyici + anti-adblock bypass + panel toggle + GM storage domain listeleri + pause/ads/warnings hatırlama
// @author       Volkan
// @match        *://*/*
// @grant        GM_setValue
// @grant        GM_getValue
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    let blockedAds = 0, blockedWarnings = 0;

    // Ayarlar ve pause durumu
    let adsEnabled = GM_getValue("adsEnabled", true);
    let warningsEnabled = GM_getValue("warningsEnabled", true);
    let paused = GM_getValue("paused", false);

    // Domain listeleri
    let blockedAdsDomains = GM_getValue("blockedAdsDomains", []);
    let blockedWarningsDomains = GM_getValue("blockedWarningsDomains", []);

    const adProviders = [
        "googlesyndication.com","doubleclick.net","googleadservices.com",
        "adnxs.com","taboola.com","outbrain.com","amazon-adsystem.com",
        "yahoo.com","bing.com","rubiconproject.com","admatic.com.tr",
        "reklamstore.com","adhood.com","admost.com","adcolony.com","yenimedya.com"
    ];
    const adHintRegex = /(adsbygoogle|sponsored|ad-container|advertisement|ad-slot|ad-banner|promoted|reklam|sponsorluk)/i;
    const antiAdblockTextRegex = /(adblock|reklam engelleyici|disable your ad blocker|we have detected.*adblock)/i;

    function isPanelNode(node){
        return node && node.nodeType===1 && (node.id==="adblock-ui-panel" || node.closest("#adblock-ui-panel"));
    }

    function createPanel(){
        if(document.getElementById("adblock-ui-panel")) return;

        const panel=document.createElement("div");
        panel.id="adblock-ui-panel";
        panel.style.position="fixed";
        panel.style.bottom="10px";
        panel.style.right="10px";
        panel.style.background="rgba(0,0,0,0.8)";
        panel.style.color="#fff";
        panel.style.padding="8px 12px";
        panel.style.borderRadius="12px";
        panel.style.fontSize="13px";
        panel.style.zIndex="2147483647";
        panel.style.display="flex";
        panel.style.flexDirection="column";
        panel.style.alignItems="flex-start";
        panel.style.boxShadow="0 0 8px rgba(0,0,0,0.5)";
        panel.style.cursor="default";

        // Başlık (toggle)
        const title = document.createElement("div");
        title.innerText="🛡️ AdBlock Panel";
        title.style.marginBottom="6px";
        title.style.cursor="pointer";
        panel.appendChild(title);

        // İçerik (başlangıçta gizli)
        const content = document.createElement("div");
        content.style.display="none";
        content.style.flexDirection="column";
        content.style.width="100%";
        panel.appendChild(content);

        // Ads buton
        const adsBtn = document.createElement("button");
        adsBtn.innerText=`⛔ Ads: ${blockedAds} | ${adsEnabled?"✅":"⏸️"}`;
        adsBtn.style.marginBottom="4px";
        adsBtn.style.width="100%";
        adsBtn.style.cursor="pointer";
        adsBtn.onclick=()=>{
            adsEnabled = !adsEnabled;
            GM_setValue("adsEnabled", adsEnabled);
            updatePanel();
        };
        content.appendChild(adsBtn);

        // Warnings buton
        const warnBtn=document.createElement("button");
        warnBtn.innerText=`⚠️ Warnings: ${blockedWarnings} | ${warningsEnabled?"✅":"⏸️"}`;
        warnBtn.style.width="100%";
        warnBtn.style.cursor="pointer";
        warnBtn.style.marginBottom="4px";
        warnBtn.onclick=()=>{
            warningsEnabled = !warningsEnabled;
            GM_setValue("warningsEnabled", warningsEnabled);
            updatePanel();
        };
        content.appendChild(warnBtn);

        // Pause buton
        const pauseBtn = document.createElement("button");
        pauseBtn.innerText=paused ? "▶️ Resume" : "⏸️ Pause";
        pauseBtn.style.width="100%";
        pauseBtn.style.cursor="pointer";
        pauseBtn.onclick=()=>{
            paused = !paused;
            GM_setValue("paused", paused);
            updatePanel();
        };
        content.appendChild(pauseBtn);

        // Başlığa tıklayınca toggle
        title.onclick = ()=>{
            content.style.display = content.style.display==="none" ? "flex" : "none";
        };

        document.body.appendChild(panel);
    }

    function updatePanel(){
        const panel=document.getElementById("adblock-ui-panel");
        if(!panel) return;
        const content = panel.children[1];
        const [adsBtn, warnBtn, pauseBtn] = content.children;
        adsBtn.innerText=`⛔ Ads: ${blockedAds} | ${adsEnabled?"✅":"⏸️"}`;
        warnBtn.innerText=`⚠️ Warnings: ${blockedWarnings} | ${warningsEnabled?"✅":"⏸️"}`;
        pauseBtn.innerText = paused ? "▶️ Resume" : "⏸️ Pause";
    }

    function addBlockedAdDomain(domain){
        if(!blockedAdsDomains.includes(domain)){
            blockedAdsDomains.push(domain);
            GM_setValue("blockedAdsDomains", blockedAdsDomains);
        }
    }

    function addBlockedWarningDomain(domain){
        if(!blockedWarningsDomains.includes(domain)){
            blockedWarningsDomains.push(domain);
            GM_setValue("blockedWarningsDomains", blockedWarningsDomains);
        }
    }

    function removeAds(node=document){
        if(paused || !adsEnabled || !node || !node.querySelectorAll) return;
        if(isPanelNode(node)) return;

        node.querySelectorAll("script[src], iframe[src]").forEach(el=>{
            if(el.nodeType!==1) return;
            if(isPanelNode(el)) return;
            const src=el.src||"";
            if(adProviders.some(domain=>src.includes(domain))){
                el.remove(); blockedAds++; updatePanel();
                addBlockedAdDomain(src);
            }
        });

        node.querySelectorAll("div, section, ins").forEach(el=>{
            if(el.nodeType!==1) return;
            if(isPanelNode(el)) return;
            const attrText=(el.className+" "+el.id).toLowerCase();
            if(adHintRegex.test(attrText)){
                el.remove(); blockedAds++; updatePanel();
                addBlockedAdDomain(attrText);
            }
        });
    }

    function bypassAntiAdblock(node=document){
        if(paused || !warningsEnabled || !node || !node.querySelectorAll) return;
        if(isPanelNode(node)) return;

        node.querySelectorAll("div, section, p, span").forEach(el=>{
            if(el.nodeType!==1) return;
            if(isPanelNode(el)) return;
            if(el.innerText && antiAdblockTextRegex.test(el.innerText)){
                el.remove(); blockedWarnings++; updatePanel();
                addBlockedWarningDomain(el.innerText);
            }
        });
    }

    function cleanAll(node=document){
        if(!node) return;
        if(node.nodeType!==1 && node!==document) return;
        removeAds(node);
        bypassAntiAdblock(node);
    }

    function ensureBodyAndCreatePanel() {
        if(document.body){
            createPanel();
        } else {
            const bodyObserver = new MutationObserver((mutations, obs)=>{
                if(document.body){
                    createPanel();
                    obs.disconnect();
                }
            });
            bodyObserver.observe(document.documentElement, {childList:true, subtree:true});
        }
    }

    document.addEventListener("DOMContentLoaded", ensureBodyAndCreatePanel);
    ensureBodyAndCreatePanel();

    const observer=new MutationObserver(mutations=>{
        mutations.forEach(m=>{
            m.addedNodes.forEach(n=>{
                cleanAll(n);
            });
        });
    });

    observer.observe(document.documentElement,{childList:true,subtree:true});
    setInterval(()=>requestIdleCallback(()=>cleanAll(document)),5000);

})();