AV_AD_Block

missav

当前为 2022-10-20 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         AV_AD_Block
// @description  missav
// @icon         https://static.missav.com/img/favicon.png
// @namespace    loadingi.local
// @version      1.0
// @author       ch
// @match        https://missav.com/*
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_xmlhttpRequest
// @license      GPL-3.0-only
// ==/UserScript==

(function() {
    'use strict';
////missav.com
  //Block Player OnceClick PopUp
    var elem0 = document.querySelector("div.flex-1.order-first").children[0]
    elem0.removeAttribute('x-init')
    elem0.removeAttribute('x-data')
    var elem1 = document.querySelector("div.relative.-mx-4.-mt-6.sm\\:m-0").children[0]
    elem1.removeAttribute(elem1.attributes[0].name)
    elem1.removeAttribute('@click.once')
  //Block GIF AD
    var elmt1 = document.querySelector('div.space-y-5.mb-5')
    var elmt2 = document.querySelector('div.under_player')
    var elmt3 = document.querySelector("iframe")
    var elmt4 = document.querySelector("script[src*='inpage.push.js']")
    function blockgif(){
        for (var i = 1; i<5; i++){
            var obj = eval('elmt'+i)
            if(obj){
                //console.log(obj)
                obj.remove()
            }else{break}
        }
    }
  //Block Video AD
    function blockvideoad(){
        var elem004 = document.querySelector("button[class^=close-button]")
        console.log('trying')
        if(elem004){
            console.log('Detection! Removed -----------------------------------');
            elem004.parentElement.remove();
            //清除计时器
            //clearInterval (timerVar);
            //timerVar= "";
        }
    }
  //Block script
    function blockScript(){
        var anchors = document.querySelectorAll("script");
        for(var i=0;i<anchors.length;i++){
            if(anchors[i].innerText.indexOf("htmlAds")>0){
                anchors[i].remove()
                break;
            }else{console.log("noMatch")}
        }
    }
  //LOOP
    var timerVar = setInterval (function() {blockProcc(); }, 500);
    var hits = 50
    function blockProcc(){
        //console.log('trying')
        blockgif();
        blockScript();
        blockvideoad();
        hits--
        console.log(hits)
        if(hits<=0){clearInterval (timerVar);console.log('exited');}
    }
})();