From: Jo-Philipp Wich Date: Fri, 8 Oct 2021 18:52:52 +0000 (+0200) Subject: luci-base: cbi.js: use IEC 80000-13 units to format base 2 byte values X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=0a31efc858b02cd5aa9f38c1b5b40a9a14a61c1a;p=openwrt-luci.git luci-base: cbi.js: use IEC 80000-13 units to format base 2 byte values Fixes: #5354 Signed-off-by: Jo-Philipp Wich --- diff --git a/modules/luci-base/htdocs/luci-static/resources/cbi.js b/modules/luci-base/htdocs/luci-static/resources/cbi.js index 9728e03e12..aef64d577e 100644 --- a/modules/luci-base/htdocs/luci-static/resources/cbi.js +++ b/modules/luci-base/htdocs/luci-static/resources/cbi.js @@ -657,7 +657,11 @@ String.prototype.format = function() for (i = 0; (i < units.length) && (val > mf); i++) val /= mf; - subst = (i ? val.toFixed(pr) : val) + units[i]; + if (i) + subst = val.toFixed(pr) + units[i] + (mf == 1024 ? 'i' : ''); + else + subst = val + ' '; + pMinLength = null; break; }