Commit Graph

541 Commits (222112bb72c043574dacfc4c6cb60202b087da00)

Author SHA1 Message Date
Martin Fischer a0486cf827 [fix] prevent leaflet.{css,js} from polluting git grep results
Fixes #704.
3 years ago
Martin Fischer 4ac6b5d32d [build] /static 3 years ago
Martin Fischer a12cb6a807 [simple] improve styling of subcategory table headers in preferences 3 years ago
Alexandre Flament 458b7fb72d
Merge pull request #610 from return42/img-load-error
[fix] simple theme: hide the image if img load fails
3 years ago
Markus Heiser efbcaaab3b [build] /static 3 years ago
Markus Heiser 391e4b57c9 make pygments.less
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser f087d01e24 [build] /static 3 years ago
Markus Heiser f75199b1ec [fix] simple theme: hide the image if img load fails
Add event listener to query selector::

    '#urls img.image'

From the user point of view, I think it is better to hide the image:
img_load_error.svg is helplful in the image category because it still allows to
select the image. IMO, in the news category, the fact there is a missing image
won't help to choose the links. From a developer point of view, the place holder
is signal that may be the engine needs to be updated (at least give a look). The
browser console should show the same information too, but it requires some
additional steps. [1]

[1] https://github.com/searxng/searxng/pull/610#issuecomment-997640132

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
mrpaulblack c6b76aa429 [build] /static 3 years ago
mrpaulblack 414f1039d2 [fix] theme: build `img_load_error.svg` as svg 3 years ago
Markus Heiser 84836a5000 [build] /static 3 years ago
Markus Heiser c020b90056 [mod] simple theme: remove vendor prefix of `width: max-content`
Remove no longer needed workarounds like `width: 1000px;`
and vendor prefix of max-content [1].

[1] https://developer.mozilla.org/en-US/docs/Web/CSS/max-content#browser_compatibility

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser 459f33a18e [mod] simple-theme: remove vendor CSS
flexbox
  Browser support for flexbox is excellent, and the majority of browsers do not
  need a prefix at this point. Safari was the last of the major browsers to
  remove prefixes, with the release of Safari 9 in 2015. [1]

user-select:
  Vendor prefix of user-select is not needed, see 'Browser compatibility' [2].

[1] https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Backwards_Compatibility_of_Flexbox#status_in_browsers
[2] https://developer.mozilla.org/en-US/docs/Web/CSS/user-select#browser_compatibility

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser 715f578cda [build] /static 3 years ago
Markus Heiser c416464949 [fix] lazy loading of <img> tags
Images should include dimension attributes.  Without `width` and `height`
specified, image dimensions are 0×0 pixels at first.  ...  In this case the
browser determines that all of them are visible to the user and decides to load
everything [1].

In CSS the `width` is set to a value and the `height` is unsed to scale the image
proportional in both dimensions.

[1] https://web.dev/browser-level-image-lazy-loading/#images-should-include-dimension-attributes
[2] https://caniuse.com/loading-lazy-attr

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser f287787c44 [simple theme] activate - SearXNG JavaScript Style Guide
Add the 'SearXNG JavaScript Style Guide' as one quality gate in the build chain
of the simple theme::

    make themes.simple
    make themes.simple.test

In the github CI the `themes.all` target enforce a `themes.simple`.

BTW: Remove 'jshint' left overs from 0ee316f3d

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser 34f5e9c7a3 [fix] eslint --fix
automatically fix some of the problems reported by eslint rules::

    $ ./manage nvm.bash
    nvm-env$ npm --prefix searx/static/themes/simple run eslint-fix

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser 32cf24a272 [mod] eslint: add gruntfile.js to the files to lint
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser 06730588a6 [mod] SearXNG JavaScript Style Guide (eslint:recommended)
The SearXNG JavaScript Style Guide is a set of eslint rules [1] based on the
eslint:recommended [2] rules.

    "extends": "eslint:recommended"

The additional rules adopted from the JavaScript Standard Style [3][4].

[1] https://eslint.org/docs/rules/
[2] https://github.com/kunalgolani/eslint-config/tree/master/packages/recommended
[3] https://standardjs.com/rules.html#javascript-standard-style
[4] https://github.com/standard/eslint-config-standard/blob/master/.eslintrc.json

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser 9fc27088ef
Merge pull request #583 from return42/fix-combo-with
[fix] simple theme: remove width  45% from language and time filters
3 years ago
Markus Heiser 5f902bbb0f [fix] simple theme: remove width 45% from language and time filters
All three filters (`language`, `time_range` and `safesearch`) are rendered in
one line.  A size of 45% for `language` and `time_range` left only 10% for the
`safesearch` filter.  Solution: drop with from `language` and `time_range`.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser d6d6585b26 [build] /static 3 years ago
Markus Heiser 2b26285a73 [fix] simple theme: make autocomplete-js CSP compliant
The CSP issue is, that the `_Position` function in the autocomplete-js set the
style attributes by `setAttribute("style", ...)`.  Using `setAttribute` to set
the style attribute invokes the HTML parser and CSP is triggered [1].

This patch overwrite the `_Position` function of autocomplete-js.

BTW: remove trailing whitespace

[1] https://stackoverflow.com/a/57633533

Closes: https://github.com/searxng/searxng/issues/352
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser f5a4906e3e [build] /static 3 years ago
Markus Heiser 7d6a15a612 [fix] simple theme: make LESS sources available on non build hosts
Include the LESS source files directly in the `.map` files [1].

Drawback: `.map` files grow up in size, but this should not bother, because the
files are only loaded in debug mode.

[1] https://github.com/gruntjs/grunt-contrib-less#outputsourcefiles
[2] https://github.com/searxng/searxng/pull/575#issuecomment-984058868

Suggested-by: @dalf [2]
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser d26a746d7d [build] /static 3 years ago
Markus Heiser f54460a805 [fix] simple theme: make JS sources available on non build hosts
Include the source files directly in the `.map` files [1] for two reasons:

1. In the simple theme, modules from `./node_modules` are only available on
   developer's build host (a `make node.env` is needed to get the sources).  By
   example; in the `searxng.min.js.map` file, the `autocomplete.js` is linked at
   URL:

      ../node_modules/autocomplete-js/dist/autocomplete.js

2. Later, when client sources has been moved out of the `./static` URL [2] to
   the `<repo-roo>/src` folder, all JS sources are no longer available.

Drawback: `.map` files grow up in size, but this should not bother, because the
files are only loaded in debug mode.

[1] https://github.com/gruntjs/grunt-contrib-uglify#sourcemapincludesources
[2] https://github.com/searxng/searxng/issues/141

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser 82125862c6 [fix] simple theme: remove static files no longer needed
remove:

    searx/static/themes/simple/js/searxng.js
    searx/static/themes/simple/js/searxng.head.js
    searx/static/themes/simple/css/searxng-rtl.css
    searx/static/themes/simple/css/searxng.css

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Alexandre Flament 28b22a0f98 [mod] simple theme: smaller build
remove:
* searx/static/themes/simple/js/searxng.head.js
* searx/static/themes/simple/js/searxng.js
* searx/static/themes/simple/css/searxng-rtl.css
* searx/static/themes/simple/css/searxng.css

These files are never used.
About the js files: the .map files references the sources instead of the concated version.
3 years ago
Markus Heiser 4798acc661 [build] /static 3 years ago
Markus Heiser 7dc9cc91a8 [mod] simple theme, JS: introduce window.searxng.theme namespace
In window.searxng.theme the theme data can be passed through to JS
implementations.

Initial the window.searxng.theme namespace starts with a value for
`img_load_error`::

    // image that is displayed if load of <img src='...'> failed
    img_load_error: 'img/img_load_error.svg'

The searx/static/themes/__common__/js/image_layout.js is patched to uses the
value, if the theme defines a value for img_load_error in this namespace.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser eff0884498 [simple] ImageLayout.watch: `img_load_error.svg` if img load fails
Show default image `img/img_load_error.svg` when image can't be loaded.

