diff --git a/public/index.html b/public/index.html index e88d7b0..0c68e23 100644 --- a/public/index.html +++ b/public/index.html @@ -15,22 +15,27 @@
-
+
Today:
-
-
SMS.ru
-
-
-
-
+
+
+

SMS.ru

+
-
- +
+
ΠšΠΎΠ»ΠΈΡ‡Π΅ΡΡ‚Π²ΠΎ SMS
+

+

+
+
+

diff --git a/public/js/app.js b/public/js/app.js index 6d4c9e4..312b09e 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -20,11 +20,16 @@ function smsruUpdateMessages() { fetch('/api/v1.0/smsru_status') .then(response => response.json()) .then(data => { + if (data.used_today === null) data.used_today = 0; + smsProgress.setAttribute('aria-valuenow', data.used_today); smsProgress.setAttribute('aria-valuemax', data.total_free); - smsProgress.setAttribute('style', `width: ${data.used_today / data.total_free * 100}%`); + if (data.used_today > 0) { + smsProgress.setAttribute('style', `width: ${data.total_free / data.used_today}%`); + } + else { + smsProgress.setAttribute('style', `width: 100%`); + } smsProgress.innerText = `Π›ΠΈΠΌΠΈΡ‚: ${data.used_today} ΠΈΠ· ${data.total_free}`; }); - - // console.log(smsProgress); }