commit 26/01/2026

This commit is contained in:
2026-01-26 17:26:06 +07:00
parent 8744a47cb3
commit b04e168b9a

View File

@@ -49,8 +49,7 @@ function getCardByIndex(index) {
* @param {StreamerOutputData[]} values
*/
function UpdateStreamerCard(values) {
if (!Array.isArray(values) || values.length === 0) return;
function setProgress(index, $bar, value, max = 100) {
const v = Number(value ?? 0);
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
.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++) {
let vv = values.find(v => v.index === i);
let card = getCardByIndex(i);
@@ -461,7 +465,6 @@ $(document).ready(function () {
* @type {StreamerOutputData[]}
*/
let so = JSON.parse(data);
console.log(so);
UpdateStreamerCard(so);
break;
}