zoneminder/web/skins/classic/views/js/video.js

49 lines
1.5 KiB
JavaScript
Raw Normal View History

function generateVideoResponse( data, responseText ) {
console.log(data);
var generated = (data.result=='Ok') ? 1 : 0;
var fullUrl = thisUrl + '?view=' + currentView + '&eid=' + eventId + '&generated=' + generated;
2020-10-06 04:53:46 +08:00
$j('#videoProgress').removeClass( 'text-warning' );
if ( generated ) {
$j('#videoProgress').addClass( 'text-success' );
$j('#videoProgress').text(exportSucceededString);
$j( "#videoTable" ).load( fullUrl+ ' #videoTable' );
} else {
$j('#videoProgress').addClass( 'text-danger' );
$j('#videoProgress').text(exportFailedString);
}
}
2020-02-29 22:28:04 +08:00
function generateVideo() {
var form = $j('#videoForm').serialize();
$j.getJSON(thisUrl + '?view=request&request=event&action=video', form)
.done(generateVideoResponse)
.fail(logAjaxFail);
$j('#videoProgress').removeClass('invisible');
}
2020-10-06 04:44:07 +08:00
function initPage() {
var backBtn = $j('#backBtn');
var videoBtn = $j('#videoBtn');
videoBtn.prop('disabled', !opt_ffmpeg);
2020-10-06 05:31:26 +08:00
2020-10-06 04:44:07 +08:00
// Manage the BACK button
document.getElementById("backBtn").addEventListener("click", function onBackClick(evt) {
evt.preventDefault();
window.history.back();
});
// Manage the REFRESH Button
document.getElementById("refreshBtn").addEventListener("click", function onRefreshClick(evt) {
evt.preventDefault();
window.location.reload(true);
});
// Don't enable the back button if there is no previous zm page to go back to
backBtn.prop('disabled', !document.referrer.length);
}
$j(document).ready(initPage);