-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"appDesc": { | ||
"message": "Suche anonym auf Google während du weiterhin bei Youtube, Gmail, usw. eingeloggt bleibst." | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"appDesc": { | ||
"message": "Search anonymously on Google while staying logged in on services such as Youtube, Gmail, etc." | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
"use strict"; | ||
|
||
// We can't use a content-script since URL-regexes don't allow checking for wildcard TLDs | ||
let contentPattern = /^https?:\/\/((www|encrypted)\.)?google\..*/; | ||
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { | ||
if(contentPattern.test(tab.url)) { | ||
// Remove cookie/privacy hints that would popup on every page visit otherwise | ||
chrome.tabs.insertCSS(tabId, { | ||
file: 'google.css' | ||
}); | ||
} | ||
}); | ||
|
||
// Register header event listener | ||
chrome.webRequest.onBeforeSendHeaders.addListener( | ||
onBeforeHeaders, | ||
{ | ||
urls: ['<all_urls>'] | ||
}, | ||
[ | ||
'requestHeaders', | ||
'blocking' | ||
] | ||
); | ||
|
||
// Remove cookie from headers | ||
function onBeforeHeaders(details) { | ||
// Check if Google search URL | ||
if(!isSearchUrl(details.url)) { | ||
return; | ||
} | ||
|
||
// Get Cookie | ||
var headers = details.requestHeaders; | ||
for(var i = 0; i < headers.length; i++) { | ||
if(headers[i].name == 'Cookie') { | ||
// Remove cookies | ||
headers.splice(i, 1); | ||
|
||
// Return new headers | ||
return { | ||
requestHeaders: headers | ||
}; | ||
} | ||
} | ||
} | ||
|
||
/* URLs */ | ||
// If URL considered a Google search URL | ||
function isSearchUrl(url) { | ||
// Check blacklist | ||
if(!isBlacklisted(url)) { | ||
return false; | ||
} | ||
|
||
// Check whitelist | ||
if(isWhitelisted(url)) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
// Is blacklisted URL? | ||
let urlBlacklist = [ | ||
//Google search page | ||
/^https?:\/\/((search|www|encrypted)\.)?google\.[^\/]+\/?[^\/]*$/i, | ||
|
||
//Google autocomplete | ||
/^https?:\/\/((search|www|encrypted)\.)?google\.[^\/]+\/complete\/.*$/i, | ||
]; | ||
function isBlacklisted(url) { | ||
return testRegexAry(urlBlacklist, url); | ||
} | ||
|
||
// Is whitelisted URL? | ||
let urlWhitelist = [ | ||
// Google Voice | ||
/^https?:\/\/www\.google\.[a-z]*?\/voice/i, | ||
|
||
// Google Maps | ||
/^https?:\/\/www\.google\.[a-z]*?\/maps/i, | ||
/^https?:\/\/www\.google\.[a-z]*?\/s\?tbm=map/i, | ||
]; | ||
function isWhitelisted(url) { | ||
return testRegexAry(urlWhitelist, url); | ||
} | ||
|
||
// Test regex array on given string | ||
function testRegexAry(ary, string) { | ||
for(var key in ary) { | ||
var pattern = ary[key]; | ||
if(pattern.test(string)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#epbar, | ||
#pmocntr2, | ||
#cnsh, /* Privacy hint on Google homepage */ | ||
#cnso /* Privacy hint ontop of search results */ | ||
{ | ||
display: none !important; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"manifest_version": 2, | ||
"name": "Searchonymous", | ||
"version": "1.0.5", | ||
"description": "__MSG_appDesc__", | ||
"default_locale": "en", | ||
"icons": { | ||
"128": "icon128.png" | ||
}, | ||
"permissions": [ | ||
"tabs", | ||
"webRequest", | ||
"webRequestBlocking", | ||
"<all_urls>" | ||
], | ||
"background": { | ||
"scripts": [ "background.js" ] | ||
} | ||
} |