Greasy Fork is available in English.

移除百家家号搜索结果

删除百度搜索结果的百家号结果

Tính đến 30-12-2018. Xem phiên bản mới nhất.

// ==UserScript==
// @name         移除百家家号搜索结果
// @namespace    http://tampermonkey.net/
// @home-url     https://greasyfork.org/zh-CN/scripts/375240
// @description  删除百度搜索结果的百家号结果
// @version      0.15
// @include      http://www.baidu.com/*
// @include      https://www.baidu.com/*
// @require      http://code.jquery.com/jquery-1.8.2.js
// @author       mzcc
// @note         2018.12.30-0.15 根据反馈,删除操作做新的变更逻辑
// @note         2018.12.19-0.14 根据百度界面变化,删除操作做新的变更逻辑
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

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

    function process() {
        // 第一项单独处理
        let $topOp = $('.c-offset');
        $topOp.children().each(function(i, v){
            let $this = $(this);
            if($this.find('.source-icon').length){
                let href = $this.find('a').attr('href');
                $topOp.find('a[href="'+href+'"]').parent().remove();
            }
        });
        
        
        // 移除第一项之外的百家号
        $('.c-showurl').each(function(i, v){
            let html = $(this).html();
            if(html.indexOf('baijia') > -1){
                $(this).parents('.c-container').remove();
            }
        });

        
        if(!$topOp.children().length){
            $topOp.parent().remove();
        }

        let $video = $('.op-short-video-pc');
        if($video.length){
            $video.parent().remove();
        }
    }
})();