From b4ff5f8729941167a813490d0d8fafc85d5cfc66 Mon Sep 17 00:00:00 2001 From: rain Date: Thu, 25 May 2023 13:32:07 -0500 Subject: [PATCH] Added a copy to clipboard function for actively displayitems --- app/static/css/style.css | 25 ++++++++++++++++--------- app/static/js/table.js | 18 ++++++++++++------ 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/app/static/css/style.css b/app/static/css/style.css index d56cb0f..e3dc7e9 100755 --- a/app/static/css/style.css +++ b/app/static/css/style.css @@ -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; } \ No newline at end of file diff --git a/app/static/js/table.js b/app/static/js/table.js index 283e159..4654def 100644 --- a/app/static/js/table.js +++ b/app/static/js/table.js @@ -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 ); }); -}); \ No newline at end of file + navigator.clipboard.writeText(addresses.join('\n')); +});