diff --git a/webassets/js/spots.js b/webassets/js/spots.js index 2f03065..f923260 100644 --- a/webassets/js/spots.js +++ b/webassets/js/spots.js @@ -182,9 +182,6 @@ function createNewTableRowsForSpot(s, highlightNew) { // Create row let $tr = $(''); - if (highlightNew) { - $tr.addClass("new"); - } // Apply striping to the table. We can't just use Bootstrap's table-striped class because we have all sorts of // extra faff to deal with, like the mobile view having extra rows, and the On Now / Next 24h / Later banners @@ -198,6 +195,12 @@ function createNewTableRowsForSpot(s, highlightNew) { $tr.addClass("table-faded"); } + // If we are asked to highlight new rows (i.e. this row is being added "live" via the SSE client and not as a bulk + // reload of the whole table) + if (highlightNew) { + $tr.addClass("new"); + } + // Format a UTC or local time for display var time = moment.unix(s["time"]).utc(); if (useLocalTime) { @@ -341,12 +344,18 @@ function createNewTableRowsForSpot(s, highlightNew) { // Second row for mobile view only, containing type, ref & comment $tr2 = $(""); + + // Apply styles as per the first row if (rowCount % 2 == 1) { $tr2.addClass("table-active"); } if (s["qrt"] == true) { $tr2.addClass("table-faded"); } + if (highlightNew) { + $tr.addClass("new"); + } + $td2 = $(""); if (showType) { $td2.append(` ${typeText} `);