Changed copy function to show visually when stuff has been copied

This commit is contained in:
rain
2023-06-01 16:59:06 -05:00
parent 9be1edf3cd
commit 3803cb8763
4 changed files with 28 additions and 2 deletions
+1
View File
@@ -2,3 +2,4 @@
**/*.xml
**/*.pyc
**/*.swp
NOTES.md
+20 -1
View File
@@ -127,4 +127,23 @@ input[type=text]{
color: var(--accent-color);
font-weight: bold;
cursor: pointer;
}
}
.animate { animation: disappear 1s linear; }
.copyAlert {
background: var(--dark-accent-color);
color: var(--header-text);
border-radius: inherit;
line-height: 3vw;
position: absolute;
height: 100%;
width: 100%;
opacity: 0;
left: 0;
top: 0;
}
@keyframes disappear {
0% { opacity: 0; }
5% { opacity: 1; }
100% { opacity: 0; }
}
+6
View File
@@ -20,4 +20,10 @@ document.querySelector(".result-count").addEventListener("click", function() {
addresses.push( element.querySelector("td:nth-child(3)").innerText );
});
navigator.clipboard.writeText(addresses.join('\n'));
// Play the Copy animation
var copyDiv = document.querySelector('.copyAlert:not(.animate)')
if(copyDiv) {
copyDiv.classList.add('animate');
copyDiv.addEventListener('animationend', () => copyDiv.classList.remove('animate') );
}
});
+1 -1
View File
@@ -30,5 +30,5 @@
</tbody>
</table>
<div class='result-count'>{{targets|count}}</div>
<div class='result-count'>{{targets|count}}<span class="copyAlert">✓</span></div>
{% endblock %}