forked from Archives/searxng
Merge pull request #333 from dalf/enh-engine-descriptions
RFC: /preferences: display engine descriptionsdependabot/pip/master/sphinx-6.1.3
commit
b046322c7b
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,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'] + ': ' + description[1] + '</i>)';
|
||||
element.innerHTML = description[0] + source;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (document.querySelector('body[class="preferences_endpoint"]')) {
|
||||
$('[data-engine-name]').hover(function() {
|
||||
load_engine_descriptions();
|
||||
});
|
||||
}
|
||||
});
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,27 @@
|
||||
(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);
|
Loading…
Reference in New Issue