Skip to content
This repository was archived by the owner on Nov 30, 2020. It is now read-only.

Commit 2d47d73

Browse files
committed
fix breakage:
- add missing match for google.com - make window.rwt read-only to prevent the page overwriting it - build cleanup - improve documentation
1 parent 93e42b6 commit 2d47d73

File tree

11 files changed

+272
-230
lines changed

11 files changed

+272
-230
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/build/
2+
/dev/
3+
/web-ext-artifacts/

COPYRIGHT

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Avoid Google Search redirects allows you to avoid tracking by Google
2-
Search on clients side.
1+
Avoid Google Search redirects prevents Google Search tracking you with redirect
2+
links.
33

44
Copyright ⓒ 2017 Adrien Dorsaz <[email protected]>
55

Makefile

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,19 @@
1-
# This file is part of Avoid Google Search redirects.
2-
#
3-
# Copyright ⓒ 2017 Adrien Dorsaz <[email protected]>
4-
#
5-
# Avoid Google Search redirects is free software: you can redistribute it and/or modify
6-
# it under the terms of the GNU General Public License as published by
7-
# the Free Software Foundation, either version 3 of the License, or
8-
# (at your option) any later version.
9-
#
10-
# Avoid Google Search redirects is distributed in the hope that it will be useful,
11-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
13-
# GNU General Public License for more details.
14-
#
15-
# You should have received a copy of the GNU General Public License
16-
# along with Avoid Google Search redirects.If not, see <http://www.gnu.org/licenses/>.
1+
IGNORE := build dev Makefile
172

18-
PERCENT := %
3+
build: script.js
4+
web-ext build --overwrite-dest --ignore-files $(IGNORE)
195

20-
build:
21-
zip ../avoid-google-search-redirects.zip -FS -r *
6+
clean:
7+
rm -rf ./web-ext
228

23-
# Look only for country related root TLD
24-
# Suppose that the iana URL give one line by domain with something like <span class="domain tld"><a>.root</a>
25-
get-google-urls:
26-
curl --silent 'https://www.iana.org/domains/root/db' | \
27-
grep 'country-code' -B2 | \
28-
grep 'class="domain tld"' | grep '>\.\w*<\/a>' -o | sed 's/<\/a>//' | sed 's/>//' | \
29-
xargs -I '{}' /bin/bash -c "if openssl s_client -showcerts --servername www.google{} --connect www.google{}:443 </dev/null 2>&1 | grep --quiet 'depth=0 C = US, ST = California, L = Mountain View, O = Google Inc'; then curl -Ls -o /dev/null -w '$(PERCENT){url_effective}\r\n' -A 'Mozilla/5.0' 'https://www.google{}' >>extern/google.urls ; sleep 5 ; fi"
9+
rebuild: clean build
3010

31-
get-google-matches:
32-
# Exceptions are manually found by clicking on ever link in extern/google.urls
33-
egrep -v "(ai.google|google.do|google.gd|google.io|google.kr|google.ph|google.sg|google.tw)" extern/google.urls |\
34-
sed 's/^https\?/\\"*/' | sed 's/?.*$$//' | sed 's=/\s*$$=/*\\",=' | \
35-
sort -u | \
36-
xargs | sed 's/,\s*$$//' >extern/google.matches
11+
build-dir:
12+
@mkdir -p build
13+
14+
get-google-matches: build-dir
15+
curl --silent 'https://www.google.com/supported_domains' \
16+
| jq --raw-input --slurp 'split("\n") | map(select(. != "")) | map("*://www" + . + "/*")' \
17+
> ./build/google-matches.json
18+
19+
.PHONY: build

README.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
11
# Avoid Google Search redirects
22

3-
## Introduction
3+
[![Firefox Version](https://img.shields.io/amo/v/avoid-google-search-redirects.svg?style=popout&logo=mozilla%20firefox&colorB=green)](https://addons.mozilla.org/firefox/addon/avoid-google-search-redirects/)
44

5-
This add-on avoids Google Search to track you with redirect links.
5+
## Description
66

7-
When a user hovers a Google Search result, target link seems to be the right one, but, when he clicks on this link, the target is rewritten with a redirection link to a Google tracker.
8-
This tracker is then able to save your click in the Google Search engine data.
7+
This add-on prevents Google Search tracking you with redirect links. Rather
8+
than detecting and repairing the intercepted links, which can be complex and
9+
fragile, it disables the JavaScript function which Google uses to rewrite the
10+
links.
911

10-
To achieve this, Google Search uses an onmousedown event on results. This event is able to rewrite the target link by using a function called « rwt ».
11-
This add-on simply redefines this rwt function with an empty function, so nothing happens on click and user goes directly to its result.
12+
### Details
1213

13-
The original idea comes from the « Remove Google Redirect in Google Search Results » add-on.
14+
When you hover over a Google Search result, the target link seems to be the
15+
right one but when you click on this link, the target is replaced with a link
16+
to a Google tracker, which is used to record the external links you visit.
1417

15-
This add-on is packaged as WebExtension and so is compatible with recent Firefox releases and technologies.
18+
To achieve this, Google Search uses an `onmousedown` event on result links.
19+
This event rewrites the target link by using a function called `rwt`. This
20+
add-on simply replaces this `rwt` function with an empty function, so nothing
21+
happens on click and you go directly to the result.
1622

17-
## Report issue, improvements
23+
The original idea comes from the
24+
[Remove Google Redirect in Google Results](https://chrome.google.com/webstore/detail/remove-google-redirect-in/miaghkkhkjklnijffegcpjlhdjelnkke)
25+
add-on.
1826

19-
Source code can be found on Github: https://github.com/Trim/avoid-google-search-redirects
27+
This add-on is packaged as a WebExtension and so is compatible with Firefox 57+ (November 2017).
28+
29+
## Report issues, improvements
30+
31+
Source code can be found on GitHub: https://github.com/Trim/avoid-google-search-redirects
2032

2133
You can use this repository to open issues and feature requests.
34+
35+
## See Also
36+
37+
- [google-redirect-rewrite-remove](https://addons.mozilla.org/en-US/firefox/addon/google-redirect-rewrite-remove/) - uses a similar technique to this add-on, but in a less robust way
38+
- [Remove Google Redirect in Google Results](https://chrome.google.com/webstore/detail/remove-google-redirect-in/miaghkkhkjklnijffegcpjlhdjelnkke) - the original inspiration for this add-on

_locales/en/messages.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"description": "Name of the extension.",
44
"message": "Avoid Google Search redirects"
55
},
6-
6+
77
"extensionDescription": {
88
"description": "Description of the extension (less than 250 characters).",
9-
"message": "This add-on avoids Google Search to track your clicks on result links.\r\nThis principle is to disable a JavaScript code sent by Google which rewrites target links."
9+
"message": "This add-on prevents Google Search tracking you with redirect links."
1010
}
1111
}

_locales/fr/messages.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"description": "Name of the extension.",
44
"message": "Eviter les redirections Google Search"
55
},
6-
6+
77
"extensionDescription": {
88
"description": "Description of the extension (less than 250 characters).",
9-
"message": "Cette extension empêche Google Search de pister vos cliques sur les liens des résultas.\r\nLe principe est de désactiver un code JavaScript envoyé par Google qui réécrit la cible du lien."
9+
"message": "Cette extension empêche Google Search de pister vos cliques sur les liens des résultas."
1010
}
1111
}

extern/google.matches

Lines changed: 0 additions & 1 deletion
This file was deleted.

extern/google.urls

Lines changed: 0 additions & 141 deletions
This file was deleted.

0 commit comments

Comments
 (0)