Bedienoberfläche für Webradio
ulrich
2018-01-03 9f0d54067fefd1d3c9c6babf425d3d3a443eeccc
commit | author | age
623a61 1 var TPL_HOME = 'home';
U 2 var TPL_PREFS = 'prefs';
47a970 3 var TPL_SENDER = 'sender';
U 4 var templateCache = {}; // mustache templates 'home', 'prefs', 'sender'
623a61 5 var prefsRendered = false;
U 6
7 function app_init() {
9f0d54 8   $('.dialog').hide();
623a61 9   $('.ost').hide();
851c9c 10   app_menu_init("menu/", "hauptmenue.json", "../jslib/app-menu/app-menu.tpl", ".west");
47a970 11   app_get_template('tpl/sender.tpl', TPL_SENDER);
623a61 12   //app_get_template('tpl/prefs.tpl', 'prefs');
U 13   $('.sued').text('Bereit.');
14   setTimeout(function() {
a480d0 15     app_get_sender();
623a61 16   }, 200);
47a970 17 }
U 18
9f0d54 19 function app_nachricht_test() {
U 20   $('.dialog').slideDown(300);
21
22 }
23
47a970 24 /* --- Ajax-Aufrufe --- */
U 25
a480d0 26 function app_get_sender() {
U 27   $.ajax({
28     url: "api/sender.json",
29     type: "GET",
30     dataType : "json"
31   }).done(function( senderliste ) {
32     $("#sender").html(Mustache.render(templateCache[TPL_SENDER], senderliste));
33   });
34 }
35
47a970 36 /*
U 37   Ein Template vom Server in den Cache laden
38   template_url - home.tpl, prefs.tpl, sender.tpl
39   tname - 'home', 'prefs', 'sender'
40 */
41 function app_get_template(template_url, tname) {
42   $.ajax({
43     url: template_url,
44     type: "GET",
45     dataType : "text"
46   }).done(function( template ) {
47     templateCache[tname] = template;
48   });
623a61 49 }