Last active
May 20, 2022 06:18
-
-
Save zb3/e86c90dd018a949be508d33084129a2e to your computer and use it in GitHub Desktop.
RewriteMeNot - a userscript that prevents rewriting of google search result urls, so you can copy them (doesn't really prevent tracking, better extensions exist for that purpose). This is much simpler than other scripts and works only on www.google.com.
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 RewriteMeNot | |
// @namespace zb3.rmn | |
// @include https://www.google.com/* | |
// @version 1 | |
// @run-at document-end | |
// ==/UserScript== | |
// Google can track us anyway, but rewriting search result urls so that we can't even copy them is pure assholery. | |
// Google should rewrite their behaviour, not urls. | |
function rewriteMeNot() { | |
Object.defineProperty(window, 'rwt', { | |
get: function(){ | |
return function(){}; | |
}, | |
set: function(){} | |
}); | |
} | |
function removeConsentWindow() { | |
const lbDiv = document.getElementById('lb'); | |
if (lbDiv) { | |
lbDiv.remove(); | |
} | |
document.documentElement.style.overflow = 'auto'; | |
} | |
document.addEventListener('DOMContentLoaded', removeConsentWindow); | |
const script = document.createElement('script'); | |
script.innerHTML = '(function(){'+rewriteMeNot.toString()+';rewriteMeNot();})()'; | |
document.documentElement.appendChild(script); | |
removeConsentWindow(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment