去广告/去除百度推广、无用功能

去掉百度推广以及辣鸡推广

As of 2016-05-18 13:16:55 UTC. See the latest version.

// ==UserScript==
// @name         去广告/去除百度推广、无用功能
// @namespace    http://tampermonkey.net/
// @version      0.121
// @description  去掉百度推广以及辣鸡推广
// @author       papipapipia
// @match        http://www.baidu.com/*
// @match        https://www.baidu.com/*
// @grant        none
// ==/UserScript==
window.onload = function(){

    function getElementsByClassName(a, b) {
        if (a.getElementsByClassName) {
            return a.getElementsByClassName(b);
        } else {
            return function c(m, k) {
                if (k == null) {
                    k = document;
                }
                var h = [], g = k.getElementsByTagName("div"), d = g.length, l = new RegExp("(^|\\s)" + m + "(\\s|$)"), f, e;
                for (f = 0, e = 0; f < d; f++) {
                    if (l.test(g[f].className)) {
                        h[e] = g[f];
                        e++;
                    }
                }
                return h;
            }(b, a);
        }
    }


    function Id_hide(id){
        $(id).css('display', 'none');
        console.log('长官 > ' + id + ' > 已经干掉了哦');
    }

    var info = [1,1,1,1,1,1,1,1,1,1,1,1];//推广 右边 百科 图片 新闻 贴吧 Win10 视频 漫画 股票 软件
    function baidu_i_fuck_you(){
        if(info[0] == 1){//推广
            var fuck;
            if (document.all || document.getElementById){
                fuck = document.getElementsByTagName("div");
            }
            for(var i = 0;i < fuck.length;i++){
                if(fuck[i].id !== ""){var fuck_id = fuck[i].id;/*var fuck_Reg = /(?=.*[a-zA-Z0-9])(?=.*\d)(?=.*[#@!~%^&*])[a-zA-Z0-9\d#@!~%^&*]{4,25}/;*/}
                if(fuck_id.length >= 4 && fuck_id.length <= 20){Id_hide(fuck_id);}
            }
        }

        if(info[1] == 1){Id_hide('#content_right');}//右边
        if(info[2] == 1){Id_hide('.c-border');}//百科(经验、翻译)
        if(info[3] == 1){Id_hide('#ala_img_results');Id_hide('.op-img-covers-desktop-cont');Id_hide('.c-showurl');}//图片
        if(info[4] == 1){Id_hide('.c-offset');}//新闻
        if(info[5] == 1){Id_hide('.op-tieba-general-maintable');Id_hide('.op-tieba-star-maintable');Id_hide('.op-tieba-general-lookmore.op-tieba-general-mainpl');}//贴吧
        if(info[6] == 1){Id_hide('.opt_software_showarea');}//Win10
        if(info[7] == 1){Id_hide('.c-row.zx-tv-video-topinfo');Id_hide('.op-zx-new-tvideo-drlt');}//视频
        if(info[8] == 1){Id_hide('.op_cartoon.click-parent-reward');}//漫画
        if(info[9] == 1){Id_hide('.op_shares_simple');}//股票
        if(info[10] == 1){Id_hide('.ct-content');}//商业推广
        if(info[11] == 1){Id_hide('table.c-table.op_pcsoft_table');Id_hide('.c-gap-top');}//软件
    }
    var ischange;
    setInterval (function (){
        if(document.location.href !== ischange){baidu_i_fuck_you();}
        ischange = document.location.href;
    }, 500);
};