Added startpage #52
This commit is contained in:
parent
d3df133f4e
commit
519f9e9594
@ -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,
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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,32 +200,34 @@
|
||||
</form>
|
||||
<div class="checklist" id="whoogle-normal-custom-checklist"></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 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>
|
||||
|
||||
<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 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>
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
|
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user