Created
June 15, 2021 13:46
-
-
Save GHolk/bcd03fbb3d22685bfc9657d5c9059ce8 to your computer and use it in GitHub Desktop.
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 google search unredirect | |
// @namespace http://gholk.github.io/ | |
// @version 6 | |
// @match https://www.google.com/search?* | |
// @grant none | |
// ==/UserScript== | |
function unlistenClick() { | |
for (const a of document.querySelectorAll('a[onmousedown]')) { | |
a.removeAttribute('onmousedown') | |
a.removeAttribute('onclick') | |
} | |
} | |
const observer = new MutationObserver(mulist => { | |
for (const mutation of mulist) { | |
if (mutation.type == 'childList') { | |
node = mutation.target | |
if (node.matches('#taw *, #res *, #rhs *')) { | |
unlistenClick() | |
} | |
} | |
} | |
}) | |
observer.observe(document.getElementById('rcnt'), { | |
childList: true, | |
subtree: true | |
}) | |
unlistenClick() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment