forked from SimplesIP/pabx-app
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.1 KiB
57 lines
1.1 KiB
let cron |
|
let segundos = 0; |
|
let minutos = 0; |
|
|
|
$(function(){ |
|
$('#voicerecorder').on('click', function(){ |
|
start() |
|
}) |
|
$('.modal-content-body').on('click', '#stoprecorder', function(){ |
|
pause() |
|
}) |
|
}) |
|
|
|
const addZero = (time) => { |
|
if(time < 10){ |
|
time = "0" + time |
|
} |
|
return time |
|
} |
|
|
|
function start() { |
|
segundos = 0 |
|
minutos = 0 |
|
pause(); |
|
cron = setInterval(() => { |
|
timer(); |
|
}, 1005); |
|
} |
|
|
|
function pause() { |
|
clearInterval(cron); |
|
} |
|
|
|
function timer() { |
|
segundos++; |
|
if (segundos == 60) { |
|
minutos++; |
|
segundos = 0; |
|
} |
|
$('#minutes').text(addZero(minutos)) |
|
$('#seconds').text(addZero(segundos)) |
|
} |
|
|
|
function converdata(timestamp, horario_server = false){ |
|
if(horario_server){ |
|
timestamp = timestamp * 1000 |
|
} |
|
|
|
let date = new Date(timestamp); |
|
let day = addZero(date.getDay()) |
|
let month = addZero(date.getMonth()) |
|
let year = date.getFullYear() |
|
let hours = date.getHours(); |
|
let minutes = date.getMinutes(); |
|
let formattedTime = `${day}/${month} ` + addZero(hours) + ':' + addZero(minutes) |
|
return formattedTime |
|
} |