diff options
| author | Ivan Gabaldon <igabaldon@inetol.net> | 2025-07-06 12:27:28 +0200 |
|---|---|---|
| committer | Markus Heiser <markus.heiser@darmarIT.de> | 2025-08-18 16:38:32 +0200 |
| commit | 60bd8b90f04d5d825fc8ac279cb7fdfde9fe78ea (patch) | |
| tree | 19b2639638e7845597f9aa839eda39a456188a1c /client/simple/src/js/core/router.ts | |
| parent | adc4361eb919604889dc0661e75ef6ac8cfc4d23 (diff) | |
[enh] theme/simple: custom router
Lay the foundation for loading scripts granularly depending on the endpoint it's
on.
Remove vendor specific prefixes as there are now managed by browserslist and
LightningCSS.
Enabled quite a few rules in Biome that don't come in recommended to better
catch issues and improve consistency.
Related:
- https://github.com/searxng/searxng/pull/5073#discussion_r2256037965
- https://github.com/searxng/searxng/pull/5073#discussion_r2256057100
Diffstat (limited to 'client/simple/src/js/core/router.ts')
| -rw-r--r-- | client/simple/src/js/core/router.ts | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/client/simple/src/js/core/router.ts b/client/simple/src/js/core/router.ts new file mode 100644 index 000000000..05c49ed07 --- /dev/null +++ b/client/simple/src/js/core/router.ts @@ -0,0 +1,38 @@ +import { Endpoints, endpoint, ready, settings } from "./toolkit.ts"; + +ready( + () => { + import("../main/keyboard.ts"); + import("../main/search.ts"); + + if (settings.autocomplete) { + import("../main/autocomplete.ts"); + } + }, + { on: [endpoint === Endpoints.index] } +); + +ready( + () => { + import("../main/keyboard.ts"); + import("../main/mapresult.ts"); + import("../main/results.ts"); + import("../main/search.ts"); + + if (settings.infinite_scroll) { + import("../main/infinite_scroll.ts"); + } + + if (settings.autocomplete) { + import("../main/autocomplete.ts"); + } + }, + { on: [endpoint === Endpoints.results] } +); + +ready( + () => { + import("../main/preferences.ts"); + }, + { on: [endpoint === Endpoints.preferences] } +); |