mirror of https://github.com/searxng/searxng.git
[feat] preferences: button to enable/disable all engines
This commit is contained in:
parent
46efb2f36d
commit
3ea278aff4
|
@ -27,6 +27,22 @@
|
||||||
searxng.on(el, 'mouseenter', load_engine_descriptions);
|
searxng.on(el, 'mouseenter', load_engine_descriptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const enableAllEngines = d.querySelectorAll(".enable-all-engines");
|
||||||
|
const disableAllEngines = d.querySelectorAll(".disable-all-engines");
|
||||||
|
const engineToggles = d.querySelectorAll('tbody input[type=checkbox][class~=checkbox-onoff]');
|
||||||
|
const toggleEngines = (enable) => {
|
||||||
|
for (const el of engineToggles) {
|
||||||
|
// check if element visible, so that only engines of the current category are modified
|
||||||
|
if (el.offsetParent !== null) el.checked = !enable;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
for (const el of enableAllEngines) {
|
||||||
|
searxng.on(el, 'click', () => toggleEngines(true));
|
||||||
|
}
|
||||||
|
for (const el of disableAllEngines) {
|
||||||
|
searxng.on(el, 'click', () => toggleEngines(false));
|
||||||
|
}
|
||||||
|
|
||||||
const copyHashButton = d.querySelector("#copy-hash");
|
const copyHashButton = d.querySelector("#copy-hash");
|
||||||
searxng.on(copyHashButton, 'click', (e) => {
|
searxng.on(copyHashButton, 'click', (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
|
@ -185,6 +185,11 @@ table {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#toggle-all-engines-container {
|
||||||
|
width: max-content;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
div.selectable_url {
|
div.selectable_url {
|
||||||
pre {
|
pre {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
|
@ -10,6 +10,12 @@
|
||||||
{{- ' ' -}}<a href="{{ url_for('info', pagename='search-syntax') }}">ⓘ</a>
|
{{- ' ' -}}<a href="{{ url_for('info', pagename='search-syntax') }}">ⓘ</a>
|
||||||
</p>
|
</p>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
|
|
||||||
|
<div class="hide_if_nojs" id="toggle-all-engines-container">
|
||||||
|
<button type="button" class="button enable-all-engines">{{ _("Enable all") }}</button>
|
||||||
|
<button type="button" class="button disable-all-engines">{{ _("Disable all") }}</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="scrollx">{{- '' -}}
|
<div class="scrollx">{{- '' -}}
|
||||||
<table class="striped table_engines">{{- '' -}}
|
<table class="striped table_engines">{{- '' -}}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue