You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

8621 lines
434 KiB

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="cache-control"
content="max-age=0" />
<meta http-equiv="cache-control"
content="no-store, no-store, must-revalidate" />
<meta http-equiv="expires"
content="-1" />
<meta http-equiv="expires"
content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma"
content="no-cache" />
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!--meta http-equiv="refresh" content="300" />--> <!--Refresh each 5s-->
<meta charset="utf-8" />
<!--<link href="./css/sweetalert2.min.css" rel="stylesheet" type="text/css" />-->
<!--<link rel="preload" href="./Icon/Counter_Green_64x64px.png" as="image" />-->
<style>
body, html {
font-family: "Arial";
}
* {
box-sizing: border-box;
}
/* Create two equal columns that floats next to each other */
.column {
float: left;
overflow: hidden;
/*width: 33%;*/
padding-left: 10px;
/*height: 300px;*/
/*margin: auto;*/
/* Should be removed. Only for demonstration */
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
.sub_row {
margin-bottom: 10px;
}
.sub_column {
float: left;
overflow: hidden;
}
/* Responsive layout - makes the two columns stack on top of each other instead of next to each other */
@media screen and (max-width: 400px) {
.column {
width: 100%;
}
}
ul {
list-style-type: none;
margin: 0px;
/*overflow: hidden;*/
overflow-y: scroll;
}
li {
margin-left: -40px;
}
.controls {
display: inline-block;
}
.div-relative {
position: relative;
color: #000000;
width: 720px;
height: 480px;
/*
width: 480px;
height: 320px;
*/
}
.div-bg {
position: absolute;
width: 100%;
height: 100%;
}
.div-a {
position: absolute;
width: 100%; /*480*/
height: 100%; /*320*/
/*transform: scale(0.85);*/ /* Equal to scaleX(0.7) scaleY(0.7) */
}
.div-b {
position: absolute;
width: 100%; /*480*/
height: 100%; /*320*/
/*transform: scale(0.85);*/ /* Equal to scaleX(0.7) scaleY(0.7) */
}
.div-c {
position: absolute;
width: 100%; /*480*/
height: 100%; /*320*/
/*transform: scale(0.85);*/ /* Equal to scaleX(0.7) scaleY(0.7) */
}
.div-d {
position: absolute;
width: 100%; /*480*/
height: 100%; /*320*/
/*transform: scale(0.85);*/ /* Equal to scaleX(0.7) scaleY(0.7) */
}
.div-e {
position: absolute;
width: 100%; /*480*/
height: 100%; /*320*/
/*transform: scale(0.85);*/ /* Equal to scaleX(0.7) scaleY(0.7) */
}
.div-f {
position: absolute;
width: 100%; /*480*/
height: 100%; /*320*/
/*transform: scale(0.85);*/ /* Equal to scaleX(0.7) scaleY(0.7) */
}
.div-g {
position: absolute;
width: 100%; /*480*/
height: 100%; /*320*/
/*transform: scale(0.85);*/ /* Equal to scaleX(0.7) scaleY(0.7) */
}
.div-h {
position: absolute;
width: 100%; /*480*/
height: 100%; /*320*/
/*transform: scale(0.85);*/ /* Equal to scaleX(0.7) scaleY(0.7) */
}
.div-y {
position: absolute;
width: 100%; /*480*/
height: 100%; /*320*/
/*transform: scale(0.85);*/ /* Equal to scaleX(0.7) scaleY(0.7) */
}
.div-z {
position: absolute;
width: 100%; /*480*/
height: 100%; /*320*/
/*transform: scale(0.85);*/ /* Equal to scaleX(0.7) scaleY(0.7) */
}
.titlebox {
float: left;
padding: 0 5px;
margin: 5px 0px 0 56px;
background: #fff;
}
/* 80 port tab inside OK button style */
.Content_stybtn_ln{
/* display: inline-block; */
background-color:#2a2a2a;
border-radius: 10px;
border:0px;
padding-left: 20px;
padding-right: 20px;
height:25px;
color:white;
font-family: "Arial","Helvetica","sans-serif";
font-size: 14px;
}
.Content_stybtn_ln:hover{
background-color:#678cd4;
}
.Content_stybtn_ln:disabled{
background-color:grey;
color:#DCDCDC;
}
.container {
display: grid;
grid-template-columns: 1.1fr 0.7fr 0.9fr 1.0fr;
width: 100%;
padding: 0px 10px 0px 10px;
}
.owl-theme .item {
height: 120px;
width:120px;
/* background: #5C5C5C; */
padding: 0rem;
border:0px solid white;
}
.owl-carousel .item h4 {
color: black; /* 原 white 設定不適用於 landing page 白底配色 */
margin-top: 0rem;
margin-bottom: 0rem;
font-size: 15px;
line-height: 15px;
}
.progress {
display: -ms-flexbox;
display: flex;
height: 8px;
width: 98%;
overflow: hidden;
line-height: 0;
font-size: 1px;
background-color: #e9ecef;
border-radius: 1px;
}
.progress-bar-striped {
background-image: linear-gradient(45deg, rgba(255, 255, 255, .15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, transparent 75%, transparent);
background-size: 1rem 1rem;
}
.progress-bar {
display: -ms-flexbox;
display: flex;
-ms-flex-direction: column;
flex-direction: column;
-ms-flex-pack: center;
justify-content: center;
overflow: hidden;
color: #fff;
text-align: center;
white-space: nowrap;
background-color: #fd9600;
transition: width .6s ease;
}
</style>
<!-- <script src="jquery_3_2_1.min.js"></script> -->
<script src="/airelay/jquery_3_2_1.min.js"></script>
<script src="/airelay/fabric_jquery.easyui.min_compressed_on_nvr.js"></script>
<script src="/airelay/config.js"></script>
<script src="/airelay/unit1.js"></script>
<script src="/js/unit2.js"></script>
<script src="/js/unit3.js"></script>
<!-- 自動加載 unit3.wasm -->
<script>
window.onerror = function (message, url, linenumber) {
console.log('JavaScript error: ' + message + ' on line ' + linenumber + ' for ' + url);
if (url.search("fabric_jquery.easyui.min_compressed_on_nvr.js") >= 1) {
loadScript("fabric_jquery.easyui.min_compressed_on_nvr.js", function () {
});
}
else if (url.search("jquery_3_2_1.min.js") >= 1) {
loadScript("jquery_3_2_1.min.js", function () {
});
}
else if (url.search("config.js") >= 1) {
loadScript("config.js", function () {
});
}
else if (url.search("owl.carousel.min.js") >= 1) {
loadScript("lib/owl.carousel.min.js", function () {
});
}
else if (url.search("cookie.min.js") >= 1) {
loadScript("cookie.min.js", function () {
});
}
else if (url.search("lang.js") >= 1) {
loadScript("lang.js", function () {
});
}
else if (url.search("label_names.js") >= 1) {
loadScript("label_names.js", function () {
});
}
else if (url.search("alarm_on_airelay.js") >= 1) {
loadScript("alarm_on_airelay.js", function () {
});
}
else if (url.search("lang_cookie.js") >= 1) {
loadScript("lang_cookie.js", function () {
});
}
else if (message.search("slider") >= 1) {
loadScript("fabric_jquery.easyui.min_compressed_on_nvr.js", function () {
});
}
else if (message.search("myport") >= 1) {
loadScript("config.js", function () {
});
}
else if (message.search("cookie") >= 1) {
loadScript("cookie.min.js", function () {
});
}
else {
if (message.search("ws_worker_close") >= 1) {
// console.log("disconnection happened, pending ...");
func_checkGetRequest();
} else {
//location.reload();
var replaceUrl = 'http://' + window.location.hostname + '/airelay/airelay_init.html';
//alert(replaceUrl);
window.location.replace(replaceUrl);
}
}
}
function GetUrlPort() {
var url_href = window.location.href;
// console.log(`[GetUrlPort] url_href: ${url_href}`);
var arr_url = url_href.split(":");
var port = 80;
if (arr_url.length > 2) { // plugin 開分頁會有 <ip>:<port_number> 格式
port = arr_url[2].split("/")[0];
}
// console.log(`[GetUrlPort] return: ${port}`);
return port;
}
if (window.history.replaceState) {
window.history.replaceState(null, null, window.location.href);
}
</script>
<script src="/airelay/cookie.min.js"></script>
<script src="/airelay/lang.js"></script>
<script src="/airelay/label_names.js"></script>
<script src="/airelay/third_party_label_names.js"></script>
<script src="/airelay/lang_cookie.js"></script>
<script src="/airelay/alarm_on_airelay.js"></script>
<link rel="stylesheet" type="text/css" href="/airelay/bootstrap.min.css">
<!-- <link rel="stylesheet" type="text/css" href="/airelay/easyui_jvc.css"> -->
<link rel="stylesheet" type="text/css" href="/js/themes/default/easyui.css">
<!-- 車牌輪播 -->
<!-- 09-11 -->
<script type="text/javascript" language="javascript" src="Aida/lib/owl.carousel.min.js"></script>
<link rel="stylesheet" type="text/css" href="Aida/css/owl.carousel.min.css">
<link rel="stylesheet" type="text/css" href="Aida/css/owl.theme.default.min.css">
<script>
var g_Canvas_BackgroundImage = null;
var g_mouse_status = 0;
var g_h = -1;
var g_m = -1;
var g_s = -1;
var g_ms = -1;
var g_time_canvas = 166;
var g_imgUrl = "";
var g_speed = 99999;
var g_times_update_canvas = 0;
var g_avg_speed = 7000;
var g_times_get_bar = 0;
var g_check_if_run_setting = 0;
var DETECT_EVENT_ID_ARRAY = ["0x00000001", "0x00000004", "0x00200000", "0x00400000", "0x00000008", "0x00000010", "0x00000020", "0x10000000", "0x20000000", "0x00800000", "0x01000000", "0x02000000", "0x04000000", "0x40000000", "0x80000000", "0x00002000", "0x00004000", "0x00000400", "0x00000800", "0x00001000", "0x00008000", "0x00040000", "0x08000000"];
function update_canvas() {
clearInterval(g_Canvas_BackgroundImage);
g_Canvas_BackgroundImage = setInterval(function update_canvas_set_interval() {
//var current_page = localStorage.getItem('current_page');
if (/*current_page === 'alarm' && */g_check_if_run_setting == 0)
{
change_g_cold_times(20);
g_times_update_canvas++;
g_times_get_bar++;
document.getElementById('counter_count_msg').innerHTML = get_counter_count_msg();
var win_width = G_VIEW_CANVAS_X, win_height = G_VIEW_CANVAS_Y;
var NowDate = new Date();
var h = NowDate.getHours();
var m = NowDate.getMinutes();
var s = NowDate.getSeconds();
var ms = NowDate.getMilliseconds();
if (g_h == -1 || g_m == -1 || g_s == -1 || g_ms == -1) {
g_h = h;
g_m = m;
g_s = s;
g_ms = ms;
}
if (g_times_get_bar > 30) {
g_times_get_bar = 0;
func_getbar();
}
try {
if (show_all_zone === 0) {
if (current_dzone === "dzone_1" && count_zone >= 1) {
if (click_canvas_all >= 1) {
click_canvas_all = 0;
//window.location.reload();
}
document.getElementById("CanvasTripwire1").style.visibility = "visible";
document.getElementById("CanvasTripwire2").style.visibility = "hidden";
document.getElementById("CanvasTripwire3").style.visibility = "hidden";
document.getElementById("CanvasTripwire4").style.visibility = "hidden";
document.getElementById("CanvasTripwire5").style.visibility = "hidden";
document.getElementById("CanvasTripwire6").style.visibility = "hidden";
document.getElementById("CanvasTripwire7").style.visibility = "hidden";
document.getElementById("CanvasTripwire8").style.visibility = "hidden";
//document.getElementById("CanvasTripwire_default").style.visibility = "hidden";
document.getElementById("CanvasTripwire").style.visibility = "hidden";
document.getElementById("CanvasTripwire_all").style.visibility = "hidden";
document.getElementsByClassName("div-a")[0].style.visibility = "visible";
document.getElementsByClassName("div-b")[0].style.visibility = "hidden";
document.getElementsByClassName("div-c")[0].style.visibility = "hidden";
document.getElementsByClassName("div-d")[0].style.visibility = "hidden";
document.getElementsByClassName("div-e")[0].style.visibility = "hidden";
document.getElementsByClassName("div-f")[0].style.visibility = "hidden";
document.getElementsByClassName("div-g")[0].style.visibility = "hidden";
document.getElementsByClassName("div-h")[0].style.visibility = "hidden";
document.getElementsByClassName("div-y")[0].style.visibility = "hidden";
document.getElementsByClassName("div-z")[0].style.visibility = "hidden";
}
else if (current_dzone === "dzone_2" && count_zone >= 2) {
if (click_canvas_all >= 1) {
click_canvas_all = 0;
//window.location.reload();
}
document.getElementById("CanvasTripwire1").style.visibility = "hidden";
document.getElementById("CanvasTripwire2").style.visibility = "visible";
document.getElementById("CanvasTripwire3").style.visibility = "hidden";
document.getElementById("CanvasTripwire4").style.visibility = "hidden";
document.getElementById("CanvasTripwire5").style.visibility = "hidden";
document.getElementById("CanvasTripwire6").style.visibility = "hidden";
document.getElementById("CanvasTripwire7").style.visibility = "hidden";
document.getElementById("CanvasTripwire8").style.visibility = "hidden";
//document.getElementById("CanvasTripwire_default").style.visibility = "hidden";
document.getElementById("CanvasTripwire").style.visibility = "hidden";
document.getElementById("CanvasTripwire_all").style.visibility = "hidden";
document.getElementsByClassName("div-a")[0].style.visibility = "hidden";
document.getElementsByClassName("div-b")[0].style.visibility = "visible";
document.getElementsByClassName("div-c")[0].style.visibility = "hidden";
document.getElementsByClassName("div-d")[0].style.visibility = "hidden";
document.getElementsByClassName("div-e")[0].style.visibility = "hidden";
document.getElementsByClassName("div-f")[0].style.visibility = "hidden";
document.getElementsByClassName("div-g")[0].style.visibility = "hidden";
document.getElementsByClassName("div-h")[0].style.visibility = "hidden";
document.getElementsByClassName("div-y")[0].style.visibility = "hidden";
document.getElementsByClassName("div-z")[0].style.visibility = "hidden";
}
else if (current_dzone === "dzone_3" && count_zone >= 3) {
if (click_canvas_all >= 1) {
click_canvas_all = 0;
//window.location.reload();
}
document.getElementById("CanvasTripwire1").style.visibility = "hidden";
document.getElementById("CanvasTripwire2").style.visibility = "hidden";
document.getElementById("CanvasTripwire3").style.visibility = "visible";
document.getElementById("CanvasTripwire4").style.visibility = "hidden";
document.getElementById("CanvasTripwire5").style.visibility = "hidden";
document.getElementById("CanvasTripwire6").style.visibility = "hidden";
document.getElementById("CanvasTripwire7").style.visibility = "hidden";
document.getElementById("CanvasTripwire8").style.visibility = "hidden";
//document.getElementById("CanvasTripwire_default").style.visibility = "hidden";
document.getElementById("CanvasTripwire").style.visibility = "hidden";
document.getElementById("CanvasTripwire_all").style.visibility = "hidden";
document.getElementsByClassName("div-a")[0].style.visibility = "hidden";
document.getElementsByClassName("div-b")[0].style.visibility = "hidden";
document.getElementsByClassName("div-c")[0].style.visibility = "visible";
document.getElementsByClassName("div-d")[0].style.visibility = "hidden";
document.getElementsByClassName("div-e")[0].style.visibility = "hidden";
document.getElementsByClassName("div-f")[0].style.visibility = "hidden";
document.getElementsByClassName("div-g")[0].style.visibility = "hidden";
document.getElementsByClassName("div-h")[0].style.visibility = "hidden";
document.getElementsByClassName("div-y")[0].style.visibility = "hidden";
document.getElementsByClassName("div-z")[0].style.visibility = "hidden";
}
else if (current_dzone === "dzone_4" && count_zone >= 4) {
if (click_canvas_all >= 1) {
click_canvas_all = 0;
//window.location.reload();
}
document.getElementById("CanvasTripwire1").style.visibility = "hidden";
document.getElementById("CanvasTripwire2").style.visibility = "hidden";
document.getElementById("CanvasTripwire3").style.visibility = "hidden";
document.getElementById("CanvasTripwire4").style.visibility = "visible";
document.getElementById("CanvasTripwire5").style.visibility = "hidden";
document.getElementById("CanvasTripwire6").style.visibility = "hidden";
document.getElementById("CanvasTripwire7").style.visibility = "hidden";
document.getElementById("CanvasTripwire8").style.visibility = "hidden";
//document.getElementById("CanvasTripwire_default").style.visibility = "hidden";
document.getElementById("CanvasTripwire").style.visibility = "hidden";
document.getElementById("CanvasTripwire_all").style.visibility = "hidden";
document.getElementsByClassName("div-a")[0].style.visibility = "hidden";
document.getElementsByClassName("div-b")[0].style.visibility = "hidden";
document.getElementsByClassName("div-c")[0].style.visibility = "hidden";
document.getElementsByClassName("div-d")[0].style.visibility = "visible";
document.getElementsByClassName("div-e")[0].style.visibility = "hidden";
document.getElementsByClassName("div-f")[0].style.visibility = "hidden";
document.getElementsByClassName("div-g")[0].style.visibility = "hidden";
document.getElementsByClassName("div-h")[0].style.visibility = "hidden";
document.getElementsByClassName("div-y")[0].style.visibility = "hidden";
document.getElementsByClassName("div-z")[0].style.visibility = "hidden";
}
else if (current_dzone === "dzone_5" && count_zone >= 5) {
if (click_canvas_all >= 1) {
click_canvas_all = 0;
//window.location.reload();
}
document.getElementById("CanvasTripwire1").style.visibility = "hidden";
document.getElementById("CanvasTripwire2").style.visibility = "hidden";
document.getElementById("CanvasTripwire3").style.visibility = "hidden";
document.getElementById("CanvasTripwire4").style.visibility = "hidden";
document.getElementById("CanvasTripwire5").style.visibility = "visible";
document.getElementById("CanvasTripwire6").style.visibility = "hidden";
document.getElementById("CanvasTripwire7").style.visibility = "hidden";
document.getElementById("CanvasTripwire8").style.visibility = "hidden";
//document.getElementById("CanvasTripwire_default").style.visibility = "hidden";
document.getElementById("CanvasTripwire").style.visibility = "hidden";
document.getElementById("CanvasTripwire_all").style.visibility = "hidden";
document.getElementsByClassName("div-a")[0].style.visibility = "hidden";
document.getElementsByClassName("div-b")[0].style.visibility = "hidden";
document.getElementsByClassName("div-c")[0].style.visibility = "hidden";
document.getElementsByClassName("div-d")[0].style.visibility = "hidden";
document.getElementsByClassName("div-e")[0].style.visibility = "visible";
document.getElementsByClassName("div-f")[0].style.visibility = "hidden";
document.getElementsByClassName("div-g")[0].style.visibility = "hidden";
document.getElementsByClassName("div-h")[0].style.visibility = "hidden";
document.getElementsByClassName("div-y")[0].style.visibility = "hidden";
document.getElementsByClassName("div-z")[0].style.visibility = "hidden";
}
else if (current_dzone === "dzone_6" && count_zone >= 6) {
if (click_canvas_all >= 1) {
click_canvas_all = 0;
//window.location.reload();
}
document.getElementById("CanvasTripwire1").style.visibility = "hidden";
document.getElementById("CanvasTripwire2").style.visibility = "hidden";
document.getElementById("CanvasTripwire3").style.visibility = "hidden";
document.getElementById("CanvasTripwire4").style.visibility = "hidden";
document.getElementById("CanvasTripwire5").style.visibility = "hidden";
document.getElementById("CanvasTripwire6").style.visibility = "visible";
document.getElementById("CanvasTripwire7").style.visibility = "hidden";
document.getElementById("CanvasTripwire8").style.visibility = "hidden";
//document.getElementById("CanvasTripwire_default").style.visibility = "hidden";
document.getElementById("CanvasTripwire").style.visibility = "hidden";
document.getElementById("CanvasTripwire_all").style.visibility = "hidden";
document.getElementsByClassName("div-a")[0].style.visibility = "hidden";
document.getElementsByClassName("div-b")[0].style.visibility = "hidden";
document.getElementsByClassName("div-c")[0].style.visibility = "hidden";
document.getElementsByClassName("div-d")[0].style.visibility = "hidden";
document.getElementsByClassName("div-e")[0].style.visibility = "hidden";
document.getElementsByClassName("div-f")[0].style.visibility = "visible";
document.getElementsByClassName("div-g")[0].style.visibility = "hidden";
document.getElementsByClassName("div-h")[0].style.visibility = "hidden";
document.getElementsByClassName("div-y")[0].style.visibility = "hidden";
document.getElementsByClassName("div-z")[0].style.visibility = "hidden";
}
else if (current_dzone === "dzone_7" && count_zone >= 7) {
if (click_canvas_all >= 1) {
click_canvas_all = 0;
//window.location.reload();
}
document.getElementById("CanvasTripwire1").style.visibility = "hidden";
document.getElementById("CanvasTripwire2").style.visibility = "hidden";
document.getElementById("CanvasTripwire3").style.visibility = "hidden";
document.getElementById("CanvasTripwire4").style.visibility = "hidden";
document.getElementById("CanvasTripwire5").style.visibility = "hidden";
document.getElementById("CanvasTripwire6").style.visibility = "hidden";
document.getElementById("CanvasTripwire7").style.visibility = "visible";
document.getElementById("CanvasTripwire8").style.visibility = "hidden";
//document.getElementById("CanvasTripwire_default").style.visibility = "hidden";
document.getElementById("CanvasTripwire").style.visibility = "hidden";
document.getElementById("CanvasTripwire_all").style.visibility = "hidden";
document.getElementsByClassName("div-a")[0].style.visibility = "hidden";
document.getElementsByClassName("div-b")[0].style.visibility = "hidden";
document.getElementsByClassName("div-c")[0].style.visibility = "hidden";
document.getElementsByClassName("div-d")[0].style.visibility = "hidden";
document.getElementsByClassName("div-e")[0].style.visibility = "hidden";
document.getElementsByClassName("div-f")[0].style.visibility = "hidden";
document.getElementsByClassName("div-g")[0].style.visibility = "visible";
document.getElementsByClassName("div-h")[0].style.visibility = "hidden";
document.getElementsByClassName("div-y")[0].style.visibility = "hidden";
document.getElementsByClassName("div-z")[0].style.visibility = "hidden";
}
else if (current_dzone === "dzone_8" && count_zone === 8) {
if (click_canvas_all >= 1) {
click_canvas_all = 0;
//window.location.reload();
}
document.getElementById("CanvasTripwire1").style.visibility = "hidden";
document.getElementById("CanvasTripwire2").style.visibility = "hidden";
document.getElementById("CanvasTripwire3").style.visibility = "hidden";
document.getElementById("CanvasTripwire4").style.visibility = "hidden";
document.getElementById("CanvasTripwire5").style.visibility = "hidden";
document.getElementById("CanvasTripwire6").style.visibility = "hidden";
document.getElementById("CanvasTripwire7").style.visibility = "hidden";
document.getElementById("CanvasTripwire8").style.visibility = "visible";
//document.getElementById("CanvasTripwire_default").style.visibility = "hidden";
document.getElementById("CanvasTripwire").style.visibility = "hidden";
document.getElementById("CanvasTripwire_all").style.visibility = "hidden";
document.getElementsByClassName("div-a")[0].style.visibility = "hidden";
document.getElementsByClassName("div-b")[0].style.visibility = "hidden";
document.getElementsByClassName("div-c")[0].style.visibility = "hidden";
document.getElementsByClassName("div-d")[0].style.visibility = "hidden";
document.getElementsByClassName("div-e")[0].style.visibility = "hidden";
document.getElementsByClassName("div-f")[0].style.visibility = "hidden";
document.getElementsByClassName("div-g")[0].style.visibility = "hidden";
document.getElementsByClassName("div-h")[0].style.visibility = "visible";
document.getElementsByClassName("div-y")[0].style.visibility = "hidden";
document.getElementsByClassName("div-z")[0].style.visibility = "hidden";
}
else {
click_canvas_all = 0;
document.getElementById("CanvasTripwire1").style.visibility = "hidden";
document.getElementById("CanvasTripwire2").style.visibility = "hidden";
document.getElementById("CanvasTripwire3").style.visibility = "hidden";
document.getElementById("CanvasTripwire4").style.visibility = "hidden";
document.getElementById("CanvasTripwire5").style.visibility = "hidden";
document.getElementById("CanvasTripwire6").style.visibility = "hidden";
document.getElementById("CanvasTripwire7").style.visibility = "hidden";
document.getElementById("CanvasTripwire8").style.visibility = "hidden";
//document.getElementById("CanvasTripwire_default").style.visibility = "visible";
document.getElementById("CanvasTripwire").style.visibility = "visible";
document.getElementById("CanvasTripwire_all").style.visibility = "hidden";
document.getElementsByClassName("div-a")[0].style.visibility = "hidden";
document.getElementsByClassName("div-b")[0].style.visibility = "hidden";
document.getElementsByClassName("div-c")[0].style.visibility = "hidden";
document.getElementsByClassName("div-d")[0].style.visibility = "hidden";
document.getElementsByClassName("div-e")[0].style.visibility = "hidden";
document.getElementsByClassName("div-f")[0].style.visibility = "hidden";
document.getElementsByClassName("div-g")[0].style.visibility = "hidden";
document.getElementsByClassName("div-h")[0].style.visibility = "hidden";
document.getElementsByClassName("div-y")[0].style.visibility = "visible";
document.getElementsByClassName("div-z")[0].style.visibility = "hidden";
}
}
else
{
document.getElementById("CanvasTripwire1").style.visibility = "hidden";
document.getElementById("CanvasTripwire2").style.visibility = "hidden";
document.getElementById("CanvasTripwire3").style.visibility = "hidden";
document.getElementById("CanvasTripwire4").style.visibility = "hidden";
document.getElementById("CanvasTripwire5").style.visibility = "hidden";
document.getElementById("CanvasTripwire6").style.visibility = "hidden";
document.getElementById("CanvasTripwire7").style.visibility = "hidden";
document.getElementById("CanvasTripwire8").style.visibility = "hidden";
//document.getElementById("CanvasTripwire_default").style.visibility = "visible";
document.getElementById("CanvasTripwire").style.visibility = "hidden";
document.getElementById("CanvasTripwire_all").style.visibility = "visible";
document.getElementsByClassName("div-a")[0].style.visibility = "hidden";
document.getElementsByClassName("div-b")[0].style.visibility = "hidden";
document.getElementsByClassName("div-c")[0].style.visibility = "hidden";
document.getElementsByClassName("div-d")[0].style.visibility = "hidden";
document.getElementsByClassName("div-e")[0].style.visibility = "hidden";
document.getElementsByClassName("div-f")[0].style.visibility = "hidden";
document.getElementsByClassName("div-g")[0].style.visibility = "hidden";
document.getElementsByClassName("div-h")[0].style.visibility = "hidden";
document.getElementsByClassName("div-y")[0].style.visibility = "hidden";
document.getElementsByClassName("div-z")[0].style.visibility = "visible";
}
}
catch (e) {
//console.log(e);
}
imgUrl = null;
if (g_times_update_canvas >= 20) {
g_times_update_canvas = 0;
if (localStorage.getItem('AI_fps') != null) {
g_time_canvas = 1000 / localStorage.getItem('AI_fps');
clearInterval(g_Canvas_BackgroundImage);
g_Canvas_BackgroundImage = setInterval(update_canvas_set_interval, g_time_canvas);
}
}
}
}, g_time_canvas);
}
/*
function measureBW(fn) {
var startTime, endTime, fileSize;
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = () => {
if (xhr.readyState === 2) {
startTime = Date.now();
}
if (xhr.readyState === 4 && xhr.status === 200) {
endTime = Date.now();
fileSize = xhr.responseText.length;
//console.log(fileSize);
if (endTime > startTime) {
var speed = fileSize / ((endTime - startTime) / 1000) / 1024;
fn && fn(Math.floor(speed));
}
else {
var speed = 99999;
fn && fn(Math.floor(speed));
}
}
}
xhr.open("GET", g_imgUrl, true);
xhr.send();
}
*/
$(document).ready(function () {
// create_canvas_stream(0);
event_stream = create_canvas_stream1();
var checkH264StreamIntervalID = null;
var checkH264StreamIntervalTime = 200;
var checkStreamingCounter = 0;
var checkCounterThreshold = 12;
clearInterval(checkH264StreamIntervalID);
checkH264StreamIntervalID = setInterval(function () {
var check_h264_received = event_stream.valid_byte_received[0];
if (check_h264_received == true) {
checkStreamingCounter++;
} else {
checkStreamingCounter = 0;
}
// console.log(`check_h264_received: ${check_h264_received} , checkStreamingCounter: ${checkStreamingCounter}`);
if (checkStreamingCounter > checkCounterThreshold) {
localStorage.setItem("receivedH264", check_h264_received);
clearInterval(checkH264StreamIntervalID);
// 08-15 TODO 嘗試確認 getalarmmotion fetch 連線是否中斷
}
}, checkH264StreamIntervalTime)
});
</script>
</head>
<body onContextMenu="window.event.returnValue=false" style="margin: 0px;">
<!-- onload="getDevicePixelRatio()" -->
<div class="progress" style="background-color:white">
<div class="progress-bar progress-bar-striped" style="min-width: 20px;visibility:hidden;"></div>
</div>
<div class="div-relative">
<div class="div-bg" id="CanvasBgContainer" >
<!-- remaining empty for creating H264 streaming canvas -->
</div>
<div class="div-a">
<canvas id="CanvasTripwire1"></canvas>
</div>
<div class="div-b">
<canvas id="CanvasTripwire2"></canvas>
</div>
<div class="div-c">
<canvas id="CanvasTripwire3"></canvas>
</div>
<div class="div-d">
<canvas id="CanvasTripwire4"></canvas>
</div>
<div class="div-e">
<canvas id="CanvasTripwire5"></canvas>
</div>
<div class="div-f">
<canvas id="CanvasTripwire6"></canvas>
</div>
<div class="div-g">
<canvas id="CanvasTripwire7"></canvas>
</div>
<div class="div-h">
<canvas id="CanvasTripwire8"></canvas>
</div>
<div class="div-y">
<canvas id="CanvasTripwire"></canvas>
</div>
<div class="div-z">
<canvas id="CanvasTripwire_all"></canvas>
</div>
</div>
<br>
<div class="sub_row">
<!-- Detection zone 按鈕位置 -->
<nobr id="IDC_STATIC_DETECTION_ZONE"></nobr>
<input id="add_zone" type="button" onclick="func_add_zone()" value="+" style="background:#6c87d4;border-color:#6c87d4;color:white" />
<input id="minus_zone" type="button" onclick="func_minus_zone()" value="-" style="background:#6c87d4;border-color:#6c87d4;color:white" />
<input id="show_all_zone" type="button" onclick="func_show_all_zone()" value=" All " />
&nbsp;
<input id="dzone_1" type="button" onclick="func_set_zone_cookie1();" value="1" />
<input id="dzone_2" type="button" onclick="func_set_zone_cookie2();" value="2" />
<input id="dzone_3" type="button" onclick="func_set_zone_cookie3();" value="3" />
<input id="dzone_4" type="button" onclick="func_set_zone_cookie4();" value="4" />
<input id="dzone_5" type="button" onclick="func_set_zone_cookie5();" value="5" />
<input id="dzone_6" type="button" onclick="func_set_zone_cookie6();" value="6" />
<input id="dzone_7" type="button" onclick="func_set_zone_cookie7();" value="7" />
<input id="dzone_8" type="button" onclick="func_set_zone_cookie8();" value="8" />
&nbsp;
<!-- 旋轉 Tripwire 方向按鈕 預設隱藏,勾選 Tripwire 後顯示 -->
<nobr id="IDC_CHECK_ENABLE_DIRECTION"></nobr>
&nbsp;
<input id="button_rotate" type="button" onclick="func_rotate_direction()" value=" " style="background:#6c87d4;border-color:#6c87d4;background-image:url(./images/rotate.png);" />
&nbsp;
<!--<input id="btn_speed" type="button" onclick="window.open('speed_index.html', '_blank', 'resizable=yes,top=0,left=0,width=1150,height=750');" value="Speed" style="background:#6c87d4;border-color:#6c87d4;color:white" />-->
<input id="enable_direction" type="checkbox" name="enable_direction" style="display:none;"/> <!-- 因影響 tcp tunnel 排版,看 js 都不會打開,多加 display:none -->
<!-- Trace -->
<input id="enable_track" type="checkbox" onchange="func_set_enable_track()"/>
<nobr id="IDC_CHECK_ENABLE_TRACK"></nobr>
</div>
<div class="sub_row">
<nobr id="IDC_STATIC_COLD_ZONE"></nobr>
<input id="button_show_coldobjects" type="button" onclick="func_show_cold()" value="Show" />
<input id="button_clean_coldobjects" type="button" onclick="func_clean_cold()" value="Clean" />
<input id="button_set_coldobjects" type="button" onclick="func_set_cold()" value="Set" style="display:none;" />
<input id="button_set_mouse_coldobjects" type="button" onclick="func_set_mouse_cold()" value="Set" />
<select name="metadata_mouse_coldobjects" id="metadata_mouse_coldobjects" onchange=""></select>
&nbsp;
<input id="hide_open_label" type="button" onclick="func_hide_open_label()" value="T" style="background:#6c87d4;border-color:#6c87d4;color:white" />
<input id="upload_img" type="button" onclick="onAddJPG()" value="ADD JPEG" style="background:#6c87d4;border-color:#6c87d4;color:white" />
<input id="hide_open_direction" type="button" onclick="func_hide_open_direction()" value="D" style="background:gray;border-color:gray;color:white" />
<input id="hide_open_speed" type="button" onclick="func_hide_open_speed()" value="S" style="background:gray;border-color:gray;color:white" />
<input id="hide_open_getalarmmotion" type="button" onclick="func_hide_open_getalarmmotion()" value="B" style="background:#6c87d4;border-color:#6c87d4;color:white" />
<button id="button_advanced" class="Content_stybtn_ln" onclick="openAida()" style="float:right; margin-right:20px;">Advanced</button>
<button id="IDOK-top" class="Content_stybtn_ln" onclick="func_setAlarmZone()" style="float:right; margin-right:20px;" value="Set">Apply</button>
</div>
<!-- 08-09 車牌輪播欄位 -->
<div class="titlebox" style="display: none;"><nobr id="HTTP_TITLE01"></nobr></div>
<div id="lpr_container" style="border:1px gray solid;padding:10px 10px 50px 10px;margin:25px 0px 0px 0px;display: none;">
<div id="lpr_jpg" class="owl-carousel owl-theme" style="height:120px;margin-top:5px;left:0px;"><!-- position:absolute;background: #5C5C5C; -->
<div id="lpr_jpg_1" class="item">
</div>
<div id="lpr_jpg_2" class="item">
</div>
<div id="lpr_jpg_3" class="item">
</div>
<div id="lpr_jpg_4" class="item">
</div>
<div id="lpr_jpg_5" class="item">
</div>
<div id="lpr_jpg_6" class="item">
</div>
<div id="lpr_jpg_7" class="item">
</div>
<div id="lpr_jpg_8" class="item">
</div>
<div id="lpr_jpg_9" class="item">
</div>
<div id="lpr_jpg_10" class="item">
</div>
<div id="lpr_jpg_11" class="item">
</div>
<div id="lpr_jpg_12" class="item">
</div>
<div id="lpr_jpg_13" class="item">
</div>
<div id="lpr_jpg_14" class="item">
</div>
<div id="lpr_jpg_15" class="item">
</div>
<div id="lpr_jpg_16" class="item">
</div>
<div id="lpr_jpg_17" class="item">
</div>
<div id="lpr_jpg_18" class="item">
</div>
</div>
</div>
<!-- <h2>Responsive Two Column Layout</h2> -->
<!-- <p>Resize the browser window to see the responsive effect (the columns will stack on top of each other instead of floating next to each other, when the screen is less than 600px wide).</p> -->
<div class="titlebox"><nobr id="TITLEBOX_PAGE02"></nobr></div>
<div style="border:1px gray solid;padding:0px 10px 10px 10px;margin:15px 0px 4px 0px;"">
<br>
<div class="row">
<div class="column sub_row" style="width:100%;">
<div class="sub_row">
<div class="sub_column" style="width:40%; margin-left: -3px;">
<!-- 一般物件 -->
<input id="enable_traffic" type="checkbox" />
<nobr id="IDC_CHECK_ENABLE_TRAFFIC"></nobr>
<br>
</div>
</div>
</div>
</div>
<div class="row">
<div class="column" style="width:50%;">
<nobr id="IDC_STATIC_MIN_MAX_PROPORTION" style="width:100%;"></nobr><br><br>
<input class="easyui-slider" style="width:93%;" id="obj_min_max_proportion" />
<nobr id="IDC_STATIC_CONFIDENCE" style="width:100%;"></nobr><br><br>
<input class="easyui-slider" style="width:93%;" id="confidence_traffic" />
<!--<img src="./Icon/NoParking_Red_64x64px.png" style="vertical-align:middle;transform:scale(0.9,0.9);width:6%;" />-->
<nobr id="IDC_STATIC_NO_PARKING_TIME" style="width:100%;"></nobr><br><br>
<input class="easyui-slider" style="width:93%;" id="no_parking_time" />
<nobr id="IDC_STATIC_NO_PARKING_TIME_IN_MINUTE" style="width:100%;"></nobr>
<select name="no_parking_time_in_minute" id="no_parking_time_in_minute" onchange="func_change_no_parking_time_in_minute()">
<option value="0">None</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="15">15</option>
<option value="20">20</option>
<option value="25">25</option>
<option value="30">30</option>
</select>
<br>
<div style="height:5px;"></div> <!-- 為了對齊右半邊 -->
<nobr id="IDC_STATIC_METADATA"></nobr><br>
<div style="border: 1px gray solid;margin-bottom: 5px;">
<ul id="metaList" style="width:100%;height: 140px;"></ul>
</div>
<nobr id="IDC_STATIC_METADATA_STOP"></nobr>&nbsp;
<select name="metadata_stop" id="metadata_stop" onchange=""></select>
<br>
<!-- 只顯示分類物件 -->
<input id="enable_only_show_metadata1" type="checkbox" onchange="func_set_only_show_metadata1_cookie()" />
<nobr id="IDC_STATIC_ENABLE_ONLY_SHOW_METADATA1"></nobr>
<br>
<!-- IVS -->
<input id="enable_unknown_object" type="checkbox" />
<nobr id="IDC_CHECK_ENABLE_UNKNOWN_OBJECT"></nobr>
<!-- <br> -->
<input id="btn_object" type="button" onclick="openIVSsettins()" value="Set" style="background:#6c87d4;border-color:#6c87d4;color:white" />
<br>
<input id="enable_ivs_zone" type="checkbox" />
<nobr id="IDC_CHECK_ENABLE_IVS_ZONE"></nobr>
<svg width="10" height="10">
<circle id="bar_circle" r="5" cx="5" cy="5" style="fill:blue;" />
</svg>
</div>
<div class="column" style="width:50%">
<nobr id="IDC_STATIC_OBJ_MIN_MAX_PROPORTION_IN_ZONE" style="width:100%;"></nobr><br><br>
<input class="easyui-slider" style="width:93%;" id="obj_min_max_proportion_in_zone" />
<nobr id="IDC_STATIC_ACTION_DETECTION"></nobr>
<br>
<div style="border: 1px gray solid;">
<ul id="eventsList" style="width:100%; height:120px;"></ul>
</div>
<nobr id="IDC_STATIC_ZONE_OUTPUT"></nobr>
<br>
<div style="border: 1px gray solid; margin-bottom: 5px;">
<ul id="postList" style="width:100%; height: 140px;"></ul>
</div>
<div id="group_parking">
<nobr id="IDC_STATIC_PARKING_LINE"></nobr>
<select name="parking_line" id="parking_line" onchange="">
<option value="0">None</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
<br>
<nobr id="IDC_STATIC_PARKING_SPACE" style="display: none;"></nobr>
<!-- <br><br> -->
<br>
<input class="easyui-slider" style="width:100%;" id="parking_space" />
</div>
</div>
</div>
<div align="center">
<input align="center" id="IDOK" type="button" value="Set" onclick="func_setAlarmData()" class="Content_stybtn_ln" />
</div>
</div>
<div id="title_counter" class="titlebox"><nobr id="TITLEBOX_PAGE09"></nobr></div>
<div id="border_counter" style="border:1px gray solid; padding:10px; margin:15px 0px 4px 0px;">
<!-- <br> -->
<div class="row">
<div align="center">
<!-- <br> -->
<div style="margin:5px;">
<nobr id="counter_count_msg" height="50px"></nobr>
</div>
</div>
<div class="container" style="margin-top:5px;">
<!-- Counter name -->
<div>
<nobr id="IDC_STATIC_COUNTER_NAME" style="width:100%;"></nobr>
<select name="select_counter" id="select_counter" onchange="func_store_and_showCountersData()">
<option value="NULL">N.</option>
<option value="Counter01"></option>
<option value="Counter02"></option>
<option value="Counter03"></option>
<option value="Counter04"></option>
<option value="Counter05"></option>
<option value="Counter06"></option>
<option value="Counter07"></option>
<option value="Counter08"></option>
</select>
<input id="counter_cust_name" type="text" value="" style="width: 80px" />
</div>
<!-- Counter operand -->
<div>
<nobr id="IDC_STATIC_COUNTER_INCREMENT" style="width:100%;"></nobr>
<select name="select_counter_increment" id="select_counter_increment" onchange="">
<option value="NULL">N.</option>
<option value="counter_increment_add">+1</option>
<option value="counter_increment_minus">-1</option>
<option value="counter_increment_equal">=</option>
</select>
</div>
<!-- Reset value -->
<div>
<nobr id="IDC_STATIC_RESET_VALUE"></nobr>
<input id="reset_value" type="text" value="" style="width: 50px" />
</div>
<!-- Reset interval -->
<div>
<nobr id="IDC_STATIC_RESET_TIME_INTERVAL"></nobr>
<select name="select_reset_time_interval" id="reset_time_interval" onchange="">
<option value="NULL">None</option>
<option value="1 minute">1&nbsp;minute</option>
<option value="5 minutes">5&nbsp;minutes</option>
<option value="30 minutes">30&nbsp;minutes</option>
<option value="1 hour">1&nbsp;hour</option>
<option value="1 day">1&nbsp;day</option>
<option value="1 week">1&nbsp;week</option>
<option value="1 month">1&nbsp;month</option>
</select>
</div>
</div>
<div align="center" style="margin-top:5px;">
<input id="reset_counter" type="button" value="Reset" onclick="func_ResetCounter()" class="Content_stybtn_ln" style="display:inline-block;"/>
</div>
<hr style="border-top: 1px solid gray; margin: 5px 10px;">
<!-- 0px 5px 0px -->
<div class="column" style="width:60%;">
<nobr id="IDC_STATIC_COUNTER_TRIGGER" style="width:100%;"></nobr>
<div style="display: inline; float:right; margin-right:7%;">
<input id="enable_linked_to_dwell_time" type="checkbox" /><nobr id="IDC_STATIC_ENABLE_LINKED_TO_DWELL_TIME"></nobr>
</div>
<div class="column" style="width:100%;">
<br>
<input class="easyui-slider" style="width:93%;" id="queuing_count" />
</div>
</div>
<div class="sub_column" style="width:40%;">
<nobr id="IDC_STATIC_LINK_TO_POST_EVENT"></nobr>
<select id="link_to_post_event_name" onchange="">
<option value="-1">None</option>
<option value="0"></option>
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
<option value="4"></option>
<option value="5"></option>
<option value="6"></option>
<option value="7"></option>
<option value="8"></option>
<option value="9"></option>
<option value="10"></option>
<option value="11"></option>
<option value="12"></option>
</select>
<br>
<nobr id="IDC_STATIC_POST_INTERVAL"></nobr>
<select name="select_post_interval" id="post_interval" onchange="">
<option value="NULL">None</option>
<option value="1 minute">1&nbsp;minute</option>
<option value="5 minutes">5&nbsp;minutes</option>
<option value="30 minutes">30&nbsp;minutes</option>
<option value="1 hour">1&nbsp;hour</option>
<option value="1 day">1&nbsp;day</option>
<option value="1 week">1&nbsp;week</option>
<option value="1 month">1&nbsp;month</option>
</select>
<br>
</div>
</div>
<div align="center">
<input align="center" id="IDOK_counter" type="button" value="Set" onclick="func_setCounterData()" class="Content_stybtn_ln" style="display:inline-block"/>
</div>
</div>
<!--
<div align="center" style="margin-top: 10px;">
<button class="Content_stybtn_ln" onclick="func_setDefault()">Default</button>
</div> -->
<!-- 08-01 會議確認 tcp tunnel 不須此欄位的提示訊息 -->
<!--
<div style="border:1px gray solid; padding:10px; margin:15px 0px 4px 0px;">
<img src="images/info-2-32X32.png" style="vertical-align:middle;" />
&nbsp;
<nobr id="IDC_STATIC_TEXT_ALARM_HELP_02"></nobr>
<nobr id="IDC_STATIC_TEXT_ALARM_HELP_03"></nobr>
<nobr id="IDC_STATIC_TEXT_ALARM_HELP_04"></nobr>
<nobr id="IDC_STATIC_TEXT_ALARM_HELP_05"></nobr>
<nobr id="IDC_STATIC_TEXT_ALARM_HELP_06"></nobr>
<nobr id="IDC_STATIC_TEXT_ALARM_HELP_07"></nobr>
</div> -->
<script>
/*
loadScript("./jquery_3_2_1.min.js", function () {
//loadScript("./fabric_jquery.easyui.min_compressed_on_nvr.js", function () {
loadScript("./config.js", function () {
loadScript("./cookie.min.js", function () {
loadScript("./lang.js", function () {
loadScript("./label_names.js", function () {
//loadScript("./alarm_on_airelay.js", function () {
loadScript("./lang_cookie.js", function () {
//alert("all load");
});
//});
});
});
});
});
//});
});
*/
function loadScript(url, callback) {
var script = document.createElement("Script");
script.type = "text/javascript";
//IE 验证脚本是否下载完成
if (script.readyState) {
script.onreadystatechange = function () {
//readyState属性有5种取值
//uninitialized:初始状态
//loading:开始下载
//interactive:数据完成下载但尚不可用
//complete:数据已经准备就绪
//实际使用时,readyState的值并不像我们预想的那样有规律,实践发现使用readyState
//最靠谱的方式是同时检查以下2个状态,只要其中1个触发,就认为脚本下载完成。
if (script.readyState == "loaded" || script.readyState == "complete") {
//移除事件处理器,确保事件不会处理2次
script.onreadystatechange = null;
callback();
}
};
}
//其他浏览器
else {
script.onload = function () {
callback();
};
}
script.src = url;
//把新建的<Script>添加到<head>里比添加到<body>里更保险。
document.getElementsByTagName("head")[0].appendChild(script);
}
//var scale = 'scale(1)';
//document.body.style.transform = scale;// General
//document.body.style.zoom = "100%";
if (localStorage.getItem('current_state_hide_or_open_label') == null)
localStorage.setItem('current_state_hide_or_open_label', 1);
else
current_state_hide_or_open_label = localStorage.getItem('current_state_hide_or_open_label');
if (localStorage.getItem('current_state_hide_or_open_direction') == null)
localStorage.setItem('current_state_hide_or_open_direction', 0);
else
current_state_hide_or_open_direction = localStorage.getItem('current_state_hide_or_open_direction');
if (localStorage.getItem('current_state_hide_or_open_speed') == null)
localStorage.setItem('current_state_hide_or_open_speed', 0);
else
current_state_hide_or_open_speed = localStorage.getItem('current_state_hide_or_open_speed');
if (localStorage.getItem('current_state_hide_or_open_getalarmmotion') == null)
localStorage.setItem('current_state_hide_or_open_getalarmmotion', 1);
else
current_state_hide_or_open_getalarmmotion = 1;
//current_state_hide_or_open_getalarmmotion = localStorage.getItem('current_state_hide_or_open_getalarmmotion');
g_check_if_run_setting = 1;
var value_luckalarmui = 300;
var MAX_DETECTION_ZONE = 8;
var check_names_array = [];
var check_events_array = [];
var check_post_array = [];
var show_all_zone = 0;
//UI Interface
func_get_lang_cookie();
var message_alert = MESSAGE08;
var message_alert_wrong_feature = MESSAGE59;
//var message_alert_wrong_zone_for_missing_object_detection = MESSAGE60;
var message_alert_clean = MESSAGE63;
var message_alert_number_output = MESSAGE80;
var message_AND_NAND = MESSAGE90;
//var message_resolution_changed = MESSAGE99;
var message_notice_only_once_to_post = IDC_STATIC_NOTICE_ONLY_ONCE_TO_POST;
var message_check_current_resolution = MESSAGE103;
document.getElementById("IDC_STATIC_MIN_MAX_PROPORTION").innerHTML = IDC_STATIC_MIN_MAX_PROPORTION;
document.getElementById("IDC_CHECK_ENABLE_TRAFFIC").innerHTML = IDC_CHECK_ENABLE_TRAFFIC;
document.getElementById("IDC_CHECK_ENABLE_UNKNOWN_OBJECT").innerHTML = IDC_CHECK_ENABLE_UNKNOWN_OBJECT;
document.getElementById("IDC_CHECK_ENABLE_IVS_ZONE").innerHTML = IDC_CHECK_ENABLE_IVS_ZONE;
document.getElementById("IDC_CHECK_ENABLE_TRACK").innerHTML = IDC_CHECK_ENABLE_TRACK;
document.getElementById("IDC_CHECK_ENABLE_DIRECTION").innerHTML = IDC_CHECK_ENABLE_DIRECTION;
document.getElementById("IDC_STATIC_CONFIDENCE").innerHTML = IDC_STATIC_CONFIDENCE;
document.getElementById("IDC_STATIC_PARKING_SPACE").innerHTML = IDC_STATIC_PARKING_SPACE;
document.getElementById("IDC_STATIC_PARKING_LINE").innerHTML = IDC_STATIC_PARKING_LINE;
document.getElementById("IDC_STATIC_DETECTION_ZONE").innerHTML = IDC_STATIC_DETECTION_ZONE;
document.getElementById("IDC_STATIC_METADATA").innerHTML = IDC_STATIC_METADATA;
document.getElementById("IDC_STATIC_NO_PARKING_TIME").innerHTML = IDC_STATIC_NO_PARKING_TIME;
document.getElementById("IDC_STATIC_NO_PARKING_TIME_IN_MINUTE").innerHTML = IDC_STATIC_NO_PARKING_TIME_IN_MINUTE;
document.getElementById("IDC_STATIC_OBJ_MIN_MAX_PROPORTION_IN_ZONE").innerHTML = IDC_STATIC_OBJ_MIN_MAX_PROPORTION_IN_ZONE;
$('#IDOK').val(IDOK.trim());
$('#IDOK-top').val(IDOK.trim());
$('#IDOK-top').html(IDOK.trim());
$('#button_advanced').html(IDC_STATIC_ADVANCED);
$('#IDOK_counter').val(IDOK.trim());
$('#reset_counter').val(IDC_STATIC_RESET_COUNTER);
document.getElementById("HTTP_TITLE01").innerHTML = HTTP_TITLE01;
document.getElementById("TITLEBOX_PAGE02").innerHTML = TITLEBOX_PAGE02;
document.getElementById("TITLEBOX_PAGE09").innerHTML = TITLEBOX_PAGE09;
document.getElementById("IDC_STATIC_ACTION_DETECTION").innerHTML = IDC_STATIC_ACTION_DETECTION;
document.getElementById("IDC_STATIC_ZONE_OUTPUT").innerHTML = IDC_STATIC_ZONE_OUTPUT;
//document.getElementById("IDC_STATIC_TEXT_ALARM_HELP_01").innerHTML = IDC_STATIC_TEXT_ALARM_HELP_01;
// 08-01 tcp tunnel 頁面不需要
// document.getElementById("IDC_STATIC_TEXT_ALARM_HELP_02").innerHTML = IDC_STATIC_TEXT_ALARM_HELP_02;
// document.getElementById("IDC_STATIC_TEXT_ALARM_HELP_03").innerHTML = IDC_STATIC_TEXT_ALARM_HELP_03;
// document.getElementById("IDC_STATIC_TEXT_ALARM_HELP_04").innerHTML = IDC_STATIC_TEXT_ALARM_HELP_04;
// document.getElementById("IDC_STATIC_TEXT_ALARM_HELP_05").innerHTML = IDC_STATIC_TEXT_ALARM_HELP_05;
// document.getElementById("IDC_STATIC_TEXT_ALARM_HELP_06").innerHTML = IDC_STATIC_TEXT_ALARM_HELP_06;
// document.getElementById("IDC_STATIC_TEXT_ALARM_HELP_07").innerHTML = IDC_STATIC_TEXT_ALARM_HELP_07;
document.getElementById("IDC_STATIC_ENABLE_ONLY_SHOW_METADATA1").innerHTML = IDC_STATIC_ENABLE_ONLY_SHOW_METADATA1;
document.getElementById("IDC_STATIC_COUNTER_NAME").innerHTML = IDC_STATIC_COUNTER_NAME;
document.getElementById("IDC_STATIC_COUNTER_INCREMENT").innerHTML = IDC_STATIC_COUNTER_INCREMENT;
document.getElementById("IDC_STATIC_COUNTER_TRIGGER").innerHTML = IDC_STATIC_COUNTER_TRIGGER;
document.getElementById("IDC_STATIC_RESET_VALUE").innerHTML = IDC_STATIC_RESET_VALUE;
document.getElementById("IDC_STATIC_RESET_TIME_INTERVAL").innerHTML = IDC_STATIC_RESET_TIME_INTERVAL;
document.getElementById("IDC_STATIC_LINK_TO_POST_EVENT").innerHTML = IDC_STATIC_LINK_TO_POST_EVENT;
document.getElementById("IDC_STATIC_POST_INTERVAL").innerHTML = IDC_STATIC_POST_INTERVAL;
document.getElementById("IDC_STATIC_COLD_ZONE").innerHTML = IDC_STATIC_COLD_ZONE;
document.getElementById("IDC_STATIC_METADATA_STOP").innerHTML = IDC_STATIC_METADATA_STOP;
var text_ban_zone = IDC_STATIC_BAN_ZONE;
//document.getElementById("IDC_STATIC_ENABLE_RESET_ONLY_CLOUD").innerHTML = IDC_STATIC_ENABLE_RESET_ONLY_CLOUD;
document.getElementById("IDC_STATIC_ENABLE_LINKED_TO_DWELL_TIME").innerHTML = IDC_STATIC_ENABLE_LINKED_TO_DWELL_TIME;
$('#button_show_coldobjects').val(IDC_STATIC_SHOW);
$('#button_clean_coldobjects').val(IDC_STATIC_CLEAN);
$('#button_set_coldobjects').val(IDC_STATIC_SET);
$('#button_set_mouse_coldobjects').val(IDC_STATIC_SET);
$('#btn_object').val(IDC_STATIC_SET);
//$('#btn_speed').val(IDC_STATIC_SPEED);
// 08-09
var defaultButtonElement = window.parent.document.getElementById('defaultBtn').querySelector("button");
defaultButtonElement.innerHTML = IDC_STATIC_DEFAULT_BUTTON;
// $("#ID_DEFAULT").val(IDC_STATIC_DEFAULT_BUTTON);
//$('select[id="select_counter"] option[value="Counter01"]').text('TEMPEST');
var current_dzone = "dzone_1";
var current_cold = "NULL";
var current_counter = "pcounters1";
var enable_cloud = "No";
var enable_PTZ = "";
var check_key_false = 0;
var check_lpr = 0;
var check_ship = 0;
var check_radar = 0;
var check_tof = 0;
var red_light_zone = "";
var MAX_SIZE_POINTS = 6;
var MAX_SIZE_POST = 9;
var MAX_SIZE_COUNTERS = 8;
var MAX_SIZE_SNMP_POST = 5;
var LIMITED_TOTAL_POST = 4;
var enable_only_once_to_post = "Yes";
//var points_array = new Array(MAX_SIZE_POINTS);
var points_x_config = new Array(MAX_DETECTION_ZONE);
var points_y_config = new Array(MAX_DETECTION_ZONE);
var checked_trigger_events = new Array(MAX_DETECTION_ZONE);
var checked_post_event_name = new Array(MAX_DETECTION_ZONE);
var post_event_name = new Array(MAX_SIZE_POST);
var post_checked = new Array(MAX_SIZE_POST + MAX_SIZE_SNMP_POST);
var post_checked_to_zone = new Array(MAX_SIZE_POST + MAX_SIZE_SNMP_POST);
var snmp_event_name = new Array(MAX_SIZE_SNMP_POST);
var counter_name = new Array(MAX_SIZE_COUNTERS);
var reset_value = new Array(MAX_SIZE_COUNTERS);
var reset_time_interval = new Array(MAX_SIZE_COUNTERS);
//var enable_reset_only_cloud = new Array(MAX_SIZE_COUNTERS);
var enable_linked_to_dwell_time = new Array(MAX_SIZE_COUNTERS);
var link_to_post_event_name = new Array(MAX_SIZE_COUNTERS);
var post_interval = new Array(MAX_SIZE_COUNTERS);
var counter_cust_name = new Array(MAX_SIZE_COUNTERS);
var selected_counter_name = new Array(MAX_DETECTION_ZONE);
var selected_counter_increment = new Array(MAX_DETECTION_ZONE);
var current_trigger = new Array(MAX_DETECTION_ZONE);
var metadata_stop = new Array(MAX_DETECTION_ZONE);
var enable_ivs_zone = new Array(MAX_DETECTION_ZONE);
{
for (var i = 0; i < MAX_SIZE_POST + MAX_SIZE_SNMP_POST; i++) {
post_checked[i] = 0;
post_checked_to_zone[i] = new Array(MAX_DETECTION_ZONE);
for (var j = 0; j < MAX_DETECTION_ZONE; j++) {
post_checked_to_zone[i][j] = 0;
}
}
}
{
for (var i = 0; i < MAX_SIZE_COUNTERS; i++) {
counter_name[i] = "Counter0"+((i+1).toString());
reset_value[i] = "0";
reset_time_interval[i] = "1 minute";
//enable_reset_only_cloud[i] = "No";
enable_linked_to_dwell_time[i] = "No";
link_to_post_event_name[i] = "";
post_interval[i] = "5 minutes";
counter_cust_name[i] = "Counter0"+((i+1).toString());
}
}
// Loop to create 2D array using 1D array
{
for (var i = 0; i < MAX_DETECTION_ZONE; i++) {
points_x_config[i] = new Array(MAX_SIZE_POINTS);
points_y_config[i] = new Array(MAX_SIZE_POINTS);
checked_trigger_events[i] = new Array(MAX_SIZE_IDC_LIST_TRIGGER_EVENTS);
checked_post_event_name[i] = new Array(MAX_SIZE_IDC_LIST_TRIGGER_EVENTS);
current_trigger[i] = 0;
selected_counter_name[i] = new Array(MAX_SIZE_IDC_LIST_TRIGGER_EVENTS);
selected_counter_increment[i] = new Array(MAX_SIZE_IDC_LIST_TRIGGER_EVENTS);
metadata_stop[i] = "";
enable_ivs_zone[i] = "No";
}
}
var obj_max_proportion = "100";
var obj_min_proportion = "0";
var enable_traffic = "Yes";
var enable_direction = new Array(MAX_DETECTION_ZONE);
var confidence_traffic = "30";
var no_parking_time = new Array(MAX_DETECTION_ZONE);
var no_parking_time_in_minute = new Array(MAX_DETECTION_ZONE);
var obj_min_proportion_in_zone = new Array(MAX_DETECTION_ZONE);
var obj_max_proportion_in_zone = new Array(MAX_DETECTION_ZONE);
var metadata1 = new Array(MAX_DETECTION_ZONE);
var queuing_count = new Array(MAX_DETECTION_ZONE);
var enable_unknown_object = "No";
var enable_track = "No";
var tab_view_size = new Array(2);
var image_width = GetMaxWidth();
var image_height = GetMaxHeight();
var check_if_existing_any_metalist = 0;
var check_current_resolution = 1;
$(".owl-carousel").owlCarousel({
loop: false, // 循環播放
margin: 1, // 外距 10px
nav: false, // 顯示點點
dots: true,
//autoWidth: true,
items: 6 // 螢幕大小為 1000 以上 顯示 5 個項目
});
$("#confidence_traffic").slider({
//width: 300,
//height: 300,
//value: 12,
mode: 'h',//v,h
showTip: true,
//将最大最小值对调
// reversed:true,
// disabled:true,
min: 0,
max: 100,
// step:2.5,
//提示格式函数
tipFormatter: function (value) {
// return '['+value+']';
return value;
},
onChange: function (newValue, oldValue) {
// alert(newValue+" | "+oldValue);
},
onSlideStart: function (value) {
// alert(value);
},
onSlideEnd: function (value) {
// alert(value);
}
});
$("#parking_space").slider({
//width: 300,
//height: 300,
//value: 12,
mode: 'h',//v,h
showTip: true,
//将最大最小值对调
// reversed:true,
// disabled:true,
min: 0,
max: 30,
// step:2.5,
//提示格式函数
tipFormatter: function (value) {
// return '['+value+']';
return value;
},
onChange: function (newValue, oldValue) {
// alert(newValue+" | "+oldValue);
},
onSlideStart: function (value) {
// alert(value);
},
onSlideEnd: function (value) {
// alert(value);
}
});
$("#no_parking_time").slider({
//width: 300,
//height: 300,
//value: 12,
mode: 'h',//v,h
showTip: true,
//将最大最小值对调
// reversed:true,
disabled: false,
min: 2,
max: 30,
// step:2.5,
//提示格式函数
tipFormatter: function (value) {
// return '['+value+']';
return value;
},
onChange: function (newValue, oldValue) {
// alert(newValue+" | "+oldValue);
},
onSlideStart: function (value) {
// alert(value);
},
onSlideEnd: function (value) {
// alert(value);
}
});
$("#obj_min_max_proportion_in_zone").slider({
//width: 300,
//height: 300,
value: [0, 100],
mode: 'h',//v,h
showTip: true,
range: true,
//将最大最小值对调
// reversed:true,
// disabled:true,
min: 0,
max: 100,
// step:2.5,
//提示格式函数
tipFormatter: function (value) {
// return '['+value+']';
return value;
},
onChange: function (newValue, oldValue) {
// alert(newValue+" | "+oldValue);
},
onSlideStart: function (value) {
// alert(value);
},
onSlideEnd: function (value) {
// alert(value);
}
});
$("#obj_min_max_proportion").slider({
//width: 300,
//height: 300,
value: [0, 100],
mode: 'h',//v,h
showTip: true,
range: true,
//将最大最小值对调
// reversed:true,
// disabled:true,
min: 0,
max: 100,
// step:2.5,
//提示格式函数
tipFormatter: function (value) {
// return '['+value+']';
return value;
},
onChange: function (newValue, oldValue) {
// alert(newValue+" | "+oldValue);
},
onSlideStart: function (value) {
// alert(value);
},
onSlideEnd: function (value) {
// alert(value);
}
});
$("#queuing_count").slider({
//width: 300,
//height: 300,
//value: 12,
mode: 'h',//v,h
showTip: true,
//将最大最小值对调
// reversed:true,
// disabled:true,
min: 1,
max: 300,
// step:2.5,
//提示格式函数
tipFormatter: function (value) {
// return '['+value+']';
return value;
},
onChange: function (newValue, oldValue) {
// alert(newValue+" | "+oldValue);
},
onSlideStart: function (value) {
// alert(value);
},
onSlideEnd: function (value) {
// alert(value);
}
});
// 08-06
func_getaboutinfo();
func_get_zone_cookie();
func_showCloudData();
func_getcheck_current_resolution();
func_getEnablePTZ();
setup_lprimg_in_anprindex();
function func_store_and_showCountersData() {
func_storeCountersData();
func_get_current_counter($("#select_counter").val());
func_showCountersData();
}
function func_storeCountersData() {
var index_counters = -1;
if (current_counter == "pcounters1") {
index_counters = 0;
}
else if (current_counter == "pcounters2") {
index_counters = 1;
}
else if (current_counter == "pcounters3") {
index_counters = 2;
}
else if (current_counter == "pcounters4") {
index_counters = 3;
}
else if (current_counter == "pcounters5") {
index_counters = 4;
}
else if (current_counter == "pcounters6") {
index_counters = 5;
}
else if (current_counter == "pcounters7") {
index_counters = 6;
}
else if (current_counter == "pcounters8") {
index_counters = 7;
}
/*
if ($('#enable_http_notification').is(":checked")) {
enable_post = "Yes";
}
else {
enable_post = "No";
}*/
if (index_counters != -1) {
counter_name[index_counters] = "Counter0" + (index_counters + 1).toString();
reset_value[index_counters] = $('#reset_value').val();
reset_time_interval[index_counters] = $('#reset_time_interval').val();
/*
if ($('#enable_reset_only_cloud').is(":checked")) {
enable_reset_only_cloud[index_counters] = "Yes";
}
else {
enable_reset_only_cloud[index_counters] = "No";
}*/
if ($('#enable_linked_to_dwell_time').is(":checked")) {
enable_linked_to_dwell_time[index_counters] = "Yes";
}
else {
enable_linked_to_dwell_time[index_counters] = "No";
}
link_to_post_event_name[index_counters] = $('#link_to_post_event_name').val();
post_interval[index_counters] = $('#post_interval').val();
if (typeof $('#counter_cust_name').val() === "undefined" || $('#counter_cust_name').val().length == 0) {
counter_cust_name[index_counters] = "Counter0" + (index_counters + 1).toString();
}
else {
counter_cust_name[index_counters] = $('#counter_cust_name').val();
}
}
}
function func_get_current_counter(current_checked_id) {
if (current_checked_id === 'Counter01') {
current_counter = "pcounters1";
}
else if (current_checked_id === 'Counter02') {
current_counter = "pcounters2";
}
else if (current_checked_id === 'Counter03') {
current_counter = "pcounters3";
}
else if (current_checked_id === 'Counter04') {
current_counter = "pcounters4";
}
else if (current_checked_id === 'Counter05') {
current_counter = "pcounters5";
}
else if (current_checked_id === 'Counter06') {
current_counter = "pcounters6";
}
else if (current_checked_id === 'Counter07') {
current_counter = "pcounters7";
}
else if (current_checked_id === 'Counter08') {
current_counter = "pcounters8";
}
else {
current_counter = "NULL";
}
}
function func_getCurrentEventsData() {
var index_counters = -1;
if (current_counter == "pcounters1") {
index_counters = 0;
}
else if (current_counter == "pcounters2") {
index_counters = 1;
}
else if (current_counter == "pcounters3") {
index_counters = 2;
}
else if (current_counter == "pcounters4") {
index_counters = 3;
}
else if (current_counter == "pcounters5") {
index_counters = 4;
}
else if (current_counter == "pcounters6") {
index_counters = 5;
}
else if (current_counter == "pcounters7") {
index_counters = 6;
}
else if (current_counter == "pcounters8") {
index_counters = 7;
}
/*
if ($('#enable_http_notification').is(":checked")) {
enable_post = "Yes";
}
else {
enable_post = "No";
}*/
if (index_counters != -1) {
counter_name[index_counters] = "Counter0" + (index_counters + 1).toString();
reset_value[index_counters] = $('#reset_value').val();
reset_time_interval[index_counters] = $('#reset_time_interval').val();
/*
if ($('#enable_reset_only_cloud').is(":checked")) {
enable_reset_only_cloud[index_counters] = "Yes";
}
else {
enable_reset_only_cloud[index_counters] = "No";
}*/
if ($('#enable_linked_to_dwell_time').is(":checked")) {
enable_linked_to_dwell_time[index_counters] = "Yes";
}
else {
enable_linked_to_dwell_time[index_counters] = "No";
}
link_to_post_event_name[index_counters] = $('#link_to_post_event_name').val();
post_interval[index_counters] = $('#post_interval').val();
if (typeof $('#counter_cust_name').val() === "undefined" || $('#counter_cust_name').val().length == 0) {
counter_cust_name[index_counters] = "Counter0" + (index_counters + 1).toString();
}
else {
counter_cust_name[index_counters] = $('#counter_cust_name').val();
}
}
}
function func_showCountersData() {
for (var i = 0; i < MAX_SIZE_POST; i++) {
$('select[id="link_to_post_event_name"] option[value="' + (i).toString() + '"]').text(post_event_name[i]);
}
//if (enable_cloud == "Yes")
{
for (var i = 0; i < MAX_SIZE_SNMP_POST; i++) {
$('select[id="link_to_post_event_name"] option[value="' + (MAX_SIZE_POST + i).toString() + '"]').text(snmp_event_name[i]);
}
}
//else {
//for (var i = 0; i < MAX_SIZE_SNMP_POST; i++) {
//$('select[id="link_to_post_event_name"] option[value="' + (MAX_SIZE_POST + i).toString() + '"]').hide();
//}
//}
var index_counters = -1;
if (current_counter == "pcounters1") {
index_counters = 0;
/*
document.getElementById("post_password").style.visibility = "hidden";
document.getElementById("IDC_STATIC_POST_PASSWORD").style.visibility = "hidden";
document.getElementById("post_user_name").style.background = "#F3F1F1";
document.getElementById("post_user_name").readOnly = true;
document.getElementById("post_host_port").style.background = "#F3F1F1";
document.getElementById("post_host_port").readOnly = true;
document.getElementById("post_host_name").style.background = "#F3F1F1";
document.getElementById("post_host_name").readOnly = true;*/
}
else if (current_counter == "pcounters2") {
index_counters = 1;
}
else if (current_counter == "pcounters3") {
index_counters = 2;
}
else if (current_counter == "pcounters4") {
index_counters = 3;
}
else if (current_counter == "pcounters5") {
index_counters = 4;
}
else if (current_counter == "pcounters6") {
index_counters = 5;
}
else if (current_counter == "pcounters7") {
index_counters = 6;
}
else if (current_counter == "pcounters8") {
index_counters = 7;
}
/*
if (enable_post === 'Yes')
$('#enable_http_notification').prop("checked", true);
else
$('#enable_http_notification').prop("checked", false);*/
//console.log(link_to_post_event_name[index_counters]);
if (index_counters != -1) {
$('#counter_name').val(counter_name[index_counters]);
$('#reset_value').val(reset_value[index_counters]);
$('#reset_time_interval').val(reset_time_interval[index_counters]);
/*
if (enable_reset_only_cloud[index_counters] === 'Yes')
$('#enable_reset_only_cloud').prop("checked", true);
else
$('#enable_reset_only_cloud').prop("checked", false);
*/
if (enable_linked_to_dwell_time[index_counters] === 'Yes')
$('#enable_linked_to_dwell_time').prop("checked", true);
else
$('#enable_linked_to_dwell_time').prop("checked", false);
$('#link_to_post_event_name').val(link_to_post_event_name[index_counters]);
$('#post_interval').val(post_interval[index_counters]);
$('#counter_cust_name').val(counter_cust_name[index_counters]);
}
/*
document.getElementById("checked_counter_name_1_text").innerHTML = counter_name[0];
document.getElementById("checked_counter_name_2_text").innerHTML = counter_name[1];
document.getElementById("checked_counter_name_3_text").innerHTML = counter_name[2];
document.getElementById("checked_counter_name_4_text").innerHTML = counter_name[3];
document.getElementById("checked_counter_name_5_text").innerHTML = counter_name[4];
document.getElementById("checked_counter_name_6_text").innerHTML = counter_name[5];
document.getElementById("checked_counter_name_7_text").innerHTML = counter_name[6];
document.getElementById("checked_counter_name_8_text").innerHTML = counter_name[7];*/
}
var checkbox_enable_direction = document.querySelector("input[name=enable_direction]");
checkbox_enable_direction.addEventListener('change', function () {
if (current_trigger[get_current_index_zone()] == 4 ||
current_trigger[get_current_index_zone()] == 17 ||
current_trigger[get_current_index_zone()] == 18 ||
current_trigger[get_current_index_zone()] == 19) {
open_visible_arrow();
enable_direction[get_current_index_zone()] = "Yes";
enable_show_direction();
}
else if (current_trigger[get_current_index_zone()] == 15 ||
current_trigger[get_current_index_zone()] == 16 ||
red_light_zone == get_current_index_zone().toString()) {
hide_visible_arrow();
enable_direction[get_current_index_zone()] = "No";
enable_show_direction();
}
else {
enable_direction[get_current_index_zone()] = "No";
disable_show_direction();
}
});
function func_change_no_parking_time_in_minute() {
func_set_zone_data();
if (no_parking_time_in_minute[get_current_index_zone()] == "0") {
$('#no_parking_time').slider({ disabled: false });
}
else {
$('#no_parking_time').slider({ disabled: true });
}
}
function onAddJPG(i) {
//window.open('./upload_img.html', 'Upload Img', config='height=800,width=600');
window.open('upload_img.html', 'Upload Img', 'width='+(window.screen.availWidth/2)+',height='+(window.screen.availHeight-20));
}
function func_hide_open_label() {
if (current_state_hide_or_open_label == 1) {
current_state_hide_or_open_label = 0;
document.getElementById("hide_open_label").style.background = "gray";
document.getElementById("hide_open_label").style.borderColor = "gray";
}
else {
current_state_hide_or_open_label = 1;
document.getElementById("hide_open_label").style.background = "#6c87d4";
document.getElementById("hide_open_label").style.borderColor = "#6c87d4";
}
localStorage.setItem('current_state_hide_or_open_label', current_state_hide_or_open_label);
}
function func_hide_open_direction() {
if (current_state_hide_or_open_direction == 1) {
current_state_hide_or_open_direction = 0;
document.getElementById("hide_open_direction").style.background = "gray";
document.getElementById("hide_open_direction").style.borderColor = "gray";
}
else {
current_state_hide_or_open_direction = 1;
document.getElementById("hide_open_direction").style.background = "#6c87d4";
document.getElementById("hide_open_direction").style.borderColor = "#6c87d4";
}
localStorage.setItem('current_state_hide_or_open_direction', current_state_hide_or_open_direction);
}
function func_hide_open_speed() {
if (current_state_hide_or_open_speed == 1) {
current_state_hide_or_open_speed = 0;
document.getElementById("hide_open_speed").style.background = "gray";
document.getElementById("hide_open_speed").style.borderColor = "gray";
}
else {
current_state_hide_or_open_speed = 1;
document.getElementById("hide_open_speed").style.background = "#6c87d4";
document.getElementById("hide_open_speed").style.borderColor = "#6c87d4";
}
localStorage.setItem('current_state_hide_or_open_speed', current_state_hide_or_open_speed);
}
function func_hide_open_getalarmmotion() {
if (current_state_hide_or_open_getalarmmotion == 1) {
current_state_hide_or_open_getalarmmotion = 0;
document.getElementById("hide_open_getalarmmotion").style.background = "gray";
document.getElementById("hide_open_getalarmmotion").style.borderColor = "gray";
}
else {
current_state_hide_or_open_getalarmmotion = 1;
document.getElementById("hide_open_getalarmmotion").style.background = "#6c87d4";
document.getElementById("hide_open_getalarmmotion").style.borderColor = "#6c87d4";
}
localStorage.setItem('current_state_hide_or_open_getalarmmotion', current_state_hide_or_open_getalarmmotion);
}
var lock_IDOK = 0;
function func_show_all_zone() {
func_set_zone_data();
func_set_zone_cookie8();
func_set_zone_cookie7();
func_set_zone_cookie6();
func_set_zone_cookie5();
func_set_zone_cookie4();
func_set_zone_cookie3();
func_set_zone_cookie2();
func_set_zone_cookie1();
show_all_zone = 1;
change_color_of_button_zone();
if (typeof canvasTripwire_all !== 'undefined') {
//Clear all objects
while (canvasTripwire_all.getObjects().length > 0) {
var items = canvasTripwire_all.getObjects();
if (items[canvasTripwire_all.getObjects().length - 1]) {
canvasTripwire_all.remove(items[canvasTripwire_all.getObjects().length - 1]);
}
}
}
if (get_check_edit1() === 1) {
disabelIteraction(canvasTripwire1.getObjects()[0]);
Edit1();
}
if (get_check_edit2() === 1) {
disabelIteraction(canvasTripwire2.getObjects()[0]);
Edit2();
}
if (get_check_edit3() === 1) {
disabelIteraction(canvasTripwire3.getObjects()[0]);
Edit3();
}
if (get_check_edit4() === 1) {
disabelIteraction(canvasTripwire4.getObjects()[0]);
Edit4();
}
if (get_check_edit5() === 1) {
disabelIteraction(canvasTripwire5.getObjects()[0]);
Edit5();
}
if (get_check_edit6() === 1) {
disabelIteraction(canvasTripwire6.getObjects()[0]);
Edit6();
}
if (get_check_edit7() === 1) {
disabelIteraction(canvasTripwire7.getObjects()[0]);
Edit7();
}
if (get_check_edit8() === 1) {
disabelIteraction(canvasTripwire8.getObjects()[0]);
Edit8();
}
var object1 = fabric.util.object.clone(canvasTripwire1.getObjects()[0]);
var object2 = fabric.util.object.clone(canvasTripwire2.getObjects()[0]);
var object3 = fabric.util.object.clone(canvasTripwire3.getObjects()[0]);
var object4 = fabric.util.object.clone(canvasTripwire4.getObjects()[0]);
var object5 = fabric.util.object.clone(canvasTripwire5.getObjects()[0]);
var object6 = fabric.util.object.clone(canvasTripwire6.getObjects()[0]);
var object7 = fabric.util.object.clone(canvasTripwire7.getObjects()[0]);
var object8 = fabric.util.object.clone(canvasTripwire8.getObjects()[0]);
if (count_zone >= 1) {
canvasTripwire_all.add(object1);
if (count_zone >= 2) {
canvasTripwire_all.add(object2);
if (count_zone >= 3) {
canvasTripwire_all.add(object3);
if (count_zone >= 4) {
canvasTripwire_all.add(object4);
if (count_zone >= 5) {
canvasTripwire_all.add(object5);
if (count_zone >= 6) {
canvasTripwire_all.add(object6);
if (count_zone >= 7) {
canvasTripwire_all.add(object7);
if (count_zone == 8) {
canvasTripwire_all.add(object8);
}
}
}
}
}
}
}
}
// 08-24 確認是否有設定警戒線的 Zone,額外再加上紅線物件
var arrow_num = 0;
for (var index_zone = 0; index_zone < count_zone; index_zone++)
{
// console.log(`[func_show_all_zone] check current_trigger[${index_zone}]: ${current_trigger[index_zone]}`);
// 比照 func_listen_to_enable_or_disable_show_direction 開啟紅線物件可見性的條件
if (
current_trigger[index_zone] == 4
|| current_trigger[index_zone] == 17
|| current_trigger[index_zone] == 18
|| current_trigger[index_zone] == 19
) {
arrow_num++;
var arrow_obj = null;
// ------------------------------------------------------
// 比照 clone 寫法位置會有問題,改仿照 Edit_Arrow 內部流程新增紅線物件
// if (index_zone == 0)
// {
// arrow_obj = fabric.util.object.clone(canvasTripwire1.getObjects()[1]);
// }
// else if (index_zone == 1)
// {
// arrow_obj = fabric.util.object.clone(canvasTripwire2.getObjects()[1]);
// }
// else if (index_zone == 2)
// {
// arrow_obj = fabric.util.object.clone(canvasTripwire3.getObjects()[1]);
// }
// else if (index_zone == 3)
// {
// arrow_obj = fabric.util.object.clone(canvasTripwire4.getObjects()[1]);
// }
// console.log("clone arrow_obj:");
// console.log(arrow_obj);
// ------------------------------------------------------
// 參照 Edit_Arrow
points_array = GetPointLocation(index_zone);
var index_point = g_mydirection[g_zone_id] - 1;
var next_point = index_point + 1 >= 4 ? 0 : index_point + 1;
var start_x = points_array[next_point].x;
var start_y = points_array[next_point].y;
var end_x = points_array[index_point].x;
var end_y = points_array[index_point].y;
arrow_obj = AddArrowObject(start_x, start_y, end_x, end_y)
arrow_obj.visible = true;
// ------------------------------------------------------
if (arrow_obj != null) {
canvasTripwire_all.add(arrow_obj);
}
}
}
// click_canvas_all = count_zone;
click_canvas_all = count_zone + arrow_num; // 確保多新增的紅線物件不會馬上被 RefreshCanvasObject 保護物件數量參數給清除掉
canvasTripwire_all.requestRenderAll();
//document.getElementById('IDOK').disabled = true;
lock_IDOK = 1;
// ------------------------------------------------------
// 08-24 避免 PTZ 機種 COLD ZONE 按鈕消失問題
/*
document.getElementById("IDOK").style.background = "#BABABA";
document.getElementById("IDOK").style.color = "black";
document.getElementById("IDOK_counter").style.background = "#BABABA";
document.getElementById("IDOK_counter").style.color = "black";
if (enable_PTZ == "Yes") {
document.getElementById("IDC_STATIC_COLD_ZONE").style.visibility = "hidden";
document.getElementById("button_show_coldobjects").style.visibility = "hidden";
document.getElementById("button_clean_coldobjects").style.visibility = "hidden";
document.getElementById("button_set_coldobjects").style.visibility = "hidden";
}
else {
document.getElementById("IDC_STATIC_COLD_ZONE").style.visibility = "visible";
document.getElementById("button_show_coldobjects").style.visibility = "visible";
document.getElementById("button_clean_coldobjects").style.visibility = "visible";
document.getElementById("button_set_coldobjects").style.visibility = "visible";
}
*/
}
function func_set_only_show_metadata1_cookie() {
var enable_only_show_metadata1 = "off";
if ($('#enable_only_show_metadata1').is(":checked")) {
enable_only_show_metadata1 = "on";
func_set_only_show_metadata1_on();
}
else {
enable_only_show_metadata1 = "off";
func_set_only_show_metadata1_off();
}
cookie("enable_only_show_metadata1", enable_only_show_metadata1, "9999/12/31 12:00:00");
}
function func_get_only_show_metadata1_cookie() {
var list = '';
var cookies = cookie();
for (var v in cookies) {
if (v === 'enable_only_show_metadata1')
list += cookies[v];
}
if (list.length >= 1) {
if (list === "on") {
$("#enable_only_show_metadata1").prop("checked", true);
func_set_only_show_metadata1_on();
}
else {
$("#enable_only_show_metadata1").prop("checked", false);
func_set_only_show_metadata1_off();
}
}
else {
cookie("enable_only_show_metadata1", "on", "9999/12/31 12:00:00");
$("#enable_only_show_metadata1").prop("checked", true);
func_set_only_show_metadata1_on();
}
}
function func_listen_to_enable_or_disable_show_direction() {
if (current_trigger[get_current_index_zone()] == 4 ||
current_trigger[get_current_index_zone()] == 17 ||
current_trigger[get_current_index_zone()] == 18 ||
current_trigger[get_current_index_zone()] == 19) {
open_visible_arrow();
enable_direction[get_current_index_zone()] = "Yes";
enable_show_direction();
}
else if (current_trigger[get_current_index_zone()] == 15 ||
current_trigger[get_current_index_zone()] == 16 ||
red_light_zone == get_current_index_zone().toString()) {
hide_visible_arrow();
enable_direction[get_current_index_zone()] = "No";
enable_show_direction();
}
else {
enable_direction[get_current_index_zone()] = "No";
disable_show_direction();
}
}
function set_g_zone_id_and_arrow() {
set_g_zone_id(get_current_index_zone());
Edit_Arrow();
}
function func_add_zone() {
if (count_zone < 8) {
count_zone = count_zone + 1;
}
func_set_count_zone_cookie();
enable_detection_zone_button();
}
function func_minus_zone() {
if (count_zone > 1) {
count_zone = count_zone - 1;
}
func_set_count_zone_cookie();
enable_detection_zone_button();
}
function enable_detection_zone_button() {
if (count_zone === 0) {
document.getElementById("dzone_1").style.visibility = "hidden";
document.getElementById("dzone_2").style.visibility = "hidden";
document.getElementById("dzone_3").style.visibility = "hidden";
document.getElementById("dzone_4").style.visibility = "hidden";
document.getElementById("dzone_5").style.visibility = "hidden";
document.getElementById("dzone_6").style.visibility = "hidden";
document.getElementById("dzone_7").style.visibility = "hidden";
document.getElementById("dzone_8").style.visibility = "hidden";
}
else if (count_zone === 1) {
document.getElementById("dzone_1").style.visibility = "visible";
document.getElementById("dzone_2").style.visibility = "hidden";
document.getElementById("dzone_3").style.visibility = "hidden";
document.getElementById("dzone_4").style.visibility = "hidden";
document.getElementById("dzone_5").style.visibility = "hidden";
document.getElementById("dzone_6").style.visibility = "hidden";
document.getElementById("dzone_7").style.visibility = "hidden";
document.getElementById("dzone_8").style.visibility = "hidden";
}
else if (count_zone === 2) {
document.getElementById("dzone_1").style.visibility = "visible";
document.getElementById("dzone_2").style.visibility = "visible";
document.getElementById("dzone_3").style.visibility = "hidden";
document.getElementById("dzone_4").style.visibility = "hidden";
document.getElementById("dzone_5").style.visibility = "hidden";
document.getElementById("dzone_6").style.visibility = "hidden";
document.getElementById("dzone_7").style.visibility = "hidden";
document.getElementById("dzone_8").style.visibility = "hidden";
}
else if (count_zone === 3) {
document.getElementById("dzone_1").style.visibility = "visible";
document.getElementById("dzone_2").style.visibility = "visible";
document.getElementById("dzone_3").style.visibility = "visible";
document.getElementById("dzone_4").style.visibility = "hidden";
document.getElementById("dzone_5").style.visibility = "hidden";
document.getElementById("dzone_6").style.visibility = "hidden";
document.getElementById("dzone_7").style.visibility = "hidden";
document.getElementById("dzone_8").style.visibility = "hidden";
}
else if (count_zone === 4) {
document.getElementById("dzone_1").style.visibility = "visible";
document.getElementById("dzone_2").style.visibility = "visible";
document.getElementById("dzone_3").style.visibility = "visible";
document.getElementById("dzone_4").style.visibility = "visible";
document.getElementById("dzone_5").style.visibility = "hidden";
document.getElementById("dzone_6").style.visibility = "hidden";
document.getElementById("dzone_7").style.visibility = "hidden";
document.getElementById("dzone_8").style.visibility = "hidden";
}
else if (count_zone === 5) {
document.getElementById("dzone_1").style.visibility = "visible";
document.getElementById("dzone_2").style.visibility = "visible";
document.getElementById("dzone_3").style.visibility = "visible";
document.getElementById("dzone_4").style.visibility = "visible";
document.getElementById("dzone_5").style.visibility = "visible";
document.getElementById("dzone_6").style.visibility = "hidden";
document.getElementById("dzone_7").style.visibility = "hidden";
document.getElementById("dzone_8").style.visibility = "hidden";
}
else if (count_zone === 6) {
document.getElementById("dzone_1").style.visibility = "visible";
document.getElementById("dzone_2").style.visibility = "visible";
document.getElementById("dzone_3").style.visibility = "visible";
document.getElementById("dzone_4").style.visibility = "visible";
document.getElementById("dzone_5").style.visibility = "visible";
document.getElementById("dzone_6").style.visibility = "visible";
document.getElementById("dzone_7").style.visibility = "hidden";
document.getElementById("dzone_8").style.visibility = "hidden";
}
else if (count_zone === 7) {
document.getElementById("dzone_1").style.visibility = "visible";
document.getElementById("dzone_2").style.visibility = "visible";
document.getElementById("dzone_3").style.visibility = "visible";
document.getElementById("dzone_4").style.visibility = "visible";
document.getElementById("dzone_5").style.visibility = "visible";
document.getElementById("dzone_6").style.visibility = "visible";
document.getElementById("dzone_7").style.visibility = "visible";
document.getElementById("dzone_8").style.visibility = "hidden";
}
else if (count_zone === 8) {
document.getElementById("dzone_1").style.visibility = "visible";
document.getElementById("dzone_2").style.visibility = "visible";
document.getElementById("dzone_3").style.visibility = "visible";
document.getElementById("dzone_4").style.visibility = "visible";
document.getElementById("dzone_5").style.visibility = "visible";
document.getElementById("dzone_6").style.visibility = "visible";
document.getElementById("dzone_7").style.visibility = "visible";
document.getElementById("dzone_8").style.visibility = "visible";
}
}
function func_set_zone_data() {
func_storeCountersData();
if ($('#enable_unknown_object').is(":checked")) {
enable_unknown_object = "Yes";
}
else {
enable_unknown_object = "No";
}
if ($('#enable_track').is(":checked")) {
enable_track = "Yes";
}
else {
enable_track = "No";
}
if (current_dzone === "dzone_2") {
if ($('#enable_ivs_zone').is(":checked")) {
enable_ivs_zone[1] = "Yes";
}
else {
enable_ivs_zone[1] = "No";
}
//no_parking_time[1] = $('#no_parking_time').val();
no_parking_time[1] = $('#no_parking_time').slider('getValue');
no_parking_time_in_minute[1] = $("#no_parking_time_in_minute").val();
parking_space[1] = $('#parking_space').slider('getValue');
parking_line[1] = $("#parking_line").val();
metadata1[1] = func_get_list_check();
func_get_eventslist_check(1);
func_get_postlist_check(1, current_trigger[1]);
metadata_stop[1] = $("#metadata_stop").val();
if ($('#enable_traffic').is(":checked")) {
enable_traffic = "Yes";
}
else {
enable_traffic = "No";
}
obj_max_proportion = $('#obj_min_max_proportion').slider('getValues')[1];
obj_min_proportion = $('#obj_min_max_proportion').slider('getValues')[0];
obj_max_proportion_in_zone[1] = $('#obj_min_max_proportion_in_zone').slider('getValues')[1];
obj_min_proportion_in_zone[1] = $('#obj_min_max_proportion_in_zone').slider('getValues')[0];
/*
if (parseInt($('#obj_max_proportion').val(), 10) >= parseInt($('#obj_min_proportion').val(), 10)) {
obj_max_proportion = $('#obj_max_proportion').val();
obj_min_proportion = $('#obj_min_proportion').val();
}*/
//confidence_traffic = $('#confidence_traffic').val();
confidence_traffic = $('#confidence_traffic').slider('getValue');
queuing_count[1] = $('#queuing_count').slider('getValue');
selected_counter_name[1][current_trigger[1]] = $("#select_counter").val();
selected_counter_increment[1][current_trigger[1]] = $("#select_counter_increment").val();
}
else if (current_dzone === "dzone_3") {
if ($('#enable_ivs_zone').is(":checked")) {
enable_ivs_zone[2] = "Yes";
}
else {
enable_ivs_zone[2] = "No";
}
//no_parking_time[2] = $('#no_parking_time').val();
no_parking_time[2] = $('#no_parking_time').slider('getValue');
no_parking_time_in_minute[2] = $("#no_parking_time_in_minute").val();
parking_space[2] = $('#parking_space').slider('getValue');
parking_line[2] = $("#parking_line").val();
metadata1[2] = func_get_list_check();
func_get_eventslist_check(2);
func_get_postlist_check(2, current_trigger[2]);
metadata_stop[2] = $("#metadata_stop").val();
if ($('#enable_traffic').is(":checked")) {
enable_traffic = "Yes";
}
else {
enable_traffic = "No";
}
obj_max_proportion = $('#obj_min_max_proportion').slider('getValues')[1];
obj_min_proportion = $('#obj_min_max_proportion').slider('getValues')[0];
obj_max_proportion_in_zone[2] = $('#obj_min_max_proportion_in_zone').slider('getValues')[1];
obj_min_proportion_in_zone[2] = $('#obj_min_max_proportion_in_zone').slider('getValues')[0];
/*
if (parseInt($('#obj_max_proportion').val(), 10) >= parseInt($('#obj_min_proportion').val(), 10)) {
obj_max_proportion = $('#obj_max_proportion').val();
obj_min_proportion = $('#obj_min_proportion').val();
}*/
//confidence_traffic = $('#confidence_traffic').val();
confidence_traffic = $('#confidence_traffic').slider('getValue');
queuing_count[2] = $('#queuing_count').slider('getValue');
selected_counter_name[2][current_trigger[2]] = $("#select_counter").val();
selected_counter_increment[2][current_trigger[2]] = $("#select_counter_increment").val();
}
else if (current_dzone === "dzone_4") {
if ($('#enable_ivs_zone').is(":checked")) {
enable_ivs_zone[3] = "Yes";
}
else {
enable_ivs_zone[3] = "No";
}
//no_parking_time[3] = $('#no_parking_time').val();
no_parking_time[3] = $('#no_parking_time').slider('getValue');
no_parking_time_in_minute[3] = $("#no_parking_time_in_minute").val();
parking_space[3] = $('#parking_space').slider('getValue');
parking_line[3] = $("#parking_line").val();
metadata1[3] = func_get_list_check();
func_get_eventslist_check(3);
func_get_postlist_check(3, current_trigger[3]);
metadata_stop[3] = $("#metadata_stop").val();
if ($('#enable_traffic').is(":checked")) {
enable_traffic = "Yes";
}
else {
enable_traffic = "No";
}
obj_max_proportion = $('#obj_min_max_proportion').slider('getValues')[1];
obj_min_proportion = $('#obj_min_max_proportion').slider('getValues')[0];
obj_max_proportion_in_zone[3] = $('#obj_min_max_proportion_in_zone').slider('getValues')[1];
obj_min_proportion_in_zone[3] = $('#obj_min_max_proportion_in_zone').slider('getValues')[0];
/*
if (parseInt($('#obj_max_proportion').val(), 10) >= parseInt($('#obj_min_proportion').val(), 10)) {
obj_max_proportion = $('#obj_max_proportion').val();
obj_min_proportion = $('#obj_min_proportion').val();
}*/
//confidence_traffic = $('#confidence_traffic').val();
confidence_traffic = $('#confidence_traffic').slider('getValue');
queuing_count[3] = $('#queuing_count').slider('getValue');
selected_counter_name[3][current_trigger[3]] = $("#select_counter").val();
selected_counter_increment[3][current_trigger[3]] = $("#select_counter_increment").val();
}
else if (current_dzone === "dzone_5") {
if ($('#enable_ivs_zone').is(":checked")) {
enable_ivs_zone[4] = "Yes";
}
else {
enable_ivs_zone[4] = "No";
}
//no_parking_time[4] = $('#no_parking_time').val();
no_parking_time[4] = $('#no_parking_time').slider('getValue');
no_parking_time_in_minute[4] = $("#no_parking_time_in_minute").val();
parking_space[4] = $('#parking_space').slider('getValue');
parking_line[4] = $("#parking_line").val();
metadata1[4] = func_get_list_check();
func_get_eventslist_check(4);
func_get_postlist_check(4, current_trigger[4]);
metadata_stop[4] = $("#metadata_stop").val();
if ($('#enable_traffic').is(":checked")) {
enable_traffic = "Yes";
}
else {
enable_traffic = "No";
}
obj_max_proportion = $('#obj_min_max_proportion').slider('getValues')[1];
obj_min_proportion = $('#obj_min_max_proportion').slider('getValues')[0];
obj_max_proportion_in_zone[4] = $('#obj_min_max_proportion_in_zone').slider('getValues')[1];
obj_min_proportion_in_zone[4] = $('#obj_min_max_proportion_in_zone').slider('getValues')[0];
/*
if (parseInt($('#obj_max_proportion').val(), 10) >= parseInt($('#obj_min_proportion').val(), 10)) {
obj_max_proportion = $('#obj_max_proportion').val();
obj_min_proportion = $('#obj_min_proportion').val();
}*/
//confidence_traffic = $('#confidence_traffic').val();
confidence_traffic = $('#confidence_traffic').slider('getValue');
queuing_count[4] = $('#queuing_count').slider('getValue');
selected_counter_name[4][current_trigger[4]] = $("#select_counter").val();
selected_counter_increment[4][current_trigger[4]] = $("#select_counter_increment").val();
}
else if (current_dzone === "dzone_6") {
if ($('#enable_ivs_zone').is(":checked")) {
enable_ivs_zone[5] = "Yes";
}
else {
enable_ivs_zone[5] = "No";
}
//no_parking_time[5] = $('#no_parking_time').val();
no_parking_time[5] = $('#no_parking_time').slider('getValue');
no_parking_time_in_minute[5] = $("#no_parking_time_in_minute").val();
parking_space[5] = $('#parking_space').slider('getValue');
parking_line[5] = $("#parking_line").val();
metadata1[5] = func_get_list_check();
func_get_eventslist_check(5);
func_get_postlist_check(5, current_trigger[5]);
metadata_stop[5] = $("#metadata_stop").val();
if ($('#enable_traffic').is(":checked")) {
enable_traffic = "Yes";
}
else {
enable_traffic = "No";
}
obj_max_proportion = $('#obj_min_max_proportion').slider('getValues')[1];
obj_min_proportion = $('#obj_min_max_proportion').slider('getValues')[0];
obj_max_proportion_in_zone[5] = $('#obj_min_max_proportion_in_zone').slider('getValues')[1];
obj_min_proportion_in_zone[5] = $('#obj_min_max_proportion_in_zone').slider('getValues')[0];
/*
if (parseInt($('#obj_max_proportion').val(), 10) >= parseInt($('#obj_min_proportion').val(), 10)) {
obj_max_proportion = $('#obj_max_proportion').val();
obj_min_proportion = $('#obj_min_proportion').val();
}*/
//confidence_traffic = $('#confidence_traffic').val();
confidence_traffic = $('#confidence_traffic').slider('getValue');
queuing_count[5] = $('#queuing_count').slider('getValue');
selected_counter_name[5][current_trigger[5]] = $("#select_counter").val();
selected_counter_increment[5][current_trigger[5]] = $("#select_counter_increment").val();
}
else if (current_dzone === "dzone_7") {
if ($('#enable_ivs_zone').is(":checked")) {
enable_ivs_zone[6] = "Yes";
}
else {
enable_ivs_zone[6] = "No";
}
//no_parking_time[6] = $('#no_parking_time').val();
no_parking_time[6] = $('#no_parking_time').slider('getValue');
no_parking_time_in_minute[6] = $("#no_parking_time_in_minute").val();
parking_space[6] = $('#parking_space').slider('getValue');
parking_line[6] = $("#parking_line").val();
metadata1[6] = func_get_list_check();
func_get_eventslist_check(6);
func_get_postlist_check(6, current_trigger[6]);
metadata_stop[6] = $("#metadata_stop").val();
if ($('#enable_traffic').is(":checked")) {
enable_traffic = "Yes";
}
else {
enable_traffic = "No";
}
obj_max_proportion = $('#obj_min_max_proportion').slider('getValues')[1];
obj_min_proportion = $('#obj_min_max_proportion').slider('getValues')[0];
obj_max_proportion_in_zone[6] = $('#obj_min_max_proportion_in_zone').slider('getValues')[1];
obj_min_proportion_in_zone[6] = $('#obj_min_max_proportion_in_zone').slider('getValues')[0];
/*
if (parseInt($('#obj_max_proportion').val(), 10) >= parseInt($('#obj_min_proportion').val(), 10)) {
obj_max_proportion = $('#obj_max_proportion').val();
obj_min_proportion = $('#obj_min_proportion').val();
}*/
//confidence_traffic = $('#confidence_traffic').val();
confidence_traffic = $('#confidence_traffic').slider('getValue');
queuing_count[6] = $('#queuing_count').slider('getValue');
selected_counter_name[6][current_trigger[6]] = $("#select_counter").val();
selected_counter_increment[6][current_trigger[6]] = $("#select_counter_increment").val();
}
else if (current_dzone === "dzone_8") {
if ($('#enable_ivs_zone').is(":checked")) {
enable_ivs_zone[7] = "Yes";
}
else {
enable_ivs_zone[7] = "No";
}
//no_parking_time[7] = $('#no_parking_time').val();
no_parking_time[7] = $('#no_parking_time').slider('getValue');
no_parking_time_in_minute[7] = $("#no_parking_time_in_minute").val();
parking_space[7] = $('#parking_space').slider('getValue');
parking_line[7] = $("#parking_line").val();
metadata1[7] = func_get_list_check();
func_get_eventslist_check(7);
func_get_postlist_check(7, current_trigger[7]);
metadata_stop[7] = $("#metadata_stop").val();
if ($('#enable_traffic').is(":checked")) {
enable_traffic = "Yes";
}
else {
enable_traffic = "No";
}
obj_max_proportion = $('#obj_min_max_proportion').slider('getValues')[1];
obj_min_proportion = $('#obj_min_max_proportion').slider('getValues')[0];
obj_max_proportion_in_zone[7] = $('#obj_min_max_proportion_in_zone').slider('getValues')[1];
obj_min_proportion_in_zone[7] = $('#obj_min_max_proportion_in_zone').slider('getValues')[0];
/*
if (parseInt($('#obj_max_proportion').val(), 10) >= parseInt($('#obj_min_proportion').val(), 10)) {
obj_max_proportion = $('#obj_max_proportion').val();
obj_min_proportion = $('#obj_min_proportion').val();
}*/
//confidence_traffic = $('#confidence_traffic').val();
confidence_traffic = $('#confidence_traffic').slider('getValue');
queuing_count[7] = $('#queuing_count').slider('getValue');
selected_counter_name[7][current_trigger[7]] = $("#select_counter").val();
selected_counter_increment[7][current_trigger[7]] = $("#select_counter_increment").val();
}
else if (current_dzone === "dzone_1") {
if ($('#enable_ivs_zone').is(":checked")) {
enable_ivs_zone[0] = "Yes";
}
else {
enable_ivs_zone[0] = "No";
}
//no_parking_time[0] = $('#no_parking_time').val();
no_parking_time[0] = $('#no_parking_time').slider('getValue');
no_parking_time_in_minute[0] = $("#no_parking_time_in_minute").val();
parking_space[0] = $('#parking_space').slider('getValue');
parking_line[0] = $("#parking_line").val();
metadata1[0] = func_get_list_check();
func_get_eventslist_check(0);
func_get_postlist_check(0, current_trigger[0]);
metadata_stop[0] = $("#metadata_stop").val();
if ($('#enable_traffic').is(":checked")) {
enable_traffic = "Yes";
}
else {
enable_traffic = "No";
}
obj_max_proportion = $('#obj_min_max_proportion').slider('getValues')[1];
obj_min_proportion = $('#obj_min_max_proportion').slider('getValues')[0];
obj_max_proportion_in_zone[0] = $('#obj_min_max_proportion_in_zone').slider('getValues')[1];
obj_min_proportion_in_zone[0] = $('#obj_min_max_proportion_in_zone').slider('getValues')[0];
/*
if (parseInt($('#obj_max_proportion').val(), 10) >= parseInt($('#obj_min_proportion').val(), 10)) {
obj_max_proportion = $('#obj_max_proportion').val();
obj_min_proportion = $('#obj_min_proportion').val();
}*/
//confidence_traffic = $('#confidence_traffic').val();
confidence_traffic = $('#confidence_traffic').slider('getValue');
queuing_count[0] = $('#queuing_count').slider('getValue');
selected_counter_name[0][current_trigger[0]] = $("#select_counter").val();
selected_counter_increment[0][current_trigger[0]] = $("#select_counter_increment").val();
}
}
function func_set_zone_cookie1() {
if (current_dzone != "dzone_1") {
func_set_zone_data();
}
cookie("DZONE", "dzone_1", "9999/12/31 12:00:00");
current_dzone = "dzone_1";
current_cold = "NULL";
change_color_of_button_cold();
func_showAlarmData();
set_g_zone_id_and_arrow();
if (get_check_edit2() === 1) {
disabelIteraction(canvasTripwire2.getObjects()[0]);
Edit2();
}
if (get_check_edit3() === 1) {
disabelIteraction(canvasTripwire3.getObjects()[0]);
Edit3();
}
if (get_check_edit4() === 1) {
disabelIteraction(canvasTripwire4.getObjects()[0]);
Edit4();
}
if (get_check_edit5() === 1) {
disabelIteraction(canvasTripwire5.getObjects()[0]);
Edit5();
}
if (get_check_edit6() === 1) {
disabelIteraction(canvasTripwire6.getObjects()[0]);
Edit6();
}
if (get_check_edit7() === 1) {
disabelIteraction(canvasTripwire7.getObjects()[0]);
Edit7();
}
if (get_check_edit8() === 1) {
disabelIteraction(canvasTripwire8.getObjects()[0]);
Edit8();
}
if (get_check_edit1() === 0) {
enableIteraction(canvasTripwire1.getObjects()[0]);
Edit1();
}
$('input.TRIGGER_EVENTS_ALARM').on('change', function () {
$('input.TRIGGER_EVENTS_ALARM').not(this).prop('checked', false);
for (var i = 0; i < MAX_SIZE_IDC_LIST_TRIGGER_EVENTS; i++) {
if ($(this).attr('id') === IDC_LIST_TRIGGER_EVENTS[i]) {
current_trigger[get_current_index_zone()] = i;
func_hide_or_show_direction_attr(1, i);
break;
}
}
if (current_trigger[get_current_index_zone()] != 4 &&
current_trigger[get_current_index_zone()] != 15 &&
current_trigger[get_current_index_zone()] != 16 &&
current_trigger[get_current_index_zone()] != 17 &&
current_trigger[get_current_index_zone()] != 18 &&
current_trigger[get_current_index_zone()] != 19 &&
red_light_zone != get_current_index_zone().toString()) {
func_hide_or_show_direction_attr(0, current_trigger[get_current_index_zone()]);
}
//if (red_light_zone != get_current_index_zone().toString())
{
func_get_postlist(get_current_index_zone(), current_trigger[get_current_index_zone()]);
func_listen_to_enable_or_disable_show_direction();
func_set_zone_data();
}
});
$('input.POST_EVENTS_ALARM').on('change', function () {
func_set_zone_data();
});
$('input.CLASS_META_LIST').on('change', function () {
func_get_list_check_select();
});
func_listen_to_enable_or_disable_show_direction();
show_all_zone = 0;
change_color_of_button_zone();
if (current_trigger[get_current_index_zone()] != 4 &&
current_trigger[get_current_index_zone()] != 15 &&
current_trigger[get_current_index_zone()] != 16 &&
current_trigger[get_current_index_zone()] != 17 &&
current_trigger[get_current_index_zone()] != 18 &&
current_trigger[get_current_index_zone()] != 19 &&
red_light_zone != get_current_index_zone().toString()) {
func_hide_or_show_direction_attr(0, current_trigger[get_current_index_zone()]);
}
else {
func_hide_or_show_direction_attr(1, current_trigger[get_current_index_zone()]);
}
//}
//document.getElementById('IDOK').disabled = false;
lock_IDOK = 0;
// 因應 Landing page 融入 ipcam service 樣式,背景色做調整
document.getElementById("IDOK").style.background = "#2a2a2a"; // "#6c87d4";
document.getElementById("IDOK").style.color = "white";
document.getElementById("IDOK_counter").style.background = "#2a2a2a"; // "#6c87d4";
document.getElementById("IDOK_counter").style.color = "white";
}
function func_set_zone_cookie2() {
if (current_dzone != "dzone_2") {
func_set_zone_data();
}
cookie("DZONE", "dzone_2", "9999/12/31 12:00:00");
current_dzone = "dzone_2";
current_cold = "NULL";
change_color_of_button_cold();
func_showAlarmData();
set_g_zone_id_and_arrow();
if (get_check_edit1() === 1) {
disabelIteraction(canvasTripwire1.getObjects()[0]);
Edit1();
}
if (get_check_edit3() === 1) {
disabelIteraction(canvasTripwire3.getObjects()[0]);
Edit3();
}
if (get_check_edit4() === 1) {
disabelIteraction(canvasTripwire4.getObjects()[0]);
Edit4();
}
if (get_check_edit5() === 1) {
disabelIteraction(canvasTripwire5.getObjects()[0]);
Edit5();
}
if (get_check_edit6() === 1) {
disabelIteraction(canvasTripwire6.getObjects()[0]);
Edit6();
}
if (get_check_edit7() === 1) {
disabelIteraction(canvasTripwire7.getObjects()[0]);
Edit7();
}
if (get_check_edit8() === 1) {
disabelIteraction(canvasTripwire8.getObjects()[0]);
Edit8();
}
if (get_check_edit2() === 0) {
enableIteraction(canvasTripwire2.getObjects()[0]);
Edit2();
}
$('input.TRIGGER_EVENTS_ALARM').on('change', function () {
$('input.TRIGGER_EVENTS_ALARM').not(this).prop('checked', false);
for (var i = 0; i < MAX_SIZE_IDC_LIST_TRIGGER_EVENTS; i++) {
if ($(this).attr('id') === IDC_LIST_TRIGGER_EVENTS[i]) {
current_trigger[get_current_index_zone()] = i;
func_hide_or_show_direction_attr(1, i);
break;
}
}
if (current_trigger[get_current_index_zone()] != 4 &&
current_trigger[get_current_index_zone()] != 15 &&
current_trigger[get_current_index_zone()] != 16 &&
current_trigger[get_current_index_zone()] != 17 &&
current_trigger[get_current_index_zone()] != 18 &&
current_trigger[get_current_index_zone()] != 19 &&
red_light_zone != get_current_index_zone().toString()) {
func_hide_or_show_direction_attr(0, current_trigger[get_current_index_zone()]);
}
//if (red_light_zone != get_current_index_zone().toString())
{
func_get_postlist(get_current_index_zone(), current_trigger[get_current_index_zone()]);
func_listen_to_enable_or_disable_show_direction();
func_set_zone_data();
}
});
$('input.POST_EVENTS_ALARM').on('change', function () {
func_set_zone_data();
});
$('input.CLASS_META_LIST').on('change', function () {
func_get_list_check_select();
});
func_listen_to_enable_or_disable_show_direction();
show_all_zone = 0;
change_color_of_button_zone();
if (current_trigger[get_current_index_zone()] != 4 &&
current_trigger[get_current_index_zone()] != 15 &&
current_trigger[get_current_index_zone()] != 16 &&
current_trigger[get_current_index_zone()] != 17 &&
current_trigger[get_current_index_zone()] != 18 &&
current_trigger[get_current_index_zone()] != 19 &&
red_light_zone != get_current_index_zone().toString()) {
func_hide_or_show_direction_attr(0, current_trigger[get_current_index_zone()]);
}
else {
func_hide_or_show_direction_attr(1, current_trigger[get_current_index_zone()]);
}
// }
//document.getElementById('IDOK').disabled = false;
lock_IDOK = 0;
// 因應 Landing page 融入 ipcam service 樣式,背景色做調整
document.getElementById("IDOK").style.background = "#2a2a2a"; // "#6c87d4";
document.getElementById("IDOK").style.color = "white";
document.getElementById("IDOK_counter").style.background = "#2a2a2a"; // "#6c87d4";
document.getElementById("IDOK_counter").style.color = "white";
}
function func_set_zone_cookie3() {
if (current_dzone != "dzone_3") {
func_set_zone_data();
}
cookie("DZONE", "dzone_3", "9999/12/31 12:00:00");
current_dzone = "dzone_3";
current_cold = "NULL";
change_color_of_button_cold();
func_showAlarmData();
set_g_zone_id_and_arrow();
if (get_check_edit1() === 1) {
disabelIteraction(canvasTripwire1.getObjects()[0]);
Edit1();
}
if (get_check_edit2() === 1) {
disabelIteraction(canvasTripwire2.getObjects()[0]);
Edit2();
}
if (get_check_edit4() === 1) {
disabelIteraction(canvasTripwire4.getObjects()[0]);
Edit4();
}
if (get_check_edit5() === 1) {
disabelIteraction(canvasTripwire5.getObjects()[0]);
Edit5();
}
if (get_check_edit6() === 1) {
disabelIteraction(canvasTripwire6.getObjects()[0]);
Edit6();
}
if (get_check_edit7() === 1) {
disabelIteraction(canvasTripwire7.getObjects()[0]);
Edit7();
}
if (get_check_edit8() === 1) {
disabelIteraction(canvasTripwire8.getObjects()[0]);
Edit8();
}
if (get_check_edit3() === 0) {
enableIteraction(canvasTripwire3.getObjects()[0]);
Edit3();
}
$('input.TRIGGER_EVENTS_ALARM').on('change', function () {
$('input.TRIGGER_EVENTS_ALARM').not(this).prop('checked', false);
for (var i = 0; i < MAX_SIZE_IDC_LIST_TRIGGER_EVENTS; i++) {
if ($(this).attr('id') === IDC_LIST_TRIGGER_EVENTS[i]) {
current_trigger[get_current_index_zone()] = i;
func_hide_or_show_direction_attr(1, i);
break;
}
}
if (current_trigger[get_current_index_zone()] != 4 &&
current_trigger[get_current_index_zone()] != 15 &&
current_trigger[get_current_index_zone()] != 16 &&
current_trigger[get_current_index_zone()] != 17 &&
current_trigger[get_current_index_zone()] != 18 &&
current_trigger[get_current_index_zone()] != 19 &&
red_light_zone != get_current_index_zone().toString()) {
func_hide_or_show_direction_attr(0, current_trigger[get_current_index_zone()]);
}
//if (red_light_zone != get_current_index_zone().toString())
{
func_get_postlist(get_current_index_zone(), current_trigger[get_current_index_zone()]);
func_listen_to_enable_or_disable_show_direction();
func_set_zone_data();
}
});
$('input.POST_EVENTS_ALARM').on('change', function () {
func_set_zone_data();
});
$('input.CLASS_META_LIST').on('change', function () {
func_get_list_check_select();
});
func_listen_to_enable_or_disable_show_direction();
show_all_zone = 0;
change_color_of_button_zone();
if (current_trigger[get_current_index_zone()] != 4 &&
current_trigger[get_current_index_zone()] != 15 &&
current_trigger[get_current_index_zone()] != 16 &&
current_trigger[get_current_index_zone()] != 17 &&
current_trigger[get_current_index_zone()] != 18 &&
current_trigger[get_current_index_zone()] != 19 &&
red_light_zone != get_current_index_zone().toString()) {
func_hide_or_show_direction_attr(0, current_trigger[get_current_index_zone()]);
}
else {
func_hide_or_show_direction_attr(1, current_trigger[get_current_index_zone()]);
}
//}
//document.getElementById('IDOK').disabled = false;
lock_IDOK = 0;
// 因應 Landing page 融入 ipcam service 樣式,背景色做調整
document.getElementById("IDOK").style.background = "#2a2a2a"; // "#6c87d4";
document.getElementById("IDOK").style.color = "white";
document.getElementById("IDOK_counter").style.background = "#2a2a2a"; // "#6c87d4";
document.getElementById("IDOK_counter").style.color = "white";
}
function func_set_zone_cookie4() {
if (current_dzone != "dzone_4") {
func_set_zone_data();
}
cookie("DZONE", "dzone_4", "9999/12/31 12:00:00");
current_dzone = "dzone_4";
current_cold = "NULL";
change_color_of_button_cold();
func_showAlarmData();
set_g_zone_id_and_arrow();
if (get_check_edit1() === 1) {
disabelIteraction(canvasTripwire1.getObjects()[0]);
Edit1();
}
if (get_check_edit2() === 1) {
disabelIteraction(canvasTripwire2.getObjects()[0]);
Edit2();
}
if (get_check_edit3() === 1) {
disabelIteraction(canvasTripwire3.getObjects()[0]);
Edit3();
}
if (get_check_edit5() === 1) {
disabelIteraction(canvasTripwire5.getObjects()[0]);
Edit5();
}
if (get_check_edit6() === 1) {
disabelIteraction(canvasTripwire6.getObjects()[0]);
Edit6();
}
if (get_check_edit7() === 1) {
disabelIteraction(canvasTripwire7.getObjects()[0]);
Edit7();
}
if (get_check_edit8() === 1) {
disabelIteraction(canvasTripwire8.getObjects()[0]);
Edit8();
}
if (get_check_edit4() === 0) {
enableIteraction(canvasTripwire4.getObjects()[0]);
Edit4();
}
$('input.TRIGGER_EVENTS_ALARM').on('change', function () {
$('input.TRIGGER_EVENTS_ALARM').not(this).prop('checked', false);
for (var i = 0; i < MAX_SIZE_IDC_LIST_TRIGGER_EVENTS; i++) {
if ($(this).attr('id') === IDC_LIST_TRIGGER_EVENTS[i]) {
current_trigger[get_current_index_zone()] = i;
func_hide_or_show_direction_attr(1, i);
break;
}
}
if (current_trigger[get_current_index_zone()] != 4 &&
current_trigger[get_current_index_zone()] != 15 &&
current_trigger[get_current_index_zone()] != 16 &&
current_trigger[get_current_index_zone()] != 17 &&
current_trigger[get_current_index_zone()] != 18 &&
current_trigger[get_current_index_zone()] != 19 &&
red_light_zone != get_current_index_zone().toString()) {
func_hide_or_show_direction_attr(0, current_trigger[get_current_index_zone()]);
}
//if (red_light_zone != get_current_index_zone().toString())
{
func_get_postlist(get_current_index_zone(), current_trigger[get_current_index_zone()]);
func_listen_to_enable_or_disable_show_direction();
func_set_zone_data();
}
});
$('input.POST_EVENTS_ALARM').on('change', function () {
func_set_zone_data();
});
$('input.CLASS_META_LIST').on('change', function () {
func_get_list_check_select();
});
func_listen_to_enable_or_disable_show_direction();
show_all_zone = 0;
change_color_of_button_zone();
if (current_trigger[get_current_index_zone()] != 4 &&
current_trigger[get_current_index_zone()] != 15 &&
current_trigger[get_current_index_zone()] != 16 &&
current_trigger[get_current_index_zone()] != 17 &&
current_trigger[get_current_index_zone()] != 18 &&
current_trigger[get_current_index_zone()] != 19 &&
red_light_zone != get_current_index_zone().toString()) {
func_hide_or_show_direction_attr(0, current_trigger[get_current_index_zone()]);
}
else {
func_hide_or_show_direction_attr(1, current_trigger[get_current_index_zone()]);
}
// }
//document.getElementById('IDOK').disabled = false;
lock_IDOK = 0;
// 因應 Landing page 融入 ipcam service 樣式,背景色做調整
document.getElementById("IDOK").style.background = "#2a2a2a"; // "#6c87d4";
document.getElementById("IDOK").style.color = "white";
document.getElementById("IDOK_counter").style.background = "#2a2a2a"; // "#6c87d4";
document.getElementById("IDOK_counter").style.color = "white";
}
function func_set_zone_cookie5() {
if (current_dzone != "dzone_5") {
func_set_zone_data();
}
cookie("DZONE", "dzone_5", "9999/12/31 12:00:00");
current_dzone = "dzone_5";
current_cold = "NULL";
change_color_of_button_cold();
func_showAlarmData();
set_g_zone_id_and_arrow();
if (get_check_edit1() === 1) {
disabelIteraction(canvasTripwire1.getObjects()[0]);
Edit1();
}
if (get_check_edit2() === 1) {
disabelIteraction(canvasTripwire2.getObjects()[0]);
Edit2();
}
if (get_check_edit3() === 1) {
disabelIteraction(canvasTripwire3.getObjects()[0]);
Edit3();
}
if (get_check_edit4() === 1) {
disabelIteraction(canvasTripwire4.getObjects()[0]);
Edit4();
}
if (get_check_edit6() === 1) {
disabelIteraction(canvasTripwire6.getObjects()[0]);
Edit6();
}
if (get_check_edit7() === 1) {
disabelIteraction(canvasTripwire7.getObjects()[0]);
Edit7();
}
if (get_check_edit8() === 1) {
disabelIteraction(canvasTripwire8.getObjects()[0]);
Edit8();
}
if (get_check_edit5() === 0) {
enableIteraction(canvasTripwire5.getObjects()[0]);
Edit5();
}
$('input.TRIGGER_EVENTS_ALARM').on('change', function () {
$('input.TRIGGER_EVENTS_ALARM').not(this).prop('checked', false);
for (var i = 0; i < MAX_SIZE_IDC_LIST_TRIGGER_EVENTS; i++) {
if ($(this).attr('id') === IDC_LIST_TRIGGER_EVENTS[i]) {
current_trigger[get_current_index_zone()] = i;
func_hide_or_show_direction_attr(1, i);
break;
}
}
if (current_trigger[get_current_index_zone()] != 4 &&
current_trigger[get_current_index_zone()] != 15 &&
current_trigger[get_current_index_zone()] != 16 &&
current_trigger[get_current_index_zone()] != 17 &&
current_trigger[get_current_index_zone()] != 18 &&
current_trigger[get_current_index_zone()] != 19 &&
red_light_zone != get_current_index_zone().toString()) {
func_hide_or_show_direction_attr(0, current_trigger[get_current_index_zone()]);
}
//if (red_light_zone != get_current_index_zone().toString())
{
func_get_postlist(get_current_index_zone(), current_trigger[get_current_index_zone()]);
func_listen_to_enable_or_disable_show_direction();
func_set_zone_data();
}
});
$('input.POST_EVENTS_ALARM').on('change', function () {
func_set_zone_data();
});
$('input.CLASS_META_LIST').on('change', function () {
func_get_list_check_select();
});
func_listen_to_enable_or_disable_show_direction();
show_all_zone = 0;
change_color_of_button_zone();
if (current_trigger[get_current_index_zone()] != 4 &&
current_trigger[get_current_index_zone()] != 15 &&
current_trigger[get_current_index_zone()] != 16 &&
current_trigger[get_current_index_zone()] != 17 &&
current_trigger[get_current_index_zone()] != 18 &&
current_trigger[get_current_index_zone()] != 19 &&
red_light_zone != get_current_index_zone().toString()) {
func_hide_or_show_direction_attr(0, current_trigger[get_current_index_zone()]);
}
else {
func_hide_or_show_direction_attr(1, current_trigger[get_current_index_zone()]);
}
// }
//document.getElementById('IDOK').disabled = false;
lock_IDOK = 0;
// 因應 Landing page 融入 ipcam service 樣式,背景色做調整
document.getElementById("IDOK").style.background = "#2a2a2a"; // "#6c87d4";
document.getElementById("IDOK").style.color = "white";
document.getElementById("IDOK_counter").style.background = "#2a2a2a"; // "#6c87d4";
document.getElementById("IDOK_counter").style.color = "white";
}
function func_set_zone_cookie6() {
if (current_dzone != "dzone_6") {
func_set_zone_data();
}
cookie("DZONE", "dzone_6", "9999/12/31 12:00:00");
current_dzone = "dzone_6";
current_cold = "NULL";
change_color_of_button_cold();
func_showAlarmData();
set_g_zone_id_and_arrow();
if (get_check_edit1() === 1) {
disabelIteraction(canvasTripwire1.getObjects()[0]);
Edit1();
}
if (get_check_edit2() === 1) {
disabelIteraction(canvasTripwire2.getObjects()[0]);
Edit2();
}
if (get_check_edit3() === 1) {
disabelIteraction(canvasTripwire3.getObjects()[0]);
Edit3();
}
if (get_check_edit4() === 1) {
disabelIteraction(canvasTripwire4.getObjects()[0]);
Edit4();
}
if (get_check_edit5() === 1) {
disabelIteraction(canvasTripwire5.getObjects()[0]);
Edit5();
}
if (get_check_edit7() === 1) {
disabelIteraction(canvasTripwire7.getObjects()[0]);
Edit7();
}
if (get_check_edit8() === 1) {
disabelIteraction(canvasTripwire8.getObjects()[0]);
Edit8();
}
if (get_check_edit6() === 0) {
enableIteraction(canvasTripwire6.getObjects()[0]);
Edit6();
}
$('input.TRIGGER_EVENTS_ALARM').on('change', function () {
$('input.TRIGGER_EVENTS_ALARM').not(this).prop('checked', false);
for (var i = 0; i < MAX_SIZE_IDC_LIST_TRIGGER_EVENTS; i++) {
if ($(this).attr('id') === IDC_LIST_TRIGGER_EVENTS[i]) {
current_trigger[get_current_index_zone()] = i;
func_hide_or_show_direction_attr(1, i);
break;
}
}
if (current_trigger[get_current_index_zone()] != 4 &&
current_trigger[get_current_index_zone()] != 15 &&
current_trigger[get_current_index_zone()] != 16 &&
current_trigger[get_current_index_zone()] != 17 &&
current_trigger[get_current_index_zone()] != 18 &&
current_trigger[get_current_index_zone()] != 19 &&
red_light_zone != get_current_index_zone().toString()) {
func_hide_or_show_direction_attr(0, current_trigger[get_current_index_zone()]);
}
//if (red_light_zone != get_current_index_zone().toString())
{
func_get_postlist(get_current_index_zone(), current_trigger[get_current_index_zone()]);
func_listen_to_enable_or_disable_show_direction();
func_set_zone_data();
}
});
$('input.POST_EVENTS_ALARM').on('change', function () {
func_set_zone_data();
});
$('input.CLASS_META_LIST').on('change', function () {
func_get_list_check_select();
});
func_listen_to_enable_or_disable_show_direction();
show_all_zone = 0;
change_color_of_button_zone();
if (current_trigger[get_current_index_zone()] != 4 &&
current_trigger[get_current_index_zone()] != 15 &&
current_trigger[get_current_index_zone()] != 16 &&
current_trigger[get_current_index_zone()] != 17 &&
current_trigger[get_current_index_zone()] != 18 &&
current_trigger[get_current_index_zone()] != 19 &&
red_light_zone != get_current_index_zone().toString()) {
func_hide_or_show_direction_attr(0, current_trigger[get_current_index_zone()]);
}
else {
func_hide_or_show_direction_attr(1, current_trigger[get_current_index_zone()]);
}
// }
//document.getElementById('IDOK').disabled = false;
lock_IDOK = 0;
// 因應 Landing page 融入 ipcam service 樣式,背景色做調整
document.getElementById("IDOK").style.background = "#2a2a2a"; // "#6c87d4";
document.getElementById("IDOK").style.color = "white";
document.getElementById("IDOK_counter").style.background = "#2a2a2a"; // "#6c87d4";
document.getElementById("IDOK_counter").style.color = "white";
}
function func_set_zone_cookie7() {
if (current_dzone != "dzone_7") {
func_set_zone_data();
}
cookie("DZONE", "dzone_7", "9999/12/31 12:00:00");
current_dzone = "dzone_7";
current_cold = "NULL";
change_color_of_button_cold();
func_showAlarmData();
set_g_zone_id_and_arrow();
if (get_check_edit1() === 1) {
disabelIteraction(canvasTripwire1.getObjects()[0]);
Edit1();
}
if (get_check_edit2() === 1) {
disabelIteraction(canvasTripwire2.getObjects()[0]);
Edit2();
}
if (get_check_edit3() === 1) {
disabelIteraction(canvasTripwire3.getObjects()[0]);
Edit3();
}
if (get_check_edit4() === 1) {
disabelIteraction(canvasTripwire4.getObjects()[0]);
Edit4();
}
if (get_check_edit5() === 1) {
disabelIteraction(canvasTripwire5.getObjects()[0]);
Edit5();
}
if (get_check_edit6() === 1) {
disabelIteraction(canvasTripwire6.getObjects()[0]);
Edit6();
}
if (get_check_edit8() === 1) {
disabelIteraction(canvasTripwire8.getObjects()[0]);
Edit8();
}
if (get_check_edit7() === 0) {
enableIteraction(canvasTripwire7.getObjects()[0]);
Edit7();
}
$('input.TRIGGER_EVENTS_ALARM').on('change', function () {
$('input.TRIGGER_EVENTS_ALARM').not(this).prop('checked', false);
for (var i = 0; i < MAX_SIZE_IDC_LIST_TRIGGER_EVENTS; i++) {
if ($(this).attr('id') === IDC_LIST_TRIGGER_EVENTS[i]) {
current_trigger[get_current_index_zone()] = i;
func_hide_or_show_direction_attr(1, i);
break;
}
}
if (current_trigger[get_current_index_zone()] != 4 &&
current_trigger[get_current_index_zone()] != 15 &&
current_trigger[get_current_index_zone()] != 16 &&
current_trigger[get_current_index_zone()] != 17 &&
current_trigger[get_current_index_zone()] != 18 &&
current_trigger[get_current_index_zone()] != 19 &&
red_light_zone != get_current_index_zone().toString()) {
func_hide_or_show_direction_attr(0, current_trigger[get_current_index_zone()]);
}
//if (red_light_zone != get_current_index_zone().toString())
{
func_get_postlist(get_current_index_zone(), current_trigger[get_current_index_zone()]);
func_listen_to_enable_or_disable_show_direction();
func_set_zone_data();
}
});
$('input.POST_EVENTS_ALARM').on('change', function () {
func_set_zone_data();
});
$('input.CLASS_META_LIST').on('change', function () {
func_get_list_check_select();
});
func_listen_to_enable_or_disable_show_direction();
show_all_zone = 0;
change_color_of_button_zone();
if (current_trigger[get_current_index_zone()] != 4 &&
current_trigger[get_current_index_zone()] != 15 &&
current_trigger[get_current_index_zone()] != 16 &&
current_trigger[get_current_index_zone()] != 17 &&
current_trigger[get_current_index_zone()] != 18 &&
current_trigger[get_current_index_zone()] != 19 &&
red_light_zone != get_current_index_zone().toString()) {
func_hide_or_show_direction_attr(0, current_trigger[get_current_index_zone()]);
}
else {
func_hide_or_show_direction_attr(1, current_trigger[get_current_index_zone()]);
}
// }
//document.getElementById('IDOK').disabled = false;
lock_IDOK = 0;
// 因應 Landing page 融入 ipcam service 樣式,背景色做調整
document.getElementById("IDOK").style.background = "#2a2a2a"; // "#6c87d4";
document.getElementById("IDOK").style.color = "white";
document.getElementById("IDOK_counter").style.background = "#2a2a2a"; // "#6c87d4";
document.getElementById("IDOK_counter").style.color = "white";
}
function func_set_zone_cookie8() {
if (current_dzone != "dzone_8") {
func_set_zone_data();
}
cookie("DZONE", "dzone_8", "9999/12/31 12:00:00");
current_dzone = "dzone_8";
current_cold = "NULL";
change_color_of_button_cold();
func_showAlarmData();
set_g_zone_id_and_arrow();
if (get_check_edit1() === 1) {
disabelIteraction(canvasTripwire1.getObjects()[0]);
Edit1();
}
if (get_check_edit2() === 1) {
disabelIteraction(canvasTripwire2.getObjects()[0]);
Edit2();
}
if (get_check_edit3() === 1) {
disabelIteraction(canvasTripwire3.getObjects()[0]);
Edit3();
}
if (get_check_edit4() === 1) {
disabelIteraction(canvasTripwire4.getObjects()[0]);
Edit4();
}
if (get_check_edit5() === 1) {
disabelIteraction(canvasTripwire5.getObjects()[0]);
Edit5();
}
if (get_check_edit6() === 1) {
disabelIteraction(canvasTripwire6.getObjects()[0]);
Edit6();
}
if (get_check_edit7() === 1) {
disabelIteraction(canvasTripwire7.getObjects()[0]);
Edit7();
}
if (get_check_edit8() === 0) {
enableIteraction(canvasTripwire8.getObjects()[0]);
Edit8();
}
$('input.TRIGGER_EVENTS_ALARM').on('change', function () {
$('input.TRIGGER_EVENTS_ALARM').not(this).prop('checked', false);
for (var i = 0; i < MAX_SIZE_IDC_LIST_TRIGGER_EVENTS; i++) {
if ($(this).attr('id') === IDC_LIST_TRIGGER_EVENTS[i]) {
current_trigger[get_current_index_zone()] = i;
func_hide_or_show_direction_attr(1, i);
break;
}
}
if (current_trigger[get_current_index_zone()] != 4 &&
current_trigger[get_current_index_zone()] != 15 &&
current_trigger[get_current_index_zone()] != 16 &&
current_trigger[get_current_index_zone()] != 17 &&
current_trigger[get_current_index_zone()] != 18 &&
current_trigger[get_current_index_zone()] != 19 &&
red_light_zone != get_current_index_zone().toString()) {
func_hide_or_show_direction_attr(0, current_trigger[get_current_index_zone()]);
}
//if (red_light_zone != get_current_index_zone().toString())
{
func_get_postlist(get_current_index_zone(), current_trigger[get_current_index_zone()]);
func_listen_to_enable_or_disable_show_direction();
func_set_zone_data();
}
});
$('input.POST_EVENTS_ALARM').on('change', function () {
func_set_zone_data();
});
$('input.CLASS_META_LIST').on('change', function () {
func_get_list_check_select();
});
func_listen_to_enable_or_disable_show_direction();
show_all_zone = 0;
change_color_of_button_zone();
if (current_trigger[get_current_index_zone()] != 4 &&
current_trigger[get_current_index_zone()] != 15 &&
current_trigger[get_current_index_zone()] != 16 &&
current_trigger[get_current_index_zone()] != 17 &&
current_trigger[get_current_index_zone()] != 18 &&
current_trigger[get_current_index_zone()] != 19 &&
red_light_zone != get_current_index_zone().toString()) {
func_hide_or_show_direction_attr(0, current_trigger[get_current_index_zone()]);
}
else {
func_hide_or_show_direction_attr(1, current_trigger[get_current_index_zone()]);
}
// }
//document.getElementById('IDOK').disabled = false;
lock_IDOK = 0;
// 因應 Landing page 融入 ipcam service 樣式,背景色做調整
document.getElementById("IDOK").style.background = "#2a2a2a"; // "#6c87d4";
document.getElementById("IDOK").style.color = "white";
document.getElementById("IDOK_counter").style.background = "#2a2a2a"; // "#6c87d4";
document.getElementById("IDOK_counter").style.color = "white";
}
/*
function func_get_plate_cookie() {
var list = '';
var cookies = cookie();
for (var v in cookies) {
if (v === 'OK_BBOX_COUNT')
list = cookies[v];
}
if (list.length >= 1) {
var SIZE_BBOX_COUNT = parseInt(list, 10);
return list;
}
cookie("OK_BBOX_COUNT", "0", "9999/12/31 12:00:00");
return 0;
}
*/
/*
function func_get_count_zone_cookie() {
var list = '';
var cookies = cookie();
for (var v in cookies) {
if (v === 'COUNT_ZONE')
list += cookies[v];
}
if (list.length >= 1) {
if (list === "0") {
count_zone = 0;
}
else if (list === "1") {
count_zone = 1;
}
else if (list === "2") {
count_zone = 2;
}
else if (list === "3") {
count_zone = 3;
}
else if (list === "4") {
count_zone = 4;
}
return list;
}
cookie("COUNT_ZONE", "0", "9999/12/31 12:00:00");
count_zone = 0;
return 0;
}*/
function func_set_count_zone_cookie() {
if (count_zone === 0) {
cookie("COUNT_ZONE", "0", "9999/12/31 12:00:00");
}
else if (count_zone === 1) {
cookie("COUNT_ZONE", "1", "9999/12/31 12:00:00");
}
else if (count_zone === 2) {
cookie("COUNT_ZONE", "2", "9999/12/31 12:00:00");
}
else if (count_zone === 3) {
cookie("COUNT_ZONE", "3", "9999/12/31 12:00:00");
}
else if (count_zone === 4) {
cookie("COUNT_ZONE", "4", "9999/12/31 12:00:00");
}
}
function func_get_zone_cookie() {
var list = '';
var cookies = cookie();
for (var v in cookies) {
if (v === 'DZONE')
list += cookies[v];
}
if (list.length >= 1) {
if (list === "dzone_1") {
current_dzone = "dzone_1";
}
else if (list === "dzone_2") {
current_dzone = "dzone_2";
}
else if (list === "dzone_3") {
current_dzone = "dzone_3";
}
else if (list === "dzone_4") {
current_dzone = "dzone_4";
}
else if (list === "dzone_5") {
current_dzone = "dzone_5";
}
else if (list === "dzone_6") {
current_dzone = "dzone_6";
}
else if (list === "dzone_7") {
current_dzone = "dzone_7";
}
else if (list === "dzone_8") {
current_dzone = "dzone_8";
}
return list;
}
cookie("DZONE", "dzone_1", "9999/12/31 12:00:00");
current_dzone = "dzone_1";
return 'dzone_1';
}
function func_showAlarmData() {
//$('#obj_max_proportion').val(obj_max_proportion);
//$('#obj_min_proportion').val(obj_min_proportion);
$('#obj_min_max_proportion').slider('setValues', [obj_min_proportion, obj_max_proportion]);
if (enable_traffic === 'Yes')
$('#enable_traffic').prop("checked", true);
else
$('#enable_traffic').prop("checked", false);
if (enable_unknown_object === 'Yes')
$('#enable_unknown_object').prop("checked", true);
else
$('#enable_unknown_object').prop("checked", false);
if (enable_track === 'Yes')
$('#enable_track').prop("checked", true);
else
$('#enable_track').prop("checked", false);
for (var i = 0; i < MAX_SIZE_COUNTERS; i++) {
$('select[id="select_counter"] option[value="Counter0' + (i + 1).toString() + '"]').text((i + 1).toString());//counter_name[i]
}
if (localStorage.getItem('check_ship') == 1) {
$('#no_parking_time').slider({ max: 600 });
}
else {
$('#no_parking_time').slider({ max: 30 });
}
if (current_dzone === "dzone_1") {
if (enable_ivs_zone[0] === 'Yes')
$('#enable_ivs_zone').prop("checked", true);
else
$('#enable_ivs_zone').prop("checked", false);
//$('#confidence_traffic').val(confidence_traffic);
$('#confidence_traffic').slider('setValue', confidence_traffic);
//$('#no_parking_time').val(no_parking_time[0]);
$('#parking_space').slider('setValue', parking_space[0]);
$("#parking_line").val(parking_line[0]);
$('#no_parking_time').slider('setValue', no_parking_time[0]);
$('#no_parking_time_in_minute').val(no_parking_time_in_minute[0]);
if (no_parking_time_in_minute[0] == "0") {
$('#no_parking_time').slider({ disabled: false });
}
else {
$('#no_parking_time').slider({ disabled: true });
}
$('#queuing_count').slider('setValue', queuing_count[0]);
$('#obj_min_max_proportion_in_zone').slider('setValues', [obj_min_proportion_in_zone[0], obj_max_proportion_in_zone[0]]);
/*
for (var i = 0; i < MAX_SIZE_IDC_LIST_TRIGGER_EVENTS; i++){
if (jsonbuf["trigger_events"][i]["checked"] === 1)
$('#trigger_events_' + padLeft(i + 1, 2)).prop("checked", true);
else
$('#trigger_events_' + padLeft(i + 1, 2)).prop("checked", false);
}*/
var names = metadata1[0].split(",");
func_get_list(names);
func_get_eventslist(0);
func_get_postlist(0, current_trigger[0]);
$("#select_counter").val(selected_counter_name[0][current_trigger[0]]);
$("#select_counter_increment").val(selected_counter_increment[0][current_trigger[0]]);
}
else if (current_dzone === "dzone_2") {
if (enable_ivs_zone[1] === 'Yes')
$('#enable_ivs_zone').prop("checked", true);
else
$('#enable_ivs_zone').prop("checked", false);
//$('#confidence_traffic').val(confidence_traffic);
$('#confidence_traffic').slider('setValue', confidence_traffic);
//$('#no_parking_time').val(no_parking_time[1]);
$('#parking_space').slider('setValue', parking_space[1]);
$("#parking_line").val(parking_line[1]);
$('#no_parking_time').slider('setValue', no_parking_time[1]);
$('#no_parking_time_in_minute').val(no_parking_time_in_minute[1]);
if (no_parking_time_in_minute[1] == "0") {
$('#no_parking_time').slider({ disabled: false });
}
else {
$('#no_parking_time').slider({ disabled: true });
}
$('#queuing_count').slider('setValue', queuing_count[1]);
$('#obj_min_max_proportion_in_zone').slider('setValues', [obj_min_proportion_in_zone[1], obj_max_proportion_in_zone[1]]);
var names = metadata1[1].split(",");
func_get_list(names);
func_get_eventslist(1);
func_get_postlist(1, current_trigger[1]);
$("#select_counter").val(selected_counter_name[1][current_trigger[1]]);
$("#select_counter_increment").val(selected_counter_increment[1][current_trigger[1]]);
}
else if (current_dzone === "dzone_3") {
if (enable_ivs_zone[2] === 'Yes')
$('#enable_ivs_zone').prop("checked", true);
else
$('#enable_ivs_zone').prop("checked", false);
//$('#confidence_traffic').val(confidence_traffic);
$('#confidence_traffic').slider('setValue', confidence_traffic);
//$('#no_parking_time').val(no_parking_time[2]);
$('#parking_space').slider('setValue', parking_space[2]);
$("#parking_line").val(parking_line[2]);
$('#no_parking_time').slider('setValue', no_parking_time[2]);
$('#no_parking_time_in_minute').val(no_parking_time_in_minute[2]);
if (no_parking_time_in_minute[2] == "0") {
$('#no_parking_time').slider({ disabled: false });
}
else {
$('#no_parking_time').slider({ disabled: true });
}
$('#queuing_count').slider('setValue', queuing_count[2]);
$('#obj_min_max_proportion_in_zone').slider('setValues', [obj_min_proportion_in_zone[2], obj_max_proportion_in_zone[2]]);
var names = metadata1[2].split(",");
func_get_list(names);
func_get_eventslist(2);
func_get_postlist(2, current_trigger[2]);
$("#select_counter").val(selected_counter_name[2][current_trigger[2]]);
$("#select_counter_increment").val(selected_counter_increment[2][current_trigger[2]]);
}
else if (current_dzone === "dzone_4") {
if (enable_ivs_zone[3] === 'Yes')
$('#enable_ivs_zone').prop("checked", true);
else
$('#enable_ivs_zone').prop("checked", false);
//$('#confidence_traffic').val(confidence_traffic);
$('#confidence_traffic').slider('setValue', confidence_traffic);
//$('#no_parking_time').val(no_parking_time[3]);
$('#parking_space').slider('setValue', parking_space[3]);
$("#parking_line").val(parking_line[3]);
$('#no_parking_time').slider('setValue', no_parking_time[3]);
$('#no_parking_time_in_minute').val(no_parking_time_in_minute[3]);
if (no_parking_time_in_minute[3] == "0") {
$('#no_parking_time').slider({ disabled: false });
}
else {
$('#no_parking_time').slider({ disabled: true });
}
$('#queuing_count').slider('setValue', queuing_count[3]);
$('#obj_min_max_proportion_in_zone').slider('setValues', [obj_min_proportion_in_zone[3], obj_max_proportion_in_zone[3]]);
var names = metadata1[3].split(",");
func_get_list(names);
func_get_eventslist(3);
func_get_postlist(3, current_trigger[3]);
$("#select_counter").val(selected_counter_name[3][current_trigger[3]]);
$("#select_counter_increment").val(selected_counter_increment[3][current_trigger[3]]);
}
else if (current_dzone === "dzone_5") {
if (enable_ivs_zone[4] === 'Yes')
$('#enable_ivs_zone').prop("checked", true);
else
$('#enable_ivs_zone').prop("checked", false);
//$('#confidence_traffic').val(confidence_traffic);
$('#confidence_traffic').slider('setValue', confidence_traffic);
//$('#no_parking_time').val(no_parking_time[4]);
$('#parking_space').slider('setValue', parking_space[4]);
$("#parking_line").val(parking_line[4]);
$('#no_parking_time').slider('setValue', no_parking_time[4]);
$('#no_parking_time_in_minute').val(no_parking_time_in_minute[4]);
if (no_parking_time_in_minute[4] == "0") {
$('#no_parking_time').slider({ disabled: false });
}
else {
$('#no_parking_time').slider({ disabled: true });
}
$('#queuing_count').slider('setValue', queuing_count[4]);
$('#obj_min_max_proportion_in_zone').slider('setValues', [obj_min_proportion_in_zone[4], obj_max_proportion_in_zone[4]]);
var names = metadata1[4].split(",");
func_get_list(names);
func_get_eventslist(4);
func_get_postlist(4, current_trigger[4]);
$("#select_counter").val(selected_counter_name[4][current_trigger[4]]);
$("#select_counter_increment").val(selected_counter_increment[4][current_trigger[4]]);
}
else if (current_dzone === "dzone_6") {
if (enable_ivs_zone[5] === 'Yes')
$('#enable_ivs_zone').prop("checked", true);
else
$('#enable_ivs_zone').prop("checked", false);
//$('#confidence_traffic').val(confidence_traffic);
$('#confidence_traffic').slider('setValue', confidence_traffic);
//$('#no_parking_time').val(no_parking_time[5]);
$('#parking_space').slider('setValue', parking_space[5]);
$("#parking_line").val(parking_line[5]);
$('#no_parking_time').slider('setValue', no_parking_time[5]);
$('#no_parking_time_in_minute').val(no_parking_time_in_minute[5]);
if (no_parking_time_in_minute[5] == "0") {
$('#no_parking_time').slider({ disabled: false });
}
else {
$('#no_parking_time').slider({ disabled: true });
}
$('#queuing_count').slider('setValue', queuing_count[5]);
$('#obj_min_max_proportion_in_zone').slider('setValues', [obj_min_proportion_in_zone[5], obj_max_proportion_in_zone[5]]);
var names = metadata1[5].split(",");
func_get_list(names);
func_get_eventslist(5);
func_get_postlist(5, current_trigger[5]);
$("#select_counter").val(selected_counter_name[5][current_trigger[5]]);
$("#select_counter_increment").val(selected_counter_increment[5][current_trigger[5]]);
}
else if (current_dzone === "dzone_7") {
if (enable_ivs_zone[6] === 'Yes')
$('#enable_ivs_zone').prop("checked", true);
else
$('#enable_ivs_zone').prop("checked", false);
//$('#confidence_traffic').val(confidence_traffic);
$('#confidence_traffic').slider('setValue', confidence_traffic);
//$('#no_parking_time').val(no_parking_time[6]);
$('#parking_space').slider('setValue', parking_space[6]);
$("#parking_line").val(parking_line[6]);
$('#no_parking_time').slider('setValue', no_parking_time[6]);
$('#no_parking_time_in_minute').val(no_parking_time_in_minute[6]);
if (no_parking_time_in_minute[6] == "0") {
$('#no_parking_time').slider({ disabled: false });
}
else {
$('#no_parking_time').slider({ disabled: true });
}
$('#queuing_count').slider('setValue', queuing_count[6]);
$('#obj_min_max_proportion_in_zone').slider('setValues', [obj_min_proportion_in_zone[6], obj_max_proportion_in_zone[6]]);
var names = metadata1[6].split(",");
func_get_list(names);
func_get_eventslist(6);
func_get_postlist(6, current_trigger[6]);
$("#select_counter").val(selected_counter_name[6][current_trigger[6]]);
$("#select_counter_increment").val(selected_counter_increment[6][current_trigger[6]]);
}
else if (current_dzone === "dzone_8") {
if (enable_ivs_zone[7] === 'Yes')
$('#enable_ivs_zone').prop("checked", true);
else
$('#enable_ivs_zone').prop("checked", false);
//$('#confidence_traffic').val(confidence_traffic);
$('#confidence_traffic').slider('setValue', confidence_traffic);
//$('#no_parking_time').val(no_parking_time[7]);
$('#parking_space').slider('setValue', parking_space[7]);
$("#parking_line").val(parking_line[7]);
$('#no_parking_time').slider('setValue', no_parking_time[7]);
$('#no_parking_time_in_minute').val(no_parking_time_in_minute[7]);
if (no_parking_time_in_minute[7] == "0") {
$('#no_parking_time').slider({ disabled: false });
}
else {
$('#no_parking_time').slider({ disabled: true });
}
$('#queuing_count').slider('setValue', queuing_count[7]);
$('#obj_min_max_proportion_in_zone').slider('setValues', [obj_min_proportion_in_zone[7], obj_max_proportion_in_zone[7]]);
var names = metadata1[7].split(",");
func_get_list(names);
func_get_eventslist(7);
func_get_postlist(7, current_trigger[7]);
$("#select_counter").val(selected_counter_name[7][current_trigger[7]]);
$("#select_counter_increment").val(selected_counter_increment[7][current_trigger[7]]);
}
if (current_dzone != "dzone_1") {
// 08-24 避免 PTZ 機種 COLD ZONE 按鈕消失問題
/*
if (enable_PTZ == "Yes") {
document.getElementById("IDC_STATIC_COLD_ZONE").style.visibility = "hidden";
document.getElementById("button_show_coldobjects").style.visibility = "hidden";
document.getElementById("button_clean_coldobjects").style.visibility = "hidden";
document.getElementById("button_set_coldobjects").style.visibility = "hidden";
}
else {
document.getElementById("IDC_STATIC_COLD_ZONE").style.visibility = "visible";
document.getElementById("button_show_coldobjects").style.visibility = "visible";
document.getElementById("button_clean_coldobjects").style.visibility = "visible";
document.getElementById("button_set_coldobjects").style.visibility = "visible";
}
*/
}
else {
document.getElementById("IDC_STATIC_COLD_ZONE").style.visibility = "visible";
document.getElementById("button_show_coldobjects").style.visibility = "visible";
document.getElementById("button_clean_coldobjects").style.visibility = "visible";
document.getElementById("button_set_coldobjects").style.visibility = "visible";
}
func_get_current_counter($("#select_counter").val());
func_showCountersData();
func_get_list_check_select();
}
function func_ResetCounter() {
$.ajax({
url: '/airelay' + "/reset_counter",
type: "GET",
async: true,
beforeSend: function (xmlHttp) {
xmlHttp.setRequestHeader("If-Modified-Since", "0");
xmlHttp.setRequestHeader("Cache-Control", "no-cache");
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
},
success: function (retdata) {
//var jsonbuf = JSON.parse('{ "name":"John", "age":30, "city":"New York"}');
},
error: function (retdata) {
console.warn(retdata);
}
});
}
function func_getEnablePTZ() {
$.ajax({
url: '/airelay' + "/get_enable_ptz",
type: "GET",
async: true,
beforeSend: function (xmlHttp) {
xmlHttp.setRequestHeader("If-Modified-Since", "0");
xmlHttp.setRequestHeader("Cache-Control", "no-cache");
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
},
success: function (retdata) {
//var jsonbuf = JSON.parse('{ "name":"John", "age":30, "city":"New York"}');
var jsonbuf = JSON.parse(retdata);
//$('#license_status_2').val(jsonbuf["jstr1"]);
//$('#enable_anpr').prop("checked", true);
enable_PTZ = jsonbuf["enable_PTZ"];
// enable_PTZ = "Yes"; // 08-24 暫時 hard code 才能在一般 IPCAM 模擬 HQ 機器上的問題
{
func_getPostEventName();
}
},
error: function (retdata) {
setTimeout(func_getEnablePTZ(), 3000);
console.warn(retdata);
}
});
}
function validatingJSON(json) {
var checkedjson;
try {
checkedjson = JSON.parse(json); //JSON parse only for try catch
//console.log("json OK");
//console.log(json);
} catch (e) {
checkedjson = null;
console.log(e);//the character would be drop sometimes, for example the label "class_id" may be "clas_id".
//console.log(json);
}
return checkedjson;
}
function func_getAlarmData() {
$.ajax({
url: '/airelay' + "/getconfigfile?ch=all",
type: "GET",
async: true,
beforeSend: function (xmlHttp) {
xmlHttp.setRequestHeader("If-Modified-Since", "0");
xmlHttp.setRequestHeader("Cache-Control", "no-cache");
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
},
success: function (retdata) {
//var jsonbuf = JSON.parse('{ "name":"John", "age":30, "city":"New York"}');
var jsonbuf = validatingJSON(retdata);
if (jsonbuf != null) {
enable_cloud = jsonbuf["system_setting"]["enable_cloud"];
obj_max_proportion = jsonbuf["view_setting"]["camera01"]["obj_max_proportion"];
obj_min_proportion = jsonbuf["view_setting"]["camera01"]["obj_min_proportion"];
enable_traffic = jsonbuf["view_setting"]["camera01"]["enable_traffic"];
enable_unknown_object = jsonbuf["view_setting"]["camera01"]["enable_unknown_object"];
enable_track = jsonbuf["view_setting"]["camera01"]["enable_track"];
confidence_traffic = jsonbuf["view_setting"]["camera01"]["confidence2"];
tab_view_size = jsonbuf["view_setting"]["camera01"]["tab_view_size"].split("x");
tab_view_size[0] = parseInt(tab_view_size[0], 10);
tab_view_size[1] = parseInt(tab_view_size[1], 10);
count_zone = jsonbuf["view_setting"]["camera01"]["count_zone"];
localStorage.setItem('count_zone', count_zone);
red_light_zone = jsonbuf["view_setting"]["camera01"]["red_light_zone"];
var temp_tof_enable_show_distance = 0;
var temp_tof_enable_show_height = 0;
for (var i = 0; i < MAX_DETECTION_ZONE; i++) {
if ((localStorage.getItem("03AI") == "Yes" || localStorage.getItem("Third_party") == "Yes")) {
parking_space[i] = jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["parking_space"];
parking_line[i] = jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["parking_line"];
}
else {
parking_space[i] = "0";
parking_line[i] = "0";
}
enable_ivs_zone[i] = jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["enable_ivs_zone"];
no_parking_time[i] = jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["no_parking_time"];
no_parking_time_in_minute[i] = jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["no_parking_time_in_minute"];
metadata1[i] = jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["metadata1"].replace(/\s/g, '');
enable_direction[i] = jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["enable_direction1"];
func_set_direction(parseInt(jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["direction1"], 10), i);
queuing_count[i] = jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["queuing_count"];
metadata_stop[i] = jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["metadata_stop"];
obj_max_proportion_in_zone[i] = jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["obj_max_proportion_in_zone"];
obj_min_proportion_in_zone[i] = jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["obj_min_proportion_in_zone"];
for (var j = 0; j < MAX_SIZE_POINTS; j++) {
points_x_config[i][j] = jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["x" + (j + 1).toString()];
points_y_config[i][j] = jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["y" + (j + 1).toString()];
}
for (var j = 0; j < MAX_SIZE_IDC_LIST_TRIGGER_EVENTS; j++) {
checked_trigger_events[i][j] = jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["trigger_events"][j]["checked"];
checked_post_event_name[i][j] = jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["trigger_events"][j]["post_event_name"];
if (j == 21 && checked_trigger_events[i][j] == 1) {
temp_tof_enable_show_distance = 1;
}
else if (j == 22 && checked_trigger_events[i][j] == 1) {
temp_tof_enable_show_height = 1;
}
if (jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["trigger_events"][j]["counter_name"].length <= 0)
selected_counter_name[i][j] = "NULL";
else
selected_counter_name[i][j] = jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["trigger_events"][j]["counter_name"];
if (jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["trigger_events"][j]["counter_increment"].length <= 0)
selected_counter_increment[i][j] = "NULL";
else
selected_counter_increment[i][j] = jsonbuf["view_setting"]["camera01"]["detection_zone"][i]["trigger_events"][j]["counter_increment"];
}
}
g_tof_enable_show_distance = temp_tof_enable_show_distance;
g_tof_enable_show_height = temp_tof_enable_show_height;
createCanvasTrafficLight_alarm([{
x: Math.round(points_x_config[0][0] * image_width / tab_view_size[0]), y: Math.round(points_y_config[0][0] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[0][1] * image_width / tab_view_size[0]), y: Math.round(points_y_config[0][1] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[0][2] * image_width / tab_view_size[0]), y: Math.round(points_y_config[0][2] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[0][3] * image_width / tab_view_size[0]), y: Math.round(points_y_config[0][3] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[0][4] * image_width / tab_view_size[0]), y: Math.round(points_y_config[0][4] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[0][5] * image_width / tab_view_size[0]), y: Math.round(points_y_config[0][5] * image_height / tab_view_size[1])
}],
[{
x: Math.round(points_x_config[1][0] * image_width / tab_view_size[0]), y: Math.round(points_y_config[1][0] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[1][1] * image_width / tab_view_size[0]), y: Math.round(points_y_config[1][1] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[1][2] * image_width / tab_view_size[0]), y: Math.round(points_y_config[1][2] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[1][3] * image_width / tab_view_size[0]), y: Math.round(points_y_config[1][3] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[1][4] * image_width / tab_view_size[0]), y: Math.round(points_y_config[1][4] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[1][5] * image_width / tab_view_size[0]), y: Math.round(points_y_config[1][5] * image_height / tab_view_size[1])
}],
[{
x: Math.round(points_x_config[2][0] * image_width / tab_view_size[0]), y: Math.round(points_y_config[2][0] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[2][1] * image_width / tab_view_size[0]), y: Math.round(points_y_config[2][1] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[2][2] * image_width / tab_view_size[0]), y: Math.round(points_y_config[2][2] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[2][3] * image_width / tab_view_size[0]), y: Math.round(points_y_config[2][3] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[2][4] * image_width / tab_view_size[0]), y: Math.round(points_y_config[2][4] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[2][5] * image_width / tab_view_size[0]), y: Math.round(points_y_config[2][5] * image_height / tab_view_size[1])
}],
[{
x: Math.round(points_x_config[3][0] * image_width / tab_view_size[0]), y: Math.round(points_y_config[3][0] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[3][1] * image_width / tab_view_size[0]), y: Math.round(points_y_config[3][1] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[3][2] * image_width / tab_view_size[0]), y: Math.round(points_y_config[3][2] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[3][3] * image_width / tab_view_size[0]), y: Math.round(points_y_config[3][3] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[3][4] * image_width / tab_view_size[0]), y: Math.round(points_y_config[3][4] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[3][5] * image_width / tab_view_size[0]), y: Math.round(points_y_config[3][5] * image_height / tab_view_size[1])
}],
[{
x: Math.round(points_x_config[4][0] * image_width / tab_view_size[0]), y: Math.round(points_y_config[4][0] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[4][1] * image_width / tab_view_size[0]), y: Math.round(points_y_config[4][1] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[4][2] * image_width / tab_view_size[0]), y: Math.round(points_y_config[4][2] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[4][3] * image_width / tab_view_size[0]), y: Math.round(points_y_config[4][3] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[4][4] * image_width / tab_view_size[0]), y: Math.round(points_y_config[4][4] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[4][5] * image_width / tab_view_size[0]), y: Math.round(points_y_config[4][5] * image_height / tab_view_size[1])
}],
[{
x: Math.round(points_x_config[5][0] * image_width / tab_view_size[0]), y: Math.round(points_y_config[5][0] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[5][1] * image_width / tab_view_size[0]), y: Math.round(points_y_config[5][1] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[5][2] * image_width / tab_view_size[0]), y: Math.round(points_y_config[5][2] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[5][3] * image_width / tab_view_size[0]), y: Math.round(points_y_config[5][3] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[5][4] * image_width / tab_view_size[0]), y: Math.round(points_y_config[5][4] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[5][5] * image_width / tab_view_size[0]), y: Math.round(points_y_config[5][5] * image_height / tab_view_size[1])
}],
[{
x: Math.round(points_x_config[6][0] * image_width / tab_view_size[0]), y: Math.round(points_y_config[6][0] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[6][1] * image_width / tab_view_size[0]), y: Math.round(points_y_config[6][1] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[6][2] * image_width / tab_view_size[0]), y: Math.round(points_y_config[6][2] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[6][3] * image_width / tab_view_size[0]), y: Math.round(points_y_config[6][3] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[6][4] * image_width / tab_view_size[0]), y: Math.round(points_y_config[6][4] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[6][5] * image_width / tab_view_size[0]), y: Math.round(points_y_config[6][5] * image_height / tab_view_size[1])
}],
[{
x: Math.round(points_x_config[7][0] * image_width / tab_view_size[0]), y: Math.round(points_y_config[7][0] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[7][1] * image_width / tab_view_size[0]), y: Math.round(points_y_config[7][1] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[7][2] * image_width / tab_view_size[0]), y: Math.round(points_y_config[7][2] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[7][3] * image_width / tab_view_size[0]), y: Math.round(points_y_config[7][3] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[7][4] * image_width / tab_view_size[0]), y: Math.round(points_y_config[7][4] * image_height / tab_view_size[1])
}, {
x: Math.round(points_x_config[7][5] * image_width / tab_view_size[0]), y: Math.round(points_y_config[7][5] * image_height / tab_view_size[1])
}]);
createCanvasTrafficLight();
func_showAlarmData();
enable_detection_zone_button();
change_color_of_button_zone();
set_g_zone_id_and_arrow();
func_listen_to_enable_or_disable_show_direction();
func_get_only_show_metadata1_cookie();
change_color_of_button_cold();
{
if (current_trigger[get_current_index_zone()] != 4 &&
current_trigger[get_current_index_zone()] != 15 &&
current_trigger[get_current_index_zone()] != 16 &&
current_trigger[get_current_index_zone()] != 17 &&
current_trigger[get_current_index_zone()] != 18 &&
current_trigger[get_current_index_zone()] != 19 &&
red_light_zone != get_current_index_zone().toString()) {
func_hide_or_show_direction_attr(0, current_trigger[get_current_index_zone()]);
}
else {
func_hide_or_show_direction_attr(1, current_trigger[get_current_index_zone()]);
}
}
$('input.TRIGGER_EVENTS_ALARM').on('change', function () {
$('input.TRIGGER_EVENTS_ALARM').not(this).prop('checked', false);
for (var i = 0; i < MAX_SIZE_IDC_LIST_TRIGGER_EVENTS; i++) {
if ($(this).attr('id') === IDC_LIST_TRIGGER_EVENTS[i]) {
current_trigger[get_current_index_zone()] = i;
func_hide_or_show_direction_attr(1, i);
break;
}
}
if (current_trigger[get_current_index_zone()] != 4 &&
current_trigger[get_current_index_zone()] != 15 &&
current_trigger[get_current_index_zone()] != 16 &&
current_trigger[get_current_index_zone()] != 17 &&
current_trigger[get_current_index_zone()] != 18 &&
current_trigger[get_current_index_zone()] != 19 &&
red_light_zone != get_current_index_zone().toString()) {
func_hide_or_show_direction_attr(0, current_trigger[get_current_index_zone()]);
}
//if (red_light_zone != get_current_index_zone().toString())
{
func_get_postlist(get_current_index_zone(), current_trigger[get_current_index_zone()]);
func_listen_to_enable_or_disable_show_direction();
$("#select_counter").val(selected_counter_name[get_current_index_zone()][current_trigger[get_current_index_zone()]]);
$("#select_counter_increment").val(selected_counter_increment[get_current_index_zone()][current_trigger[get_current_index_zone()]]);
func_set_zone_data();
}
});
$('input.POST_EVENTS_ALARM').on('change', function () {
func_set_zone_data();
});
$('input.CLASS_META_LIST').on('change', function () {
func_get_list_check_select();
});
update_canvas();
// 08-14
// 用 Current zone 確認 trigger index,避免 polygon 初始化問題
var current_trigger_index = checked_trigger_events[g_zone_id].indexOf(1);
// console.log(`current_trigger_index: ${current_trigger_index}`);
if (current_trigger_index != 4) {
if (current_dzone === "dzone_1") {
disabelIteraction(canvasTripwire2.getObjects()[0]);
disabelIteraction(canvasTripwire3.getObjects()[0]);
disabelIteraction(canvasTripwire4.getObjects()[0]);
disabelIteraction(canvasTripwire5.getObjects()[0]);
disabelIteraction(canvasTripwire6.getObjects()[0]);
disabelIteraction(canvasTripwire7.getObjects()[0]);
disabelIteraction(canvasTripwire8.getObjects()[0]);
Edit1();
}
else if (current_dzone === "dzone_2") {
disabelIteraction(canvasTripwire1.getObjects()[0]);
disabelIteraction(canvasTripwire3.getObjects()[0]);
disabelIteraction(canvasTripwire4.getObjects()[0]);
disabelIteraction(canvasTripwire5.getObjects()[0]);
disabelIteraction(canvasTripwire6.getObjects()[0]);
disabelIteraction(canvasTripwire7.getObjects()[0]);
disabelIteraction(canvasTripwire8.getObjects()[0]);
Edit2();
}
else if (current_dzone === "dzone_3") {
disabelIteraction(canvasTripwire1.getObjects()[0]);
disabelIteraction(canvasTripwire2.getObjects()[0]);
disabelIteraction(canvasTripwire4.getObjects()[0]);
disabelIteraction(canvasTripwire5.getObjects()[0]);
disabelIteraction(canvasTripwire6.getObjects()[0]);
disabelIteraction(canvasTripwire7.getObjects()[0]);
disabelIteraction(canvasTripwire8.getObjects()[0]);
Edit3();
}
else if (current_dzone === "dzone_4"){
disabelIteraction(canvasTripwire1.getObjects()[0]);
disabelIteraction(canvasTripwire2.getObjects()[0]);
disabelIteraction(canvasTripwire3.getObjects()[0]);
disabelIteraction(canvasTripwire5.getObjects()[0]);
disabelIteraction(canvasTripwire6.getObjects()[0]);
disabelIteraction(canvasTripwire7.getObjects()[0]);
disabelIteraction(canvasTripwire8.getObjects()[0]);
Edit4();
}
else if (current_dzone === "dzone_5") {
disabelIteraction(canvasTripwire1.getObjects()[0]);
disabelIteraction(canvasTripwire2.getObjects()[0]);
disabelIteraction(canvasTripwire3.getObjects()[0]);
disabelIteraction(canvasTripwire4.getObjects()[0]);
disabelIteraction(canvasTripwire6.getObjects()[0]);
disabelIteraction(canvasTripwire7.getObjects()[0]);
disabelIteraction(canvasTripwire8.getObjects()[0]);
Edit5();
}
else if (current_dzone === "dzone_6") {
disabelIteraction(canvasTripwire1.getObjects()[0]);
disabelIteraction(canvasTripwire2.getObjects()[0]);
disabelIteraction(canvasTripwire3.getObjects()[0]);
disabelIteraction(canvasTripwire4.getObjects()[0]);
disabelIteraction(canvasTripwire5.getObjects()[0]);
disabelIteraction(canvasTripwire7.getObjects()[0]);
disabelIteraction(canvasTripwire8.getObjects()[0]);
Edit6();
}
else if (current_dzone === "dzone_7") {
disabelIteraction(canvasTripwire1.getObjects()[0]);
disabelIteraction(canvasTripwire2.getObjects()[0]);
disabelIteraction(canvasTripwire3.getObjects()[0]);
disabelIteraction(canvasTripwire4.getObjects()[0]);
disabelIteraction(canvasTripwire5.getObjects()[0]);
disabelIteraction(canvasTripwire6.getObjects()[0]);
disabelIteraction(canvasTripwire8.getObjects()[0]);
Edit7();
}
else{
disabelIteraction(canvasTripwire1.getObjects()[0]);
disabelIteraction(canvasTripwire2.getObjects()[0]);
disabelIteraction(canvasTripwire3.getObjects()[0]);
disabelIteraction(canvasTripwire4.getObjects()[0]);
disabelIteraction(canvasTripwire5.getObjects()[0]);
disabelIteraction(canvasTripwire6.getObjects()[0]);
disabelIteraction(canvasTripwire7.getObjects()[0]);
Edit8();
}
}
func_getbar();
show_tof_map();
// 08-29
var innerIframe = window.parent.document.querySelector("#innerIframe");
if (innerIframe) {
var iframeDocument = innerIframe.contentDocument || innerIframe.contentWindow.document;
var initIframeHeight = localStorage.getItem('iframeHeight');
var innerIframeHeight = iframeDocument.documentElement.clientHeight;
if (innerIframeHeight > 0 && initIframeHeight != null) { // 一般網速初始化夠快時,外層尚未設定,就會是 0
// 網路速度過慢的時候,CSS 或 欄位內容 載入較慢,會影響 iframe 高度
if (parseInt(initIframeHeight) < innerIframeHeight) {
var resetInnerIframeHeight = parseInt(initIframeHeight * 1.05);
// console.log("reset innerIframe.height: ", resetInnerIframeHeight);
innerIframe.height = resetInnerIframeHeight;
}
}
}
}
//console.info(retdata);
},
error: function (retdata) {
setTimeout(func_getAlarmData(),3000);
console.warn(retdata);
}
});
}
function func_getbar() {
if (enable_unknown_object == "Yes") {
$.ajax({
url: '/airelay' + "/getbar",
type: "GET",
async: true,
beforeSend: function (xmlHttp) {
xmlHttp.setRequestHeader("If-Modified-Since", "0");
xmlHttp.setRequestHeader("Cache-Control", "no-cache");
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
},
success: function (retdata) {
//console.info(retdata);
//
if (retdata == "0") {
document.getElementById("bar_circle").style.fill = "green";
}
else if (retdata == "-1") {
document.getElementById("bar_circle").style.fill = "yellow";
}
else {
console.log("getbar:" + retdata);
document.getElementById("bar_circle").style.fill = "red";
}
},
error: function (retdata) {
console.warn(retdata);
document.getElementById("bar_circle").style.fill = "blue";
}
});
}
else {
document.getElementById("bar_circle").style.fill = "#BABABA";
}
}
function func_set_only_show_metadata1_on() {
$.ajax({
url: '/airelay' + "/set_only_show_metadata1_on",
type: "GET",
async: true,
beforeSend: function (xmlHttp) {
xmlHttp.setRequestHeader("If-Modified-Since", "0");
xmlHttp.setRequestHeader("Cache-Control", "no-cache");
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
},
success: function (retdata) {
//var jsonbuf = JSON.parse('{ "name":"John", "age":30, "city":"New York"}');
var jsonbuf = JSON.parse(retdata);
//console.info(retdata);
},
error: function (retdata) {
console.warn(retdata);
}
});
}
function func_set_only_show_metadata1_off() {
$.ajax({
url: '/airelay' + "/set_only_show_metadata1_off",
type: "GET",
async: true,
beforeSend: function (xmlHttp) {
xmlHttp.setRequestHeader("If-Modified-Since", "0");
xmlHttp.setRequestHeader("Cache-Control", "no-cache");
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
},
success: function (retdata) {
//var jsonbuf = JSON.parse('{ "name":"John", "age":30, "city":"New York"}');
var jsonbuf = JSON.parse(retdata);
//console.info(retdata);
},
error: function (retdata) {
console.warn(retdata);
}
});
}
function closethis() {
if (alert(message_alert)) {
}
}
function waitSeconds(iMilliSeconds) {
var counter = 0
, start = new Date().getTime()
, end = 0;
while (counter < iMilliSeconds) {
end = new Date().getTime();
counter = end - start;
}
}
function func_set_enable_track() {
//if (lock_IDOK == 1) {
//alert(IDC_STATIC_SHOW_ALL_ALERT);
//}
//else {
k_index = 0;
makeProgress_track();
//}
}
function func_setAlarmZone() {
if (lock_IDOK == 1) {
alert(IDC_STATIC_SHOW_ALL_ALERT);
}
else {
k_index = 0;
makeProgress_zone();
}
}
function func_setAlarmData() {
if (lock_IDOK == 1) {
alert(IDC_STATIC_SHOW_ALL_ALERT);
}
else {
k_index = 0;
makeProgress();
}
}
function func_setCounterData() {
if (lock_IDOK == 1) {
alert(IDC_STATIC_SHOW_ALL_ALERT);
}
else {
k_index = 0;
makeProgress_counter();
}
}
function func_setelement_system_setting(name_, value_) {
$.ajax({
url: '/airelay' + "/setconfig?ch=system_setting&" + name_ + "=" + value_,
method: "GET",
async: true,
beforeSend: function (xmlHttp) {
xmlHttp.setRequestHeader("If-Modified-Since", "0");
xmlHttp.setRequestHeader("Cache-Control", "no-cache");
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
},
success: function () {
//console.info();
},
error: function () {
console.warn();
}
});
return false;
}
function func_seteventsfile(json_data) {
$.ajax({
url: '/airelay' + "/seteventsfile",
method: "POST",
async: false,
data: json_data,
contentType: false,
processData: false,
beforeSend: function (xmlHttp) {
xmlHttp.setRequestHeader("If-Modified-Since", "0");
xmlHttp.setRequestHeader("Cache-Control", "no-cache");
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
},
success: function () {
//console.info();
},
error: function () {
console.warn();
k_index++;
if (k_index <= 94) {
waitSeconds(500);
func_seteventsfile(json_data);
}
}
});
return false;
}
// function func_setconfigfile(json_data) {
// $.ajax({
// url: '/airelay' + "/setconfigfile",
// method: "POST",
// async: false,
// data: json_data,
// contentType: false,
// processData: false,
// beforeSend: function (xmlHttp) {
// xmlHttp.setRequestHeader("If-Modified-Since", "0");
// xmlHttp.setRequestHeader("Cache-Control", "no-cache");
// //xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
// },
// success: function () {
// //console.info();
// },
// error: function () {
// console.warn();
// k_index++;
// if (k_index <= 94) {
// waitSeconds(500);
// func_setconfigfile(json_data);
// }
// }
// });
// return false;
// }
function func_run_osd_server() {
$.ajax({
url: '/airelay' + "/run_osd_server",
method: "GET",
async: true,
beforeSend: function (xmlHttp) {
xmlHttp.setRequestHeader("If-Modified-Since", "0");
xmlHttp.setRequestHeader("Cache-Control", "no-cache");
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
},
success: function () {
//console.info();
},
error: function () {
console.warn();
}
});
return false;
}
function func_setelement(name_, value_) {
$.ajax({
url: '/airelay' + "/setconfig?ch=1&" + name_ + "=" + value_,
method: "GET",
async: true,
beforeSend: function (xmlHttp) {
xmlHttp.setRequestHeader("If-Modified-Since", "0");
xmlHttp.setRequestHeader("Cache-Control", "no-cache");
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
},
success: function () {
//console.info();
},
error: function () {
console.warn();
}
});
return false;
}
function func_setelement_detection_zone(name_, value_, zone_) {
$.ajax({
url: '/airelay' + "/setconfig?ch=1&detection_zone=" + zone_ + "&" + name_ + "=" + value_,
method: "GET",
async: true,
beforeSend: function (xmlHttp) {
xmlHttp.setRequestHeader("If-Modified-Since", "0");
xmlHttp.setRequestHeader("Cache-Control", "no-cache");
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
},
success: function () {
//console.info();
},
error: function () {
console.warn();
}
});
return false;
}
function func_setelement_detection_zone_trigger_events(name_, value_, zone_, trigger_) {
$.ajax({
url: '/airelay' + "/setconfig?ch=1&detection_zone=" + zone_ + "&trigger_events=" + trigger_ + "&" + name_ + "=" + value_,
method: "GET",
async: true,
beforeSend: function (xmlHttp) {
xmlHttp.setRequestHeader("If-Modified-Since", "0");
xmlHttp.setRequestHeader("Cache-Control", "no-cache");
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
},
success: function () {
//console.info();
},
error: function () {
console.warn();
}
});
return false;
}
var count_reload = 0;
function func_getreload() {
$.ajax({
url: '/airelay' + "/getconfig?reload=1",
method: "GET",
async: true,
beforeSend: function (xmlHttp) {
xmlHttp.setRequestHeader("If-Modified-Since", "0");
xmlHttp.setRequestHeader("Cache-Control", "no-cache");
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
},
//data : JSON.stringify(data),
success: function (retdata) {
count_reload++;
if (retdata === "Reload OK.") {
count_reload = 0;
//console.log("Reload OK.");
}
else {
if (count_reload <= 3) {
setTimeout(func_getreload(), 2000);
}
else {
count_reload = 0;
}
}
//console.info();
},
error: function () {
console.warn();
}
});
return false;
}
function func_get_list_check() {
var wanted_meta_data = '';
var array_OK_check = [];
for (var i = 0; i < check_names_array.length; i++) {
if (document.getElementById(check_names_array[i]).checked === true) {
array_OK_check.push(check_names_array[i]);
}
}
for (var i = 0; i < array_OK_check.length; i++) {
if (i < array_OK_check.length - 1) {
wanted_meta_data += (array_OK_check[i] + ",");
}
else if (i === array_OK_check.length - 1) {
wanted_meta_data += array_OK_check[i];
}
}
if (wanted_meta_data.length == 0) {
wanted_meta_data = 'NULL';
}
return wanted_meta_data;
}
function func_get_list_check_select() {
$('#metadata_stop').empty();
$('#metadata_mouse_coldobjects').empty();
var selectElement = document.getElementById('metadata_stop');
selectElement.add(new Option("None", "NULL"));
var selectElement_mouse = document.getElementById('metadata_mouse_coldobjects');
selectElement_mouse.add(new Option(text_ban_zone, "ban_zone"));
//selectElement_mouse.add(new Option("buffer_zone", "buffer_zone"));
var check_if_existing_metadata_stop = 0;
for (var i = 0; i < check_names_array.length; i++) {
if (document.getElementById(check_names_array[i]).checked === true) {
if (localStorage.getItem("license_type").search("arty") >= 1) {
selectElement.add(new Option(check_names_array[i], check_names_array[i]));
selectElement_mouse.add(new Option(check_names_array[i], check_names_array[i]));
}
else {
selectElement.add(new Option(func_translate_name(check_names_array[i]), check_names_array[i]));
selectElement_mouse.add(new Option(func_translate_name(check_names_array[i]), check_names_array[i]));
}
if (check_names_array[i] == metadata_stop[get_current_index_zone()]) {
check_if_existing_metadata_stop = 1;
}
}
}
if (check_if_existing_metadata_stop == 0) {
metadata_stop[get_current_index_zone()] = "NULL";
}
$('#metadata_stop').val(metadata_stop[get_current_index_zone()]);
}
function padLeft(str, len) {
str = '' + str;
return str.length >= len ? str : new Array(len - str.length + 1).join("0") + str;
}
function func_get_list(names) {
var ul = document.getElementById("metaList");
ul.innerHTML = '';
check_names_array = [];
var json_label_names = JSON.parse(LABEL_NAMES);
var json_third_party_label_names = JSON.parse(THIRD_PARTY_LABEL_NAMES);
if (localStorage.getItem("dataset_ver").search("RAFFIC") >= 1) {
check_if_existing_any_metalist = 1;
var data = json_label_names.Tiny_Traffic[0];
for (var key in data) {
if (data.hasOwnProperty(key)) {
if (data[key] != "_s") {
var label_names = data[key];
//do something with myvalue;
var check_the_same = 0;
for (var i = 0; i < check_names_array.length; i++) {
if (check_names_array[i] === label_names)
check_the_same = 1;
}
if (check_the_same == 1)
continue;
if (localStorage.getItem("g_IsHelm_without_car") == "Yes") {
if (label_names != "person")
continue;
}
if (localStorage.getItem("soft_ver").search("mod004") >= 1) {
if (label_names == "tuktuk" ||
label_names == "trailer" ||
label_names == "pickup" ||
label_names == "fire_engine" ||
label_names == "van" ||
label_names == "bulldozer" ||
label_names == "forklift" ||
label_names == "excavator" ||
label_names == "tanker")
continue;
}
else {
if (label_names == "boat")
continue;
}
if (localStorage.getItem("events_default_version") != null && localStorage.getItem("events_default_version") == "4") {
if (label_names == "car" || label_names == "person") {
}
else {
continue;
}
}
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', label_names);
answer.setAttribute('class', 'CLASS_META_LIST');
check_names_array.push(label_names);
var checked_built = 0;
for (var i = 0; i < names.length; i++) {
if (label_names === names[i]) {
answer.setAttribute('checked', 'true');
checked_built = 1;
break;
}
}
if (checked_built === 1) {
answer.setAttribute('checked', 'false');
}
//answer.setAttribute('id', 'answer');
//answer.setAttribute('value', 'a');
li.appendChild(answer);
li.appendChild(document.createTextNode(func_translate_name(label_names)));
ul.appendChild(li);
}
}
}
}
if (localStorage.getItem("dataset_ver").search("IFIRE") >= 1) {
check_if_existing_any_metalist = 1;
var data = json_label_names.AIFIRE[0];
for (var key in data) {
if (data.hasOwnProperty(key)) {
if (data[key] != "_s") {
var label_names = data[key];
//do something with myvalue;
var check_the_same = 0;
for (var i = 0; i < check_names_array.length; i++) {
if (check_names_array[i] === label_names)
check_the_same = 1;
}
if (check_the_same == 1)
continue;
if (enable_cloud == "No" && (label_names == "smog" || label_names == "snow")) {
continue;
}
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', label_names);
answer.setAttribute('class', 'CLASS_META_LIST');
check_names_array.push(label_names);
var checked_built = 0;
for (var i = 0; i < names.length; i++) {
if (label_names === names[i]) {
answer.setAttribute('checked', 'true');
checked_built = 1;
break;
}
}
if (checked_built === 1) {
answer.setAttribute('checked', 'false');
}
//answer.setAttribute('id', 'answer');
//answer.setAttribute('value', 'a');
li.appendChild(answer);
li.appendChild(document.createTextNode(func_translate_name(label_names)));
ul.appendChild(li);
}
}
}
}
if (localStorage.getItem("dataset_ver").search("IAERO") >= 1) {
check_if_existing_any_metalist = 1;
var data = json_label_names.AIAERO[0];
for (var key in data) {
if (data.hasOwnProperty(key)) {
if (data[key] != "_s") {
var label_names = data[key];
//do something with myvalue;
var check_the_same = 0;
for (var i = 0; i < check_names_array.length; i++) {
if (check_names_array[i] === label_names)
check_the_same = 1;
}
if (check_the_same == 1)
continue;
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', label_names);
answer.setAttribute('class', 'CLASS_META_LIST');
check_names_array.push(label_names);
var checked_built = 0;
for (var i = 0; i < names.length; i++) {
if (label_names === names[i]) {
answer.setAttribute('checked', 'true');
checked_built = 1;
break;
}
}
if (checked_built === 1) {
answer.setAttribute('checked', 'false');
}
//answer.setAttribute('id', 'answer');
//answer.setAttribute('value', 'a');
li.appendChild(answer);
li.appendChild(document.createTextNode(func_translate_name(label_names)));
ul.appendChild(li);
}
}
}
}
if (localStorage.getItem("dataset_ver").search("ITOF") >= 1) {
check_if_existing_any_metalist = 1;
var data = json_label_names.AITOF[0];
for (var key in data) {
if (data.hasOwnProperty(key)) {
if (data[key] != "_s") {
var label_names = data[key];
//do something with myvalue;
var check_the_same = 0;
for (var i = 0; i < check_names_array.length; i++) {
if (check_names_array[i] === label_names)
check_the_same = 1;
}
if (check_the_same == 1)
continue;
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', label_names);
answer.setAttribute('class', 'CLASS_META_LIST');
check_names_array.push(label_names);
var checked_built = 0;
for (var i = 0; i < names.length; i++) {
if (label_names === names[i]) {
answer.setAttribute('checked', 'true');
checked_built = 1;
break;
}
}
if (checked_built === 1) {
answer.setAttribute('checked', 'false');
}
//answer.setAttribute('id', 'answer');
//answer.setAttribute('value', 'a');
li.appendChild(answer);
li.appendChild(document.createTextNode(func_translate_name(label_names)));
ul.appendChild(li);
}
}
}
}
if (localStorage.getItem("dataset_ver").search("UMAN") >= 1) {
check_if_existing_any_metalist = 1;
var data = json_label_names.AIHUMAN[0];
for (var key in data) {
if (data.hasOwnProperty(key)) {
if (data[key] != "_s") {
var label_names = data[key];
//do something with myvalue;
var check_the_same = 0;
for (var i = 0; i < check_names_array.length; i++) {
if (check_names_array[i] === label_names)
check_the_same = 1;
}
if (check_the_same == 1)
continue;
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', label_names);
answer.setAttribute('class', 'CLASS_META_LIST');
check_names_array.push(label_names);
var checked_built = 0;
for (var i = 0; i < names.length; i++) {
if (label_names === names[i]) {
answer.setAttribute('checked', 'true');
checked_built = 1;
break;
}
}
if (checked_built === 1) {
answer.setAttribute('checked', 'false');
}
//answer.setAttribute('id', 'answer');
//answer.setAttribute('value', 'a');
li.appendChild(answer);
li.appendChild(document.createTextNode(func_translate_name(label_names)));
ul.appendChild(li);
}
}
}
}
if (localStorage.getItem("dataset_ver").search("ISAFTY") >= 1) {
check_if_existing_any_metalist = 1;
var data = json_label_names.AISAFETY[0];
for (var key in data) {
if (data.hasOwnProperty(key)) {
if (data[key] != "_s") {
var label_names = data[key];
//do something with myvalue;
var check_the_same = 0;
for (var i = 0; i < check_names_array.length; i++) {
if (check_names_array[i] === label_names)
check_the_same = 1;
}
if (check_the_same == 1)
continue;
if (enable_cloud == "No" && (label_names == "stroller" || label_names == "robber_mask" || label_names == "backpack" || label_names == "handbag" || label_names == "suitcase"
|| label_names == "coat_shirt" || label_names == "shorts" || label_names == "dress_skirt" || label_names == "trousers" || label_names == "golf_cart"
|| label_names == "knife" || label_names == "glasses" || label_names == "gun")) {
continue;
}
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', label_names);
answer.setAttribute('class', 'CLASS_META_LIST');
check_names_array.push(label_names);
var checked_built = 0;
for (var i = 0; i < names.length; i++) {
if (label_names === names[i]) {
answer.setAttribute('checked', 'true');
checked_built = 1;
break;
}
}
if (checked_built === 1) {
answer.setAttribute('checked', 'false');
}
//answer.setAttribute('id', 'answer');
//answer.setAttribute('value', 'a');
li.appendChild(answer);
li.appendChild(document.createTextNode(func_translate_name(label_names)));
ul.appendChild(li);
}
}
}
}
if (localStorage.getItem("dataset_ver").search("IPRODUCTION") >= 1) {
check_if_existing_any_metalist = 1;
var data = json_label_names.AIPRODUCTION[0];
for (var key in data) {
if (data.hasOwnProperty(key)) {
if (data[key] != "_s") {
var label_names = data[key];
//do something with myvalue;
var check_the_same = 0;
for (var i = 0; i < check_names_array.length; i++) {
if (check_names_array[i] === label_names)
check_the_same = 1;
}
if (check_the_same == 1)
continue;
if (enable_cloud == "No" && (label_names == "camera" || label_names == "nvr")) {
continue;
}
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', label_names);
answer.setAttribute('class', 'CLASS_META_LIST');
check_names_array.push(label_names);
var checked_built = 0;
for (var i = 0; i < names.length; i++) {
if (label_names === names[i]) {
answer.setAttribute('checked', 'true');
checked_built = 1;
break;
}
}
if (checked_built === 1) {
answer.setAttribute('checked', 'false');
}
//answer.setAttribute('id', 'answer');
//answer.setAttribute('value', 'a');
li.appendChild(answer);
li.appendChild(document.createTextNode(func_translate_name(label_names)));
ul.appendChild(li);
}
}
}
}
if (localStorage.getItem("dataset_ver").search("ISHIP") >= 1) {
check_if_existing_any_metalist = 1;
var data = json_label_names.AISHIP[0];
for (var key in data) {
if (data.hasOwnProperty(key)) {
if (data[key] != "_s") {
var label_names = data[key];
//do something with myvalue;
var check_the_same = 0;
for (var i = 0; i < check_names_array.length; i++) {
if (check_names_array[i] === label_names)
check_the_same = 1;
}
if (check_the_same == 1)
continue;
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', label_names);
answer.setAttribute('class', 'CLASS_META_LIST');
check_names_array.push(label_names);
var checked_built = 0;
for (var i = 0; i < names.length; i++) {
if (label_names === names[i]) {
answer.setAttribute('checked', 'true');
checked_built = 1;
break;
}
}
if (checked_built === 1) {
answer.setAttribute('checked', 'false');
}
//answer.setAttribute('id', 'answer');
//answer.setAttribute('value', 'a');
li.appendChild(answer);
li.appendChild(document.createTextNode(func_translate_name(label_names)));
ul.appendChild(li);
}
}
}
}
if (localStorage.getItem("license_type").search("LPR") >= 1) {
check_if_existing_any_metalist = 1;
var data = json_label_names.AIANPR[0];
for (var key in data) {
if (data.hasOwnProperty(key)) {
if (data[key] != "_s") {
var label_names = data[key];
//do something with myvalue;
var check_the_same = 0;
for (var i = 0; i < check_names_array.length; i++) {
if (check_names_array[i] === label_names)
check_the_same = 1;
}
if (check_the_same == 1)
continue;
if (enable_cloud == "No" && (label_names == "stop_sign")) {
continue;
}
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', label_names);
answer.setAttribute('class', 'CLASS_META_LIST');
check_names_array.push(label_names);
var checked_built = 0;
for (var i = 0; i < names.length; i++) {
if (label_names === names[i]) {
answer.setAttribute('checked', 'true');
checked_built = 1;
break;
}
}
if (checked_built === 1) {
answer.setAttribute('checked', 'false');
}
//answer.setAttribute('id', 'answer');
//answer.setAttribute('value', 'a');
li.appendChild(answer);
li.appendChild(document.createTextNode(func_translate_name(label_names)));
ul.appendChild(li);
}
}
}
}
if (localStorage.getItem("dataset_ver").search("IAML") >= 1) {
check_if_existing_any_metalist = 1;
var data = json_label_names.AIAML[0];
for (var key in data) {
if (data.hasOwnProperty(key)) {
if (data[key] != "_s") {
var label_names = data[key];
//do something with myvalue;
var check_the_same = 0;
for (var i = 0; i < check_names_array.length; i++) {
if (check_names_array[i] === label_names)
check_the_same = 1;
}
if (check_the_same == 1)
continue;
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', label_names);
answer.setAttribute('class', 'CLASS_META_LIST');
check_names_array.push(label_names);
var checked_built = 0;
for (var i = 0; i < names.length; i++) {
if (label_names === names[i]) {
answer.setAttribute('checked', 'true');
checked_built = 1;
break;
}
}
if (checked_built === 1) {
answer.setAttribute('checked', 'false');
}
//answer.setAttribute('id', 'answer');
//answer.setAttribute('value', 'a');
li.appendChild(answer);
li.appendChild(document.createTextNode(func_translate_name(label_names)));
ul.appendChild(li);
}
}
}
}
if (localStorage.getItem("dataset_ver").search("IFRONTBACK") >= 1) {
check_if_existing_any_metalist = 1;
var data = json_label_names.AIFRONTBACK[0];
for (var key in data) {
if (data.hasOwnProperty(key)) {
if (data[key] != "_s") {
var label_names = data[key];
//do something with myvalue;
var check_the_same = 0;
for (var i = 0; i < check_names_array.length; i++) {
if (check_names_array[i] === label_names)
check_the_same = 1;
}
if (check_the_same == 1)
continue;
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', label_names);
answer.setAttribute('class', 'CLASS_META_LIST');
check_names_array.push(label_names);
var checked_built = 0;
for (var i = 0; i < names.length; i++) {
if (label_names === names[i]) {
answer.setAttribute('checked', 'true');
checked_built = 1;
break;
}
}
if (checked_built === 1) {
answer.setAttribute('checked', 'false');
}
//answer.setAttribute('id', 'answer');
//answer.setAttribute('value', 'a');
li.appendChild(answer);
li.appendChild(document.createTextNode(func_translate_name(label_names)));
ul.appendChild(li);
}
}
}
}
if (localStorage.getItem("license_type").search("arty") >= 1) {
check_if_existing_any_metalist = 1;
var data = json_third_party_label_names.THIRD_PARTY[0];
for (var key in data) {
if (data.hasOwnProperty(key)) {
if (data[key] != "_s") {
var label_names = data[key];
//do something with myvalue;
var check_the_same = 0;
for (var i = 0; i < check_names_array.length; i++) {
if (check_names_array[i] === label_names)
check_the_same = 1;
}
if (check_the_same == 1)
continue;
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', label_names);
answer.setAttribute('class', 'CLASS_META_LIST');
check_names_array.push(label_names);
var checked_built = 0;
for (var i = 0; i < names.length; i++) {
if (label_names === names[i]) {
answer.setAttribute('checked', 'true');
checked_built = 1;
break;
}
}
if (checked_built === 1) {
answer.setAttribute('checked', 'false');
}
//answer.setAttribute('id', 'answer');
//answer.setAttribute('value', 'a');
li.appendChild(answer);
li.appendChild(document.createTextNode(label_names));
ul.appendChild(li);
}
}
}
}
// Ken 2021-10-13
if (localStorage.getItem("license_type").search("Radar") >= 1) {
check_if_existing_any_metalist = 1;
var data = json_label_names.AIRADAR[0];
for (var key in data) {
if (data.hasOwnProperty(key)) {
if (data[key] != "_s") {
var label_names = data[key];
//do something with myvalue;
var check_the_same = 0;
for (var i = 0; i < check_names_array.length; i++) {
if (check_names_array[i] === label_names)
check_the_same = 1;
}
if (check_the_same == 1)
continue;
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', label_names);
answer.setAttribute('class', 'CLASS_META_LIST');
check_names_array.push(label_names);
var checked_built = 0;
for (var i = 0; i < names.length; i++) {
if (label_names === names[i]) {
answer.setAttribute('checked', 'true');
checked_built = 1;
break;
}
}
if (checked_built === 1) {
answer.setAttribute('checked', 'false');
}
//answer.setAttribute('id', 'answer');
//answer.setAttribute('value', 'a');
li.appendChild(answer);
li.appendChild(document.createTextNode(label_names));
ul.appendChild(li);
}
}
}
}
if (localStorage.getItem("license_type").search("ERAIL") >= 0) {
check_if_existing_any_metalist = 1;
var data = json_label_names.AIRAILWAY[0];
for (var key in data) {
if (data.hasOwnProperty(key)) {
if (data[key] != "_s") {
var label_names = data[key];
//do something with myvalue;
var check_the_same = 0;
for (var i = 0; i < check_names_array.length; i++) {
if (check_names_array[i] === label_names)
check_the_same = 1;
}
if (check_the_same == 1)
continue;
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', label_names);
answer.setAttribute('class', 'CLASS_META_LIST');
check_names_array.push(label_names);
var checked_built = 0;
for (var i = 0; i < names.length; i++) {
if (label_names === names[i]) {
answer.setAttribute('checked', 'true');
checked_built = 1;
break;
}
}
if (checked_built === 1) {
answer.setAttribute('checked', 'false');
}
//answer.setAttribute('id', 'answer');
//answer.setAttribute('value', 'a');
li.appendChild(answer);
li.appendChild(document.createTextNode(func_translate_name(label_names)));
ul.appendChild(li);
}
}
}
}
if (localStorage.getItem("license_type").search("ESPORTS") >= 0) {
check_if_existing_any_metalist = 1;
var data = json_label_names.AISPORTS[0];
for (var key in data) {
if (data.hasOwnProperty(key)) {
if (data[key] != "_s") {
var label_names = data[key];
//do something with myvalue;
var check_the_same = 0;
for (var i = 0; i < check_names_array.length; i++) {
if (check_names_array[i] === label_names)
check_the_same = 1;
}
if (check_the_same == 1)
continue;
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', label_names);
answer.setAttribute('class', 'CLASS_META_LIST');
check_names_array.push(label_names);
var checked_built = 0;
for (var i = 0; i < names.length; i++) {
if (label_names === names[i]) {
answer.setAttribute('checked', 'true');
checked_built = 1;
break;
}
}
if (checked_built === 1) {
answer.setAttribute('checked', 'false');
}
//answer.setAttribute('id', 'answer');
//answer.setAttribute('value', 'a');
li.appendChild(answer);
li.appendChild(document.createTextNode(func_translate_name(label_names)));
ul.appendChild(li);
}
}
}
}
if (localStorage.getItem("license_type").search("EGARBAGE") >= 0) {
check_if_existing_any_metalist = 1;
var data = json_label_names.AIGARBAGE[0];
for (var key in data) {
if (data.hasOwnProperty(key)) {
if (data[key] != "_s") {
var label_names = data[key];
//do something with myvalue;
var check_the_same = 0;
for (var i = 0; i < check_names_array.length; i++) {
if (check_names_array[i] === label_names)
check_the_same = 1;
}
if (check_the_same == 1)
continue;
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', label_names);
answer.setAttribute('class', 'CLASS_META_LIST');
check_names_array.push(label_names);
var checked_built = 0;
for (var i = 0; i < names.length; i++) {
if (label_names === names[i]) {
answer.setAttribute('checked', 'true');
checked_built = 1;
break;
}
}
if (checked_built === 1) {
answer.setAttribute('checked', 'false');
}
//answer.setAttribute('id', 'answer');
//answer.setAttribute('value', 'a');
li.appendChild(answer);
li.appendChild(document.createTextNode(func_translate_name(label_names)));
ul.appendChild(li);
}
}
}
}
if (localStorage.getItem("license_type").search("EFACE") >= 0) {
check_if_existing_any_metalist = 1;
var data = json_label_names.AIFACE[0];
for (var key in data) {
if (data.hasOwnProperty(key)) {
if (data[key] != "_s") {
var label_names = data[key];
//do something with myvalue;
var check_the_same = 0;
for (var i = 0; i < check_names_array.length; i++) {
if (check_names_array[i] === label_names)
check_the_same = 1;
}
if (check_the_same == 1)
continue;
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', label_names);
answer.setAttribute('class', 'CLASS_META_LIST');
check_names_array.push(label_names);
var checked_built = 0;
for (var i = 0; i < names.length; i++) {
if (label_names === names[i]) {
answer.setAttribute('checked', 'true');
checked_built = 1;
break;
}
}
if (checked_built === 1) {
answer.setAttribute('checked', 'false');
}
//answer.setAttribute('id', 'answer');
//answer.setAttribute('value', 'a');
li.appendChild(answer);
li.appendChild(document.createTextNode(func_translate_name(label_names)));
ul.appendChild(li);
}
}
}
}
if (localStorage.getItem("license_type").search("EGENDER") >= 0) {
check_if_existing_any_metalist = 1;
var data = json_label_names.AIGENDER[0];
for (var key in data) {
if (data.hasOwnProperty(key)) {
if (data[key] != "_s") {
var label_names = data[key];
//do something with myvalue;
var check_the_same = 0;
for (var i = 0; i < check_names_array.length; i++) {
if (check_names_array[i] === label_names)
check_the_same = 1;
}
if (check_the_same == 1)
continue;
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', label_names);
answer.setAttribute('class', 'CLASS_META_LIST');
check_names_array.push(label_names);
var checked_built = 0;
for (var i = 0; i < names.length; i++) {
if (label_names === names[i]) {
answer.setAttribute('checked', 'true');
checked_built = 1;
break;
}
}
if (checked_built === 1) {
answer.setAttribute('checked', 'false');
}
//answer.setAttribute('id', 'answer');
//answer.setAttribute('value', 'a');
li.appendChild(answer);
li.appendChild(document.createTextNode(func_translate_name(label_names)));
ul.appendChild(li);
}
}
}
}
}
function func_hide_or_show_direction_attr(show_direction_attr, trigger_index) {
if (localStorage.getItem("g_IsHelm_without_car") == "Yes"){
// document.getElementById("group_parking").style.display = "none";
// 08-02 上午會議決定改成常開
document.getElementById("group_parking").style.display = "block";
}
else if (localStorage.getItem("03AI") == "Yes" /*|| localStorage.getItem("g_IsHelm_without_car") == "Yes"*/ || localStorage.getItem("Third_party") == "Yes") {
if (trigger_index != 7) {
// 08-02 上午會議決定改成常開
// document.getElementById("group_parking").style.visibility = "hidden";
document.getElementById("group_parking").style.visibility = "visible";
}
else {
document.getElementById("group_parking").style.visibility = "visible";
}
}
//console.log(trigger_index);
if (trigger_index === 4 || trigger_index === 17 || trigger_index === 18 || trigger_index === 19) {
open_visible_arrow();
if (show_direction_attr === 1) {
document.getElementById("enable_direction").style.visibility = "hidden"; // visible
document.getElementById("IDC_CHECK_ENABLE_DIRECTION").style.visibility = "visible";
document.getElementById("button_rotate").style.visibility = "visible";
Edit_Zone(1);
}
else {
document.getElementById("enable_direction").style.visibility = "hidden";
// tcp tunnel 特例預設開啟 Direction 按鈕
document.getElementById("IDC_CHECK_ENABLE_DIRECTION").style.visibility = "visible";
document.getElementById("button_rotate").style.visibility = "visible";
if (g_first_edit_zone == 1) {
Edit_Zone(0);
}
}
}
else if (trigger_index === 15 || trigger_index == 16 || red_light_zone == get_current_index_zone().toString()) {
hide_visible_arrow();
if (show_direction_attr === 1) {
document.getElementById("enable_direction").style.visibility = "hidden";
// tcp tunnel 特例預設開啟 Direction 按鈕
document.getElementById("IDC_CHECK_ENABLE_DIRECTION").style.visibility = "visible";
document.getElementById("button_rotate").style.visibility = "visible";
Edit_Zone(1);
}
else {
document.getElementById("enable_direction").style.visibility = "hidden";
// tcp tunnel 特例預設開啟 Direction 按鈕
document.getElementById("IDC_CHECK_ENABLE_DIRECTION").style.visibility = "visible";
document.getElementById("button_rotate").style.visibility = "visible";
if (g_first_edit_zone == 1) {
Edit_Zone(0);
}
}
}
else {
document.getElementById("enable_direction").style.visibility = "hidden";
// tcp tunnel 特例預設開啟 Direction 按鈕
document.getElementById("IDC_CHECK_ENABLE_DIRECTION").style.visibility = "visible";
document.getElementById("button_rotate").style.visibility = "visible";
if (g_first_edit_zone == 1) {
Edit_Zone(0);
}
}
}
function func_get_eventslist(index_zone) {
var ul = document.getElementById("eventsList");
ul.innerHTML = '';
check_events_array = [];
for (var i = 0; i < MAX_SIZE_IDC_LIST_TRIGGER_EVENTS; i++) {
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', IDC_LIST_TRIGGER_EVENTS[i]);
answer.setAttribute('class', 'TRIGGER_EVENTS_ALARM');
if (i == 5 || i == 6 || i === 11) {
answer.setAttribute('style', 'visibility:hidden;top:500px;position:absolute;');
}
else if ((i == 17 || i == 18 || i == 19 || i == 20) && enable_cloud != "Yes") {
answer.setAttribute('style', 'visibility:hidden;top:500px;position:absolute;');
}
else if ((i == 21 || i == 22) && localStorage.getItem("ToF_recognition") != "Yes") {
answer.setAttribute('style', 'visibility:hidden;top:500px;position:absolute;');
}
else if ((i == 8 || i == 9 || i == 10 || i == 12 || i == 13 || i == 14 || i == 15 || i == 16) && localStorage.getItem("Face_recognition") == "Yes") {
answer.setAttribute('style', 'visibility:hidden;top:500px;position:absolute;');
}
else if ((i == 2 && localStorage.getItem("06AI") != "Yes") ||
(i == 3 && localStorage.getItem("06AI") != "Yes") ||
(i == 7 && localStorage.getItem("03AI") != "Yes" && localStorage.getItem("Third_party") != "Yes") ||
(i == 9 && localStorage.getItem("06AI") != "Yes")) {
answer.setAttribute('style', 'visibility:hidden;top:500px;position:absolute;');
}
else if ((i == 15 || i == 16) && localStorage.getItem('CheckIsExistingSpeed') != 1) {
answer.setAttribute('style', 'visibility:hidden;top:500px;position:absolute;');
}
check_events_array.push(IDC_LIST_TRIGGER_EVENTS[i]);
if (checked_trigger_events[index_zone][i] == 1) {
answer.setAttribute('checked', 'true');
current_trigger[index_zone] = i;
}
else {
answer.checked = false;
}
li.appendChild(answer);
if (i != 5 && i != 6 && i != 11 &&
!((i == 2 && localStorage.getItem("06AI") != "Yes") ||
(i == 3 && localStorage.getItem("06AI") != "Yes") ||
(i == 7 && localStorage.getItem("03AI") != "Yes" && localStorage.getItem("Third_party") != "Yes") ||
(i == 9 && localStorage.getItem("06AI") != "Yes")) &&
!((i == 17 || i == 18 || i == 19 || i == 20) && enable_cloud != "Yes") &&
!((i == 21 || i == 22) && localStorage.getItem("ToF_recognition") != "Yes")&&
!((i == 8 || i == 9 || i == 10 || i == 12 || i == 13 || i == 14 || i == 15 || i == 16) && localStorage.getItem("Face_recognition") == "Yes") &&
!((i == 15 || i == 16) && localStorage.getItem('CheckIsExistingSpeed') != 1))
li.appendChild(document.createTextNode(IDC_LIST_TRIGGER_EVENTS[i]));
else
li.appendChild(document.createTextNode(""));
ul.appendChild(li);
}
}
function func_get_postlist(index_zone, index_trigger) {
var ul = document.getElementById("postList");
ul.innerHTML = '';
check_post_array = [];
var checked_post_event_nameAry = [];
checked_post_event_nameAry = checked_post_event_name[index_zone][index_trigger].split(',');
for (var i = 0; i < MAX_SIZE_POST; i++) {
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', post_event_name[i]);
answer.setAttribute('class', 'POST_EVENTS_ALARM');
check_post_array.push(post_event_name[i]);
//alert(checked_post_event_name[index_zone][index_trigger]);
//alert(post_event_name[i]);
var answer_checked = 0;
for (var j = 0; j < checked_post_event_nameAry.length; j++) {
if (checked_post_event_nameAry[j] === post_event_name[i]) {
answer_checked = 1;
break;
}
}
if (answer_checked) {
answer.setAttribute('checked', 'true');
}
else {
answer.checked = false;
}
li.appendChild(answer);
li.appendChild(document.createTextNode(post_event_name[i]));
ul.appendChild(li);
}
//if (enable_cloud == "Yes")
{
for (var i = 0; i < MAX_SIZE_SNMP_POST; i++) {
var li = document.createElement('li');
var answer = document.createElement('input');
answer.setAttribute('type', 'checkbox');
answer.setAttribute('id', snmp_event_name[i]);
answer.setAttribute('class', 'POST_EVENTS_ALARM');
check_post_array.push(snmp_event_name[i]);
//alert(checked_post_event_name[index_zone][index_trigger]);
//alert(post_event_name[i]);
var answer_checked = 0;
for (var j = 0; j < checked_post_event_nameAry.length; j++) {
if (checked_post_event_nameAry[j] === snmp_event_name[i]) {
answer_checked = 1;
break;
}
}
if (answer_checked) {
answer.setAttribute('checked', 'true');
}
else {
answer.checked = false;
}
li.appendChild(answer);
li.appendChild(document.createTextNode(snmp_event_name[i]));
ul.appendChild(li);
}
}
}
function func_get_eventslist_check(index_zone) {
for (var i = 0; i < check_events_array.length; i++) {
if (document.getElementById(check_events_array[i]).checked === true) {
if (red_light_zone == index_zone.toString()) {
//if ((localStorage.getItem("03AI") == "Yes" || localStorage.getItem("Third_party") == "Yes"))
{
parking_space[index_zone] = "0";
parking_line[index_zone] = "0";
}
enable_direction[index_zone] = "No";
checked_trigger_events[index_zone][i] = 0;
document.getElementById(check_events_array[i]).checked = false;
hide_visible_arrow();
enable_show_direction();
document.getElementById("enable_direction").style.visibility = "hidden";
// tcp tunnel 特例預設開啟 Direction 按鈕
document.getElementById("IDC_CHECK_ENABLE_DIRECTION").style.visibility = "visible";
document.getElementById("button_rotate").style.visibility = "visible";
alert("This is red light zone.");
}
else if (//(i == 0 && check_if_existing_any_metalist == 0) ||
//(i == 1 && check_if_existing_any_metalist == 0) ||
(i == 2 && localStorage.getItem("06AI") != "Yes") ||
(i == 3 && localStorage.getItem("06AI") != "Yes") ||
//(i == 4 && check_if_existing_any_metalist == 0) ||
(i == 7 && localStorage.getItem("03AI") != "Yes" && localStorage.getItem("Third_party") != "Yes") ||
(i == 8 && check_if_existing_any_metalist == 0) ||
(i == 9 && localStorage.getItem("06AI") != "Yes") ||
//(i == 15 && check_if_existing_any_metalist == 0) ||
//(i == 16 && check_if_existing_any_metalist == 0) ||
//(i == 17 && check_if_existing_any_metalist == 0) ||
//(i == 18 && check_if_existing_any_metalist == 0) ||
//(i == 19 && check_if_existing_any_metalist == 0) ||
(i == 20 && check_if_existing_any_metalist == 0) ||
(i == 21 && check_if_existing_any_metalist == 0) ||
(i == 22 && check_if_existing_any_metalist == 0)) {
//if ((localStorage.getItem("03AI") == "Yes" || localStorage.getItem("Third_party") == "Yes"))
{
parking_space[index_zone] = "0";
parking_line[index_zone] = "0";
}
enable_direction[index_zone] = "No";
checked_trigger_events[index_zone][i] = 0;
alert(message_alert_wrong_feature);
}
/*
else if (i == 7 && (index_zone >= 1 && index_zone <= 3) && (localStorage.getItem("03AI") == "Yes" || localStorage.getItem("Third_party") == "Yes")) {
enable_direction[index_zone] = "No";
checked_trigger_events[index_zone][i] = 0;
alert(message_alert_wrong_zone_for_missing_object_detection);
}*/
else if (i == 7 && (localStorage.getItem("03AI") == "Yes" || localStorage.getItem("Third_party") == "Yes")) {
enable_direction[index_zone] = "No";
checked_trigger_events[index_zone][i] = 1;
}
else if ((i == 10 || i == 12) && (enable_unknown_object != "Yes" || no_parking_time_in_minute[index_zone] != "0" || enable_ivs_zone[index_zone] != "Yes")) {
//if ((localStorage.getItem("03AI") == "Yes" || localStorage.getItem("Third_party") == "Yes"))
{
parking_space[index_zone] = "0";
parking_line[index_zone] = "0";
}
enable_direction[index_zone] = "No";
$('#enable_unknown_object').prop("checked", true);
enable_unknown_object = "Yes";
enable_ivs_zone[index_zone] = "Yes";
no_parking_time_in_minute[index_zone] = "0";
$('#no_parking_time_in_minute').val(no_parking_time_in_minute[index_zone]);
checked_trigger_events[index_zone][i] = 1;
//alert("Please enable object detection.");
}
else if ((i == 8 || i == 10 || i == 12) && (no_parking_time_in_minute[index_zone] != "0")) {
//if ((localStorage.getItem("03AI") == "Yes" || localStorage.getItem("Third_party") == "Yes"))
{
parking_space[index_zone] = "0";
parking_line[index_zone] = "0";
}
enable_direction[index_zone] = "No";
no_parking_time_in_minute[index_zone] = "0";
$('#no_parking_time_in_minute').val(no_parking_time_in_minute[index_zone]);
checked_trigger_events[index_zone][i] = 1;
//alert("Please enable object detection.");
}
else if (i == 13 || i == 14) {
//if ((localStorage.getItem("03AI") == "Yes" || localStorage.getItem("Third_party") == "Yes"))
{
parking_space[index_zone] = "0";
parking_line[index_zone] = "0";
}
enable_direction[index_zone] = "No";
if (no_parking_time_in_minute[index_zone] != "0") {
no_parking_time_in_minute[index_zone] = "0";
$('#no_parking_time_in_minute').val(no_parking_time_in_minute[index_zone]);
}
if (metadata1[index_zone] != "NULL" && metadata1[index_zone].indexOf(",") >= 1) {
checked_trigger_events[index_zone][i] = 1;
}
else {
alert(message_AND_NAND);
checked_trigger_events[index_zone][i] = 0;
}
//alert("Please enable object detection.");
}
else if (i == 4 || i == 17 || i == 18 || i == 19) {
//if ((localStorage.getItem("03AI") == "Yes" || localStorage.getItem("Third_party") == "Yes"))
{
parking_space[index_zone] = "0";
parking_line[index_zone] = "0";
}
if (localStorage.getItem("enable_only_once_to_post") != null) {
enable_only_once_to_post = localStorage.getItem("enable_only_once_to_post");
}
if (check_if_existing_any_metalist == 0 && enable_only_once_to_post == "Yes") {
alert(message_notice_only_once_to_post);
enable_direction[index_zone] = "No";
checked_trigger_events[index_zone][i] = 0;
}
else {
enable_direction[index_zone] = "Yes";
checked_trigger_events[index_zone][i] = 1;
}
}
else if (i == 15 || i == 16) {
//if ((localStorage.getItem("03AI") == "Yes" || localStorage.getItem("Third_party") == "Yes"))
{
parking_space[index_zone] = "0";
parking_line[index_zone] = "0";
}
enable_direction[index_zone] = "No";
checked_trigger_events[index_zone][i] = 1;
}
else {
//if ((localStorage.getItem("03AI") == "Yes" || localStorage.getItem("Third_party") == "Yes"))
{
parking_space[index_zone] = "0";
parking_line[index_zone] = "0";
}
if (localStorage.getItem("enable_only_once_to_post") != null) {
enable_only_once_to_post = localStorage.getItem("enable_only_once_to_post");
}
if (i == 1 && check_if_existing_any_metalist == 0 && enable_only_once_to_post == "Yes") {
alert(message_notice_only_once_to_post);
enable_direction[index_zone] = "No";
checked_trigger_events[index_zone][i] = 0;
}
else {
enable_direction[index_zone] = "No";
checked_trigger_events[index_zone][i] = 1;
}
}
}
else {
if (i == 4 || i == 15 || i == 16 || i == 17 || i == 18 || i == 19) {
enable_direction[index_zone] = "No";
}
checked_trigger_events[index_zone][i] = 0;
}
}
}
function func_get_postlist_check(index_zone, index_trigger) {
var checked_post = "Null";
var size = 0;
var alert_too_many_posts = 0;
var count_post_checked = 0;
for (var i = 0; i < check_post_array.length; i++) {
if (post_checked[i] >= 1) {
count_post_checked++;
}
}
for (var i = 0; i < check_post_array.length; i++) {
if (document.getElementById(check_post_array[i]).checked === true) {
if (size === 0 && ((post_checked[i] == 0 && count_post_checked < LIMITED_TOTAL_POST) || post_checked[i] >= 1)) {
checked_post = check_post_array[i];
if (post_checked_to_zone[i][index_zone] == 0) {
post_checked[i]++;
post_checked_to_zone[i][index_zone] = 1;
}
size++;
}
else if (size >= 1 && size <= 3 && ((post_checked[i] == 0 && count_post_checked < LIMITED_TOTAL_POST) || post_checked[i] >= 1)) {
checked_post += ',';
checked_post += check_post_array[i];
if (post_checked_to_zone[i][index_zone] == 0) {
post_checked[i]++;
post_checked_to_zone[i][index_zone] = 1;
}
size++;
}
else {
if (post_checked_to_zone[i][index_zone] == 1) {
post_checked_to_zone[i][index_zone] = 0;
post_checked[i]--;
}
document.getElementById(check_post_array[i]).checked = false;
if (alert_too_many_posts === 0) {
alert_too_many_posts = 1;
alert(message_alert_number_output);
}
}
}
else {
if (post_checked_to_zone[i][index_zone] == 1) {
post_checked_to_zone[i][index_zone] = 0;
post_checked[i]--;
}
}
}
checked_post_event_name[index_zone][index_trigger] = checked_post;
}
function func_getcheck_current_resolution() {
$.ajax({
url: '/airelay' + "/getcheck_current_resolution",
type: "GET",
async: true,
beforeSend: function (xmlHttp) {
xmlHttp.setRequestHeader("If-Modified-Since", "0");
xmlHttp.setRequestHeader("Cache-Control", "no-cache");
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
},
success: function (retdata) {
//var jsonbuf = JSON.parse('{ "name":"John", "age":30, "city":"New York"}');
if (retdata != null) {
check_current_resolution = retdata;
}
else {
setTimeout(func_getcheck_current_resolution(), 3000);
}
//console.info(retdata);
},
error: function (retdata) {
setTimeout(func_getcheck_current_resolution(), 3000);
console.warn(retdata);
}
});
}
function func_getCountersData() {
$.ajax({
url: '/airelay' + "/getcounters?ch=all",
type: "GET",
async: true,
beforeSend: function (xmlHttp) {
xmlHttp.setRequestHeader("If-Modified-Since", "0");
xmlHttp.setRequestHeader("Cache-Control", "no-cache");
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
},
success: function (retdata) {
//var jsonbuf = JSON.parse('{ "name":"John", "age":30, "city":"New York"}');
var jsonbuf = JSON.parse(retdata);
if (jsonbuf != null) {
for (var i = 0; i < MAX_SIZE_COUNTERS; i++) {
counter_name[i] = jsonbuf["event_counters"][i]["counter_name"];
reset_value[i] = jsonbuf["event_counters"][i]["reset_value"];
reset_time_interval[i] = jsonbuf["event_counters"][i]["reset_time_interval"];
//enable_reset_only_cloud[i] = jsonbuf["event_counters"][i]["enable_reset_only_cloud"];
enable_linked_to_dwell_time[i] = jsonbuf["event_counters"][i]["enable_linked_to_dwell_time"];
post_interval[i] = jsonbuf["event_counters"][i]["post_interval"];
counter_cust_name[i] = jsonbuf["event_counters"][i]["counter_cust_name"];
for (var j = 0; j < MAX_SIZE_POST; j++) {
if (jsonbuf["event_counters"][i]["link_to_post_event_name"] == post_event_name[j]) {
link_to_post_event_name[i] = j;
//console.log(j);
}
else if (jsonbuf["event_counters"][i]["link_to_post_event_name"] == "NULL") {
link_to_post_event_name[i] = -1;
}
}
//if (enable_cloud == "Yes")
{
for (var j = 0; j < MAX_SIZE_SNMP_POST; j++) {
if (jsonbuf["event_counters"][i]["link_to_post_event_name"] == snmp_event_name[j]) {
link_to_post_event_name[i] = j + MAX_SIZE_POST;
//console.log(j);
}
else if (jsonbuf["event_counters"][i]["link_to_post_event_name"] == "NULL") {
link_to_post_event_name[i] = -1;
}
}
}
}
func_getAlarmData();
}
else {
setTimeout(func_getCountersData(), 3000);
}
//console.info(retdata);
},
error: function (retdata) {
setTimeout(func_getCountersData(), 3000);
console.warn(retdata);
}
});
}
function func_getPostEventName() {
if (localStorage.getItem("post_event_name_0") != null || localStorage.getItem("snmp_event_name_0") != null) {
if (localStorage.getItem("post_event_name_0") != null) {
for (var i = 0; i < MAX_SIZE_POST; i++) {
post_event_name[i] = localStorage.getItem("post_event_name_" + i.toString());
}
}
if (localStorage.getItem("snmp_event_name_0") != null) {
for (var i = 0; i < MAX_SIZE_SNMP_POST; i++) {
snmp_event_name[i] = localStorage.getItem("snmp_event_name_" + i.toString());
}
}
if (localStorage.getItem("enable_only_once_to_post") != null) {
enable_only_once_to_post = localStorage.getItem("enable_only_once_to_post");
}
if (localStorage.getItem("03AI") == "Yes" || localStorage.getItem("g_IsHelm_without_car") == "Yes" || localStorage.getItem("Third_party") == "Yes") {
func_getCountersData();
}
else {
func_getAlarmData();
}
}
else {
$.ajax({
url: '/airelay' + "/geteventsfile?ch=all",
type: "GET",
async: true,
beforeSend: function (xmlHttp) {
xmlHttp.setRequestHeader("If-Modified-Since", "0");
xmlHttp.setRequestHeader("Cache-Control", "no-cache");
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
},
success: function (retdata) {
//var jsonbuf = JSON.parse('{ "name":"John", "age":30, "city":"New York"}');
var jsonbuf = JSON.parse(retdata);
enable_only_once_to_post = jsonbuf["notification"]["enable_only_once_to_post"];
localStorage.setItem("events_default_version", jsonbuf["notification"]["events_default_version"]);
for (var i = 0; i < MAX_SIZE_POST; i++) {
post_event_name[i] = jsonbuf["notification"]["http_post_events"][i]["post_event_name"];
}
for (var i = 0; i < MAX_SIZE_SNMP_POST; i++) {
snmp_event_name[i] = jsonbuf["event_counter_setting"]["snmp_management"][i]["snmp_event_name"];
}
if (localStorage.getItem("03AI") == "Yes" || localStorage.getItem("g_IsHelm_without_car") == "Yes" || localStorage.getItem("Third_party") == "Yes") {
func_getCountersData();
}
else {
func_getAlarmData();
}
//console.info(retdata);
},
error: function (retdata) {
console.warn(retdata);
setTimeout(func_getPostEventName(), 3000);
}
});
}
}
function get_current_index_zone() {
var index_zone = 0;
if (current_dzone === "dzone_1") {
index_zone = 0;
}
else if (current_dzone === "dzone_2") {
index_zone = 1;
}
else if (current_dzone === "dzone_3") {
index_zone = 2;
}
else if (current_dzone === "dzone_4") {
index_zone = 3;
}
else if (current_dzone === "dzone_5") {
index_zone = 4;
}
else if (current_dzone === "dzone_6") {
index_zone = 5;
}
else if (current_dzone === "dzone_7") {
index_zone = 6;
}
else if (current_dzone === "dzone_8") {
index_zone = 7;
}
return index_zone;
}
function change_color_of_button_zone() {
if (show_all_zone === 0) {
if (current_dzone === "dzone_1") {
document.getElementById("dzone_1").style.background = "#6c87d4";
document.getElementById("dzone_2").style.background = "#BABABA";
document.getElementById("dzone_3").style.background = "#BABABA";
document.getElementById("dzone_4").style.background = "#BABABA";
document.getElementById("dzone_5").style.background = "#BABABA";
document.getElementById("dzone_6").style.background = "#BABABA";
document.getElementById("dzone_7").style.background = "#BABABA";
document.getElementById("dzone_8").style.background = "#BABABA";
document.getElementById("show_all_zone").style.background = "#BABABA";
document.getElementById("dzone_1").style.borderColor = "#6c87d4";
document.getElementById("dzone_2").style.borderColor = "#BABABA";
document.getElementById("dzone_3").style.borderColor = "#BABABA";
document.getElementById("dzone_4").style.borderColor = "#BABABA";
document.getElementById("dzone_5").style.borderColor = "#BABABA";
document.getElementById("dzone_6").style.borderColor = "#BABABA";
document.getElementById("dzone_7").style.borderColor = "#BABABA";
document.getElementById("dzone_8").style.borderColor = "#BABABA";
document.getElementById("show_all_zone").style.borderColor = "#BABABA";
document.getElementById("dzone_1").style.color = "white";
document.getElementById("dzone_2").style.color = "black";
document.getElementById("dzone_3").style.color = "black";
document.getElementById("dzone_4").style.color = "black";
document.getElementById("dzone_5").style.color = "black";
document.getElementById("dzone_6").style.color = "black";
document.getElementById("dzone_7").style.color = "black";
document.getElementById("dzone_8").style.color = "black";
document.getElementById("show_all_zone").style.color = "black";
}
else if (current_dzone === "dzone_2") {
document.getElementById("dzone_1").style.background = "#BABABA";
document.getElementById("dzone_2").style.background = "#6c87d4";
document.getElementById("dzone_3").style.background = "#BABABA";
document.getElementById("dzone_4").style.background = "#BABABA";
document.getElementById("dzone_5").style.background = "#BABABA";
document.getElementById("dzone_6").style.background = "#BABABA";
document.getElementById("dzone_7").style.background = "#BABABA";
document.getElementById("dzone_8").style.background = "#BABABA";
document.getElementById("show_all_zone").style.background = "#BABABA";
document.getElementById("dzone_1").style.borderColor = "#BABABA";
document.getElementById("dzone_2").style.borderColor = "#6c87d4";
document.getElementById("dzone_3").style.borderColor = "#BABABA";
document.getElementById("dzone_4").style.borderColor = "#BABABA";
document.getElementById("dzone_5").style.borderColor = "#BABABA";
document.getElementById("dzone_6").style.borderColor = "#BABABA";
document.getElementById("dzone_7").style.borderColor = "#BABABA";
document.getElementById("dzone_8").style.borderColor = "#BABABA";
document.getElementById("show_all_zone").style.borderColor = "#BABABA";
document.getElementById("dzone_1").style.color = "black";
document.getElementById("dzone_2").style.color = "white";
document.getElementById("dzone_3").style.color = "black";
document.getElementById("dzone_4").style.color = "black";
document.getElementById("dzone_5").style.color = "black";
document.getElementById("dzone_6").style.color = "black";
document.getElementById("dzone_7").style.color = "black";
document.getElementById("dzone_8").style.color = "black";
document.getElementById("show_all_zone").style.color = "black";
}
else if (current_dzone === "dzone_3") {
document.getElementById("dzone_1").style.background = "#BABABA";
document.getElementById("dzone_2").style.background = "#BABABA";
document.getElementById("dzone_3").style.background = "#6c87d4";
document.getElementById("dzone_4").style.background = "#BABABA";
document.getElementById("dzone_5").style.background = "#BABABA";
document.getElementById("dzone_6").style.background = "#BABABA";
document.getElementById("dzone_7").style.background = "#BABABA";
document.getElementById("dzone_8").style.background = "#BABABA";
document.getElementById("show_all_zone").style.background = "#BABABA";
document.getElementById("dzone_1").style.borderColor = "#BABABA";
document.getElementById("dzone_2").style.borderColor = "#BABABA";
document.getElementById("dzone_3").style.borderColor = "#6c87d4";
document.getElementById("dzone_4").style.borderColor = "#BABABA";
document.getElementById("dzone_5").style.borderColor = "#BABABA";
document.getElementById("dzone_6").style.borderColor = "#BABABA";
document.getElementById("dzone_7").style.borderColor = "#BABABA";
document.getElementById("dzone_8").style.borderColor = "#BABABA";
document.getElementById("show_all_zone").style.borderColor = "#BABABA";
document.getElementById("dzone_1").style.color = "black";
document.getElementById("dzone_2").style.color = "black";
document.getElementById("dzone_3").style.color = "white";
document.getElementById("dzone_4").style.color = "black";
document.getElementById("dzone_5").style.color = "black";
document.getElementById("dzone_6").style.color = "black";
document.getElementById("dzone_7").style.color = "black";
document.getElementById("dzone_8").style.color = "black";
document.getElementById("show_all_zone").style.color = "black";
}
else if (current_dzone === "dzone_4") {
document.getElementById("dzone_1").style.background = "#BABABA";
document.getElementById("dzone_2").style.background = "#BABABA";
document.getElementById("dzone_3").style.background = "#BABABA";
document.getElementById("dzone_4").style.background = "#6c87d4";
document.getElementById("dzone_5").style.background = "#BABABA";
document.getElementById("dzone_6").style.background = "#BABABA";
document.getElementById("dzone_7").style.background = "#BABABA";
document.getElementById("dzone_8").style.background = "#BABABA";
document.getElementById("show_all_zone").style.background = "#BABABA";
document.getElementById("dzone_1").style.borderColor = "#BABABA";
document.getElementById("dzone_2").style.borderColor = "#BABABA";
document.getElementById("dzone_3").style.borderColor = "#BABABA";
document.getElementById("dzone_4").style.borderColor = "#6c87d4";
document.getElementById("dzone_5").style.borderColor = "#BABABA";
document.getElementById("dzone_6").style.borderColor = "#BABABA";
document.getElementById("dzone_7").style.borderColor = "#BABABA";
document.getElementById("dzone_8").style.borderColor = "#BABABA";
document.getElementById("show_all_zone").style.borderColor = "#BABABA";
document.getElementById("dzone_1").style.color = "black";
document.getElementById("dzone_2").style.color = "black";
document.getElementById("dzone_3").style.color = "black";
document.getElementById("dzone_4").style.color = "white";
document.getElementById("dzone_5").style.color = "black";
document.getElementById("dzone_6").style.color = "black";
document.getElementById("dzone_7").style.color = "black";
document.getElementById("dzone_8").style.color = "black";
document.getElementById("show_all_zone").style.color = "black";
}
else if (current_dzone === "dzone_5") {
document.getElementById("dzone_1").style.background = "#BABABA";
document.getElementById("dzone_2").style.background = "#BABABA";
document.getElementById("dzone_3").style.background = "#BABABA";
document.getElementById("dzone_4").style.background = "#BABABA";
document.getElementById("dzone_5").style.background = "#6c87d4";
document.getElementById("dzone_6").style.background = "#BABABA";
document.getElementById("dzone_7").style.background = "#BABABA";
document.getElementById("dzone_8").style.background = "#BABABA";
document.getElementById("show_all_zone").style.background = "#BABABA";
document.getElementById("dzone_1").style.borderColor = "#BABABA";
document.getElementById("dzone_2").style.borderColor = "#BABABA";
document.getElementById("dzone_3").style.borderColor = "#BABABA";
document.getElementById("dzone_4").style.borderColor = "#BABABA";
document.getElementById("dzone_5").style.borderColor = "#6c87d4";
document.getElementById("dzone_6").style.borderColor = "#BABABA";
document.getElementById("dzone_7").style.borderColor = "#BABABA";
document.getElementById("dzone_8").style.borderColor = "#BABABA";
document.getElementById("show_all_zone").style.borderColor = "#BABABA";
document.getElementById("dzone_1").style.color = "black";
document.getElementById("dzone_2").style.color = "black";
document.getElementById("dzone_3").style.color = "black";
document.getElementById("dzone_4").style.color = "black";
document.getElementById("dzone_5").style.color = "white";
document.getElementById("dzone_6").style.color = "black";
document.getElementById("dzone_7").style.color = "black";
document.getElementById("dzone_8").style.color = "black";
document.getElementById("show_all_zone").style.color = "black";
}
else if (current_dzone === "dzone_6") {
document.getElementById("dzone_1").style.background = "#BABABA";
document.getElementById("dzone_2").style.background = "#BABABA";
document.getElementById("dzone_3").style.background = "#BABABA";
document.getElementById("dzone_4").style.background = "#BABABA";
document.getElementById("dzone_5").style.background = "#BABABA";
document.getElementById("dzone_6").style.background = "#6c87d4";
document.getElementById("dzone_7").style.background = "#BABABA";
document.getElementById("dzone_8").style.background = "#BABABA";
document.getElementById("show_all_zone").style.background = "#BABABA";
document.getElementById("dzone_1").style.borderColor = "#BABABA";
document.getElementById("dzone_2").style.borderColor = "#BABABA";
document.getElementById("dzone_3").style.borderColor = "#BABABA";
document.getElementById("dzone_4").style.borderColor = "#BABABA";
document.getElementById("dzone_5").style.borderColor = "#BABABA";
document.getElementById("dzone_6").style.borderColor = "#6c87d4";
document.getElementById("dzone_7").style.borderColor = "#BABABA";
document.getElementById("dzone_8").style.borderColor = "#BABABA";
document.getElementById("show_all_zone").style.borderColor = "#BABABA";
document.getElementById("dzone_1").style.color = "black";
document.getElementById("dzone_2").style.color = "black";
document.getElementById("dzone_3").style.color = "black";
document.getElementById("dzone_4").style.color = "black";
document.getElementById("dzone_5").style.color = "black";
document.getElementById("dzone_6").style.color = "white";
document.getElementById("dzone_7").style.color = "black";
document.getElementById("dzone_8").style.color = "black";
document.getElementById("show_all_zone").style.color = "black";
}
else if (current_dzone === "dzone_7") {
document.getElementById("dzone_1").style.background = "#BABABA";
document.getElementById("dzone_2").style.background = "#BABABA";
document.getElementById("dzone_3").style.background = "#BABABA";
document.getElementById("dzone_4").style.background = "#BABABA";
document.getElementById("dzone_5").style.background = "#BABABA";
document.getElementById("dzone_6").style.background = "#BABABA";
document.getElementById("dzone_7").style.background = "#6c87d4";
document.getElementById("dzone_8").style.background = "#BABABA";
document.getElementById("show_all_zone").style.background = "#BABABA";
document.getElementById("dzone_1").style.borderColor = "#BABABA";
document.getElementById("dzone_2").style.borderColor = "#BABABA";
document.getElementById("dzone_3").style.borderColor = "#BABABA";
document.getElementById("dzone_4").style.borderColor = "#BABABA";
document.getElementById("dzone_5").style.borderColor = "#BABABA";
document.getElementById("dzone_6").style.borderColor = "#BABABA";
document.getElementById("dzone_7").style.borderColor = "#6c87d4";
document.getElementById("dzone_8").style.borderColor = "#BABABA";
document.getElementById("show_all_zone").style.borderColor = "#BABABA";
document.getElementById("dzone_1").style.color = "black";
document.getElementById("dzone_2").style.color = "black";
document.getElementById("dzone_3").style.color = "black";
document.getElementById("dzone_4").style.color = "black";
document.getElementById("dzone_5").style.color = "black";
document.getElementById("dzone_6").style.color = "black";
document.getElementById("dzone_7").style.color = "white";
document.getElementById("dzone_8").style.color = "black";
document.getElementById("show_all_zone").style.color = "black";
}
else if (current_dzone === "dzone_8") {
document.getElementById("dzone_1").style.background = "#BABABA";
document.getElementById("dzone_2").style.background = "#BABABA";
document.getElementById("dzone_3").style.background = "#BABABA";
document.getElementById("dzone_4").style.background = "#BABABA";
document.getElementById("dzone_5").style.background = "#BABABA";
document.getElementById("dzone_6").style.background = "#BABABA";
document.getElementById("dzone_7").style.background = "#BABABA";
document.getElementById("dzone_8").style.background = "#6c87d4";
document.getElementById("show_all_zone").style.background = "#BABABA";
document.getElementById("dzone_1").style.borderColor = "#BABABA";
document.getElementById("dzone_2").style.borderColor = "#BABABA";
document.getElementById("dzone_3").style.borderColor = "#BABABA";
document.getElementById("dzone_4").style.borderColor = "#BABABA";
document.getElementById("dzone_5").style.borderColor = "#BABABA";
document.getElementById("dzone_6").style.borderColor = "#BABABA";
document.getElementById("dzone_7").style.borderColor = "#BABABA";
document.getElementById("dzone_8").style.borderColor = "#6c87d4";
document.getElementById("show_all_zone").style.borderColor = "#BABABA";
document.getElementById("dzone_1").style.color = "black";
document.getElementById("dzone_2").style.color = "black";
document.getElementById("dzone_3").style.color = "black";
document.getElementById("dzone_4").style.color = "black";
document.getElementById("dzone_5").style.color = "black";
document.getElementById("dzone_6").style.color = "black";
document.getElementById("dzone_7").style.color = "black";
document.getElementById("dzone_8").style.color = "white";
document.getElementById("show_all_zone").style.color = "black";
}
}
else {
document.getElementById("dzone_1").style.background = "#BABABA";
document.getElementById("dzone_2").style.background = "#BABABA";
document.getElementById("dzone_3").style.background = "#BABABA";
document.getElementById("dzone_4").style.background = "#BABABA";
document.getElementById("dzone_5").style.background = "#BABABA";
document.getElementById("dzone_6").style.background = "#BABABA";
document.getElementById("dzone_7").style.background = "#BABABA";
document.getElementById("dzone_8").style.background = "#BABABA";
document.getElementById("show_all_zone").style.background = "#6c87d4";
document.getElementById("dzone_1").style.borderColor = "#BABABA";
document.getElementById("dzone_2").style.borderColor = "#BABABA";
document.getElementById("dzone_3").style.borderColor = "#BABABA";
document.getElementById("dzone_4").style.borderColor = "#BABABA";
document.getElementById("dzone_5").style.borderColor = "#BABABA";
document.getElementById("dzone_6").style.borderColor = "#BABABA";
document.getElementById("dzone_7").style.borderColor = "#BABABA";
document.getElementById("dzone_8").style.borderColor = "#BABABA";
document.getElementById("show_all_zone").style.borderColor = "#6c87d4";
document.getElementById("dzone_1").style.color = "black";
document.getElementById("dzone_2").style.color = "black";
document.getElementById("dzone_3").style.color = "black";
document.getElementById("dzone_4").style.color = "black";
document.getElementById("dzone_5").style.color = "black";
document.getElementById("dzone_6").style.color = "black";
document.getElementById("dzone_7").style.color = "black";
document.getElementById("dzone_8").style.color = "black";
document.getElementById("show_all_zone").style.color = "white";
}
}
function func_set_events_counter(name_, value_, event_id) {
$.ajax({
url: '/airelay' + "/setcounters?ch=all&event_counters=" + event_id + "&" + name_ + "=" + value_,
method: "GET",
async: true,
beforeSend: function (xmlHttp) {
xmlHttp.setRequestHeader("If-Modified-Since", "0");
xmlHttp.setRequestHeader("Cache-Control", "no-cache");
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
},
success: function () {
//console.info();
},
error: function () {
console.warn();
}
});
return false;
}
function func_showCloudData() {
// console.log("[func_showCloudData] check port: ", GetUrlPort());
if (localStorage.getItem("03AI") == "Yes" || localStorage.getItem("g_IsHelm_without_car") == "Yes" || localStorage.getItem("Third_party") == "Yes" || GetUrlPort() == 80) {
document.getElementById("border_counter").style.display = "block";
document.getElementById("title_counter").style.display = "block";
document.getElementById("IDOK_counter").style.display = "inline-block"; // 因旁邊要放 Reset Counter
}
else {
document.getElementById("border_counter").style.display = "none";
document.getElementById("title_counter").style.display = "none";
document.getElementById("IDOK_counter").style.display = "none";
// 08-02 上午會議決定改成常開
// document.getElementById("group_parking").style.display = "none";
}
if (localStorage.getItem("Face_recognition") == "Yes") {
}
else {
document.getElementById("upload_img").style.display = "none";
}
if (localStorage.getItem("events_default_version") != null && localStorage.getItem("events_default_version") == "4") {
}
else{
document.getElementById("enable_track").style.display = "none";
document.getElementById("IDC_CHECK_ENABLE_TRACK").style.display = "none";
}
}
/*
$("#eventsList li").click(function () {
$("#eventsList li").each(function () { $(this).removeClass("selected") });
$(this).addClass("selected");
});
*/
// main function for emulating IE11's "change" event:
/*
function onRangeChange(rangeInputElmt, listener) {
var inputEvtHasNeverFired = true;
var rangeValue = { current: undefined, mostRecent: undefined };
rangeInputElmt.addEventListener("input", function (evt) {
inputEvtHasNeverFired = false;
rangeValue.current = evt.target.value;
if (rangeValue.current !== rangeValue.mostRecent) {
listener(evt);
}
rangeValue.mostRecent = rangeValue.current;
});
rangeInputElmt.addEventListener("change", function (evt) {
if (inputEvtHasNeverFired) {
listener(evt);
}
});
}
*/
// example usage:
/*
var myRangeInputElmt = document.querySelector("input");
var myRangeValPar = document.querySelector("#rangeValPar");
var myNumChgEvtsCell = document.querySelector("#numChgEvtsCell");
var myNumInpEvtsCell = document.querySelector("#numInpEvtsCell");
var myNumCusEvtsCell = document.querySelector("#numCusEvtsCell");
var myNumEvts = { input: 0, change: 0, custom: 0 };
var myUpdate = function () {
myNumChgEvtsCell.innerHTML = myNumEvts["change"];
myNumInpEvtsCell.innerHTML = myNumEvts["input"];
myNumCusEvtsCell.innerHTML = myNumEvts["custom"];
};
["input", "change"].forEach(function (myEvtType) {
myRangeInputElmt.addEventListener(myEvtType, function () {
myNumEvts[myEvtType] += 1;
myUpdate();
});
});
var myListener = function (myEvt) {
myNumEvts["custom"] += 1;
myRangeValPar.innerHTML = "range value: " + myEvt.target.value;
myUpdate();
};
onRangeChange(myRangeInputElmt, myListener);
*/
var k_index = -1;
$(".progress-bar").css("visibility", "hidden");
function makeProgress() {
if (k_index < 100 && k_index >= 0) {
k_index = k_index + 1;
$(".progress-bar").css("visibility", "visible");
//$(".progress-bar").css("width", k_index + "%").text(k_index + " %");
$(".progress-bar").css("width", k_index + "%");
console.log("k_index:" + k_index.toString());
if (k_index == 1) {
g_check_if_run_setting = 1;
$('html, body').scrollTop(0);
func_getCurrentEventsData();
func_set_zone_data();
localStorage.setItem('count_zone', count_zone);
for (var index_zone = 0; index_zone < MAX_DETECTION_ZONE; index_zone++) {
if (index_zone >= count_zone) {
enable_direction[index_zone] = "No";
}
}
var points_array_0 = new Array(MAX_SIZE_POINTS);
points_array_0 = GetPointLocation(0);
var points_num_0 = 6;
if (checked_trigger_events[0][4] == 1 ||
checked_trigger_events[0][15] == 1 ||
checked_trigger_events[0][16] == 1 ||
checked_trigger_events[0][17] == 1 ||
checked_trigger_events[0][18] == 1 ||
checked_trigger_events[0][19] == 1 ||
red_light_zone == get_current_index_zone().toString()) {
points_num_0 = 4;
}
else {
points_num_0 = 6;
}
var points_array_1 = new Array(MAX_SIZE_POINTS);
points_array_1 = GetPointLocation(1);
var points_num_1 = 6;
if (checked_trigger_events[1][4] == 1 ||
checked_trigger_events[1][15] == 1 ||
checked_trigger_events[1][16] == 1 ||
checked_trigger_events[1][17] == 1 ||
checked_trigger_events[1][18] == 1 ||
checked_trigger_events[1][19] == 1 ||
red_light_zone == get_current_index_zone().toString()) {
points_num_1 = 4;
}
else {
points_num_1 = 6;
}
var points_array_2 = new Array(MAX_SIZE_POINTS);
points_array_2 = GetPointLocation(2);
var points_num_2 = 6;
if (checked_trigger_events[2][4] == 1 ||
checked_trigger_events[2][15] == 1 ||
checked_trigger_events[2][16] == 1 ||
checked_trigger_events[2][17] == 1 ||
checked_trigger_events[2][18] == 1 ||
checked_trigger_events[2][19] == 1 ||
red_light_zone == get_current_index_zone().toString()) {
points_num_2 = 4;
}
else {
points_num_2 = 6;
}
var points_array_3 = new Array(MAX_SIZE_POINTS);
points_array_3 = GetPointLocation(3);
var points_num_3 = 6;
if (checked_trigger_events[3][4] == 1 ||
checked_trigger_events[3][15] == 1 ||
checked_trigger_events[3][16] == 1 ||
checked_trigger_events[3][17] == 1 ||
checked_trigger_events[3][18] == 1 ||
checked_trigger_events[3][19] == 1 ||
red_light_zone == get_current_index_zone().toString()) {
points_num_3 = 4;
}
else {
points_num_3 = 6;
}
var points_array_4 = new Array(MAX_SIZE_POINTS);
points_array_4 = GetPointLocation(4);
var points_num_4 = 6;
if (checked_trigger_events[4][4] == 1 ||
checked_trigger_events[4][15] == 1 ||
checked_trigger_events[4][16] == 1 ||
checked_trigger_events[4][17] == 1 ||
checked_trigger_events[4][18] == 1 ||
checked_trigger_events[4][19] == 1 ||
red_light_zone == get_current_index_zone().toString()) {
points_num_4 = 4;
}
else {
points_num_4 = 6;
}
var points_array_5 = new Array(MAX_SIZE_POINTS);
points_array_5 = GetPointLocation(5);
var points_num_5 = 6;
if (checked_trigger_events[5][4] == 1 ||
checked_trigger_events[5][15] == 1 ||
checked_trigger_events[5][16] == 1 ||
checked_trigger_events[5][17] == 1 ||
checked_trigger_events[5][18] == 1 ||
checked_trigger_events[5][19] == 1 ||
red_light_zone == get_current_index_zone().toString()) {
points_num_5 = 4;
}
else {
points_num_5 = 6;
}
var points_array_6 = new Array(MAX_SIZE_POINTS);
points_array_6 = GetPointLocation(6);
var points_num_6 = 6;
if (checked_trigger_events[6][4] == 1 ||
checked_trigger_events[6][15] == 1 ||
checked_trigger_events[6][16] == 1 ||
checked_trigger_events[6][17] == 1 ||
checked_trigger_events[6][18] == 1 ||
checked_trigger_events[6][19] == 1 ||
red_light_zone == get_current_index_zone().toString()) {
points_num_6 = 4;
}
else {
points_num_6 = 6;
}
var points_array_7 = new Array(MAX_SIZE_POINTS);
points_array_7 = GetPointLocation(7);
var points_num_7 = 6;
if (checked_trigger_events[7][4] == 1 ||
checked_trigger_events[7][15] == 1 ||
checked_trigger_events[7][16] == 1 ||
checked_trigger_events[7][17] == 1 ||
checked_trigger_events[7][18] == 1 ||
checked_trigger_events[7][19] == 1 ||
red_light_zone == get_current_index_zone().toString()) {
points_num_7 = 4;
}
else {
points_num_7 = 6;
}
var temp_tof_enable_show_distance = 0;
var temp_tof_enable_show_height = 0;
for (var index_zone = 0; index_zone < count_zone; index_zone++) {
if (checked_trigger_events[index_zone][21] == 1) {
temp_tof_enable_show_distance = 1;
}
else if (checked_trigger_events[index_zone][22] == 1) {
temp_tof_enable_show_height = 1;
}
}
g_tof_enable_show_distance = temp_tof_enable_show_distance;
g_tof_enable_show_height = temp_tof_enable_show_height;
var temp_text_clear_trigger_event = get_text_to_clear_config_trigger_event();
// Slider Options 相關數值設定
var json_data = '{"view_setting":{"camera01":{"obj_max_proportion": "' + obj_max_proportion;
json_data += '","obj_min_proportion": "' + obj_min_proportion + '","enable_traffic": "' + enable_traffic + '","enable_unknown_object": "' + enable_unknown_object + '","enable_track": "' + enable_track;
json_data += '","confidence2": "' + confidence_traffic + '"';
json_data += '}}}';
// console.log("[makeProgress] json_data:");
// console.log(json_data);
// console.log("------------------------------------------------");
func_setconfigfile(json_data);
// 08-28
// 各 Zone 拆開寫入,並根據 count_zone 決定要寫到第幾個 Zone
// console.log("count_zone:", count_zone);
if (count_zone >= 1) {
// console.log("set zone 1 config");
var json_data_zone_1 = '{"view_setting":{"camera01":{';
json_data_zone_1 += '"detection_zone":[';
json_data_zone_1 += '{"queuing_count": "' + queuing_count[0];
json_data_zone_1 += '","enable_ivs_zone": "' + enable_ivs_zone[0];
json_data_zone_1 += '","parking_line": "' + parking_line[0];
json_data_zone_1 += '","parking_space": "' + parking_space[0];
json_data_zone_1 += '","no_parking_time": "' + no_parking_time[0];
json_data_zone_1 += '","metadata_stop": "' + metadata_stop[0];
json_data_zone_1 += '","no_parking_time_in_minute": "' + no_parking_time_in_minute[0];
json_data_zone_1 += '","obj_min_proportion_in_zone": "' + obj_min_proportion_in_zone[0];
json_data_zone_1 += '","obj_max_proportion_in_zone": "' + obj_max_proportion_in_zone[0];
json_data_zone_1 += '","metadata1": "' + metadata1[0];
json_data_zone_1 += '","trigger_events": [' + temp_text_clear_trigger_event + ']';
json_data_zone_1 += '}';
json_data_zone_1 += ']';
json_data_zone_1 += '}}}'; // 對應 view_setting & camera01 層級
// console.log("[makeProgress] json_data_zone_1:");
// console.log(json_data_zone_1);
// console.log("------------------------------------------------");
func_setconfigfile(json_data_zone_1);
}
if (count_zone >= 2) {
// console.log("set zone 2 config");
var json_data_zone_2 = '{"view_setting":{"camera01":{';
json_data_zone_2 += '"detection_zone":[';
json_data_zone_2 += '{},' // 補上index之前 空的 dict,確保次序對上既有格式
json_data_zone_2 += '{"queuing_count": "' + queuing_count[1];
json_data_zone_2 += '","enable_ivs_zone": "' + enable_ivs_zone[1];
json_data_zone_2 += '","parking_line": "' + parking_line[1];
json_data_zone_2 += '","parking_space": "' + parking_space[1];
json_data_zone_2 += '","no_parking_time": "' + no_parking_time[1];
json_data_zone_2 += '","metadata_stop": "' + metadata_stop[1];
json_data_zone_2 += '","no_parking_time_in_minute": "' + no_parking_time_in_minute[1];
json_data_zone_2 += '","obj_min_proportion_in_zone": "' + obj_min_proportion_in_zone[1];
json_data_zone_2 += '","obj_max_proportion_in_zone": "' + obj_max_proportion_in_zone[1];
json_data_zone_2 += '","metadata1": "' + metadata1[1];
json_data_zone_2 += '","trigger_events": [' + temp_text_clear_trigger_event + ']';
json_data_zone_2 += '}';
json_data_zone_2 += ']';
json_data_zone_2 += '}}}'; // 對應 view_setting & camera01 層級
// console.log("[makeProgress] json_data_zone_2:");
// console.log(json_data_zone_2);
// console.log("------------------------------------------------");
func_setconfigfile(json_data_zone_2);
}
if (count_zone >= 3) {
// console.log("set zone 3 config");
var json_data_zone_3 = '{"view_setting":{"camera01":{';
json_data_zone_3 += '"detection_zone":[';
json_data_zone_3 += '{},{},' // 補上index之前 空的 dict,確保次序對上既有格式
json_data_zone_3 += '{"queuing_count": "' + queuing_count[2];
json_data_zone_3 += '","enable_ivs_zone": "' + enable_ivs_zone[2];
json_data_zone_3 += '","parking_line": "' + parking_line[2];
json_data_zone_3 += '","parking_space": "' + parking_space[2];
json_data_zone_3 += '","no_parking_time": "' + no_parking_time[2];
json_data_zone_3 += '","metadata_stop": "' + metadata_stop[2];
json_data_zone_3 += '","no_parking_time_in_minute": "' + no_parking_time_in_minute[2];
json_data_zone_3 += '","obj_min_proportion_in_zone": "' + obj_min_proportion_in_zone[2];
json_data_zone_3 += '","obj_max_proportion_in_zone": "' + obj_max_proportion_in_zone[2];
json_data_zone_3 += '","metadata1": "' + metadata1[2];
json_data_zone_3 += '","trigger_events": [' + temp_text_clear_trigger_event + ']';
json_data_zone_3 += '}';
json_data_zone_3 += ']';
json_data_zone_3 += '}}}'; // 對應 view_setting & camera01 層級
// console.log("[makeProgress] json_data_zone_3:");
// console.log(json_data_zone_3);
// console.log("------------------------------------------------");
func_setconfigfile(json_data_zone_3);
}
if (count_zone >= 4) {
// console.log("set zone 4 config");
var json_data_zone_4 = '{"view_setting":{"camera01":{';
json_data_zone_4 += '"detection_zone":[';
json_data_zone_4 += '{},{},{},' // 補上index之前 空的 dict,確保次序對上既有格式
json_data_zone_4 += '{"queuing_count": "' + queuing_count[3];
json_data_zone_4 += '","enable_ivs_zone": "' + enable_ivs_zone[3];
json_data_zone_4 += '","parking_line": "' + parking_line[3];
json_data_zone_4 += '","parking_space": "' + parking_space[3];
json_data_zone_4 += '","no_parking_time": "' + no_parking_time[3];
json_data_zone_4 += '","metadata_stop": "' + metadata_stop[3];
json_data_zone_4 += '","no_parking_time_in_minute": "' + no_parking_time_in_minute[3];
json_data_zone_4 += '","obj_min_proportion_in_zone": "' + obj_min_proportion_in_zone[3];
json_data_zone_4 += '","obj_max_proportion_in_zone": "' + obj_max_proportion_in_zone[3];
json_data_zone_4 += '","metadata1": "' + metadata1[3];
json_data_zone_4 += '","trigger_events": [' + temp_text_clear_trigger_event + ']';
json_data_zone_4 += '}';
json_data_zone_4 += ']';
json_data_zone_4 += '}}}'; // 對應 view_setting & camera01 層級
// console.log("[makeProgress] json_data_zone_4:");
// console.log(json_data_zone_4);
// console.log("------------------------------------------------");
func_setconfigfile(json_data_zone_4);
}
if (count_zone >= 5) {
// console.log("set zone 5 config");
var json_data_zone_5 = '{"view_setting":{"camera01":{';
json_data_zone_5 += '"detection_zone":[';
json_data_zone_5 += '{},{},{},{},' // 補上index之前 空的 dict,確保次序對上既有格式
json_data_zone_5 += '{"queuing_count": "' + queuing_count[4];
json_data_zone_5 += '","enable_ivs_zone": "' + enable_ivs_zone[4];
json_data_zone_5 += '","parking_line": "' + parking_line[4];
json_data_zone_5 += '","parking_space": "' + parking_space[4];
json_data_zone_5 += '","no_parking_time": "' + no_parking_time[4];
json_data_zone_5 += '","metadata_stop": "' + metadata_stop[4];
json_data_zone_5 += '","no_parking_time_in_minute": "' + no_parking_time_in_minute[4];
json_data_zone_5 += '","obj_min_proportion_in_zone": "' + obj_min_proportion_in_zone[4];
json_data_zone_5 += '","obj_max_proportion_in_zone": "' + obj_max_proportion_in_zone[4];
json_data_zone_5 += '","metadata1": "' + metadata1[4];
json_data_zone_5 += '","trigger_events": [' + temp_text_clear_trigger_event + ']';
json_data_zone_5 += '}';
json_data_zone_5 += ']';
json_data_zone_5 += '}}}'; // 對應 view_setting & camera01 層級
// console.log("[makeProgress] json_data_zone_5:");
// console.log(json_data_zone_5);
// console.log("------------------------------------------------");
func_setconfigfile(json_data_zone_5);
}
if (count_zone >= 6) {
// console.log("set zone 6 config");
var json_data_zone_6 = '{"view_setting":{"camera01":{';
json_data_zone_6 += '"detection_zone":[';
json_data_zone_6 += '{},{},{},{},{},' // 補上index之前 空的 dict,確保次序對上既有格式
json_data_zone_6 += '{"queuing_count": "' + queuing_count[5];
json_data_zone_6 += '","enable_ivs_zone": "' + enable_ivs_zone[5];
json_data_zone_6 += '","parking_line": "' + parking_line[5];
json_data_zone_6 += '","parking_space": "' + parking_space[5];
json_data_zone_6 += '","no_parking_time": "' + no_parking_time[5];
json_data_zone_6 += '","metadata_stop": "' + metadata_stop[5];
json_data_zone_6 += '","no_parking_time_in_minute": "' + no_parking_time_in_minute[5];
json_data_zone_6 += '","obj_min_proportion_in_zone": "' + obj_min_proportion_in_zone[5];
json_data_zone_6 += '","obj_max_proportion_in_zone": "' + obj_max_proportion_in_zone[5];
json_data_zone_6 += '","metadata1": "' + metadata1[5];
json_data_zone_6 += '","trigger_events": [' + temp_text_clear_trigger_event + ']';
json_data_zone_6 += '}';
json_data_zone_6 += ']';
json_data_zone_6 += '}}}'; // 對應 view_setting & camera01 層級
// console.log("[makeProgress] json_data_zone_6:");
// console.log(json_data_zone_6);
// console.log("------------------------------------------------");
func_setconfigfile(json_data_zone_6);
}
if (count_zone >= 7) {
// console.log("set zone 7 config");
var json_data_zone_7 = '{"view_setting":{"camera01":{';
json_data_zone_7 += '"detection_zone":[';
json_data_zone_7 += '{},{},{},{},{},{},' // 補上index之前 空的 dict,確保次序對上既有格式
json_data_zone_7 += '{"queuing_count": "' + queuing_count[6];
json_data_zone_7 += '","enable_ivs_zone": "' + enable_ivs_zone[6];
json_data_zone_7 += '","parking_line": "' + parking_line[6];
json_data_zone_7 += '","parking_space": "' + parking_space[6];
json_data_zone_7 += '","no_parking_time": "' + no_parking_time[6];
json_data_zone_7 += '","metadata_stop": "' + metadata_stop[6];
json_data_zone_7 += '","no_parking_time_in_minute": "' + no_parking_time_in_minute[6];
json_data_zone_7 += '","obj_min_proportion_in_zone": "' + obj_min_proportion_in_zone[6];
json_data_zone_7 += '","obj_max_proportion_in_zone": "' + obj_max_proportion_in_zone[6];
json_data_zone_7 += '","metadata1": "' + metadata1[6];
json_data_zone_7 += '","trigger_events": [' + temp_text_clear_trigger_event + ']';
json_data_zone_7 += '}';
json_data_zone_7 += ']';
json_data_zone_7 += '}}}'; // 對應 view_setting & camera01 層級
// console.log("[makeProgress] json_data_zone_7:");
// console.log(json_data_zone_7);
// console.log("------------------------------------------------");
func_setconfigfile(json_data_zone_7);
}
if (count_zone >= 8) {
// console.log("set zone 8 config");
var json_data_zone_8 = '{"view_setting":{"camera01":{';
json_data_zone_8 += '"detection_zone":[';
json_data_zone_8 += '{},{},{},{},{},{},{},' // 補上index之前 空的 dict,確保次序對上既有格式
json_data_zone_8 += '{"queuing_count": "' + queuing_count[7];
json_data_zone_8 += '","enable_ivs_zone": "' + enable_ivs_zone[7];
json_data_zone_8 += '","parking_line": "' + parking_line[7];
json_data_zone_8 += '","parking_space": "' + parking_space[7];
json_data_zone_8 += '","no_parking_time": "' + no_parking_time[7];
json_data_zone_8 += '","metadata_stop": "' + metadata_stop[7];
json_data_zone_8 += '","no_parking_time_in_minute": "' + no_parking_time_in_minute[7];
json_data_zone_8 += '","obj_min_proportion_in_zone": "' + obj_min_proportion_in_zone[7];
json_data_zone_8 += '","obj_max_proportion_in_zone": "' + obj_max_proportion_in_zone[7];
json_data_zone_8 += '","metadata1": "' + metadata1[7];
json_data_zone_8 += '","trigger_events": [' + temp_text_clear_trigger_event + ']';
json_data_zone_8 += '}';
json_data_zone_8 += ']';
json_data_zone_8 += '}}}'; // 對應 view_setting & camera01 層級
// console.log("[makeProgress] json_data_zone_8:");
// console.log(json_data_zone_8);
// console.log("------------------------------------------------");
func_setconfigfile(json_data_zone_8);
}
var text_checked_trigger_events = new Array(MAX_DETECTION_ZONE);
var text_checked_post_event_name = new Array(MAX_DETECTION_ZONE);
var text_detect_event_id = new Array(MAX_DETECTION_ZONE);
for (var i = 0; i < MAX_DETECTION_ZONE; i++) {
text_detect_event_id[i] = "0x00000000";
text_checked_trigger_events[i] = "0";
text_checked_post_event_name[i] = "";
}
for (var i = 0; i < count_zone; i++) {
for (var j = 0; j < MAX_SIZE_IDC_LIST_TRIGGER_EVENTS; j++) {
if (checked_trigger_events[i][j] == 1) {
text_detect_event_id[i] = DETECT_EVENT_ID_ARRAY[j];
text_checked_trigger_events[i] = checked_trigger_events[i][j].toString();
text_checked_post_event_name[i] = checked_post_event_name[i][j];
break;
}
}
}
var json_data_trigger = '{"view_setting":{"camera01":{"detection_zone":[';
for (var i = 0; i < count_zone; i++) {
json_data_trigger += '{"trigger_events": [{"checked":' + text_checked_trigger_events[i] + ',"detect_event_id": "' + text_detect_event_id[i] + '","post_event_name": "' + text_checked_post_event_name[i] + '"}]}';
if (i < count_zone - 1) {
json_data_trigger += ',';
}
}
json_data_trigger += ']}}}';
// console.log("[makeProgress] json_data_trigger:");
// console.log(json_data_trigger);
// console.log("------------------------------------------------");
func_setconfigfile(json_data_trigger);
localStorage.setItem('speed_index_success', 'Null');
localStorage.setItem('setting_success', 'Null');
//g_luckalarmui = value_luckalarmui * 0.9;
if (no_parking_time_in_minute[get_current_index_zone()] == "0") {
$('#no_parking_time').slider({ disabled: false });
}
else {
$('#no_parking_time').slider({ disabled: true });
}
k_index = 94;
}
else if (k_index == 95) {
//g_luckalarmui = value_luckalarmui * 0.3;
//waitSeconds(500);
//func_getreload();
//k_index = 95;
}
else if (k_index == 100) {
func_run_osd_server();
var alert_message_check_current_resolution = 0;
for (var i = 0; i < count_zone; i++) {
if ((metadata1[i].indexOf("barcode") >= 0 || metadata1[i].indexOf("qrcode") >= 0) && check_current_resolution == 0) {
alert_message_check_current_resolution = 1;
break;
}
}
if (alert_message_check_current_resolution == 1) {
alert(message_check_current_resolution);
}
$(".progress-bar").css("visibility", "hidden");
//$(".progress-bar").css("width", "0%").text("0 %");
$(".progress-bar").css("width", "0%");
k_index = -1;
g_check_if_run_setting = 0;
}
// Wait for sometime before running this script again
setTimeout("makeProgress()", 200);
}
}
function makeProgress_zone() {
console.log("[makeProgress_zone] start");
if (k_index < 100 && k_index >= 0) {
k_index = k_index + 1;
$(".progress-bar").css("visibility", "visible");
//$(".progress-bar").css("width", k_index + "%").text(k_index + " %");
$(".progress-bar").css("width", k_index + "%");
console.log("k_index:" + k_index.toString());
if (k_index == 1) {
g_check_if_run_setting = 1;
$('html, body').scrollTop(0);
func_getCurrentEventsData();
func_set_zone_data();
localStorage.setItem('count_zone', count_zone);
for (var index_zone = 0; index_zone < MAX_DETECTION_ZONE; index_zone++) {
if (index_zone >= count_zone) {
enable_direction[index_zone] = "No";
}
}
var points_array_0 = new Array(MAX_SIZE_POINTS);
points_array_0 = GetPointLocation(0);
var points_num_0 = 6;
if (checked_trigger_events[0][4] == 1 ||
checked_trigger_events[0][15] == 1 ||
checked_trigger_events[0][16] == 1 ||
checked_trigger_events[0][17] == 1 ||
checked_trigger_events[0][18] == 1 ||
checked_trigger_events[0][19] == 1 ||
red_light_zone == get_current_index_zone().toString()) {
points_num_0 = 4;
}
else {
points_num_0 = 6;
}
var points_array_1 = new Array(MAX_SIZE_POINTS);
points_array_1 = GetPointLocation(1);
var points_num_1 = 6;
if (checked_trigger_events[1][4] == 1 ||
checked_trigger_events[1][15] == 1 ||
checked_trigger_events[1][16] == 1 ||
checked_trigger_events[1][17] == 1 ||
checked_trigger_events[1][18] == 1 ||
checked_trigger_events[1][19] == 1 ||
red_light_zone == get_current_index_zone().toString()) {
points_num_1 = 4;
}
else {
points_num_1 = 6;
}
var points_array_2 = new Array(MAX_SIZE_POINTS);
points_array_2 = GetPointLocation(2);
var points_num_2 = 6;
if (checked_trigger_events[2][4] == 1 ||
checked_trigger_events[2][15] == 1 ||
checked_trigger_events[2][16] == 1 ||
checked_trigger_events[2][17] == 1 ||
checked_trigger_events[2][18] == 1 ||
checked_trigger_events[2][19] == 1 ||
red_light_zone == get_current_index_zone().toString()) {
points_num_2 = 4;
}
else {
points_num_2 = 6;
}
var points_array_3 = new Array(MAX_SIZE_POINTS);
points_array_3 = GetPointLocation(3);
var points_num_3 = 6;
if (checked_trigger_events[3][4] == 1 ||
checked_trigger_events[3][15] == 1 ||
checked_trigger_events[3][16] == 1 ||
checked_trigger_events[3][17] == 1 ||
checked_trigger_events[3][18] == 1 ||
checked_trigger_events[3][19] == 1 ||
red_light_zone == get_current_index_zone().toString()) {
points_num_3 = 4;
}
else {
points_num_3 = 6;
}
var points_array_4 = new Array(MAX_SIZE_POINTS);
points_array_4 = GetPointLocation(4);
var points_num_4 = 6;
if (checked_trigger_events[4][4] == 1 ||
checked_trigger_events[4][15] == 1 ||
checked_trigger_events[4][16] == 1 ||
checked_trigger_events[4][17] == 1 ||
checked_trigger_events[4][18] == 1 ||
checked_trigger_events[4][19] == 1 ||
red_light_zone == get_current_index_zone().toString()) {
points_num_4 = 4;
}
else {
points_num_4 = 6;
}
var points_array_5 = new Array(MAX_SIZE_POINTS);
points_array_5 = GetPointLocation(5);
var points_num_5 = 6;
if (checked_trigger_events[5][4] == 1 ||
checked_trigger_events[5][15] == 1 ||
checked_trigger_events[5][16] == 1 ||
checked_trigger_events[5][17] == 1 ||
checked_trigger_events[5][18] == 1 ||
checked_trigger_events[5][19] == 1 ||
red_light_zone == get_current_index_zone().toString()) {
points_num_5 = 4;
}
else {
points_num_5 = 6;
}
var points_array_6 = new Array(MAX_SIZE_POINTS);
points_array_6 = GetPointLocation(6);
var points_num_6 = 6;
if (checked_trigger_events[6][4] == 1 ||
checked_trigger_events[6][15] == 1 ||
checked_trigger_events[6][16] == 1 ||
checked_trigger_events[6][17] == 1 ||
checked_trigger_events[6][18] == 1 ||
checked_trigger_events[6][19] == 1 ||
red_light_zone == get_current_index_zone().toString()) {
points_num_6 = 4;
}
else {
points_num_6 = 6;
}
var points_array_7 = new Array(MAX_SIZE_POINTS);
points_array_7 = GetPointLocation(7);
var points_num_7 = 6;
if (checked_trigger_events[7][4] == 1 ||
checked_trigger_events[7][15] == 1 ||
checked_trigger_events[7][16] == 1 ||
checked_trigger_events[7][17] == 1 ||
checked_trigger_events[7][18] == 1 ||
checked_trigger_events[7][19] == 1 ||
red_light_zone == get_current_index_zone().toString()) {
points_num_7 = 4;
}
else {
points_num_7 = 6;
}
var temp_tof_enable_show_distance = 0;
var temp_tof_enable_show_height = 0;
for (var index_zone = 0; index_zone < count_zone; index_zone++) {
if (checked_trigger_events[index_zone][21] == 1) {
temp_tof_enable_show_distance = 1;
}
else if (checked_trigger_events[index_zone][22] == 1) {
temp_tof_enable_show_height = 1;
}
}
g_tof_enable_show_distance = temp_tof_enable_show_distance;
g_tof_enable_show_height = temp_tof_enable_show_height;
// 08-28 簡化成 Zone 相關設定就好
var json_data = '{"view_setting":{"camera01":{"count_zone": ' + count_zone;
json_data += ',"detection_zone":[';
json_data += '{"enable_direction1": "' + enable_direction[0];
json_data += '","direction1": "' + func_get_direction(0).toString();
json_data += '","point_number": ' + points_num_0;
json_data += ',"x1": ' + Math.round(points_array_0[0].x * tab_view_size[0] / image_width);
json_data += ',"y1": ' + Math.round(points_array_0[0].y * tab_view_size[1] / image_height);
json_data += ',"x2": ' + Math.round(points_array_0[1].x * tab_view_size[0] / image_width);
json_data += ',"y2": ' + Math.round(points_array_0[1].y * tab_view_size[1] / image_height);
json_data += ',"x3": ' + Math.round(points_array_0[2].x * tab_view_size[0] / image_width);
json_data += ',"y3": ' + Math.round(points_array_0[2].y * tab_view_size[1] / image_height);
json_data += ',"x4": ' + Math.round(points_array_0[3].x * tab_view_size[0] / image_width);
json_data += ',"y4": ' + Math.round(points_array_0[3].y * tab_view_size[1] / image_height);
json_data += ',"x5": ' + Math.round(points_array_0[4].x * tab_view_size[0] / image_width);
json_data += ',"y5": ' + Math.round(points_array_0[4].y * tab_view_size[1] / image_height);
json_data += ',"x6": ' + Math.round(points_array_0[5].x * tab_view_size[0] / image_width);
json_data += ',"y6": ' + Math.round(points_array_0[5].y * tab_view_size[1] / image_height);
json_data += '},';
json_data += '{"enable_direction1": "' + enable_direction[1];
json_data += '","direction1": "' + func_get_direction(1).toString();
json_data += '","point_number": ' + points_num_1;
json_data += ',"x1": ' + Math.round(points_array_1[0].x * tab_view_size[0] / image_width);
json_data += ',"y1": ' + Math.round(points_array_1[0].y * tab_view_size[1] / image_height);
json_data += ',"x2": ' + Math.round(points_array_1[1].x * tab_view_size[0] / image_width);
json_data += ',"y2": ' + Math.round(points_array_1[1].y * tab_view_size[1] / image_height);
json_data += ',"x3": ' + Math.round(points_array_1[2].x * tab_view_size[0] / image_width);
json_data += ',"y3": ' + Math.round(points_array_1[2].y * tab_view_size[1] / image_height);
json_data += ',"x4": ' + Math.round(points_array_1[3].x * tab_view_size[0] / image_width);
json_data += ',"y4": ' + Math.round(points_array_1[3].y * tab_view_size[1] / image_height);
json_data += ',"x5": ' + Math.round(points_array_1[4].x * tab_view_size[0] / image_width);
json_data += ',"y5": ' + Math.round(points_array_1[4].y * tab_view_size[1] / image_height);
json_data += ',"x6": ' + Math.round(points_array_1[5].x * tab_view_size[0] / image_width);
json_data += ',"y6": ' + Math.round(points_array_1[5].y * tab_view_size[1] / image_height);
json_data += '},';
json_data += '{"enable_direction1": "' + enable_direction[2];
json_data += '","direction1": "' + func_get_direction(2).toString();
json_data += '","point_number": ' + points_num_2;
json_data += ',"x1": ' + Math.round(points_array_2[0].x * tab_view_size[0] / image_width);
json_data += ',"y1": ' + Math.round(points_array_2[0].y * tab_view_size[1] / image_height);
json_data += ',"x2": ' + Math.round(points_array_2[1].x * tab_view_size[0] / image_width);
json_data += ',"y2": ' + Math.round(points_array_2[1].y * tab_view_size[1] / image_height);
json_data += ',"x3": ' + Math.round(points_array_2[2].x * tab_view_size[0] / image_width);
json_data += ',"y3": ' + Math.round(points_array_2[2].y * tab_view_size[1] / image_height);
json_data += ',"x4": ' + Math.round(points_array_2[3].x * tab_view_size[0] / image_width);
json_data += ',"y4": ' + Math.round(points_array_2[3].y * tab_view_size[1] / image_height);
json_data += ',"x5": ' + Math.round(points_array_2[4].x * tab_view_size[0] / image_width);
json_data += ',"y5": ' + Math.round(points_array_2[4].y * tab_view_size[1] / image_height);
json_data += ',"x6": ' + Math.round(points_array_2[5].x * tab_view_size[0] / image_width);
json_data += ',"y6": ' + Math.round(points_array_2[5].y * tab_view_size[1] / image_height);
json_data += '},';
json_data += '{"enable_direction1": "' + enable_direction[3];
json_data += '","direction1": "' + func_get_direction(3).toString();
json_data += '","point_number": ' + points_num_3;
json_data += ',"x1": ' + Math.round(points_array_3[0].x * tab_view_size[0] / image_width);
json_data += ',"y1": ' + Math.round(points_array_3[0].y * tab_view_size[1] / image_height);
json_data += ',"x2": ' + Math.round(points_array_3[1].x * tab_view_size[0] / image_width);
json_data += ',"y2": ' + Math.round(points_array_3[1].y * tab_view_size[1] / image_height);
json_data += ',"x3": ' + Math.round(points_array_3[2].x * tab_view_size[0] / image_width);
json_data += ',"y3": ' + Math.round(points_array_3[2].y * tab_view_size[1] / image_height);
json_data += ',"x4": ' + Math.round(points_array_3[3].x * tab_view_size[0] / image_width);
json_data += ',"y4": ' + Math.round(points_array_3[3].y * tab_view_size[1] / image_height);
json_data += ',"x5": ' + Math.round(points_array_3[4].x * tab_view_size[0] / image_width);
json_data += ',"y5": ' + Math.round(points_array_3[4].y * tab_view_size[1] / image_height);
json_data += ',"x6": ' + Math.round(points_array_3[5].x * tab_view_size[0] / image_width);
json_data += ',"y6": ' + Math.round(points_array_3[5].y * tab_view_size[1] / image_height);
json_data += '},';
json_data += '{"enable_direction1": "' + enable_direction[4];
json_data += '","direction1": "' + func_get_direction(4).toString();
json_data += '","point_number": ' + points_num_4;
json_data += ',"x1": ' + Math.round(points_array_4[0].x * tab_view_size[0] / image_width);
json_data += ',"y1": ' + Math.round(points_array_4[0].y * tab_view_size[1] / image_height);
json_data += ',"x2": ' + Math.round(points_array_4[1].x * tab_view_size[0] / image_width);
json_data += ',"y2": ' + Math.round(points_array_4[1].y * tab_view_size[1] / image_height);
json_data += ',"x3": ' + Math.round(points_array_4[2].x * tab_view_size[0] / image_width);
json_data += ',"y3": ' + Math.round(points_array_4[2].y * tab_view_size[1] / image_height);
json_data += ',"x4": ' + Math.round(points_array_4[3].x * tab_view_size[0] / image_width);
json_data += ',"y4": ' + Math.round(points_array_4[3].y * tab_view_size[1] / image_height);
json_data += ',"x5": ' + Math.round(points_array_4[4].x * tab_view_size[0] / image_width);
json_data += ',"y5": ' + Math.round(points_array_4[4].y * tab_view_size[1] / image_height);
json_data += ',"x6": ' + Math.round(points_array_4[5].x * tab_view_size[0] / image_width);
json_data += ',"y6": ' + Math.round(points_array_4[5].y * tab_view_size[1] / image_height);
json_data += '},';
json_data += '{"enable_direction1": "' + enable_direction[5];
json_data += '","direction1": "' + func_get_direction(5).toString();
json_data += '","point_number": ' + points_num_5;
json_data += ',"x1": ' + Math.round(points_array_5[0].x * tab_view_size[0] / image_width);
json_data += ',"y1": ' + Math.round(points_array_5[0].y * tab_view_size[1] / image_height);
json_data += ',"x2": ' + Math.round(points_array_5[1].x * tab_view_size[0] / image_width);
json_data += ',"y2": ' + Math.round(points_array_5[1].y * tab_view_size[1] / image_height);
json_data += ',"x3": ' + Math.round(points_array_5[2].x * tab_view_size[0] / image_width);
json_data += ',"y3": ' + Math.round(points_array_5[2].y * tab_view_size[1] / image_height);
json_data += ',"x4": ' + Math.round(points_array_5[3].x * tab_view_size[0] / image_width);
json_data += ',"y4": ' + Math.round(points_array_5[3].y * tab_view_size[1] / image_height);
json_data += ',"x5": ' + Math.round(points_array_5[4].x * tab_view_size[0] / image_width);
json_data += ',"y5": ' + Math.round(points_array_5[4].y * tab_view_size[1] / image_height);
json_data += ',"x6": ' + Math.round(points_array_5[5].x * tab_view_size[0] / image_width);
json_data += ',"y6": ' + Math.round(points_array_5[5].y * tab_view_size[1] / image_height);
json_data += '},';
json_data += '{"enable_direction1": "' + enable_direction[6];
json_data += '","direction1": "' + func_get_direction(6).toString();
json_data += '","point_number": ' + points_num_6;
json_data += ',"x1": ' + Math.round(points_array_6[0].x * tab_view_size[0] / image_width);
json_data += ',"y1": ' + Math.round(points_array_6[0].y * tab_view_size[1] / image_height);
json_data += ',"x2": ' + Math.round(points_array_6[1].x * tab_view_size[0] / image_width);
json_data += ',"y2": ' + Math.round(points_array_6[1].y * tab_view_size[1] / image_height);
json_data += ',"x3": ' + Math.round(points_array_6[2].x * tab_view_size[0] / image_width);
json_data += ',"y3": ' + Math.round(points_array_6[2].y * tab_view_size[1] / image_height);
json_data += ',"x4": ' + Math.round(points_array_6[3].x * tab_view_size[0] / image_width);
json_data += ',"y4": ' + Math.round(points_array_6[3].y * tab_view_size[1] / image_height);
json_data += ',"x5": ' + Math.round(points_array_6[4].x * tab_view_size[0] / image_width);
json_data += ',"y5": ' + Math.round(points_array_6[4].y * tab_view_size[1] / image_height);
json_data += ',"x6": ' + Math.round(points_array_6[5].x * tab_view_size[0] / image_width);
json_data += ',"y6": ' + Math.round(points_array_6[5].y * tab_view_size[1] / image_height);
json_data += '},';
json_data += '{"enable_direction1": "' + enable_direction[7];
json_data += '","direction1": "' + func_get_direction(7).toString();
json_data += '","point_number": ' + points_num_7;
json_data += ',"x1": ' + Math.round(points_array_7[0].x * tab_view_size[0] / image_width);
json_data += ',"y1": ' + Math.round(points_array_7[0].y * tab_view_size[1] / image_height);
json_data += ',"x2": ' + Math.round(points_array_7[1].x * tab_view_size[0] / image_width);
json_data += ',"y2": ' + Math.round(points_array_7[1].y * tab_view_size[1] / image_height);
json_data += ',"x3": ' + Math.round(points_array_7[2].x * tab_view_size[0] / image_width);
json_data += ',"y3": ' + Math.round(points_array_7[2].y * tab_view_size[1] / image_height);
json_data += ',"x4": ' + Math.round(points_array_7[3].x * tab_view_size[0] / image_width);
json_data += ',"y4": ' + Math.round(points_array_7[3].y * tab_view_size[1] / image_height);
json_data += ',"x5": ' + Math.round(points_array_7[4].x * tab_view_size[0] / image_width);
json_data += ',"y5": ' + Math.round(points_array_7[4].y * tab_view_size[1] / image_height);
json_data += ',"x6": ' + Math.round(points_array_7[5].x * tab_view_size[0] / image_width);
json_data += ',"y6": ' + Math.round(points_array_7[5].y * tab_view_size[1] / image_height);
json_data += '}]}}}';
// console.log("json_data:");
// console.log(json_data);
// console.log("------------------------------------------------");
func_setconfigfile(json_data);
/*
var text_checked_trigger_events = new Array(MAX_DETECTION_ZONE);
var text_checked_post_event_name = new Array(MAX_DETECTION_ZONE);
var text_detect_event_id = new Array(MAX_DETECTION_ZONE);
for (var i = 0; i < MAX_DETECTION_ZONE; i++) {
text_detect_event_id[i] = "0x00000000";
text_checked_trigger_events[i] = "0";
text_checked_post_event_name[i] = "";
}
for (var i = 0; i < count_zone; i++) {
for (var j = 0; j < MAX_SIZE_IDC_LIST_TRIGGER_EVENTS; j++) {
if (checked_trigger_events[i][j] == 1) {
text_detect_event_id[i] = DETECT_EVENT_ID_ARRAY[j];
text_checked_trigger_events[i] = checked_trigger_events[i][j].toString();
text_checked_post_event_name[i] = checked_post_event_name[i][j];
break;
}
}
}
var json_data_trigger = '{"view_setting":{"camera01":{"detection_zone":[';
for (var i = 0; i < count_zone; i++) {
json_data_trigger += '{"trigger_events": [{"checked":' + text_checked_trigger_events[i] + ',"detect_event_id": "' + text_detect_event_id[i] + '","post_event_name": "' + text_checked_post_event_name[i] + '"}]}';
if (i < count_zone - 1) {
json_data_trigger += ',';
}
}
json_data_trigger += ']}}}';
console.log("json_data_trigger:");
console.log(json_data_trigger);
console.log("------------------------------------------------");
func_setconfigfile(json_data_trigger);
*/
localStorage.setItem('speed_index_success', 'Null');
localStorage.setItem('setting_success', 'Null');
//g_luckalarmui = value_luckalarmui * 0.9;
if (no_parking_time_in_minute[get_current_index_zone()] == "0") {
$('#no_parking_time').slider({ disabled: false });
}
else {
$('#no_parking_time').slider({ disabled: true });
}
k_index = 94;
}
else if (k_index == 95) {
//g_luckalarmui = value_luckalarmui * 0.3;
//waitSeconds(500);
//func_getreload();
//k_index = 95;
}
else if (k_index == 100) {
func_run_osd_server();
var alert_message_check_current_resolution = 0;
for (var i = 0; i < count_zone; i++) {
if ((metadata1[i].indexOf("barcode") >= 0 || metadata1[i].indexOf("qrcode") >= 0) && check_current_resolution == 0) {
alert_message_check_current_resolution = 1;
break;
}
}
if (alert_message_check_current_resolution == 1) {
alert(message_check_current_resolution);
}
$(".progress-bar").css("visibility", "hidden");
//$(".progress-bar").css("width", "0%").text("0 %");
$(".progress-bar").css("width", "0%");
k_index = -1;
g_check_if_run_setting = 0;
}
// Wait for sometime before running this script again
setTimeout("makeProgress()", 200);
}
}
function makeProgress_counter() {
if (k_index < 100 && k_index >= 0) {
k_index = k_index + 1;
$(".progress-bar").css("visibility", "visible");
//$(".progress-bar").css("width", k_index + "%").text(k_index + " %");
$(".progress-bar").css("width", k_index + "%");
console.log("k_index:" + k_index.toString());
if (k_index == 1) {
g_check_if_run_setting = 1;
$('html, body').scrollTop(0);
func_getCurrentEventsData();
func_set_zone_data();
localStorage.setItem('count_zone', count_zone);
var temp_text_clear_trigger_event_counter = get_text_to_clear_config_trigger_event_counter();
var json_data = '{"view_setting":{"camera01":{"detection_zone":[';
for (var index_zone = 0; index_zone < MAX_DETECTION_ZONE; index_zone++) {
json_data += '{"trigger_events": [' + temp_text_clear_trigger_event_counter + ']' + '}';
if (index_zone < MAX_DETECTION_ZONE - 1) {
json_data += ',';
}
}
json_data += ']}}}';
//console.log(json_data);
func_setconfigfile(json_data);
//MAX_SIZE_COUNTERS
var text_reset_time_interval = new Array(MAX_SIZE_COUNTERS);
var text_enable_reset_time_interval = new Array(MAX_SIZE_COUNTERS);
var text_link_to_post_event_name = new Array(MAX_SIZE_COUNTERS);
for (var index_text = 0; index_text < MAX_SIZE_COUNTERS; index_text++) {
if (reset_time_interval[index_text] != "No") {
text_reset_time_interval[index_text] = reset_time_interval[index_text];
text_enable_reset_time_interval[index_text] = "Yes";
}
else {
text_reset_time_interval[index_text] = "NULL";
text_enable_reset_time_interval[index_text] = "No";
}
if (link_to_post_event_name[index_text] >= 0 && link_to_post_event_name[index_text] < MAX_SIZE_POST)
text_link_to_post_event_name[index_text] = post_event_name[link_to_post_event_name[index_text]];
else if (/*enable_cloud == "Yes" && */link_to_post_event_name[index_text] >= MAX_SIZE_POST && link_to_post_event_name[index_text] < MAX_SIZE_POST + MAX_SIZE_SNMP_POST)
{
text_link_to_post_event_name[index_text] = snmp_event_name[link_to_post_event_name[index_text] - MAX_SIZE_POST];
}
else
text_link_to_post_event_name[index_text] = "NULL";
}
var json_data_events = '{"event_counter_setting":{"event_counters":[';
for (var index_counter = 0; index_counter < MAX_SIZE_COUNTERS; index_counter++) {
json_data_events += '{"counter_name":"Counter0' + (index_counter + 1).toString() + '","reset_value":"' + reset_value[index_counter] + '","enable_linked_to_dwell_time":"' + enable_linked_to_dwell_time[index_counter] + '","enable_reset_time_interval":"' + text_enable_reset_time_interval[index_counter] + '","reset_time_interval": "' + text_reset_time_interval[index_counter] + '","link_to_post_event_name":"' + text_link_to_post_event_name[index_counter] + '","counter_cust_name":"' + counter_cust_name[index_counter] + '","post_interval":"' + post_interval[index_counter] + '"}';
if (index_counter < MAX_SIZE_COUNTERS - 1) {
json_data_events += ',';
}
}
json_data_events += ']}}';
func_seteventsfile(json_data_events);
var text_selected_counter_name = new Array(MAX_DETECTION_ZONE);
var text_selected_counter_increment = new Array(MAX_DETECTION_ZONE);
var text_checked_trigger_events = new Array(MAX_DETECTION_ZONE);
var text_checked_post_event_name = new Array(MAX_DETECTION_ZONE);
var text_detect_event_id = new Array(MAX_DETECTION_ZONE);
for (var i = 0; i < MAX_DETECTION_ZONE; i++) {
text_detect_event_id[i] = "0x00000000";
text_checked_trigger_events[i] = "0";
text_checked_post_event_name[i] = "";
text_selected_counter_name[i] = "";
text_selected_counter_increment[i] = "";
}
for (var i = 0; i < count_zone; i++) {
for (var j = 0; j < MAX_SIZE_IDC_LIST_TRIGGER_EVENTS; j++) {
if (checked_trigger_events[i][j] == 1) {
text_detect_event_id[i] = DETECT_EVENT_ID_ARRAY[j];
text_checked_trigger_events[i] = checked_trigger_events[i][j].toString();
text_checked_post_event_name[i] = checked_post_event_name[i][j];
//func_setelement_detection_zone_trigger_events("checked", checked_trigger_events[i][j].toString(), (i).toString(), (j).toString());
//func_setelement_detection_zone_trigger_events("post_event_name", checked_post_event_name[i][j], (i).toString(), (j).toString());
if (selected_counter_name[i][j] != "NULL" &&
(
selected_counter_increment[i][j] == "counter_increment_add" ||
selected_counter_increment[i][j] == "counter_increment_minus" ||
selected_counter_increment[i][j] == "counter_increment_equal"
)) {
text_selected_counter_name[i] = selected_counter_name[i][j];
text_selected_counter_increment[i] = selected_counter_increment[i][j];
//func_setelement_detection_zone_trigger_events("counter_name", selected_counter_name[i][j], (i).toString(), (j).toString());
//func_setelement_detection_zone_trigger_events("counter_increment", selected_counter_increment[i][j], (i).toString(), (j).toString());
}
else {
text_selected_counter_name[i] = "NULL";
text_selected_counter_increment[i] = "NULL";
//func_setelement_detection_zone_trigger_events("counter_name", "NULL", (i).toString(), (j).toString());
//func_setelement_detection_zone_trigger_events("counter_increment", "NULL", (i).toString(), (j).toString());
}
break;
}
}
}
var json_data_trigger = '{"view_setting":{"camera01":{"detection_zone":[';
for (var i = 0; i < count_zone; i++) {
if (i == count_zone - 1) {
json_data_trigger += '{"queuing_count": "' + queuing_count[i] + '","trigger_events": [{"checked":' + text_checked_trigger_events[i] + ',"detect_event_id": "' + text_detect_event_id[i] + '","counter_name": "' + text_selected_counter_name[i] + '","counter_increment": "' + text_selected_counter_increment[i] + '"}]}';
}
else {
json_data_trigger += '{"queuing_count": "' + queuing_count[i] + '","trigger_events": [{"checked":' + text_checked_trigger_events[i] + ',"detect_event_id": "' + text_detect_event_id[i] + '","counter_name": "' + text_selected_counter_name[i] + '","counter_increment": "' + text_selected_counter_increment[i] + '"}]},';
}
}
json_data_trigger += ']}}}';
func_setconfigfile(json_data_trigger);
localStorage.setItem('speed_index_success', 'Null');
localStorage.setItem('setting_success', 'Null');
//g_luckalarmui = value_luckalarmui * 0.9;
if (no_parking_time_in_minute[get_current_index_zone()] == "0") {
$('#no_parking_time').slider({ disabled: false });
}
else {
$('#no_parking_time').slider({ disabled: true });
}
func_showCountersData();
k_index = 94;
}
else if (k_index == 95) {
//g_luckalarmui = value_luckalarmui * 0.3;
//waitSeconds(500);
//func_getreload();
//k_index = 95;
}
else if (k_index == 100) {
func_run_osd_server();
$(".progress-bar").css("visibility", "hidden");
//$(".progress-bar").css("width", "0%").text("0 %");
$(".progress-bar").css("width", "0%");
k_index = -1;
g_check_if_run_setting = 0;
}
// Wait for sometime before running this script again
setTimeout("makeProgress_counter()", 200);
}
}
function makeProgress_track() {
if (k_index < 100 && k_index >= 0) {
k_index = k_index + 1;
$(".progress-bar").css("visibility", "visible");
//$(".progress-bar").css("width", k_index + "%").text(k_index + " %");
$(".progress-bar").css("width", k_index + "%");
console.log("k_index:" + k_index.toString());
if (k_index == 1) {
g_check_if_run_setting = 1;
$('html, body').scrollTop(0);
if ($('#enable_track').is(":checked")) {
enable_track = "Yes";
}
else {
enable_track = "No";
}
var json_data = '{"view_setting":{"camera01":{"enable_track": "' + enable_track + '"}}}';
func_setconfigfile(json_data);
k_index = 94;
}
else if (k_index == 95) {
//g_luckalarmui = value_luckalarmui * 0.3;
//waitSeconds(500);
//func_getreload();
//k_index = 95;
}
else if (k_index == 100) {
//func_run_osd_server();
$(".progress-bar").css("visibility", "hidden");
//$(".progress-bar").css("width", "0%").text("0 %");
$(".progress-bar").css("width", "0%");
k_index = -1;
g_check_if_run_setting = 0;
}
// Wait for sometime before running this script again
setTimeout("makeProgress_track()", 200);
}
}
/*
function getDevicePixelRatio() {
var mediaQuery;
var is_firefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
if (window.devicePixelRatio !== undefined && !is_firefox) {
//alert(window.devicePixelRatio);
document.body.style.zoom = 1 / window.devicePixelRatio;
return window.devicePixelRatio;
} else if (window.matchMedia) {
mediaQuery = "(-webkit-min-device-pixel-ratio: 1.5),\
(min--moz-device-pixel-ratio: 1.5),\
(-o-min-device-pixel-ratio: 3/2),\
(min-resolution: 1.5dppx)";
if (window.matchMedia(mediaQuery).matches) {
document.body.style.zoom = 1 / 1.5;
return 1.5;
}
mediaQuery = "(-webkit-min-device-pixel-ratio: 2),\
(min--moz-device-pixel-ratio: 2),\
(-o-min-device-pixel-ratio: 2/1),\
(min-resolution: 2dppx)";
if (window.matchMedia(mediaQuery).matches) {
document.body.style.zoom = 1 / 2;
return 2;
}
mediaQuery = "(-webkit-min-device-pixel-ratio: 0.75),\
(min--moz-device-pixel-ratio: 0.75),\
(-o-min-device-pixel-ratio: 3/4),\
(min-resolution: 0.75dppx)";
if (window.matchMedia(mediaQuery).matches) {
document.body.style.zoom = 1 / 0.7;
return 0.7;
}
} else {
return 1;
}
}
*/
function func_set_cold() {
console.log("[func_set_cold] start");
func_show_all_zone();
current_cold = "set";
change_color_of_button_cold();
}
function func_set_mouse_cold() {
console.log("[func_set_mouse_cold] start");
func_show_all_zone();
current_cold = "mouse";
change_color_of_button_cold();
}
function func_show_cold() {
if (current_cold != "show") {
func_get_coldobjects();
current_cold = "show";
change_color_of_button_cold();
}
else {
current_cold = "NULL";
change_color_of_button_cold();
}
}
function func_clean_cold() {
if (confirm(message_alert_clean)) {
func_clean_coldobjects();
current_cold = "clean";
change_color_of_button_cold();
}
}
var isMouseDown,tool;
$('#button_set_mouse_coldobjects').click(function () {
tool = 'square';
console.log("button_set_mouse_coldobjects clicked , tool: ", tool);
canvasTripwire_all.selection = false;
changeStatus(false);
//register mouse event
// canvas.isDrawingMode = true;
//canvas.freeDrawingBrush.color = 'transparent';
//canvas.isDrawingMode = false;
canvasTripwire_all.on('mouse:down', onMouseDown);
canvasTripwire_all.on('mouse:move', onMouseMove);
canvasTripwire_all.on('mouse:up', onMouseUp);
});
function onMouseDown(o) {
console.warn('clicked');
isMouseDown = true;
var pointer = canvasTripwire_all.getPointer(o.e);
if (tool == 'square') {
rect = new fabric.Rect({
left: pointer.x,
top: pointer.y,
width: 0.1,
height: 0.1,
stroke: 'blue',
strokeWidth: 3,
selectable: false,
fill: ''
});
canvasTripwire_all.add(rect);
}
}
function changeStatus(val) {
canvasTripwire_all.forEachObject(function (obj) {
obj.selectable = val;
})
canvasTripwire_all.renderAll();
}
function onMouseMove(o) {
if (!isMouseDown) {
return;
}
var pointer = canvasTripwire_all.getPointer(o.e);
if (tool == 'square') {
var mouse_width = 0;
var mouse_height = 0;
if (rect.left <= 10 || pointer.x <= 10) {
mouse_width = 0.1
}
else if (rect.left >= MAX_WIDTH - 10 || pointer.x >= MAX_WIDTH - 10) {
mouse_width = 0.1
}
else if ((pointer.x - rect.left) <= 0) {
mouse_width = 0.1
}
else {
mouse_width = (pointer.x - rect.left);
}
if (rect.top <= 10 || pointer.y <= 10) {
mouse_height = 0.1
}
else if (rect.top >= MAX_HEIGHT - 10 || pointer.y >= MAX_HEIGHT - 10) {
mouse_height = 0.1
}
else if ((pointer.y - rect.top) <= 0) {
mouse_height = 0.1
}
else {
mouse_height = (pointer.y - rect.top);
}
rect.set({
width: mouse_width,
height: mouse_height
});
canvasTripwire_all.renderAll();
}
}
function onMouseUp(o) {
console.log("[onMouseUp] isMouseDown:", isMouseDown);
if (tool == 'square') {
rect.setCoords();
console.log(rect);
}
isMouseDown = false;
if (typeof canvasTripwire_all !== 'undefined') {
console.log("[onMouseUp] #metadata_mouse_coldobjects val:", $('#metadata_mouse_coldobjects').val());
var items = canvasTripwire_all.getObjects();
if (items[canvasTripwire_all.getObjects().length - 1].width * items[canvasTripwire_all.getObjects().length - 1].height < 50) {
canvasTripwire_all.remove(items[canvasTripwire_all.getObjects().length - 1]);
canvasTripwire_all.renderAll();
}
else if ($('#metadata_mouse_coldobjects').val() != null && $('#metadata_mouse_coldobjects').val().length >= 1) {
var r_left = items[canvasTripwire_all.getObjects().length - 1].left;
var r_top = items[canvasTripwire_all.getObjects().length - 1].top;
var r_width = items[canvasTripwire_all.getObjects().length - 1].width;
var r_height = items[canvasTripwire_all.getObjects().length - 1].height;
var r_name = $('#metadata_mouse_coldobjects').val();
console.log("G_CAM_VIDEO_RES_WIDTH:", G_CAM_VIDEO_RES_WIDTH);
console.log("G_CAM_VIDEO_RES_HEIGHT:", G_CAM_VIDEO_RES_HEIGHT);
console.log("MAX_WIDTH:", MAX_WIDTH);
console.log("MAX_HEIGHT:", MAX_HEIGHT);
var selected_left = r_left * G_CAM_VIDEO_RES_WIDTH / MAX_WIDTH - 20;
var selected_top = r_top * G_CAM_VIDEO_RES_HEIGHT / MAX_HEIGHT - 20;
var selected_width = r_width * G_CAM_VIDEO_RES_WIDTH / MAX_WIDTH + 40;
var selected_height = r_height * G_CAM_VIDEO_RES_HEIGHT / MAX_HEIGHT + 40;
if (selected_left < 10)
selected_left = 10;
if (selected_top < 10)
selected_top = 10;
if (selected_width > G_CAM_VIDEO_RES_WIDTH - 20)
selected_width = G_CAM_VIDEO_RES_WIDTH - 20;
if (selected_height > G_CAM_VIDEO_RES_HEIGHT - 20)
selected_height = G_CAM_VIDEO_RES_HEIGHT - 20;
// 08-26
selected_left = selected_left.toFixed(3);
selected_top = selected_top.toFixed(3);
selected_width = selected_width.toFixed(3);
selected_height = selected_height.toFixed(3);
func_set_coldobjects(selected_left, selected_top, selected_width, selected_height, r_name);
}
}
}
function change_color_of_button_cold() {
if (current_cold === "set") {
document.getElementById("button_set_coldobjects").style.background = "#6c87d4";
document.getElementById("button_show_coldobjects").style.background = "#BABABA";
document.getElementById("button_clean_coldobjects").style.background = "#BABABA";
document.getElementById("button_set_mouse_coldobjects").style.background = "#BABABA";
document.getElementById("button_set_coldobjects").style.borderColor = "#6c87d4";
document.getElementById("button_show_coldobjects").style.borderColor = "#BABABA";
document.getElementById("button_clean_coldobjects").style.borderColor = "#BABABA";
document.getElementById("button_set_mouse_coldobjects").style.borderColor = "#BABABA";
document.getElementById("button_set_coldobjects").style.color = "white";
document.getElementById("button_show_coldobjects").style.color = "black";
document.getElementById("button_clean_coldobjects").style.color = "black";
document.getElementById("button_set_mouse_coldobjects").style.color = "black";
click_cold_set = 1;
click_mouse_set = 0;
check_if_existing_coldobjects = 0;
canvasTripwire_all.off('mouse:down', onMouseDown);
canvasTripwire_all.off('mouse:move', onMouseMove);
canvasTripwire_all.off('mouse:up', onMouseUp);
}
else if (current_cold === "show") {
document.getElementById("button_set_coldobjects").style.background = "#BABABA";
document.getElementById("button_show_coldobjects").style.background = "#6c87d4";
document.getElementById("button_clean_coldobjects").style.background = "#BABABA";
document.getElementById("button_set_mouse_coldobjects").style.background = "#BABABA";
document.getElementById("button_set_coldobjects").style.borderColor = "#BABABA";
document.getElementById("button_show_coldobjects").style.borderColor = "#6c87d4";
document.getElementById("button_clean_coldobjects").style.borderColor = "#BABABA";
document.getElementById("button_set_mouse_coldobjects").style.borderColor = "#BABABA";
document.getElementById("button_set_coldobjects").style.color = "black";
document.getElementById("button_show_coldobjects").style.color = "white";
document.getElementById("button_clean_coldobjects").style.color = "black";
document.getElementById("button_set_mouse_coldobjects").style.color = "black";
click_cold_set = 0;
click_mouse_set = 0;
canvasTripwire_all.off('mouse:down', onMouseDown);
canvasTripwire_all.off('mouse:move', onMouseMove);
canvasTripwire_all.off('mouse:up', onMouseUp);
}
else if (current_cold === "clean") {
document.getElementById("button_set_coldobjects").style.background = "#BABABA";
document.getElementById("button_show_coldobjects").style.background = "#BABABA";
document.getElementById("button_clean_coldobjects").style.background = "#6c87d4";
document.getElementById("button_set_mouse_coldobjects").style.background = "#BABABA";
document.getElementById("button_set_coldobjects").style.borderColor = "#BABABA";
document.getElementById("button_show_coldobjects").style.borderColor = "#BABABA";
document.getElementById("button_clean_coldobjects").style.borderColor = "#6c87d4";
document.getElementById("button_set_mouse_coldobjects").style.borderColor = "#BABABA";
document.getElementById("button_set_coldobjects").style.color = "black";
document.getElementById("button_show_coldobjects").style.color = "black";
document.getElementById("button_clean_coldobjects").style.color = "white";
document.getElementById("button_set_mouse_coldobjects").style.color = "black";
click_cold_set = 0;
click_mouse_set = 0;
check_if_existing_coldobjects = 0;
canvasTripwire_all.off('mouse:down', onMouseDown);
canvasTripwire_all.off('mouse:move', onMouseMove);
canvasTripwire_all.off('mouse:up', onMouseUp);
}
else if (current_cold === "mouse") {
document.getElementById("button_set_coldobjects").style.background = "#BABABA";
document.getElementById("button_show_coldobjects").style.background = "#BABABA";
document.getElementById("button_clean_coldobjects").style.background = "#BABABA";
document.getElementById("button_set_mouse_coldobjects").style.background = "#6c87d4";
document.getElementById("button_set_coldobjects").style.borderColor = "#BABABA";
document.getElementById("button_show_coldobjects").style.borderColor = "#BABABA";
document.getElementById("button_clean_coldobjects").style.borderColor = "#BABABA";
document.getElementById("button_set_mouse_coldobjects").style.borderColor = "#6c87d4";
document.getElementById("button_set_coldobjects").style.color = "black";
document.getElementById("button_show_coldobjects").style.color = "black";
document.getElementById("button_clean_coldobjects").style.color = "black";
document.getElementById("button_set_mouse_coldobjects").style.color = "white";
click_cold_set = 0;
click_mouse_set = 1;
check_if_existing_coldobjects = 0;
}
else {
document.getElementById("button_set_coldobjects").style.background = "#BABABA";
document.getElementById("button_show_coldobjects").style.background = "#BABABA";
document.getElementById("button_clean_coldobjects").style.background = "#BABABA";
document.getElementById("button_set_mouse_coldobjects").style.background = "#BABABA";
document.getElementById("button_set_coldobjects").style.borderColor = "#BABABA";
document.getElementById("button_show_coldobjects").style.borderColor = "#BABABA";
document.getElementById("button_clean_coldobjects").style.borderColor = "#BABABA";
document.getElementById("button_set_mouse_coldobjects").style.borderColor = "#BABABA";
document.getElementById("button_set_coldobjects").style.color = "black";
document.getElementById("button_show_coldobjects").style.color = "black";
document.getElementById("button_clean_coldobjects").style.color = "black";
document.getElementById("button_set_mouse_coldobjects").style.color = "black";
click_cold_set = 0;
click_mouse_set = 0;
check_if_existing_coldobjects = 0;
canvasTripwire_all.off('mouse:down', onMouseDown);
canvasTripwire_all.off('mouse:move', onMouseMove);
canvasTripwire_all.off('mouse:up', onMouseUp);
}
}
function show_tof_map(){
var colorBarRuler = null;
var rangeMax = 7.4;
var canvasDiv = $("#CanvasTripwire1").parent().parent().parent();
var canvasH = canvasDiv.height();
// 2022-12-19 Ken tof color bar
if (localStorage.getItem("ToF_recognition") === "Yes") {
// console.log("localStorage - ToF_recognition: ", localStorage.getItem("ToF_recognition"));
// create inline div for ruler
canvasDiv.css("display", "inline-block");
canvasDiv.after('<div id="colorBarDiv" style="display: inline-block; vertical-align:top;"> <div id="colorMap"></div> </div>');
var margeLeft = 15;
$("#colorMap").css("margin-left", margeLeft.toString()+"px");
$("#colorMap").css("height", canvasH.toString()+"px");
$("#colorMap").css("width", margeLeft.toString()+"px");
$("#colorMap").css("background-image", "linear-gradient(to bottom, red,orange,yellow,chartreuse,green,aqua,blue,blueViolet,violet,magenta)"); // HSV color map
var textBoxWidth = "250px";
var tofMinMaxTextHeight = 16;
var color_map_height = canvasH - (tofMinMaxTextHeight * 2);
$("#colorMap").append('<div id="tofMin" style="display: inline-block; width: ' + textBoxWidth + '; height:' + tofMinMaxTextHeight.toString() + 'px; margin-left:' + (margeLeft + 5).toString() +'px;"></div>');
$("#tofMin").append('<div>0.3M 0.984Ft</div>');
//var tof_current_min_Height = 30;
$("#colorMap").append('<div id="tof_current_min" style="display: inline-block; width: ' + textBoxWidth + '; height:' + tofMinMaxTextHeight.toString() + 'px; margin-left:' + (margeLeft + 5).toString() + 'px;margin-top:' + (color_map_height*0.333-10).toString() +'px"></div>');
$("#tof_current_min").append('<div>Min:1.4M&ensp;4.592Ft</div>');
$("#colorMap").append('<div id="tof_current_max" style="display: inline-block; width: ' + textBoxWidth + '; height:' + tofMinMaxTextHeight.toString() + 'px; margin-left:' + (margeLeft + 5).toString() + 'px;margin-top:' + (color_map_height * 0.333 - 10).toString() + 'px"></div>');
$("#tof_current_max").append('<div>Max:6M&ensp;19.68Ft</div>');
$("#colorMap").append('<div id="tofMax" style="display: inline-block; width: ' + textBoxWidth + '; height:' + tofMinMaxTextHeight.toString() + 'px; margin-left:' + (margeLeft + 5).toString() + 'px; margin-top:' + (color_map_height*0.333-10).toString()+'px"></div>');
$("#tofMax").append('<div>7.4M&ensp;24.272Ft</div>');
}
}
function get_text_to_clear_config_trigger_event() {
var json_data = '{"checked": 0,"detect_event_id": "0x00000001","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x00000004","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x00200000","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x00400000","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x00000008","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x00000010","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x00000020","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x10000000","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x20000000","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x00800000","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x01000000","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x02000000","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x04000000","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x40000000","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x80000000","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x00002000","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x00004000","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x00000400","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x00000800","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x00001000","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x00008000","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x00040000","post_event_name": ""}, {"checked": 0,"detect_event_id": "0x08000000","post_event_name": ""}';
return json_data;
}
function get_text_to_clear_config_trigger_event_counter() {
var json_data = '{"detect_event_id": "0x00000001","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x00000004","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x00200000","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x00400000","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x00000008","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x00000010","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x00000020","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x10000000","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x20000000","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x00800000","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x01000000","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x02000000","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x04000000","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x40000000","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x80000000","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x00002000","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x00004000","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x00000400","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x00000800","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x00001000","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x00008000","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x00040000","counter_name": "","counter_increment": ""}, {"detect_event_id": "0x08000000","counter_name": "","counter_increment": ""}';
return json_data;
}
/*function func_hideAlarmSettingOnFace() {
var hiddenElementIDs = [
"enable_unknown_object",
"IDC_CHECK_ENABLE_UNKNOWN_OBJECT",
"btn_object",
"bar_circle"
];
for (var i = 0; i < hiddenElementIDs.length; i++) {
$("#"+hiddenElementIDs[i]).hide();
}
}
if (localStorage.getItem("Face_recognition") === "Yes") {
func_hideAlarmSettingOnFace();
}*/
function func_getaboutinfo() {
$.ajax({
url: '/airelay' + "/getAidaInfo",
type: "GET",
async: false,
beforeSend: function (xmlHttp) {
xmlHttp.setRequestHeader("If-Modified-Since", "0");
xmlHttp.setRequestHeader("Cache-Control", "no-cache");
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password"));
},
success: function (retdata) {
//var jsonbuf = JSON.parse('{ "name":"John", "age":30, "city":"New York"}');
var jsonbuf = JSON.parse(retdata);
//$('#license_status_2').val(jsonbuf["jstr1"]);
//$('#enable_anpr').prop("checked", true);
var license_status_1_temp = jsonbuf["license_status"];
var license_type_temp = jsonbuf["license_type"].substr(1, 255);
var index_mismatch = license_status_1_temp.indexOf("mismatch");
var index_expired = license_status_1_temp.indexOf("expired");
var index_error = license_type_temp.indexOf("Error");
var index_invalid = license_status_1_temp.indexOf("alid");
var index_empty = license_status_1_temp.length;
var index_third_party = license_type_temp.indexOf("arty");
var index_radar = license_type_temp.indexOf("adar");
var index_tof = license_type_temp.indexOf("ToF");
localStorage.setItem("events_default_version", jsonbuf["events_default_version"]);
if ((index_mismatch >= 2 || index_expired >= 2 || index_error >= 2 || index_empty <= 2 || index_invalid >= 2) && index_third_party <= 2 && index_radar <= 0 && index_tof < 0) {
check_key_false = 1;
}
localStorage.setItem('check_key_false', check_key_false);
localStorage.setItem("unlock_key", jsonbuf["unlock_key"]);
localStorage.setItem("sys_id", jsonbuf["sys_id"]);
localStorage.setItem("dataset_ver", jsonbuf["dataset_ver"]);
//console.log(jsonbuf["dataset_ver"]);
localStorage.setItem("soft_ver", jsonbuf["soft_ver"]);
localStorage.setItem("license_type", jsonbuf["license_type"]);
localStorage.setItem("license_status", jsonbuf["license_status"]);
//console.log(jsonbuf["license_file_content"]);
localStorage.setItem("license_file_content", jsonbuf["license_file_content"]);
//console.info(retdata);
localStorage.setItem("v_series", jsonbuf["v_series"]);
localStorage.setItem("No_brand", jsonbuf["No_brand"]);
localStorage.setItem("sdk_version", jsonbuf["sdk_version"]);
if (jsonbuf["license_type"].search("CAP") >= 1 || jsonbuf["license_type"].search("EMASK") >= 1 || jsonbuf["license_type"].search("EFRONTBACK") >= 1 || jsonbuf["license_type"].search("EDENSITY") >= 1 || jsonbuf["license_type"].search("SPORTS") >= 1 || jsonbuf["license_type"].search("ESAFTY") >= 1) {//03AI
if (localStorage.getItem("events_default_version") != null && localStorage.getItem("events_default_version") == "4")
{
localStorage.setItem("03AI", "No");
}
else
{
localStorage.setItem("03AI", "Yes");
}
}
else {
localStorage.setItem("03AI", "No");
}
if ((jsonbuf["license_type"].search("ESAFTY") >= 1 || jsonbuf["license_type"].search("ESPORTS") >= 1) && jsonbuf["license_type"].search("CAP") < 1 && jsonbuf["license_type"].search("EDENSITY") < 1 &&
jsonbuf["license_type"].search("FLOW") < 1 && jsonbuf["license_type"].search("FENCE") < 1 && jsonbuf["license_type"].search("EFRONTBACK") < 1) {
localStorage.setItem("g_IsHelm_without_car", "Yes");
}
else {
localStorage.setItem("g_IsHelm_without_car", "No");
}
if (jsonbuf["license_type"].search("hird") >= 1) {
localStorage.setItem("Third_party", "Yes");
}
else {
localStorage.setItem("Third_party", "No");
}
if (jsonbuf["license_type"].search("adar") >= 1) {
localStorage.setItem("Radar_recognition", "Yes");
check_radar = 1;
console.log("[index.html] modify check_radar value: ", check_radar);
}
else {
localStorage.setItem("Radar_recognition", "No");
}
// 2023-01-05 bypass ToF license
// localStorage.setItem("ToF_recognition", "Yes");
// check_tof = 1;
if (jsonbuf["license_type"].search("ToF") >= 1) {
localStorage.setItem("ToF_recognition", "Yes");
check_tof = 1;
}
else {
localStorage.setItem("ToF_recognition", "No");
}
if (jsonbuf["license_type"].search("LPR") >= 1) {//06AI
localStorage.setItem("06AI", "Yes");
check_lpr = 1;
//g_enable_anpr = 1;
// 08-09
document.getElementById("lpr_container").style.display = "block";
document.getElementById("HTTP_TITLE01").closest('.titlebox').style.display = "block";
}
else {
localStorage.setItem("06AI", "No");
document.getElementById("lpr_container").style.display = "none";
document.getElementById("HTTP_TITLE01").closest('.titlebox').style.display = "none";
var alarmTitleBox = document.getElementById("TITLEBOX_PAGE02").closest('.titlebox').nextElementSibling;
// 確保選擇的元素存在
if (alarmTitleBox) {
alarmTitleBox.style.margin = '25px 0px 4px 0px';
}
// console.log(alarmTitleBox);
}
// console.log("[alarm_on_airelay.html] check lpr license ( localStorage 06AI ):", localStorage.getItem("06AI"));
localStorage.setItem("model_camera", jsonbuf["model_camera"]);
if (jsonbuf["license_type"].search("ssel") >= 1) {//Vessel Recognition
check_ship = 1;
}
localStorage.setItem('check_lpr', check_lpr);
localStorage.setItem('check_ship', check_ship);
localStorage.setItem('check_radar', check_radar);
localStorage.setItem('check_tof', check_tof);
localStorage.setItem('check_key_false', check_key_false);
// console.log("[index.html] localStorage check_tof", localStorage.getItem('check_tof'));
// console.log("[index.html] check_key_false:", localStorage.getItem('check_key_false'));
/*
if (check_key_false) {
$("#RADIO_SETTING").prop('checked', false);
$("#IFRAME_SETTING").prop("style", "visibility: hidden;");
$("#RADIO_LICENSE").prop('checked', true);
$("#IFRAME_LICENSE").prop("style", "visibility: visible;");
}*/
if ((check_tof == 0 && check_radar == 0 && check_lpr == 0) || check_key_false == 1) {
//document.getElementById("TAB_LPR_LIST").style.visibility = "hidden";
//document.getElementById("TAB_ANPR").style.visibility = "hidden";
//g_enable_anpr = 0;
//toggle_specific_tabs(localStorage.getItem('current_page'));
}
else {
if (check_radar == 1) {
// console.log("[index.html] check_radar == 1");
//toggle_specific_tabs(localStorage.getItem('current_page'));
} else if (check_tof == 1) {
// console.log("[index.html] check_tof == 1");
//toggle_specific_tabs(localStorage.getItem('current_page'));
}
else {
//toggle_specific_tabs(localStorage.getItem('current_page'));
}
}
/*
if (enable_PTZ == "Yes")
document.getElementById("TAB_PTZ").style.visibility = "visible";
else
document.getElementById("TAB_PTZ").style.visibility = "hidden";*/
localStorage.setItem("current_page", "alarm_nvr");
},
error: function (retdata) {
console.warn(retdata);
}
});
}
// 08-05
var getalarmmotionDelayTime = 1000;
// console.log("setTimeout getalarmmotion_value delay time : ", getalarmmotionDelayTime);
// getalarmmotion_value();
// 08-06
setTimeout(getalarmmotion_value(), getalarmmotionDelayTime);
g_check_if_run_setting = 0;
localStorage.setItem('alarm_success', 'OK');
localStorage.setItem('landing_page_port', GetUrlPort());
// console.log("[alarm_on_airelay] check port: ", localStorage.getItem('landing_page_port'));
// // IDOK
</script>
</body>
</html>