src/de/uhilger/mediaz/api/ListHandler.java | ●●●●● patch | view | raw | blame | history | |
www/ui/js/app.js | ●●●●● patch | view | raw | blame | history |
src/de/uhilger/mediaz/api/ListHandler.java
@@ -95,9 +95,24 @@ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } // DELETE /mz/api/alist/[pl-name]/[nr] den Titel an der Position [nr] aus der Liste [pl-name] entfernen @Override protected boolean delete(HttpExchange e) { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. String path = e.getRequestURI().toString(); String[] elems = path.split(Server.SLASH); String plname = elems[elems.length - 2]; String listName = elems[elems.length - 3]; FileStorage fs = new FileStorage(App.getInitParameter(App.getRs(App.RB_AP_CONF))); Entity entity = fs.read(Abspielliste.class.getSimpleName(), listName); if(entity instanceof Abspielliste) { Abspielliste liste = (Abspielliste) entity; liste.getTitel().remove(Integer.parseInt(elems[elems.length-1])); fs.write(liste, true); return true; } else { return false; } } } www/ui/js/app.js
@@ -231,6 +231,20 @@ }); }; 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); } } }; /* Unterer Einblendbereich */ this.dialog_unten_zeigen = function() { @@ -242,6 +256,8 @@ 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(); }); };