"/ctdl/p/" + ref, { method: "DELETE" }
);
- if (response.ok) { // If the server accepted the delete, remove it from the screen
- var el = document.getElementById(ref);
+ if (response.ok) { // If the server accepted the delete...
+ var el = document.getElementById(ref); // ...remove it from the screen...
el.parentNode.removeChild(el);
+ uploads = uploads.filter((r) => r.ref != ref); // ...remove it from the array...
+ document.getElementById("num_attachments").innerHTML = uploads.length; // ...and update our count
}
}
flush_one_upload(u.ref);
});
uploads=[];
+ document.getElementById("num_attachments").innerHTML = uploads.length;
deactivate_uploads(); // this makes the window get destroyed too
}