| | |
| | | var cache; // mustache templates |
| | | var ortPfad; |
| | | var mediaPfad; |
| | | var katUrl; |
| | | var selTitel; |
| | | |
| | | this.init = function () { |
| | | self.mediaPfad = '/'; |
| | |
| | | dlg.innerHTML = html; |
| | | self.abspieler_auswahl_fuellen(); |
| | | self.abspielliste_auswahl_fuellen(); |
| | | self.addEvtListener('#dazu-btn', 'click', self.addSelectedTitel); |
| | | self.media_liste(); |
| | | }); |
| | | }; |
| | |
| | | /* ---------------- Titel einer Abspielliste ----------------- */ |
| | | |
| | | this.titel_liste = function() { |
| | | self.http_get('../api/store/Ablageort/liste/', function (responseText) { |
| | | self.vorlage_laden_und_fuellen("data/tpl/ablageort_liste.tpl", JSON.parse(responseText), function (html) { |
| | | self.reset_top_buttons(); |
| | | var plname = document.querySelector('#playlist').value; |
| | | self.http_get('../api/alist/' + plname, function (responseText) { |
| | | self.vorlage_laden_und_fuellen("data/tpl/titel_liste.tpl", JSON.parse(responseText), function (html) { |
| | | document.querySelector(".zentraler-inhalt").innerHTML = html; |
| | | self.addEvtListener('.entity-eintrag', 'click', function (event) { |
| | | var t = event.target; |
| | | self.removeClassMulti('selected'); |
| | | t.classList.add('selected'); |
| | | |
| | | /* |
| | | self.http_get('../api/store/Ablageort/' + t.textContent, function(responseText){ |
| | | var ablageort = JSON.parse(responseText); |
| | | self.ablageort_form(ablageort); |
| | | }); |
| | | */ |
| | | }); |
| | | /* |
| | | self.addEvtListener('#neu-btn', 'click', function (event) { |
| | | eval("self.ablageort_form" + "(this)"); |
| | | }); |
| | | }); |
| | | */ |
| | | }); |
| | | }); |
| | | }; |
| | |
| | | }); |
| | | }); |
| | | } else { |
| | | // Pfad listen |
| | | // console.log("vorher ortPfad: " + self.ortPfad); |
| | | //console.log("vorher mediaPfad: " + self.mediaPfad); |
| | | //self.http_get('..' + self.ortPfad + '/' + self.mediaPfad + '/', function(responseText) { |
| | | var url = '..' + self.ortPfad + self.mediaPfad; |
| | | if(!url.endsWith('/')) { |
| | | url = url + '/'; |
| | | } |
| | | //console.log("url: " + url); |
| | | self.http_get(url, function(responseText) { |
| | | //console.log(responseText); |
| | | self.vorlage_laden_und_fuellen("data/tpl/katalog_inhalt_liste.tpl", JSON.parse(responseText), function (html) { |
| | | document.querySelector(".zentraler-inhalt").innerHTML = html; |
| | | //console.log("mediaPfad bei Anzeige: " + self.mediaPfad); |
| | | self.addEvtListener('.entity-eintrag', 'click', function (event) { |
| | | var t = event.target; |
| | | var tx = t.textContent; |
| | | //console.log("tx: " + tx); |
| | | //console.log("mediaPfad nach Auswahl: " + self.mediaPfad); |
| | | if(t.classList.contains("entity-typ-folder")) { |
| | | if(self.mediaPfad.endsWith('/')) { |
| | | self.mediaPfad = self.mediaPfad + tx; |
| | | } else { |
| | | self.mediaPfad = self.mediaPfad + '/' + tx; |
| | | } |
| | | //self.mediaPfad = self.mediaPfad + t.textContent; |
| | | //console.log("mediaPfad neu: " + self.mediaPfad); |
| | | self.media_liste(); |
| | | } else { |
| | | //console.log("Media-Inhalt auswaehlen oder abspielen"); |
| | | self.removeClassMulti('selected'); |
| | | t.classList.add('selected'); |
| | | if(t.classList.contains('selected')) { |
| | | self.addSelectedTitel(); |
| | | } else { |
| | | self.removeClassMulti('selected'); |
| | | t.classList.add('selected'); |
| | | } |
| | | //self.selTitel = new Titel(t.textContent, self.ortPfad); |
| | | } |
| | | }); |
| | | self.addEvtListener('#top-up-btn', 'click', function(event) { |
| | |
| | | } else { |
| | | parent = '/'; |
| | | } |
| | | //console.log("Parent: " + parent); |
| | | self.mediaPfad = parent; |
| | | } |
| | | self.media_liste(); |
| | |
| | | }); |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | this.addSelectedTitel = function() { |
| | | var titelName = document.querySelector(".selected").textContent; |
| | | var titel; |
| | | if(self.mediaPfad.endsWith('/')) { |
| | | titel = new Titel(titelName, self.mediaPfad, self.ortPfad); |
| | | } else { |
| | | titel = new Titel(titelName, self.mediaPfad + '/', self.ortPfad); |
| | | } |
| | | var plname = document.querySelector('#playlist').value; |
| | | self.http_put('../api/alist/' + plname, JSON.stringify(titel), function(responseText) { |
| | | self.meldung_mit_timeout(responseText, 1500); |
| | | }); |
| | | }; |
| | | |
| | | this.ablageort_liste = function() { |
| | |
| | | |
| | | function Abspielliste(n) { |
| | | this.name = n; |
| | | } |
| | | |
| | | function Titel(n, p, u) { |
| | | this.katalogUrl = u; |
| | | this.pfad = p; |
| | | this.name = n; |
| | | } |