From 5898509f4ca658690c4d4bc0e1784a8ecbff4178 Mon Sep 17 00:00:00 2001 From: ulrich Date: Sat, 10 Apr 2021 16:09:30 +0000 Subject: [PATCH] Abspielliste abspielen fertig, stop, pause, weiter fertig --- www/ui/js/app.js | 28 +++++++++++++++++++--------- 1 files changed, 19 insertions(+), 9 deletions(-) diff --git a/www/ui/js/app.js b/www/ui/js/app.js index 864f20f..15e1e64 100644 --- a/www/ui/js/app.js +++ b/www/ui/js/app.js @@ -234,15 +234,26 @@ 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); - console.log("liElems.anz: " + liElems.length); - for(var i = 0; i < liElems.length; i++) { - console.log(liElems.item(i).textContent); - if(liElems.item(i).textContent === elem.textContent) { - console.log(elem.textContent + ' hat Index ' + i); + //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 */ @@ -256,7 +267,6 @@ self.abspielliste_auswahl_fuellen(); self.addEvtListener('#dazu-btn', 'click', self.addSelectedTitel); self.addEvtListener('#play-btn', 'click', self.play); - // /mz/api/alist/[pl-name]/[nr] self.addEvtListener('#weg-btn', 'click', self.removeSelectedTitel); self.media_liste(); }); @@ -434,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