----
Some words about class ImageLayout:

The https://github.com/searxng/searxng/blob/master/searx/static/themes/simple/js/searxng.js is build by a grunt task ..

d0e21a01b4/searx/static/themes/simple/gruntfile.js (L91-L93)

The `/__common__/js/*.js` concats also https://github.com/searxng/searxng/blob/master/searx/static/themes/__common__/js/image_layout.js where a modified copy of the of the "Google-image-layout" (`ImageLayout`) is implemented [1][2][3].

[1] https://ptgamr.github.io/2014-09-12-google-image-layout/
[2] https://ptgamr.github.io/google-image-layout/src/google-image-layout.js
[3] https://github.com/ptgamr/google-image-layout/tree/master
----

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser f8c3acd729 [build] /static 3 years ago
Markus Heiser fb5c1ed310 [fix] simple theme: set img background color to wallpaper's color
The *background color* of an transparent image is the color of the color of
wallpaper on which all images are shown on.

Set variable `--color-result-image-background` and `--color-base-background` to
the same value.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser 0afcde071c [build] /static 3 years ago
Markus Heiser 944b73511a [enh] add SVG favicon href="favicon.svg" type="image/svg+xml"
Add link::

    <link rel="icon" href="favicon.png" sizes="any">
    <link rel="icon" href="favicon.svg" type="image/svg+xml">

Modern browsers should request::

    INFO  werkzeug   : 127.0.0.1 - - [28/Nov/2021 17:03:07] "GET /static/themes/simple/img/favicon.svg HTTP/1.1" 200 -

[1] https://github.com/audreyfeldroy/favicon-cheat-sheet#svg-file
[2] https://dev.to/masakudamatsu/favicon-nightmare-how-to-maintain-sanity-3al7

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser e2e585319e [build] /static 3 years ago
Markus Heiser 9349c71c54 [mod] themes/simple/img/searxng.svg -> src/brand/searxng.svg
* move `searx/static/themes/simple/img/searxng.svg` to `src/brand/searxng.svg`

* README.rst can use it without a reference to a theme.

* the simple theme can create `searx/static/themes/simple/img/searxng.png` using
  the svg2png task

Suggested-by: @dalf https://github.com/searxng/searxng/pull/561#issuecomment-981747902
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser 8154dd2a2e [build] /static 3 years ago
Alexandre Flament 59f4c792b4 [mod] simple theme: use sharp instead of convert to create .png from .svg
define a custom grunt task, since grunt-sharp is too old (it can't be installed).
in gruntfile.js, the image tasks are moved at the end the build chain.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser 8c4c4259d4 [mod] gruntfile: do some polish (no functional change)
- remove unused 'path' constant
- fix indentation
- Put all image tasks at the end, where it is easy to list which image is processed.

Suggested -by: @dalf https://github.com/searxng/searxng/pull/541#discussion_r756247157
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
mrpaulblack c443e56458 [build] /static 3 years ago
mrpaulblack 0bb4d6b296 [oscar theme] center search on index and use logo with ponthi 3 years ago
Markus Heiser e54a06bae7 [fix] oscar theme: use SearXNG logo and wordmark
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser 3364a15b3a [build] /static 3 years ago
Markus Heiser 28a597e43e [simple theme] remove '-webkit-border-radius' property
[1] https://github.com/searxng/searxng/pull/537#issuecomment-976582675

Suggested-by: @dalf [1]
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser 8935b1d8a2 [simple theme] remove '-moz-border-radius' property
Support for the prefixed version (-moz-border-radius) was removed in Gecko
13.0 (Firefox 13.0 / Thunderbird 13.0 / SeaMonkey 2.10) [1].

[1] https://developer.mozilla.org/pt-BR/docs/Web/CSS/border-radius

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser 02391cc892 [build] /static 3 years ago
Markus Heiser f57a9f425d [simple template] format default string 'italic'
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Markus Heiser 339838f9f5 [build] /static 3 years ago