Merge branch 'master' into rtsp_server

This commit is contained in:
Isaac Connor 2021-01-07 09:51:00 -05:00
commit 272fdcec68
33 changed files with 317 additions and 829 deletions

View File

@ -33,16 +33,7 @@ install:
env:
- SMPFLAGS=-j4 OS=eslint DIST=eslint
- SMPFLAGS=-j4 OS=el DIST=7 DOCKER_REPO=knnniggett/packpack
- SMPFLAGS=-j4 OS=el DIST=8 DOCKER_REPO=knnniggett/packpack
- SMPFLAGS=-j4 OS=fedora DIST=31 DOCKER_REPO=knnniggett/packpack
- SMPFLAGS=-j4 OS=fedora DIST=32 DOCKER_REPO=knnniggett/packpack
- SMPFLAGS=-j4 OS=fedora DIST=33 DOCKER_REPO=knnniggett/packpack
- SMPFLAGS=-j4 OS=ubuntu DIST=xenial DOCKER_REPO=iconzm/packpack
- SMPFLAGS=-j4 OS=ubuntu DIST=bionic DOCKER_REPO=iconzm/packpack
- SMPFLAGS=-j4 OS=ubuntu DIST=focal DOCKER_REPO=iconzm/packpack
- SMPFLAGS=-j4 OS=debian DIST=stretch DOCKER_REPO=iconzm/packpack
- SMPFLAGS=-j4 OS=debian DIST=buster DOCKER_REPO=iconzm/packpack
compiler:
- gcc

View File

