preferences.js 953 B

1234567891011121314151617181920212223
  1. $(document).ready(function(){
  2. let engine_descriptions = null;
  3. function load_engine_descriptions() {
  4. if (engine_descriptions == null) {
  5. $.ajax("engine_descriptions.json", dataType="json").done(function(data) {
  6. engine_descriptions = data;
  7. for (const [engine_name, description] of Object.entries(data)) {
  8. let elements = $('[data-engine-name="' + engine_name + '"] .description');
  9. for(const element of elements) {
  10. let source = ' (<i>' + searx.translations['Source'] + ':&nbsp;' + description[1] + '</i>)';
  11. element.innerHTML = description[0] + source;
  12. }
  13. }
  14. });
  15. }
  16. }
  17. if (document.querySelector('body[class="preferences_endpoint"]')) {
  18. $('[data-engine-name]').hover(function() {
  19. load_engine_descriptions();
  20. });
  21. }
  22. });