`;
data[category].forEach(item => {
const date = new Date(item.changedAt);
const formattedDate = new Intl.DateTimeFormat(“de-DE”, {
day: “numeric”,
month: “long”,
year: “numeric”
}).format(date);
suggestionsContainer.innerHTML += `
title}”/>
${categoryName === “article” ? item.title + ” ” + formattedDate : item.title}
${item.teaser ?? “”}
`;
});
}
}
let currentIndex = -1;
const selectAllContentContainer = document.querySelectorAll(“.content-container”);
function updateSelectAllContentContainerFocus() {
selectAllContentContainer.forEach((container, index) => {
container.classList.toggle(“active”, index === currentIndex);
})
}
updateSelectAllContentContainerFocus();
document.addEventListener(“keydown”, function (e) {
if (e.key === “ArrowDown” && currentIndex = 0) {
currentIndex -= 1;
updateSelectAllContentContainerFocus();
e.preventDefault();
} else if (e.key === “Enter” && currentIndex 0) {
suggestionsContainer.innerHTML = `
No results were found for your search query”${searchInput.value}”
`;
suggestionsContainer.style.height = “50px”;
}
});
document.addEventListener(“click”, function (e) {
if (!suggestionsContainer.contains(e.target) && e.target.id !== “search_input”) {
suggestionsContainer.style.display = “none”;
}
});
} else {
suggestionsContainer.style.display = “none”;
}
})