Greasy Fork

来自缓存

Greasy Fork is available in English.

m.5xw.net净化

m.5xw.net净化, 过滤广告。

当前为 2023-12-16 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         m.5xw.net净化
// @namespace    https://github.com/guoshiqiufeng
// @version      1.0.1
// @description  m.5xw.net净化, 过滤广告。
// @author       yanghq
// @license MIT
// @match        https://m.5xw.net/**
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // 保存当前域名
    var currentDomain = window.location.hostname;
    console.log('currentDomain:', currentDomain);

    var nsws = document.querySelectorAll('#nsws');
    // console.log(nsws);
    if(nsws) {
        for(var i=0;i<nsws.length;i++) {
            nsws[i].innerHTML="";
        }
    }
    document.querySelectorAll('wwwhhh1').innerHTML="";

    // 重写XMLHttpRequest的open方法
    var originalOpen = XMLHttpRequest.prototype.open;

    XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
        // 检查请求的目标域名
        var targetDomain = (new URL(url)).hostname;
        console.log('targetDomain:', targetDomain);
        // 如果目标域名与当前域名不匹配,则拦截请求
        if (targetDomain !== currentDomain) {
            console.log('拦截请求:', url);
            return;
        }
        // 调用原始的open方法
        originalOpen.apply(this, arguments);
    };


})();