Skip to content

Commit 0666407

Browse files
committed
Have NextDue() take a class name, not status code
This will help with scoping issues later with the new_board = EMPTY_ROW check.
1 parent 46f2d99 commit 0666407

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎js/solari.js‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ var Status = {
6161
};
6262

6363
var LAST_STATUS = 4;
64-
var NextDueStatus = [null, "soon", "null", "overdue", null];
64+
var NextDueStatus = ["", "soon", "null", "overdue", ""];
6565
var solari_setup_done = 0;
6666
var failboard = false;
6767
var syncing = false;
@@ -204,11 +204,10 @@ function addSolariBoard(divSelector) {
204204
updateSolariBoard();
205205
}
206206

207-
function NextDue(id, time, offset, status) {
207+
function NextDue(id, time, offset, add_class) {
208208
$(id + ' .today').html(offset);
209209
$(id + ' .clock').html(time);
210-
$(id + ' .inner').attr('class', 'inner'); // get rid of any existing classes
211-
$(id + ' .inner').addClass(new_board[0] === EMPTY_ROW ? "later" : NextDueStatus[status]); // add the appropriate class based on status. If no data, green.
210+
$(id + ' .inner').attr('class', 'inner ' + add_class); // reset the applied classes
212211
}
213212

214213
function UpdateSolariRow(row, current_row, new_row) {
@@ -381,15 +380,16 @@ function updateSolariBoard() {
381380
}
382381
}
383382
}
384-
var status = next_due_row.nStatus;
383+
// add the appropriate class based on status. If no data, green.
384+
var status_class = (new_board[0] === EMPTY_ROW ? "later" : NextDueStatus[next_due_row.nStatus])
385385
time = (time === "") ? "00:00" : time;
386-
NextDue("#next-due", time, sOffset, status);
386+
NextDue("#next-due", time, sOffset, status_class);
387387
$("ul.solari-board-columns li.departure").text("Departure");
388388
} else {
389389
//failed to get data
390390
new_board = GetFailBoard();
391391
$("ul.solari-board-columns li.departure").text("FAIL WHALE");
392-
NextDue("#next-due", '-FA1L-', '', 1);
392+
NextDue("#next-due", '-FA1L-', '', '');
393393
}
394394

395395
// update each row on the board

0 commit comments

Comments
 (0)