AzuraCast/templates/admin/backups/index.js.phtml

41 lines
1.2 KiB
PHTML

$(function () {
$('time[data-content]').each(function () {
let tz_display = $(this).data('content');
$(this).text(luxon.DateTime.fromSeconds(tz_display).toLocaleString(luxon.DateTime.DATETIME_SHORT));
});
$('time[data-duration]').each(function () {
$(this).text(humanizeDuration($(this).data('duration') * 1000, {locale: App.locale_short}));
});
$('span[data-file-size]').each(function () {
let original_size = $(this).data('file-size');
$(this).text(formatFileSize(original_size));
});
function formatFileSize(bytes) {
var s = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB'];
for (var pos = 0; bytes >= 1000; pos++, bytes /= 1000) ;
var d = Math.round(bytes * 10);
return pos ? [parseInt(d / 10), ".", d % 10, " ", s[pos]].join('') : bytes + ' bytes';
}
var log_modal = $('#modal-log-view');
if (log_modal.length > 0) {
log_modal.modal({
focus: false,
show: false
});
$('#btn-view-log').on('click', function(e) {
e.preventDefault();
log_modal.modal('show');
return false;
});
}
});