summaryrefslogtreecommitdiff
path: root/searx/static/themes/oscar/src/js/preferences.js
blob: 25aac052f1595951edfb41ac07935afec35707ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
$(document).ready(function(){
    let engine_descriptions = null;
    function load_engine_descriptions() {
        if (engine_descriptions == null) {
            $.ajax("engine_descriptions.json", dataType="json").done(function(data) {
                engine_descriptions = data;
                for (const [engine_name, description] of Object.entries(data)) {
                    let elements = $('[data-engine-name="' + engine_name + '"] .description');
                    for(const element of elements) {
                        let source = ' (<i>' + searx.translations['Source'] + ':&nbsp;' + description[1] + '</i>)';
                        element.innerHTML = description[0] + source;
                    }
                }
            });
        }
    }

    if (document.querySelector('body[class="preferences_endpoint"]')) {
        $('[data-engine-name]').hover(function() {
            load_engine_descriptions();
        });
    }
});