Add basic searchbar (#5)
Co-authored-by: Tulir Asokan <tulir@maunium.net>
This commit is contained in:
15
static/index.js
Normal file
15
static/index.js
Normal file
@@ -0,0 +1,15 @@
|
||||
function searchPlugins() {
|
||||
const filter = document.querySelector("#search-input").value.toLowerCase()
|
||||
for (const plugin of document.querySelectorAll(".plugin")) {
|
||||
const name = plugin.querySelector(".title").textContent.toLowerCase()
|
||||
const description = plugin.querySelector(".description").textContent.toLowerCase()
|
||||
|
||||
if (name.includes(filter) || description.includes(filter)) {
|
||||
plugin.style.display = ""
|
||||
} else {
|
||||
plugin.style.display = "none"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
window.searchPlugins = searchPlugins
|
||||
Reference in New Issue
Block a user