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() { |
131c8e
|
20 |
$(".close-btn").on('click', function() { |
U |
21 |
$('.close-btn').attr('onclick','').unbind('click'); |
|
22 |
$('.dialog').slideUp(300); |
|
23 |
}); |
9f0d54
|
24 |
$('.dialog').slideDown(300); |
U |
25 |
} |
|
26 |
|
47a970
|
27 |
/* --- Ajax-Aufrufe --- */ |
U |
28 |
|
a480d0
|
29 |
function app_get_sender() { |
U |
30 |
$.ajax({ |
|
31 |
url: "api/sender.json", |
|
32 |
type: "GET", |
|
33 |
dataType : "json" |
|
34 |
}).done(function( senderliste ) { |
|
35 |
$("#sender").html(Mustache.render(templateCache[TPL_SENDER], senderliste)); |
|
36 |
}); |
|
37 |
} |
|
38 |
|
47a970
|
39 |
/* |
U |
40 |
Ein Template vom Server in den Cache laden |
|
41 |
template_url - home.tpl, prefs.tpl, sender.tpl |
|
42 |
tname - 'home', 'prefs', 'sender' |
|
43 |
*/ |
|
44 |
function app_get_template(template_url, tname) { |
|
45 |
$.ajax({ |
|
46 |
url: template_url, |
|
47 |
type: "GET", |
|
48 |
dataType : "text" |
|
49 |
}).done(function( template ) { |
|
50 |
templateCache[tname] = template; |
|
51 |
}); |
623a61
|
52 |
} |