Skip to content
Snippets Groups Projects
Commit 7f55b2ec authored by root's avatar root
Browse files

reload fur mensa foo:

parent 7246275b
No related branches found
No related tags found
No related merge requests found
this.loaded = function(panel, config) {
setInterval(function(){getMensaPlan();}, 1800000);
function getMensaPlan() {
$.getJSON( "panels/mensaPlan/mensaPlan.json")
.done(function( json ) {
console.log( "JSON Data: " + json.montag.gerichte );
fillTable(json);
})
.fail(function( jqxhr, textStatus, error ) {
......@@ -15,7 +14,32 @@ this.loaded = function(panel, config) {
function fillTable( json ) {
var tableBody = document.getElementById("mensaPlanTableBody");
var day = new Date();
switch(day.getDay()){
case 0:
var gerichte = json.sonntag.gerichte;
break;
case 1:
var gerichte = json.montag.gerichte;
break;
case 2:
var gerichte = json.dienstag.gerichte;
break;
case 3:
console.log("BLA");
var gerichte = json.mittwoch.gerichte;
break;
case 4:
var gerichte = json.donnerstag.gerichte;
break;
case 5:
var gerichte = json.freitag.gerichte;
break;
case 6:
var gerichte = json.samstag.gerichte;
break;
}
tableBody.innerHtml = "";
for(var i=0;i<gerichte.length;i++){
var gericht = gerichte [i];
var row = tableBody.insertRow(i);
......@@ -29,5 +53,4 @@ this.loaded = function(panel, config) {
}
getMensaPlan();
fillTable();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment