Forked from kelunik/remove-w3schools-from-google-search.user.js
Last active
August 29, 2015 14:26
-
-
Save crazygolem/18be92d387482ddd07b8 to your computer and use it in GitHub Desktop.
Remove w3schools.com from Google Search results
This file contains 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 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