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" }}
<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>
<section class="section pb-0">

@ -17,11 +17,16 @@
<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">
{{ range .Site.Params.plugins.head_js }}
<script src="{{ . | absURL }}" type="text/javascript"></script>
{{ end }}
<link href="/pagefind/pagefind-ui.css" rel="stylesheet">
<script src="/pagefind/pagefind-ui.js" type="text/javascript"></script>
<script>
window.addEventListener('DOMContentLoaded', (event) => {
($ => {
$(window).on('DOMContentLoaded', () => {
new PagefindUI({
element: "#search",
translations: {
@ -29,15 +34,15 @@
zero_results: "Leider konnten keine Ergebnisse zu [SEARCH_TERM] gefunden werden",
clear_search: "Löschen"
}
});
$('#search').addEventListener('shown.bs.modal', () => {
$('.pagefind-ui__search-input input').focus();
});
});
});
})(jQuery);
</script>
{{ range .Site.Params.plugins.head_js }}
<script src="{{ . | absURL }}"></script>
{{ end }}
<script>
var _paq = window._paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */