百度文库去广告

去掉相关文档推荐和购买链接,免开会员使用VIP背景换肤

目前为 2021-08-21 提交的版本。查看 最新版本

// ==UserScript==
// @name         百度文库去广告
// @namespace    http://tampermonkey.net/
// @version      0.9.1
// @description  去掉相关文档推荐和购买链接,免开会员使用VIP背景换肤
// @author       AN drew
// @match        https://wenku.baidu.com/*
// @require      https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js
// @require      https://cdn.bootcdn.net/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';
    GM_addStyle(`html.full-screen::-webkit-scrollbar { width: 0 !important }
html.full-screen { -ms-overflow-style: none; }
html.full-screen { overflow: -moz-scrollbars-none; }
.theme-wrapper{ padding-top: 15px;}
.btn.saveskin {height: 36px;
background: green;
text-align: center;
position: absolute;
right: 48px;
top: 15px;
border-radius: 6px;
font-family: PingFangSC-Medium,sans-serif;
font-size: 16px;
color: #fff;
display: inline-block;
line-height: 36px;
vertical-align: middle;
min-width: 100px;
cursor: pointer;}`);

    if(window.location.href.indexOf("https://wenku.baidu.com/ndcore/browse/sub") > -1)
    {
        if(document.querySelector(".red-text.bold-text"))
            document.querySelector(".red-text.bold-text").style.display="none";
        if(document.querySelector(".pay-vip-btn-wrap"))
            document.querySelector(".pay-vip-btn-wrap").style.display="none";
        if(document.querySelector(".sub-right"))
            document.querySelector(".sub-right").style.display="none";
        if(document.querySelector(".sub-main"))
        {
            document.querySelector(".sub-main").style.cssText="display: flex; justify-content: center;";
            /*
            document.querySelector(".sub-main").style.display="flex";
            document.querySelector(".sub-main").style.justifyContent="center";
            */
        }
    }

    if (typeof $ != 'undefined')
    {
        //设置皮肤
        if($.cookie('mytheme')==undefined)
        {
            $.cookie('mytheme', 'theme-1', { expires: 365, path: "/", domain: "wenku.baidu.com" });
        }
        else
        {
            $('#app').attr('class',$.cookie('mytheme'));
            $('#app').attr('style',$.cookie('mystyle'));
        }


        //保存皮肤
        var $save = $('<div data-v-416af63d="" class="btn saveskin">保存皮肤</div>');

        $save.click(function(){
            if($('#app').attr('class')!=undefined)
            {
                $.cookie('mytheme', $('#app').attr('class'), { expires: 365, path: "/", domain: "wenku.baidu.com" });
                $.cookie('mystyle', $('#app').attr('style'), { expires: 365, path: "/", domain: "wenku.baidu.com" });
            }
            $.cookie('myindex', $.cookie('tempindex'), { expires: 365, path: "/", domain: "wenku.baidu.com" });
            //window.location.reload();
            $('.bottom-theme-select-wrap').hide();
        });

        //点击换肤按钮后,选择并移动至当前皮肤预览图
        var timer1 = setInterval(()=>{
            if($('.theme-enter-wrap').length>0)
            {
                $('.theme-enter-wrap').click(function(){
                    $('.bottom-theme-select-wrap').show();
                    let myindex = parseInt($.cookie('myindex'));
                    setTimeout(()=>{
                        if(!$('.theme-item .bg-img').eq(myindex).hasClass('selected'))
                        {
                            $('.theme-item .bg-img').removeClass('selected');
                            $('.theme-item .bg-img').eq(myindex).addClass('selected');
                        }
                        if(!$('.slide-wrapper').hasClass('slid'))
                        {
                            if(myindex >= 7)
                            {
                                $('.slide-wrapper').attr('style','margin-left: '+(-186*(myindex-7+1))+'px; transition: all 0.3s ease-out 0.1s;')
                            }
                            $('.slide-wrapper').addClass('slid');
                        }
                    },500);
                });
                clearInterval(timer1);
            }
        },1);

        //选择皮肤预览图时
        var timer2 = setInterval(()=>{
            if($('.theme-list').length>0)
            {
                $('.theme-item .bg-img').click(function(){
                    $('.theme-item .bg-img').removeClass('selected');
                    $(this).addClass('selected');
                    $.cookie('tempindex', $('.theme-item .bg-img').index(this), { expires: 365, path: "/", domain: "wenku.baidu.com" });
                });
                clearInterval(timer2);
            }
        },1);

        setInterval(()=>{
            if($('.btn.saveskin').length==0)
            {
                $('.theme-list .title-wrap').append($save);
            }

            $('.theme-list .btn.join-vip').remove();
            $('.bottom-theme-select-wrap > .btn-close').remove();
            $('div.theme-list div.info').remove();
        },1);

        setInterval(()=>{
            $('body').removeAttr('style');
        },1);

        setTimeout(function(){
            $(".moreBtn.goBtn").click();
            //$(".read-all").click();
            $(".more-coment").click();
            if($(".moreBtn.goBtn").length>0)
            {
                setTimeout(function(){
                    $(window).scrollTop(0);
                },500);
            }
        },1500);

        setInterval(function(){

            $('.woniu-guide-card').hide();
            $('.woniu-tag').hide();
            $('.recommend-aside').hide();

            $('.search-topic-block').height(180);
            $('.specialDisplay-container').height(180);
            $('.specialDisplay-inner').height(180);

            $('#top-recommend-dsp-ad').hide();
            $('.search-topic-block').hide();
            $('.tiger-lossUser-dialog-vip').hide();
            $('#go-to-buy-vip-dialog').hide();
            $('.vip-guide-mask').hide();
            $('.new-recommend').hide();
            $('.try-end-fold-page').hide();
            $('.hx-recom-wrapper').hide();
            $('#fengchaoad').hide();
            $('.shop-goods-wrapper').hide();
            $('.opening-season-dialog').hide();
            $('.hx-warp').hide();
            $('.hx-bottom-wrapper').hide();
            $('.bz-doc-tool-dialog-fix').hide();
            $('.fixed-activity-bar').hide();
            $('.dialog-wraper').hide();
            $('.new-skin-wrap').hide();
            $('.pure-guide-dialog').hide();

            $('.vip-activity-wrap-new').hide();
            $('.doc-price-voucher-wrap').hide();
            $('.btn-pay.2').hide();
            $('.btn-pay-vip').hide();
            $('.btn-vip').hide();

            $('.pager-container').hide();
            $('.treasure-main').hide();
            $('.fufei-activity-bar').hide();

            $(".slide-left").hide();
            $(".slide-right").hide();
            $(".bg-items-wrapper").empty();
            $(".bg-items-wrapper").attr("style","width: 700%; margin-left: -100%; background: linear-gradient(rgb(65, 210, 93), rgb(32, 181, 122));")
            $(".slide-circle-wrapper").hide();
            $(".promotion-wrapper").hide();
            $(".doc-pack-wrapper").hide();
            $("#book-rec-wrapper").hide();
            $("#app > div.header-wrapper > div.search-wrapper > div.hot-words-wrapper > div.hot-words-items > div:nth-child(2)").hide();

            $(".aside-rknow-con").hide();
            $(".zsj-topbar.mini").hide();
            $(".search-nav").removeClass("zsj-act");
            $(".bd-wrap").removeClass("zsj-act");
            $(".search-aside-adWrap").hide();
            $(".yuedu-recommend-wrap").hide();
            $(".header-box-recommend.clearfix.inline").hide();
            $(".search-wrapper-box-recommend.clearfix").hide();
            $(".footer-box-recommend.clearfix").hide();
            $(".summary-recommend.clearfix.has-content").hide();
            $(".open-vip-button ").hide();

            $('.confirm-change').hide();
            $('.btn.super-vip').hide();
            $('.specific-user-dialog-wrap').hide();
            $('.experience-card-old-dialog-wrap').hide();
            $("table tr:first").hide();
            $("#banurl").hide();
            $(".mn-lk-w.member-icon").next().hide();
            $("#hd > div > div.nav-wrap.mb10 > div > div > ul.main-nav.side-nav.clearfix > li:nth-child(1)").hide();
            $(".top-ads-banner-wrap").hide();
            $(".zsj-toppos").hide();
            $(".ui-bz-hot-ic").hide();
            $(".qua-box").hide();
            $("#__elm_view-like-recom__qk_1").hide();
            $("#__elm_view-like-recom__qk_2").hide();
            $("#__elm_view-like-recom__qk_3").hide();
            $(".ft").hide();
            $("#next_doc_box").hide();
            $(".convert-tip").hide();
            $(".toolbar-core-btns-wrap").find(".btn-pay-vip").hide();
            $("#relative-doc-item").hide();
            $(".welfare-pop-tip").hide();
            $(".wangpan-tip").hide();
            $(".lastcell-dialog").hide();
            $(".service-entry").hide();
            $(".ad-area").hide();
            $(".banner-ad.banner-wrap.ad-onff").hide();
            $(".wkfc-wrap.ad-onff").hide();
            $(".banner-ad").hide();

            $(".edit-subscription-dialog-wrapper.mod").hide()
            $(".hot-option-word-wrapper").hide()
            $(".tangram-suggestion-main").hide();

            $(".CASH_PACK-CASH.summary").hide();
            $(".CASH_PACK-CASH.searchBox").hide();
            $(".CASH_PACK-CASH.topBar").hide();

            $(".CASH_DISCOUNT-CASH.summary").hide();
            $(".CASH_DISCOUNT-CASH.searchBox").hide();
            $(".CASH_DISCOUNT-CASH.topBar").hide();

            $(".CASH_DISCOUNT-VIP_RIGHT.summary").hide();
            $(".CASH_DISCOUNT-VIP_RIGHT.searchBox").hide();
            $(".CASH_DISCOUNT-VIP_RIGHT.topBar").hide();

            $(".-VIP_RIGHT.summary").hide();
            $(".-VIP_RIGHT.searchBox").hide();
            $(".-VIP_RIGHT.topBar").hide();

            $('.slogan').hide();
            $(".red-text").hide();
            $(".operate-wrapper").hide();
            $(".bottom-pop-wrap").hide();
            $(".pay-layer1509-wrapper").hide();
            $(".pay-vip-btn-wrap").hide();
            $(".relative-search-wrap").hide();
            $(".relative-recommend-wrapper").hide();
            $(".operation-wrapper").hide();
            $(".relative-doc-wrapper").hide();
            $(".relative-course-wrapper").hide();
            $(".hot-search-wrapper").hide();
            $(".hx-right-wrapper").hide();
            $(".doc-voucher-wrap").hide();
            $(".core-btn-wrapper.CASH_DISCOUNT-CASH.CASH_DISCOUNT.summary.t1272-0.nafe-1509").hide();
            $(".core-btn-wrapper.CASH_DISCOUNT-CASH.CASH_DISCOUNT.searchBox.t1272-0.nafe-1509").hide();

            $(".voucher-center-wrap").hide();
            $("#add-price-buy-wrap").hide();
            $(".recommend-wrap.clearfix.notjigou").hide();
            $(".searchMode01").parent().parent().parent().hide();

            $(".right-channel-wrap").hide();
            $(".ex-wrapper").hide();
            $(".query-sug").hide();

            $('.experience-card-dialog-wrap, .experience-card-bar-wrap').hide();
        },1);
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址