class toolBar{ constructor(){ this.element = document.querySelector('#toolbar'); this.deleteButton = this.element.querySelector('#tbDelete'); this.editButton = this.element.querySelector('#tbEdit'); this.downloadButton = this.element.querySelector('#tbDownload'); this.closeButton = this.element.querySelector('#tbclose'); this.countdisplay = this.element.querySelector('#selectAmount'); this.deleteButton.addEventListener("click", ()=>{ this.delete(); }) this.closeButton.addEventListener("click", ()=>{ this.close(); }) this.downloadButton.addEventListener("click", ()=>{ this.download(); }) } show(){ this.element.classList.remove('d-none'); } hide(){ this.element.classList.add("d-none"); } close(){ backend.checkedImages.forEach(element => { element.toogleCheckbox(true); }); } async delete() { try { for (let element of backend.checkedImages) { await element.delete(); } this.hide(); await backend.getEntries(backend.status); } catch (error) { console.error('Fehler beim Löschen:', error); } } async download() { try { let imageUrl = "/backend/download/original/"; for (let element of backend.checkedImages) { imageUrl += element.id + "+"; } imageUrl = imageUrl.slice(0, -1); window.location.assign(imageUrl) this.hide(); } catch (error) { console.error('Fehler beim Herunterladen:', error); } } }