2019-07-23 14:13:38 +02:00
|
|
|
/**
|
2021-10-01 18:07:27 +02:00
|
|
|
* @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
|
|
|
|
*/
|
2021-08-31 15:33:38 +02:00
|
|
|
/* global DocumentTouch:readonly */
|
2019-07-23 14:13:38 +02:00
|
|
|
(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
|
2021-10-01 18:07:27 +02:00
|
|
|
w.searxng = {
|
2019-07-23 14:13:38 +02:00
|
|
|
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',
|
2021-11-05 12:45:15 +01:00
|
|
|
hotkeys: script.getAttribute('data-hotkeys') === 'true',
|
2019-07-23 14:13:38 +02:00
|
|
|
static_path: script.getAttribute('data-static-path'),
|
2021-03-16 11:07:04 +01:00
|
|
|
translations: JSON.parse(script.getAttribute('data-translations')),
|
2021-06-16 14:23:44 +02:00
|
|
|
};
|
2019-07-23 14:13:38 +02:00
|
|
|
|
|
|
|
// update the css
|
2021-10-01 18:07:27 +02:00
|
|
|
d.getElementsByTagName("html")[0].className = (w.searxng.touch)?"js touch":"js";
|
2019-07-23 14:13:38 +02:00
|
|
|
})(window, document);
|