Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save crazygolem/18be92d387482ddd07b8 to your computer and use it in GitHub Desktop.
Save crazygolem/18be92d387482ddd07b8 to your computer and use it in GitHub Desktop.
Remove w3schools.com from Google Search results
// ==UserScript==
// @name Ditch W3Schools
// @namespace pwa.lu
// @description Remove w3schools.com results from Google
// @include http://www.google.tld/*
// @include https://www.google.tld/*
// @version 1.0
// @grant none
// ==/UserScript==
//
// Inspired by https://gist.github.com/kelunik/255a092c6fe5264c9def
// This script might not work with older browsers because they might not implement
// some DOM APIs or JavaScript keywords used by it.
// If you use an older browser, try the script by kelunik.
function cleanupResults() {
for (var node of document.querySelectorAll('cite')) {
if (node.textContent.indexOf('w3schools.com') > 0) {
var res = node.closest('.g')
res.parentNode.removeChild(res)
}
}
}
new MutationObserver(function(muts) {
muts.forEach(function() { cleanupResults() })
}).observe(document.body, { childList: true })
cleanupResults()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment