Seperated SearX and SearXNG in code #120
This commit is contained in:
parent
8a9bdc3d1d
commit
d731d94a2d
|
@ -48,6 +48,7 @@ async function updateInstances() {
|
||||||
translateHelper.setLingvaRedirects(instances.lingva)
|
translateHelper.setLingvaRedirects(instances.lingva)
|
||||||
|
|
||||||
searchHelper.setSearxRedirects(instances.searx);
|
searchHelper.setSearxRedirects(instances.searx);
|
||||||
|
searchHelper.setSearxngRedirects(instances.searxng);
|
||||||
searchHelper.setWhoogleRedirects(instances.whoogle);
|
searchHelper.setWhoogleRedirects(instances.whoogle);
|
||||||
|
|
||||||
wikipediaHelper.setRedirects(instances.wikiless);
|
wikipediaHelper.setRedirects(instances.wikiless);
|
||||||
|
|
|
@ -13,6 +13,11 @@ let redirects = {
|
||||||
"tor": [],
|
"tor": [],
|
||||||
"i2p": []
|
"i2p": []
|
||||||
},
|
},
|
||||||
|
"searxng": {
|
||||||
|
"normal": [],
|
||||||
|
"tor": [],
|
||||||
|
"i2p": []
|
||||||
|
},
|
||||||
"whoogle": {
|
"whoogle": {
|
||||||
"normal": [],
|
"normal": [],
|
||||||
"tor": []
|
"tor": []
|
||||||
|
@ -29,6 +34,10 @@ const getCustomRedirects = () => {
|
||||||
"normal": [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects],
|
"normal": [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects],
|
||||||
"tor": [...searxTorRedirectsChecks, ...searxTorCustomRedirects],
|
"tor": [...searxTorRedirectsChecks, ...searxTorCustomRedirects],
|
||||||
},
|
},
|
||||||
|
"searxng": {
|
||||||
|
"normal": [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects],
|
||||||
|
"tor": [...searxngTorRedirectsChecks, ...searxngTorCustomRedirects],
|
||||||
|
},
|
||||||
"whoogle": {
|
"whoogle": {
|
||||||
"normal": [...whoogleNormalRedirectsChecks, ...whoogleNormalCustomRedirects],
|
"normal": [...whoogleNormalRedirectsChecks, ...whoogleNormalCustomRedirects],
|
||||||
"normal": [...whoogleTorRedirectsChecks, ...whoogleTorCustomRedirects]
|
"normal": [...whoogleTorRedirectsChecks, ...whoogleTorCustomRedirects]
|
||||||
|
@ -53,6 +62,23 @@ function setSearxRedirects(val) {
|
||||||
setSearxTorRedirectsChecks(searxTorRedirectsChecks);
|
setSearxTorRedirectsChecks(searxTorRedirectsChecks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setSearxngRedirects(val) {
|
||||||
|
redirects.searxng = val;
|
||||||
|
browser.storage.local.set({ searchRedirects: redirects })
|
||||||
|
console.log("searxngRedirects:", val)
|
||||||
|
for (const item of searxngNormalRedirectsChecks) if (!redirects.searxng.normal.includes(item)) {
|
||||||
|
var index = searxngNormalRedirectsChecks.indexOf(item);
|
||||||
|
if (index !== -1) searxngNormalRedirectsChecks.splice(index, 1);
|
||||||
|
}
|
||||||
|
setSearxngNormalRedirectsChecks(searxngNormalRedirectsChecks);
|
||||||
|
|
||||||
|
for (const item of searxngTorRedirectsChecks) if (!redirects.searxng.tor.includes(item)) {
|
||||||
|
var index = searxngTorRedirectsChecks.indexOf(item);
|
||||||
|
if (index !== -1) searxngTorRedirectsChecks.splice(index, 1);
|
||||||
|
}
|
||||||
|
setSearxngTorRedirectsChecks(searxngTorRedirectsChecks);
|
||||||
|
}
|
||||||
|
|
||||||
function setWhoogleRedirects(val) {
|
function setWhoogleRedirects(val) {
|
||||||
redirects.whoogle = val;
|
redirects.whoogle = val;
|
||||||
browser.storage.local.set({ searchRedirects: redirects })
|
browser.storage.local.set({ searchRedirects: redirects })
|
||||||
|
@ -134,6 +160,38 @@ function setSearxTorCustomRedirects(val) {
|
||||||
console.log("searxTorCustomRedirects: ", val)
|
console.log("searxTorCustomRedirects: ", val)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let searxngNormalRedirectsChecks;
|
||||||
|
const getSearxngNormalRedirectsChecks = () => searxngNormalRedirectsChecks;
|
||||||
|
function setSearxngNormalRedirectsChecks(val) {
|
||||||
|
searxngNormalRedirectsChecks = val;
|
||||||
|
browser.storage.local.set({ searxngNormalRedirectsChecks })
|
||||||
|
console.log("searxngNormalRedirectsChecks: ", val)
|
||||||
|
}
|
||||||
|
|
||||||
|
let searxngTorRedirectsChecks;
|
||||||
|
const getSearxngTorRedirectsChecks = () => searxngTorRedirectsChecks;
|
||||||
|
function setSearxngTorRedirectsChecks(val) {
|
||||||
|
searxngTorRedirectsChecks = val;
|
||||||
|
browser.storage.local.set({ searxngTorRedirectsChecks })
|
||||||
|
console.log("searxngTorRedirectsChecks: ", val)
|
||||||
|
}
|
||||||
|
|
||||||
|
let searxngNormalCustomRedirects = [];
|
||||||
|
const getSearxngNormalCustomRedirects = () => searxngNormalCustomRedirects;
|
||||||
|
function setSearxngNormalCustomRedirects(val) {
|
||||||
|
searxngNormalCustomRedirects = val;
|
||||||
|
browser.storage.local.set({ searxngNormalCustomRedirects })
|
||||||
|
console.log("searxngNormalCustomRedirects: ", val)
|
||||||
|
}
|
||||||
|
|
||||||
|
let searxngTorCustomRedirects = [];
|
||||||
|
const getSearxngTorCustomRedirects = () => searxngTorCustomRedirects;
|
||||||
|
function setSearxngTorCustomRedirects(val) {
|
||||||
|
searxngTorCustomRedirects = val;
|
||||||
|
browser.storage.local.set({ searxngTorCustomRedirects })
|
||||||
|
console.log("searxngTorCustomRedirects: ", val)
|
||||||
|
}
|
||||||
|
|
||||||
let disable;
|
let disable;
|
||||||
const getDisable = () => disable;
|
const getDisable = () => disable;
|
||||||
function setDisable(val) {
|
function setDisable(val) {
|
||||||
|
@ -193,6 +251,39 @@ function initSearxCookies() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function initSearxngCookies() {
|
||||||
|
let themeValue;
|
||||||
|
if (theme == 'light') themeValue = 'logicodev';
|
||||||
|
if (theme == 'dark') themeValue = 'logicodev-dark';
|
||||||
|
if (applyThemeToSites && themeValue) {
|
||||||
|
let allInstances = [...redirects.searxng.normal, ...redirects.searxng.tor, ...searxngNormalCustomRedirects, ...searxngTorCustomRedirects]
|
||||||
|
let checkedInstances = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects, ...searxngTorRedirectsChecks, ...searxngTorCustomRedirects]
|
||||||
|
for (const instanceUrl of allInstances)
|
||||||
|
if (!checkedInstances.includes(instanceUrl)) {
|
||||||
|
browser.cookies.remove({
|
||||||
|
url: instanceUrl,
|
||||||
|
name: "oscar-style",
|
||||||
|
})
|
||||||
|
browser.cookies.remove({
|
||||||
|
url: instanceUrl,
|
||||||
|
name: "oscar",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
for (const instanceUrl of checkedInstances) {
|
||||||
|
browser.cookies.set({
|
||||||
|
url: instanceUrl,
|
||||||
|
name: "oscar-style",
|
||||||
|
value: themeValue
|
||||||
|
})
|
||||||
|
browser.cookies.set({
|
||||||
|
url: instanceUrl,
|
||||||
|
name: "theme",
|
||||||
|
value: 'oscar'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function initWhoogleCookies() {
|
function initWhoogleCookies() {
|
||||||
let checkedInstances = [...whoogleNormalRedirectsChecks, ...whoogleNormalCustomRedirects, ...whoogleTorRedirectsChecks, ...whoogleTorCustomRedirects]
|
let checkedInstances = [...whoogleNormalRedirectsChecks, ...whoogleNormalCustomRedirects, ...whoogleTorRedirectsChecks, ...whoogleTorCustomRedirects]
|
||||||
|
|
||||||
|
@ -249,6 +340,14 @@ function redirect(url) {
|
||||||
randomInstance = commonHelper.getRandomInstance(instancesList)
|
randomInstance = commonHelper.getRandomInstance(instancesList)
|
||||||
path = "/";
|
path = "/";
|
||||||
}
|
}
|
||||||
|
else if (frontend == 'searxng') {
|
||||||
|
let instancesList;
|
||||||
|
if (protocol == 'normal') instancesList = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...searxngTorRedirectsChecks, ...searxngTorCustomRedirects];
|
||||||
|
if (instancesList.length === 0) return null;
|
||||||
|
randomInstance = commonHelper.getRandomInstance(instancesList)
|
||||||
|
path = "/";
|
||||||
|
}
|
||||||
else if (frontend == 'whoogle') {
|
else if (frontend == 'whoogle') {
|
||||||
let instancesList
|
let instancesList
|
||||||
if (protocol == 'normal') instancesList = [...whoogleNormalRedirectsChecks, ...whoogleNormalCustomRedirects];
|
if (protocol == 'normal') instancesList = [...whoogleNormalRedirectsChecks, ...whoogleNormalCustomRedirects];
|
||||||
|
@ -279,6 +378,12 @@ function switchInstance(url) {
|
||||||
...searxNormalCustomRedirects,
|
...searxNormalCustomRedirects,
|
||||||
...searxTorCustomRedirects,
|
...searxTorCustomRedirects,
|
||||||
|
|
||||||
|
...redirects.searx.normal,
|
||||||
|
...redirects.searxng.tor,
|
||||||
|
|
||||||
|
...searxngNormalCustomRedirects,
|
||||||
|
...searxngTorCustomRedirects,
|
||||||
|
|
||||||
...redirects.whoogle.normal,
|
...redirects.whoogle.normal,
|
||||||
...redirects.whoogle.tor,
|
...redirects.whoogle.tor,
|
||||||
|
|
||||||
|
@ -293,6 +398,10 @@ function switchInstance(url) {
|
||||||
if (protocol == 'normal') instancesList = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects];
|
if (protocol == 'normal') instancesList = [...searxNormalRedirectsChecks, ...searxNormalCustomRedirects];
|
||||||
else if (protocol == 'tor') instancesList = [...searxTorRedirectsChecks, ...searxTorCustomRedirects];
|
else if (protocol == 'tor') instancesList = [...searxTorRedirectsChecks, ...searxTorCustomRedirects];
|
||||||
}
|
}
|
||||||
|
else if (frontend == 'searxng') {
|
||||||
|
if (protocol == 'normal') instancesList = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects];
|
||||||
|
else if (protocol == 'tor') instancesList = [...searxngTorRedirectsChecks, ...searxngTorCustomRedirects];
|
||||||
|
}
|
||||||
else if (frontend == 'whoogle') {
|
else if (frontend == 'whoogle') {
|
||||||
if (protocol == 'normal') instancesList = [...whoogleNormalRedirectsChecks, ...whoogleNormalCustomRedirects];
|
if (protocol == 'normal') instancesList = [...whoogleNormalRedirectsChecks, ...whoogleNormalCustomRedirects];
|
||||||
else if (protocol == 'tor') instancesList = [...whoogleTorRedirectsChecks, ...whoogleTorCustomRedirects];
|
else if (protocol == 'tor') instancesList = [...whoogleTorRedirectsChecks, ...whoogleTorCustomRedirects];
|
||||||
|
@ -330,6 +439,12 @@ async function init() {
|
||||||
"searxTorRedirectsChecks",
|
"searxTorRedirectsChecks",
|
||||||
"searxTorCustomRedirects",
|
"searxTorCustomRedirects",
|
||||||
|
|
||||||
|
"searxngNormalRedirectsChecks",
|
||||||
|
"searxngNormalCustomRedirects",
|
||||||
|
|
||||||
|
"searxngTorRedirectsChecks",
|
||||||
|
"searxngTorCustomRedirects",
|
||||||
|
|
||||||
"theme",
|
"theme",
|
||||||
"applyThemeToSites",
|
"applyThemeToSites",
|
||||||
|
|
||||||
|
@ -346,6 +461,7 @@ async function init() {
|
||||||
applyThemeToSites = r.applyThemeToSites ?? false;
|
applyThemeToSites = r.applyThemeToSites ?? false;
|
||||||
|
|
||||||
redirects.searx = dataJson.searx;
|
redirects.searx = dataJson.searx;
|
||||||
|
redirects.searxng = dataJson.searxng;
|
||||||
redirects.whoogle = dataJson.whoogle;
|
redirects.whoogle = dataJson.whoogle;
|
||||||
if (r.searchRedirects) redirects = r.searchRedirects;
|
if (r.searchRedirects) redirects = r.searchRedirects;
|
||||||
|
|
||||||
|
@ -361,7 +477,14 @@ async function init() {
|
||||||
searxTorRedirectsChecks = r.searxTorRedirectsChecks ?? [...redirects.searx.tor];
|
searxTorRedirectsChecks = r.searxTorRedirectsChecks ?? [...redirects.searx.tor];
|
||||||
searxTorCustomRedirects = r.searxTorCustomRedirects ?? [];
|
searxTorCustomRedirects = r.searxTorCustomRedirects ?? [];
|
||||||
|
|
||||||
|
searxngNormalRedirectsChecks = r.searxngNormalRedirectsChecks ?? [...redirects.searxng.normal];
|
||||||
|
searxngNormalCustomRedirects = r.searxngNormalCustomRedirects ?? [];
|
||||||
|
|
||||||
|
searxngTorRedirectsChecks = r.searxngTorRedirectsChecks ?? [...redirects.searxng.tor];
|
||||||
|
searxngTorCustomRedirects = r.searxngTorCustomRedirects ?? [];
|
||||||
|
|
||||||
initSearxCookies()
|
initSearxCookies()
|
||||||
|
initSearxngCookies()
|
||||||
// initWhoogleCookies()
|
// initWhoogleCookies()
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
|
@ -378,7 +501,9 @@ export default {
|
||||||
|
|
||||||
getRedirects,
|
getRedirects,
|
||||||
getCustomRedirects,
|
getCustomRedirects,
|
||||||
|
|
||||||
setSearxRedirects,
|
setSearxRedirects,
|
||||||
|
setSearxngRedirects,
|
||||||
setWhoogleRedirects,
|
setWhoogleRedirects,
|
||||||
|
|
||||||
getFrontend,
|
getFrontend,
|
||||||
|
@ -404,6 +529,16 @@ export default {
|
||||||
getSearxTorCustomRedirects,
|
getSearxTorCustomRedirects,
|
||||||
setSearxTorCustomRedirects,
|
setSearxTorCustomRedirects,
|
||||||
|
|
||||||
|
getSearxngNormalRedirectsChecks,
|
||||||
|
setSearxngNormalRedirectsChecks,
|
||||||
|
getSearxngNormalCustomRedirects,
|
||||||
|
setSearxngNormalCustomRedirects,
|
||||||
|
|
||||||
|
getSearxngTorRedirectsChecks,
|
||||||
|
setSearxngTorRedirectsChecks,
|
||||||
|
getSearxngTorCustomRedirects,
|
||||||
|
setSearxngTorCustomRedirects,
|
||||||
|
|
||||||
getProtocol,
|
getProtocol,
|
||||||
setProtocol,
|
setProtocol,
|
||||||
|
|
||||||
|
|
|
@ -138,6 +138,7 @@
|
||||||
<h4 id="frontend" data-localise="__MSG_frontend__">Frontend</h4>
|
<h4 id="frontend" data-localise="__MSG_frontend__">Frontend</h4>
|
||||||
<select id="search-frontend">
|
<select id="search-frontend">
|
||||||
<option value="searx">SearX</option>
|
<option value="searx">SearX</option>
|
||||||
|
<option value="searxng">SearXNG</option>
|
||||||
<option value="whoogle">Whoogle</option>
|
<option value="whoogle">Whoogle</option>
|
||||||
<option value="startpage">Startpage</option>
|
<option value="startpage">Startpage</option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -211,6 +212,58 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="searxng">
|
||||||
|
<hr>
|
||||||
|
<div id="searxng-normal">
|
||||||
|
<div class="some-block option-block">
|
||||||
|
<h4 data-localise="__MSG_defaultInstances__">Default Instances</h4>
|
||||||
|
</div>
|
||||||
|
<div class="checklist" id="searxng-normal-checklist">
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="some-block option-block">
|
||||||
|
<h4 data-localise="__MSG_customInstances__">Custom Instances</h4>
|
||||||
|
</div>
|
||||||
|
<form id="custom-searxng-normal-instance-form">
|
||||||
|
<div class="some-block option-block">
|
||||||
|
<input id="searxng-normal-custom-instance" placeholder="https://searxng.com" type="url" />
|
||||||
|
<button type="submit" class="add" id="searxng-normal-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="searxng-normal-custom-checklist"></div>
|
||||||
|
</div>
|
||||||
|
<div id="searxng-tor">
|
||||||
|
<div class="some-block option-block">
|
||||||
|
<h4 data-localise="__MSG_defaultInstances__">Default Instances</h4>
|
||||||
|
</div>
|
||||||
|
<div class="checklist" id="searxng-tor-checklist">
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
|
<div class="some-block option-block">
|
||||||
|
<h4 data-localise="__MSG_customInstances__">Custom Instances</h4>
|
||||||
|
</div>
|
||||||
|
<form id="custom-searxng-tor-instance-form">
|
||||||
|
<div class="some-block option-block">
|
||||||
|
<input id="searxng-tor-custom-instance" placeholder="https://searxng.com" type="url" />
|
||||||
|
<button type="submit" class="add" id="searxng-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="searxng-tor-custom-checklist"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="whoogle">
|
<div id="whoogle">
|
||||||
<hr>
|
<hr>
|
||||||
<div id="whoogle-normal">
|
<div id="whoogle-normal">
|
||||||
|
@ -264,8 +317,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,12 @@ import searchHelper from "../../../assets/javascripts/helpers/search.js";
|
||||||
import commonHelper from "../../../assets/javascripts/helpers/common.js";
|
import commonHelper from "../../../assets/javascripts/helpers/common.js";
|
||||||
|
|
||||||
let disableSearchElement = document.getElementById("disable-search");
|
let disableSearchElement = document.getElementById("disable-search");
|
||||||
disableSearchElement.addEventListener("change",
|
disableSearchElement.addEventListener("change", event => searchHelper.setDisable(!event.target.checked));
|
||||||
(event) => searchHelper.setDisable(!event.target.checked)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
let searxDivElement = document.getElementById("searx")
|
let searxDivElement = document.getElementById("searx");
|
||||||
let whoogleDivElement = document.getElementById("whoogle")
|
let searxngDivElement = document.getElementById("searxng")
|
||||||
|
let whoogleDivElement = document.getElementById("whoogle");
|
||||||
|
|
||||||
|
|
||||||
function changeFrontendsSettings(frontend) {
|
function changeFrontendsSettings(frontend) {
|
||||||
|
@ -17,25 +16,35 @@ function changeFrontendsSettings(frontend) {
|
||||||
if (frontend == 'searx') {
|
if (frontend == 'searx') {
|
||||||
frontendElement.innerHTML = 'Frontend';
|
frontendElement.innerHTML = 'Frontend';
|
||||||
searxDivElement.style.display = 'block';
|
searxDivElement.style.display = 'block';
|
||||||
|
searxngDivElement.style.display = 'none';
|
||||||
|
whoogleDivElement.style.display = 'none';
|
||||||
|
SearxWhoogleElement.style.display = 'block';
|
||||||
|
}
|
||||||
|
else if (frontend == 'searxng') {
|
||||||
|
frontendElement.innerHTML = 'Frontend';
|
||||||
|
searxDivElement.style.display = 'none';
|
||||||
|
searxngDivElement.style.display = 'block';
|
||||||
whoogleDivElement.style.display = 'none';
|
whoogleDivElement.style.display = 'none';
|
||||||
SearxWhoogleElement.style.display = 'block';
|
SearxWhoogleElement.style.display = 'block';
|
||||||
}
|
}
|
||||||
else if (frontend == 'whoogle') {
|
else if (frontend == 'whoogle') {
|
||||||
frontendElement.innerHTML = 'Frontend';
|
frontendElement.innerHTML = 'Frontend';
|
||||||
searxDivElement.style.display = 'none';
|
searxDivElement.style.display = 'none';
|
||||||
|
searxngDivElement.style.display = 'none';
|
||||||
whoogleDivElement.style.display = 'block';
|
whoogleDivElement.style.display = 'block';
|
||||||
SearxWhoogleElement.style.display = 'block';
|
SearxWhoogleElement.style.display = 'block';
|
||||||
}
|
}
|
||||||
else if (frontend == 'startpage') {
|
else if (frontend == 'startpage') {
|
||||||
frontendElement.innerHTML = `Frontend: <span style="color:red;">This is a centralized service</span>`;
|
frontendElement.innerHTML = `Frontend: <span style="color:red;">This is a centralized service</span>`;
|
||||||
searxDivElement.style.display = 'none';
|
searxDivElement.style.display = 'none';
|
||||||
|
searxngDivElement.style.display = 'none';
|
||||||
whoogleDivElement.style.display = 'none';
|
whoogleDivElement.style.display = 'none';
|
||||||
SearxWhoogleElement.style.display = 'none';
|
SearxWhoogleElement.style.display = 'none';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let searchFrontendElement = document.getElementById("search-frontend");
|
let searchFrontendElement = document.getElementById("search-frontend");
|
||||||
searchFrontendElement.addEventListener("change",
|
searchFrontendElement.addEventListener("change",
|
||||||
(event) => {
|
event => {
|
||||||
let frontend = event.target.options[searchFrontendElement.selectedIndex].value
|
let frontend = event.target.options[searchFrontendElement.selectedIndex].value
|
||||||
searchHelper.setFrontend(frontend)
|
searchHelper.setFrontend(frontend)
|
||||||
changeFrontendsSettings(frontend);
|
changeFrontendsSettings(frontend);
|
||||||
|
@ -44,7 +53,7 @@ searchFrontendElement.addEventListener("change",
|
||||||
|
|
||||||
let protocolElement = document.getElementById("protocol")
|
let protocolElement = document.getElementById("protocol")
|
||||||
protocolElement.addEventListener("change",
|
protocolElement.addEventListener("change",
|
||||||
(event) => {
|
event => {
|
||||||
let protocol = event.target.options[protocolElement.selectedIndex].value
|
let protocol = event.target.options[protocolElement.selectedIndex].value
|
||||||
searchHelper.setProtocol(protocol);
|
searchHelper.setProtocol(protocol);
|
||||||
changeProtocolSettings(protocol);
|
changeProtocolSettings(protocol);
|
||||||
|
@ -55,19 +64,26 @@ function changeProtocolSettings(protocol) {
|
||||||
let normalsearxDiv = document.getElementById("searx-normal");
|
let normalsearxDiv = document.getElementById("searx-normal");
|
||||||
let torsearxDiv = document.getElementById("searx-tor");
|
let torsearxDiv = document.getElementById("searx-tor");
|
||||||
|
|
||||||
|
let normalsearxngDiv = document.getElementById("searxng-normal");
|
||||||
|
let torsearxngDiv = document.getElementById("searxng-tor");
|
||||||
|
|
||||||
let normalwhoogleDiv = document.getElementById("whoogle-normal");
|
let normalwhoogleDiv = document.getElementById("whoogle-normal");
|
||||||
let torwhoogleDiv = document.getElementById("whoogle-tor");
|
let torwhoogleDiv = document.getElementById("whoogle-tor");
|
||||||
if (protocol == 'normal') {
|
if (protocol == 'normal') {
|
||||||
normalsearxDiv.style.display = 'block';
|
normalsearxDiv.style.display = 'block';
|
||||||
|
normalsearxngDiv.style.display = 'block';
|
||||||
normalwhoogleDiv.style.display = 'block';
|
normalwhoogleDiv.style.display = 'block';
|
||||||
torwhoogleDiv.style.display = 'none';
|
|
||||||
torsearxDiv.style.display = 'none';
|
torsearxDiv.style.display = 'none';
|
||||||
|
torsearxngDiv.style.display = 'none';
|
||||||
|
torwhoogleDiv.style.display = 'none';
|
||||||
}
|
}
|
||||||
else if (protocol == 'tor') {
|
else if (protocol == 'tor') {
|
||||||
normalsearxDiv.style.display = 'none';
|
normalsearxDiv.style.display = 'none';
|
||||||
|
normalsearxngDiv.style.display = 'none';
|
||||||
normalwhoogleDiv.style.display = 'none';
|
normalwhoogleDiv.style.display = 'none';
|
||||||
torwhoogleDiv.style.display = 'block';
|
|
||||||
torsearxDiv.style.display = 'block';
|
torsearxDiv.style.display = 'block';
|
||||||
|
torsearxngDiv.style.display = 'block';
|
||||||
|
torwhoogleDiv.style.display = 'block';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,6 +119,28 @@ searchHelper.init().then(() => {
|
||||||
searchHelper.setSearxTorCustomRedirects
|
searchHelper.setSearxTorCustomRedirects
|
||||||
);
|
);
|
||||||
|
|
||||||
|
commonHelper.processDefaultCustomInstances(
|
||||||
|
'searxng',
|
||||||
|
'normal',
|
||||||
|
searchHelper,
|
||||||
|
document,
|
||||||
|
searchHelper.getSearxngNormalRedirectsChecks,
|
||||||
|
searchHelper.setSearxngNormalRedirectsChecks,
|
||||||
|
searchHelper.getSearxngNormalCustomRedirects,
|
||||||
|
searchHelper.setSearxngNormalCustomRedirects
|
||||||
|
);
|
||||||
|
|
||||||
|
commonHelper.processDefaultCustomInstances(
|
||||||
|
'searxng',
|
||||||
|
'tor',
|
||||||
|
searchHelper,
|
||||||
|
document,
|
||||||
|
searchHelper.getSearxngTorRedirectsChecks,
|
||||||
|
searchHelper.setSearxngTorRedirectsChecks,
|
||||||
|
searchHelper.getSearxngTorCustomRedirects,
|
||||||
|
searchHelper.setSearxngTorCustomRedirects
|
||||||
|
);
|
||||||
|
|
||||||
commonHelper.processDefaultCustomInstances(
|
commonHelper.processDefaultCustomInstances(
|
||||||
'whoogle',
|
'whoogle',
|
||||||
'normal',
|
'normal',
|
||||||
|
|
Loading…
Reference in New Issue