Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions i18n/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ country:
one: Land
many: Länder
other: Länder
search-placeholder: Gib ein Land oder Bahnunternehmen ein
search-button: Suchen
search-placeholder: Suche
footer-love:
text: Made with ♥️ in Frankfurt & Köln
aria-label: Made with love in Frankfurt & Köln
Expand Down
3 changes: 1 addition & 2 deletions i18n/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ country:
one: country
many: countries
other: countries
search-placeholder: Type in a country or train operator
search-button: Search
search-placeholder: Search
footer-love:
text: Made with ♥️ in Frankfurt & Cologne
aria-label: Made with love in Frankfurt & Cologne
Expand Down
30 changes: 29 additions & 1 deletion layouts/partials/stage.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
<script>
const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0;
let placeholderText = '{{ T "search-placeholder" }}';

if (!isMobile) {
if (isMac) {
placeholderText += ' (⌘ + K)';
} else {
placeholderText += ' (CTRL + K)';
}
}

window.addEventListener('DOMContentLoaded', (event) => {
new PagefindUI({ element: "#search", highlightParam: "highlight", showSubResults: true });
new PagefindUI({
element: "#search",
highlightParam: "highlight",
showSubResults: true,
translations: {
placeholder: placeholderText,
}
});
});
document.addEventListener('keydown', (e) => {
if ((e.ctrlKey || e.metaKey) && e.key === 'k') {
e.preventDefault();
const searchElement = document.querySelector('#search input');
if (searchElement) {
searchElement.focus();
}
}
});
</script>

Expand Down
Loading