fixed a bug where copy animation remained

This commit is contained in:
MarcusNyne 2024-08-24 20:21:05 -04:00
parent d08d730163
commit 786809d5ca

View File

@ -213,6 +213,16 @@ function uiElementInSight(el) {
return isOnScreen;
}
function uiCopyElementAnimate(el) {
el.classList.remove('animate');
setTimeout(() => {
el.classList.add('animate');
}, 0);
setTimeout(() => {
el.classList.remove('animate');
}, 1100);
}
function uiCopyElementText(el) {
var text = el.innerText;
if (text.startsWith('"')) {
@ -220,11 +230,7 @@ function uiCopyElementText(el) {
}
navigator.clipboard.writeText(text);
el.classList.remove('animate');
setTimeout(() => {
el.classList.add('animate');
}, 0);
uiCopyElementAnimate(el);
}
function uiCopyRawText(elid) {
@ -266,10 +272,6 @@ function uiCopyPngInfo(el, mode) {
if (text != null) {
navigator.clipboard.writeText(text);
el.classList.remove('animate');
setTimeout(() => {
el.classList.add('animate');
}, 0);
uiCopyElementAnimate(el);
}
}