| | |
| | | var cache; // mustache templates |
| | | var ortPfad; |
| | | var mediaPfad; |
| | | var katUrl; |
| | | var selTitel; |
| | | //var katUrl; |
| | | //var selTitel; |
| | | var katName; |
| | | |
| | | this.init = function () { |
| | |
| | | self.seitenleiste_umschalten(); |
| | | self.dialog_unten_zeigen(); |
| | | }; |
| | | |
| | | |
| | | /* ---------------- Entitaets-Listen ----------------- */ |
| | | |
| | | this.livestream_selection = function() { |
| | |
| | | self.mediaPfad = neuerPfad; |
| | | self.media_liste(); |
| | | }); |
| | | var url = self.ortPfad + self.mediaPfad; |
| | | //var url = '/tango' + self.ortPfad + self.mediaPfad; |
| | | var url = '.' + self.ortPfad + self.mediaPfad; |
| | | if(!url.endsWith('/')) { |
| | | url = url + '/'; |
| | | } |
| | |
| | | self.addEvtListener('#plst-btn', 'click', self.titel_liste); |
| | | self.addEvtListener('#live-btn', 'click', self.livestream_selection); |
| | | self.addEvtListener('#switch-btn', 'click', self.geraet_schalt_liste); |
| | | |
| | | |
| | | self.addEvtListener('#voldn-btn', 'click', function() { |
| | | self.kommando('voldn'); |
| | | }); |
| | | self.addEvtListener('#volup-btn', 'click', function() { |
| | | self.kommando('volup'); |
| | | }); |
| | | |
| | | self.media_liste(); |
| | | }); |
| | | }; |
| | |
| | | this.kommando = function(kommando) { |
| | | var abs = document.querySelector('#abspieler').value; |
| | | self.http_get('api/strg/' + abs + '/' + kommando, function(responseText) { |
| | | self.meldung_mit_timeout(responseText, 1500); |
| | | if(kommando !== 'volup' && kommando !== 'voldn') { |
| | | self.meldung_mit_timeout(responseText, 1500); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | |
| | | console.log('url: ' + url); |
| | | //window.open(url); |
| | | }; |
| | | |
| | | this.gehe_zu_dialog_zeigen = function () { |
| | | self.dialog_laden_und_zeigen('data/tpl/gehe-zu.txt', '', function(){ |
| | | const form = document.querySelector('form'); |
| | | form.addEventListener('submit', function(event) { |
| | | // hier gehe zu realisieren |
| | | event.preventDefault(); |
| | | const data = new FormData(event.target); |
| | | const value = Object.fromEntries(data.entries()); |
| | | var daten = JSON.stringify(value); |
| | | console.log('gehe zu mit ' + daten); |
| | | var sekunden = (value['std'] * 3600) + (value['min'] * 60) + (value['sek'] * 1); |
| | | if(value['richtung'] === 'zurueck') { |
| | | sekunden *= -1; |
| | | } |
| | | console.log('sekunden: ' + sekunden); |
| | | self.dialog_schliessen(); |
| | | // HTTP GET /mz/api/strg/abspieler/seek/[sekunden] |
| | | self.kommando('seek/' + sekunden); |
| | | }); |
| | | self.addEvtListener('#cancel-btn', 'click', function(event) { |
| | | self.dialog_schliessen(); |
| | | }); |
| | | self.menue_umschalten(); |
| | | }); |
| | | }; |
| | | |
| | | /* ------------- Verwaltungsfunktionen Abspielliste -------------------- */ |
| | | |
| | |
| | | self.http_call('DELETE', u, data, cb); |
| | | }; |
| | | |
| | | this.http_call = function (method, u, data, scallback) { |
| | | this.http_call = function (method, callurl, data, scallback) { |
| | | var xhr = new XMLHttpRequest(); |
| | | var url = u; |
| | | xhr.onreadystatechange = function () { |
| | | if (this.readyState === 4 && this.status === 200) { |
| | | scallback(this.responseText); |
| | | } |
| | | }; |
| | | xhr.open(method, url); |
| | | xhr.open(method, callurl); |
| | | if (method === 'GET') { |
| | | xhr.send(); |
| | | } else if (method === 'POST' || method === 'PUT' || method === 'DELETE') { |