Skip to content

Commit

Permalink
Rearrange functions to resolve false conflict.
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewHana committed Mar 17, 2024
1 parent 84fd30f commit ffebbf1
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions radicale/web/internal_data/fn.js
Original file line number Diff line number Diff line change
Expand Up @@ -1336,22 +1336,6 @@ function CreateEditCollectionScene(user, password, collection) {
};
}

/**
* Format bytes to human-readable text.
*
* @param bytes Number of bytes.
*
* @return Formatted string.
*/
function bytesToHumanReadable(bytes, dp=1) {
let isNumber = !isNaN(parseFloat(bytes)) && !isNaN(bytes - 0);
if(!isNumber){
return "";
}
var i = bytes == 0 ? 0 : Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, i)).toFixed(dp) * 1 + ' ' + ['b', 'kb', 'mb', 'gb', 'tb'][i];
}

/**
* Removed invalid HREF characters for a collection HREF.
*
Expand Down Expand Up @@ -1386,6 +1370,22 @@ function isValidHREF(href) {
return true;
}

/**
* Format bytes to human-readable text.
*
* @param bytes Number of bytes.
*
* @return Formatted string.
*/
function bytesToHumanReadable(bytes, dp=1) {
let isNumber = !isNaN(parseFloat(bytes)) && !isNaN(bytes - 0);
if(!isNumber){
return "";
}
var i = bytes == 0 ? 0 : Math.floor(Math.log(bytes) / Math.log(1024));
return (bytes / Math.pow(1024, i)).toFixed(dp) * 1 + ' ' + ['b', 'kb', 'mb', 'gb', 'tb'][i];
}

function main() {
// Hide startup loading message
document.getElementById("loadingscene").classList.add("hidden");
Expand Down

0 comments on commit ffebbf1

Please sign in to comment.