Greasy Fork

Greasy Fork is available in English.

再见了百度知道和百家号搜索结果

删除百度搜索结果的百度知道和百家号结果

当前为 2018-10-08 提交的版本,查看 最新版本

// ==UserScript==
// @name         再见了百度知道和百家号搜索结果
// @namespace    http://tampermonkey.net/
// @home-url     http://greasyfork.icu/zh-CN/scripts/371691
// @description  删除百度搜索结果的百度知道和百家号结果
// @version      0.10
// @include      http://www.baidu.com/*
// @include      https://www.baidu.com/*
// @author       vessl
// @grant        none
// @run-at       document-end
// ==/UserScript==



(function() {
    'use strict';

     $(document).on('DOMSubtreeModified',process);

    function process() {

        var results = document.getElementById('content_left');

            if(!results) return;

            for (var i =0; i < results.children.length; i++) {
                var links = results.children[i].getElementsByClassName('c-showurl');
                if (links && links.length > 0) {
                    var link = links[0];
                    var text = link.innerText;
                    if (text && (text.indexOf('zhidao.baidu') > -1 || text.indexOf('baijia')) > -1){
                        results.children[i].parentNode.removeChild(results.children[i]);
                    }
                }
            }

    }
})();