Filter CSDN Content from Bing and Baidu

Filter out CSDN content from Bing and Baidu search results

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Filter CSDN Content from Bing and Baidu
// @namespace    http://tampermonkey.net/
// @version      2024-12-05
// @description  Filter out CSDN content from Bing and Baidu search results
// @author       You
// @match        https://www.bing.com/search?q=*
// @match        https://www.baidu.com/s?wd=*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=bing.com
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to remove CSDN results
    function removeCSDNResults() {
        const results = document.querySelectorAll('.b_algo, .b_sideBleed, .b_footnote, .result');
        results.forEach(result => {
            const link = result.querySelector('a');
            // Filter for Bing results
            if (link && link.href.includes('csdn.net')) {
                result.style.display = 'none';
            }
            // Filter for Baidu results
            const muAttr = result.getAttribute('mu');
            if (muAttr && muAttr.includes('csdn.net')) {
                result.style.display = 'none';
            }
        });
    }

    // Run the function after the page loads
    window.addEventListener('load', removeCSDNResults);
})();