mirror of
https://github.com/searxng/searxng.git
synced 2025-08-05 11:26:43 +02:00
[mod] client_settings: pass settings from server to JS client
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
9177172ea2
commit
ed2a4c8087
8 changed files with 45 additions and 41 deletions
|
@ -1,9 +1,4 @@
|
|||
/**
|
||||
* @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
|
||||
*/
|
||||
/* SPDX-License-Identifier: AGPL-3.0-or-later */
|
||||
(function (w, d) {
|
||||
'use strict';
|
||||
|
||||
|
@ -13,23 +8,13 @@
|
|||
return scripts[scripts.length - 1];
|
||||
})();
|
||||
|
||||
// try to detect touch screen
|
||||
w.searxng = {
|
||||
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',
|
||||
hotkeys: script.getAttribute('data-hotkeys') === 'true',
|
||||
static_path: script.getAttribute('data-static-path'),
|
||||
translations: JSON.parse(script.getAttribute('data-translations')),
|
||||
theme: {
|
||||
// image that is displayed if load of <img src='...'> failed
|
||||
img_load_error: 'img/img_load_error.svg'
|
||||
}
|
||||
settings: JSON.parse(atob(script.getAttribute('client_settings')))
|
||||
};
|
||||
|
||||
// update the css
|
||||
var hmtlElement = d.getElementsByTagName("html")[0];
|
||||
hmtlElement.classList.remove('no-js');
|
||||
hmtlElement.classList.add('js');
|
||||
})(window, document);
|
||||
|
||||
})(window, document);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue