diff options
| author | Alexandre Flament <alex@al-f.net> | 2021-10-01 18:07:27 +0200 |
|---|---|---|
| committer | Alexandre Flament <alex@al-f.net> | 2021-10-01 18:09:37 +0200 |
| commit | a53a4d5012a3aa5bcabbe0d7db8805fdf342d896 (patch) | |
| tree | 6624deb9186ef9979230e8e63a871b96a4dd38b1 /searx/static/themes/simple/js/searxng.head.js | |
| parent | 74b08303622c5545f04a3faf52f6c6962a43ea5f (diff) | |
[build] /static
Diffstat (limited to 'searx/static/themes/simple/js/searxng.head.js')
| -rw-r--r-- | searx/static/themes/simple/js/searxng.head.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/searx/static/themes/simple/js/searxng.head.js b/searx/static/themes/simple/js/searxng.head.js new file mode 100644 index 000000000..4406b764e --- /dev/null +++ b/searx/static/themes/simple/js/searxng.head.js @@ -0,0 +1,30 @@ +/** + * @license + * (C) Copyright Contributors to the SearXNG project. + * (C) Copyright Contributors to the searx project (2014 - 2021). + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +/* global DocumentTouch:readonly */ +(function(w, d) { + 'use strict'; + + // add data- properties + var script = d.currentScript || (function() { + var scripts = d.getElementsByTagName('script'); + return scripts[scripts.length - 1]; + })(); + + // try to detect touch screen + w.searxng = { + touch: (("ontouchstart" in w) || w.DocumentTouch && document instanceof DocumentTouch) || false, + method: script.getAttribute('data-method'), + autocompleter: script.getAttribute('data-autocompleter') === 'true', + search_on_category_select: script.getAttribute('data-search-on-category-select') === 'true', + infinite_scroll: script.getAttribute('data-infinite-scroll') === 'true', + static_path: script.getAttribute('data-static-path'), + translations: JSON.parse(script.getAttribute('data-translations')), + }; + + // update the css + d.getElementsByTagName("html")[0].className = (w.searxng.touch)?"js touch":"js"; +})(window, document);
\ No newline at end of file |