Commit 48b1b7aa authored by Rosanny Sihombing's avatar Rosanny Sihombing
Browse files

add project counter

parent 61fa3ef4
......@@ -33,6 +33,7 @@ html(lang="de")
h3(class="mb-3 font-weight-bold") Projekte
div(class="container")
p#projectCounter #{project.length} Projekte werden angezeigt
| <div class="row">
for item in project
div(class="py-4 col-sm")
......@@ -66,23 +67,27 @@ html(lang="de")
var input = document.getElementById("searchInput")
var filter = input.value.toUpperCase()
var cards = document.getElementsByClassName("col-sm")
var cardsCol = document.getElementsByClassName("col-sm")
var cardTitle, cardText, titleValue, textValue
var i
for (i = 0; i < cards.length; i++) {
cardTitle = cards[i].getElementsByClassName("card-title-bottom-left");
cardBody = cards[i].getElementsByClassName("card-body");
cardText = cards[i].getElementsByClassName("card-text");
var counterBlock = 0
for (i = 0; i < cardsCol.length; i++) {
cardTitle = cardsCol[i].getElementsByClassName("card-title-bottom-left");
cardBody = cardsCol[i].getElementsByClassName("card-body");
cardText = cardsCol[i].getElementsByClassName("card-text");
titleValue = cardTitle[0].textContent || cardTitle[0].innerText;
bodyValue = cardBody[0].textContent || cardBody[0].innerText;
textValue = cardText[0].textContent || cardText[0].innerText;
if (titleValue.toUpperCase().indexOf(filter) > -1 || bodyValue.toUpperCase().indexOf(filter) > -1 || textValue.toUpperCase().indexOf(filter) > -1) {
cards[i].style.display = "block";
cardsCol[i].style.display = "block"
counterBlock++
} else {
cards[i].style.display = "none";
cardsCol[i].style.display = "none"
}
}
document.getElementById("projectCounter").innerHTML = counterBlock+" Projekte werden angezeigt"
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment