serpFilter

Remove crappy yandex zen (and any other sites) from yandex and google search results.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name           serpFilter
// @namespace      aumakua
// @version        1.2.0
// @description    Remove crappy yandex zen (and any other sites) from yandex and google search results.
// @description:ru Удаляет ссылки на Яндекс.Дзен (можно добавлять и другие сайты) из результатов поиска гугла и яндекса.
// @author         aumakua
// @license        MIT
// @match          *://*ya.ru/search*
// @match          *://*yandex.ru/search*
// @match          *://google.com/search*
// @match          *://www.google.com/search*
// @grant          none
// ==/UserScript==

(function () {
    'use strict';
    let snippet_id = '';
    const crap = ['zen.yandex.ru', 'zen.yandex.com', 'dzen.ru']; // you can add other crappy sites here

    if (document.location.hostname.includes('ya.ru') || document.location.hostname.includes('yandex.ru')) {
        snippet_id = 'li:has(div.organic)';
    }
    else if (document.location.hostname.includes('google')) {
        snippet_id = 'div.g';
    }

    const remove_crap = () => {
        const snippets = document.querySelectorAll(snippet_id);
        for (let snippet of snippets) {
            const links = snippet.querySelectorAll('a');
            something:
            for (let link of links) {
                for (let piece of crap) {
                    if (link.href.includes(piece)) {
                        snippet.style.display = 'none';
                        break something;
                    }
                }
            }
        }
    };

    remove_crap();
})();