commit 26/01/2026
This commit is contained in:
@@ -49,8 +49,7 @@ function getCardByIndex(index) {
|
|||||||
* @param {StreamerOutputData[]} values
|
* @param {StreamerOutputData[]} values
|
||||||
*/
|
*/
|
||||||
function UpdateStreamerCard(values) {
|
function UpdateStreamerCard(values) {
|
||||||
if (!Array.isArray(values) || values.length === 0) return;
|
|
||||||
|
|
||||||
function setProgress(index, $bar, value, max = 100) {
|
function setProgress(index, $bar, value, max = 100) {
|
||||||
const v = Number(value ?? 0);
|
const v = Number(value ?? 0);
|
||||||
const pct = Math.max(0, Math.min(100, Math.round((v / max) * 100)));
|
const pct = Math.max(0, Math.min(100, Math.round((v / max) * 100)));
|
||||||
@@ -60,6 +59,11 @@ function UpdateStreamerCard(values) {
|
|||||||
.css('width', pct + '%') // visual width
|
.css('width', pct + '%') // visual width
|
||||||
.text(pct); // optional label
|
.text(pct); // optional label
|
||||||
}
|
}
|
||||||
|
if (!Array.isArray(values) || values.length === 0) {
|
||||||
|
// create dummy data to disable all cards
|
||||||
|
values = [];
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 1; i <= 64; i++) {
|
for (let i = 1; i <= 64; i++) {
|
||||||
let vv = values.find(v => v.index === i);
|
let vv = values.find(v => v.index === i);
|
||||||
let card = getCardByIndex(i);
|
let card = getCardByIndex(i);
|
||||||
@@ -461,7 +465,6 @@ $(document).ready(function () {
|
|||||||
* @type {StreamerOutputData[]}
|
* @type {StreamerOutputData[]}
|
||||||
*/
|
*/
|
||||||
let so = JSON.parse(data);
|
let so = JSON.parse(data);
|
||||||
console.log(so);
|
|
||||||
UpdateStreamerCard(so);
|
UpdateStreamerCard(so);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user