diff options
| author | Alexandre Flament <alex@al-f.net> | 2021-09-24 20:38:56 +0200 |
|---|---|---|
| committer | Alexandre Flament <alex@al-f.net> | 2021-09-24 20:38:56 +0200 |
| commit | 39876d9f144700b223819a0f50101625a1b85e3c (patch) | |
| tree | 7edc41db1b70d5961309adc127704af92363fb19 /searx/static/themes/simple/js/searx.js | |
| parent | 2f1384f1989ddcdeba96d3e0f300510db235b851 (diff) | |
[build] /static
Diffstat (limited to 'searx/static/themes/simple/js/searx.js')
| -rw-r--r-- | searx/static/themes/simple/js/searx.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/searx/static/themes/simple/js/searx.js b/searx/static/themes/simple/js/searx.js index 320c5f882..94e4b3426 100644 --- a/searx/static/themes/simple/js/searx.js +++ b/searx/static/themes/simple/js/searx.js @@ -621,6 +621,33 @@ searx.ready(function() { }); }); })(window, document, window.searx); +;(function (w, d, searx) { + 'use strict'; + + searx.ready(function() { + let engine_descriptions = null; + function load_engine_descriptions() { + if (engine_descriptions == null) { + searx.http("GET", "engine_descriptions.json").then(function(content) { + engine_descriptions = JSON.parse(content); + for (const [engine_name, description] of Object.entries(engine_descriptions)) { + let elements = d.querySelectorAll('[data-engine-name="' + engine_name + '"] .engine-description'); + for(const element of elements) { + let source = ' (<i>' + searx.translations['Source'] + ': ' + description[1] + '</i>)'; + element.innerHTML = description[0] + source; + } + } + }); + } + } + + if (d.querySelector('body[class="preferences_endpoint"]')) { + for(const el of d.querySelectorAll('[data-engine-name]')) { + searx.on(el, 'mouseenter', load_engine_descriptions); + } + } + }); +})(window, document, window.searx); ;/** * searx is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by |