15 lines
728 B
JavaScript
15 lines
728 B
JavaScript
// Gold / silver / bronze medal for places 1-3 in result tables (also A1-A3 in the finals);
|
|
// other places stay as they are. The medal still holds the text, so CSV, sorting and the print
|
|
// table decoration keep working.
|
|
export function medal(pos) {
|
|
const value = String(pos ?? "").trim();
|
|
const place = /^A?([1-3])$/.exec(value)?.[1];
|
|
return place ? `<span class="medal medal-${place}">${value}</span>` : value;
|
|
}
|
|
|
|
// The driver's qualifying place next to a final result; the top qualifier gets a "TQ" badge.
|
|
export function qualCell(qual, escapeHtml) {
|
|
const value = String(qual || "").trim();
|
|
return `<td class="qual-cell">${value === "TQ" ? '<span class="tq-badge">TQ</span>' : escapeHtml(value || "-")}</td>`;
|
|
}
|