Hide StackOverflow in Google Search

hide stackoverflow. research independently.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Hide StackOverflow in Google Search
// @namespace    http://tampermonkey.net/
// @version      2024-12-23
// @description  hide stackoverflow. research independently.
// @author       You
// @match        https://www.google.com/**
// @icon         https://www.google.com/s2/favicons?sz=64&domain=google.com
// @grant        none
// @license      GPLv3
// ==/UserScript==

(function() {
    'use strict';
// the search area
    const area = document.querySelector("div#search")
    // the results
    const first_result = area.childNodes[0].childNodes[1].childNodes[0]
    const other_results = area.childNodes[0].childNodes[1].childNodes[2].childNodes
    let results = [first_result]
    for(let i=0; i<other_results.length; i++) {
        results.push(other_results[i])
    }
    for(let i=0; i<results.length; i++) {
        let spans = results[i].querySelectorAll("span + div > div >span")
        for(let j=0; j<spans.length; j++) {
            let span=spans[j];
            if (span.textContent === "Stack Overflow"|| span.textContent==="Ask Ubuntu" || span.textContent==="Super User" ) {
                console.log(results[i]);
                results[i].style.display = "none";
                break;
            }
        }
    }
})();