去除软件站无用元素

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

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

(function() {
    'use strict';
    if (window.location.hostname == "www.mpyit.com") {
        $(".sticky").remove();//正版推荐和广告
        $('body').css('background-image', 'none');//body的背景设置为none
        window.scrollTo(0, 60);
        window.scrollTo(0, 0);
    } else if (window.location.hostname == "www.ghxi.com") {
        window.addAdNote = function() {} //广告屏蔽提示条
        $(".wpcom_ad_wrap").remove();//广告
        let ghxi_ai_ad=$('.entry-content style').first().prev()
        if (ghxi_ai_ad.text().includes("AI")){
            ghxi_ai_ad.remove()//果核的AI广告
        }
        $(".item-sticky").remove();//文章列表置顶的广告
        $('button.gh-dialog--btn').length && $('button.gh-dialog--btn').click();//关注公众号弹窗
        $("#core-ai-summary-tool")?.remove();//文章ai总结
        removeElementWithoutClass(".sidebar > div");//sidebar里的广告
        ["12", "13", "15", "16", "18", "21", "22", "23", "24", "25", "26", "27", "28", "29"].forEach(id => {
            $(`#modules-${id}`).remove();//各种无用模块
        });
    } else if (window.location.hostname == "www.423down.com") {
        let isPC = $('div.wrapper').length > 0;
        if (isPC) {
            $('.content-wrap:eq(0) .content ul.excerpt li:contains("推广"),.content-wrap:eq(0) .content ul.excerpt li:contains("推荐")').remove();//带推广和推荐的全删除
            $('.content-wrap:eq(0) .content ul.excerpt li:contains("!"),.content-wrap:eq(0) .content ul.excerpt li:contains("!")').remove();//推广一般都带感叹号
            $('ul.nav ul li').slice(-2).remove();//导航条后两个ai广告
        } else {
            $('.post-list li:contains("置顶")').remove();//手机端匹配"置顶"就行
            $('nav.navbar-nav ul li').slice(0,2).remove();//侧边栏前两个ai广告
        }
        $('.content > p').remove();
    } else if (window.location.hostname == "www.mefcl.com") {
        removeElementsByText('.content', 'article', '合作推荐');
        $(".item-01").empty();
    }else if (window.location.hostname == "www.fenxm.com") {
        removeElementsByText('.content', 'article', '置顶');
        $(".swiper-container").remove();
        $(".full-pst").remove();
    }else if (window.location.hostname == "www.gndown.com") {
        removeElementsByText('.content', 'article', '置顶');
    }else if (window.location.hostname == "www.osssr.com") {
        removeElementsByText('.content', 'article', '置顶');
        $(".excerpt-minic-index").remove();
    }else if (window.location.hostname == "www.lsapk.com") {
        $(".swiper-container").remove();
        removeElementsByText('.post-list', 'li', '置顶');
        removeElementWithoutClass(".sidebar-box-list > div")
        $(".cp-pop-btn")[0]?.click()
    }else if (window.location.hostname == "www.lxapk.com") {
        $('.adsbygoogle').css('height', '0px');
        $('.swiper-bulletin ,.new-swiper').hide();
        $('.widget-tab-post ,.wp-image-2903').remove();
        $('.container.fluid-widget')[0].remove();
        removeElementsByText('.posts-row', 'posts', '置顶');
    }

    //删除包含指定字符串的元素
    function removeElementsByText(selector, childSelector, searchText) {
        $(selector).find(childSelector).each(function() {
            if ($(this).text().indexOf(searchText) !== -1) {
                $(this).remove();
            }
        });
    }

    //删除指定元素下没有类名的元素
    function removeElementWithoutClass(selector) {
        $(selector).each(function() {
            if (!$(this).attr('class')) {
                $(this).remove();
            }
        });
    }
})();