Browse Source

Merge pull request #582 from return42/fix-autocomplete-csp

[fix] simple theme: make autocomplete-js CSP compliant
Alexandre Flament 3 years ago
parent
commit
2a262df0bb

+ 1 - 1
searx/static/themes/oscar/js/searxng.min.js

@@ -4,7 +4,7 @@
  * (C) Copyright Contributors to the searx project (2014 - 2021).
  * SPDX-License-Identifier: AGPL-3.0-or-later
  */
-window.searxng=function(t){"use strict";t.getElementsByTagName("html")[0].className="js";var e,e=t.currentScript||(e=t.getElementsByTagName("script"))[e.length-1];return{autocompleter:"true"===e.getAttribute("data-autocompleter"),method:e.getAttribute("data-method"),translations:JSON.parse(e.getAttribute("data-translations"))}}(document),
+window.searxng=function(t){"use strict";t.getElementsByTagName("html")[0].className="js";var e=t.currentScript||(e=t.getElementsByTagName("script"))[e.length-1];return{autocompleter:"true"===e.getAttribute("data-autocompleter"),method:e.getAttribute("data-method"),translations:JSON.parse(e.getAttribute("data-translations"))}}(document),
 /**
  * @license
  * (C) Copyright Contributors to the SearXNG project.

File diff suppressed because it is too large
+ 0 - 0
searx/static/themes/oscar/js/searxng.min.js.map


File diff suppressed because it is too large
+ 0 - 0
searx/static/themes/simple/js/searxng.min.js


File diff suppressed because it is too large
+ 0 - 0
searx/static/themes/simple/js/searxng.min.js.map


+ 7 - 1
searx/static/themes/simple/src/js/main/search.js

@@ -54,7 +54,7 @@
     if (qinput !== null) {
       // clear button
       createClearButton(qinput);
-      
+
       // autocompleter
       if (searxng.autocompleter) {
         searxng.autocomplete = AutoComplete.call(w, {
@@ -67,6 +67,12 @@
           },
           MinChars: 4,
           Delay: 300,
+          _Position:function() {
+            this.DOMResults.setAttribute("class", "autocomplete");
+            this.DOMResults.style.top = (this.Input.offsetTop + this.Input.offsetHeight) + "px";
+            this.DOMResults.style.left = this.Input.offsetLeft + "px";
+            this.DOMResults.style.width = this.Input.clientWidth + "px";
+          },
         }, "#" + qinput_id);
 
         // hack, see : https://github.com/autocompletejs/autocomplete.js/issues/37

Some files were not shown because too many files changed in this diff