| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -42,4 +42,19 @@ hideBox.addEventListener('change', function(e){ | |||
| 42 | 42 | } else { | |
| 43 | 43 | list.style.display = "initial"; | |
| 44 | 44 | } | |
| 45 | + }); | ||
| 46 | + | ||
| 47 | + // filter books | ||
| 48 | + const searchBar = forms['search-books'].querySelector('input'); | ||
| 49 | + searchBar.addEventListener('keyup', (e) => { | ||
| 50 | + const term = e.target.value.toLowerCase(); | ||
| 51 | + const books = list.getElementsByTagName('li'); | ||
| 52 | + Array.from(books).forEach((book) => { | ||
| 53 | + const title = book.firstElementChild.textContent; | ||
| 54 | + if(title.toLowerCase().indexOf(e.target.value) != -1){ | ||
| 55 | + book.style.display = 'block'; | ||
| 56 | + } else { | ||
| 57 | + book.style.display = 'none'; | ||
| 58 | + } | ||
| 59 | + }); | ||
| 45 | 60 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments