-
Notifications
You must be signed in to change notification settings - Fork 0
/
GSearch Privacy Enforcer.user.js
32 lines (29 loc) · 1.11 KB
/
GSearch Privacy Enforcer.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// ==UserScript==
// @name Google Search Privacy Enforcer
// @namespace /^https?://(www|encrypted)\.google\.[a-z\.]{2,5}/search$/
// @include /^https?://(www|encrypted)\.google\.[a-z\.]{2,5}/search.*$/
// @icon https://www.google.com/favicon.ico
// @run-at document-start
// @description Enforces search privacy by removing link tracking.
// @version 1.2
// @author Martin Arndt
// @homepageURL https://github.com/Eagle3386/userscripts
// @license EUPL, Version 1.2 only
// @grant none
// ==/UserScript==
(function() {
'use strict';
document.addEventListener('readystatechange', event => {
if (event.target.readyState === "interactive") {
event.target.querySelectorAll('h3.r > a').forEach(function(link) {
for (var i = 0; i < link.attributes.length; i++) {
if (link.attributes[i].name !== "href") {
link.attributes.removeNamedItem(link.attributes[i].name);
}
}
var url = link.attributes[0].value;
link.attributes[0].value = url.slice(url.indexOf('http'), url.indexOf('&usg='));
});
}
});
})();