Skip to content

Commit

Permalink
More support | Mais suporte
Browse files Browse the repository at this point in the history
Now this extension supports more search engines, like DuckDuckGo and
Yandex, where Yandex is now fully supported (the user is not redirected
to Google anymore).

PT

Agora esta extensão suporta mais motores de busca como o DuckDuckGo e o
Yandex, onde o Yandex agora é completamente suportado pela extensão (o
usuário não é mais redirecionado para o Google).
  • Loading branch information
mauromascarenhas committed Feb 8, 2017
1 parent 5fdb30b commit d215e70
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "__MSG_extensionName__",
"version": "1.1.3",
"version": "1.1.5",

"default_locale": "en_GB",

Expand Down
20 changes: 6 additions & 14 deletions safeIt.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ function chooseSafe(requestDetails){
var pBing = new RegExp(".bing.");
var pYahoo = new RegExp("search.yahoo.com");
var pYandex = new RegExp("yandex.");
var pDDG = new RegExp("duckduckgo.");
var pSearch = new RegExp("/search");
var urlTemp;

Expand All @@ -43,7 +44,11 @@ function chooseSafe(requestDetails){
}
else if (pSearch.test(URL) && pYandex.test(URL)){
canReload = true;
urlTemp = changeYandex(URL);
urlTemp = safeIt(URL, 'fyandex', '1');
}
else if (pDDG.test(URL)){
canReload = true;
urlTemp = safeIt(URL, 'kp', '1');
}

// Loads a new and safe URL if necessary
Expand All @@ -54,19 +59,6 @@ function chooseSafe(requestDetails){
}
}

/*
This function just substitite Yandex by Google, once there is any known parameter
enforcing SafeSearch in Yandex (If you know one, please open a request or issue).
*/

function changeYandex(url){
let params = new URL(url).searchParams;
var parameter = params.get("text");

var newURL = "https://www.google.com/search?q=" + parameter + "&safe=active&gws_rd=cr";
return newURL;
}

/*
This function just canges or generates a safe URL if necessary.
*/
Expand Down

0 comments on commit d215e70

Please sign in to comment.