mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 21:30:24 +08:00
Add resource list page.
This commit is contained in:
@ -274,6 +274,18 @@ export function getShortText(s, maxLength=35) {
|
||||
}
|
||||
}
|
||||
|
||||
export function getFriendlyFileSize(size) {
|
||||
if (size < 1024) {
|
||||
return size + ' B';
|
||||
}
|
||||
|
||||
let i = Math.floor(Math.log(size) / Math.log(1024));
|
||||
let num = (size / Math.pow(1024, i));
|
||||
let round = Math.round(num);
|
||||
num = round < 10 ? num.toFixed(2) : round < 100 ? num.toFixed(1) : round;
|
||||
return `${num} ${'KMGTPEZY'[i-1]}B`;
|
||||
}
|
||||
|
||||
function getRandomInt(s) {
|
||||
let hash = 0;
|
||||
if (s.length !== 0) {
|
||||
|
Reference in New Issue
Block a user