mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-31 01:51:53 +08:00
otg msd ui
This commit is contained in:
@@ -55,6 +55,15 @@ export var tools = new function() {
|
||||
return id;
|
||||
};
|
||||
|
||||
this.formatSize = function(size) {
|
||||
if (size > 0) {
|
||||
let index = Math.floor( Math.log(size) / Math.log(1024) );
|
||||
return (size / Math.pow(1024, index)).toFixed(2) * 1 + " " + ["B", "KiB", "MiB", "GiB", "TiB"][index];
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
this.getCookie = function(name) {
|
||||
@@ -110,6 +119,11 @@ export var tools = new function() {
|
||||
};
|
||||
};
|
||||
|
||||
this.setProgressPercent = function(el, title, percent) {
|
||||
el.setAttribute("data-label", title);
|
||||
$(`${el.id}-value`).style.width = `${percent}%`;
|
||||
};
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
let __debug = (new URL(window.location.href)).searchParams.get("debug");
|
||||
|
||||
Reference in New Issue
Block a user