Add local dashcam video library
Co-authored-by: Copilot <[email protected]>
This commit is contained in:
@@ -1,6 +1,18 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function formatBytes(bytes) {
|
||||
if (bytes === 0) {
|
||||
return "0 B";
|
||||
}
|
||||
const units = ["B", "KB", "MB", "GB", "TB"];
|
||||
const unit = Math.min(
|
||||
Math.floor(Math.log(bytes) / Math.log(1024)),
|
||||
units.length - 1
|
||||
);
|
||||
return `${(bytes / (1024 ** unit)).toFixed(unit === 0 ? 0 : 1)} ${units[unit]}`;
|
||||
}
|
||||
|
||||
function compareRows(left, right, key, direction) {
|
||||
const leftValue = left.dataset[key] || "";
|
||||
const rightValue = right.dataset[key] || "";
|
||||
@@ -66,4 +78,5 @@
|
||||
}
|
||||
|
||||
document.querySelectorAll("[data-data-list]").forEach(initializeList);
|
||||
window.YarisUI = Object.assign(window.YarisUI || {}, { formatBytes });
|
||||
}());
|
||||
|
||||
Reference in New Issue
Block a user