Skip to content

Instantly share code, notes, and snippets.

@iarp
Created May 24, 2023 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iarp/9ffd547e0dfc7e08d02d23071d67529a to your computer and use it in GitHub Desktop.
Save iarp/9ffd547e0dfc7e08d02d23071d67529a to your computer and use it in GitHub Desktop.
tampermonkey script that highlights geeksforgeeks, medium, and quora
// ==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