Greasy Fork

Greasy Fork is available in English.

C语言中文网美化

去掉QQ群和编程辅导班链接

目前为 2020-04-29 提交的版本。查看 最新版本

// ==UserScript==
// @name         C语言中文网美化
// @namespace    http://tampermonkey.net/
// @version      0.1.1
// @description  去掉QQ群和编程辅导班链接
// @author       You
// @match        http://c.biancheng.net/*
// @grant        none
// ==/UserScript==

function getByClass(sClass){
    var aResult=[];
    var aEle=document.getElementsByTagName('*');
    for(var i=0;i<aEle.length;i++)
    {
        /*将每个className拆分*/
        if(typeof(aEle[i].className)=='string')
        {
            var arr=aEle[i].className.split(/\s+/);
            for(var j=0;j<arr.length;j++)
            {
                /*判断拆分后的数组中有没有满足的class*/
                if(arr[j]==sClass)
                {
                    aResult.push(aEle[i]);
                }
            }
        }
    }
    return aResult;
};


(function() {
    'use strict';

    var ad_link_top = document.getElementById("ad-link-top");
    if(ad_link_top != null)
    {
        ad_link_top.setAttribute("style","display:none")
    }

    var bubble = document.getElementsByClassName("bubble");
    if(bubble != null && bubble.length>0)
    {
        bubble[0].setAttribute("style","display:none")
        bubble[1].setAttribute("style","display:none")
    }

    var ad_arc_top_diy = document.getElementById("ad-arc-top-diy");
    if(ad_arc_top_diy != null)
    {
        ad_arc_top_diy.setAttribute("style","display:none")
    }

    var ad_arc_bottom_diy = document.getElementById("ad-arc-bottom-diy");
    if(ad_arc_bottom_diy != null)
    {
        ad_arc_bottom_diy.setAttribute("style","display:none")
    }

    var follow_us_left_hover_none = getByClass("follow-us");
    if(follow_us_left_hover_none != null && follow_us_left_hover_none.length>0)
    {
        follow_us_left_hover_none[0].setAttribute("style","display:none")
        follow_us_left_hover_none[1].setAttribute("style","display:none")
    }

    var qq_qun_float = document.getElementById("qq-qun-float");
    if(qq_qun_float != null)
    {
        qq_qun_float.setAttribute("style","display:none")
    }


    var ad_art_body_top = document.getElementsByClassName("ad-art-body-top")[0];
    if(ad_art_body_top != null)
    {
        ad_art_body_top.setAttribute("style","display:none")
    }

    var ad_sidebar_top = document.getElementById("ad-sidebar-top");
    if(ad_sidebar_top != null)
    {
        ad_sidebar_top.setAttribute("style","display:none")
    }

    var ad_bottom_weixin = document.getElementById("ad-bottom-weixin");
    if(ad_bottom_weixin != null)
    {
        ad_bottom_weixin.setAttribute("style","display:none")
    }

    var sticker_sidebar = document.getElementsByClassName("sticker-sidebar")[0];
    if(sticker_sidebar != null)
    {
        sticker_sidebar.setAttribute("style","display:none")
    }

    var weixin_sidebar = document.getElementById("weixin-sidebar");
    if(weixin_sidebar != null)
    {
        weixin_sidebar.setAttribute("style","display:none")
    }

    var fdb = document.querySelector("#main > div:nth-child(1) > a")
    if(fdb != null)
    {
        var fd = fdb.parentNode
        fd.setAttribute("style","display:none")
    }

    var ad_arc_top = document.getElementById("ad-arc-top");
    if(ad_arc_top != null)
    {
        ad_arc_top.setAttribute("style","display:none")
    }

    var ad_arc_bottom = document.getElementById("ad-arc-bottom");
    if(ad_arc_bottom != null)
    {
        ad_arc_bottom.setAttribute("style","display:none")
    }

    var ad_page_top_left = document.getElementById("ad-page-top-left");
    if(ad_page_top_left != null)
    {
        ad_page_top_left.setAttribute("style","display:none")
    }


    // Your code here...
})();