diff --git a/_layouts/default.html b/_layouts/default.html index 4e224cf..fae057b 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -12,6 +12,9 @@
+
+ +
{% if site.title and site.title != page.title %}

{{ site.title }}

{% endif %} @@ -23,6 +26,7 @@ Awesome ChatGPT Prompts is open source. {% github_edit_link "Improve this page" %}.
{% endif %} + @@ -47,6 +51,21 @@ }, false); x.previousElementSibling.previousElementSibling.prepend(button); }); + + // Add search functionality + const searchBar = document.querySelector(".search-container input"); + searchBar.addEventListener("keyup", function() { + const searchTerm = searchBar.value.toLowerCase(); + const prompts = document.querySelectorAll("h2[id^=act] + p + blockquote"); + prompts.forEach(prompt => { + const promptText = prompt.innerText.toLowerCase(); + if (promptText.includes(searchTerm)) { + prompt.style.display = "block"; + } else { + prompt.style.display = "none"; + } + }); + });