wallets_balance: Add checkbox to hide simples wallets

This commit is contained in:
poka 2020-10-18 06:02:13 +02:00
parent 8f085e0e52
commit 12bfb02345
3 changed files with 37 additions and 1 deletions

View File

@ -37,3 +37,7 @@
position: sticky;
top: 0px;
}
#splw {
margin-left: 20px;
}

View File

@ -21,7 +21,6 @@ function recherche(select) {
filter = input.value.toUpperCase();
table = document.getElementById("soldes");
tr = table.getElementsByTagName("tr");
th = table.getElementsByTagName("th");
// Loop through all table rows, and hide those who don't match the search query
for (i = 0; i < tr.length; i++) {
@ -39,3 +38,35 @@ function recherche(select) {
}
}
// Affichage des simples portefeuilles
var checkWallets = document.querySelector('input[value="splw"]');
checkWallets.onchange = function() {
var table, tr, td, i, txtValue;
table = document.getElementById("soldes");
tr = table.getElementsByTagName("tr");
if(checkWallets.checked) {
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[2];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue == " ") {
tr[i].style.display = "";
}
}
}
} else {
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[2];
if (td) {
txtValue = td.textContent || td.innerText;
if (txtValue == " ") {
tr[i].style.display = "none";
}
}
}
}
};

View File

@ -6,6 +6,7 @@
<body>
<input type="text" id="pseudo" onkeyup="recherche('pseudo')" placeholder="Rechercher un pseudo...">
<input type="text" id="key" onkeyup="recherche('key')" placeholder="Rechercher une clé publique...">
<input type="checkbox" id="splw" value="splw" checked><label for="splw">Afficher les simples portefeuilles</label>
<table id="soldes (Ḡ1)">
<tr><th>Solde</th><th>Clé publique</th><th>Pseudo</th></tr>