| | |
| | | function Ablageort(n, o, u) { |
| | | this.name = n; |
| | | this.ort = o; |
| | | this.url = u; |
| | | } |
| | | |
| | | function Einstellung(k, v) { |
| | | this.key = k; |
| | | this.value = v; |
| | | } |
| | | |
| | | function Abspieler(n, u) { |
| | | this.name = n; |
| | | this.url = u; |
| | | } |
| | | |
| | | function Mediazentrale() { |
| | | var self = this; |
| | | var appMenu; |
| | | var cache; // mustache templates |
| | | var ortPfad; |
| | | var mediaPfad; |
| | | |
| | | this.init = function () { |
| | | self.mediaPfad = '/'; |
| | | self.ortPfad = '/'; |
| | | self.cache = new Array(); |
| | | self.appMenu = new AppMenu(); |
| | | self.appMenu.init( |
| | | "data/menu/", |
| | | "hauptmenue.json", |
| | | "data/tpl/app-menu.tpl", |
| | | ".west", |
| | | "8em"); |
| | | |
| | | document.querySelector('.hamburger').addEventListener('click', function (e) { |
| | | self.menue_umschalten(); |
| | | }); |
| | | |
| | | self.addEvtListener('#mi-katalog', 'click', self.media_liste); |
| | | self.addEvtListener('#mi-orte', 'click', self.ablageort_liste); |
| | | self.addEvtListener('#mi-prefs', 'click', self.prefs_liste); |
| | | self.addEvtListener('#mi-player', 'click', self.abspieler_liste); |
| | | |
| | | self.fusszeile_umschalten(); |
| | | self.seitenleiste_umschalten(); |
| | | self.dialog_unten_zeigen(); |
| | | }; |
| | | |
| | | this.abspieler_auswahl_fuellen = function() { |
| | | self.http_get('../api/store/Abspieler/', function (responseText) { |
| | | /* |
| | | {"ArrayList": [{"name":"Wohnz","url":"http://rpi4-wz:9090/"},{"name":"Arbz","url":"http://rpi4-az:9090/"}]} |
| | | */ |
| | | self.vorlage_laden_und_fuellen("data/tpl/abs_sel.tpl", JSON.parse(responseText), function (html) { |
| | | document.querySelector(".abs-sel").innerHTML = html; |
| | | }); |
| | | }); |
| | | }; |
| | | |
| | | /* Unterer Einblendbereich */ |
| | | |
| | | this.dialog_unten_zeigen = function() { |
| | | self.vorlage_laden_und_fuellen("data/tpl/ctrl.tpl", "", function (html) { |
| | | var dlg = document.querySelector(".dialog-unten"); |
| | | dlg.style.height = '4.5em'; |
| | | dlg.innerHTML = html; |
| | | self.abspieler_auswahl_fuellen(); |
| | | }); |
| | | }; |
| | | |
| | | |
| | | // auf der obersten Ebene werden die Kataloge angezeigt, |
| | | // darunter der Inhalt des aktuellen Pfades |
| | | this.media_liste = function() { |
| | | if(self.ortPfad === '/') { |
| | | // Kataloge listen |
| | | self.http_get('../api/store/Ablageort/', function (responseText) { |
| | | self.http_get('../api/store/Ablageort/liste/', function (responseText) { |
| | | self.vorlage_laden_und_fuellen("data/tpl/katalog_root_liste.tpl", JSON.parse(responseText), function (html) { |
| | | document.querySelector(".zentraler-inhalt").innerHTML = html; |
| | | self.addEvtListener('.entity-eintrag', 'click', function (event) { |
| | |
| | | /* Die folgenden '_liste' Funktionen koennen noch vereinheitlicht werden */ |
| | | |
| | | this.ablageort_liste = function() { |
| | | self.http_get('../api/store/Ablageort/', function (responseText) { |
| | | self.http_get('../api/store/Ablageort/liste/', function (responseText) { |
| | | self.vorlage_laden_und_fuellen("data/tpl/ablageort_liste.tpl", JSON.parse(responseText), function (html) { |
| | | document.querySelector(".zentraler-inhalt").innerHTML = html; |
| | | self.addEvtListener('.entity-eintrag', 'click', function (event) { |
| | |
| | | }; |
| | | |
| | | this.prefs_liste = function() { |
| | | self.http_get('../api/store/Einstellung/', function (responseText) { |
| | | self.http_get('../api/store/Einstellung/liste/', function (responseText) { |
| | | self.vorlage_laden_und_fuellen("data/tpl/einstellung_liste.tpl", JSON.parse(responseText), function (html) { |
| | | document.querySelector(".zentraler-inhalt").innerHTML = html; |
| | | self.addEvtListener('.entity-eintrag', 'click', function (event) { |
| | |
| | | }; |
| | | |
| | | this.abspieler_liste = function() { |
| | | self.http_get('../api/store/Abspieler/', function (responseText) { |
| | | self.http_get('../api/store/Abspieler/liste/', function (responseText) { |
| | | self.vorlage_laden_und_fuellen("data/tpl/abspieler_liste.tpl", JSON.parse(responseText), function (html) { |
| | | document.querySelector(".zentraler-inhalt").innerHTML = html; |
| | | self.addEvtListener('.entity-eintrag', 'click', function (event) { |
| | |
| | | |
| | | // document.querySelectorAll(selector).forEach(elem => { elem.addEventListener(eventName, func); }); |
| | | |
| | | /* asynchroner HTTP Client */ |
| | | /* --------------------- asynchroner HTTP Client ----------------- */ |
| | | |
| | | this.http_get = function (u, cb) { |
| | | self.http_call('GET', u, null, cb); |
| | |
| | | } |
| | | }; |
| | | |
| | | /* Unterer Einblendbereich */ |
| | | |
| | | self.dialog_unten_zeigen = function() { |
| | | self.vorlage_laden_und_fuellen("data/tpl/ctrl.tpl", "", function (html) { |
| | | var dlg = document.querySelector(".dialog-unten"); |
| | | dlg.style.height = '4.5em'; |
| | | dlg.innerHTML = html; |
| | | }); |
| | | }; |
| | | |
| | | /* ab hier aus App-Vorlage */ |
| | | |
| | | this.init = function () { |
| | | //self.vorlagen = new Vorlagen(); |
| | | self.mediaPfad = '/'; |
| | | self.ortPfad = '/'; |
| | | self.cache = new Array(); |
| | | self.appMenu = new AppMenu(); |
| | | self.appMenu.init( |
| | | "data/menu/", |
| | | "hauptmenue.json", |
| | | "data/tpl/app-menu.tpl", |
| | | ".west", |
| | | "8em"); |
| | | |
| | | document.querySelector('.hamburger').addEventListener('click', function (e) { |
| | | self.menue_umschalten(); |
| | | }); |
| | | |
| | | self.addEvtListener('#mi-katalog', 'click', self.media_liste); |
| | | self.addEvtListener('#mi-orte', 'click', self.ablageort_liste); |
| | | self.addEvtListener('#mi-prefs', 'click', self.prefs_liste); |
| | | self.addEvtListener('#mi-player', 'click', self.abspieler_liste); |
| | | //self.addEvtListener('#mi-list', 'click', self.media_liste); |
| | | |
| | | self.fusszeile_umschalten(); |
| | | self.seitenleiste_umschalten(); |
| | | self.dialog_unten_zeigen(); |
| | | }; |
| | | /* ------------------------ aus App-Vorlage ------------------- */ |
| | | |
| | | this.menue_umschalten = function () { |
| | | var ham = document.querySelector(".hamburger"); |
| | |
| | | }, timeout); |
| | | }; |
| | | |
| | | /* Dialog-Funktionen */ |
| | | /* --------------------- Dialog-Funktionen ------------------------ */ |
| | | |
| | | /* |
| | | Einen Dialog aus Vorlagen erzeugen |
| | |
| | | }); |
| | | }; |
| | | |
| | | self.dialog_schliessen = function () { |
| | | this.dialog_schliessen = function () { |
| | | document.querySelector('.close-btn').removeEventListener('click', self.dialog_schliessen); |
| | | var dlg = document.querySelector('.dialog'); |
| | | dlg.style.height = '0'; |
| | | dlg.innerHTML = ''; |
| | | }; |
| | | |
| | | /* Vorlagen */ |
| | | /* --------------------- Vorlagen ---------------------- */ |
| | | |
| | | /* |
| | | Das HTML erzeugen, das entsteht, wenn eine Vorlage mit Inhalt |
| | |
| | | |
| | | } |
| | | |
| | | /* ----------- Objekte ---------------- */ |
| | | |
| | | function Ablageort(n, o, u) { |
| | | this.name = n; |
| | | this.ort = o; |
| | | this.url = u; |
| | | } |
| | | |
| | | function Einstellung(k, v) { |
| | | this.key = k; |
| | | this.value = v; |
| | | } |
| | | |
| | | function Abspieler(n, u) { |
| | | this.name = n; |
| | | this.url = u; |
| | | } |
| | | |