From d215e709a55b9628f7ec4f24f9a3aed37080d98f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mauro=20Mascarenhas=20de=20Ara=C3=BAjo?= Date: Wed, 8 Feb 2017 03:07:27 -0200 Subject: [PATCH] More support | Mais suporte MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). --- manifest.json | 2 +- safeIt.js | 20 ++++++-------------- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/manifest.json b/manifest.json index 6e458b2..b8a2322 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "__MSG_extensionName__", - "version": "1.1.3", + "version": "1.1.5", "default_locale": "en_GB", diff --git a/safeIt.js b/safeIt.js index 4415e62..096fb81 100644 --- a/safeIt.js +++ b/safeIt.js @@ -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; @@ -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 @@ -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. */