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 {
background-color: #FFEFC6;
font-weight: bold;
color: var(--accent-color);
font-weight: bold;
cursor: pointer;
}
tbody tr.active td {
@@ -112,12 +112,19 @@ input[type=text]{
}
.result-count {
position: fixed;
right: 0;
bottom: 0;
margin: 0.8vw;
font-size: 1vw;
border-radius: 15px;
padding: 1vw;
background: var(--accent-color);
position: fixed;
right: 0;
bottom: 0;
margin: 0.8vw;
font-size: 1vw;
border-radius: 15px;
padding: 1vw;
background: var(--accent-color);
}
.result-count:hover {
background-color: #FFEFC6;
color: var(--accent-color);
font-weight: bold;
cursor: pointer;
}
+11 -5
View File
@@ -1,9 +1,15 @@
function count_rows() {
return document.querySelectorAll('tr:not([style*="display:none"]):not([style*="display: none"])').length;
function get_displayed_rows() {
return document.querySelectorAll('tbody tr:not([style*="display:none"]):not([style*="display: none"])');
}
document.querySelectorAll("tbody tr").forEach(function(elem) {
elem.addEventListener("click", function() {
elem.classList.toggle('active');
function count_rows() {
return get_displayed_rows().length;
}
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'));
});