remove ads

clear site ui

目前為 2023-09-19 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         remove ads
// @namespace    http://removeads.net/
// @version      0.1.20
// @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        *sexinsex*
// @exclude        *://*.doubleclick.*/*
// @exclude        *://*advertising*
// @exclude        *://*banner*

// @license MIT
// @run-at document-end
// ==/UserScript==

; (function (withjQuery, remove) {
    "use strict"
    if (window.self !== window.top) {
        return;
    } // end execution if in a frame
    withjQuery(function ($, window) {
        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) {

            console.log("removed->", $(selectors.join(",")).length, selectors.join(","))
            $(selectors.join(",")).remove()

        }
        let removeListAds = function () {
            for (let i = list.length; i > 0; i--) {
                let li = list[i - 1]
                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()
                    }
                }

            }
        }
        // Select the node that will be observed for mutations
        let targetNode = document.body;
        // 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);
        // 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)
    }
})