mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-06 12:47:13 +02:00
* file.db: file_user_rating: Table for tracking average user rating of a file
* Default filter order to descending * File rating support including in search/filter * Default to passing submitted form data (if any) @ prevMenu() * Fix issues with byte/size formatting for 0 * Allow action keys for prompts * use MenuModule.pausePrompt() in various places * Add quick search to file area * Display dupes, if any @ upload
This commit is contained in:
parent
5f929b3d63
commit
f0db0e3c94
16 changed files with 714 additions and 230 deletions
|
@ -301,13 +301,17 @@ function renderStringLength(s) {
|
|||
const SIZE_ABBRS = [ 'B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' ]; // :)
|
||||
|
||||
function formatByteSizeAbbr(byteSize) {
|
||||
if(0 === byteSize) {
|
||||
return SIZE_ABBRS[0]; // B
|
||||
}
|
||||
|
||||
return SIZE_ABBRS[Math.floor(Math.log(byteSize) / Math.log(1024))];
|
||||
}
|
||||
|
||||
function formatByteSize(byteSize, withAbbr, decimals) {
|
||||
withAbbr = withAbbr || false;
|
||||
decimals = decimals || 3;
|
||||
const i = Math.floor(Math.log(byteSize) / Math.log(1024));
|
||||
const i = 0 === byteSize ? byteSize : Math.floor(Math.log(byteSize) / Math.log(1024));
|
||||
let result = parseFloat((byteSize / Math.pow(1024, i)).toFixed(decimals));
|
||||
if(withAbbr) {
|
||||
result += ` ${SIZE_ABBRS[i]}`;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue