Added some more comments to explain some difficult code

This commit is contained in:
Bram van der Veen 2015-06-16 15:04:07 +02:00
parent fbe683b5b6
commit 1ab02bc6ae

View file

@ -47,11 +47,11 @@ function to_json(page) {
schedule_data[day][hour] = {teacher: [], chamber: [], course: [], changed: []}; schedule_data[day][hour] = {teacher: [], chamber: [], course: [], changed: []};
for (special_hour = 0; special_hour < amount_of_special_hours; special_hour++) { for (special_hour = 0; special_hour < amount_of_special_hours; special_hour++) {
var selected_hour = schedule.find('table').eq(day).find('tr').eq(special_hour).find('td'); var selected_hour = schedule.find('table').eq(day).find('tr').eq(special_hour).find('td');
//Give the value of the schedule hour to the fitting array.
schedule_data[day][hour].teacher[special_hour] = selected_hour.eq(0).html(); schedule_data[day][hour].teacher[special_hour] = selected_hour.eq(0).html();
schedule_data[day][hour].chamber[special_hour] = selected_hour.eq(2).html(); schedule_data[day][hour].chamber[special_hour] = selected_hour.eq(2).html();
schedule_data[day][hour].course[special_hour] = selected_hour.eq(4).html(); schedule_data[day][hour].course[special_hour] = selected_hour.eq(4).html( );
//Check if the hour is 'changed' by the schedule authors, if so set to true.
schedule_data[day][hour].changed[special_hour] = selected_hour.eq(0).attr().class == 'tableCellNew' ? true : false; schedule_data[day][hour].changed[special_hour] = selected_hour.eq(0).attr().class == 'tableCellNew' ? true : false;
} }
} }