APmanageur Wi-Fi V1.0
This commit is contained in:
1 parent
d2a837ea17
commit
ecef92e558
1 file changed
+19
-5
+19
-5
@@ -9133,12 +9133,26 @@ ${vpnBadgeTopo}
|
|||||||
const usageStr = lim.usage_bytes_str || formatBytes(usageBytes);
|
const usageStr = lim.usage_bytes_str || formatBytes(usageBytes);
|
||||||
|
|
||||||
let qVal = parseFloat($('inputQuotaValue') ? $('inputQuotaValue').value : 0) || 0;
|
let qVal = parseFloat($('inputQuotaValue') ? $('inputQuotaValue').value : 0) || 0;
|
||||||
const qUnit = $('selectQuotaUnit') ? $('selectQuotaUnit').value : 'GB';
|
const unit = $('selectQuotaUnit') ? $('selectQuotaUnit').value : 'GB';
|
||||||
const qBytes = qUnit === 'GB' ? Math.round(qVal * 1073741824) : Math.round(qVal * 1048576);
|
let mult = 1073741824;
|
||||||
|
if (unit === 'MB') mult = 1048576;
|
||||||
|
else if (unit === 'TB') mult = 1099511627776;
|
||||||
|
const quotaBytes = qVal * mult;
|
||||||
|
|
||||||
const exceeded = qBytes > 0 && usageBytes >= qBytes;
|
const period = $('selectQuotaPeriod') ? $('selectQuotaPeriod').value : 'total';
|
||||||
const pct = qBytes > 0 ? Math.min(100, Math.round((usageBytes / qBytes) * 100)) : 0;
|
const periodLabels = { total: 'Total', monthly: 'Ce mois-ci', weekly: 'Cette semaine', daily: "Aujourd'hui" };
|
||||||
const remaining = Math.max(0, qBytes - usageBytes);
|
const pLabel = periodLabels[period] || period;
|
||||||
|
|
||||||
|
if ($('quotaUsageSummaryText')) {
|
||||||
|
$('quotaUsageSummaryText').textContent = `${usageStr} consommés (${pLabel})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
let pct = 0;
|
||||||
|
if (quotaBytes > 0) {
|
||||||
|
pct = Math.min(100, Math.round((usageBytes / quotaBytes) * 100));
|
||||||
|
}
|
||||||
|
const remaining = Math.max(0, quotaBytes - usageBytes);
|
||||||
|
const exceeded = (quotaBytes > 0 && usageBytes >= quotaBytes);
|
||||||
|
|
||||||
if ($('quotaUsageBar')) {
|
if ($('quotaUsageBar')) {
|
||||||
$('quotaUsageBar').style.width = `${pct}%`;
|
$('quotaUsageBar').style.width = `${pct}%`;
|
||||||
|
|||||||
Reference in new issue
Block a user