Commit graph

64 commits

Author SHA1 Message Date
Markus Heiser
2149e88bdd [mod] template preferences: split into elements (no functional change)
HINT: this patch has no functional change / it is the preparation for following
      changes and bugfixes

Over the years, the preferences template became an unmanageable beast.  To make
the source code more readable the monolith is splitted into elements.  The
splitting into elements also has the advantage that a new template can make use
of them.

The reversed checkbox is a quirk that is only used in the prefereces and must be
eliminated in the long term.  For this the macro 'checkbox_onoff_reversed' was
added to the preferences.html template.  The 'checkbox' macro is also a quirk of
the preferences.html we don't want to use in other templates (it is an
input-checkbox in a HTML form that was misused for status display).

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-06-02 19:05:43 +02:00
Markus Heiser
ebe22a4319 [fix] typo: dues --> does
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-05-22 13:18:22 +02:00
Markus Heiser
f117f969d8 [mod] in the preference page, show !bang of subgrouping categories
The names of the subgrouping categories in the preference page are translated,
to use this categories the user needs to know by which !bang the category can be
selected.  Related to "Make 'non tab category' bangs discoverable" in [#690].

Related:

- [#690] https://github.com/searxng/searxng/issues/690
- https://github.com/searxng/searxng/issues/1604
- https://github.com/searxng/searxng/pull/1545

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-04-08 11:10:14 +02:00
Markus Heiser
2ffd446e5c [mod] clarify the difference of the default category and subgrouping
This PR does no functional change it is just an attempt to make more clear in
the code, what a default category is and what a subcategory is.  The previous
name 'others' leads to confusion with the **category 'other'**.

If a engine is not assigned to a category, the default is assigned::

    DEFAULT_CATEGORY = 'other'

If an engine has only one category and this category is shown as tab in the user
interface, this engine has no further subgrouping::

    NO_SUBGROUPING = 'without further subgrouping'

Related:

- https://github.com/searxng/searxng/issues/1604
- https://github.com/searxng/searxng/pull/1545

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-04-07 11:03:25 +02:00
Markus Heiser
c9cd376186 [mod] replace searx.languages by searx.sxng_locales
With the language and region tags from the EngineTraitsMap the handling of
SearXNG's tags of languages and regions has been normalized and is no longer
a *mystery*.  The "languages" became "locales" that are supported by babel and
by this, the update_engine_traits.py can be simplified a lot.

Other code places can be simplified as well, but these simplifications
should (respectively can) only be done when none of the engines work with the
deprecated EngineTraits.supported_languages interface anymore.

This commit replaces searx.languages by searx.sxng_locales and fix the naming of
some names from "language" to "locale" (e.g. language_codes --> sxng_locales).

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-03-24 10:37:42 +01:00
Alexandre Flament
6748e8e2d5 Add "Auto-detected" as a language.
When the user choose "Auto-detected", the choice remains on the following queries.
The detected language is displayed.

For example "Auto-detected (en)":
* the next query language is going to be auto detected
* for the current query, the detected language is English.

This replace the autodetect_search_language plugin.
2023-02-17 15:17:36 +00:00
Markus Heiser
ba8959ad7c [fix] typos / reported by @kianmeng in searx PR-3366
[PR-3366] https://github.com/searx/searx/pull/3366

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-09-27 18:32:14 +02:00
Alexandre FLAMENT
66f72a006f template: when enable_metrics are disabled, hide the empty stats
when metrics are disabled:
* hide the link to /stats at the bottom of the pages
* in /preferences, hide the columns "Response time" and "Reliability"
2022-09-02 08:52:23 +00:00
Léon Tiekötter
d339e97727
[fix] preferences: missing option value
Fix missing option value "0".
2022-07-17 19:51:12 +02:00
Markus Heiser
241bde5ae3 [fix] typo: add missing 'n' in center_aligment --> center_alignment
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-07-03 17:35:54 +02:00
Alexandre Flament
8a85d1b0c7 Theme: add a preference to center the results (Oscar) (2nd edition)
related to
* #1169
* #1281
* #1286
2022-06-18 08:54:24 +02:00
Alexandre Flament
9723cef99a Revert "Theme: add a preference to center the results (Oscar)"
This reverts commit 4237f5fd50.
2022-06-05 23:03:26 +02:00
Alexandre Flament
4237f5fd50 Theme: add a preference to center the results (Oscar)
related to #1169
2022-06-05 19:59:49 +02:00
Julian Fairfax
7d443dfea3 Preferences URL in preferences
Revert translation changes

Auto-save preferences from URL

Preferences URL in preferences

Fix that

Preferences URL in preferences
2022-05-15 20:34:04 +02:00
Markus Heiser
e8541b6006 [theme] peel out oscar from SearXNG development
This is the first step of removing oscar theme

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-04-30 13:20:27 +02:00
Alexandre Flament
0379856712
Merge pull request #967 from return42/language-filter
[mod] add flags to the languages filter
2022-03-28 21:36:20 +02:00
Markus Heiser
076c6889d3 [fix] simple theme: open preferences with general tab
BTW: fix also the category tab to open with category 'general'

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-03-19 19:55:54 +01:00
Markus Heiser
2841abaf55 [mod] add flags to the languages filter
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-03-19 15:09:13 +01:00
Alexandre Flament
a250ddadb9 [enh] simple: basic ARIA fixes 2022-03-08 19:37:21 +00:00
Alexandre Flament
3d9e48b84e [simple] checkboxes can get the focusable
Do note that checkboxes in the engine tab are displayed reversed.
See: 3408d061aa/searx/templates/simple/preferences.html (L313)
A checkbox for an engine is checked when the engine is disabled.
2022-03-02 18:56:08 +00:00
Alexandre Flament
56e34947a6 [mod] infinite_scroll as preference
* oscar theme: code from searx/plugins/infinite_scroll.py
* simple theme: new implementation

Co-authored-by: Markus Heiser <markus.heiser@darmarIT.de>
2022-02-20 22:58:51 +01:00
Martin Fischer
07936060d1 preferences: Set autocomplete=off for form
Otherwise you can change the value of a select,
refresh the page and the preferences stay changed,
leaving the wrong impression that they were saved.
2022-02-04 21:11:29 +01:00
Martin Fischer
e7c0f4e877 [simple] link preferences on /about and /stats
We want to link the preferences from every page
(except of course the preferences page).
2022-01-31 11:57:24 +01:00
Martin Fischer
6f0ec7e58f [simple] introduce page_with_header.html template
Previously the preferences & stats templates contained the markup:

<a href="{{ url_for('index') }}"><h1><span>SearXNG</span></h1></a>

There are many things wrong with this:

1. the markup was duplicated

2. the CSS needed to be changed whenever a new page wanted to use this
   header (since the CSS used page-specific selectors)

3. h1 should be reserved for the actual page title
   (e.g. Preferences or Engine stats)

4. the image was set via CSS which also set:

       span { visibility: hidden; }

   which however removes the alternative text from the accessibility
   tree (meaning screen readers will ignore it).

This commit fixes all these problems.
2022-01-30 17:29:21 +01:00
Monty
f59afc8dd2 Uppercase buttons 2022-01-26 16:54:15 +01:00
Markus Heiser
08b38a8bfd [fix] simple theme: description of HTTP method
Suggested-by: @not-my-profile https://github.com/searxng/searxng/pull/754#issuecomment-1012921096
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-14 10:07:09 +01:00
Markus Heiser
e45dfb334b [theme] /preferences: rename "Method" to "HTTP Method"
Closes: https://github.com/searxng/searxng/issues/751
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-14 08:29:04 +01:00
Martin Fischer
cd8ce22f86 [themes] add comma before "but" in new sentence
Closes #739.
2022-01-12 08:26:23 +01:00
Martin Fischer
abe53946d4 [enh] display help text for "Other" engines tab in preferences 2022-01-05 11:03:44 +01:00
Martin Fischer
ab90e2ac49 [enh] show categories not in any tab category in "Other" preferences tab
Previously we didn't have a good place to put search engines that don't
fit into any of the tab categories. This commit automatically puts
search engines that don't belong to any tab category in an "other"
category, that is only displayed in the user preferences (and not above
search results).
2022-01-05 11:03:44 +01:00
Martin Fischer
a12cb6a807 [simple] improve styling of subcategory table headers in preferences 2022-01-05 11:03:44 +01:00
Martin Fischer
20a5e43e35 [enh] display language of engines in preferences 2022-01-05 11:03:44 +01:00
Martin Fischer
31e206361f [enh] group engines in preference tabs 2022-01-05 11:03:44 +01:00
Martin Fischer
8e9ad1ccc2 [enh] introduce categories_as_tabs
Previously all categories were displayed as search engine tabs.
This commit changes that so that only the categories listed under
categories_as_tabs in settings.yml are displayed.

This lets us introduce more categories without cluttering up the UI.
Categories not displayed as tabs  can still be searched with !bangs.
2022-01-03 07:01:49 +01:00
Markus Heiser
3f3097c772 [fix] templates: remove unneeded escape \' of single quotation mark
Strings like::

    'Query in the page\'s title'

are hard to read / remove escape sequence by using double quotation marks for
strings ::

    "Query in the page's title"

BTW: remove a leading dot in the simple theme [1].

[1] 80fb77476f (r756112716)

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-11-24 17:40:03 +01:00
Alexandre Flament
42c1a938f0
Merge pull request #485 from dalf/pref_query_in_title
[mod] new preference: query_in_title
2021-11-24 13:10:27 +01:00
Alexandre Flament
ec5a82fccd [enh] simple theme: add "simple-style" preferences 2021-11-19 16:45:50 +01:00
Alexandre Flament
dfbbc3b471 [fix] simple theme: /preferences: add tokens field
include changes to display input text field in the preferences
2021-11-13 17:12:28 +01:00
MrPaulBlack
566dfe3330 [simple theme] update to ion icons 5 and drop webfont
* update from ionicons-npm to ionicons ver.5
* drop the webfont built by grunt for icons
* built icons.html template for inlining icons with jinja2 into html
* update icon to use mostly the outline version
* add icons to categories and do not display them on mobile to save space
* remove all legacy ion icon font files from simple theme
* icons.html is added in this commit since make statc.build.restore requires git to know the file already
* cleanup error-dialog
2021-11-13 10:42:07 +01:00
Alexandre Flament
80fb77476f [mod] new preference: query_in_title
* disable by default
* settings.yml: ui.query_in_title
* in /preferences: privacy tab

when enabled, the result page's title contains the user query.

previously:
* oscar theme: the query was always included
* simple theme: the query was included with the GET method
2021-11-08 21:40:53 +01:00
Markus Heiser
9730371199 [fix] typos reported from weblate translators
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-10-15 19:20:11 +00:00
Alexandre Flament
74b0830362 SearXNG: simple theme 2021-10-01 18:06:55 +02:00
Alexandre Flament
2f1384f198 [enh] themes: display the engine descriptions 2021-09-24 20:38:05 +02:00
MrPaulBlack
3017227c14 [preferences] remove checkbox class from query section 2021-09-24 19:14:35 +02:00
MrPaulBlack
d24bcbb6f0 [preferences] reorder tabs in simple to match oscar theme 2021-09-24 16:21:43 +02:00
MrPaulBlack
45eb2b5637 [preferences] cleanup whitespaces 2021-09-24 16:15:26 +02:00
MrPaulBlack
2d26ace265 [preferences] add special queries tab to preferences 2021-09-24 16:04:10 +02:00
Markus Heiser
bd830f7449 [fix] simple theme - preferences: fix tooltip overflow
Suggested-by: @dalf https://github.com/searxng/searxng/pull/295#discussion_r703370358
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-09-07 16:46:49 +02:00
Markus Heiser
e564cef0fe [fix] make /preferences more CSP compliant - simple & oscar theme
In simple & oscar theme remove ``style=`` properties which violates CSP but seem
not to have a magnification in GUI (UX).

Fixed files::

    ./oscar/preferences.html:25:<td class="{{ label }}" style="padding: 2px">{{- "" -}}
    ./simple/preferences.html:39:<td class="{{ label }}" style="padding: 2px; width: 13rem;">{{- "" -}}
    ./simple/preferences.html:77:    <div class="engine-tooltip" style="right: 12rem;" role="tooltip" id="{{engine_name}}_reliability">
    ./simple/preferences.html:258:     <p class="text-muted" style="margin:20px 0;">

Reported-by: https://github.com/searxng/searxng/issues/57
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-09-07 08:20:30 +02:00
Markus Heiser
48c806954e [fix] make /preferences more CSP compliant - simple & oscar theme
in simple & oscar theme replace bar-graph's *styles* by CSP compliant
implementation in::

    searx/static/themes/__common__/less/stats.less

Fixed files::

    ./oscar/preferences.html:29:        <span style="width: calc(max(2px, 100%*{{ (stats[engine_name].time / max_rate95)|round(3) }}))" class="stacked-bar-chart-median"></span>{{- "" -}}
    ./oscar/preferences.html:30:        <span style="width: calc(100%*{{ ((stats[engine_name].rate80 - stats[engine_name].time) / max_rate95)|round(3) }})" class="stacked-bar-chart-rate80"></span>{{- "" -}}
    ./oscar/preferences.html:31:        <span style="width: calc(100%*{{ ((stats[engine_name].rate95 - stats[engine_name].rate80) / max_rate95)|round(3) }})" class="stacked-bar-chart-rate95"></span>{{- "" -}}
    ./simple/preferences.html:43:        <span style="width: calc(max(2px, 100%*{{ (stats[engine_name].time / max_rate95)|round(3) }}))" class="stacked-bar-chart-median"></span>{{- "" -}}
    ./simple/preferences.html:44:        <span style="width: calc(100%*{{ ((stats[engine_name].rate80 - stats[engine_name].time) / max_rate95)|round(3) }})" class="stacked-bar-chart-rate80"></span>{{- "" -}}
    ./simple/preferences.html:45:        <span style="width: calc(100%*{{ ((stats[engine_name].rate95 - stats[engine_name].rate80) / max_rate95)|round(3) }})" class="stacked-bar-chart-rate95"></span>{{- "" -}}

Reported-by: https://github.com/searxng/searxng/issues/57
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2021-09-06 11:08:50 +02:00