Skip to content

Commit e6d82f5

Browse files
committed
table filtering, code tidy
1 parent c0ec593 commit e6d82f5

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

tagging-status/full.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The values in the *Status* column have the following meaning:
4040

4141
**Enter search keywords** (space separated) to filter the table.
4242

43-
<input size="40" type="text" id="inp" onkeyup="filterrows()" placeholder="Seach terms">
43+
<input size="40" type="text" id="inp" onkeyup="filterRows()" placeholder="Seach terms">
4444

4545
**Click on a column heading** to sort the table by the chosen column.
4646

@@ -178,22 +178,22 @@ Other:
178178
{% endfor %}
179179

180180
<script>
181-
function filterrows() {
182-
const input = document.getElementById("inp");
183-
const filter = input.value.toUpperCase().split(' ');
184-
const table = document.getElementById("tblbdy");
185-
const tr = table.getElementsByTagName("tr");
186-
187-
// Loop through all table rows, and hide those who don't match all terms the search query
188-
for (let i = 0; i != tr.length; i++) {
189-
txtValue = tr[i].textContent.toUpperCase();
181+
function filterRows() {
182+
const input = document.getElementById("inp");
183+
const keywds = input.value.toUpperCase().split(' ');
184+
const tbdy= document.getElementById("tblbdy");
185+
const tr = tbdy.getElementsByTagName("tr");
186+
187+
// Loop through rows, and hide those who don't match all terms in the query
188+
for (let i = 0; i != trs.length; i++) {
189+
const rowtxt = trs[i].textContent.toUpperCase();
190190
let d="";
191-
for (let j=0;j!=filter.length;j++){
192-
if (txtValue.indexOf(filter[j]) == -1) {
191+
for (let j=0;j!=keywds.length;j++){
192+
if (rowtxt.indexOf(keywds[j]) == -1) {
193193
d="none";
194-
}
195-
}
196-
tr[i].style.display = d;
197-
}
194+
}
198195
}
196+
tr[i].style.display = d;
197+
}
198+
}
199199
</script>

0 commit comments

Comments
 (0)