add autofocus to search field
All checks were successful
website-main / prod-build (push) Successful in 13s
website-main / test-build (push) Successful in 5s

This commit is contained in:
Denys Konovalov 2024-01-03 11:40:48 +01:00
parent cbbf5abf04
commit f30522fbd4
Signed by: Denys Konovalov
GPG Key ID: 0037E1B0E33BD2C9
2 changed files with 15 additions and 10 deletions

@ -1,8 +1,8 @@
{{ define "main" }} {{ define "main" }}
<link rel="stylesheet" href="https://unpkg.com/leaflet@^1.7.1/dist/leaflet.css" /> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.min.css" />
<script src="https://unpkg.com/leaflet@^1.7.1/dist/leaflet.js"></script> <script src="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.min.js"></script>
<main data-pagefind-body> <main data-pagefind-body>
<section class="section pb-0"> <section class="section pb-0">

@ -17,11 +17,16 @@
<link rel="shortcut icon" href="{{ `media/favicon.png` | absURL }}" type="image/x-icon"> <link rel="shortcut icon" href="{{ `media/favicon.png` | absURL }}" type="image/x-icon">
<link rel="icon" href="{{ `media/favicon.png` | absURL }}" type="image/x-icon"> <link rel="icon" href="{{ `media/favicon.png` | absURL }}" type="image/x-icon">
{{ range .Site.Params.plugins.head_js }}
<script src="{{ . | absURL }}" type="text/javascript"></script>
{{ end }}
<link href="/pagefind/pagefind-ui.css" rel="stylesheet"> <link href="/pagefind/pagefind-ui.css" rel="stylesheet">
<script src="/pagefind/pagefind-ui.js" type="text/javascript"></script> <script src="/pagefind/pagefind-ui.js" type="text/javascript"></script>
<script> <script>
window.addEventListener('DOMContentLoaded', (event) => { ($ => {
$(window).on('DOMContentLoaded', () => {
new PagefindUI({ new PagefindUI({
element: "#search", element: "#search",
translations: { translations: {
@ -29,14 +34,14 @@
zero_results: "Leider konnten keine Ergebnisse zu [SEARCH_TERM] gefunden werden", zero_results: "Leider konnten keine Ergebnisse zu [SEARCH_TERM] gefunden werden",
clear_search: "Löschen" clear_search: "Löschen"
} }
}); });
});
</script>
$('#search').addEventListener('shown.bs.modal', () => {
{{ range .Site.Params.plugins.head_js }} $('.pagefind-ui__search-input input').focus();
<script src="{{ . | absURL }}"></script> });
{{ end }} });
})(jQuery);
</script>
<script> <script>
var _paq = window._paq = window._paq || []; var _paq = window._paq = window._paq || [];