From bc2128742e16559eaba80b958edf6c90ba29fadf Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Sat, 4 Mar 2023 12:25:09 +0000 Subject: [PATCH] Prettified Code! --- gui/preload-chat.js | 16 +++++++--------- gui/src/chat-module.html | 11 ++++------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/gui/preload-chat.js b/gui/preload-chat.js index 33e17fce..ca514ed8 100644 --- a/gui/preload-chat.js +++ b/gui/preload-chat.js @@ -2087,17 +2087,15 @@ ipcRenderer.on("update-config", (event, data) => { config = data; }); - - // https://stackoverflow.com/a/18650828 function formatBytes(bytes, decimals = 2) { - if (!+bytes) return '0 Bytes' + if (!+bytes) return "0 Bytes"; - const k = 1024 - const dm = decimals < 0 ? 0 : decimals - const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] + const k = 1024; + const dm = decimals < 0 ? 0 : decimals; + const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; - const i = Math.floor(Math.log(bytes) / Math.log(k)) + const i = Math.floor(Math.log(bytes) / Math.log(k)); - return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}` -} \ No newline at end of file + return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`; +} diff --git a/gui/src/chat-module.html b/gui/src/chat-module.html index 33f1f40a..5f64f0b6 100644 --- a/gui/src/chat-module.html +++ b/gui/src/chat-module.html @@ -626,16 +626,13 @@ > - - -