From 5f7e0b47ee8d31a87bef7d6fa7268fc8ce839126 Mon Sep 17 00:00:00 2001 From: ulrich <undisclosed@undiclosed> Date: Sat, 10 Apr 2021 15:20:30 +0000 Subject: [PATCH] Titel aus Abspielliste loeschen fertig, Abspielliste abspielen Entwurf fertig zum Test --- www/ui/js/app.js | 28 +++++++++++++++++++++++++++- 1 files changed, 27 insertions(+), 1 deletions(-) diff --git a/www/ui/js/app.js b/www/ui/js/app.js index 87fdf6b..15e1e64 100644 --- a/www/ui/js/app.js +++ b/www/ui/js/app.js @@ -231,6 +231,31 @@ }); }; + this.removeSelectedTitel = function() { + var elem = document.querySelector(".selected"); + var parentElem = elem.parentNode; + //console.log("elem: " + elem.nodeName + ", parent: " + parentElem.nodeName + ", len: " + parentElem.childNodes.length); + var liElems = parentElem.getElementsByTagName(elem.nodeName); // nur die LI Elemente + //console.log("liElems.anz: " + liElems.length); + var gefunden = false; + for(var i = 0; i < liElems.length && !gefunden; i++) { + //console.log(liElems.item(i).textContent); + if(liElems.item(i).classList.contains("selected")) { + gefunden = true; + var index = i; + //console.log(elem.textContent + ' hat Index ' + i); + } + } + // /mz/api/alist/[pl-name]/[nr] + var plname = document.querySelector('#playlist').value; + self.http_delete('../api/alist/' + plname + '/' + index,'', function(responseText) { + // DELETE http://localhost:9090/mz/api/alist/liste1/0 + self.meldung_mit_timeout(responseText, 1500); + self.titel_liste(); + }); + + }; + /* Unterer Einblendbereich */ this.dialog_unten_zeigen = function() { @@ -242,6 +267,7 @@ self.abspielliste_auswahl_fuellen(); self.addEvtListener('#dazu-btn', 'click', self.addSelectedTitel); self.addEvtListener('#play-btn', 'click', self.play); + self.addEvtListener('#weg-btn', 'click', self.removeSelectedTitel); self.media_liste(); }); }; @@ -418,7 +444,7 @@ }; this.http_delete = function (u, data, cb) { - console.log("delete " + u); + // console.log("delete " + u); self.http_call('DELETE', u, data, cb); }; -- Gitblit v1.9.3