Home.html 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>BDLG Planning 2022</title>
  5. <style>
  6. {% include "stylesheet.css" %}
  7. </style>
  8. </head>
  9. <body>
  10. <div class="formcontrol home-search">
  11. <label class="formcontrol-label" for="search">Cherche ton prénom</label>
  12. <div class="formcontrol-control">
  13. <input class="input" type="text" id="search" />
  14. </div>
  15. </div>
  16. <ul class="" id="links">
  17. {%- for name, link in links %}
  18. <li class="link-item">
  19. <a href="./{{ link }}">{{ name }}</a>
  20. </li>
  21. {%- endfor %}
  22. </ul>
  23. <script>
  24. const input = document.getElementById("search");
  25. const link_list = document.getElementById("links").children;
  26. var changeListener = (evt) => {
  27. const text = input.value.toLowerCase();
  28. for (let node of link_list) {
  29. if (node.innerText.toLowerCase().includes(text)) {
  30. node.classList.remove("hide");
  31. } else {
  32. node.classList.add("hide");
  33. }
  34. }
  35. };
  36. input.addEventListener("input", changeListener);
  37. </script>
  38. </body>
  39. </html>