Greasy Fork

Greasy Fork is available in English.

Fuck微博网页版

自动关闭广告,关闭视频自动播放以及微博视频号语音

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Fuck微博网页版
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  自动关闭广告,关闭视频自动播放以及微博视频号语音
// @author       parhelion
// @include      https://weibo.com/*
// @grant        none
// ==/UserScript==


(function() {
    'use strict';
    const sleep = (timeountMS) => new Promise((resolve) => {
  setTimeout(resolve, timeountMS);
});
    function BanAutoPlay(){
        //var str = document.getElementByClassName("woo-switch-main VideoList_switch_1-TPG").innerHTML;
        //var txt = str.replace("woo-switch-shadow woo-switch-checked","woo-switch-shadow");
        //document.getElementsByClassName("woo-switch-shadow woo-switch-checked")[0].classname = "woo-switch-shadow";
        var e = document.getElementsByClassName("woo-switch-shadow woo-switch-checked")[0];
        if(e){
        //e.setAttribute("class","woo-switch-shadow");
        e.click();
        }
    }

    function BanSBAudio(){
        //var str = document.getElementByClassName("woo-switch-main VideoList_switch_1-TPG").innerHTML;
        //var txt = str.replace("woo-switch-shadow woo-switch-checked","woo-switch-shadow");
        //document.getElementsByClassName("woo-switch-shadow woo-switch-checked")[0].classname = "woo-switch-shadow";
        var e = document.getElementsByClassName("AfterPatch_bgm_3mYmJ")[0];
        if(e){
        //e.setAttribute("class","woo-switch-shadow");
        //e.removeAttribute("autoplay");
        e.parentNode.removeChild(e);
        }
    }

   async function BanAD(){
        //var str = document.getElementByClassName("woo-switch-main VideoList_switch_1-TPG").innerHTML;
        //var txt = str.replace("woo-switch-shadow woo-switch-checked","woo-switch-shadow");
        //document.getElementsByClassName("woo-switch-shadow woo-switch-checked")[0].classname = "woo-switch-shadow";
        var e = document.getElementsByClassName("woo-font woo-font--cross morepop_action_bk3Fq morepop_cross_1Q1PF")[0];
        if(e){
        //e.setAttribute("class","woo-switch-shadow");
        e.click();
        await sleep(100);
        e = document.getElementsByClassName("woo-box-flex woo-box-alignCenter woo-pop-item-main")[0];
        e.click();
        console.log("AD delete");
        }
    }




    BanAutoPlay();
    setInterval(BanAutoPlay, 1000);
    setInterval(BanAD, 500);
    setInterval(BanSBAudio, 100);
    // Your code here...
})();