Update VodafoneDE.js

This commit is contained in:
Chaos53925 2023-09-21 05:46:30 +02:00
parent 84e84bd29b
commit 889b5f2bf4

View file

@ -429,7 +429,7 @@ function getDiagram(percentage, isFlat) {
canvas.setTextAlignedCenter() canvas.setTextAlignedCenter()
canvas.setTextColor(textColor) canvas.setTextColor(textColor)
canvas.setFont(Font.boldSystemFont(canvTextSize)) canvas.setFont(Font.boldSystemFont(canvTextSize))
if (isFlat === true) { if (isFlat) {
const infinitySize = canvSize / 2; const infinitySize = canvSize / 2;
canvas.setFont(Font.boldSystemFont(infinitySize)); canvas.setFont(Font.boldSystemFont(infinitySize));
const verticalPosition = config.widgetFamily === "small" || "medium" || "large" || "extraLarge" ? infinitySize / 3 : infinitySize / 1; const verticalPosition = config.widgetFamily === "small" || "medium" || "large" || "extraLarge" ? infinitySize / 3 : infinitySize / 1;
@ -458,28 +458,24 @@ function getTimeRemaining(endtime) {
} }
function getTotalValues(v) { function getTotalValues(v) {
let totalValues; const unitOfMeasure = descriptionMapping[v.unitOfMeasure] || v.unitOfMeasure;
if (v.unitOfMeasure !== 'MB') { const remainingOrUsed = showRemainingContingent ? v.remaining : v.used;
totalValues = `${(showRemainingContingent ? v.remaining : v.used)} ${descriptionMapping[v.unitOfMeasure] !== undefined ? descriptionMapping[v.unitOfMeasure] : v.unitOfMeasure} von ${v.total} ${descriptionMapping[v.unitOfMeasure] !== undefined ? descriptionMapping[v.unitOfMeasure] : v.unitOfMeasure}` const total = parseInt(v.total);
} else if (parseInt(v.total) < 1000) {
totalValues = `${(showRemainingContingent ? v.remaining : v.used)} MB von ${v.total} MB` if (v.unitOfMeasure !== 'MB' || total < 1024) {
} else if (parseInt(v.total) >= 100000000) { return `${remainingOrUsed} ${unitOfMeasure} von ${total} ${unitOfMeasure}`;
if (showRemainingContingent === true) { } else if (total >= 100000000) {
totalValues = `Flat` if (showRemainingContingent) {
return 'Flat';
} else { } else {
if (v.used <= 1024) { const usedValue = v.used <= 1024 ? `${v.used} MB` : `${(v.used / 1024).toFixed(2)} GB`;
totalValues = `${v.used} MB verbraucht` return `${usedValue} verbraucht`;
} else {
let usedGB = (v.used / 1024).toFixed(2)
totalValues = `${usedGB} GB verbraucht`
}
} }
} else { } else {
let GB = ((showRemainingContingent ? v.remaining : v.used) / 1024).toFixed(2) const GB = (remainingOrUsed / 1024).toFixed(2);
let totalGB = (v.total / 1024).toFixed(2) const totalGB = (total / 1024).toFixed(2);
totalValues = `${GB} GB von ${totalGB} GB` return `${GB} GB von ${totalGB} GB`;
} }
return totalValues
} }
async function getSessionCookiesViaNetworkLogin() { async function getSessionCookiesViaNetworkLogin() {