Created
May 24, 2023 15:51
-
-
Save iarp/9ffd547e0dfc7e08d02d23071d67529a to your computer and use it in GitHub Desktop.
tampermonkey script that highlights geeksforgeeks, medium, and quora
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Google Crap Filter | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Highlight bad sites in Google search results. | |
// @author carcigenicate | |
// @match https://www.google.com/search* | |
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const CRAP = ["geeksforgeeks", "medium", "quora"]; | |
function isCrap(href) { | |
for (const crap of CRAP) { | |
if (href.includes(crap)) { | |
return true; | |
} | |
} | |
return false; | |
} | |
const resultLinks = document.querySelectorAll("#search .g > div > div > div > a"); | |
for (const anchor of resultLinks) { | |
if (isCrap(anchor.href)) { | |
const resultContainer = anchor.parentElement.parentElement.parentElement; | |
resultContainer.style.backgroundColor = "darkred"; | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment