mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00

SearXNG supports plugins. Plugins can declare JavaScript and CSS dependencies. Currently three plugins declare such dependencies: * search_on_category_select (on by default) * vim_hotkeys * infinite_scroll If a user enables a plugin its JavaScript and CSS dependencies are embedded into every page. Sounds simple right? Ironically in the Simple theme things start to get complicated: The scripts were originally written for the Oscar theme and thus depend on jQuery (which isn't loaded in the Simple theme) and look for certain element identifiers (which aren't present in the Simple theme). So how did the plugins actually work with the simple theme? The simple theme just didn't embed the plugin dependencies (which wasn't even documented anywhere). Instead the simple theme checked if the paths contained a certain script path, then set an attribute, which 00_init.js detected and turned into a boolean, which was then used to enable vanilla-JS reimplementations of the plugins. This commit ends this horrible hack (and fixes #769). The necessary changes to the Simple theme are introduced in the next commit.
16 lines
476 B
Python
16 lines
476 B
Python
from flask_babel import gettext
|
|
from . import Resource
|
|
|
|
name = gettext('Vim-like hotkeys')
|
|
description = gettext(
|
|
'Navigate search results with Vim-like hotkeys '
|
|
'(JavaScript required). '
|
|
'Press "h" key on main or result page to get help.'
|
|
)
|
|
default_on = False
|
|
preference_section = 'ui'
|
|
|
|
js_dependencies = (
|
|
Resource(path='plugins/js/vim_hotkeys.js', themes=('oscar',)),
|
|
)
|
|
css_dependencies = (Resource(path='plugins/css/vim_hotkeys.css', themes=('oscar',)),)
|