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() { |
|
8 |
$('.ost').hide(); |
851c9c
|
9 |
app_menu_init("menu/", "hauptmenue.json", "../jslib/app-menu/app-menu.tpl", ".west"); |
47a970
|
10 |
app_get_template('tpl/sender.tpl', TPL_SENDER); |
623a61
|
11 |
//app_get_template('tpl/prefs.tpl', 'prefs'); |
U |
12 |
$('.sued').text('Bereit.'); |
|
13 |
setTimeout(function() { |
47a970
|
14 |
$("#sender").html(Mustache.render(templateCache[TPL_SENDER], '')); |
623a61
|
15 |
}, 200); |
47a970
|
16 |
} |
U |
17 |
|
|
18 |
/* --- Ajax-Aufrufe --- */ |
|
19 |
|
|
20 |
/* |
|
21 |
Ein Template vom Server in den Cache laden |
|
22 |
template_url - home.tpl, prefs.tpl, sender.tpl |
|
23 |
tname - 'home', 'prefs', 'sender' |
|
24 |
*/ |
|
25 |
function app_get_template(template_url, tname) { |
|
26 |
$.ajax({ |
|
27 |
url: template_url, |
|
28 |
type: "GET", |
|
29 |
dataType : "text" |
|
30 |
}).done(function( template ) { |
|
31 |
templateCache[tname] = template; |
|
32 |
}); |
623a61
|
33 |
} |