@ -165,9 +165,6 @@ function queryRequest() {
$rows = array();
$results = dbFetchAll($query['sql'], NULL, $query['values']);
if ( !$results ) {
return $data;
}
foreach ( $results as $row ) {
$row['DateTime'] = strftime('%Y-%m-%d %H:%M:%S', intval($row['TimeKey']));

View File

@ -1,7 +1,7 @@
/**
* bootstrap-table - An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation)
*
* @version v1.17.1
* @version v1.18.1
* @homepage https://bootstrap-table.com
* @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
* @license MIT

File diff suppressed because one or more lines are too long

View File

@ -1,49 +0,0 @@
.overlayMask {
position: absolute;
opacity: 0.6;
filter: alpha(opacity=60);
-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=60);
z-index: 999;
background: #aaaaaa;
}
.overlay {
display: none;
position: absolute;
background-color: #f0f0f0;
border: 2px solid #555555;
-moz-border-radius: 4px;
z-index: 1000;
overflow: hidden;
}
.overlayHeader {
float: left;
background-color: #853131;
width: 100%;
border-bottom: 1px solid #666666;
color: black;
}
.overlayTitle {
float: left;
padding: 10px 6px;
font-weight: bold;
width: auto;
}
.overlayToolbar {
float: right;
font-weight: bold;
padding: 6px 4px;
width: auto;
}
.overlayBody {
float: left;
width: 100%;
}
.overlayContent {
padding: 4px 4px 6px;
}

View File

@ -44,8 +44,7 @@ if ( $action == 'save' ) {
}
}
} // end foreach mid
$refreshParent = true;
$view = 'none';
$view = 'console';
} else {
ZM\Warning("Unknown action $action in Monitor");
} // end if action == Delete

View File

@ -8,13 +8,16 @@ function MonitorStream(monitorData) {
this.status = null;
this.alarmState = STATE_IDLE;
this.lastAlarmState = STATE_IDLE;
this.streamCmdParms = 'view=request&request=stream&connkey='+this.connKey;
this.streamCmdParms = {
view: 'request',
request: 'stream',
connkey: this.connKey
};
if ( auth_hash ) {
this.streamCmdParms += '&auth='+auth_hash;
this.streamCmdParms.auth = auth_hash;
} else if ( auth_relay ) {
this.streamCmdParms += '&'+auth_relay;
this.streamCmdParms.auth_relay = '';
}
this.streamCmdTimer = null;
this.type = monitorData.type;
this.refresh = monitorData.refresh;
this.start = function(delay) {
@ -33,15 +36,7 @@ function MonitorStream(monitorData) {
stream.src = '';
stream.src = src;
}
if ( this.streamCmdQuery ) {
this.streamCmdTimer = this.streamCmdQuery.delay(delay, this);
} else {
console.log("No streamCmdQuery");
}
console.log("queueing for " + this.id + " " + this.connKey + " timeout is: " + AJAX_TIMEOUT);
requestQueue.addRequest("cmdReq"+this.id, this.streamCmdReq);
this.streamCmdQuery.delay(delay, this);
};
this.stop = function() {
if ( 0 ) {
@ -57,13 +52,16 @@ function MonitorStream(monitorData) {
stream.src = src;
}
}
this.streamCmdReq.send(this.streamCmdParms+"&command="+CMD_STOP);
this.streamCmdParms.command = CMD_STOP;
this.streamCmdReq(this.streamCmdParms);
};
this.pause = function() {
this.streamCmdReq.send(this.streamCmdParms+"&command="+CMD_PAUSE);
this.streamCmdParms.command = CMD_PAUSE;
this.streamCmdReq(this.streamCmdParms);
};
this.play = function() {
this.streamCmdReq.send(this.streamCmdParms+"&command="+CMD_PLAY);
this.streamCmdParms.command = CMD_PLAY;
this.streamCmdReq(this.streamCmdParms);
};
this.eventHandler = function(event) {
@ -86,55 +84,27 @@ function MonitorStream(monitorData) {
document.getElementById('imageFeed'+this.id).removeEventListener('click', this.onclick );
};
this.setStateClass = function(element, stateClass) {
if ( !element ) {
this.setStateClass = function(jobj, stateClass) {
if ( !jobj ) {
return;
}
if ( !element.hasClass( stateClass ) ) {
if ( stateClass != 'alarm' ) {
element.removeClass('alarm');
}
if ( stateClass != 'alert' ) {
element.removeClass('alert');
}
if ( stateClass != 'idle' ) {
element.removeClass('idle');
}
element.addClass(stateClass);
if ( !jobj.hasClass( stateClass ) ) {
if ( stateClass != 'alarm' ) jobj.removeClass('alarm');
if ( stateClass != 'alert' ) jobj.removeClass('alert');
if ( stateClass != 'idle' ) jobj.removeClass('idle');
jobj.addClass(stateClass);
}
};
this.onError = function(text, error) {
console.log('onerror: ' + text + ' error:'+error);
// Requeue, but want to wait a while.
var streamCmdTimeout = 10*statusRefreshTimeout;
this.streamCmdTimer = this.streamCmdQuery.delay(streamCmdTimeout, this);
};
this.onFailure = function(xhr) {
console.log('onFailure: ' + this.connKey);
console.log(xhr);
if ( ! requestQueue.hasNext('cmdReq'+this.id) ) {
console.log('Not requeuing because there is one already');
requestQueue.addRequest('cmdReq'+this.id, this.streamCmdReq);
}
if ( 0 ) {
// Requeue, but want to wait a while.
if ( this.streamCmdTimer ) {
this.streamCmdTimer = clearTimeout( this.streamCmdTimer );
}
var streamCmdTimeout = 1000*statusRefreshTimeout;
this.streamCmdTimer = this.streamCmdQuery.delay(streamCmdTimeout, this, true);
requestQueue.resume();
}
console.log('done failure');
this.onFailure = function(jqxhr, textStatus, error) {
this.streamCmdQuery.delay(1000*statusRefreshTimeout, this);
logAjaxFail(jqxhr, textStatus, error);
};
this.getStreamCmdResponse = function(respObj, respText) {
if ( this.streamCmdTimer ) {
this.streamCmdTimer = clearTimeout(this.streamCmdTimer);
}
var stream = $j('#liveStream'+this.id)[0];
if ( ! stream ) {
console.log('No live stream');
return;
@ -159,22 +129,16 @@ function MonitorStream(monitorData) {
!COMPACT_MONTAGE) &&
(this.type != 'WebSite')
) {
fpsValue = $('fpsValue'+this.id);
if ( fpsValue ) {
fpsValue.set('text', this.status.fps);
}
stateValue = $('stateValue'+this.id);
if ( stateValue ) {
stateValue.set('text', stateStrings[this.alarmState]);
}
var fpsValue = $j('#fpsValue'+this.id);
var stateValue = $j('#stateValue'+this.id);
var monitorState = $j('#monitorState'+this.id);
monitorState = $('monitorState'+this.id);
if ( monitorState ) {
this.setStateClass(monitorState, stateClass);
}
if ( fpsValue.length ) fpsValue.text(this.status.fps);
if ( stateValue.length ) stateValue.text(stateStrings[this.alarmState]);
if ( monitorState.length ) this.setStateClass(monitorState, stateClass);
}
this.setStateClass($('monitor'+this.id), stateClass);
this.setStateClass($j('#monitor'+this.id), stateClass);
/*Stream could be an applet so can't use moo tools*/
//stream.parentNode().className = stateClass;
@ -188,7 +152,7 @@ function MonitorStream(monitorData) {
if ( newAlarm ) {
if ( false && SOUND_ON_ALARM ) {
// Enable the alarm sound
$('alarmSound').removeClass('hidden');
$j('#alarmSound').removeClass('hidden');
}
if ( (typeof POPUP_ON_ALARM !== 'undefined') && POPUP_ON_ALARM ) {
windowToFront();
@ -197,7 +161,7 @@ function MonitorStream(monitorData) {
if ( false && SOUND_ON_ALARM ) {
if ( oldAlarm ) {
// Disable alarm sound
$('alarmSound').addClass('hidden');
$j('#alarmSound').addClass('hidden');
}
}
if ( this.status.auth ) {
@ -230,38 +194,24 @@ function MonitorStream(monitorData) {
}
} // end if Ok or not
var streamCmdTimeout = statusRefreshTimeout;
// The idea here is if we are alarmed, do updates faster.
// However, there is a timeout in the php side which isn't getting modified,
// so this may cause a problem. Also the server may only be able to update so fast.
//if ( this.alarmState == STATE_ALARM || this.alarmState == STATE_ALERT ) {
//streamCmdTimeout = streamCmdTimeout/5;
//}
this.streamCmdTimer = this.streamCmdQuery.delay(streamCmdTimeout, this);
this.lastAlarmState = this.alarmState;
this.streamCmdQuery.delay(statusRefreshTimeout, this);
};
this.streamCmdQuery = function(resent) {
if ( resent ) {
console.log(this.connKey+': timeout: Resending');
this.streamCmdReq.cancel();
}
//console.log("Starting CmdQuery for " + this.connKey );
if ( this.type != 'WebSite' ) {
this.streamCmdReq.send(this.streamCmdParms+'&command='+CMD_QUERY);
this.streamCmdParms.command = CMD_QUERY;
this.streamCmdReq(this.streamCmdParms);
}
};
if ( this.type != 'WebSite' ) {
this.streamCmdReq = new Request.JSON( {
url: this.url,
method: 'get',
timeout: AJAX_TIMEOUT,
onSuccess: this.getStreamCmdResponse.bind(this),
onTimeout: this.streamCmdQuery.bind(this, true),
onError: this.onError.bind(this),
onFailure: this.onFailure.bind(this),
link: 'cancel'
} );
this.streamCmdReq = function(streamCmdParms) {
$j.ajaxSetup({timeout: AJAX_TIMEOUT});
$j.getJSON(this.url, streamCmdParms)
.done(this.getStreamCmdResponse.bind(this))
.fail(this.onFailure.bind(this));
};
}
} // end function MonitorStream

View File

@ -1,118 +0,0 @@
var Overlay = new Class({
Implements: [Options, Events],
initialize: function( id, options ) {
this.setOptions( options );
this.mask = new Mask( document.body, {'maskMargins': false, 'class': 'overlayMask'} );
this.id = id?id:'overlay';
if ( typeOf(this.id) == 'string' ) {
if ( $(this.id) ) {
this.element = $(this.id);
}
} else {
this.element = this.id;
this.id = this.element.get('id');
}
if ( !this.element ) {
this.element = new Element( 'div', {'id': this.id, 'class': 'overlay', 'styles': {'display': 'none'}} );
if ( this.options.title || this.options.buttons ) {
var overlayHeader = new Element( 'div', {'class': 'overlayHeader'} );
if ( this.options.title ) {
var overlayTitle = new Element( 'div', {'class': 'overlayTitle', 'text': this.options.title} );
overlayHeader.grab( overlayTitle );
}
if ( this.options.buttons ) {
var overlayToolbar = new Element( 'div', {'class': 'overlayToolbar'} );
this.options.buttons.each(
function( button ) {
var overlayButton = new Element( 'button', {'text': button.text} );
if ( button.id ) {
overlayButton.setProperty( 'id', button.id );
}
if ( button.events ) {
overlayButton.set( 'events', events );
}
overlayToolbar.grab( overlayButton );
}
);
overlayHeader.grab( overlayTitle );
}
this.element.grab( overlayHeader );
var overlayBody = new Element( 'div', {'class': 'overlayBody'} );
var overlayContent = new Element( 'div', {'class': 'overlayContent'} );
overlayContent.grab( this.options.content );
overlayBody.grab( overlayContent );
this.element.grab( overlayBody );
}
this.target = document.id(this.options.target) || document.id(document.body);
this.element.inject( this.target );
}
},
show: function() {
this.mask.show();
window.addEventListener( 'resize', this.update.bind(this), {passive: true} );
window.addEventListener( 'scroll', this.update.bind(this), {passive: true} );
this.element.tween( 'opacity', [0, 1.0] );
this.element.show();
this.element.position();
this.mask.position();
},
hideComplete: function() {
this.element.hide();
this.mask.hide();
},
hide: function() {
new Fx.Tween( this.element, {duration: 400, transition: Fx.Transitions.Sine, onComplete: this.hideComplete.bind(this)} ).start( 'opacity', 1.0, 0 );
},
update: function() {
this.element.position();
this.mask.position();
},
showAnimation: function() {
showOverlay();
//console.log( "Showing overlay loading" );
if ( !this.loading ) {
this.loading = new Element( 'div', {'id': 'loading'+this.key, 'styles': {'display': 'none'}} );
this.loading.grab( this.loadingImage );
document.body.grab( this.loading );
}
updateOverlayLoading();
this.loading.setStyle( 'display', 'block' );
window.addEventListener( 'resize', this.update.bind(this), {passive: true} );
window.addEventListener( 'scroll', this.update.bind(this), {passive: true} );
},
hideAnimation: function() {
if ( this.loading ) {
this.loading.setStyle( 'display', 'none' );
}
}
});
function setupOverlays() {
try {
$$('.overlay').each(
function( overlay ) {
overlay.element = new Overlay( overlay.get('id') );
overlay.getElements('.overlayCloser').each(
function( closer ) {
closer.addEvent( 'click', function() {
overlay.element.hide();
} );
}
);
overlay.overlayShow = function() {
overlay.element.show();
};
overlay.overlayHide = function() {
overlay.element.hide();
};
}
);
} catch ( e ) {
alert( e );
}
}
window.addEventListener( 'DOMContentLoaded', setupOverlays );

View File

@ -109,7 +109,6 @@ if ( file_exists("skins/$skin/css/$css/graphics/favicon.ico") ) {
}
echo output_cache_busted_stylesheet_links(array(
'css/reset.css',
'css/overlay.css',
'css/font-awesome.min.css',
'css/bootstrap.min.css',
'css/bootstrap-table.min.css',
@ -856,7 +855,6 @@ function xhtmlFooter() {
global $skin;
global $basename;
$skinJsPhpFile = getSkinFile('js/skin.js.php');
$cssJsFile = getSkinFile('js/'.$css.'.js');
$viewJsFile = getSkinFile('views/js/'.$basename.'.js');
$viewJsPhpFile = getSkinFile('views/js/'.$basename.'.js.php');
?>
@ -871,7 +869,6 @@ function xhtmlFooter() {
<?php echo output_script_if_exists(array(
'js/bootstrap-table.min.js',
'js/bootstrap-table-locale-all.min.js',
'js/tableExport.min.js',
'js/bootstrap-table-export.min.js',
'js/bootstrap-table-page-jump-to.min.js',
'js/bootstrap-table-cookie.min.js',
@ -907,15 +904,6 @@ function xhtmlFooter() {
?>
</script>
<?php
if ( $cssJsFile ) {
?>
<script src="<?php echo cache_bust($cssJsFile) ?>"></script>
<?php
} else {
?>
<script src="<?php echo cache_bust('skins/classic/js/base.js') ?>"></script>
<?php
}
if ( $viewJsFile ) {
?>
<script src="<?php echo cache_bust($viewJsFile) ?>"></script>
@ -926,12 +914,7 @@ function xhtmlFooter() {
<script src="<?php echo cache_bust($skinJsFile) ?>"></script>
<script src="<?php echo cache_bust('js/logger.js')?>"></script>
<?php
if ($basename == 'watch' or $basename == 'log' ) {
// This is used in the log popup for the export function. Not sure if it's used anywhere else
?>
<script src="<?php echo cache_bust('js/overlay.js') ?>"></script>
<?php
} else if ( $basename == 'monitor' ) {
if ( $basename == 'monitor' ) {
echo output_script_if_exists(array('js/leaflet/leaflet.js'), false);
} ?>
<script nonce="<?php echo $cspNonce; ?>">$j('.chosen').chosen();</script>

View File

@ -1,76 +0,0 @@
//
// ZoneMinder base static javascript file, $Date$, $Revision$
// Copyright (C) 2001-2008 Philip Coombes
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
//
// This file should only contain static JavaScript and no php.
// Use skin.js.php for JavaScript that need pre-processing
//
// Javascript window sizes
/* eslint-disable key-spacing */
var popupSizes = {
'bandwidth': {'width': 300, 'height': 200},
'console': {'width': 750, 'height': 312},
'control': {'width': 480, 'height': 480},
'controlcaps': {'width': 780, 'height': 320},
'controlcap': {'width': 600, 'height': 500},
'cycle': {'addWidth': 32, 'minWidth': 384, 'addHeight': 62},
'device': {'width': 260, 'height': 150},
'devices': {'width': 400, 'height': 240},
'donate': {'width': 500, 'height': 480},
'download': {'width': 350, 'height': 315},
'event': {'addWidth': 108, 'minWidth': 496, 'addHeight': 230, 'minHeight': 540},
'eventdetail': {'width': 600, 'height': 420},
'events': {'width': 1220, 'height': 780},
'export': {'width': 500, 'height': 640},
'filter': {'width': 900, 'height': 700},
'frame': {'addWidth': 32, 'minWidth': 384, 'addHeight': 200},
'frames': {'addWidth': 800, 'addHeight': 600},
'function': {'width': 350, 'height': 260},
'group': {'width': 760, 'height': 600},
'groups': {'width': 540, 'height': 420},
'image': {'addWidth': 48, 'addHeight': 80},
'log': {'width': 1180, 'height': 720},
'login': {'width': 720, 'height': 480},
'logout': {'width': 260, 'height': 150},
'monitor': {'width': 800, 'height': 780},
'monitorpreset':{'width': 440, 'height': 210},
'monitorprobe': {'width': 500, 'height': 275},
'monitorselect':{'width': 160, 'height': 200},
'montage': {'width': -1, 'height': -1},
'onvifprobe': {'width': 700, 'height': 550},
'optionhelp': {'width': 400, 'height': 400},
'options': {'width': 1000, 'height': 660},
'preset': {'width': 300, 'height': 220},
'server': {'width': 600, 'height': 405},
'settings': {'width': 250, 'height': 335},
'shutdown': {'width': 400, 'height': 400},
'state': {'width': 400, 'height': 170},
'stats': {'width': 840, 'height': 200},
'storage': {'width': 600, 'height': 425},
'timeline': {'width': 760, 'height': 540},
'user': {'width': 460, 'height': 720},
'version': {'width': 360, 'height': 210},
'video': {'width': 420, 'height': 360},
'videoview': {'addWidth': 48, 'addHeight': 80},
'watch': {'addWidth': 96, 'minWidth': 420, 'addHeight': 384},
'zone': {'addWidth': 520, 'addHeight': 260, 'minHeight': 600},
'zones': {'addWidth': 72, 'addHeight': 232}
};
/* eslint-enable key-spacing */

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,76 +0,0 @@
//
// ZoneMinder base static javascript file, $Date$, $Revision$
// Copyright (C) 2001-2008 Philip Coombes
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
//
// This file should only contain static JavaScript and no php.
// Use skin.js.php for JavaScript that need pre-processing
//
// Javascript window sizes
/* eslint-disable key-spacing */
var popupSizes = {
'bandwidth': {'width': 300, 'height': 220},
'console': {'width': 750, 'height': 312},
'control': {'width': 380, 'height': 480},
'controlcaps': {'width': 780, 'height': 320},
'controlcap': {'width': 600, 'height': 400},
'cycle': {'addWidth': 32, 'minWidth': 384, 'addHeight': 62},
'device': {'width': 260, 'height': 150},
'devices': {'width': 400, 'height': 240},
'donate': {'width': 500, 'height': 480},
'download': {'width': 350, 'height': 215},
'event': {'addWidth': 108, 'minWidth': 496, 'addHeight': 230, 'minHeight': 540},
'eventdetail': {'width': 600, 'height': 420},
'events': {'width': 1020, 'height': 780},
'export': {'width': 400, 'height': 340},
'filter': {'width': 820, 'height': 700},
'frame': {'addWidth': 32, 'minWidth': 384, 'addHeight': 200},
'frames': {'width': 600, 'height': 700},
'function': {'width': 400, 'height': 250},
'group': {'width': 660, 'height': 520},
'groups': {'width': 440, 'height': 220},
'image': {'addWidth': 48, 'addHeight': 80},
'log': {'width': 1080, 'height': 720},
'login': {'width': 720, 'height': 480},
'logout': {'width': 460, 'height': 300},
'monitor': {'width': 700, 'height': 680},
'monitorpreset':{'width': 440, 'height': 200},
'monitorprobe': {'width': 500, 'height': 240},
'monitorselect':{'width': 160, 'height': 200},
'monitors': {'width': 300, 'height': 640},
'montage': {'width': -1, 'height': -1},
'onvifprobe': {'width': 700, 'height': 550},
'optionhelp': {'width': 400, 'height': 320},
'options': {'width': 1000, 'height': 660},
'preset': {'width': 300, 'height': 120},
'server': {'width': 600, 'height': 405},
'settings': {'width': 220, 'height': 225},
'state': {'width': 370, 'height': 134},
'stats': {'width': 840, 'height': 200},
'storage': {'width': 600, 'height': 425},
'timeline': {'width': 760, 'height': 540},
'user': {'width': 360, 'height': 720},
'version': {'width': 360, 'height': 140},
'video': {'width': 420, 'height': 360},
'videoview': {'addWidth': 48, 'addHeight': 80},
'watch': {'addWidth': 96, 'minWidth': 420, 'addHeight': 384},
'zone': {'addWidth': 450, 'addHeight': 200, 'minHeight': 450},
'zones': {'addWidth': 72, 'addHeight': 232}
};
/* eslint-enable key-spacing */

View File

@ -1,93 +0,0 @@
/*
tableExport.jquery.plugin
Version 1.10.20
Copyright (c) 2015-2020 hhurz, https://github.com/hhurz/tableExport.jquery.plugin
Based on https://github.com/kayalshri/tableExport.jquery.plugin
Licensed under the MIT License
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(c,k,y){c instanceof String&&(c=String(c));for(var v=c.length,A=0;A<v;A++){var S=c[A];if(k.call(y,S,A,c))return{i:A,v:S}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(c,k,y){c!=Array.prototype&&c!=Object.prototype&&(c[k]=y.value)};
$jscomp.getGlobal=function(c){return"undefined"!=typeof window&&window===c?c:"undefined"!=typeof global&&null!=global?global:c};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(c,k,y,v){if(k){y=$jscomp.global;c=c.split(".");for(v=0;v<c.length-1;v++){var A=c[v];A in y||(y[A]={});y=y[A]}c=c[c.length-1];v=y[c];k=k(v);k!=v&&null!=k&&$jscomp.defineProperty(y,c,{configurable:!0,writable:!0,value:k})}};
$jscomp.polyfill("Array.prototype.find",function(c){return c?c:function(c,y){return $jscomp.findInternal(this,c,y).v}},"es6","es3");
(function(c){c.fn.tableExport=function(k){function y(b){var d=[];A(b,"thead").each(function(){d.push.apply(d,A(c(this),a.theadSelector).toArray())});return d}function v(b){var d=[];A(b,"tbody").each(function(){d.push.apply(d,A(c(this),a.tbodySelector).toArray())});a.tfootSelector.length&&A(b,"tfoot").each(function(){d.push.apply(d,A(c(this),a.tfootSelector).toArray())});return d}function A(b,a){var d=b[0].tagName,p=b.parents(d).length;return b.find(a).filter(function(){return p===c(this).closest(d).parents(d).length})}
function S(b){var a=[];c(b).find("thead").first().find("th").each(function(b,d){void 0!==c(d).attr("data-field")?a[b]=c(d).attr("data-field"):a[b]=b.toString()});return a}function I(b){var a="undefined"!==typeof b[0].rowIndex,e=!1===a&&"undefined"!==typeof b[0].cellIndex,p=e||a?Ja(b):b.is(":visible"),f=b.attr("data-tableexport-display");e&&"none"!==f&&"always"!==f&&(b=c(b[0].parentNode),a="undefined"!==typeof b[0].rowIndex,f=b.attr("data-tableexport-display"));a&&"none"!==f&&"always"!==f&&(f=b.closest("table").attr("data-tableexport-display"));
return"none"!==f&&(!0===p||"always"===f)}function Ja(b){var a=[];V&&(a=J.filter(function(){var a=!1;this.nodeType===b[0].nodeType&&("undefined"!==typeof this.rowIndex&&this.rowIndex===b[0].rowIndex?a=!0:"undefined"!==typeof this.cellIndex&&this.cellIndex===b[0].cellIndex&&"undefined"!==typeof this.parentNode.rowIndex&&"undefined"!==typeof b[0].parentNode.rowIndex&&this.parentNode.rowIndex===b[0].parentNode.rowIndex&&(a=!0));return a}));return!1===V||0===a.length}function sa(b,d,e){var p=!1;I(b)?0<
a.ignoreColumn.length&&(-1!==c.inArray(e,a.ignoreColumn)||-1!==c.inArray(e-d,a.ignoreColumn)||T.length>e&&"undefined"!==typeof T[e]&&-1!==c.inArray(T[e],a.ignoreColumn))&&(p=!0):p=!0;return p}function B(b,d,e,p,f){if("function"===typeof f){var l=!1;"function"===typeof a.onIgnoreRow&&(l=a.onIgnoreRow(c(b),e));if(!1===l&&(0===a.ignoreRow.length||-1===c.inArray(e,a.ignoreRow)&&-1===c.inArray(e-p,a.ignoreRow))&&I(c(b))){var q=A(c(b),d),h=0;q.each(function(b){var a=c(this),d,l=O(this),p=U(this);c.each(G,
function(){if(e>=this.s.r&&e<=this.e.r&&h>=this.s.c&&h<=this.e.c)for(d=0;d<=this.e.c-this.s.c;++d)f(null,e,h++)});if(!1===sa(a,q.length,b)){if(p||l)l=l||1,G.push({s:{r:e,c:h},e:{r:e+(p||1)-1,c:h+l-1}});f(this,e,h++)}if(l)for(d=0;d<l-1;++d)f(null,e,h++)});c.each(G,function(){if(e>=this.s.r&&e<=this.e.r&&h>=this.s.c&&h<=this.e.c)for(da=0;da<=this.e.c-this.s.c;++da)f(null,e,h++)})}}}function ta(b,a,e,c){if("undefined"!==typeof c.images&&(e=c.images[e],"undefined"!==typeof e)){a=a.getBoundingClientRect();
var d=b.width/b.height,l=a.width/a.height,p=b.width,h=b.height,z=19.049976/25.4,g=0;l<=d?(h=Math.min(b.height,a.height),p=a.width*h/a.height):l>d&&(p=Math.min(b.width,a.width),h=a.height*p/a.width);p*=z;h*=z;h<b.height&&(g=(b.height-h)/2);try{c.doc.addImage(e.src,b.textPos.x,b.y+g,p,h)}catch(Pa){}b.textPos.x+=p}}function ua(b,d){if("string"===a.outputMode)return b.output();if("base64"===a.outputMode)return K(b.output());if("window"===a.outputMode)window.URL=window.URL||window.webkitURL,window.open(window.URL.createObjectURL(b.output("blob")));
else try{var e=b.output("blob");saveAs(e,a.fileName+".pdf")}catch(p){ja(a.fileName+".pdf","data:application/pdf"+(d?"":";base64")+",",d?b.output("blob"):b.output())}}function va(b,a,e){var d=0;"undefined"!==typeof e&&(d=e.colspan);if(0<=d){for(var c=b.width,l=b.textPos.x,q=a.table.columns.indexOf(a.column),h=1;h<d;h++)c+=a.table.columns[q+h].width;1<d&&("right"===b.styles.halign?l=b.textPos.x+c-b.width:"center"===b.styles.halign&&(l=b.textPos.x+(c-b.width)/2));b.width=c;b.textPos.x=l;"undefined"!==
typeof e&&1<e.rowspan&&(b.height*=e.rowspan);if("middle"===b.styles.valign||"bottom"===b.styles.valign)e=("string"===typeof b.text?b.text.split(/\r\n|\r|\n/g):b.text).length||1,2<e&&(b.textPos.y-=(2-1.15)/2*a.row.styles.fontSize*(e-2)/3);return!0}return!1}function wa(b,a,e){"undefined"!==typeof b&&null!==b&&(b.hasAttribute("data-tableexport-canvas")?(a=(new Date).getTime(),c(b).attr("data-tableexport-canvas",a),e.images[a]={url:'[data-tableexport-canvas="'+a+'"]',src:null}):"undefined"!==a&&null!=
a&&a.each(function(){if(c(this).is("img")){var a=xa(this.src);e.images[a]={url:this.src,src:this.src}}wa(b,c(this).children(),e)}))}function Ka(b,a){function d(b){if(b.url)if(b.src){var d=new Image;p=++f;d.crossOrigin="Anonymous";d.onerror=d.onload=function(){if(d.complete&&(0===d.src.indexOf("data:image/")&&(d.width=b.width||d.width||0,d.height=b.height||d.height||0),d.width+d.height)){var e=document.createElement("canvas"),c=e.getContext("2d");e.width=d.width;e.height=d.height;c.drawImage(d,0,0);
b.src=e.toDataURL("image/png")}--f||a(p)};d.src=b.url}else{var e=c(b.url);e.length&&(p=++f,html2canvas(e[0]).then(function(d){b.src=d.toDataURL("image/png");--f||a(p)}))}}var p=0,f=0;if("undefined"!==typeof b.images)for(var l in b.images)b.images.hasOwnProperty(l)&&d(b.images[l]);(b=f)||(a(p),b=void 0);return b}function ya(b,d,e){d.each(function(){if(c(this).is("div")){var d=ea(L(this,"background-color"),[255,255,255]),f=ea(L(this,"border-top-color"),[0,0,0]),l=fa(this,"border-top-width",a.jspdf.unit),
q=this.getBoundingClientRect(),h=this.offsetLeft*e.wScaleFactor,z=this.offsetTop*e.hScaleFactor,g=q.width*e.wScaleFactor;q=q.height*e.hScaleFactor;e.doc.setDrawColor.apply(void 0,f);e.doc.setFillColor.apply(void 0,d);e.doc.setLineWidth(l);e.doc.rect(b.x+h,b.y+z,g,q,l?"FD":"F")}else c(this).is("img")&&(d=xa(this.src),ta(b,this,d,e));ya(b,c(this).children(),e)})}function za(b,d,e){if("function"===typeof e.onAutotableText)e.onAutotableText(e.doc,b,d);else{var p=b.textPos.x,f=b.textPos.y,l={halign:b.styles.halign,
valign:b.styles.valign};if(d.length){for(d=d[0];d.previousSibling;)d=d.previousSibling;for(var q=!1,h=!1;d;){var z=d.innerText||d.textContent||"",g=z.length&&" "===z[0]?" ":"",k=1<z.length&&" "===z[z.length-1]?" ":"";!0!==a.preserve.leadingWS&&(z=g+ka(z));!0!==a.preserve.trailingWS&&(z=la(z)+k);c(d).is("br")&&(p=b.textPos.x,f+=e.doc.internal.getFontSize());c(d).is("b")?q=!0:c(d).is("i")&&(h=!0);(q||h)&&e.doc.setFontType(q&&h?"bolditalic":q?"bold":"italic");if(g=e.doc.getStringUnitWidth(z)*e.doc.internal.getFontSize()){"linebreak"===
b.styles.overflow&&p>b.textPos.x&&p+g>b.textPos.x+b.width&&(0<=".,!%*;:=-".indexOf(z.charAt(0))&&(k=z.charAt(0),g=e.doc.getStringUnitWidth(k)*e.doc.internal.getFontSize(),p+g<=b.textPos.x+b.width&&(e.doc.autoTableText(k,p,f,l),z=z.substring(1,z.length)),g=e.doc.getStringUnitWidth(z)*e.doc.internal.getFontSize()),p=b.textPos.x,f+=e.doc.internal.getFontSize());if("visible"!==b.styles.overflow)for(;z.length&&p+g>b.textPos.x+b.width;)z=z.substring(0,z.length-1),g=e.doc.getStringUnitWidth(z)*e.doc.internal.getFontSize();
e.doc.autoTableText(z,p,f,l);p+=g}if(q||h)c(d).is("b")?q=!1:c(d).is("i")&&(h=!1),e.doc.setFontType(q||h?q?"bold":"italic":"normal");d=d.nextSibling}b.textPos.x=p;b.textPos.y=f}else e.doc.autoTableText(b.text,b.textPos.x,b.textPos.y,l)}}function W(b,a,e){return null==b?"":b.toString().replace(new RegExp(null==a?"":a.toString().replace(/([.*+?^=!:${}()|\[\]\/\\])/g,"\\$1"),"g"),e)}function ka(b){return null==b?"":b.toString().replace(/^\s+/,"")}function la(b){return null==b?"":b.toString().replace(/\s+$/,
"")}function La(b){if(0===a.date.html.length)return!1;a.date.pattern.lastIndex=0;var d=a.date.pattern.exec(b);if(null==d)return!1;b=+d[a.date.match_y];if(0>b||8099<b)return!1;var e=1*d[a.date.match_m];d=1*d[a.date.match_d];if(!isFinite(d))return!1;var c=new Date(b,e-1,d,0,0,0);return c.getFullYear()===b&&c.getMonth()===e-1&&c.getDate()===d?new Date(Date.UTC(b,e-1,d,0,0,0)):!1}function ma(b){b=b||"0";""!==a.numbers.html.thousandsSeparator&&(b=W(b,a.numbers.html.thousandsSeparator,""));"."!==a.numbers.html.decimalMark&&
(b=W(b,a.numbers.html.decimalMark,"."));return"number"===typeof b||!1!==jQuery.isNumeric(b)?b:!1}function Ma(b){-1<b.indexOf("%")?(b=ma(b.replace(/%/g,"")),!1!==b&&(b/=100)):b=!1;return b}function E(b,d,e,p){var f="",l="text";if(null!==b){var q=c(b);q.removeData("teUserDefText");if(q[0].hasAttribute("data-tableexport-canvas"))var h="";else if(q[0].hasAttribute("data-tableexport-value"))h=(h=q.attr("data-tableexport-value"))?h+"":"",q.data("teUserDefText",1);else if(h=q.html(),"function"===typeof a.onCellHtmlData)h=
a.onCellHtmlData(q,d,e,h),q.data("teUserDefText",1);else if(""!==h){b=c.parseHTML(h);var g=0,k=0;h="";c.each(b,function(){if(c(this).is("input"))h+=q.find("input").eq(g++).val();else if(c(this).is("select"))h+=q.find("select option:selected").eq(k++).text();else if(c(this).is("br"))h+="<br>";else{if("undefined"===typeof c(this).html())h+=c(this).text();else if(void 0===jQuery().bootstrapTable||!1===c(this).hasClass("fht-cell")&&!1===c(this).hasClass("filterControl")&&0===q.parents(".detail-view").length)h+=
c(this).html();if(c(this).is("a")){var b=q.find("a").attr("href")||"";f="function"===typeof a.onCellHtmlHyperlink?f+a.onCellHtmlHyperlink(q,d,e,b,h):"href"===a.htmlHyperlink?f+b:f+h;h=""}}})}if(h&&""!==h&&!0===a.htmlContent)f=c.trim(h);else if(h&&""!==h)if(""!==q.attr("data-tableexport-cellformat")){var m=h.replace(/\n/g,"\u2028").replace(/(<\s*br([^>]*)>)/gi,"\u2060"),n=c("<div/>").html(m).contents();b=!1;m="";c.each(n.text().split("\u2028"),function(b,d){0<b&&(m+=" ");!0!==a.preserve.leadingWS&&
(d=ka(d));m+=!0!==a.preserve.trailingWS?la(d):d});c.each(m.split("\u2060"),function(b,d){0<b&&(f+="\n");!0!==a.preserve.leadingWS&&(d=ka(d));!0!==a.preserve.trailingWS&&(d=la(d));f+=d.replace(/\u00AD/g,"")});f=f.replace(/\u00A0/g," ");if("json"===a.type||"excel"===a.type&&"xmlss"===a.mso.fileFormat||!1===a.numbers.output)b=ma(f),!1!==b&&(l="number",f=Number(b));else if(a.numbers.html.decimalMark!==a.numbers.output.decimalMark||a.numbers.html.thousandsSeparator!==a.numbers.output.thousandsSeparator)if(b=
ma(f),!1!==b){n=(""+b.substr(0>b?1:0)).split(".");1===n.length&&(n[1]="");var t=3<n[0].length?n[0].length%3:0;l="number";f=(0>b?"-":"")+(a.numbers.output.thousandsSeparator?(t?n[0].substr(0,t)+a.numbers.output.thousandsSeparator:"")+n[0].substr(t).replace(/(\d{3})(?=\d)/g,"$1"+a.numbers.output.thousandsSeparator):n[0])+(n[1].length?a.numbers.output.decimalMark+n[1]:"")}}else f=h;!0===a.escape&&(f=escape(f));"function"===typeof a.onCellData&&(f=a.onCellData(q,d,e,f,l),q.data("teUserDefText",1))}void 0!==
p&&(p.type=l);return f}function Aa(b){return 0<b.length&&!0===a.preventInjection&&0<="=+-@".indexOf(b.charAt(0))?"'"+b:b}function Na(b,a,e){return a+"-"+e.toLowerCase()}function ea(b,a){(b=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(b))&&(a=[parseInt(b[1]),parseInt(b[2]),parseInt(b[3])]);return a}function Ba(b){var a=L(b,"text-align"),e=L(b,"font-weight"),c=L(b,"font-style"),f="";"start"===a&&(a="rtl"===L(b,"direction")?"right":"left");700<=e&&(f="bold");"italic"===c&&(f+=c);""===f&&(f="normal");
a={style:{align:a,bcolor:ea(L(b,"background-color"),[255,255,255]),color:ea(L(b,"color"),[0,0,0]),fstyle:f},colspan:O(b),rowspan:U(b)};null!==b&&(b=b.getBoundingClientRect(),a.rect={width:b.width,height:b.height});return a}function O(b){var a=c(b).attr("data-tableexport-colspan");"undefined"===typeof a&&c(b).is("[colspan]")&&(a=c(b).attr("colspan"));return parseInt(a)||0}function U(b){var a=c(b).attr("data-tableexport-rowspan");"undefined"===typeof a&&c(b).is("[rowspan]")&&(a=c(b).attr("rowspan"));
return parseInt(a)||0}function L(b,a){try{return window.getComputedStyle?(a=a.replace(/([a-z])([A-Z])/,Na),window.getComputedStyle(b,null).getPropertyValue(a)):b.currentStyle?b.currentStyle[a]:b.style[a]}catch(e){}return""}function fa(a,d,e){d=L(a,d).match(/\d+/);if(null!==d){d=d[0];a=a.parentElement;var b=document.createElement("div");b.style.overflow="hidden";b.style.visibility="hidden";a.appendChild(b);b.style.width=100+e;e=100/b.offsetWidth;a.removeChild(b);return d*e}return 0}function Oa(a){for(var b=
new ArrayBuffer(a.length),e=new Uint8Array(b),c=0;c!==a.length;++c)e[c]=a.charCodeAt(c)&255;return b}function na(a){var b=a.c,c="";for(++b;b;b=Math.floor((b-1)/26))c=String.fromCharCode((b-1)%26+65)+c;return c+(""+(a.r+1))}function oa(a,d){if("undefined"===typeof d||"number"===typeof d)return oa(a.s,a.e);"string"!==typeof a&&(a=na(a));"string"!==typeof d&&(d=na(d));return a===d?a:a+":"+d}function Ca(a,d){var b=Number(a);if(isFinite(b))return b;var c=1;""!==d.thousandsSeparator&&(a=a.replace(new RegExp("([\\d])"+
d.thousandsSeparator+"([\\d])","g"),"$1$2"));"."!==d.decimalMark&&(a=a.replace(new RegExp("([\\d])"+d.decimalMark+"([\\d])","g"),"$1.$2"));a=a.replace(/[$]/g,"").replace(/[%]/g,function(){c*=100;return""});if(isFinite(b=Number(a)))return b/c;a=a.replace(/[(](.*)[)]/,function(a,b){c=-c;return b});return isFinite(b=Number(a))?b/c:b}function xa(a){var b=0,c;if(0===a.length)return b;var p=0;for(c=a.length;p<c;p++){var f=a.charCodeAt(p);b=(b<<5)-b+f;b|=0}return b}function M(b,d,c,p,f,l){var e=!0;"function"===
typeof a.onBeforeSaveToFile&&(e=a.onBeforeSaveToFile(b,d,c,p,f),"boolean"!==typeof e&&(e=!0));if(e)try{if(Da=new Blob([b],{type:c+";charset="+p}),saveAs(Da,d,!1===l),"function"===typeof a.onAfterSaveToFile)a.onAfterSaveToFile(b,d)}catch(h){ja(d,"data:"+c+(p.length?";charset="+p:"")+(f.length?";"+f:"")+",",l?"\ufeff"+b:b)}}function ja(b,d,c){var e=window.navigator.userAgent;if(!1!==b&&window.navigator.msSaveOrOpenBlob)window.navigator.msSaveOrOpenBlob(new Blob([c]),b);else if(!1!==b&&(0<e.indexOf("MSIE ")||
e.match(/Trident.*rv\:11\./))){if(d=document.createElement("iframe")){document.body.appendChild(d);d.setAttribute("style","display:none");d.contentDocument.open("txt/plain","replace");d.contentDocument.write(c);d.contentDocument.close();d.contentWindow.focus();switch(b.substr(b.lastIndexOf(".")+1)){case "doc":case "json":case "png":case "pdf":case "xls":case "xlsx":b+=".txt"}d.contentDocument.execCommand("SaveAs",!0,b);document.body.removeChild(d)}}else{var f=document.createElement("a");if(f){var l=
null;f.style.display="none";!1!==b?f.download=b:f.target="_blank";"object"===typeof c?(window.URL=window.URL||window.webkitURL,e=[],e.push(c),l=window.URL.createObjectURL(new Blob(e,{type:d})),f.href=l):0<=d.toLowerCase().indexOf("base64,")?f.href=d+K(c):f.href=d+encodeURIComponent(c);document.body.appendChild(f);if(document.createEvent)null===ha&&(ha=document.createEvent("MouseEvents")),ha.initEvent("click",!0,!1),f.dispatchEvent(ha);else if(document.createEventObject)f.fireEvent("onclick");else if("function"===
typeof f.onclick)f.onclick();setTimeout(function(){l&&window.URL.revokeObjectURL(l);document.body.removeChild(f);if("function"===typeof a.onAfterSaveToFile)a.onAfterSaveToFile(c,b)},100)}}}function K(a){var b,c="",p=0;if("string"===typeof a){a=a.replace(/\x0d\x0a/g,"\n");var f="";for(b=0;b<a.length;b++){var l=a.charCodeAt(b);128>l?f+=String.fromCharCode(l):(127<l&&2048>l?f+=String.fromCharCode(l>>6|192):(f+=String.fromCharCode(l>>12|224),f+=String.fromCharCode(l>>6&63|128)),f+=String.fromCharCode(l&
63|128))}a=f}for(;p<a.length;){var q=a.charCodeAt(p++);f=a.charCodeAt(p++);b=a.charCodeAt(p++);l=q>>2;q=(q&3)<<4|f>>4;var h=(f&15)<<2|b>>6;var g=b&63;isNaN(f)?h=g=64:isNaN(b)&&(g=64);c=c+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(l)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(q)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(g)}return c}
var a={csvEnclosure:'"',csvSeparator:",",csvUseBOM:!0,date:{html:"dd/mm/yyyy"},displayTableName:!1,escape:!1,exportHiddenCells:!1,fileName:"tableExport",htmlContent:!1,htmlHyperlink:"content",ignoreColumn:[],ignoreRow:[],jsonScope:"all",jspdf:{orientation:"p",unit:"pt",format:"a4",margins:{left:20,right:10,top:10,bottom:10},onDocCreated:null,autotable:{styles:{cellPadding:2,rowHeight:12,fontSize:8,fillColor:255,textColor:50,fontStyle:"normal",overflow:"ellipsize",halign:"inherit",valign:"middle"},
headerStyles:{fillColor:[52,73,94],textColor:255,fontStyle:"bold",halign:"inherit",valign:"middle"},alternateRowStyles:{fillColor:245},tableExport:{doc:null,onAfterAutotable:null,onBeforeAutotable:null,onAutotableText:null,onTable:null,outputImages:!0}}},mso:{fileFormat:"xlshtml",onMsoNumberFormat:null,pageFormat:"a4",pageOrientation:"portrait",rtl:!1,styles:[],worksheetName:"",xslx:{formatId:{date:14,numbers:2}}},numbers:{html:{decimalMark:".",thousandsSeparator:","},output:{decimalMark:".",thousandsSeparator:","}},
onAfterSaveToFile:null,onBeforeSaveToFile:null,onCellData:null,onCellHtmlData:null,onCellHtmlHyperlink:null,onIgnoreRow:null,onTableExportBegin:null,onTableExportEnd:null,outputMode:"file",pdfmake:{enabled:!1,docDefinition:{pageOrientation:"portrait",defaultStyle:{font:"Roboto"}},fonts:{}},preserve:{leadingWS:!1,trailingWS:!1},preventInjection:!0,sql:{tableEnclosure:"`",columnEnclosure:"`"},tbodySelector:"tr",tfootSelector:"tr",theadSelector:"tr",tableName:"Table",type:"csv"},N={a0:[2383.94,3370.39],
a1:[1683.78,2383.94],a2:[1190.55,1683.78],a3:[841.89,1190.55],a4:[595.28,841.89],a5:[419.53,595.28],a6:[297.64,419.53],a7:[209.76,297.64],a8:[147.4,209.76],a9:[104.88,147.4],a10:[73.7,104.88],b0:[2834.65,4008.19],b1:[2004.09,2834.65],b2:[1417.32,2004.09],b3:[1000.63,1417.32],b4:[708.66,1000.63],b5:[498.9,708.66],b6:[354.33,498.9],b7:[249.45,354.33],b8:[175.75,249.45],b9:[124.72,175.75],b10:[87.87,124.72],c0:[2599.37,3676.54],c1:[1836.85,2599.37],c2:[1298.27,1836.85],c3:[918.43,1298.27],c4:[649.13,
918.43],c5:[459.21,649.13],c6:[323.15,459.21],c7:[229.61,323.15],c8:[161.57,229.61],c9:[113.39,161.57],c10:[79.37,113.39],dl:[311.81,623.62],letter:[612,792],"government-letter":[576,756],legal:[612,1008],"junior-legal":[576,360],ledger:[1224,792],tabloid:[792,1224],"credit-card":[153,243]},C=this,ha=null,u=[],w=[],n=0,t="",T=[],G=[],Da,J=[],V=!1;c.extend(!0,a,k);"xlsx"===a.type&&(a.mso.fileFormat=a.type,a.type="excel");"undefined"!==typeof a.excelFileFormat&&"undefined"===a.mso.fileFormat&&(a.mso.fileFormat=
a.excelFileFormat);"undefined"!==typeof a.excelPageFormat&&"undefined"===a.mso.pageFormat&&(a.mso.pageFormat=a.excelPageFormat);"undefined"!==typeof a.excelPageOrientation&&"undefined"===a.mso.pageOrientation&&(a.mso.pageOrientation=a.excelPageOrientation);"undefined"!==typeof a.excelRTL&&"undefined"===a.mso.rtl&&(a.mso.rtl=a.excelRTL);"undefined"!==typeof a.excelstyles&&"undefined"===a.mso.styles&&(a.mso.styles=a.excelstyles);"undefined"!==typeof a.onMsoNumberFormat&&"undefined"===a.mso.onMsoNumberFormat&&
(a.mso.onMsoNumberFormat=a.onMsoNumberFormat);"undefined"!==typeof a.worksheetName&&"undefined"===a.mso.worksheetName&&(a.mso.worksheetName=a.worksheetName);a.mso.pageOrientation="l"===a.mso.pageOrientation.substr(0,1)?"landscape":"portrait";a.date.html=a.date.html||"";if(a.date.html.length){k=[];k.dd="(3[01]|[12][0-9]|0?[1-9])";k.mm="(1[012]|0?[1-9])";k.yyyy="((?:1[6-9]|2[0-2])\\d{2})";k.yy="(\\d{2})";var r=a.date.html.match(/[^a-zA-Z0-9]/)[0];r=a.date.html.toLowerCase().split(r);a.date.regex="^\\s*";
a.date.regex+=k[r[0]];a.date.regex+="(.)";a.date.regex+=k[r[1]];a.date.regex+="\\2";a.date.regex+=k[r[2]];a.date.regex+="\\s*$";a.date.pattern=new RegExp(a.date.regex,"g");k=r.indexOf("dd")+1;a.date.match_d=k+(1<k?1:0);k=r.indexOf("mm")+1;a.date.match_m=k+(1<k?1:0);k=(0<=r.indexOf("yyyy")?r.indexOf("yyyy"):r.indexOf("yy"))+1;a.date.match_y=k+(1<k?1:0)}T=S(C);if("function"===typeof a.onTableExportBegin)a.onTableExportBegin();if("csv"===a.type||"tsv"===a.type||"txt"===a.type){var P="",Z=0;G=[];n=0;
var pa=function(b,d,e){b.each(function(){t="";B(this,d,n,e+b.length,function(b,c,d){var e=t,f="";if(null!==b)if(b=E(b,c,d),c=null===b||""===b?"":b.toString(),"tsv"===a.type)b instanceof Date&&b.toLocaleString(),f=W(c,"\t"," ");else if(b instanceof Date)f=a.csvEnclosure+b.toLocaleString()+a.csvEnclosure;else if(f=Aa(c),f=W(f,a.csvEnclosure,a.csvEnclosure+a.csvEnclosure),0<=f.indexOf(a.csvSeparator)||/[\r\n ]/g.test(f))f=a.csvEnclosure+f+a.csvEnclosure;t=e+(f+("tsv"===a.type?"\t":a.csvSeparator))});
t=c.trim(t).substring(0,t.length-1);0<t.length&&(0<P.length&&(P+="\n"),P+=t);n++});return b.length};Z+=pa(c(C).find("thead").first().find(a.theadSelector),"th,td",Z);A(c(C),"tbody").each(function(){Z+=pa(A(c(this),a.tbodySelector),"td,th",Z)});a.tfootSelector.length&&pa(c(C).find("tfoot").first().find(a.tfootSelector),"td,th",Z);P+="\n";if("string"===a.outputMode)return P;if("base64"===a.outputMode)return K(P);if("window"===a.outputMode){ja(!1,"data:text/"+("csv"===a.type?"csv":"plain")+";charset=utf-8,",
P);return}M(P,a.fileName+"."+a.type,"text/"+("csv"===a.type?"csv":"plain"),"utf-8","","csv"===a.type&&a.csvUseBOM)}else if("sql"===a.type){n=0;G=[];var D="INSERT INTO "+a.sql.tableEnclosure+a.tableName+a.sql.tableEnclosure+" (";u=y(c(C));c(u).each(function(){B(this,"th,td",n,u.length,function(b,c,e){b=E(b,c,e)||"";-1<b.indexOf(a.sql.columnEnclosure)&&(b=W(b.toString(),a.sql.columnEnclosure,a.sql.columnEnclosure+a.sql.columnEnclosure));D+=a.sql.columnEnclosure+b+a.sql.columnEnclosure+","});n++;D=c.trim(D).substring(0,
D.length-1)});D+=") VALUES ";w=v(c(C));c(w).each(function(){t="";B(this,"td,th",n,u.length+w.length,function(a,c,e){a=E(a,c,e)||"";-1<a.indexOf("'")&&(a=W(a.toString(),"'","''"));t+="'"+a+"',"});3<t.length&&(D+="("+t,D=c.trim(D).substring(0,D.length-1),D+="),");n++});D=c.trim(D).substring(0,D.length-1);D+=";";if("string"===a.outputMode)return D;if("base64"===a.outputMode)return K(D);M(D,a.fileName+".sql","application/sql","utf-8","",!1)}else if("json"===a.type){var X=[];G=[];u=y(c(C));c(u).each(function(){var a=
[];B(this,"th,td",n,u.length,function(b,c,g){a.push(E(b,c,g))});X.push(a)});var qa=[];w=v(c(C));c(w).each(function(){var a={},d=0;B(this,"td,th",n,u.length+w.length,function(b,c,f){X.length?a[X[X.length-1][d]]=E(b,c,f):a[d]=E(b,c,f);d++});!1===c.isEmptyObject(a)&&qa.push(a);n++});k="head"===a.jsonScope?JSON.stringify(X):"data"===a.jsonScope?JSON.stringify(qa):JSON.stringify({header:X,data:qa});if("string"===a.outputMode)return k;if("base64"===a.outputMode)return K(k);M(k,a.fileName+".json","application/json",
"utf-8","base64",!1)}else if("xml"===a.type){n=0;G=[];var Q='<?xml version="1.0" encoding="utf-8"?>';Q+="<tabledata><fields>";u=y(c(C));c(u).each(function(){B(this,"th,td",n,u.length,function(a,c,e){Q+="<field>"+E(a,c,e)+"</field>"});n++});Q+="</fields><data>";var Ea=1;w=v(c(C));c(w).each(function(){var a=1;t="";B(this,"td,th",n,u.length+w.length,function(b,c,g){t+="<column-"+a+">"+E(b,c,g)+"</column-"+a+">";a++});0<t.length&&"<column-1></column-1>"!==t&&(Q+='<row id="'+Ea+'">'+t+"</row>",Ea++);n++});
Q+="</data></tabledata>";if("string"===a.outputMode)return Q;if("base64"===a.outputMode)return K(Q);M(Q,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"===a.type&&"xmlss"===a.mso.fileFormat){var ra=[],F=[];c(C).filter(function(){return I(c(this))}).each(function(){function b(a,b,d){var f=[];c(a).each(function(){var b=0,e=0;t="";B(this,"td,th",n,d+a.length,function(a,d,l){if(null!==a){var h="";d=E(a,d,l);l="String";if(!1!==jQuery.isNumeric(d))l="Number";else{var g=Ma(d);!1!==
g&&(d=g,l="Number",h+=' ss:StyleID="pct1"')}"Number"!==l&&(d=d.replace(/\n/g,"<br>"));g=O(a);a=U(a);c.each(f,function(){if(n>=this.s.r&&n<=this.e.r&&e>=this.s.c&&e<=this.e.c)for(var a=0;a<=this.e.c-this.s.c;++a)e++,b++});if(a||g)a=a||1,g=g||1,f.push({s:{r:n,c:e},e:{r:n+a-1,c:e+g-1}});1<g&&(h+=' ss:MergeAcross="'+(g-1)+'"',e+=g-1);1<a&&(h+=' ss:MergeDown="'+(a-1)+'" ss:StyleID="rsp1"');0<b&&(h+=' ss:Index="'+(e+1)+'"',b=0);t+="<Cell"+h+'><Data ss:Type="'+l+'">'+c("<div />").text(d).html()+"</Data></Cell>\r";
e++}});0<t.length&&(H+='<Row ss:AutoFitHeight="0">\r'+t+"</Row>\r");n++});return a.length}var d=c(this),e="";"string"===typeof a.mso.worksheetName&&a.mso.worksheetName.length?e=a.mso.worksheetName+" "+(F.length+1):"undefined"!==typeof a.mso.worksheetName[F.length]&&(e=a.mso.worksheetName[F.length]);e.length||(e=d.find("caption").text()||"");e.length||(e="Table "+(F.length+1));e=c.trim(e.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));F.push(c("<div />").text(e).html());!1===a.exportHiddenCells&&(J=
d.find("tr, th, td").filter(":hidden"),V=0<J.length);n=0;T=S(this);H="<Table>\r";e=b(y(d),"th,td",0);b(v(d),"td,th",e);H+="</Table>\r";ra.push(H)});k={};r={};for(var m,R,Y=0,da=F.length;Y<da;Y++)m=F[Y],R=k[m],R=k[m]=null==R?1:R+1,2===R&&(F[r[m]]=F[r[m]].substring(0,29)+"-1"),1<k[m]?F[Y]=F[Y].substring(0,29)+"-"+k[m]:r[m]=Y;k='<?xml version="1.0" encoding="UTF-8"?>\r<?mso-application progid="Excel.Sheet"?>\r<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:o="urn:schemas-microsoft-com:office:office"\r xmlns:x="urn:schemas-microsoft-com:office:excel"\r xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"\r xmlns:html="http://www.w3.org/TR/REC-html40">\r<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">\r <Created>'+
(new Date).toISOString()+'</Created>\r</DocumentProperties>\r<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">\r <AllowPNG/>\r</OfficeDocumentSettings>\r<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">\r <WindowHeight>9000</WindowHeight>\r <WindowWidth>13860</WindowWidth>\r <WindowTopX>0</WindowTopX>\r <WindowTopY>0</WindowTopY>\r <ProtectStructure>False</ProtectStructure>\r <ProtectWindows>False</ProtectWindows>\r</ExcelWorkbook>\r<Styles>\r <Style ss:ID="Default" ss:Name="Normal">\r <Alignment ss:Vertical="Bottom"/>\r <Borders/>\r <Font/>\r <Interior/>\r <NumberFormat/>\r <Protection/>\r </Style>\r <Style ss:ID="rsp1">\r <Alignment ss:Vertical="Center"/>\r </Style>\r <Style ss:ID="pct1">\r <NumberFormat ss:Format="Percent"/>\r </Style>\r</Styles>\r';
for(r=0;r<ra.length;r++)k+='<Worksheet ss:Name="'+F[r]+'" ss:RightToLeft="'+(a.mso.rtl?"1":"0")+'">\r'+ra[r],k=a.mso.rtl?k+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">\r<DisplayRightToLeft/>\r</WorksheetOptions>\r':k+'<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"/>\r',k+="</Worksheet>\r";k+="</Workbook>\r";if("string"===a.outputMode)return k;if("base64"===a.outputMode)return K(k);M(k,a.fileName+".xml","application/xml","utf-8","base64",!1)}else if("excel"===
a.type&&"xlsx"===a.mso.fileFormat){var aa=[],Fa=XLSX.utils.book_new();c(C).filter(function(){return I(c(this))}).each(function(){for(var b=c(this),d={},e=this.getElementsByTagName("tr"),g={s:{r:0,c:0},e:{r:0,c:0}},f=[],l,q=[],h=0,k=0,m,n,t,u,r,w=XLSX.SSF.get_table();h<e.length&&1E7>k;++h)if(m=e[h],n=!1,"function"===typeof a.onIgnoreRow&&(n=a.onIgnoreRow(c(m),h)),!0!==n&&(0===a.ignoreRow.length||-1===c.inArray(h,a.ignoreRow)&&-1===c.inArray(h-e.length,a.ignoreRow))&&!1!==I(c(m))){var y=m.children,
C=0;for(m=0;m<y.length;++m)r=y[m],u=+O(r)||1,C+=u;var A=0;for(m=n=0;m<y.length;++m)if(r=y[m],u=+O(r)||1,l=m+A,!sa(c(r),C,l+(l<n?n-l:0))){A+=u-1;for(l=0;l<f.length;++l){var v=f[l];v.s.c==n&&v.s.r<=k&&k<=v.e.r&&(n=v.e.c+1,l=-1)}(0<(t=+U(r))||1<u)&&f.push({s:{r:k,c:n},e:{r:k+(t||1)-1,c:n+u-1}});var D={type:""};l=E(r,h,m+A,D);v={t:"s",v:l};var B="";if(""!==c(r).attr("data-tableexport-cellformat")){var x=parseInt(c(r).attr("data-tableexport-xlsxformatid")||0);0===x&&"function"===typeof a.mso.xslx.formatId.numbers&&
(x=a.mso.xslx.formatId.numbers(c(r),h,m+A));0===x&&"function"===typeof a.mso.xslx.formatId.date&&(x=a.mso.xslx.formatId.date(c(r),h,m+A));if(49===x||"@"===x)B="s";else if("number"===D.type||0<x&&14>x||36<x&&41>x||48===x)B="n";else if("date"===D.type||13<x&&37>x||44<x&&48>x||56===x)B="d"}else B="s";if(null!=l)if(0===l.length)v.t="z";else if(0!==l.trim().length&&"s"!==B)if("function"===D.type)v={f:l};else if("TRUE"===l)v={t:"b",v:!0};else if("FALSE"===l)v={t:"b",v:!1};else if(""===B&&c(r).find("a").length)l=
"href"!==a.htmlHyperlink?l:"",v={f:'=HYPERLINK("'+c(r).find("a").attr("href")+(l.length?'","'+l:"")+'")'};else if("n"===B||isFinite(Ca(l,a.numbers.output))){if(r=Ca(l,a.numbers.output),0===x&&"function"!==typeof a.mso.xslx.formatId.numbers&&(x=a.mso.xslx.formatId.numbers),isFinite(r)||isFinite(l))v={t:"n",v:isFinite(r)?r:l,z:"string"===typeof x?x:x in w?w[x]:"0.00"}}else if(!1!==(r=La(l))||"d"===B)0===x&&"function"!==typeof a.mso.xslx.formatId.date&&(x=a.mso.xslx.formatId.date),v={t:"d",v:!1!==r?
r:l,z:"string"===typeof x?x:x in w?w[x]:"m/d/yy"};d[na({c:n,r:k})]=v;g.e.c<n&&(g.e.c=n);n+=u}++k}f.length&&(d["!merges"]=f);q.length&&(d["!rows"]=q);g.e.r=k-1;d["!ref"]=oa(g);1E7<=k&&(d["!fullref"]=oa((g.e.r=e.length-h+k-1,g)));e="";"string"===typeof a.mso.worksheetName&&a.mso.worksheetName.length?e=a.mso.worksheetName+" "+(aa.length+1):"undefined"!==typeof a.mso.worksheetName[aa.length]&&(e=a.mso.worksheetName[aa.length]);e.length||(e=b.find("caption").text()||"");e.length||(e="Table "+(aa.length+
1));e=c.trim(e.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31));aa.push(e);XLSX.utils.book_append_sheet(Fa,d,e)});k=XLSX.write(Fa,{type:"binary",bookType:a.mso.fileFormat,bookSST:!1});M(Oa(k),a.fileName+"."+a.mso.fileFormat,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","UTF-8","",!1)}else if("excel"===a.type||"xls"===a.type||"word"===a.type||"doc"===a.type){k="excel"===a.type||"xls"===a.type?"excel":"word";r="excel"===k?"xls":"doc";m='xmlns:x="urn:schemas-microsoft-com:office:'+
k+'"';var H="",ba="";c(C).filter(function(){return I(c(this))}).each(function(){var b=c(this);""===ba&&(ba=a.mso.worksheetName||b.find("caption").text()||"Table",ba=c.trim(ba.replace(/[\\\/[\]*:?'"]/g,"").substring(0,31)));!1===a.exportHiddenCells&&(J=b.find("tr, th, td").filter(":hidden"),V=0<J.length);n=0;G=[];T=S(this);H+="<table><thead>";u=y(b);c(u).each(function(){var b=c(this);t="";B(this,"th,td",n,u.length,function(c,d,f){if(null!==c){var e="";t+="<th";if(a.mso.styles.length){var g=document.defaultView.getComputedStyle(c,
null),h=document.defaultView.getComputedStyle(b[0],null),k;for(k in a.mso.styles){var m=g[a.mso.styles[k]];""===m&&(m=h[a.mso.styles[k]]);""!==m&&"0px none rgb(0, 0, 0)"!==m&&"rgba(0, 0, 0, 0)"!==m&&(e+=""===e?'style="':";",e+=a.mso.styles[k]+":"+m)}}""!==e&&(t+=" "+e+'"');e=O(c);0<e&&(t+=' colspan="'+e+'"');e=U(c);0<e&&(t+=' rowspan="'+e+'"');t+=">"+E(c,d,f)+"</th>"}});0<t.length&&(H+="<tr>"+t+"</tr>");n++});H+="</thead><tbody>";w=v(b);c(w).each(function(){var b=c(this);t="";B(this,"td,th",n,u.length+
w.length,function(d,g,f){if(null!==d){var e=E(d,g,f),q="",h=c(d).attr("data-tableexport-msonumberformat");"undefined"===typeof h&&"function"===typeof a.mso.onMsoNumberFormat&&(h=a.mso.onMsoNumberFormat(d,g,f));"undefined"!==typeof h&&""!==h&&(q="style=\"mso-number-format:'"+h+"'");if(a.mso.styles.length){g=document.defaultView.getComputedStyle(d,null);f=document.defaultView.getComputedStyle(b[0],null);for(var k in a.mso.styles)h=g[a.mso.styles[k]],""===h&&(h=f[a.mso.styles[k]]),""!==h&&"0px none rgb(0, 0, 0)"!==
h&&"rgba(0, 0, 0, 0)"!==h&&(q+=""===q?'style="':";",q+=a.mso.styles[k]+":"+h)}t+="<td";""!==q&&(t+=" "+q+'"');q=O(d);0<q&&(t+=' colspan="'+q+'"');d=U(d);0<d&&(t+=' rowspan="'+d+'"');"string"===typeof e&&""!==e&&(e=Aa(e),e=e.replace(/\n/g,"<br>"));t+=">"+e+"</td>"}});0<t.length&&(H+="<tr>"+t+"</tr>");n++});a.displayTableName&&(H+="<tr><td></td></tr><tr><td></td></tr><tr><td>"+E(c("<p>"+a.tableName+"</p>"))+"</td></tr>");H+="</tbody></table>"});m='<html xmlns:o="urn:schemas-microsoft-com:office:office" '+
m+' xmlns="http://www.w3.org/TR/REC-html40">'+('<meta http-equiv="content-type" content="application/vnd.ms-'+k+'; charset=UTF-8">');m+="<head>";"excel"===k&&(m+="\x3c!--[if gte mso 9]>",m+="<xml>",m+="<x:ExcelWorkbook>",m+="<x:ExcelWorksheets>",m+="<x:ExcelWorksheet>",m+="<x:Name>",m+=ba,m+="</x:Name>",m+="<x:WorksheetOptions>",m+="<x:DisplayGridlines/>",a.mso.rtl&&(m+="<x:DisplayRightToLeft/>"),m+="</x:WorksheetOptions>",m+="</x:ExcelWorksheet>",m+="</x:ExcelWorksheets>",m+="</x:ExcelWorkbook>",
m+="</xml>",m+="<![endif]--\x3e");m+="<style>";m+="@page { size:"+a.mso.pageOrientation+"; mso-page-orientation:"+a.mso.pageOrientation+"; }";m+="@page Section1 {size:"+N[a.mso.pageFormat][0]+"pt "+N[a.mso.pageFormat][1]+"pt";m+="; margin:1.0in 1.25in 1.0in 1.25in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";m+="div.Section1 {page:Section1;}";m+="@page Section2 {size:"+N[a.mso.pageFormat][1]+"pt "+N[a.mso.pageFormat][0]+"pt";m+=";mso-page-orientation:"+a.mso.pageOrientation+
";margin:1.25in 1.0in 1.25in 1.0in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}";m+="div.Section2 {page:Section2;}";m+="br {mso-data-placement:same-cell;}";m+="</style>";m+="</head>";m+="<body>";m+='<div class="Section'+("landscape"===a.mso.pageOrientation?"2":"1")+'">';m+=H;m+="</div>";m+="</body>";m+="</html>";if("string"===a.outputMode)return m;if("base64"===a.outputMode)return K(m);M(m,a.fileName+"."+r,"application/vnd.ms-"+k,"","base64",!1)}else if("png"===a.type)html2canvas(c(C)[0]).then(function(b){b=
b.toDataURL();for(var c=atob(b.substring(22)),e=new ArrayBuffer(c.length),g=new Uint8Array(e),f=0;f<c.length;f++)g[f]=c.charCodeAt(f);if("string"===a.outputMode)return c;if("base64"===a.outputMode)return K(b);"window"===a.outputMode?window.open(b):M(e,a.fileName+".png","image/png","","",!1)});else if("pdf"===a.type)if(!0===a.pdfmake.enabled){k=[];var Ga=[];n=0;G=[];r=function(a,d,e){var b=0;c(a).each(function(){var a=[];B(this,d,n,e,function(b,c,d){if("undefined"!==typeof b&&null!==b){var e=O(b),
f=U(b);b=E(b,c,d)||" ";1<e||1<f?a.push({colSpan:e||1,rowSpan:f||1,text:b}):a.push(b)}else a.push(" ")});a.length&&Ga.push(a);b<a.length&&(b=a.length);n++});return b};u=y(c(this));m=r(u,"th,td",u.length);for(R=k.length;R<m;R++)k.push("*");w=v(c(this));r(w,"th,td",u.length+w.length);k={content:[{table:{headerRows:u.length,widths:k,body:Ga}}]};"undefined"!==typeof pdfMake&&(pdfMake.fonts={Roboto:{normal:"Roboto-Regular.ttf",bold:"Roboto-Medium.ttf",italics:"Roboto-Italic.ttf",bolditalics:"Roboto-MediumItalic.ttf"}},
pdfMake.vfs.hasOwnProperty("Mirza-Regular.ttf")?(a.pdfmake.docDefinition.defaultStyle.font="Mirza",c.extend(!0,pdfMake.fonts,{Mirza:{normal:"Mirza-Regular.ttf",bold:"Mirza-Bold.ttf",italics:"Mirza-Medium.ttf",bolditalics:"Mirza-SemiBold.ttf"}})):pdfMake.vfs.hasOwnProperty("gbsn00lp.ttf")?(a.pdfmake.docDefinition.defaultStyle.font="gbsn00lp",c.extend(!0,pdfMake.fonts,{gbsn00lp:{normal:"gbsn00lp.ttf",bold:"gbsn00lp.ttf",italics:"gbsn00lp.ttf",bolditalics:"gbsn00lp.ttf"}})):pdfMake.vfs.hasOwnProperty("ZCOOLXiaoWei-Regular.ttf")&&
(a.pdfmake.docDefinition.defaultStyle.font="ZCOOLXiaoWei",c.extend(!0,pdfMake.fonts,{ZCOOLXiaoWei:{normal:"ZCOOLXiaoWei-Regular.ttf",bold:"ZCOOLXiaoWei-Regular.ttf",italics:"ZCOOLXiaoWei-Regular.ttf",bolditalics:"ZCOOLXiaoWei-Regular.ttf"}})),c.extend(!0,k,a.pdfmake.docDefinition),c.extend(!0,pdfMake.fonts,a.pdfmake.fonts),"undefined"!==typeof pdfMake.createPdf&&pdfMake.createPdf(k).getBuffer(function(b){M(b,a.fileName+".pdf","application/pdf","","",!1)}))}else if(!1===a.jspdf.autotable){k={dim:{w:fa(c(C).first().get(0),
"width","mm"),h:fa(c(C).first().get(0),"height","mm")},pagesplit:!1};var Ha=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format);Ha.addHTML(c(C).first(),a.jspdf.margins.left,a.jspdf.margins.top,k,function(){ua(Ha,!1)})}else{var g=a.jspdf.autotable.tableExport;if("string"===typeof a.jspdf.format&&"bestfit"===a.jspdf.format.toLowerCase()){var ia="",ca="",Ia=0;c(C).each(function(){if(I(c(this))){var a=fa(c(this).get(0),"width","pt");if(a>Ia){a>N.a0[0]&&(ia="a0",ca="l");for(var d in N)N.hasOwnProperty(d)&&
N[d][1]>a&&(ia=d,ca="l",N[d][0]>a&&(ca="p"));Ia=a}}});a.jspdf.format=""===ia?"a4":ia;a.jspdf.orientation=""===ca?"w":ca}if(null==g.doc&&(g.doc=new jsPDF(a.jspdf.orientation,a.jspdf.unit,a.jspdf.format),g.wScaleFactor=1,g.hScaleFactor=1,"function"===typeof a.jspdf.onDocCreated))a.jspdf.onDocCreated(g.doc);!0===g.outputImages&&(g.images={});"undefined"!==typeof g.images&&(c(C).filter(function(){return I(c(this))}).each(function(){var b=0;G=[];!1===a.exportHiddenCells&&(J=c(this).find("tr, th, td").filter(":hidden"),
V=0<J.length);u=y(c(this));w=v(c(this));c(w).each(function(){B(this,"td,th",u.length+b,u.length+w.length,function(a){wa(a,c(a).children(),g)});b++})}),u=[],w=[]);Ka(g,function(){c(C).filter(function(){return I(c(this))}).each(function(){var b;n=0;G=[];!1===a.exportHiddenCells&&(J=c(this).find("tr, th, td").filter(":hidden"),V=0<J.length);T=S(this);g.columns=[];g.rows=[];g.teCells={};if("function"===typeof g.onTable&&!1===g.onTable(c(this),a))return!0;a.jspdf.autotable.tableExport=null;var d=c.extend(!0,
{},a.jspdf.autotable);a.jspdf.autotable.tableExport=g;d.margin={};c.extend(!0,d.margin,a.jspdf.margins);d.tableExport=g;"function"!==typeof d.beforePageContent&&(d.beforePageContent=function(a){if(1===a.pageCount){var b=a.table.rows.concat(a.table.headerRow);c.each(b,function(){0<this.height&&(this.height+=(2-1.15)/2*this.styles.fontSize,a.table.height+=(2-1.15)/2*this.styles.fontSize)})}});"function"!==typeof d.createdHeaderCell&&(d.createdHeaderCell=function(a,b){a.styles=c.extend({},b.row.styles);
if("undefined"!==typeof g.columns[b.column.dataKey]){var e=g.columns[b.column.dataKey];if("undefined"!==typeof e.rect){a.contentWidth=e.rect.width;if("undefined"===typeof g.heightRatio||0===g.heightRatio){var f=b.row.raw[b.column.dataKey].rowspan?b.row.raw[b.column.dataKey].rect.height/b.row.raw[b.column.dataKey].rowspan:b.row.raw[b.column.dataKey].rect.height;g.heightRatio=a.styles.rowHeight/f}f=b.row.raw[b.column.dataKey].rect.height*g.heightRatio;f>a.styles.rowHeight&&(a.styles.rowHeight=f)}a.styles.halign=
"inherit"===d.headerStyles.halign?"center":d.headerStyles.halign;a.styles.valign=d.headerStyles.valign;"undefined"!==typeof e.style&&!0!==e.style.hidden&&("inherit"===d.headerStyles.halign&&(a.styles.halign=e.style.align),"inherit"===d.styles.fillColor&&(a.styles.fillColor=e.style.bcolor),"inherit"===d.styles.textColor&&(a.styles.textColor=e.style.color),"inherit"===d.styles.fontStyle&&(a.styles.fontStyle=e.style.fstyle))}});"function"!==typeof d.createdCell&&(d.createdCell=function(a,b){b=g.teCells[b.row.index+
":"+b.column.dataKey];a.styles.halign="inherit"===d.styles.halign?"center":d.styles.halign;a.styles.valign=d.styles.valign;"undefined"!==typeof b&&"undefined"!==typeof b.style&&!0!==b.style.hidden&&("inherit"===d.styles.halign&&(a.styles.halign=b.style.align),"inherit"===d.styles.fillColor&&(a.styles.fillColor=b.style.bcolor),"inherit"===d.styles.textColor&&(a.styles.textColor=b.style.color),"inherit"===d.styles.fontStyle&&(a.styles.fontStyle=b.style.fstyle))});"function"!==typeof d.drawHeaderCell&&
(d.drawHeaderCell=function(a,b){var c=g.columns[b.column.dataKey];return(!0!==c.style.hasOwnProperty("hidden")||!0!==c.style.hidden)&&0<=c.rowIndex?va(a,b,c):!1});"function"!==typeof d.drawCell&&(d.drawCell=function(a,b){var d=g.teCells[b.row.index+":"+b.column.dataKey];if(!0!==("undefined"!==typeof d&&d.isCanvas))va(a,b,d)&&(g.doc.rect(a.x,a.y,a.width,a.height,a.styles.fillStyle),"undefined"===typeof d||"undefined"!==typeof d.hasUserDefText&&!0===d.hasUserDefText||"undefined"===typeof d.elements||
!d.elements.length?za(a,{},g):(b=a.height/d.rect.height,b>g.hScaleFactor&&(g.hScaleFactor=b),g.wScaleFactor=a.width/d.rect.width,b=a.textPos.y,ya(a,d.elements,g),a.textPos.y=b,za(a,d.elements,g)));else{d=d.elements[0];var e=c(d).attr("data-tableexport-canvas"),f=d.getBoundingClientRect();a.width=f.width*g.wScaleFactor;a.height=f.height*g.hScaleFactor;b.row.height=a.height;ta(a,d,e,g)}return!1});g.headerrows=[];u=y(c(this));c(u).each(function(){b=0;g.headerrows[n]=[];B(this,"th,td",n,u.length,function(a,
c,d){var e=Ba(a);e.title=E(a,c,d);e.key=b++;e.rowIndex=n;g.headerrows[n].push(e)});n++});if(0<n)for(var e=n-1;0<=e;)c.each(g.headerrows[e],function(){var a=this;0<e&&null===this.rect&&(a=g.headerrows[e-1][this.key]);null!==a&&0<=a.rowIndex&&(!0!==a.style.hasOwnProperty("hidden")||!0!==a.style.hidden)&&g.columns.push(a)}),e=0<g.columns.length?-1:e-1;var k=0;w=[];w=v(c(this));c(w).each(function(){var a=[];b=0;B(this,"td,th",n,u.length+w.length,function(d,e,f){if("undefined"===typeof g.columns[b]){var h=
{title:"",key:b,style:{hidden:!0}};g.columns.push(h)}a.push(E(d,e,f));"undefined"!==typeof d&&null!==d?(h=Ba(d),h.isCanvas=d.hasAttribute("data-tableexport-canvas"),h.elements=h.isCanvas?c(d):c(d).children(),"undefined"!==typeof c(d).data("teUserDefText")&&(h.hasUserDefText=!0)):(h=c.extend(!0,{},g.teCells[k+":"+(b-1)]),h.colspan=-1);g.teCells[k+":"+b++]=h});a.length&&(g.rows.push(a),k++);n++});if("function"===typeof g.onBeforeAutotable)g.onBeforeAutotable(c(this),g.columns,g.rows,d);g.doc.autoTable(g.columns,
g.rows,d);if("function"===typeof g.onAfterAutotable)g.onAfterAutotable(c(this),d);a.jspdf.autotable.startY=g.doc.autoTableEndPosY()+d.margin.top});ua(g.doc,"undefined"!==typeof g.images&&!1===jQuery.isEmptyObject(g.images));"undefined"!==typeof g.headerrows&&(g.headerrows.length=0);"undefined"!==typeof g.columns&&(g.columns.length=0);"undefined"!==typeof g.rows&&(g.rows.length=0);delete g.doc;g.doc=null})}if("function"===typeof a.onTableExportEnd)a.onTableExportEnd();return this}})(jQuery);

View File

@ -1,12 +0,0 @@
function updateLabel() {
var form = $('contentForm');
var preset_ddm = form.elements['preset'];
var presetIndex = preset_ddm[preset_ddm.selectedIndex].value;
if ( labels[presetIndex] ) {
form.newLabel.value = labels[presetIndex];
} else {
form.newLabel.value = '';
}
}
window.addEventListener('DOMContentLoaded', updateLabel);

View File

@ -1,11 +0,0 @@
<?php
global $labels;
?>
var labels = new Array();
<?php
foreach ( $labels as $index=>$label ) {
?>
labels[<?php echo validInt($index) ?>] = '<?php echo validJsStr($label) ?>';
<?php
}
?>

View File

@ -1,4 +1,6 @@
var periodical_id;
var pauseBtn = $j('#pauseBtn');
var playBtn = $j('#playBtn');
function nextCycleView() {
window.location.replace('?view=cycle&mid='+nextMid+'&mode='+mode, cycleRefreshTimeout);
@ -6,14 +8,14 @@ function nextCycleView() {
function cyclePause() {
$clear(periodical_id);
$('pauseBtn').disabled = true;
$('playBtn').disabled = false;
pauseBtn.prop('disabled', true);
playBtn.prop('disabled', false);
}
function cycleStart() {
periodical_id = nextCycleView.periodical(cycleRefreshTimeout);
$('pauseBtn').disabled = false;
$('playBtn').disabled = true;
pauseBtn.prop('disabled', false);
playBtn.prop('disabled', true);
}
function cycleNext() {
@ -45,8 +47,8 @@ function initCycle() {
}
function changeSize() {
var width = $('width').get('value');
var height = $('height').get('value');
var width = $j('#width').val();
var height = $j('#height').val();
// Scale the frame
monitor_frame = $j('#imageFeed');
@ -62,7 +64,7 @@ function changeSize() {
}
/* Stream could be an applet so can't use moo tools */
var streamImg = $('liveStream'+monitorData[monIdx].id);
var streamImg = document.getElementById('liveStream'+monitorData[monIdx].id);
if ( streamImg ) {
if ( streamImg.nodeName == 'IMG' ) {
var src = streamImg.src;
@ -78,16 +80,16 @@ function changeSize() {
} else {
console.log('Did not find liveStream'+monitorData[monIdx].id);
}
$('scale').set('value', '');
$j('#scale').val('');
Cookie.write('zmCycleScale', '', {duration: 10*365, samesite: 'strict'});
Cookie.write('zmCycleWidth', width, {duration: 10*365, samesite: 'strict'});
Cookie.write('zmCycleHeight', height, {duration: 10*365, samesite: 'strict'});
} // end function changeSize()
function changeScale() {
var scale = $('scale').get('value');
$('width').set('value', 'auto');
$('height').set('value', 'auto');
var scale = $j('#scale').val();
$j('#width').val('auto');
$j('#height').val('auto');
Cookie.write('zmCycleScale', scale, {duration: 10*365, samesite: 'strict'});
Cookie.write('zmCycleWidth', 'auto', {duration: 10*365, samesite: 'strict'});
Cookie.write('zmCycleHeight', 'auto', {duration: 10*365, samesite: 'strict'});
@ -153,4 +155,4 @@ function changeScale() {
}
} // end function changeScale()
window.addEventListener('DOMContentLoaded', initCycle);
$j(document).ready(initCycle);

View File

@ -61,7 +61,7 @@ function processRows(rows) {
if ( canEdit.Monitors ) row.Monitor = '<a href="?view=monitor&amp;mid=' + mid + '">' + row.Monitor + '</a>';
if ( canEdit.Events ) row.Cause = '<a href="#" title="' + row.Notes + '" class="eDetailLink" data-eid="' + eid + '">' + row.Cause + '</a>';
if ( row.Notes.indexOf('detected:') >= 0 ) {
row.Cause = row.Cause + '<a href="#" data-on-click-this="objdetectModal" data-event-id=' +eid+ '><div class="small text-nowrap text-muted"><u>' + row.Notes + '</u></div></div></a>';
row.Cause = row.Cause + '<a href="#" class="objDetectLink" data-eid=' +eid+ '><div class="small text-nowrap text-muted"><u>' + row.Notes + '</u></div></div></a>';
} else if ( row.Notes != 'Forced Web: ' ) {
row.Cause = row.Cause + '<br/><div class="small text-nowrap text-muted">' + row.Notes + '</div>';
}
@ -141,9 +141,7 @@ function getEventDetailModal(eid) {
.fail(logAjaxFail);
}
function objdetectModal( element ) {
var eid = element.getAttribute('data-event-id');
function getObjdetectModal(eid) {
$j.getJSON(thisUrl + '?request=modal&modal=objdetect&eid=' + eid)
.done(function(data) {
insertModalHtml('objdetectModal', data.html);
@ -314,8 +312,13 @@ function initPage() {
// Update table links each time after new data is loaded
table.on('post-body.bs.table', function(data) {
// Object detection inserts data-onclick-this links after DOM has loaded
dataOnClickThis();
// Manage the Object Detection links in the events list
$j(".objDetectLink").click(function(evt) {
evt.preventDefault();
var eid = $j(this).data('eid');
getObjdetectModal(eid);
});
// Manage the eventdetail links in the events list
$j(".eDetailLink").click(function(evt) {
evt.preventDefault();

View File

@ -429,12 +429,12 @@ function manageModalBtns(id) {
}
}
function init() {
updateButtons( $('executeButton') );
function initPage() {
updateButtons($j('#executeButton')[0]);
$j('#Id').chosen();
$j('#fieldsTable select').not("[name$='br\\]'], [name$='cnj\\]']").chosen({width: '101%'}); //Every select except brackets/and
$j("#sortTable [name$='sort_field\\]']").chosen();
parseRows($j('#fieldsTable tbody').children());
}
window.addEventListener( 'DOMContentLoaded', init );
$j(document).ready(initPage );

View File

@ -71,9 +71,6 @@ function initPage() {
var backBtn = $j('#backBtn');
var onvifBtn = $j('#onvifBtn');
//var protocolSelector = $('contentForm').elements['newMonitor[Protocol]'];
//if ( $(protocolSelector).getTag() == 'select' )
//updateMethods( $(protocolSelector) );
document.querySelectorAll('input[name="newMonitor[SignalCheckColour]"]').forEach(function(el) {
el.oninput = function(event) {
$j('#SignalCheckSwatch').css('background-color', event.target.value);

View File

@ -1,7 +1,3 @@
var requestQueue = new Request.Queue({
concurrent: monitorData.length,
stopOnFailure: false
});
/**
* called when the layoutControl select element is changed, or the page
* is rendered
@ -51,14 +47,14 @@ function selectLayout(element) {
Cookie.write('zmMontageLayout', layout_id, {duration: 10*365, samesite: 'strict'});
if ( layouts[layout_id].Name != 'Freeform' ) { // 'montage_freeform.css' ) {
Cookie.write('zmMontageScale', '', {duration: 10*365, samesite: 'strict'});
$('scale').set('value', '');
$('width').set('value', '0');
$j('#scale').val('');
$j('#width').val('0');
} else {
// Is freeform, we don't touch the width/height/scale settings, but we may need to update sizing and scales
}
var width = parseInt($('width').get('value'));
var height = parseInt($('height').get('value'));
var scale = $('scale').get('value');
var width = parseInt($j('#width').val());
var height = parseInt($j('#height').val());
var scale = $j('#scale').val();
for ( var i = 0, length = monitors.length; i < length; i++ ) {
var monitor = monitors[i];
@ -94,8 +90,8 @@ function selectLayout(element) {
* called when the widthControl|heightControl select elements are changed
*/
function changeSize() {
var width = parseInt($('width').get('value'));
var height = parseInt($('height').get('value'));
var width = parseInt($j('#width').val());
var height = parseInt($j('#height').val());
for ( var i = 0, length = monitors.length; i < length; i++ ) {
var monitor = monitors[i];
@ -110,7 +106,7 @@ function changeSize() {
monitor_frame.css('height', ( height ? height+'px' : 'auto'));
/*Stream could be an applet so can't use moo tools*/
var streamImg = $('liveStream'+monitor.id);
var streamImg = document.getElementById('liveStream'+monitor.id);
if ( streamImg ) {
if ( streamImg.nodeName == 'IMG' ) {
var src = streamImg.src;
@ -132,11 +128,11 @@ function changeSize() {
//streamImg.style.height = '';
}
}
$('scale').set('value', '');
$j('#scale').val('');
Cookie.write('zmMontageScale', '', {duration: 10*365, samesite: 'strict'});
Cookie.write('zmMontageWidth', width, {duration: 10*365, samesite: 'strict'});
Cookie.write('zmMontageHeight', height, {duration: 10*365, samesite: 'strict'});
jQuery("#zmMontageLayout option:selected").removeAttr("selected");
$j("#zmMontageLayout option:selected").removeAttr("selected");
//selectLayout('#zmMontageLayout');
} // end function changeSize()
@ -144,9 +140,9 @@ function changeSize() {
* called when the scaleControl select element is changed
*/
function changeScale() {
var scale = $('scale').get('value');
$('width').set('value', '0'); //auto
$('height').set('value', '0'); //auto
var scale = $j('#scale').val();
$j('#width').val('0'); //auto
$j('#height').val('0'); //auto
Cookie.write('zmMontageScale', scale, {duration: 10*365, samesite: 'strict'});
Cookie.write('zmMontageWidth', '', {duration: 10*365, samesite: 'strict'});
Cookie.write('zmMontageHeight', '', {duration: 10*365, samesite: 'strict'});
@ -276,17 +272,15 @@ function reloadWebSite(ndx) {
var monitors = new Array();
function initPage() {
jQuery(document).ready(function() {
jQuery("#hdrbutton").click(function() {
jQuery("#flipMontageHeader").slideToggle("slow");
jQuery("#hdrbutton").toggleClass('glyphicon-menu-down').toggleClass('glyphicon-menu-up');
Cookie.write( 'zmMontageHeaderFlip', jQuery('#hdrbutton').hasClass('glyphicon-menu-up') ? 'up' : 'down', {duration: 10*365} );
});
$j("#hdrbutton").click(function() {
$j("#flipMontageHeader").slideToggle("slow");
$j("#hdrbutton").toggleClass('glyphicon-menu-down').toggleClass('glyphicon-menu-up');
Cookie.write( 'zmMontageHeaderFlip', $j('#hdrbutton').hasClass('glyphicon-menu-up') ? 'up' : 'down', {duration: 10*365} );
});
if ( Cookie.read('zmMontageHeaderFlip') == 'down' ) {
// The chosen dropdowns require the selects to be visible, so once chosen has initialized, we can hide the header
jQuery("#flipMontageHeader").slideToggle("fast");
jQuery("#hdrbutton").toggleClass('glyphicon-menu-down').toggleClass('glyphicon-menu-up');
$j("#flipMontageHeader").slideToggle("fast");
$j("#hdrbutton").toggleClass('glyphicon-menu-down').toggleClass('glyphicon-menu-up');
}
for ( var i = 0, length = monitorData.length; i < length; i++ ) {
@ -306,4 +300,4 @@ function initPage() {
selectLayout('#zmMontageLayout');
}
// Kick everything off
window.addEventListener('DOMContentLoaded', initPage);
$j(document).ready(initPage);

View File

@ -42,7 +42,7 @@ function evaluateLoadTimes() {
currentDisplayInterval = Math.min(Math.max(currentDisplayInterval, 40), 10000);
imageLoadTimesEvaluated=0;
setSpeed(speedIndex);
$('fps').innerHTML="Display refresh rate is " + (1000 / currentDisplayInterval).toFixed(1) + " per second, avgFrac=" + avgFrac.toFixed(3) + ".";
$j('#fps').text("Display refresh rate is " + (1000 / currentDisplayInterval).toFixed(1) + " per second, avgFrac=" + avgFrac.toFixed(3) + ".");
} // end evaluateLoadTimes()
function getFrame(monId, time, last_Frame) {
@ -337,7 +337,7 @@ function drawSliderOnGraph(val) {
ctx.strokeRect(sliderX+sliderLineWidth, sliderLineWidth, sliderWidth - 2*sliderLineWidth, sliderHeight - 2*sliderLineWidth);
underSliderX = sliderX;
}
var o = $('scruboutput');
var o = document.getElementById('scruboutput');
if ( liveMode == 1 ) {
o.innerHTML = "Live Feed @ " + (1000 / currentDisplayInterval).toFixed(1) + " fps";
o.style.color = "red";
@ -363,41 +363,41 @@ function drawSliderOnGraph(val) {
// Because these change widths if the slider is too close, use the slider width as an estimate for the left/right label length (i.e. don't recalculate len from above)
// If this starts to collide increase some of the extra space
var o = $('scrubleft');
o.innerHTML=secs2dbstr(minTimeSecs);
o.style.position="absolute";
o.style.bottom=labbottom;
o.style.font=labfont;
o.style.left="5px";
var o = document.getElementById('scrubleft');
o.innerHTML = secs2dbstr(minTimeSecs);
o.style.position = "absolute";
o.style.bottom = labbottom;
o.style.font = labfont;
o.style.left = "5px";
if ( numMonitors == 0 ) { // we need a len calculation if we skipped the slider
len = o.offsetWidth;
}
// If the slider will overlay part of this suppress (this is the left side)
if ( len + 10 > sliderX || cWidth < len * 4 ) {
// that last check is for very narrow browsers
o.style.display="none";
o.style.display = "none";
} else {
o.style.display="inline";
o.style.display="inline-flex"; // safari won't take this but will just ignore
o.style.display = "inline";
o.style.display = "inline-flex"; // safari won't take this but will just ignore
}
var o = $('scrubright');
o.innerHTML=secs2dbstr(maxTimeSecs);
o.style.position="absolute";
o.style.bottom=labbottom;
o.style.font=labfont;
var o = document.getElementById('scrubright');
o.innerHTML = secs2dbstr(maxTimeSecs);
o.style.position = "absolute";
o.style.bottom = labbottom;
o.style.font = labfont;
// If the slider will overlay part of this suppress (this is the right side)
o.style.left=(cWidth - len - 15).toString() + "px";
if ( sliderX > cWidth - len - 20 || cWidth < len * 4 ) {
o.style.display="none";
o.style.display = "none";
} else {
o.style.display="inline";
o.style.display="inline-flex";
o.style.display = "inline";
o.style.display = "inline-flex";
}
}
function drawGraph() {
var divWidth = $('timelinediv').clientWidth;
var divWidth = document.getElementById('timelinediv').clientWidth;
canvas.width = cWidth = divWidth; // Let it float and determine width (it should be sized a bit smaller percentage of window)
cHeight = parseInt(window.innerHeight * 0.10);
if ( cHeight < numMonitors * 20 ) {
@ -461,46 +461,54 @@ function drawGraph() {
} // end function drawGraph
function redrawScreen() {
var dateTimeDiv = $j('#DateTimeDiv');
var speedDiv = $j('#SpeedDiv');
var timeLineDiv = $j('#timelinediv');
var liveButton = $j('#liveButton');
var zoomIn = $j('#zoomin');
var zoomOut = $j('#zoomout');
var panLeft = $j('#panleft');
var panRight = $j('#panright');
var downloadVideo = $j('#downloadVideo');
var scaleDiv = $j('#ScaleDiv');
var fit = $j('#fit');
if ( liveMode == 1 ) {
// if we are not in live view switch to history -- this has to come before fit in case we re-establish the timeline
$('DateTimeDiv').style.display="none";
$('SpeedDiv').style.display="none";
var timelinediv= $('timelinediv');
if ( timelinediv ) timelinediv.style.display="none";
$('liveButton').innerHTML="History";
$('zoomin').style.display="none";
$('zoomout').style.display="none";
$('panleft').style.display="none";
$('panright').style.display="none";
if ($('downloadVideo')) $('downloadVideo').style.display="none";
dateTimeDiv.hide();
speedDiv.hide();
timeLineDiv.hide();
liveButton.text('History');
zoomIn.hide();
zoomOut.hide();
panLeft.hide();
panRight.hide();
downloadVideo.hide();
} else {
// switch out of liveview mode
$('DateTimeDiv').style.display="inline";
$('DateTimeDiv').style.display="inline-flex";
$('SpeedDiv').style.display="inline";
$('SpeedDiv').style.display="inline-flex";
$('timelinediv').style.display=null;
$('liveButton').innerHTML="Live";
$('zoomin').style.display="inline";
$('zoomin').style.display="inline-flex";
$('zoomout').style.display="inline";
$('zoomout').style.display="inline-flex";
$('panleft').style.display="inline";
$('panleft').style.display="inline-flex";
$('panright').style.display="inline";
$('panright').style.display="inline-flex";
if ($('downloadVideo')) $('downloadVideo').style.display="inline";
dateTimeDiv.show();
speedDiv.show();
timeLineDiv.show();
liveButton.text('Live');
zoomIn.show();
zoomOut.show();
panLeft.show();
panRight.show();
downloadVideo.show();
drawGraph();
}
if ( fitMode == 1 ) {
$('ScaleDiv').style.display="none";
$('fit').innerHTML="Scale";
var vh=window.innerHeight;
var pos=$('monitors').getPosition();
var mh=(vh - pos.y - $('fps').getSize().y);
$('monitors').setStyle('height', mh.toString() + "px"); // leave a small gap at bottom
if (maxfit2($('monitors').getSize().x, $('monitors').getSize().y) == 0) { /// if we fail to fix we back out of fit mode -- ??? This may need some better handling
var monitors = $j('#monitors');
var fps = $j('#fps');
var vh = window.innerHeight;
var mh = (vh - monitors.position().top - fps.outerHeight());
scaleDiv.hide();
fit.text('Scale');
monitors.height(mh.toString() + "px"); // leave a small gap at bottom
if (maxfit2(monitors.outerWidth(), monitors.outerHeight()) == 0) { /// if we fail to fix we back out of fit mode -- ??? This may need some better handling
fitMode=1-fitMode;
}
} else {
@ -509,10 +517,9 @@ function redrawScreen() {
for ( var i=0; i<numMonitors; i++ ) {
monitorCanvasObj[monitorPtr[i]].style.position="";
}
$('monitors').setStyle('height', "auto");
$('ScaleDiv').style.display="inline";
$('ScaleDiv').style.display="inline-flex";
$('fit').innerHTML="Fit";
monitors.height('auto');
scaleDiv.show();
fit.text('fit');
setScale(currentScale);
}
outputUpdate(currentTimeSecs);
@ -609,7 +616,7 @@ function setFit(value) {
function showScale(newscale) {
// updates slider only
$('scaleslideroutput').innerHTML = parseFloat(newscale).toFixed(2).toString() + " x";
$j('#scaleslideroutput').text(parseFloat(newscale).toFixed(2).toString() + " x");
return;
}
@ -625,7 +632,7 @@ function setScale(newscale) {
function showSpeed(val) {
// updates slider only
$('speedslideroutput').innerHTML = parseFloat(speeds[val]).toFixed(2).toString() + " x";
$j('#speedslideroutput').text(parseFloat(speeds[val]).toFixed(2).toString() + " x");
}
function setSpeed(speed_index) {
@ -666,10 +673,10 @@ function clicknav(minSecs, maxSecs, live) {// we use the current time if we can
maxSecs = parseInt(now);
}
maxStr = "&maxTime=" + secs2inputstr(maxSecs);
$('maxTime').value = secs2inputstr(maxSecs);
$j('#maxTime').val(secs2inputstr(maxSecs));
}
if ( minSecs > 0 ) {
$('minTime').value = secs2inputstr(minSecs);
$j('#minTime').val(secs2inputstr(minSecs));
minStr = "&minTime=" + secs2inputstr(minSecs);
}
if ( maxSecs == 0 && minSecs == 0 ) {
@ -801,7 +808,7 @@ function maxfit2(divW, divH) {
}
if ( borders <= 0 ) {
borders=$("Monitor"+monId).getStyle("border").toInt() * 2;
borders = parseInt($j('#Monitor'+monId).css('border')) * 2;
} // assume fixed size border, and added to both sides and top/bottom
// try fitting over first, then down. Each new one must land at either upper right or lower left corner of last (try in that order)
// Pick the one with the smallest Y, then smallest X if Y equal
@ -856,12 +863,12 @@ function maxfit2(divW, divH) {
}
if ( bestFitArea > 0 ) { // only rearrange if we could fit -- otherwise just do nothing, let them start coming out, whatever
for ( m = 0; m < numMonitors; m++ ) {
c = $("Monitor" + monitorPtr[m]);
c.style.position="absolute";
c.style.left=bestFitX[m].toString() + "px";
c.style.top=bestFitY[m].toString() + "px";
c = document.getElementById('Monitor' + monitorPtr[m]);
c.style.position = "absolute";
c.style.left = bestFitX[m].toString() + "px";
c.style.top = bestFitY[m].toString() + "px";
c.width = bestFitX2[m] - bestFitX[m] + 1 - borders;
c.height= bestFitY2[m] - bestFitY[m] + 1 - borders;
c.height = bestFitY2[m] - bestFitY[m] + 1 - borders;
}
return 1;
} else {
@ -902,7 +909,7 @@ function zoom(monId, scale) {
function clickMonitor(event) {
var element = event.target;
//var monitor_element = $("Monitor"+monId.toString());
//var monitor_element = document.getElementById('Monitor'+monId.toString());
var monId = element.getAttribute('monitor_id');
var pos_x = event.offsetX ? (event.offsetX) : event.pageX - element.offsetLeft;
var pos_y = event.offsetY ? (event.offsetY) : event.pageY - element.offsetTop;
@ -963,7 +970,7 @@ function initPage() {
for ( var i = 0, len = monitorPtr.length; i < len; i += 1 ) {
var monId = monitorPtr[i];
if ( !monId ) continue;
monitorCanvasObj[monId] = $('Monitor'+monId);
monitorCanvasObj[monId] = document.getElementById('Monitor'+monId);
if ( !monitorCanvasObj[monId] ) {
alert("Couldn't find DOM element for Monitor" + monId + "monitorPtr.length=" + len);
} else {
@ -982,7 +989,7 @@ function initPage() {
} // end foreach monitor
if ( !liveMode ) {
canvas = $("timeline");
canvas = document.getElementById('timeline');
canvas.addEventListener('mousemove', mmove, false);
canvas.addEventListener('touchmove', tmove, false);

View File

@ -230,7 +230,6 @@ for ( $i=0; $i < count($speeds); $i++ )
echo "];\n";
?>
var scrubAsObject=$('scrub');
var cWidth; // save canvas width
var cHeight; // save canvas height
var canvas; // global canvas definition so we don't have to keep looking it up

View File

@ -1,9 +1,13 @@
var requestQueue = new Request.Queue({
concurrent: monitorData.length,
stopOnFailure: false
});
var pauseBtn = $j('#pauseBtn');
var playBtn = $j('#playBtn');
var saveBtn = $j('#saveBtn');
var cancelBtn = $j('#cancelBtn');
var backBtn = $j('#backBtn');
var refreshBtn = $j('#refreshBtn');
var monitors = [];
function validateForm( form ) {
var errors = new Array();
var errors = [];
if ( selfIntersecting ) {
errors[errors.length] = selfIntersectingString;
}
@ -152,7 +156,7 @@ function applyCheckMethod() {
function applyPreset() {
var form = document.zoneForm;
var presetId = $('presetSelector').get('value');
var presetId = $j('#presetSelector').val();
if ( presets[presetId] ) {
var preset = presets[presetId];
@ -256,33 +260,33 @@ function limitArea(field) {
}
function highlightOn(index) {
$('row'+index).addClass('highlight');
$('point'+index).addClass('highlight');
$j('#row'+index).addClass('highlight');
$j('#point'+index).addClass('highlight');
}
function highlightOff(index) {
row = $('row'+index);
row = $j('#row'+index);
if ( row ) {
row.removeClass('highlight');
} else {
console.log("No row for index " + index);
}
$('point'+index).removeClass('highlight');
$j('#point'+index).removeClass('highlight');
}
function setActivePoint(index) {
highlightOff(index);
$('row'+index).addClass('active');
$('point'+index).addClass('active');
$j('#row'+index).addClass('active');
$j('#point'+index).addClass('active');
}
function unsetActivePoint(index) {
$('row'+index).removeClass('active');
$('point'+index).removeClass('active');
$j('#row'+index).removeClass('active');
$j('#point'+index).removeClass('active');
}
function getCoordString() {
var coords = new Array();
var coords = [];
for ( var i = 0; i < zone['Points'].length; i++ ) {
coords[coords.length] = zone['Points'][i].x+','+zone['Points'][i].y;
}
@ -290,18 +294,13 @@ function getCoordString() {
}
function updateZoneImage() {
var imageFrame = $('imageFrame');
var style = imageFrame.currentStyle || window.getComputedStyle(imageFrame);
scale = (imageFrame.clientWidth - ( style.paddingLeft.toInt() + style.paddingRight.toInt() )) / maxX;
var SVG = $('zoneSVG');
var Poly = $('zonePoly');
var SVG = document.getElementById('zoneSVG');
var Poly = document.getElementById('zonePoly');
Poly.points.clear();
for ( var i = 0; i < zone['Points'].length; i++ ) {
var Point = SVG.createSVGPoint();
Point.x = zone['Points'][i].x;
//+ 2*padding_left;
Point.y = zone['Points'][i].y;// + 2*padding_top;
Point.y = zone['Points'][i].y;
Poly.points.appendItem(Point);
}
}
@ -323,31 +322,31 @@ function constrainValue(value, loVal, hiVal) {
}
function updateActivePoint(index) {
var point = $('point'+index);
var imageFrame = $('imageFrame');
var point = $j('#point'+index);
var imageFrame = document.getElementById('imageFrame');
var style = imageFrame.currentStyle || window.getComputedStyle(imageFrame);
var padding_left = style.paddingLeft.toInt();
var padding_top = style.paddingTop.toInt();
scale = (imageFrame.clientWidth - ( style.paddingLeft.toInt() + style.paddingRight.toInt() )) / maxX;
var left = point.getStyle('left').toInt();
var padding_left = parseInt(style.paddingLeft);
var padding_top = parseInt(style.paddingTop);
var padding_right = parseInt(style.paddingRight);
var scale = (imageFrame.clientWidth - ( padding_top + padding_right )) / maxX;
var left = parseInt(point.css('left'), 10);
if ( left < padding_left ) {
point.setStyle('left', style.paddingLeft);
left = padding_left.toInt();
point.css('left', style.paddingLeft);
left = parseInt(padding_left);
}
var top = point.getStyle('top').toInt();
var top = parseInt(point.css('top'));
if ( top < padding_top ) {
point.setStyle('top', style.paddingTop);
top = padding_top;
point.css('top', style.paddingTop);
top = parseInt(padding_top);
}
var x = constrainValue(Math.ceil(left / scale)-Math.ceil(padding_left/scale), 0, maxX);
var y = constrainValue(Math.ceil(top / scale)-Math.ceil(padding_top/scale), 0, maxY);
zone['Points'][index].x = $('newZone[Points]['+index+'][x]').value = x;
zone['Points'][index].y = $('newZone[Points]['+index+'][y]').value = y;
var Point = $('zonePoly').points.getItem(index);
zone['Points'][index].x = document.getElementById('newZone[Points]['+index+'][x]').value = x;
zone['Points'][index].y = document.getElementById('newZone[Points]['+index+'][y]').value = y;
var Point = document.getElementById('zonePoly').points.getItem(index);
Point.x = x;
Point.y = y;
updateArea();
@ -381,7 +380,7 @@ function limitPointValue(point, loVal, hiVal) {
function updateArea( ) {
area = Polygon_calcArea(zone['Points']);
zone.Area = area;
var form = $('zoneForm');
var form = document.getElementById('zoneForm');
form.elements['newZone[Area]'].value = area;
if ( form.elements['newZone[Units]'].value == 'Percent' ) {
form.elements['newZone[TempArea]'].value = Math.round( area/monitorArea*100 );
@ -397,12 +396,12 @@ function updateX(input) {
limitPointValue(input, 0, maxX);
var point = $('point'+index);
var point = $j('#point'+index);
var x = input.value;
point.setStyle('left', x+'px');
point.css('left', x+'px');
zone['Points'][index].x = x;
var Point = $('zonePoly').points.getItem(index);
var Point = document.getElementById('zonePoly').points.getItem(index);
Point.x = x;
updateArea();
}
@ -411,12 +410,12 @@ function updateY(input) {
index = input.getAttribute('data-point-index');
limitPointValue(input, 0, maxY);
var point = $('point'+index);
var point = $j('#point'+index);
var y = input.value;
point.setStyle('top', y+'px');
point.css('top', y+'px');
zone['Points'][index].y = y;
var Point = $('zonePoly').points.getItem(index);
var Point = document.getElementById('zonePoly').points.getItem(index);
Point.y = y;
updateArea();
}
@ -434,51 +433,57 @@ function saveChanges(element) {
}
function drawZonePoints() {
var imageFrame = $('imageFrame');
imageFrame.getElements('.zonePoint').each(
function(element) {
element.destroy();
});
var imageFrame = document.getElementById('imageFrame');
$j('.zonePoint').remove();
var style = imageFrame.currentStyle || window.getComputedStyle(imageFrame);
scale = (imageFrame.clientWidth - ( style.paddingLeft.toInt() + style.paddingRight.toInt() )) / maxX;
var padding_left = parseInt(style.paddingLeft);
var padding_right = parseInt(style.paddingRight);
var padding_top = parseInt(style.paddingTop);
var scale = (imageFrame.clientWidth - ( padding_left + padding_right )) / maxX;
for ( var i = 0; i < zone['Points'].length; i++ ) {
var div = new Element('div', {
$j.each( zone['Points'], function(i, coord) {
var div = $j('<div>');
div.attr({
'id': 'point'+i,
'data-point-index': i,
'class': 'zonePoint',
'title': 'Point '+(i+1),
'styles': {
'left': (Math.round(zone['Points'][i].x * scale) + style.paddingLeft.toInt())+"px",
'top': ((zone['Points'][i].y * scale).toInt() + style.paddingTop.toInt()) +"px"
}
'title': 'Point '+(i+1)
});
div.css({
left: (Math.round(coord.x * scale) + padding_left)+"px",
top: ((parseInt(coord.y * scale)) + padding_top) +"px"
});
div.addEvent('mouseover', highlightOn.pass(i));
div.addEvent('mouseout', highlightOff.pass(i));
div.inject(imageFrame);
div.makeDraggable( {
'container': imageFrame,
'onStart': setActivePoint.pass(i),
'onComplete': fixActivePoint.pass(i),
'onDrag': updateActivePoint.pass(i)
} );
} // end foreach point
var tables = $('zonePoints').getElement('table').getElements('table');
div.mouseover(highlightOn.bind(i, i));
div.mouseout(highlightOff.bind(i, i));
$j('#imageFrame').append(div);
div.draggable({
'containment': imageFrame,
'start': setActivePoint.bind(i, i),
'stop': fixActivePoint.bind(i, i),
'drag': updateActivePoint.bind(i, i)
});
}); // end $j.each point
var tables = document.getElementById('zonePoints').getElement('table').getElements('table');
tables.each( function(table) {
table.getElement('tbody').empty();
} );
for ( var i = 0; i < zone['Points'].length; i++ ) {
var row = new Element('tr', {'id': 'row'+i});
row.addEvent('mouseover', highlightOn.pass(i));
row.addEvent('mouseout', highlightOff.pass(i));
var cell = new Element('td');
cell.set('text', i+1);
cell.inject(row);
var row = document.createElement('tr');
row.id = 'row'+i;
row.addEvent('mouseover', highlightOn.bind(i, i));
row.addEvent('mouseout', highlightOff.bind(i, i));
cell = new Element('td');
var input = new Element('input', {
var cell = document.createElement('td');
$j(cell).text(i+1).appendTo(row);
cell = document.createElement('td');
var input = document.createElement('input');
$j(input).attr({
'id': 'newZone[Points]['+i+'][x]',
'name': 'newZone[Points]['+i+'][x]',
'value': zone['Points'][i].x,
@ -489,11 +494,12 @@ function drawZonePoints() {
'data-point-index': i
});
input.oninput = window['updateX'].bind(input, input);
input.inject(cell);
cell.inject(row);
$j(input).appendTo(cell);
$j(cell).appendTo(row);
cell = new Element('td');
input = new Element('input', {
cell = document.createElement('td');
input = document.createElement('input');
$j(input).attr({
'id': 'newZone[Points]['+i+'][y]',
'name': 'newZone[Points]['+i+'][y]',
'value': zone['Points'][i].y,
@ -502,27 +508,32 @@ function drawZonePoints() {
'min': '0',
'max': maxY,
'data-point-index': i
} );
});
input.oninput = window['updateY'].bind(input, input);
input.inject(cell);
cell.inject(row);
$j(input).appendTo(cell);
$j(cell).appendTo(row);
cell = document.createElement('td');
var pbtn = document.createElement('button');
$j(pbtn)
.attr('type', 'button')
.text('+')
.click(addPoint.bind(i, i))
.appendTo(cell);
cell = new Element('td');
new Element('button', {
'type': 'button',
'events': {'click': addPoint.pass(i)}
}).set('text', '+').inject(cell);
if ( zone['Points'].length > 3 ) {
cell.appendText(' ');
new Element('button', {
'id': 'delete'+i,
'type': 'button',
'events': {'click': delPoint.pass(i)}
}).set('text', '-').inject(cell);
var mbtn = document.createElement('button');
$j(mbtn)
.attr('id', 'delete'+i)
.attr('type', 'button')
.addClass('ml-1')
.text('-')
.click(delPoint.bind(i, i))
.appendTo(cell);
}
cell.inject(row);
$j(cell).appendTo(row);
row.inject(tables[i%tables.length].getElement('tbody'));
$j(row).appendTo(tables[i%tables.length].getElement('tbody'));
} // end foreach point
// Sets up the SVG polygon
updateZoneImage();
@ -532,16 +543,16 @@ function streamCmdPause() {
for ( var i = 0, length = monitors.length; i < length; i++ ) {
monitors[i].pause();
}
document.getElementById('pauseBtn').style.display = 'none';
document.getElementById('playBtn').style.display = 'inline';
pauseBtn.hide();
playBtn.show();
}
function streamCmdPlay() {
for ( var i = 0, length = monitors.length; i < length; i++ ) {
monitors[i].play();
}
document.getElementById('playBtn').style.display = 'none';
document.getElementById('pauseBtn').style.display = 'inline';
pauseBtn.show();
playBtn.hide();
}
//Make sure the various refreshes are still taking effect
@ -561,8 +572,6 @@ function presetSelectorBlur() {
this.selectedIndex = 0;
}
var monitors = new Array();
function initPage() {
var form = document.zoneForm;
@ -636,21 +645,16 @@ function initPage() {
applyCheckMethod();
$('pauseBtn').onclick = function() {
streamCmdPause();
};
$('playBtn').style.display = 'none'; // hide pause initially
$('playBtn').onclick = function() {
streamCmdPlay();
};
pauseBtn.click(streamCmdPause);
playBtn.click(streamCmdPlay);
playBtn.hide(); // hide pause initially
if ( el = $('saveBtn') ) {
if ( el = saveBtn[0] ) {
el.onclick = window['saveChanges'].bind(el, el);
}
if ( el = $('cancelBtn') ) {
if ( el = cancelBtn[0] ) {
el.onclick = function() {
refreshParentWindow();
closeWindow();
window.location.reload(true);
};
}
@ -676,7 +680,7 @@ function initPage() {
});
// Disable the back button if there is nothing to go back to
$j('#backBtn').prop('disabled', !document.referrer.length);
backBtn.prop('disabled', !document.referrer.length);
// Manage the REFRESH Button
document.getElementById("refreshBtn").addEventListener("click", function onRefreshClick(evt) {

View File

@ -1,8 +1,3 @@
var requestQueue = new Request.Queue({
concurrent: monitorData.length,
stopOnFailure: false
});
function streamCmdQuit( ) {
if ( action ) {
streamCmdReq.send( streamCmdParms+"&command="+CMD_QUIT );

View File

@ -1,6 +1,6 @@
<?php
//
// ZoneMinder web function view file, $Date$, $Revision$
// ZoneMinder web monitors view file, $Date$, $Revision$
// Copyright (C) 2001-2008 Philip Coombes
//
// This program is free software; you can redistribute it and/or
@ -39,12 +39,12 @@ foreach ( $storage_areas as $S ) {
$focusWindow = true;
xhtmlHeaders(__FILE__, translate('Function'));
getBodyTopHTML();
echo getNavBarHTML();
?>
<body>
<div id="page">
<div id="header">
<h2><?php echo translate('Function') ?></h2>
</div>
<h2 class="pt-2"><?php echo translate('Monitors') ?></h2>
<div id="content">
The following monitors will have these settings update when you click Save:<br/><br/>
<?php echo implode('<br/>', array_map(function($m){return $m->Id().' ' .$m->Name();}, $monitors)); ?>
@ -88,10 +88,9 @@ The following monitors will have these settings update when you click Save:<br/>
</p>
<div id="contentButtons">
<button type="submit" value="Save"><?php echo translate('Save') ?></button>
<button type="button" data-on-click="closeWindow"><?php echo translate('Cancel') ?></button>
<button type="button" data-on-click="backWindow"><?php echo translate('Cancel') ?></button>
</div>
</form>
</div>
</div>
</body>
</html>
<?php xhtmlFooter() ?>

View File

@ -137,10 +137,10 @@ foreach ( $displayMonitors as &$row ) {
} # end foreach Monitor
xhtmlHeaders(__FILE__, translate('Montage'));
getBodyTopHTML();
echo getNavBarHTML();
?>
<body>
<div id="page">
<?php echo getNavBarHTML() ?>
<div id="page" class="container-fluid">
<div id="header">
<?php
$html = '';

View File

@ -92,6 +92,9 @@ xhtmlHeaders(__FILE__, translate('Zones'));
?>
Sorry, your browser does not support inline SVG
</svg>
<div id="monitorState">
<?php echo translate('State') ?>:&nbsp;<span id="stateValue<?php echo $monitor->Id() ?>"></span>&nbsp;-&nbsp;<span id="fpsValue<?php echo $monitor->Id() ?>"></span>&nbsp;fps
</div>
</div>
<div class="zones">
<table id="zonesTable" class="major">