Added a copy to clipboard function for actively displayitems

This commit is contained in:
rain
2023-05-25 13:32:07 -05:00
parent 60ee186c89
commit b4ff5f8729
2 changed files with 28 additions and 15 deletions
+16 -9
View File
@@ -75,8 +75,8 @@ tr td:last-child{
tbody tr:hover td { tbody tr:hover td {
background-color: #FFEFC6; background-color: #FFEFC6;
font-weight: bold;
color: var(--accent-color); color: var(--accent-color);
font-weight: bold;
cursor: pointer; cursor: pointer;
} }
tbody tr.active td { tbody tr.active td {
@@ -112,12 +112,19 @@ input[type=text]{
} }
.result-count { .result-count {
position: fixed; position: fixed;
right: 0; right: 0;
bottom: 0; bottom: 0;
margin: 0.8vw; margin: 0.8vw;
font-size: 1vw; font-size: 1vw;
border-radius: 15px; border-radius: 15px;
padding: 1vw; padding: 1vw;
background: var(--accent-color); background: var(--accent-color);
}
.result-count:hover {
background-color: #FFEFC6;
color: var(--accent-color);
font-weight: bold;
cursor: pointer;
} }
+12 -6
View File
@@ -1,9 +1,15 @@
function count_rows() { function get_displayed_rows() {
return document.querySelectorAll('tr:not([style*="display:none"]):not([style*="display: none"])').length; return document.querySelectorAll('tbody tr:not([style*="display:none"]):not([style*="display: none"])');
} }
document.querySelectorAll("tbody tr").forEach(function(elem) { function count_rows() {
elem.addEventListener("click", function() { return get_displayed_rows().length;
elem.classList.toggle('active'); }
document.querySelector(".result-count").addEventListener("click", function() {
var addresses = [];
get_displayed_rows().forEach((element) => {
addresses.push( element.querySelector("td:nth-child(3)").innerText );
}); });
}); navigator.clipboard.writeText(addresses.join('\n'));
});