forked from Ponysearch/Ponysearch
[feat] preferences: button to enable/disable all engines
This commit is contained in:
parent
46efb2f36d
commit
3ea278aff4
3 changed files with 27 additions and 0 deletions
|
@ -27,6 +27,22 @@
|
|||
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");
|
||||
searxng.on(copyHashButton, 'click', (e) => {
|
||||
e.preventDefault();
|
||||
|
|
|
@ -185,6 +185,11 @@ table {
|
|||
}
|
||||
}
|
||||
|
||||
#toggle-all-engines-container {
|
||||
width: max-content;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
div.selectable_url {
|
||||
pre {
|
||||
width: 100%;
|
||||
|
|
|
@ -10,6 +10,12 @@
|
|||
{{- ' ' -}}<a href="{{ url_for('info', pagename='search-syntax') }}">ⓘ</a>
|
||||
</p>
|
||||
{%- 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">{{- '' -}}
|
||||
<table class="striped table_engines">{{- '' -}}
|
||||
|
||||
|
|
Loading…
Reference in a new issue