This effect highlights discards in the series summary tables. The default colour is a light grey but the user can change the colour as required by editing the source.
It can be downloaded from Here
This effect highlights discards in the series summary tables. The default colour is a light grey but the user can change the colour as required by editing the source.
It can be downloaded from Here
The discard highlight leaves some discarded races without the highlight. The sea foam green cells are the discards the script highlighted. But you will see a few other discards that were skipped.
I’m running Sailwave on an old MacBook Air under Wine Devel.
Could you send the htm / html file or a link to where it is posted?
The adding of the shading is done by the viewing browser so if there is an issue then it is most likely the browser being used for viewing have you tried a different modern browser?
This does not work when publishing scored groups with different # of races where the first group has less races than others. It will only highlight discards in the first X races, where X is the number of races sailed by the first group. Ex: Keelboat I sails 10 races, Keelboat II sails 12 races. A boat in Keelboat II has a discarded race in race 11 or 12. You publish a combined score with both Keelboat I and Keelboat II.
The fix is to use the following edited script. Adding a for loop around building array of columns and adding the summaryRace class to race result cells, so it’s done individually for each summary table.
——
$(document).ready(function() {
var discardSelector = ‘.summaryrace’;
var discardText = /\b\)/;
// Edit these colours to change the highlight colours for 1st, 2nd and 3rd
var discardColour = ‘#f2f2f2’;
// create array of race column numbers for each summary table (summarytable)
var summaryTables = document.getElementsByClassName(‘summarytable’);
for (var j=0; j < summaryTables.length; j++) {
var summaryTable=summaryTables[j];
var ths = summaryTable.getElementsByTagName('col');
var column =[];
for (var i=0; i<ths.length; i++) {
if (ths[i].classList[0] === "race") {
column.push(i);
} else {
if (column.length !=0) {
break;
}
}
}
//console.log(column);
// Set a class of summaryrace for all race cells in summary table body
//
for (var i=0; i<column.length; i++) {
$(".summarytable tbody tr td:nth-child(" + (column[i]+1) +")").addClass("summaryrace");
}
}
// Change the background color for cells with class of summaryrace and that match regular expression text
$(function () {
$(discardSelector).filter(function() {
return discardText.test($(this).text());
}).css("background", discardColour);
});
});