| | |
| | | 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 */ |
| | |
| | | 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(); |
| | | }); |
| | |
| | | }; |
| | | |
| | | this.http_delete = function (u, data, cb) { |
| | | console.log("delete " + u); |
| | | // console.log("delete " + u); |
| | | self.http_call('DELETE', u, data, cb); |
| | | }; |
| | | |