Greasy Fork

Greasy Fork is available in English.

去除软件站无用元素

去除殁漂遥、果核剥壳、423down无用元素

当前为 2024-04-14 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         去除软件站无用元素
// @namespace    http://tampermonkey.net/
// @version      0.30
// @description  去除殁漂遥、果核剥壳、423down无用元素
// @author       You
// @match        https://*.mpyit.com/*
// @match        https://*.ghxi.com/*
// @match        https://*.423down.com/*
// @match        https://*.mefcl.com/*
// @grant        none
// ==/UserScript==
/* globals jQuery, $, waitForKeyElements */

(function() {
    'use strict';
    let len, arr, i
    if (window.location.hostname == "www.mpyit.com") {
        //删除只有一个类名的Div
        let url = window.location.href
        if (!url.includes(".html")) { //判断是否是首页
            let childDivs;
            if (url.includes("category") || url.includes("/?s=")) { //分类和搜索页面
                childDivs = document.getElementById('content').children;
            } else {
                childDivs = document.getElementById('post').children;
                i = 0;
                while (i < childDivs.length) {
                    if (childDivs[i].innerHTML.indexOf("AIChat") !== -1){
                        childDivs[i].remove();
                    }
                    if (childDivs[i].id == "map" || childDivs[i].id == "pagenavi") {
                        i++;
                        continue;
                    } else {
                        let classNames = childDivs[i].className.split(' ');
                        if (classNames.length < 2) {
                            childDivs[i].remove();
                        } else {
                            i++;
                        }
                    }
                }
            }
        }
        //删除类名为category-zhengban的Div
        len = document.getElementsByClassName("category-zhengban").length
        for (i = 0; i < len; i++) {
            document.getElementsByClassName("category-zhengban")['0'].remove()
        }
        //删除右侧 "正版福利"
        len = document.getElementsByClassName("widget").length
        for (i = 0; i < len; i++) {
            if (document.getElementsByClassName("widget")[i].offsetHeight != 0) {
                document.getElementsByClassName("widget")[i].getElementsByTagName("h3")[0].remove();
                document.getElementsByClassName("widget")[i].getElementsByClassName("box")[0].remove();
            }
        }
        //删除leftad.png
        let bodyElement = document.querySelector('body');
        bodyElement.style.backgroundImage = 'none';
        window.scrollTo(0, 60);
        window.scrollTo(0, 0);
    } else if (window.location.hostname == "www.ghxi.com") {
        window.addAdNote = function() {} //广告提示条
        len = document.getElementsByClassName("wpcom_ad_wrap").length
        for (i = 0; i < len; i++) {
            document.getElementsByClassName("wpcom_ad_wrap")['0'].remove()
        }
        arr = new Array("12", "13", "15", "16", "18", "21", "22", "23", "24", "25", "26")
        for (i = 0; i < arr.length; i++) {
            let obj = document.getElementById("modules-" + arr[i]);
            if (obj) {
                obj.remove();
            }
        }
        len = document.getElementsByClassName("item-sticky").length
        for (i = 0; i < len; i++) {
            document.getElementsByClassName("item-sticky")['0'].remove()
        }
    } else if (window.location.hostname == "www.423down.com") {
        //删除分类名带推荐的
        $(".content-wrap:eq(0) .content ul.excerpt li").each(function() {
            let catSpan = $(this).find(".info .cat")[0];
            if (catSpan.innerHTML.includes("推荐") || catSpan.innerHTML.includes("推广") ) {
                $(this).remove();
            }
            let titleSpan = $(this).find("h2 a")[0].innerHTML;
            if (titleSpan.includes("!") || titleSpan.includes("!")) {
                $(this).remove();
            }
        });

        //删除nav里GPT广告
        let ulMenu = $('[id="menu-%e9%a1%b6%e9%83%a8%e5%af%bc%e8%88%aa"]') //
        if (ulMenu.length > 0) {
            ulMenu.children('li').each(function() {
                if ($(this).attr('id') && $(this).attr('id').length === 15) {
                    $(this).remove();
                }
            });
        }

        //删除文章页标题下GPT广告
        let gpt_ad = $(".entry").children().eq(0)
        if (gpt_ad.children().eq(0)[0].nodeName.length == 5) {
            gpt_ad.children().eq(0)[0].remove();
        }

        //删除文章底部站长推荐
        $('img[src="https://www.423down.com/wp-content/themes/D7/img/new.png"]').each(function() {
            $(this).parent().remove();
        });
        $('img[src="https://img.alicdn.com/imgextra/i4/1058648503/O1CN01xNg1Yu2CgQa0kJpVt_!!1058648503.png"]').each(
            function() {
                $(this).parent().remove();
            });
    } else if (window.location.hostname == "www.mefcl.com") {
        $(".content").find("article").each(function() {
            if ($(this).text().indexOf("合作推荐") !== -1) {
                $(this).remove();
            }
        });
        $(".item-01").empty();

    }
})();