diff --git a/static/index.html b/static/index.html
index d55c51b..b49d2db 100644
--- a/static/index.html
+++ b/static/index.html
@@ -100,6 +100,9 @@ function set(short, long) {
params.set('short', short);
params.set('long', long);
+ const oldShort = document.getElementById('short').value;
+ const oldLong = document.getElementById('long').value;
+
fetch(`./?${params.toString()}`, {
method: 'POST',
}).then(async (resp) => {
@@ -113,9 +116,14 @@ function set(short, long) {
setShortItem(newShort, 'check-square');
+ // Only set the icons if we were actually setting from these inputs
if (document.getElementById('short').value == short && document.getElementById('long').value == long) {
document.getElementById('short-icon').setAttribute('name', 'check-square');
document.getElementById('long-icon').setAttribute('name', 'check-square');
+ }
+
+ // Only set the clipboard if the user didn't change the inputs
+ if (document.getElementById('short').value == oldShort && document.getElementById('long').value == oldLong) {
await navigator.clipboard.writeText(`${window.location.origin}/${newShort}`);
}
});