remove ads

clear site ui

От 21.09.2023. Виж последната версия.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey, Greasemonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Userscripts.

За да инсталирате скрипта, трябва да инсталирате разширение като Tampermonkey.

За да инсталирате този скрипт, трябва да имате инсталиран скриптов мениджър.

(Вече имам скриптов мениджър, искам да го инсталирам!)

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

(Вече имам инсталиран мениджър на стиловете, искам да го инсталирам!)

// ==UserScript==
// @name         remove ads
// @namespace    http://removeads.net/
// @version      0.1.22
// @description  clear site ui
// @author       jim
// @include        /http[s]?\:\/\/([a-z\.]*\.)?[myjavbay|eporner|footfan|sis001|theporn|av6k|eqpp|bdsmx|vjav|soav|pornlulu|arival|avtb].*\..*/
// @include        *
// @exclude        *://*.doubleclick.*/*
// @exclude        *://*advertising*
// @exclude        *://*banner*
// @grant         GM_getValue
// @grant         GM_setValue
// @grant         GM.getValue
// @grant         GM.setValue
// @require       https://openuserjs.org/src/libs/sizzle/GM_config.min.js
// @license MIT
// @run-at document-end
// ==/UserScript==

; (async function (withjQuery, addStyle, createSuperLabel) {
    "use strict";

    if (window.self !== window.top) {
        return;
    } // end execution if in a frame

    withjQuery(function ($, window) {
        let conf = new GM_config({
            id: 'GM_config_removeAds',
            title: 'Configurable Options Script',
            fields: {
                'conf': {
                    'label': 'Search keys',
                    'type': 'textarea',
                    'default': `[
                         {
                        "matchs": ["arival", "pornlulu"],
                        "selectors": [
                            "div.row.no-gutters", "#top-ads", "#bottom-ads", ".ima-ad-container",
                            "#myplayer_ima-ad-container", 'div[style*="text-align:center"]'
                        ]
                    }]`
                },
            },
        });

        addStyle(`
        a:link{color:green;}
        a:hover{color:red;}
        a:active{color:yellow;}
        a:visited{color:orange;}
        .btn1   {   
                    opacity:0.3;-moz-transition-duration:0.2s;-webkit-transition-duration:0.2s;
                    padding:1px; margin-top:1px;
                    font-size: 10; text-align: center; vertical-align: middle; line-height:40px;
                    border-radius:5px 5px 5px 5px;cursor:pointer; left:0px;z-index:9999;
                    background:white; 
                    width:40px;height:40px;
                }`);

        let container = $(document.createElement('div')).css({
            'cssText': `position:fixed;top:480px;width:40px;height:240px;left:0px;z-index:9999`
        });
        //最顶按钮
        let toTopBtn = $(document.createElement('div')).text('Top');
        toTopBtn.click(function () {
            window.scrollTo(0, 0);
        });
        container.append(toTopBtn);

        if (window.location.href.indexOf("thread") == -1) {
            //下载按钮
            let downloadBtn = $(document.createElement('div')).text('Lod');
            downloadBtn.click(function () {
                let url = $(".t_attachlist > dt > a:eq(1)").prop('href');
                let filename = $("div.mainbox.viewthread>h1").text().trim() + '.torrent';
                console.log(filename)
                $.ajax({
                    url,
                    success: function (result, status, xhr) {
                        let alink = document.createElement('a');
                        alink.download = filename;
                        alink.href = $(result).find("#downloadBtn").prop('href');
                        document.body.appendChild(alink);
                        alink.click();
                    },
                    error: function (xhr, status, error) {
                        console.log(status, error)
                    }
                });
            });
            container.append(downloadBtn);

        }
        else {
            $('tr').hover(function () {
                $(this).find('*').css("background-color", "#9AAAC7")
            },
                function () {
                    $(this).find('*').css("background-color", '');
                });
        }

        //最低按钮
        let toBottomBtn = $(document.createElement('div')).text('Bot');;
        container.append(toBottomBtn);
        toBottomBtn.click(function () {
            window.scrollTo(0, document.body.scrollHeight);
        });


        let fastBtn = $(document.createElement('div')).text('Set'),
            middleBtn = $(document.createElement('div')).text('Sta'),
            slowBtn = $(document.createElement('div')).text('Low');
        container.append(fastBtn)
            .append(middleBtn)
            .append(slowBtn)

        container.find('div')
            .addClass('btn1')
            .hover(
                function (item) {
                    $(this).css('opacity', 1).css('border', '1px solid black')
                }, function (item) {
                    $(this).css('opacity', 0.3).css('border', 'none')
                })


        fastBtn.click(function () {
            conf.open();

        });
        slowBtn.click(function () { });

        $(document).keydown(function (event) {
            let e = event || window.event;
            let k = e.keyCode || e.which;
            if (k === 16) {
                //  isCtrl = true;
                middleBtn.click()
            } else if (k === 38) {  //up
                event.stopPropagation()
                slowBtn.click()

            } else if (k === 40) {//down
                event.stopPropagation()
                //fastBtn.click()
            }
        })
   
        middleBtn.click(function () {
            if (!!!win.___t) {
                win.___func();
            } else {
                clearTimeout(win.___t)
                win.___t = 0
            }
        })

        container.appendTo('body');


        let list = [{
            "matchs": ["avtb"],
            "selectors": [".ads"]
        },
        {
            "matchs": ["sexinsex"],
            "selectors": ["#header", ".ad_text"]
        },
        {
            "matchs": ["arival", "pornlulu"],
            "selectors": [
                "div.row.no-gutters", "#top-ads", "#bottom-ads", ".ima-ad-container",
                "#myplayer_ima-ad-container", 'div[style*="text-align:center"]'
            ]
        },
        {
            "matchs": ["myjavbay"],
            "selectors": ["#custom_html-12", "#custom_html-18", "#custom_html-19", "#custom_html-2"]
        },
        {
            "matchs": ["eporner"],
            "selectors": ["#movieplayer-box-adv"]
        },
        {
            "matchs": ["footfan"],
            "selectors": ["#sticky-banner-4672820", ".da", ".form-group.dvplay > div:eq(1)"]
        },
        {
            "matchs": ["sis001"],
            "selectors": ["#ad_headerbanner", ".ad_text", ".portalbox", "#header"]
        },
        {
            "matchs": ["av6k"],
            "selectors": [
                "div.frameC > a", "div.frame > a", "#app", "table.links-top2", ".video-img", ".subLink",
                ".newVideoC>div>a[target='_blank'],p,font,b,.h_30", ".clickadu", ".footlink", ".clickadu"
            ],
            "run": () => {
                $("#header").css({ "padding-top": "0px", "padding-bottom": "0px" })
                $(".menu").css({ "padding-top": "0px", "padding-bottom": "0px" })
            }
        },
        {
            "matchs": ["theporn"],
            "selectors": ["div.c199d26a", ".float-right.right-player-container.col-2"],
            "run": () => {
                $(".q-responsive").parent().parent().parent().remove()
                setTimeout(function () {
                    $("#gbcs").trigger("click")
                    $(".close").trigger("click")
                    $(".block").trigger("click")
                    remove("#__ds_dp", "#domain_change_dialog")
                }, 3000)
            }
        },
        {
            "matchs": ["eqpp"],
            "selectors": ["#sticky-banner-4672820", ".da", ".form-group.dvplay > div:eq(1)"]
        },
        {
            "matchs": ["bdsmx"],
            "selectors": [".right", "section:contains(Advertisement)"]
        },
        {
            "matchs": ["vjav"],
            "selectors": [
                ".hdyythvtvviieietth", ".vydththeeyy", "section:contains(Advertisement)",
                ".sinieieyyii", ".eniimeymsywwywyiie", ".iyinsiieieyyii", ".video-page__content>*:not(.left)",
                ".left>*:not(.video-page__player,.video-page__underplayer)"
            ]
        },
        {
            "matchs": ["soav"],
            "selectors": ['.ad.noadmo']
        },
        ]

        let remove = function (...selectors) {
            let adItems = $(selectors.join(","))
            console.log("removed->", adItems.length, selectors.join(","))
            adItems.remove()

        }
        let removeListAds = function () {

            new Promise((resolve, reject) => resolve(conf.get('conf', '[]')))
                .then(r => {
                    try {
                        return JSON.parse(r)
                    } catch (error) {
                        console.log('config value:', r, 'Error:', error)
                        return []
                    }
                })
                .then(listconf => listconf.concat(list))
                .then(alllist => {
                    for (let i = alllist.length; i > 0; i--) {
                        let li = alllist[i - 1]
                        if (!li) {
                            console.log(`item is null, index:`, i)
                            continue;
                        }
                        if (!li.matchs || li.matchs.length == 0) {
                            console.log(`matchs is null or matchs length is 0, index:`, i)
                            continue;
                        }
                        for (let j = li.matchs.length; j > 0; j--) {

                            if (window.location.href.indexOf(li.matchs[j - 1]) > -1) {
                                remove(...li.selectors)
                                if (li.run) li.run()
                            }
                        }

                    }
                })
                .catch(error => console.log('config err:', error))




        }

        // Options for the observer (which mutations to observe)
        let config = {
            childList: true, // 监视node直接子节点的变动
            subtree: true, // 监视node所有后代的变动
            attributes: true, // 监视node属性的变动
            characterData: false, // 监视指定目标节点或子节点树中节点所包含的字符数据的变化。
            attributeOldValue: false // 记录任何有改动的属性的旧值
        };
        // Callback function to execute when mutations are observed
        let callback = function (mutationsList, observer) {
            for (let mutation of mutationsList) {
                if (mutation.type == 'childList') {
                    for (var node of mutation.addedNodes) {
                        if (!(node instanceof HTMLElement)) continue;
                        if (node.tagName == 'IFRAME') {
                            // $(node).remove()
                            // console.log("mutation remove->", "iframe")
                        }
                        if (node.tagName == 'DIV') {
                            removeListAds()
                        }
                    }

                } else if (mutation.type == 'attributes') {
                    // if (mutation.target.tagName == "DIV" && mutation.target.innerText && mutation.target.innerText != '') {
                    //     console.log("mutation attributes->", mutation.target.innerText)
                    //     if (mutation.target.innerText.indexOf('Skip') > -1)
                    //         mutation.target.click()
                    // }

                }
            }


        };
        // Create an observer instance linked to the callback function
        let observer = new MutationObserver(callback);

        // Select the node that will be observed for mutations
        let targetNode = document.body;
        // Start observing the target node for configured mutations
        observer.observe(targetNode, config);

        // (new MutationObserver((mlist, obs) => { })).observe(document.body, {
        //     childList: true, // 监视node直接子节点的变动
        //     subtree: true, // 监视node所有后代的变动
        //     attributes: true, // 监视node属性的变动
        //     characterData: false, // 监视指定目标节点或子节点树中节点所包含的字符数据的变化。
        //     attributeOldValue: false // 记录任何有改动的属性的旧值
        // })

        $(document).ready(function () {

            remove("[opacity='0']", "[display='block']")
            //remove("iframe")
            //console.log("document ready remove->", "iframe")
            removeListAds()

        })
    }, false)

    // Put all your code in your document ready area

    // Your code here...
})(
    function (callback, safe) {
        if (typeof jQuery == "undefined") {
            let script = document.createElement("script")
            script.type = "text/javascript"
            script.src = "https://code.jquery.com/jquery-3.6.1.min.js"
            if (safe) {
                let cb = document.createElement("script")
                cb.type = "text/javascript"
                cb.textContent = "jQuery.noConflict();(" + callback.toString() + ")(jQuery, window);"
                script.addEventListener("load", function () {
                    document.head.appendChild(cb)
                })
            } else {
                let dollar = undefined
                if (typeof $ != "undefined") dollar = $
                script.addEventListener("load", function () {
                    jQuery.noConflict()
                    // eslint-disable-next-line no-global-assign
                    $ = dollar
                    callback(jQuery, window)
                })
            }
            document.head.appendChild(script)
        } else {
            setTimeout(function () {
                //Firefox supports
                callback(jQuery, typeof unsafeWindow === "undefined" ? window : unsafeWindow)
            }, 30)
        }
    },
    //addStyle 
    function (css) {
        var s = document.createElement('style');
        s.appendChild(document.createTextNode(css));
        document.getElementsByTagName('head')[0].appendChild(s);
    },
    //createSuperLabel 创建超链接,不会被拦截 
    function (url, id) {
        if (!id)
            id = url;
        // 防止反复添加
        if (!document.getElementById(id) && !localStorage[id]) {
            let tmpLink = document.createElement("a");
            localStorage[id] = true
            tmpLink.setAttribute("href", url);
            tmpLink.setAttribute("target", "_blank");
            tmpLink.setAttribute("id", id);
            document.body.appendChild(tmpLink);
            tmpLink.click();
            return true
        }
        return false;
    }
)