#Apps
<script type="text/template" id="app-template">
Description: {app_description}
Last update (UTC): {app_update}
Maintainer: {app_maintainer} ({app_mail})
Git: {app_git} ({app_branch})
Documentation
</script>
<script>
function timeConverter(UNIX_timestamp) {
var a = new Date(UNIX_timestamp*1000);
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
var year = a.getFullYear();
var month = months[a.getMonth()];
var date = a.getDate();
var hour = a.getHours();
var min = a.getMinutes();
if (hour < 10) { hour = '0' + hour; }
if (min < 10) { min = '0' + min; }
var time = date+' '+month+' '+year+' at '+hour+':'+min;
return time;
}
$(document).ready(function () {
$.getJSON('/list.json', function(app_list) {
console.log(app_list);
$.each(app_list, function(app_id, infos) {
html = $('#app-template').html()
.replace(/{app_id}/g, app_id)
.replace(/{app_name}/g, infos.manifest.name)
.replace('{app_description}', infos.manifest.description.en)
.replace('{app_maintainer}', infos.manifest.developer.name)
.replace('{app_mail}', infos.manifest.developer.email)
.replace('{app_git}', infos.git.url)
.replace('{app_branch}', infos.git.branch)
.replace('{app_update}', timeConverter(infos.lastUpdate));
$('#app-accordion').append(html);
$('.app_'+ app_id).attr('id', 'app_'+ app_id);
});
});
});
</script>