Difference between revisions of "Widget:MerlinProficiencyProgress"
From Coder Merlin
(Created page with "<noinclude> Runs the JavaScript for the progress HTML table. </noinclude> <includeonly> <script> // Wait for the other scripts to be ready because we need jQuery window.addEv...") |
|||
Line 186: | Line 186: | ||
// 4 because a percentage is a decimal anyways | // 4 because a percentage is a decimal anyways | ||
const pct = parseFloat(stage.pct).toFixed(4); | const pct = parseFloat(stage.pct).toFixed(4); | ||
// Background color for the cell | |||
let backgroundColor = `rgb(0, ${greenColor}, 0)`; | |||
// If not complete, the background should be blue | |||
if (pct < 1.0) { | |||
backgroundColor = "rgb(0, 167, 225)"; | |||
} | |||
// Append | // Append | ||
Line 193: | Line 201: | ||
attributes: { | attributes: { | ||
//style: `background-color: ${(stage.date) ? `rgb(0, ${greenColor}, 0)` : 'lightgray'}; text-align: center;`, | //style: `background-color: ${(stage.date) ? `rgb(0, ${greenColor}, 0)` : 'lightgray'}; text-align: center;`, | ||
style: `background-image: linear-gradient(to right | style: `background-image: linear-gradient(to right, ${backgroundColor} ${pct * 100}%, lightgray 0%); text-align: center;` | ||
} | } | ||
}); | }); |
Revision as of 22:35, 25 November 2021
Runs the JavaScript for the progress HTML table.