Greasy Fork

Greasy Fork is available in English.

驱动之家净化阅读 - 文章样式调整

驱动之家阅读文章样式调整

目前为 2024-05-17 提交的版本,查看 最新版本

// ==UserScript==
// @name         驱动之家净化阅读 - 文章样式调整
// @namespace    http://tampermonkey.net/
// @version      1.0.2
// @description  驱动之家阅读文章样式调整
// @author       zengyufei
// @match        http://www.mydrivers.com/
// @match        https://www.mydrivers.com/
// @match        https://news.mydrivers.com/
// @match        http://news.mydrivers.com/
// @match        https://news.mydrivers.com/class/**
// @match        http://news.mydrivers.com/**.htm
// @match        https://news.mydrivers.com/**.htm
// @grant        none
// @require      http://code.jquery.com/jquery-1.11.0.min.js
// ==/UserScript==

// https://github.com/zengyufei

if ('loading' == document.readyState) {
    console.log("1。");
} else {
    console.log("2:" + document.readyState);
}
document.addEventListener('readystatechange', event => {
    if (event.target.readyState === 'loading') {
        console.log("3。");
    }
    if (event.target.readyState === 'interactive') {
        console.log("4。");
    } else if (event.target.readyState === 'complete') {
        console.log("5");

        var isContentPage = /.*htm$/.test(location.href) &&  /^http(s)?:\/\/news\.mydrivers\.com\/.*$/.test(location.href)
        var isIndexPage = /^http(s)?:\/\/www\.mydrivers\.com\/$/.test(location.href)
        var isZhiBo = $(".zhibo_box").length > 0

        // 内容页
        if(isZhiBo) {
            console.log("51。");

        } else if (isContentPage){
            console.log("52。");


            // 删除长时间停留弹窗
            $("body > script:nth-child(25)").remove();
            // 删除长时间停留弹窗
            $("#a_showhotnews_list_dia").remove();
            // 删除顶栏
            $("body > div.top").remove();
            // 删除菜单栏
            $("#menu_2023").remove();
            // 删除AD广告
            $("body > div.baidu").remove();
            // 删除面包屑
            $("body > div.pathway").remove();
            // 删除标题下方广告位
            $("#main_contents > div.news_n > div:nth-child(3) > a > img").remove()
            // 删除作者和右边侧栏
            $("body > div.main_box > div.main_right").remove()
            // 删除尾部
            $("body > div.footer_about").remove()
            // 扩大阅读区
            $(".main_left").attr("style", "width:100%;")
            // 删除转发区域
            $("#main_contents > div.function").remove()
            $("#main_contents > div.news_n > div:nth-child(5) > div.share").remove()
            // 删除文章生产日期
            $("#main_contents > div.news_n > div.news_bt1").remove()
            // 删除相关推荐
            $("#main_contents > div.navs_newsinfo.xg_newsinfo").remove()
            // 删除打赏
            $("#main_contents > div.news_zc").remove()
            // 删除评分
            $("#main_contents > div.news_df").remove()
            // 删除内容评论分隔符
            $("#main_contents > div.adds").remove()
            // 删除评论提示
            $("body > div > div.plun_title.b_bottom > ul > li.pnumber").remove()

        } else {
            if (isIndexPage) {
                console.log("53。");

                $(".main_left").attr("style", "width:1333px !important;margin:0 auto;float:none;height: auto;background:#fff0;");
                $(".news_info1").attr("style", "background: #fff;");
                $(".main_1").removeAttr("style");
                $(".main_1").attr("style", "height:1099px;");

                var shidianDom = $(".shidian")
                shidianDom.remove();

                $(".main_box").remove();
                var gcDom = $("#GC_box")
                gcDom.nextAll().remove();
                gcDom.remove();

                $("iframe").remove();
                $("body link").remove();
                $("body style").remove();

                $(".main_2").remove();

                $(".nav_box").remove();
                $(".main_right").remove();
                $(".main_right_title").remove();
                $(".main").attr("style", "width:1333px;");
                $("#news_content_1,#news_content_2,#news_content_3,#news_content_4,#news_content_5").after(
                    '<HR style="FILTER: alpha(opacity=100,finishopacity=0,style=3)" width="80%" color=#987cb9 SIZE=1>'
                ).show()
                $("#news_content_page").remove();
                $(".news_info1").css("width", "50%");

                setTimeout(()=>{

                    // 删除尾部广告
                    $("body > div:nth-child(5)").remove()
                    $("body > div:nth-child(5)").remove()
                    $("body > div:nth-child(5)").remove()
                    $("body > div:nth-child(5)").remove()
                    $("body > div:nth-child(5)").remove()
                    $("body > div:nth-child(5)").remove()
                    $("body > div:nth-child(5)").remove()
                    $("body > div:nth-child(5)").remove()


                    $("body > div.link").remove()
                    $("body > div.footer_about").remove()
                    $("body > div.main > div > div > h3").remove()

                }, 5000)

                console.log("53end。");
            } else {
                console.log("54。");
                $(".shidian").remove();
                $(".product_box").remove();
                $(".righttitle ").remove();
                $(".top_1_center ").remove();
                $(".pathway ").remove();
                $(".main_right div:not(:last-child)").remove();
                $(".link ").remove();
                $("#footer").remove();
            }
        }

    } else {

        console.log("6");
    }
});
(function () {
    console.log("7");
    'use strict';

    var isContentPage = /.*htm$/.test(location.href) &&  /^http(s)?:\/\/news\.mydrivers\.com\/.*$/.test(location.href)
    var isIndexPage = /^http(s)?:\/\/www\.mydrivers\.com\/$/.test(location.href)
    var isZhiBo = $(".zhibo_box").length > 0

    })();