about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/assets/javascripts/helpers/search.js20
-rw-r--r--src/pages/background/background.js2
-rw-r--r--src/pages/options/search/search.html67
-rw-r--r--src/pages/options/search/search.js12
4 files changed, 61 insertions, 40 deletions
diff --git a/src/assets/javascripts/helpers/search.js b/src/assets/javascripts/helpers/search.js
index 66d8300a..b90c201c 100644
--- a/src/assets/javascripts/helpers/search.js
+++ b/src/assets/javascripts/helpers/search.js
@@ -17,6 +17,10 @@ let redirects = {
     "normal": [],
     "tor": []
   },
+  "startpage": {
+    "normal": "https://www.startpage.com",
+    "tor": null
+  }
 };
 const getRedirects = () => redirects;
 const getCustomRedirects = () => {
@@ -154,13 +158,10 @@ function setProtocol(val) {
   console.log("searchProtocol: ", val)
 }
 
-function isSearch(url) {
-  if (disable) return false;
-  return targets.some((rx) => rx.test(url.href));
-}
-
 function redirect(url) {
-  console.log(url.href);
+  if (disable) return;
+  if (!targets.some((rx) => rx.test(url.href))) return;
+
   let randomInstance;
   let path;
   if (frontend == 'searx') {
@@ -171,7 +172,7 @@ function redirect(url) {
     randomInstance = commonHelper.getRandomInstance(instancesList)
     path = "/";
   }
-  if (frontend == 'whoogle') {
+  else if (frontend == 'whoogle') {
     let instancesList
     if (protocol == 'normal') instancesList = [...whoogleNormalRedirectsChecks, ...whoogleNormalCustomRedirects];
     if (protocol == 'tor') instancesList = [...whoogleTorRedirectsChecks, ...whoogleTorCustomRedirects];
@@ -179,6 +180,10 @@ function redirect(url) {
     randomInstance = commonHelper.getRandomInstance(instancesList)
     path = "/search";
   }
+  else if (frontend == 'startpage') {
+    randomInstance = redirects.startpage.normal;
+    path = "/do/search";
+  }
 
   let searchQuery = "";
   url.search.slice(1).split("&").forEach((input) => {
@@ -282,7 +287,6 @@ async function init() {
 }
 
 export default {
-  isSearch,
 
   getDisable,
   setDisable,
diff --git a/src/pages/background/background.js b/src/pages/background/background.js
index 6b41b347..d019fa28 100644
--- a/src/pages/background/background.js
+++ b/src/pages/background/background.js
@@ -76,7 +76,7 @@ browser.webRequest.onBeforeRequest.addListener(
 
     if (translateHelper.isTranslate(url, initiator)) newUrl = translateHelper.redirect(url);
 
-    if (searchHelper.isSearch(url)) newUrl = searchHelper.redirect(url)
+    if (!newUrl) newUrl = searchHelper.redirect(url)
 
     if (wikipediaHelper.isWikipedia(url, initiator)) newUrl = wikipediaHelper.redirect(url);
 
diff --git a/src/pages/options/search/search.html b/src/pages/options/search/search.html
index 1349445a..5db6d2ab 100644
--- a/src/pages/options/search/search.html
+++ b/src/pages/options/search/search.html
@@ -103,22 +103,25 @@
       <input id="disable-search" type="checkbox" checked />
     </div>
     <div class="some-block option-block">
-      <h4>Frontend</h4>
+      <h4 id="frontend">Frontend</h4>
       <select id="search-frontend">
         <option value="searx">SearX</option>
         <option value="whoogle">Whoogle</option>
+        <option value="startpage">Startpage</option>
       </select>
     </div>
 
-    <div class="some-block option-block">
-      <h4>Protocol</h4>
-      <select id="protocol">
-        <option value="normal">Normal</option>
-        <option value="tor">Tor</option>
-      </select>
-    </div>
+    <div id="searx-whoogle">
+      <div class="some-block option-block">
+        <h4>Protocol</h4>
+        <select id="protocol">
+          <option value="normal">Normal</option>
+          <option value="tor">Tor</option>
+        </select>
+      </div>
 
-    <hr>
+      <hr>
+    </div>
 
     <div id="searx">
       <div id="searx-normal">
@@ -197,33 +200,35 @@
         </form>
         <div class="checklist" id="whoogle-normal-custom-checklist"></div>
       </div>
-    </div>
-
-    <div id="whoogle-tor">
-      <div class="some-block option-block">
-        <h4>Default Instances</h4>
-      </div>
-      <div class="checklist" id="whoogle-tor-checklist">
-      </div>
-      <hr>
-      <div class="some-block option-block">
-        <h4>Custom Instances</h4>
-      </div>
-      <form id="custom-whoogle-tor-instance-form">
+      <div id="whoogle-tor">
         <div class="some-block option-block">
-          <input id="whoogle-tor-custom-instance" placeholder="https://whoogle.com" type="url" />
-          <button type="submit" class="add" id="whoogle-tor-add-instance">
-            <svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px" fill="currentColor">
-              <path d="M0 0h24v24H0V0z" fill="none" />
-              <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
-            </svg>
-          </button>
+          <h4>Default Instances</h4>
+        </div>
+        <div class="checklist" id="whoogle-tor-checklist">
         </div>
-      </form>
-      <div class="checklist" id="whoogle-tor-custom-checklist"></div>
+        <hr>
+        <div class="some-block option-block">
+          <h4>Custom Instances</h4>
+        </div>
+        <form id="custom-whoogle-tor-instance-form">
+          <div class="some-block option-block">
+            <input id="whoogle-tor-custom-instance" placeholder="https://whoogle.com" type="url" />
+            <button type="submit" class="add" id="whoogle-tor-add-instance">
+              <svg xmlns="http://www.w3.org/2000/svg" height="20px" viewBox="0 0 24 24" width="20px"
+                fill="currentColor">
+                <path d="M0 0h24v24H0V0z" fill="none" />
+                <path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
+              </svg>
+            </button>
+          </div>
+        </form>
+        <div class="checklist" id="whoogle-tor-custom-checklist"></div>
+      </div>
     </div>
     </div>
 
+
+
   </section>
 
 
diff --git a/src/pages/options/search/search.js b/src/pages/options/search/search.js
index e4ce9d6f..57024221 100644
--- a/src/pages/options/search/search.js
+++ b/src/pages/options/search/search.js
@@ -12,13 +12,25 @@ let whoogleDivElement = document.getElementById("whoogle")
 
 
 function changeFrontendsSettings(frontend) {
+  let SearxWhoogleElement = document.getElementById("searx-whoogle");
+  let frontendElement = document.getElementById("frontend");
   if (frontend == 'searx') {
+    frontendElement.innerHTML = 'Frontend';
     searxDivElement.style.display = 'block';
     whoogleDivElement.style.display = 'none';
+    SearxWhoogleElement.style.display = 'block';
   }
   else if (frontend == 'whoogle') {
+    frontendElement.innerHTML = 'Frontend';
     searxDivElement.style.display = 'none';
     whoogleDivElement.style.display = 'block';
+    SearxWhoogleElement.style.display = 'block';
+  }
+  else if (frontend == 'startpage') {
+    frontendElement.innerHTML = `Frontend: <span style="color:red;">This is a centralized service</span>`;
+    searxDivElement.style.display = 'none';
+    whoogleDivElement.style.display = 'none';
+    SearxWhoogleElement.style.display = 'none';
   }
 }
 let searchFrontendElement = document.getElementById("search-frontend");