aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pug/options/search/search.pug333
-rw-r--r--pug/options/youtube/youtube.pug11
-rw-r--r--src/assets/javascripts/helpers/search.js147
-rw-r--r--src/pages/options/search/search.html8
-rw-r--r--src/pages/options/search/search.js63
5 files changed, 542 insertions, 20 deletions
diff --git a/pug/options/search/search.pug b/pug/options/search/search.pug
index 3bdc6d7e..78825611 100644
--- a/pug/options/search/search.pug
+++ b/pug/options/search/search.pug
@@ -46,7 +46,340 @@ body.option(dir="auto")
+instances('https://searx.i2p')
#searxng
+ .some-block.option-block
+ h4(data-localise="__MSG_enableCustomSettings__") Enable Custom Settings (will use cookies)
+ input#enable-searxng-custom-settings(type="checkbox")
hr
+ .custom-settings
+ .some-block.option-block
+ h2 General
+
+ .some-block.option-block
+ h4(data-localise="") Default categories
+
+ .checklist-popup
+ div
+ div
+ svg(viewBox="0 0 512 512" aria-hidden="true")
+ path(d="M221.09 64a157.09 157.09 0 10157.09 157.09A157.1 157.1 0 00221.09 64z" fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="32")
+ path(fill="none" stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="32" d="M338.29 338.29L448 448")
+ |General
+ input.category_general(type="checkbox")
+
+ div
+ div
+ svg(viewBox="0 0 512 512" aria-hidden="true")
+ rect(x="48" y="80" width="416" height="352" rx="48" ry="48" fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="32")
+ circle(cx="336" cy="176" r="32" fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="32")
+ path(d="M304 335.79l-90.66-90.49a32 32 0 00-43.87-1.3L48 352M224 432l123.34-123.34a32 32 0 0143.11-2L464 368" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32")
+ |Images
+
+ input.category_images(type="checkbox")
+
+ div
+ div
+ svg(viewBox="0 0 512 512" aria-hidden="true")
+ path(d="M112 111v290c0 17.44 17 28.52 31 20.16l247.9-148.37c12.12-7.25 12.12-26.33 0-33.58L143 90.84c-14-8.36-31 2.72-31 20.16z" fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="32")
+ |Videos
+ input.category_videos(type="checkbox")
+
+ div
+ div
+ svg(viewBox="0 0 512 512" aria-hidden="true")
+ path(d="M368 415.86V72a24.07 24.07 0 00-24-24H72a24.07 24.07 0 00-24 24v352a40.12 40.12 0 0040 40h328" fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="32")
+ path(d="M416 464h0a48 48 0 01-48-48V128h72a24 24 0 0124 24v264a48 48 0 01-48 48z" fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="32")
+ path(fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M240 128h64M240 192h64M112 256h192M112 320h192M112 384h192")
+ path(d="M176 208h-64a16 16 0 01-16-16v-64a16 16 0 0116-16h64a16 16 0 0116 16v64a16 16 0 01-16 16z")
+ |News
+ input.category_news(type="checkbox")
+
+ div
+ div
+ svg(viewBox="0 0 512 512" aria-hidden="true")
+ path(d="M256 48c-79.5 0-144 61.39-144 137 0 87 96 224.87 131.25 272.49a15.77 15.77 0 0025.5 0C304 409.89 400 272.07 400 185c0-75.61-64.5-137-144-137z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32")
+ circle(cx="256" cy="192" r="48" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32")
+ |Maps
+ input.category_map(type="checkbox")
+
+ div
+ div
+ svg(viewBox="0 0 512 512" aria-hidden="true")
+ path(d="M192 218v-6c0-14.84 10-27 24.24-30.59l174.59-46.68A20 20 0 01416 154v22" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32")
+ path(d="M416 295.94v80c0 13.91-8.93 25.59-22 30l-22 8c-25.9 8.72-52-10.42-52-38h0a33.37 33.37 0 0123-32l51-18.15c13.07-4.4 22-15.94 22-29.85V58a10 10 0 00-12.6-9.61L204 102a16.48 16.48 0 00-12 16v226c0 13.91-8.93 25.6-22 30l-52 18c-13.88 4.68-22 17.22-22 32h0c0 27.58 26.52 46.55 52 38l22-8c13.07-4.4 22-16.08 22-30v-80" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32")
+ |Music
+ input.category_music(type="checkbox")
+
+ div
+ div
+ svg(class="ion-icon-big" viewBox="0 0 512 512" aria-hidden="true")
+ path(d="M434.8 137.65l-149.36-68.1c-16.19-7.4-42.69-7.4-58.88 0L77.3 137.65c-17.6 8-17.6 21.09 0 29.09l148 67.5c16.89 7.7 44.69 7.7 61.58 0l148-67.5c17.52-8 17.52-21.1-.08-29.09zM160 308.52l-82.7 37.11c-17.6 8-17.6 21.1 0 29.1l148 67.5c16.89 7.69 44.69 7.69 61.58 0l148-67.5c17.6-8 17.6-21.1 0-29.1l-79.94-38.47" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32")
+ path(d="M160 204.48l-82.8 37.16c-17.6 8-17.6 21.1 0 29.1l148 67.49c16.89 7.7 44.69 7.7 61.58 0l148-67.49c17.7-8 17.7-21.1.1-29.1L352 204.48" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32")
+ |It
+ input.category_it(type="checkbox")
+
+ div
+ div
+ svg(class="ion-icon-big" viewBox="0 0 512 512" aria-hidden="true")
+ path(fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M32 192L256 64l224 128-224 128L32 192z")
+ path(fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M112 240v128l144 80 144-80V240M480 368V192M256 320v128")
+ |Science
+ input.category_science(type="checkbox")
+
+ div
+ div
+ svg(viewBox="0 0 512 512" aria-hidden="true")
+ path(d="M384 80H128c-26 0-43 14-48 40L48 272v112a48.14 48.14 0 0048 48h320a48.14 48.14 0 0048-48V272l-32-152c-5-27-23-40-48-40z" fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="32")
+ path(fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" d="M48 272h144M320 272h144M192 272a64 64 0 00128 0M144 144h224M128 208h256")
+ |Files
+ input.category_files(type="checkbox")
+
+ div
+ div
+ svg(viewBox="0 0 512 512" aria-hidden="true")
+ path(d="M402 168c-2.93 40.67-33.1 72-66 72s-63.12-31.32-66-72c-3-42.31 26.37-72 66-72s69 30.46 66 72z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32")
+ path(d="M336 304c-65.17 0-127.84 32.37-143.54 95.41-2.08 8.34 3.15 16.59 11.72 16.59h263.65c8.57 0 13.77-8.25 11.72-16.59C463.85 335.36 401.18 304 336 304z" fill="none" stroke="currentColor" stroke-miterlimit="10" stroke-width="32")
+ path(d="M200 185.94c-2.34 32.48-26.72 58.06-53 58.06s-50.7-25.57-53-58.06C91.61 152.15 115.34 128 147 128s55.39 24.77 53 57.94z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32")
+ path(d="M206 306c-18.05-8.27-37.93-11.45-59-11.45-52 0-102.1 25.85-114.65 76.2-1.65 6.66 2.53 13.25 9.37 13.25H154" fill="none" stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="32")
+ |Social Media
+ input.category_social_media(type="checkbox")
+
+ .some-block.option-block
+ h4(data-localise="") Search language
+ select.language
+ option(value="all") Default language
+ option(value="af-ZA") 🇿🇦 Afrikaans (Suid-Afrika)
+ option(value="ca-ES") 🇪🇸 Català (Espanya)
+ option(value="da-DK") 🇩🇰 Dansk (Danmark)
+ option(value="de") 🌐 Deutsch
+ option(value="de-AT") 🇦🇹 Deutsch (Österreich)
+ option(value="de-CH") 🇨🇭 Deutsch (Schweiz)
+ option(value="de-DE") 🇩🇪 Deutsch (Deutschland)
+ option(value="et-EE") 🇪🇪 Eesti (Eesti)
+ option(value="en") 🌐 English
+ option(value="en-AU") 🇦🇺 English (Australia)
+ option(value="en-CA") 🇨🇦 English (Canada)
+ option(value="en-GB") 🇬🇧 English (United Kingdom)
+ option(value="en-IE") 🇮🇪 English (Ireland)
+ option(value="en-MY") 🇲🇾 English (Malaysia)
+ option(value="en-NZ") 🇳🇿 English (New Zealand)
+ option(value="en-US") 🇺🇸 English (United States)
+ option(value="es") 🌐 Español
+ option(value="es-AR") 🇦🇷 Español (Argentina)
+ option(value="es-CL") 🇨🇱 Español (Chile)
+ option(value="es-ES") 🇪🇸 Español (España)
+ option(value="es-MX") 🇲🇽 Español (México)
+ option(value="fil-PH") 🇵🇭 Filipino (Pilipinas)
+ option(value="fr") 🌐 Français
+ option(value="fr-BE") 🇧🇪 Français (Belgique)
+ option(value="fr-CA") 🇨🇦 Français (Canada)
+ option(value="fr-CH") 🇨🇭 Français (Suisse)
+ option(value="fr-FR") 🇫🇷 Français (France)
+ option(value="hr-HR") 🇭🇷 Hrvatski (Hrvatska)
+ option(value="id-ID") 🇮🇩 Indonesia (Indonesia)
+ option(value="it-IT") 🇮🇹 Italiano (Italia)
+ option(value="sw-TZ") 🇹🇿 Kiswahili (Tanzania)
+ option(value="lv-LV") 🇱🇻 Latviešu (Latvija)
+ option(value="lt-LT") 🇱🇹 Lietuvių (Lietuva)
+ option(value="hu-HU") 🇭🇺 Magyar (Magyarország)
+ option(value="nl") 🌐 Nederlands
+ option(value="nl-BE") 🇧🇪 Nederlands (België)
+ option(value="nl-NL") 🇳🇱 Nederlands (Nederland)
+ option(value="no-NO") 🇳🇴 Norsk
+ option(value="pl-PL") 🇵🇱 Polski (Polska)
+ option(value="pt") 🌐 Português
+ option(value="pt-BR") 🇧🇷 Português (Brasil)
+ option(value="pt-PT") 🇵🇹 Português (Portugal)
+ option(value="ro-RO") 🇷🇴 Română (România)
+ option(value="sk-SK") 🇸🇰 Slovenčina (Slovensko)
+ option(value="sl-SI") 🇸🇮 Slovenščina (Slovenija)
+ option(value="fi-FI") 🇫🇮 Suomi (Suomi)
+ option(value="sv-SE") 🇸🇪 Svenska (Sverige)
+ option(value="vi-VN") 🇻🇳 Tiếng Việt (Việt Nam)
+ option(value="tr-TR") 🇹🇷 Türkçe (Türkiye)
+ option(value="is-IS") 🇮🇸 Íslenska (Ísland)
+ option(value="cs-CZ") 🇨🇿 Čeština (Česko)
+ option(value="el-GR") 🇬🇷 Ελληνικά (Ελλάδα)
+ option(value="be-BY") 🇧🇾 Беларуская (Беларусь)
+ option(value="bg-BG") 🇧🇬 Български (България)
+ option(value="ru-RU") 🇷🇺 Русский (Россия)
+ option(value="sr-RS") 🇷🇸 Српски (Србија)
+ option(value="uk-UA") 🇺🇦 Українська (Україна)
+ option(value="he-IL") 🇮🇱 עברית (ישראל)
+ option(value="ar-EG") 🇪🇬 العربية (مصر)
+ option(value="fa-IR") 🇮🇷 فارسی (ایران)
+ option(value="hi-IN") 🇮🇳 हिन्दी (भारत)
+ option(value="th-TH") 🇹🇭 ไทย (ไทย)
+ option(value="zh") 🌐 中文
+ option(value="zh-CN") 🇨🇳 中文 (中国)
+ option(value="zh-HK") 🇭🇰 中文 (中國香港)
+ option(value="zh-TW") 🇹🇼 中文 (台灣)
+ option(value="ja-JP") 🇯🇵 日本語 (日本)
+ option(value="ko-KR") 🇰🇷 한국어 (대한민국)
+
+ .some-block.option-block
+ h4(data-localise="") Autocomplete
+ select.autocomplete
+ option(value="") -
+ option(value="dbpedia") dbpedia
+ option(value="duckduckgo") duckduckgo
+ option(value="google") google
+ option(value="seznam") seznam
+ option(value="startpage") startpage
+ option(value="swisscows") swisscows
+ option(value="qwant") qwant
+ option(value="wikipedia") wikipedia
+ option(value="brave") brave
+
+ .some-block.option-block
+ h4(data-localise="") SafeSearch
+ select.safesearch
+ option(value="2") Strict
+ option(value="1") Moderate
+ option(value="0") None
+
+ .some-block.option-block
+ h4(data-localise="") Hostname replace
+ input.hostname_replace(type="checkbox")
+
+ .some-block.option-block
+ h4(data-localise="") Open Access DOI rewrite
+ input.oa_doi_rewrite(type="checkbox")
+
+ .some-block.option-block
+ h4(data-localise="") Open Access DOI resolver
+ select.doi_resolver
+ option(value="oadoi.org") oadoi.org - https://oadoi.org/
+ option(value="doi.org") doi.org - https://doi.org/
+ option(value="doai.io") doai.io - https://dissem.in/
+ option(value="sci-hub.se") sci-hub.se - https://sci-hub.se/
+ option(value="sci-hub.do") sci-hub.do - https://sci-hub.do/
+ option(value="scihubtw.tw") scihubtw.tw - https://scihubtw.tw/
+ option(value="sci-hub.st") sci-hub.st - https://sci-hub.st/
+ option(value="sci-hub.bar") sci-hub.bar - https://sci-hub.bar/
+ option(value="sci-hub.it.nf") sci-hub.it.nf - https://sci-hub.it.nf/
+
+ .some-block.option-block
+ h4(data-localise="") Engine tokens
+ input.tokens(type="text")
+
+ hr
+
+ .some-block.option-block
+ h2 User Interface
+
+ .some-block.option-block
+ h4(data-localise="") Interface language
+ select.locale
+ option(value="ar") العربية (Arabic)
+ option(value="bg") Български (Bulgarian)
+ option(value="bo") བོད་སྐད་ (Tibetan)
+ option(value="ca") Català (Catalan)
+ option(value="cs") Čeština (Czech)
+ option(value="cy") Cymraeg (Welsh)
+ option(value="da") Dansk (Danish)
+ option(value="de") Deutsch (German)
+ option(value="el-GR") Ελληνικά, Ελλάδα (Greek, Greece)
+ option(value="en" selected="selected") English
+ option(value="eo") Esperanto
+ option(value="es") Español (Spanish)
+ option(value="et") Eesti (Estonian)
+ option(value="eu") Euskara (Basque)
+ option(value="fa-IR") فارسی, ایران (Persian, Iran)
+ option(value="fi") Suomi (Finnish)
+ option(value="fil") Filipino
+ option(value="fr") Français (French)
+ option(value="gl") Galego (Galician)
+ option(value="he") עברית (Hebrew)
+ option(value="hr") Hrvatski (Croatian)
+ option(value="hu") Magyar (Hungarian)
+ option(value="ia") Interlingua
+ option(value="id") Indonesia (Indonesian)
+ option(value="it") Italiano (Italian)
+ option(value="ja") 日本語 (Japanese)
+ option(value="ko") 한국어 (Korean)
+ option(value="lt") Lietuvių (Lithuanian)
+ option(value="nb-NO") Norsk bokmål, Norge (Norwegian bokmål, Norway)
+ option(value="nl") Nederlands (Dutch)
+ option(value="nl-BE") Vlaams (Dutch, Belgium)
+ option(value="oc") Occitan
+ option(value="pl") Polski (Polish)
+ option(value="pt") Português (Portuguese)
+ option(value="pt-BR") Português, Brasil (Portuguese, Brazil)
+ option(value="ro") Română (Romanian)
+ option(value="ru") Русский (Russian)
+ option(value="sk") Slovenčina (Slovak)
+ option(value="sl") Slovenščina (Slovenian)
+ option(value="sr") Српски (Serbian)
+ option(value="sv") Svenska (Swedish)
+ option(value="ta") தமிழ் (Tamil)
+ option(value="te") తెలుగు (Telugu)
+ option(value="tr") Türkçe (Turkish)
+ option(value="uk") Українська (Ukrainian)
+ option(value="vi") Tiếng việt (Vietnamese)
+ option(value="zh-Hans-CN") 中文, 中国 (Chinese, China)
+ option(value="zh-Hant-TW") 中文, 台灣 (Chinese, Taiwan)
+
+ .some-block.option-block
+ h4(data-localise="") Theme
+ select.theme
+ option(value="simple") simple
+
+ .some-block.option-block
+ h4(data-localise="") Theme style
+ select.simple_style
+ option(value="auto") auto
+ option(value="light") light
+ option(value="dark") dark
+
+ .some-block.option-block
+ h4(data-localise="") Results on new tabs
+ select.results_on_new_tab
+ option(value="1") On
+ option(value="0") Off
+
+ .some-block.option-block
+ h4(data-localise="") Infinite scroll
+ select.infinite_scroll
+ option(value="1") On
+ option(value="0") Off
+
+ .some-block.option-block
+ h4(data-localise="") Search on category select
+ input.search_on_category_select(type="checkbox")
+
+ .some-block.option-block
+ h4(data-localise="") Vim-like hotkeys
+ input.vim_hotkeys(type="checkbox")
+
+ hr
+
+ .some-block.option-block
+ h2 Privacy
+
+ .some-block.option-block
+ h4(data-localise="") HTTP Method
+ select.method
+ option(value="POST") POST
+ option(value="GET") GET
+
+ .some-block.option-block
+ h4(data-localise="") Image proxy
+ select.image_proxy
+ option(value="1") Enabled
+ option(value="0") Disabled
+
+ .some-block.option-block
+ h4(data-localise="") Query in the page's title
+ select.query_in_title
+ option(value="1") Enabled
+ option(value="") Disabled
+
+ .some-block.option-block
+ h4(data-localise="") Tracker URL remover
+ input.tracker_url_remover(type="checkbox")
+
+ hr
+
.normal
include ../../widgets/instances.pug
+instances('https://searxng.com')
diff --git a/pug/options/youtube/youtube.pug b/pug/options/youtube/youtube.pug
index d3173012..be88aac8 100644
--- a/pug/options/youtube/youtube.pug
+++ b/pug/options/youtube/youtube.pug
@@ -129,7 +129,8 @@ body.option(dir="auto")
option(value="" data-localise="__MSG_none__") none
option(value="youtube") YouTube
option(value="reddit") Reddit
- | 
+ .some-block.option-block
+ h4
select(class="comments[1]")
option(value="" data-localise="__MSG_none__") none
option(value="youtube") YouTube
@@ -140,13 +141,13 @@ body.option(dir="auto")
select(class="captions[0]")
include ../../widgets/captions_options.pug
- | 
-
+ .some-block.option-block
+ h4
select(class="captions[1]")
include ../../widgets/captions_options.pug
- | 
-
+ .some-block.option-block
+ h4
select(class="captions[2]")
include ../../widgets/captions_options.pug
diff --git a/src/assets/javascripts/helpers/search.js b/src/assets/javascripts/helpers/search.js
index c26eeb29..e6d230fe 100644
--- a/src/assets/javascripts/helpers/search.js
+++ b/src/assets/javascripts/helpers/search.js
@@ -146,20 +146,107 @@ function initSearxCookies() {
}
function initSearxngCookies() {
- let themeValue;
- if (theme == 'light') themeValue = 'logicodev';
- if (theme == 'dark') themeValue = 'logicodev-dark';
- if (applyThemeToSites && themeValue) {
- let checkedInstances;
- if (protocol == 'normal') checkedInstances = [...searxngNormalRedirectsChecks, ...searxngNormalCustomRedirects];
- else if (protocol == 'tor') checkedInstances = [...searxngTorRedirectsChecks, ...searxngTorCustomRedirects];
- else if (protocol == 'i2p') checkedInstances = [...searxngI2pRedirectsChecks, ...searxngI2pCustomRedirects];
+ browser.storage.local.get(
+ [
+ "searchProtocol",
+ "searchFrontend",
+ "searxngCustomSettings",
- for (const instanceUrl of checkedInstances) {
- browser.cookies.set({ url: instanceUrl, name: "oscar-style", value: themeValue })
- browser.cookies.set({ url: instanceUrl, name: "theme", value: 'oscar' })
+ "searxngNormalRedirectsChecks",
+ "searxngNormalCustomRedirects",
+ "searxngTorRedirectsChecks",
+ "searxngTorCustomRedirects",
+ "searxngI2pRedirectsChecks",
+ "searxngI2pCustomRedirects",
+
+ "searxng_category_general",
+ "searxng_category_images",
+ "searxng_category_videos",
+ "searxng_category_news",
+ "searxng_category_map",
+ "searxng_category_music",
+ "searxng_category_it",
+ "searxng_category_science",
+ "searxng_category_files",
+ "searxng_category_social_media",
+ "searxng_language",
+ "searxng_autocomplete",
+ "searxng_safesearch",
+ "searxng_hostname_replace",
+ "searxng_oa_doi_rewrite",
+ "searxng_doi_resolver",
+ "searxng_tokens",
+ "searxng_locale",
+ "searxng_theme",
+ "searxng_simple_style",
+ "searxng_results_on_new_tab",
+ "searxng_infinite_scroll",
+ "searxng_search_on_category_select",
+ "searxng_vim_hotkeys",
+ "searxng_method",
+ "searxng_image_proxy",
+ "searxng_query_in_title",
+ "searxng_tracker_url_remover",
+ ],
+ r => {
+ if (!r.searxngCustomSettings || r.searchFrontend != 'searxng') return;
+ console.log('init SearXNG Cookies');
+ let checkedInstances;
+ if (r.searchProtocol == 'normal') checkedInstances = [...r.searxngNormalRedirectsChecks, ...r.searxngNormalCustomRedirects];
+ else if (r.searchProtocol == 'tor') checkedInstances = [...r.searxngTorRedirectsChecks, ...r.searxngTorCustomRedirects];
+ else if (r.searchProtocol == 'i2p') checkedInstances = [...r.searxngI2pRedirectsChecks, ...r.searxngI2pCustomRedirects];
+
+ let categoryList = [];
+ if (r.searxng_category_general) categoryList.push('general')
+ if (r.searxng_category_images) categoryList.push('images')
+ if (r.searxng_category_videos) categoryList.push('videos')
+ if (r.searxng_category_news) categoryList.push('news')
+ if (r.searxng_category_map) categoryList.push('map')
+ if (r.searxng_category_music) categoryList.push('music')
+ if (r.searxng_category_it) categoryList.push('it')
+ if (r.searxng_category_science) categoryList.push('science')
+ if (r.searxng_category_files) categoryList.push('files')
+ if (r.searxng_category_social_media) categoryList.push('social media')
+ let categoryString = '"' + categoryList.join("\\054") + '"' // ""general\054images\054videos""
+
+ let enabledPluginsList = [];
+ if (r.searxng_hostname_replace) enabledPluginsList.push('searx.plugins.hostname_replace')
+ if (r.searxng_oa_doi_rewrite) enabledPluginsList.push('searx.plugins.oa_doi_rewrite')
+ if (r.searxng_vim_hotkeys) enabledPluginsList.push('searx.plugins.vim_hotkeys')
+
+ let enabledPluginsString = '"' + enabledPluginsList.join("\\054") + '"' // ""searx.plugins.hostname_replace\054searx.plugins.oa_doi_rewrite""
+
+
+ let disabledPluginsList = [];
+ if (!r.searxng_search_on_category_select) disabledPluginsList.push('searx.plugins.search_on_category_select')
+ if (!r.searxng_tracker_url_remover) disabledPluginsList.push('searx.plugins.tracker_url_remover')
+ let disabledPluginsString = '"' + disabledPluginsList.join("\\054") + '"' // ""searx.plugins.hostname_replace\054searx.plugins.oa_doi_rewrite""
+
+ for (const instanceUrl of checkedInstances) {
+ browser.cookies.set({ url: instanceUrl, name: "categories", value: categoryString });
+
+ browser.cookies.set({ url: instanceUrl, name: "language", value: r.searxng_language });
+ browser.cookies.set({ url: instanceUrl, name: "autocomplete", value: r.searxng_autocomplete });
+ browser.cookies.set({ url: instanceUrl, name: "safesearch", value: r.searxng_safesearch });
+
+ browser.cookies.set({ url: instanceUrl, name: "enabled_plugins", value: enabledPluginsString });
+ browser.cookies.set({ url: instanceUrl, name: "disabled_plugins", value: disabledPluginsString });
+
+ browser.cookies.set({ url: instanceUrl, name: "doi_resolver", value: r.searxng_doi_resolver });
+ browser.cookies.set({ url: instanceUrl, name: "tokens", value: r.searxng_tokens });
+ browser.cookies.set({ url: instanceUrl, name: "locale", value: r.searxng_locale });
+ browser.cookies.set({ url: instanceUrl, name: "theme", value: r.searxng_theme });
+ browser.cookies.set({ url: instanceUrl, name: "simple_style", value: r.searxng_simple_style });
+ browser.cookies.set({ url: instanceUrl, name: "results_on_new_tab", value: r.searxng_results_on_new_tab });
+ browser.cookies.set({ url: instanceUrl, name: "infinite_scroll", value: r.searxng_infinite_scroll });
+ browser.cookies.set({ url: instanceUrl, name: "method", value: r.searxng_method });
+ browser.cookies.set({ url: instanceUrl, name: "image_proxy", value: r.searxng_image_proxy });
+ browser.cookies.set({ url: instanceUrl, name: "query_in_title", value: r.searxng_query_in_title });
+ }
}
- }
+ )
+
+
}
function redirect(url) {
@@ -303,6 +390,7 @@ async function initDefaults() {
disableSearch: false,
searchFrontend: 'searxng',
searchRedirects: redirects,
+ searxngCustomSettings: false,
whoogleNormalRedirectsChecks: whoogleNormalRedirectsChecks,
whoogleNormalCustomRedirects: [],
@@ -335,6 +423,41 @@ async function initDefaults() {
applyThemeToSites: false,
searchProtocol: 'normal',
+
+ searxng_category_general: true,
+ searxng_category_images: false,
+ searxng_category_videos: false,
+ searxng_category_news: false,
+ searxng_category_map: false,
+ searxng_category_music: false,
+ searxng_category_it: false,
+ searxng_category_science: false,
+ searxng_category_files: false,
+ searxng_category_social_media: false,
+
+ searxng_language: 'en',
+ searxng_autocomplete: 'google',
+ searxng_safesearch: '0',
+
+ searxng_hostname_replace: false,
+ searxng_oa_doi_rewrite: false,
+
+ searxng_doi_resolver: 'oadoi.org',
+ searxng_tokens: '',
+
+ searxng_locale: 'en',
+ searxng_theme: 'simple',
+ searxng_simple_style: 'auto',
+ searxng_results_on_new_tab: '0',
+ searxng_infinite_scroll: '0',
+
+ searxng_search_on_category_select: true,
+ searxng_vim_hotkeys: false,
+
+ searxng_method: 'POST',
+ searxng_image_proxy: '1',
+ searxng_query_in_title: '',
+ searxng_tracker_url_remover: false,
})
})
})
diff --git a/src/pages/options/search/search.html b/src/pages/options/search/search.html
index 641823f1..45fed601 100644
--- a/src/pages/options/search/search.html
+++ b/src/pages/options/search/search.html
@@ -154,6 +154,10 @@
</div>
</div>
<div id="searxng">
+ <div class="some-block option-block">
+ <h4 data-localise="__MSG_enableCustomSettings__">Enable Custom Settings (will use cookies)</h4>
+ <input id="enable-searxng-custom-settings" type="checkbox">
+ </div>
<hr>
<div class="custom-settings">
<div class="some-block option-block">
@@ -489,14 +493,14 @@
<h4 data-localise="">Image proxy</h4>
<select class="image_proxy">
<option value="1">Enabled</option>
- <option value="">Disabled</option>
+ <option value="0">Disabled</option>
</select>
</div>
<div class="some-block option-block">
<h4 data-localise="">Query in the page's title</h4>
<select class="query_in_title">
<option value="1">Enabled</option>
- <option value="" selected="selected">Disabled</option>
+ <option value="">Disabled</option>
</select>
</div>
<div class="some-block option-block">
diff --git a/src/pages/options/search/search.js b/src/pages/options/search/search.js
index 37b0ed46..0cbb79f7 100644
--- a/src/pages/options/search/search.js
+++ b/src/pages/options/search/search.js
@@ -2,18 +2,49 @@ import searchHelper from "../../../assets/javascripts/helpers/search.js";
import commonHelper from "../../../assets/javascripts/helpers/common.js";
let searxDiv = document.getElementById("searx");
-let searxngDiv = document.getElementById("searxng")
+
+let searxngDiv = document.getElementById("searxng");
+let searxngCustomSettings = document.getElementById("enable-searxng-custom-settings");
+
+let searxngCustomSettingsDiv = searxngDiv.getElementsByClassName('custom-settings')[0]
+
let whoogleDiv = document.getElementById("whoogle");
let disableSearchElement = document.getElementById("disable-search");
let searchFrontendElement = document.getElementById("search-frontend");
let protocolElement = document.getElementById("protocol")
+let customSettingsDivElement = document.getElementsByClassName("custom-settings");
+
+let checkboxes_xpath = document.evaluate(
+ "//div[@id='searxng']//input[@type='checkbox']",
+ document, null, XPathResult.ANY_TYPE, null,
+);
+const inputChecked = [];
+let checkbox = checkboxes_xpath.iterateNext();
+while (checkbox) {
+ inputChecked.push(checkbox);
+ checkbox = checkboxes_xpath.iterateNext();
+}
+
+let textInputs_xpath = document.evaluate(
+ "//div[@id='searxng']//input[@type='text']",
+ document, null, XPathResult.ANY_TYPE, null,
+);
+const inputValues = [];
+let textInput = textInputs_xpath.iterateNext();
+while (textInput) {
+ inputValues.push(textInput);
+ textInput = textInputs_xpath.iterateNext();
+}
+inputValues.push(...searxngCustomSettingsDiv.getElementsByTagName('select'));
+
browser.storage.local.get(
[
"disableSearch",
"searchFrontend",
"searchProtocol",
+ "searxngCustomSettings"
],
r => {
disableSearchElement.checked = !r.disableSearch;
@@ -23,19 +54,49 @@ browser.storage.local.get(
protocolElement.value = r.searchProtocol;
changeProtocolSettings(r.searchProtocol);
+
+
+ searxngCustomSettings.checked = r.searxngCustomSettings
+ changeCustomSettings()
}
);
+for (const element of inputChecked) {
+ let k = `searxng_${element.className}`
+ browser.storage.local.get(k, r => element.checked = r[k])
+}
+for (const element of inputValues) {
+ let k = `searxng_${element.className}`
+ browser.storage.local.get(k, r => element.value = r[k])
+}
+
+searxngCustomSettingsDiv.addEventListener("change", async () => {
+ for (const element of inputChecked)
+ browser.storage.local.set({ [`searxng_${element.className}`]: element.checked })
+
+ for (const element of inputValues)
+ browser.storage.local.set({ [`searxng_${element.className}`]: element.value });
+})
+
document.addEventListener("change", async () => {
await browser.storage.local.set({
disableSearch: !disableSearchElement.checked,
searchFrontend: searchFrontendElement.value,
searchProtocol: protocolElement.value,
+ searxngCustomSettings: searxngCustomSettings.checked,
});
changeFrontendsSettings(searchFrontendElement.value);
changeProtocolSettings(protocolElement.value);
+ changeCustomSettings();
})
+function changeCustomSettings() {
+ if (searxngCustomSettings.checked)
+ for (const item of customSettingsDivElement) item.style.display = 'block';
+ else
+ for (const item of customSettingsDivElement) item.style.display = 'none';
+}
+
function changeFrontendsSettings(frontend) {
let SearxWhoogleElement = document.getElementById("searx-whoogle");
if (frontend == 'searx') {