[fix] remove js_dependencies & css_dependencies

Previously plugins could declare js_dependencies and css_dependencies
which in theory would then be embedded in the page by themes.

Practically this does not make sense when you have multiple themes
since the JS & CSS needs to be written with a specific theme in mind
in order to support it.

Which is also why js_dependencies and css_dependencies was actually only
used by the Oscar theme and ignored by the Simple theme because the
Simple theme doesn't bundle jQuery and has a slightly different page
markup.

This commit removes this broken feature and also moves the *.js files in
searx/static/plugins/js/ to searx/static/themes/oscar/src/js/plugins
(where they actually belong).

The oscar-specific CSS is now simply injected via the oscar-specific JS.

Fixes #769.
This commit is contained in:
Martin Fischer 2022-01-20 09:55:53 +01:00
parent 96a1f79c6d
commit 132917ff42
17 changed files with 78 additions and 105 deletions

View file

@ -14,14 +14,16 @@
return scripts[scripts.length - 1];
})();
const enabledPluginIds = JSON.parse(script.getAttribute('data-plugins'));
// 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',
hotkeys: script.getAttribute('data-hotkeys') === 'true',
search_on_category_select: enabledPluginIds['searx.plugins.search_on_category_select'] == true,
infinite_scroll: enabledPluginIds['searx.plugins.infinite_scroll'] == true,
hotkeys: enabledPluginIds['searx.plugins.vim_hotkeys'] == true,
static_path: script.getAttribute('data-static-path'),
translations: JSON.parse(script.getAttribute('data-translations')),
theme: {
@ -37,4 +39,4 @@
if (w.searxng.touch) {
hmtlElement.classList.add('touch');
}
})(window, document);
})(window, document);