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.
 
 
 
 

1329 lines
55 KiB

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="cache-control"
content="max-age=0" />
<meta http-equiv="cache-control"
content="no-store" />
<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 name="viewport" content="width=device-width, initial-scale=1" />
<!--meta http-equiv="refresh" content="300" />--> <!--Refresh each 5s-->
<meta charset="utf-8" />
<script src="cookie.min.js"></script>
<script src="lang.js"></script>
<script src="lang_cookie.js"></script>
<script src="label_names.js"></script>
<script src="heatmap.min.js"></script>
<script src="heatmap_index.js"></script>
<script src="heatmap.js"></script>
<script src="config.js"></script>
<script src="jquery_3_2_1.min.js"></script>
<script src="fabric_jquery.easyui.min_compressed_on_nvr.js"></script>
<script>
window.onerror = function (message, url, linenumber) {
console.log('JavaScript error: ' + message + ' on line ' + linenumber + ' for ' + url);
/*
if (url.search("prism.js") >= 1) {
loadScript("prism.js", function () {
});
}
else if (url.search("timebar-1.js") >= 1) {
loadScript("lib/timebar-1.js", function () {
});
}*/
if (url.search("heatmap.min.js") >= 1) {
loadScript("heatmap.min.js", function () {
});
}
else if (url.search("config.js") >= 1) {
loadScript("config.js", function () {
});
}
else if (url.search("heatmap_index.js") >= 1) {
loadScript("heatmap_index.js", function () {
});
}
else if (url.search("label_names.js") >= 1) {
loadScript("label_names.js", function () {
});
}
else if (url.search("heatmap.js") >= 1) {
loadScript("heatmap.js", function () {
});
}
else if (url.search("lang.js") >= 1) {
loadScript("lang.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("fabric_jquery.easyui.min_compressed_on_nvr.js") >= 1) {
loadScript("fabric_jquery.easyui.min_compressed_on_nvr.js", function () {
});
}
/*
else if (url.search("js_3_5_1.js") >= 1) {
loadScript("js_3_5_1.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 {
//location.reload();
var replaceUrl = 'http://' + window.location.hostname + ':' + GetUrlPort() + '/Aida/heatmap.html';
//alert(replaceUrl);
window.location.replace(replaceUrl);
}
}
function GetUrlPort() {
var url_href = window.location.href;
var arr_url = url_href.split(":")[2].split("/")[0];
return arr_url;
}
if (window.history.replaceState) {
window.history.replaceState(null, null, window.location.href);
}
</script>
<link rel="stylesheet" href="heatmap.css">
<link rel="stylesheet" href="bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="easyui.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_ratio = 0;
var count_change_g_mydate = 0;
var g_count_heat = 0;
var g_normal_browser_width = 0;
var g_normal_browser_height = 0;
function update_canvas() {
clearInterval(g_Canvas_BackgroundImage);
g_Canvas_BackgroundImage = setInterval(function update_canvas_set_interval() {
if (parseInt(window.innerWidth) != g_normal_browser_width || parseInt(window.innerHeight) != g_normal_browser_height) {
detectZoom();
resize_destImage();
initial_heatmap();
g_count_heat = 0;
}
//var current_page = localStorage.getItem('current_page');
//if (current_page === 'heatmap')
{
//g_times_update_canvas++;
if (play_video_state == 1) {
count_change_g_mydate++;
g_count_heat++;
if (count_change_g_mydate >= 8) {
click_timebar();
count_change_g_mydate = 0;
}
if (g_count_heat == 1) {
heatMapDraw();
}
if (g_count_heat >= 240) {
g_count_heat = 0;
}
document.getElementById("border_calendar").style.display = "none";
document.body.style.overflow = "hidden";
}
else {
show_calendar_for_existing_data();
count_change_g_mydate++;
if (count_change_g_mydate >= 8) {
change_g_mydate();
}
set_g_mydate();
if (count_change_g_mydate >= 8) {
count_change_g_mydate = 0;
heatMapDraw();
}
document.getElementById("border_calendar").style.display = "inline";
}
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;
}
//var imgUrl='../snap.jpg?'+Math.random();
//var imgUrl='./snap.jpg?'+Math.random();
var imgUrl = 'http://' + window.location.hostname + ":" + GetUrlPort() + '/getimage_HD?' + 'heatmap_' + h + '_' + m + '_' + s + '_' + ms;
if (localStorage.getItem("Radar_recognition") == "Yes") {
imgUrl = 'http://' + window.location.hostname + ":" + GetUrlPort() + '/Aida/images/gray_background.png';
}
else {
if (play_video_state == 1) {
imgUrl = 'http://' + window.location.hostname + ":" + GetUrlPort() + '/getimage_HD?' + 'heatmap_' + h + '_' + m + '_' + s + '_' + ms;
}
else {
if (get_approaching_to_pause_time() >= 1) {
imgUrl = 'http://' + window.location.hostname + ":" + GetUrlPort() + '/Aida_data/playback/' + get_approaching_to_pause_time().toString() + '.jpg';
}
else {
imgUrl = 'http://' + window.location.hostname + ":" + GetUrlPort() + '/Aida/images/gray_background.png';
}
}
}
g_imgUrl = imgUrl;
//document.getElementById('destImage').src = g_imgUrl;
try {
fabric.Image.fromURL(imgUrl, function (img) {
if (img != null && img._element != null) {
img.set({
scaleX: win_width / img.width,
scaleY: win_height / img.height,
});
document.getElementById("CanvasTripwire1").style.visibility = "visible";
if ((h * 3600 + m * 60 + s + ms / 1000) > (g_h * 3600 + g_m * 60 + g_s + g_ms / 1000))
canvasTripwire1.setBackgroundImage(img, canvasTripwire1.renderAll.bind(canvasTripwire1));
//func_get_plate_cookie();
if ((h * 3600 + m * 60 + s + ms / 1000) > (g_h * 3600 + g_m * 60 + g_s + g_ms / 1000)) {
g_h = h;
g_m = m;
g_s = s;
g_ms = ms;
}
if ((g_h * 3600 + g_m * 60 + g_s + g_ms / 1000) - (h * 3600 + m * 60 + s + ms / 1000) >= 3600) {
g_h = h;
g_m = m;
g_s = s;
g_ms = ms;
}
img = null;
}
});
}
catch (e) {
//console.log(e);
}
imgUrl = null;
//detectZoom();
}
}, 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();
}*/
</script>
<script>
$(document).ready(function () {
$(window).resize(function () {
//location.reload();
detectZoom();
resize_destImage();
initial_heatmap();
g_count_heat = 0;
});
});
</script>
</head>
<body>
<div style="position: absolute;right:0%;top:0%;background-color:black;z-index: 60;width:30px;height:30px;">
<input id="open_banner" type="button" value="" style="left:auto;right:auto;top:auto;bottom:auto;width:30px;height:30px;background:black;border-color:black;background-image:url(./images/catalog.png);background-repeat:no-repeat;background-position:center;" onclick="open_banner_video_setting()" />
</div>
<div style="position: absolute;right:0%;background-color:black;z-index: 50;padding:5px;">
<div id="banner_video_setting" style="display:none">
<table>
<tbody>
<tr>
<td id="table_color_1" style="width:34px;height:16px"></td>
<td id="table_color_2" style="width:34px;height:16px"></td>
<td id="table_color_3" style="width:34px;height:16px"></td>
<td id="table_color_4" style="width:34px;height:16px"></td>
</tr>
<tr>
<td id="table_value_1" style="width:34px;height:16px;color:white;text-align:center;font-size:16px;line-height:16px;"></td>
<td id="table_value_2" style="width:34px;height:16px;color:white;text-align:center;font-size:16px;line-height:16px;"></td>
<td id="table_value_3" style="width:34px;height:16px;color:white;text-align:center;font-size:16px;line-height:16px;"></td>
<td id="table_value_4" style="width:34px;height:16px;color:white;text-align:center;font-size:16px;line-height:16px;"></td>
</tr>
</tbody>
</table>
&nbsp;<input id="live_video" type="button" value="Live" style="font-size:0.4rem;background:black;border-color:white;color:white;border: 1px white solid;" onclick="func_play_video()" />
&nbsp;<input id="hide_open_label" type="button" onclick="func_hide_open_label()" value="T" style="font-size:0.4rem;background:black;border-color:white;color:white;border: 1px white solid;" />
&nbsp;<input id="hide_open_direction" type="button" onclick="func_hide_open_direction()" value="D" style="font-size:0.4rem;background:black;border-color:white;color:white;border: 1px white solid;" />
&nbsp;<input id="hide_open_speed" type="button" onclick="func_hide_open_speed()" value="S" style="font-size:0.4rem;background:black;border-color:white;color:white;border: 1px white solid;" />
&nbsp;<nobr id="IDC_STATIC_HOURLY_HEATMAP" style="font-size:0.4rem;background:black;border-color:white;color:white;border: 0px white solid;"></nobr>
<div id="border_calendar" style="display:none">
<br>
&nbsp;
<input id="control_calendar" class="easyui-datetimebox"
data-options="required:true,showSeconds:false,onSelect:select_date,okText:'Play'" value="03/04/2010 01:00" style="width:200px;height:16px;font-size:16px;line-height:16px;" /> <!--overflow-y:auto-->
</div>
</div>
</div>
<!--<div id="main_screen" style="position: absolute; left: 0px; top:0%; height:100%;">-->
<!---<div class="heatmap-wrapper" onclick="mouseXYshow()">-->
<div style="position: absolute; z-index: 20; left: 0%;top:0%; ">
<!--<img src="../getimage_HD?123" id="destImage" />-->
<canvas id="CanvasTripwire1" style=""></canvas>
</div>
<div id="myheatmap" class="heatmap" style="position: absolute; z-index:40; left: 0%;top:0%; opacity:1.0">
<!--<canvas id="heatmap_canvas" class="heatmap-canvas" style="position: absolute; left: 0px;width: 100%; height: 100%;"></canvas>-->
</div>
<!---</div>-->
<!--</div>-->
<script>
if (localStorage.getItem('current_state_hide_or_open_label') == null)
localStorage.setItem('current_state_hide_or_open_label', 0);
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');
var state_open_banner = 0;
if (localStorage.getItem('state_open_banner') != null) {
state_open_banner = localStorage.getItem('state_open_banner');
}
else {
localStorage.setItem('state_open_banner', state_open_banner);
}
var heatmap_max = "100";
//var g_current_time_second = 0;
var play_video_state = 1;
var g_mydate = "03/04/2010 01:00:00";
/*
var timebar = $("#timelineId").timebar({
totalTimeInSecond: 86400 * 7,
//cuepoints: [0, 110, 220, 330, 440, 550],
width: '300px',
multiSelect: true,
stepBars: 168,
timeIntervals: 7,
barClicked(time) {
g_current_time_second = time;
//console.log("g_current_time_second: " + g_current_time_second.toString());
//$("#duration").text(selectedTime);
var myDate_current = new Date();
var now_current_time_second = myDate_current.getDay() * 86400 + myDate_current.getHours() * 3600 + myDate_current.getMinutes() * 60 + myDate_current.getSeconds();
var diff_time = g_current_time_second - now_current_time_second;
if (diff_time > 0) {
diff_time -= 86400 * 7;
}
set_pause_time((myDate_current.getTime() / 1000 * 1000) + diff_time * 1000);
}
//pointerClicked(time) {
//const selectedTime = timebar.formatTime(time);
//$("#duration").text(selectedTime);
// $('#add-input').val(time);
//}
});*/
func_getaboutinfo();
func_get_lang_cookie();
fill_seven_days_check_tables();
document.getElementById("IDC_STATIC_HOURLY_HEATMAP").innerHTML = IDC_STATIC_HOURLY_HEATMAP;
createCanvasTrafficLight_heatmap();
func_getplayback_list();
click_timebar();
//console.log("timelineId width " + $("#timelineId").width());
func_getEventsData();
draw_color_ruler();
detectZoom();
func_get_play_video();
//func_get_pause_time();
start_banner_video_setting();
resize_destImage();
initial_heatmap();
//func_get_framesize_HD();
update_canvas();
getalarmmotion_value();
show_calendar_for_existing_data();
function fill_seven_days_check_tables() {
for (var i = 0; i < NUM_SEVEN_DAYS; i++) {
var wday = parseInt(i / 24);
var whour = parseInt(i % 24);
if (wday == 0)
wday = 7;
var heatmap_url;
if (whour >= 1)
heatmap_url = "heatmap_data_" + wday + ".js?";
else {
wday = wday - 1;
if (wday <= 0) {
wday = 7;
}
heatmap_url = "heatmap_data_" + wday + ".js?";
}
var current_index_table = i;
if (whour == 1) {
loadScript(heatmap_url, get_num_if_existing_heatmap_data, current_index_table);
}
else if (whour == 0) {
loadScript(heatmap_url, get_num_if_existing_heatmap_data_zero, current_index_table);
}
//console.log("AAA:" + seven_days_check_tables[g_current_index_table]);
}
}
function click_timebar() {
var myDate_current = new Date();
//g_current_time_second = myDate_current.getDay() * 86400 + myDate_current.getHours() * 3600 + myDate_current.getMinutes() * 60 + myDate_current.getSeconds();
set_pause_time(myDate_current.getTime() / 1000 * 1000);
//timebar.setSelectedTime(g_current_time_second);
//timebar._barClicked(timebar);
var current_year = myDate_current.getFullYear();
var current_month = myDate_current.getMonth() + 1;
current_month = (current_month < 10 ? ('0' + current_month) : current_month);
var current_date = myDate_current.getDate();
current_date = (current_date < 10 ? ('0' + current_date) : current_date);
var current_hour = myDate_current.getHours();
current_hour = (current_hour < 10 ? ('0' + current_hour) : current_hour);
var current_min = myDate_current.getMinutes();
current_min = (current_min < 10 ? ('0' + current_min) : current_min);
var current_sec = myDate_current.getSeconds();
current_sec = (current_sec < 10 ? ('0' + current_sec) : current_sec);
var msg_time = current_month.toString() + '/' + current_date.toString() + '/' + current_year.toString() + ' ' + current_hour.toString() + ':' + current_min.toString() + ':' + current_sec.toString();
var msg_time_2 = current_month.toString() + '/' + current_date.toString() + '/' + current_year.toString() + ' ' + current_hour.toString();
//console.log(msg_time);
$('#control_calendar').val(msg_time_2 + ':00');
$('#_easyui_textbox_input1').val(msg_time_2 + ':00');
//$('#_easyui_textbox_input2').val(current_hour.toString() + ':00:00');
//console.log($('#control_calendar').val());
g_mydate = msg_time_2 + ':00:00';
}
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_get_framesize_HD() {
$.ajax({
url: "/get_framesize_HD",
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 = validatingJSON(retdata);
if (jsonbuf != null) {
//set_width_HD(parseInt(jsonbuf["width_HD"], 10));
//set_height_HD(parseInt(jsonbuf["height_HD"], 10));
}
else {
setTimeout(func_get_framesize_HD(), 3000);
}
//console.info(retdata);
},
error: function (retdata) {
setTimeout(func_get_framesize_HD(), 3000);
console.warn(retdata);
}
});
}*/
function func_getplayback_list() {
$.ajax({
url: "/getplayback_list",
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) {
//set_pause_time(parseInt(retdata, 10));
var playback_time_array = retdata.split(".jpg,");
playback_time_array.pop();
playback_time_array.sort();
for (var i = 0; i < playback_time_array.length; i++) {
playback_time_array[i] = parseInt(playback_time_array[i], 10);
}
g_playback_time_array = playback_time_array;
//console.log(g_playback_time_array);
},
error: function (retdata) {
setTimeout(func_get_framesize_HD(), 3000);
console.warn(retdata);
}
});
}
/*
function func_get_pause_time() {
$.ajax({
url: "/get_pause_time",
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) {
set_pause_time(parseInt(retdata, 10) * 1000 / 1000);
//console.info(retdata);
},
error: function (retdata) {
setTimeout(func_get_framesize_HD(), 3000);
console.warn(retdata);
}
});
}*/
function func_get_play_video() {
/*
$.ajax({
url: "/get_play_video",
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) {*/
//if (retdata == "Yes")
{
play_video_state = 1;
set_play_video(1);
$('#live_video').val("Live");
}
/*
else {
play_video_state = 0;
set_play_video(0);
$('#live_video').val("History");
}*/
//console.info(retdata);
/*
},
error: function (retdata) {
setTimeout(func_get_framesize_HD(), 3000);
console.warn(retdata);
}
});*/
}
function func_play_video() {
/*
$.ajax({
url: "/play_video",
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) {*/
if (play_video_state == 0) {
play_video_state = 1;
set_play_video(1);
$('#live_video').val("Live");
}
else {
play_video_state = 0;
set_play_video(0);
$('#live_video').val("History");
}
//console.info(retdata);
/*
},
error: function (retdata) {
setTimeout(func_get_framesize_HD(), 3000);
console.warn(retdata);
}
});*/
}
function detectZoom() {
var ratio = 0,
screen = window.screen,
ua = navigator.userAgent.toLowerCase();
if (window.devicePixelRatio !== undefined) {
ratio = window.devicePixelRatio;
} else if (~ua.indexOf('msie')) {
if (screen.deviceXDPI && screen.logicalXDPI) {
ratio = screen.deviceXDPI / screen.logicalXDPI;
}
} else if (window.outerWidth !== undefined && window.innerWidth !== undefined) {
ratio = window.outerWidth / window.innerWidth;
}
if (ratio) {
ratio = Math.round(ratio * 100);
}
g_ratio = ratio;
//console.log("Web browser ratio:" + ratio.toString());
var total_height_calendar = 0;
var record_offset_top = 0;
if ($(".datebox-calendar-inner").offset()) {
total_height_calendar += $(".datebox-calendar-inner").offset().top;
record_offset_top = $(".datebox-calendar-inner").offset().top;
}
if (total_height_calendar != 0)
total_height_calendar += $(".datebox-calendar-inner").height();
else
set_correct_hour_format();//calendar panel is closed.
if (total_height_calendar >= 1 && total_height_calendar > g_normal_browser_height) {
//console.log(total_height_calendar);
document.body.style.overflow = "";
document.body.style.overflowX = "hidden";
document.body.style.overflowY = "hidden";//scroll
}
else {
document.body.style.overflow = "hidden";
document.body.style.top = "0px";
if (g_ratio <= 100) {
document.body.style.overflow = 'hidden';
}
else {
document.body.style.overflow = 'hidden';
}
}
}
function func_getEventsData() {
$.ajax({
url: "/geteventsfile?ch=all",
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 = validatingJSON(retdata);
if (jsonbuf != null) {
heatmap_max = parseInt(jsonbuf["notification"]["heatmap_max"], 10);
localStorage.setItem("events_default_version", jsonbuf["notification"]["events_default_version"]);
set_heatmap_max(heatmap_max);
}
else {
setTimeout(func_getEventsData(), 3000);
}
//console.info(retdata);
},
error: function (retdata) {
setTimeout(func_getEventsData(), 3000);
console.warn(retdata);
}
});
}
function resize_destImage() {
//console.log("screen width" + screen.width.toString());
//console.log("screen height" + screen.height.toString());
//console.log("browser width" + window.innerWidth.toString());
//console.log("browser height" + window.innerHeight.toString());
//console.log("webpage width" + document.documentElement.scrollWidth.toString());
//console.log("webpage height" + document.documentElement.scrollHeight.toString());
var adjust_unit = 1;
if (g_ratio > 100) {
adjust_unit = 100 / g_ratio;
}
var normal_browser_width = parseInt(window.innerWidth /** g_ratio / 100 * adjust_unit*/);
var normal_browser_height = parseInt(window.innerHeight/* * g_ratio / 100 * 1 * adjust_unit*/);
//console.log("normal browser width" + normal_browser_width.toString());
//console.log("normal browser height" + normal_browser_height.toString());
document.getElementById("CanvasTripwire1").style.width = normal_browser_width.toString() + "px";
document.getElementById("CanvasTripwire1").style.height = normal_browser_height.toString() + "px";
document.getElementById("myheatmap").style.width = normal_browser_width.toString() + "px";
document.getElementById("myheatmap").style.height = normal_browser_height.toString() + "px";
g_normal_browser_width = normal_browser_width;
g_normal_browser_height = normal_browser_height;
//document.getElementById("live_video").style.transformOrigin = "0 0";
// document.getElementById("live_video").style.transform = "scale(" + (window.innerHeight / screen.height * g_ratio / 100).toString() + ")";
//timebar.setWidth(parseInt(normal_browser_width * 0.5).toString() + "px");
/*
for (var i = 0; i < 4; i++) {
document.getElementById("table_color_" + (i + 1).toString()).style.width = (normal_browser_width * 0.04).toString() + "px";
document.getElementById("table_color_" + (i + 1).toString()).style.height = (normal_browser_height * 0.02).toString() + "px";
document.getElementById("table_value_" + (i + 1).toString()).style.width = (normal_browser_width * 0.04).toString() + "px";
document.getElementById("table_value_" + (i + 1).toString()).style.height = (normal_browser_height * 0.02).toString() + "px";
document.getElementById("table_value_" + (i + 1).toString()).style.lineHeight = (normal_browser_height * 0.02).toString() + "px";
document.getElementById("table_value_" + (i + 1).toString()).style.fontSize = (normal_browser_height * 0.018).toString() + "px";
document.getElementById("table_value_" + (i + 1).toString()).style.textAlign = "center";
}*/
set_width_HD(normal_browser_width);
set_height_HD(normal_browser_height);
set_mNheatRadius(30 * window.innerHeight / screen.height * g_ratio / 100 * adjust_unit);
}
function draw_color_ruler() {
document.getElementById("table_color_1").style.backgroundColor = '#00F';
document.getElementById("table_color_2").style.backgroundColor = '#0F0';
document.getElementById("table_color_3").style.backgroundColor = '#FF0';
document.getElementById("table_color_4").style.backgroundColor = '#F00';
document.getElementById("table_value_1").innerHTML = parseInt(get_heatmap_max() * 0.25).toString();
document.getElementById("table_value_2").innerHTML = parseInt(get_heatmap_max() * 0.55).toString();
document.getElementById("table_value_3").innerHTML = parseInt(get_heatmap_max() * 0.85).toString();
document.getElementById("table_value_4").innerHTML = parseInt(get_heatmap_max() * 1).toString();
/*
const ctx = document.getElementById('color_ruler').getContext('2d');
// draw background
ctx.fillStyle = '#00F';
ctx.fillRect(0, 20, 75, 50);
ctx.fillStyle = '#0F0';
ctx.fillRect(75, 20, 75, 50);
ctx.fillStyle = '#FF0';
ctx.fillRect(150, 20, 75, 50);
ctx.fillStyle = '#F00';
ctx.fillRect(225, 20, 75, 50);
ctx.fillStyle = '#000';
ctx.fillRect(0, 70, 300, 50);
ctx.font = "20px Arial";
ctx.fillStyle = "#FFF";
ctx.fillText(parseInt(get_heatmap_max() * 0.25).toString(), 25, 100);
ctx.font = "20px Arial";
ctx.fillStyle = "#FFF";
ctx.fillText(parseInt(get_heatmap_max() * 0.55).toString(), 100, 100);
ctx.font = "20px Arial";
ctx.fillStyle = "#FFF";
ctx.fillText(parseInt(get_heatmap_max() * 0.85).toString(), 175, 100);
ctx.font = "20px Arial";
ctx.fillStyle = "#FFF";
ctx.fillText(parseInt(get_heatmap_max() * 1).toString(), 250, 100);
ctx.beginPath();
ctx.moveTo(0, 20);
ctx.lineTo(0, 120);
ctx.lineWidth = "1";
ctx.strokeStyle = "white";
ctx.stroke();
ctx.beginPath();
ctx.moveTo(300, 20);
ctx.lineTo(300, 120);
ctx.lineWidth = "1";
ctx.strokeStyle = "white";
ctx.stroke();
ctx.beginPath();
ctx.moveTo(0, 20);
ctx.lineTo(300, 20);
ctx.lineWidth = "1";
ctx.strokeStyle = "white";
ctx.stroke();
ctx.beginPath();
ctx.moveTo(0, 120);
ctx.lineTo(300, 120);
ctx.lineWidth = "1";
ctx.strokeStyle = "white";
ctx.stroke();*/
}
function set_correct_hour_format() {
g_mydate = g_mydate.split(":")[0] + ':00:00';
var myDate_current = new Date(g_mydate);
$('#_easyui_textbox_input2').val(myDate_current.getHours() + ':00');
$('.textbox-value').val(myDate_current.getHours() + ':00');
}
function change_g_mydate() {
g_mydate = g_mydate.split(":")[0] + ':00:00';
var myDate_current = new Date(g_mydate);
var myDate_current_real = new Date();
var adjust_myDate_current_real = 0;
if (myDate_current_real.getMinutes() == 0 && myDate_current_real.getSeconds() == 0) {
adjust_myDate_current_real = myDate_current_real.getTime();
}
else {
var current_year = new Date().getFullYear();
var current_month = new Date().getMonth() + 1;
current_month = (current_month < 10 ? ('0' + current_month) : current_month);
var current_date = new Date().getDate();
current_date = (current_date < 10 ? ('0' + current_date) : current_date);
var current_hour = new Date().getHours();
current_hour = (current_hour < 10 ? ('0' + current_hour) : current_hour);
myDate_current_real = new Date(current_month.toString() + '/' + current_date.toString() + '/' + current_year.toString() + ' ' + current_hour.toString() + ':00:00');
adjust_myDate_current_real = myDate_current_real.getTime() + 1000 * 60 * 60;
}
while (myDate_current.getTime() + 1000 * 60 * 60 <= adjust_myDate_current_real) {
myDate_current.setTime(myDate_current.getTime() + 1000 * 60 * 60);
set_pause_time(myDate_current.getTime() / 1000 * 1000);
if (get_approaching_to_pause_time() >= 1) {
//timebar.setSelectedTime(g_current_time_second);
//timebar._barClicked(timebar);
var current_year = myDate_current.getFullYear();
var current_month = myDate_current.getMonth() + 1;
current_month = (current_month < 10 ? ('0' + current_month) : current_month);
var current_date = myDate_current.getDate();
current_date = (current_date < 10 ? ('0' + current_date) : current_date);
var current_hour = myDate_current.getHours();
current_hour = (current_hour < 10 ? ('0' + current_hour) : current_hour);
var current_min = myDate_current.getMinutes();
current_min = (current_min < 10 ? ('0' + current_min) : current_min);
var current_sec = myDate_current.getSeconds();
current_sec = (current_sec < 10 ? ('0' + current_sec) : current_sec);
var msg_time = current_month.toString() + '/' + current_date.toString() + '/' + current_year.toString() + ' ' + current_hour.toString() + ':' + current_min.toString() + ':' + current_sec.toString();
var msg_time_2 = current_month.toString() + '/' + current_date.toString() + '/' + current_year.toString() + ' ' + current_hour.toString();
//console.log(msg_time);
$('#control_calendar').val(msg_time_2 + ':00');
$('#_easyui_textbox_input1').val(msg_time_2 + ':00');
//$('#_easyui_textbox_input2').val(current_hour.toString() + ':00:00');
//console.log($('#control_calendar').val());
g_mydate = msg_time_2 + ':00:00';
break;
}
}
}
$('#_easyui_textbox_input2').blur(function () {
$('#_easyui_textbox_input2').val($('#_easyui_textbox_input2').val().split(":")[0] + ":00");
});
function set_g_mydate() {
g_mydate = $('#control_calendar').val().split(":")[0] + ":00:00";
$('#_easyui_textbox_input1').val($('#control_calendar').val().split(":")[0] + ":00");
var t = $('#control_calendar').datetimebox('spinner');
var time = t.timespinner('getValue');
//$('#_easyui_textbox_input2').val(time.split(":")[0] + ":00:00");
var myDate_current = new Date(g_mydate);
//console.log(myDate_current.getTime());
set_pause_time(myDate_current.getTime() / 1000 * 1000);
}
function select_date() {
//console.log("select_date");
var c = $('#control_calendar').datetimebox('calendar');
var t = $('#control_calendar').datetimebox('spinner');
var day = c.calendar('options').current;
var time = t.timespinner('getValue');
var y = day.getFullYear();
var m = day.getMonth() + 1;
var d = day.getDate();
var myday = (m < 10 ? ('0' + m) : m).toString() + '/' + (d < 10 ? ('0' + d) : d).toString() + '/' + (y).toString();
var mydate = myday + ' ' + time;
var mydate_2 = myday + ' ' + time.split(":")[0];
$('#control_calendar').val(mydate_2 + ":00");
$('#_easyui_textbox_input1').val(mydate_2 + ":00");
$('#_easyui_textbox_input2').val(time.split(":")[0] + ":00");
//console.log(mydate);
g_mydate = mydate_2 + ":00:00";
}
function show_calendar_for_existing_data() {
var num_month = 0;
var num_year = 0;
var all_month_year = $(".calendar-text").map(function (map_index) {
//console.log(map_index);
var month_year = this.innerHTML;
var temp_month = month_year.split(" ")[0];
if (temp_month == "Jan") {
num_month = 1;
}
else if (temp_month == "Feb") {
num_month = 2;
}
else if (temp_month == "Mar") {
num_month = 3;
}
else if (temp_month == "Apr") {
num_month = 4;
}
else if (temp_month == "May") {
num_month = 5;
}
else if (temp_month == "Jun") {
num_month = 6;
}
else if (temp_month == "Jul") {
num_month = 7;
}
else if (temp_month == "Aug") {
num_month = 8;
}
else if (temp_month == "Sep") {
num_month = 9;
}
else if (temp_month == "Oct") {
num_month = 10;
}
else if (temp_month == "Nov") {
num_month = 11;
}
else if (temp_month == "Dec") {
num_month = 12;
}
num_year = parseInt(month_year.split(" ")[1]);
return this.innerHTML;
}).get();
//console.log(num_year);
//console.log(num_month);
var check_start = 0;
var all_run = $(".calendar-day").map(function (map_index) {
if (this.innerHTML == 1 || check_start == 1) {
if (this.innerHTML == 1 && check_start == 1) {
check_start = 0;
}
else {
check_start = 1;
var num_date = parseInt(this.innerHTML,10);
var myday_start = (num_month < 10 ? ('0' + num_month) : num_month).toString() + '/' + (num_date < 10 ? ('0' + num_date) : num_date).toString() + '/' + (num_year).toString() + " 00:00:00";
var myday_end = (num_month < 10 ? ('0' + num_month) : num_month).toString() + '/' + (num_date < 10 ? ('0' + num_date) : num_date).toString() + '/' + (num_year).toString() + " 23:59:59";
var timestamp_myday_start = new Date(myday_start).getTime();
var timestamp_myday_end = new Date(myday_end).getTime();
//console.log(this.innerHTML);
//console.log(timestamp_myday_start);
//console.log(timestamp_myday_end);
var check_if_in_range = 0;
for (var i = 0; i < g_playback_time_array.length; i++) {
//console.log(g_playback_time_array[i]);
if (g_playback_time_array[i] >= timestamp_myday_start && g_playback_time_array[i] <= timestamp_myday_end) {
check_if_in_range = 1;
break;
}
}
var OK_check = 0;
for (var i = 0; i < 24; i++) {
if (seven_days_check_tables[new Date(timestamp_myday_start).getDay() * 24 + i] >= 1) {
OK_check = 1;
break;
}
}
if (check_if_in_range == 1 && (
(new Date().getDay() == new Date(timestamp_myday_start).getDay() &&
new Date().getDate() == new Date(timestamp_myday_start).getDate()) ||
new Date().getDay() != new Date(timestamp_myday_start).getDay()) &&
OK_check == 1
) {
this.style.border = "1px red solid";
}
else {
var temp_wday = new Date(timestamp_myday_start).getDay();
if (temp_wday == 0)
temp_wday = 7;
this.style.border = "0px red solid";
if (temp_wday == 7) {
this.style.color = "cyan";
}
else if (temp_wday == 6) {
this.style.color = "purple";
}
else{
this.style.color = "white";
}
this.disabled = true;
}
//this.setAttribute("disabled", "disabled");
}
}
return this.innerHTML;
}).get();
//g_normal_browser_width = normal_browser_width;
//g_normal_browser_height = normal_browser_height;
//var total_height = $(".datebox-calendar-inner").offset().top + $(".datebox-calendar-inner").height();
//console.log($(".datebox-calendar-inner").height());
//$(".datebox-calendar-inner").css("border", "3px solid red");
/*
for (var i = 0; i < g_playback_time_array.length; i++) {
console.log(g_playback_time_array[i]);
}*/
//console.log(all_run.join());
var datebox_button = $(".datebox-button").map(function (map_index) {
//console.log(map_index);
this.style.color = "white";
return this.innerHTML;
}).get();
var datebox_button_a = $(".datebox-button-a").map(function (map_index) {
//console.log(map_index);
this.style.color = "white";
return this.innerHTML;
}).get();
}
function start_banner_video_setting() {
if (state_open_banner == 1) {
document.getElementById("banner_video_setting").style.display = "inline";
//$('#open_banner').val(">");
}
else {
document.getElementById("banner_video_setting").style.display = "none";
//$('#open_banner').val("<");
}
}
function open_banner_video_setting() {
if (state_open_banner == 1) {
state_open_banner = 0;
document.getElementById("banner_video_setting").style.display = "none";
//$('#open_banner').val("<");
}
else {
state_open_banner = 1;
document.getElementById("banner_video_setting").style.display = "inline";
//$('#open_banner').val(">");
}
localStorage.setItem('state_open_banner', state_open_banner);
}
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 = "black";
document.getElementById("hide_open_label").style.borderColor = "white";
}
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 = "black";
document.getElementById("hide_open_direction").style.borderColor = "white";
}
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 = "black";
document.getElementById("hide_open_speed").style.borderColor = "white";
}
localStorage.setItem('current_state_hide_or_open_speed', current_state_hide_or_open_speed);
}
function func_getaboutinfo() {
$.ajax({
url: "/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(retdata);
localStorage.setItem("dataset_ver", jsonbuf["dataset_ver"]);
localStorage.setItem("events_default_version", jsonbuf["events_default_version"]);
},
error: function (retdata) {
console.warn(retdata);
}
});
}
/*
function time_format_ww4(date) {
console.log("time_format_ww4");
var y = date.getFullYear();
var m = date.getMonth() + 1;
var d = date.getDate();
var h = date.getHours();
var min = date.getMinutes();
var sec = date.getSeconds();
var msg_date = y + '/' + (m < 10 ? ('0' + m) : m) + '/' + (d < 10 ? ('0' + d) : d) + ' ' + (h < 10 ? ('0' + h) : h) + ':' + (min < 10 ? ('0' + min) : min) + ':' + (sec < 10 ? ('0' + sec) : sec);
console.log(msg_date);
return msg_date;
}
function time_parser_w4(s) {
console.log("time_parser_w4");
var reg = /[\u4e00-\u9fa5]/ //利用正则表达式分隔
var ss = (s.split(reg));
console.log(ss);
var y = parseInt(ss[0], 10);
var m = parseInt(ss[1], 10);
var d = parseInt(ss[2], 10);
var h = parseInt(ss[3], 10);
var min = parseInt(ss[4], 10);
var sec = parseInt(ss[5], 10);
if (!isNaN(y) && !isNaN(m) && !isNaN(d) && !isNaN(h) && !isNaN(min) && !isNaN(sec)) {
return new Date(y, m - 1, d, h,min,sec);
} else {
return new Date();
}
} */
</script>
</body>
</html>