|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 609 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 563 B |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 432 B |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 726 B |
|
After Width: | Height: | Size: 422 B |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 9.4 KiB |
|
After Width: | Height: | Size: 8.3 KiB |
|
After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 7.7 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 8.9 KiB |
|
After Width: | Height: | Size: 5.0 KiB |
|
After Width: | Height: | Size: 7.3 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 7.3 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 7.2 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 8.0 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 8.5 KiB |
|
After Width: | Height: | Size: 6.9 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 8.9 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 7.4 KiB |
@ -0,0 +1,649 @@
|
||||
<!DOCTYPE html> |
||||
<html> |
||||
<head> |
||||
<meta http-equiv="cache-control" |
||||
content="max-age=0" /> |
||||
<meta http-equiv="cache-control" |
||||
content="no-cache, 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 charset="utf-8" /> |
||||
<!-- <link rel="preload" href="./Icon/Counter_Green_64x64px.png" as="image" /> --> |
||||
<!-- <link rel="preload" href="images/icon_alarm.png" as="image" /> |
||||
<link rel="preload" href="images/icon_output.png" as="image" /> |
||||
<link rel="preload" href="images/icon_setting.png" as="image" /> |
||||
<link rel="preload" href="images/icon_license.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; |
||||
} |
||||
/* 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%; |
||||
} |
||||
} |
||||
|
||||
/* hide the up and down arrows which are built in number type input */ |
||||
/* Chrome, Safari, Edge, Opera */ |
||||
input::-webkit-outer-spin-button, |
||||
input::-webkit-inner-spin-button { |
||||
-webkit-appearance: none; |
||||
margin: 0; |
||||
} |
||||
/* Firefox */ |
||||
input[type=number] { |
||||
-moz-appearance: textfield; |
||||
} |
||||
|
||||
|
||||
/* 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; |
||||
} |
||||
</style> |
||||
|
||||
<!-- 原 plugin 是用 "jquery_3_2_1.min.js",初始化直接載入,避免載入時間點太慢導致高度設定問題 --> |
||||
<script src="/airelay/jquery_3_2_1.min.js"></script> |
||||
|
||||
<!-- 避免在單一檔案卡太久,以非同步處理 --> |
||||
<script src="/airelay/fabric_jquery.easyui.min_compressed_on_nvr.js" async></script> |
||||
|
||||
<script> |
||||
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; |
||||
} |
||||
localStorage.setItem('landing_page_port', GetUrlPort()); |
||||
// console.log("[airelay_init.html] localStorage landing_page_port: ", localStorage.getItem('landing_page_port')); |
||||
|
||||
var g_tcp_tunnel_token = "airelay"; |
||||
|
||||
// 逐步加載腳本列表 |
||||
var resourcesToLoad = [ |
||||
"/js/common.js", |
||||
`/${g_tcp_tunnel_token}/cookie.min.js`, |
||||
`/${g_tcp_tunnel_token}/alarm_on_airelay.js`, |
||||
`/${g_tcp_tunnel_token}/lang.js`, |
||||
`/${g_tcp_tunnel_token}/lang_cookie.js`, |
||||
`/${g_tcp_tunnel_token}/config.js`, |
||||
`/${g_tcp_tunnel_token}/unit1.js`, |
||||
`/${g_tcp_tunnel_token}/label_names.js`, |
||||
`/${g_tcp_tunnel_token}/third_party_label_names.js`, |
||||
`/${g_tcp_tunnel_token}/lib/owl.carousel.min.js` |
||||
]; |
||||
|
||||
var loadCount = 0; |
||||
|
||||
function loadScriptsWithDelay() { |
||||
var index = 0; |
||||
var interval = 20; // 每次迭代之間的延遲時間,單位是毫秒 |
||||
var errorReconnectInterval = 100; |
||||
|
||||
function loadNextScript() { |
||||
if (index < resourcesToLoad.length) { |
||||
(function (currentIndex) { |
||||
var src = resourcesToLoad[index]; |
||||
var script = document.createElement('script'); |
||||
script.type = "text/javascript"; |
||||
script.src = src; |
||||
script.async = false; |
||||
|
||||
script.onload = function () { |
||||
// console.log('[script ' + currentIndex + '] ' + src + ' has been successfully loaded'); |
||||
index++; |
||||
setTimeout(loadNextScript, interval); // 加載下一個腳本之前等待一段時間 |
||||
|
||||
loadCount++; |
||||
}; |
||||
|
||||
script.onerror = function () { |
||||
console.error('[Error] Failed to load script: ' + src + ' at index: ' + currentIndex); |
||||
|
||||
setTimeout(() => { |
||||
window.location.reload(); |
||||
}, errorReconnectInterval); |
||||
}; |
||||
|
||||
document.getElementsByTagName("head")[0].appendChild(script); |
||||
})(index); |
||||
} else { |
||||
// console.log("All scripts loaded successfully!"); |
||||
} |
||||
} |
||||
|
||||
// 開始加載第一個腳本 |
||||
loadNextScript(); |
||||
} |
||||
|
||||
// 開始使用延遲加載的方式加載腳本 |
||||
loadScriptsWithDelay(); |
||||
|
||||
// -------------------------------------------------------------------------------- |
||||
|
||||
var imagesToPreload = [ |
||||
`/${g_tcp_tunnel_token}/images/rotate.png`, |
||||
`/${g_tcp_tunnel_token}/images/slider_handle.png` |
||||
]; |
||||
|
||||
function preloadImagesWithDelay() { |
||||
var imgIndex = 0; |
||||
var interval = 150; // 每次迭代之間的延遲時間,單位是毫秒 |
||||
|
||||
function loadNextImage() { |
||||
if (imgIndex < imagesToPreload.length) { |
||||
var src = imagesToPreload[imgIndex]; |
||||
// console.log("[img " + imgIndex + "] start to preload: "+src); |
||||
var link = document.createElement('link'); |
||||
link.rel = 'preload'; |
||||
link.href = src; |
||||
link.as = 'image'; |
||||
|
||||
link.onload = function () { |
||||
// console.log('[img ' + imgIndex + '] ' + src + ' has been successfully preloaded'); |
||||
imgIndex++; |
||||
setTimeout(loadNextImage, interval); // 加載下一個影像之前等待一段時間 |
||||
}; |
||||
|
||||
link.onerror = function () { |
||||
// console.error('Failed to preload image: ' + src + ' at index: ' + imgIndex); |
||||
// 處理影像加載失敗的情況,可以進行重整頁面或其他操作 |
||||
window.location.reload(); |
||||
}; |
||||
|
||||
document.head.appendChild(link); |
||||
} else { |
||||
// console.log("All images preloaded successfully!"); |
||||
} |
||||
} |
||||
|
||||
// 開始預加載第一個影像 |
||||
loadNextImage(); |
||||
} |
||||
|
||||
// 開始使用延遲加載的方式預加載影像 |
||||
// preloadImagesWithDelay(); |
||||
|
||||
// -------------------------------------------------------------------------------- |
||||
|
||||
var tabsButtonId = [ |
||||
{ tabId: 'TAB_ALARM', textId: 'HTTP_TITLE05', icon: 'icon_alarm.png', pageId: 'alarm' }, |
||||
{ tabId: 'TAB_OUTPUT', textId: 'HTTP_TITLE08', icon: 'icon_output.png', pageId: 'output' }, |
||||
{ tabId: 'TAB_SETTING', textId: 'HTTP_TITLE06', icon: 'icon_setting.png', pageId: 'setting' }, |
||||
{ tabId: 'TAB_LICENSE', textId: 'HTTP_TITLE07', icon: 'icon_license.png', pageId: 'license' } |
||||
]; |
||||
|
||||
var iconSize = '60px'; |
||||
var innerIframeId = "innerIframe"; |
||||
var loadingElementId = 'percentage'; |
||||
var preloadImgElementId = 'preloadImg'; |
||||
|
||||
|
||||
// 透過 jQuery 拿到外層 iframe 尺寸 |
||||
var iframeWidth = window.innerWidth - 80; |
||||
|
||||
function addIframeToBody(src) { |
||||
// var iframe = document.createElement('iframe'); |
||||
var iframe = document.getElementById(innerIframeId); |
||||
// iframe.id = innerIframeId; |
||||
|
||||
// 避免預設邊框樣式 |
||||
iframe.style.border = 'none'; |
||||
|
||||
iframe.width = iframeWidth; |
||||
iframe.style.border = '0'; |
||||
iframe.frameBorder = '0'; // 設置 frameborder 屬性 |
||||
|
||||
// 設置載入檔案來源 |
||||
iframe.src = src; |
||||
} |
||||
|
||||
function addTmpSnapImageToDiv(imgWidth, imgHeight) { |
||||
// console.log("create preload img element"); |
||||
var img = document.createElement('img'); |
||||
|
||||
// 設置 img 屬性 |
||||
img.width = imgWidth; |
||||
img.height = imgHeight; |
||||
|
||||
// 載入影像 |
||||
var port = localStorage.getItem('landing_page_port'); |
||||
img.src = 'http://' + window.location.hostname + ':' + port + '/snap'; |
||||
|
||||
// 將 img 附加到預設位置 |
||||
var div = document.getElementById(preloadImgElementId); |
||||
if (div) { |
||||
div.appendChild(img); |
||||
} |
||||
} |
||||
// -------------------------------------------------------------------------------- |
||||
|
||||
// 08-08 |
||||
function func_getWanPort() { |
||||
$.ajax({ |
||||
url: '/network?get=all', |
||||
method: "GET", |
||||
async: true, |
||||
beforeSend: function (xmlHttp) { |
||||
xmlHttp.setRequestHeader("If-Modified-Since", "0"); |
||||
xmlHttp.setRequestHeader("Cache-Control", "no-cache"); |
||||
// xmlHttp.setRequestHeader("Referer", window.location.origin); |
||||
//xmlHttp.setRequestHeader("Authorization", "Basic " + btoa("username:password")); |
||||
}, |
||||
success: function (retdata) { |
||||
// console.log(retdata); |
||||
func_filterWanInfo(retdata); |
||||
}, |
||||
error: function () { |
||||
setTimeout(func_getWanPort(), 3000); |
||||
console.warn(); |
||||
} |
||||
}); |
||||
return false; |
||||
} |
||||
|
||||
|
||||
function func_filterWanInfo(data) { |
||||
var targetNumber = '8592'; |
||||
|
||||
// 將回傳的資料以換行符號分割為一個陣列 |
||||
var lines = data.split('\r\n'); |
||||
|
||||
// 過濾出以 'lpkg.wan' 開頭且包含 'info=1' 的行 |
||||
var filteredLines = lines.filter(line => line.startsWith('lpkg.wan') && line.includes('info=1')); |
||||
|
||||
// 輸出過濾後的結果 |
||||
// console.log("[filterWanInfo] filtered lines:", filteredLines); |
||||
|
||||
// 沒設定 WAN 的情況,預設 8592 |
||||
localStorage.setItem("plugin_wan_port", targetNumber); |
||||
|
||||
// 使用迴圈掃掠 filteredLines |
||||
for (var line of filteredLines) { |
||||
if (line.includes(targetNumber)) { // 有設定 WAN 才會從 info 撈到對應關係 |
||||
var parts = line.split(','); // 以 ',' 裁切 |
||||
extractedNumber = parts[parts.length - 1]; // 取出最後一個部分 |
||||
localStorage.setItem("plugin_wan_port", extractedNumber); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
// console.log("plugin wan port: ", localStorage.getItem("plugin_wan_port")); |
||||
|
||||
return filteredLines; |
||||
} |
||||
|
||||
function func_setPluginLang(ipcam_lang_index) { |
||||
var lang = 'en_gb'; // 預設 English |
||||
if (ipcam_lang_index == 1 || ipcam_lang_index == 2) { |
||||
lang = 'zh_tw'; // 繁中 簡中 歸納成 Chinese |
||||
} else if (ipcam_lang_index == 4) { |
||||
lang = 'it_it'; // Italian |
||||
} else if (ipcam_lang_index == 11) { |
||||
lang = 'ja_jp'; // Japanese |
||||
} // 其他語系,歸納到預設 |
||||
|
||||
// console.log(`[SetPluginLang] ipcam_lang_index : ${ipcam_lang_index} , set plugin cookie : ${lang}`); |
||||
|
||||
cookie("LANG", lang, "9999/12/31 12:00:00"); |
||||
|
||||
var json_data = '{'; |
||||
json_data += '"system_setting": {'; |
||||
json_data += '"language": "' + lang + '"'; |
||||
json_data += '}}'; |
||||
func_setconfigfile(json_data); |
||||
} |
||||
|
||||
|
||||
// -------------------------------------------------------------------------------- |
||||
|
||||
var checkIntervalTime = 500; |
||||
var hideLoadPageDeferTime = 1500; |
||||
var preloadImgDisplayTime = 500; |
||||
var intervalID = null; |
||||
var checkPercentageStuckCounter = 0; |
||||
var percentage = 0; |
||||
var landingPage = "/airelay/alarm_on_airelay.html"; |
||||
|
||||
var progressBarHeight = 8; |
||||
var snapImgWidth = 720; // 同 G_VIEW_CANVAS_X 設定 |
||||
var snapImgHeight = 480; // 同 G_VIEW_CANVAS_Y 設定 |
||||
|
||||
clearInterval(intervalID); |
||||
// 持續檢核是否加載完成 |
||||
intervalID = setInterval(function () { |
||||
var loadingElement = document.getElementById(loadingElementId); |
||||
var prevPercentage = percentage; |
||||
|
||||
var percentageStuckThreshold = 30; // 08-16 原設定 2,網速慢時,容易載一半就當成錯誤,才拉長等待時間 |
||||
|
||||
percentage = Math.round(((loadCount / resourcesToLoad.length) * 100), 2); |
||||
// console.log("[setInterval] check percentage: " + percentage + " , prev percentage: " + prevPercentage); |
||||
|
||||
if ((percentage == prevPercentage) && (percentage < 100)) { |
||||
checkPercentageStuckCounter++; |
||||
// console.log("checkPercentageStuckCounter: ", checkPercentageStuckCounter); |
||||
if (checkPercentageStuckCounter >= percentageStuckThreshold) { |
||||
// console.log("reload init page"); |
||||
window.location.reload(); |
||||
} |
||||
} else { |
||||
// 頻寬差時,不能讓 Counter 在不同 script 載入過程持續累積,容易觸發 reload |
||||
checkPercentageStuckCounter = 0; |
||||
// console.log("reset checkPercentageStuckCounter: ", checkPercentageStuckCounter); |
||||
} |
||||
|
||||
loadingElement.innerText = "Loading scripts ... " + percentage.toString() + " %"; |
||||
|
||||
if (loadCount == resourcesToLoad.length) { |
||||
localStorage.setItem("loadScriptIndex", 0); |
||||
// console.log("prepare to load landing page ..."); |
||||
|
||||
// window.parent.document |
||||
var outterIframeElement = window.parent.document.querySelector("#content-show iframe"); |
||||
// console.log(outterIframeElement); |
||||
if (outterIframeElement) { |
||||
outterIframeElement.height = "1000"; // 調整外框高度 |
||||
} |
||||
|
||||
func_getWanPort(); // 08-08 |
||||
|
||||
// 08-09 |
||||
//var ipcam_lang_setting = GetCookie('ipcam_lang'); |
||||
// console.log("[airelay_init.html] get ipcam_lang_setting:", ipcam_lang_setting); |
||||
//func_setPluginLang(ipcam_lang_setting); |
||||
|
||||
clearInterval(intervalID); |
||||
|
||||
// 這邊沿用 G_VIEW_CANVAS_X & G_VIEW_CANVAS_Y 仍會是 480 x 320,改設變數同步解析度 |
||||
addTmpSnapImageToDiv(snapImgWidth, snapImgHeight); |
||||
|
||||
// 08-29 暫時不載第二層,先把 script load 好 |
||||
addIframeToBody(landingPage); |
||||
|
||||
setTimeout(() => { |
||||
// console.log("defer load landing page"); |
||||
loadingElement.style.top = (progressBarHeight + snapImgHeight) + 'px'; |
||||
loadingElement.style.position = "absolute"; |
||||
loadingElement.innerText = "Streaming and Page initialization ..."; |
||||
|
||||
var preloadElement = document.getElementById(preloadImgElementId); |
||||
if (preloadElement) { |
||||
preloadElement.style.top = progressBarHeight + 'px'; // progress bar height |
||||
preloadElement.style.display = 'inline'; |
||||
} |
||||
|
||||
checkH264Streaming(); |
||||
}, hideLoadPageDeferTime); |
||||
|
||||
} |
||||
|
||||
}, checkIntervalTime) |
||||
func_getaboutinfo(); |
||||
|
||||
localStorage.setItem("receivedH264", false); |
||||
localStorage.setItem('iframeHeight', null); |
||||
// console.log("[airelay_init.html] Init localStorage receivedH264: ", localStorage.getItem("receivedH264")); |
||||
|
||||
var defaultBtnOffset = 30; // 預設按鈕往下偏移距離 |
||||
function checkH264Streaming() { |
||||
// console.log("start checkH264Streaming"); |
||||
var checkH264IntervalID = null; |
||||
checkH264IntervalID = setInterval(function () { |
||||
var receivedH264 = localStorage.getItem("receivedH264"); |
||||
// console.log("[airelay_init.html] receivedH264: ", receivedH264); |
||||
if (receivedH264 == "true") { |
||||
|
||||
var loadingElement = document.getElementById(loadingElementId); |
||||
if (loadingElement) { |
||||
loadingElement.style.display = 'none'; |
||||
} |
||||
|
||||
// console.log("[airelay_init.html] hide preloadElement"); |
||||
var preloadElement = document.getElementById(preloadImgElementId); |
||||
if (preloadElement) { |
||||
preloadElement.style.display = 'none'; |
||||
} |
||||
|
||||
// 顯示預設按鈕 |
||||
var defaultButtonElement = document.getElementById('defaultBtn'); |
||||
|
||||
if (defaultButtonElement) { |
||||
defaultButtonElement.style.display = 'block'; |
||||
defaultButtonElement.style.width = iframeWidth + 'px'; |
||||
} |
||||
|
||||
// 顯示內層 iframe |
||||
var innerIframeElement = document.getElementById(innerIframeId); |
||||
|
||||
if (innerIframeElement) { |
||||
innerIframeElement.style.display = 'block'; // 先顯示才能知道高度 |
||||
|
||||
// 08-29 |
||||
var iframeDocument = innerIframeElement.contentDocument || innerIframeElement.contentWindow.document; |
||||
var iframeHeight = iframeDocument.body.offsetHeight; |
||||
|
||||
localStorage.setItem('iframeHeight', iframeHeight); |
||||
innerIframeElement.height = iframeHeight + defaultBtnOffset; |
||||
} |
||||
// console.log("[airelay_init.html] set innerIframeElement.height:", iframeHeight + defaultBtnOffset); |
||||
|
||||
clearInterval(checkH264IntervalID); |
||||
} |
||||
}, checkIntervalTime) |
||||
} |
||||
|
||||
// -------------------------------------------------------------------------------- |
||||
|
||||
function func_setTcptunnelPage(page) { |
||||
$.ajax({ |
||||
url: "/airelay/settcptunnel?page=" + page, |
||||
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.log(retdata); |
||||
}, |
||||
error: function (retdata) { |
||||
console.warn(retdata); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
function func_setDefault() { |
||||
if (confirm('Do you want to apply default settings?')) { |
||||
cookie("enable_only_show_metadata1", "on", "9999/12/31 12:00:00"); |
||||
$.ajax({ |
||||
url: '/' + g_tcp_tunnel_token + "/system?default=3", |
||||
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.log("[func_setDefault] retdata: ", retdata); |
||||
|
||||
//var jsonbuf = JSON.parse(retdata); |
||||
//$('#CPU_USAGE').val(jsonbuf["CPU_USAGE"] + " %"); |
||||
//$('#GPU_USAGE').val(jsonbuf["GPU_USAGE"] + " %"); |
||||
//$('#FPS').val(jsonbuf["FPS"]); |
||||
//document.getElementById('CPU_USAGE').innerHTML=jsonbuf["CPU_USAGE"]+" %"; |
||||
//document.getElementById('GPU_USAGE').innerHTML=jsonbuf["GPU_USAGE"]+" %"; |
||||
//document.getElementById('FPS').innerHTML=jsonbuf["FPS"]; |
||||
|
||||
|
||||
//func_getreload(); |
||||
//alert("Close or refresh the browser to reboot the camera."); |
||||
/* |
||||
var replaceUrl = 'http://' + window.location.hostname + ':' + myport + '/setup.htm'; |
||||
//alert(replaceUrl); |
||||
parent.window.location.replace(replaceUrl);*/ |
||||
//parent.open(parent.location, '_parent').close(); |
||||
//console.info(retdata); |
||||
}, |
||||
error: function (retdata) { |
||||
console.warn(retdata); |
||||
//alert("Close or refresh the browser to reboot the camera."); |
||||
//parent.open(parent.location, '_parent').close(); |
||||
} |
||||
}); |
||||
|
||||
var port = localStorage.getItem('landing_page_port'); |
||||
// console.log("[func_setDefault] port:", port); |
||||
|
||||
|
||||
var innerIframe = document.getElementById(innerIframeId); |
||||
if (innerIframe) { |
||||
innerIframe.width = iframeWidth; |
||||
innerIframe.height = '600px'; |
||||
innerIframe.style.border = '0'; |
||||
innerIframe.style.position = "absolute"; |
||||
innerIframe.frameBorder = '0'; // 設置 frameborder 屬性 |
||||
innerIframe.src = 'http://' + window.location.hostname + ':' + port + '/' + g_tcp_tunnel_token + '/countdown.html'; |
||||
} |
||||
|
||||
var defaultButtonElement = document.getElementById('defaultBtn'); |
||||
if (defaultButtonElement) { |
||||
defaultButtonElement.style.display = 'none'; |
||||
} |
||||
|
||||
|
||||
window.onload = function () { |
||||
window.scrollTo(0, 0); |
||||
}; |
||||
|
||||
//console.log('Apply default settings!'); |
||||
return false; |
||||
|
||||
} |
||||
} |
||||
|
||||
|
||||
function func_getaboutinfo() { |
||||
$.ajax({ |
||||
url: '/airelay' + "/getAidaInfo", |
||||
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); |
||||
localStorage.setItem("events_default_version", jsonbuf["events_default_version"]); |
||||
|
||||
//console.info(retdata); |
||||
}, |
||||
error: function (retdata) { |
||||
console.warn(retdata); |
||||
setTimeout(func_getPostEventName(), 3000); |
||||
} |
||||
}); |
||||
} |
||||
</script> |
||||
|
||||
<!-- 08-29 --> |
||||
<link rel="stylesheet" type="text/css" href="/airelay/bootstrap.min.css"> |
||||
</head> |
||||
|
||||
<body onContextMenu="window.event.returnValue=false" style="margin: 0px;"> |
||||
<div id="tabs" style="display: none;"> |
||||
<label id="TAB_ALARM"> |
||||
<a> |
||||
<nobr id="HTTP_TITLE05"></nobr> |
||||
</a> |
||||
</label> |
||||
<label id="TAB_OUTPUT"> |
||||
<a> |
||||
<nobr id="HTTP_TITLE08"></nobr> |
||||
</a> |
||||
</label> |
||||
<label id="TAB_SETTING"> |
||||
<a> |
||||
<nobr id="HTTP_TITLE06"></nobr> |
||||
</a> |
||||
</label> |
||||
<label id="TAB_LICENSE"> |
||||
<a> |
||||
<nobr id="HTTP_TITLE07"></nobr> |
||||
</a> |
||||
</label> |
||||
</div> |
||||
|
||||
<div id="preloadImg" style="position: absolute; display: none;"></div> |
||||
|
||||
<p id="percentage" height="650"> |
||||
Loading ... 0% |
||||
</p> |
||||
|
||||
<iframe id="innerIframe" frameborder="0" style="display: none;"></iframe> |
||||
|
||||
<div id="defaultBtn" align="center" style="display:none;"> |
||||
<button class="Content_stybtn_ln" onclick="func_setDefault()">Default</button> |
||||
</div> |
||||
|
||||
</body> |
||||
</html> |
||||
@ -0,0 +1,30 @@
|
||||
.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 { |
||||
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; |
||||
} |
||||
|
||||
.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; |
||||
} |
||||
@ -0,0 +1,275 @@
|
||||
var myport = "80"; |
||||
var g_check_if_airelay = 1; |
||||
|
||||
/* |
||||
var mymirror = "0"; |
||||
var myflip = "0"; |
||||
var myrotate = "0"; |
||||
*/ |
||||
/* |
||||
window.addEventListener("mousewheel", (e) => { |
||||
if (e.deltaY === 1) { |
||||
e.preventDefault(); |
||||
} |
||||
})*/ |
||||
|
||||
getIPCamSettings(); |
||||
// Restricts input for the given textbox to the given inputFilter.
|
||||
|
||||
function getIPCamSettings() { |
||||
var urlStr; |
||||
if (g_check_if_airelay == 1) { |
||||
urlStr = '/airelay/getipcamsettings'; |
||||
} |
||||
else { |
||||
urlStr = '/getipcamsettings'; |
||||
} |
||||
|
||||
if (localStorage.getItem('IPCAM_PORT') == null) { |
||||
$.ajax({ |
||||
//url: "/airelay/getipcamsettings",
|
||||
url: urlStr, |
||||
type: "GET", |
||||
async: false, |
||||
// timeout: 0,
|
||||
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); |
||||
|
||||
myport = jsonbuf["IPCAM_PORT"]; |
||||
localStorage.setItem("IPCAM_PORT", myport); |
||||
|
||||
/*mymirror = jsonbuf["IPCAM_MIRROR"]; |
||||
myflip = jsonbuf["IPCAM_FLIP"]; |
||||
myrotate = jsonbuf["IPCAM_ROTATE"]; |
||||
*/ |
||||
//console.info(retdata);
|
||||
}, |
||||
error: function (retdata) { |
||||
console.warn(retdata); |
||||
/* |
||||
if (localStorage.getItem('IPCAM_PORT') != null) { |
||||
myport = localStorage.getItem('IPCAM_PORT'); |
||||
}*/ |
||||
} |
||||
}); |
||||
} |
||||
else { |
||||
myport = localStorage.getItem('IPCAM_PORT'); |
||||
} |
||||
} |
||||
|
||||
|
||||
get_cgi = function () |
||||
{ |
||||
if (arguments.length == 0) |
||||
{ |
||||
return; |
||||
} |
||||
var ajax = new Array; |
||||
var _timeout; |
||||
if(window.location.protocol == "http:") |
||||
{ |
||||
ajax["port"] = myport; |
||||
if(arguments[0].port != null) |
||||
{ |
||||
ajax["port"] = arguments[0].port; |
||||
if (ajax["port"] == myport) |
||||
ajax["url"] = "http://"+ (document.URL.split('//')[1]).split('/')[0].split(':')[0] + arguments[0].cmd;
|
||||
else |
||||
ajax["url"] = "http://"+ (document.URL.split('//')[1]).split('/')[0].split(':')[0] + ":" + ajax["port"] + arguments[0].cmd; |
||||
}else{ |
||||
ajax["url"] = "http://"+ (document.URL.split('//')[1]).split('/')[0] + arguments[0].cmd; |
||||
} |
||||
|
||||
} |
||||
else |
||||
{ |
||||
ajax["url"] = "https://"+ (document.URL.split('//')[1]).split('/')[0] + arguments[0].cmd;
|
||||
} |
||||
|
||||
//console.log(ajax["url"]);
|
||||
|
||||
ajax["async"] = true; |
||||
if (typeof arguments[0].async == "boolean") |
||||
{ |
||||
ajax["async"] = arguments[0].async; |
||||
} |
||||
if(arguments[0].timeout != null) |
||||
{ |
||||
_timeout = arguments[0].timeout; |
||||
}else{ |
||||
_timeout = 30000; |
||||
} |
||||
ajax["get_parser"] = arguments[0].get_parser; |
||||
ajax["get_response"] = arguments[0].get_response; |
||||
if(arguments[0].parameter != null) |
||||
{ |
||||
ajax["parameter"] = arguments[0].parameter; |
||||
} |
||||
$.ajax({ |
||||
url: ajax["url"], |
||||
type: 'GET', |
||||
async: ajax["async"], |
||||
timeout: _timeout, |
||||
cache: false, |
||||
error: function (xhr) |
||||
{ |
||||
if (typeof ajax["get_parser"] == "function") |
||||
{ |
||||
ajax["get_parser"]("cgi_error"); |
||||
} |
||||
else if (typeof ajax["get_response"] == "function") |
||||
{ |
||||
ajax["get_response"]("cgi_error"); |
||||
} |
||||
}, |
||||
success: function (response) |
||||
{ |
||||
//console.info(response);
|
||||
if (typeof ajax["get_parser"] == "function") |
||||
{ |
||||
if(ajax["parameter"] != null) |
||||
{ |
||||
ajax["get_parser"](parse_key_array_content(response),ajax["parameter"]); |
||||
} |
||||
else |
||||
{ |
||||
ajax["get_parser"](parse_key_array_content(response)); |
||||
} |
||||
} |
||||
else if (typeof ajax["get_response"] == "function") |
||||
{ |
||||
ajax["get_response"](response); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
post_cgi = function() |
||||
{ |
||||
if (arguments.length == 0) |
||||
{ |
||||
return; |
||||
} |
||||
var ajax = new Array; |
||||
var _timeout; |
||||
|
||||
if(window.location.protocol == "http:") |
||||
{ |
||||
ajax["url"] = "http://"+ (document.URL.split('//')[1]).split('/')[0] + arguments[0].cmd;
|
||||
} |
||||
else |
||||
{ |
||||
ajax["url"] = "https://"+ (document.URL.split('//')[1]).split('/')[0] + arguments[0].cmd;
|
||||
} |
||||
//console.log(ajax["url"]);
|
||||
ajax["async"] = true; |
||||
if (typeof arguments[0].async == "boolean") |
||||
{ |
||||
ajax["async"] = arguments[0].async; |
||||
} |
||||
if(arguments[0].timeout != null) |
||||
{ |
||||
_timeout = arguments[0].timeout; |
||||
}else{ |
||||
_timeout = 1900; |
||||
} |
||||
|
||||
ajax["get_parser"] = arguments[0].get_parser; |
||||
ajax["post_data"] = arguments[0].post_data; |
||||
ajax["get_response"] = arguments[0].get_response; |
||||
|
||||
$.ajax({ |
||||
url: ajax["url"], |
||||
data: ajax["post_data"], |
||||
dataType: 'text', |
||||
type: 'POST', |
||||
async: ajax["async"], |
||||
timeout: _timeout, |
||||
cache: false, |
||||
error: function (xhr) |
||||
{ |
||||
if (typeof ajax["get_parser"] == "function") |
||||
{ |
||||
ajax["get_parser"]("cgi_error"); |
||||
} |
||||
else if (typeof ajax["get_response"] == "function") |
||||
{ |
||||
ajax["get_response"]("cgi_error"); |
||||
} |
||||
}, |
||||
success: function (response) |
||||
{ |
||||
if (typeof ajax["get_parser"] == "function") |
||||
{ |
||||
ajax["get_parser"](parse_key_array_content(response)); |
||||
} |
||||
else if (typeof ajax["get_response"] == "function") |
||||
{ |
||||
ajax["get_response"](response); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
parse_key_array_content = function(content,options) |
||||
{ |
||||
var options = $.extend({spliter1: '=', spliter2: '\n'},options); |
||||
var result = { all: content }; |
||||
var place = content.split(options.spliter2); |
||||
var info=new Array; |
||||
for (var i=0;i<place.length;i++) |
||||
{ |
||||
var sepSite = place[i].search(options.spliter1); |
||||
if (sepSite!=-1) |
||||
{ |
||||
var endSite = place[i].search(options.spliter2); |
||||
info[2*i] = place[i].slice(0,sepSite); |
||||
info[2*i+1] = place[i].slice(sepSite+1,endSite); |
||||
} |
||||
} |
||||
|
||||
var key, value, _i, _len; |
||||
for (var i = _i = 0, _len = info.length; _i < _len; i = _i += 2) |
||||
{ |
||||
key = $.trim(info[i]); |
||||
value = info[i + 1];//$.trim(info[i + 1]);
|
||||
if (key !== '') |
||||
{
|
||||
result[key] = value; |
||||
} |
||||
} |
||||
return result; |
||||
} |
||||
//common
|
||||
/*function my_sleep(delay) |
||||
{ |
||||
var start = new Date().getTime(); |
||||
while (new Date().getTime() < start + delay); |
||||
};*/ |
||||
function TranTextQuoteGV(v) |
||||
{ |
||||
var Sq_length=v.length; |
||||
var o=''; |
||||
for(var i=0;i < Sq_length;i++) |
||||
{ |
||||
if(v.charCodeAt(i)==0x2B)//+
|
||||
o+='%2B'; |
||||
else if(v.charCodeAt(i)==0x3B)//->;
|
||||
o+='%3B'; |
||||
else if(v.charCodeAt(i)==0x5C)//-> \
|
||||
o+='%5C';
|
||||
else if(v.charCodeAt(i)==0x2F)// ->/
|
||||
o+='%2F'; |
||||
else if(v.charCodeAt(i)==0x26)//->&
|
||||
o+='%26';
|
||||
else
|
||||
o+=v.charAt(i); |
||||
} |
||||
return o; |
||||
}; |
||||
@ -0,0 +1,347 @@
|
||||
function GE(a) { return document.getElementById(a) } |
||||
|
||||
function GES(a) { return document.getElementsByName(a) } |
||||
|
||||
function GetValue(b) { |
||||
var a = ""; |
||||
var c = GE(b); |
||||
if (c != null) { |
||||
if (c.type.indexOf("select") >= 0) { |
||||
a = c.options[c.selectedIndex].value |
||||
} else { a = c.value } |
||||
} else { |
||||
alert(b + " Error") |
||||
} |
||||
return a |
||||
} |
||||
|
||||
function SetValue(a, c) { |
||||
var d = GE(a); |
||||
if (d != null) { |
||||
if (d.type.indexOf("select") >= 0) { |
||||
for (var b = 0; b < d.options.length; b++) { |
||||
if (d.options[b].value == c) { d.selectedIndex = b; break } |
||||
} |
||||
} else { |
||||
d.value = c |
||||
} |
||||
} else { alert(a + " Error") } |
||||
} |
||||
|
||||
function Ctrl_Text(a, l, e, c, g, d, h, j, b, f, k, i) { |
||||
this.type = "text"; |
||||
this.active = !(b == true); |
||||
this.id = a; |
||||
this.value = c; |
||||
this.setcmd = g; |
||||
this.checker = d; |
||||
this.html = CreateTextHtml(a, l, e, c, h, j, f, k, i); |
||||
this.GV = function () { return GetValue(this.id) }; |
||||
this.SV = function (m) { SetValue(this.id, m) } |
||||
} |
||||
|
||||
function CreateTextHtml(a, k, b, i, f, g, d, j, e) { |
||||
var h = "text"; |
||||
if (f) { h = "password"; } else { if (k == "0") { h = "hidden"; } } |
||||
var c = ""; |
||||
c += "<input name='" + a + "' id='" + a + "' type='" + h + |
||||
"' size='" + k + "' maxlength='" + b + "' value='" + i + "'"; |
||||
if (g != null) { c += "onChange='" + g + "' ";} |
||||
if (d != null) { |
||||
c += "onKeyup='" + d + "' "; |
||||
//c += "onkeyup = \"this.value=this.value.replace(/[^\w_]/g,'');\"";
|
||||
} |
||||
if (j != null) { |
||||
c += "onKeyPress='" + j + "' "; |
||||
} |
||||
if (e != null) { c += e;} c += ">"; |
||||
return c; |
||||
} |
||||
|
||||
function Ctrl_Check(f, e, d, c, a, b) { |
||||
this.type = "check"; |
||||
this.active = !(b == true); |
||||
this.id = f; |
||||
this.value = e; |
||||
this.setcmd = d; |
||||
this.checker = a; |
||||
this.onClickFunc = c; |
||||
this.GetHtml = function () { |
||||
var g = ""; |
||||
g += '<input type="checkbox" id="' + this.id + '" name="' + |
||||
this.id + '" '; |
||||
if (this.value == 1) { |
||||
g += "checked " |
||||
} |
||||
if (this.onClickFunc != null) { |
||||
g += "onClick='" + this.onClickFunc + "'" |
||||
} |
||||
g += " >"; |
||||
return g |
||||
}; |
||||
this.html = this.GetHtml(); |
||||
this.GV = function () { return Bool2Int(IsChecked(this.id)) }; |
||||
this.SV = function (g) { SetChecked(this.id, (g == 1)) } |
||||
} |
||||
|
||||
function IsChecked(b) { |
||||
var c = GE(b); |
||||
var a = false; |
||||
if (c != null) { |
||||
a = c.checked |
||||
} |
||||
return a |
||||
} |
||||
|
||||
function SetChecked(a, b) { |
||||
var c = GE(a); |
||||
if (c != null) { |
||||
c.checked = b |
||||
} |
||||
} |
||||
|
||||
function Bool2Int(a) { return (a) ? 1 : 0 } |
||||
|
||||
function Ctrl_Radio(f, e, d, c, a, b) { |
||||
this.type = "radio"; |
||||
this.active = !(b == true); |
||||
this.id = f; |
||||
this.value = e; |
||||
this.setcmd = d; |
||||
this.checker = a; |
||||
this.onClickFunc = c; |
||||
this.GetHtml = function (h) { |
||||
var g = "<input type='radio' name='" + this.id + "' id='" + |
||||
this.id + "' value='" + h + "' "; |
||||
if (this.value == h) { g += "checked " } |
||||
if (this.onClickFunc != null) { |
||||
g += "onClick='" + this.onClickFunc + "'" |
||||
} |
||||
g += " >"; |
||||
return g |
||||
}; |
||||
this.GV = function () { return GetRadioValue(this.id) }; |
||||
this.SV = function (g) { SetRadioValue(this.id, g) } |
||||
} |
||||
|
||||
function GetRadioValue(a) { |
||||
var d = 0; |
||||
var c; |
||||
var b = GES(a); |
||||
if (b != null) { |
||||
for (c = 0; c < b.length; c++) { |
||||
if (b[c].checked == true) { d = b[c].value; break } |
||||
} |
||||
} |
||||
return d |
||||
} |
||||
|
||||
function SetRadioValue(a, d) { |
||||
var c; |
||||
var b = GES(a); |
||||
if (b != null) { |
||||
for (c = 0; c < b.length; c++) { |
||||
if (b[c].value == d) { |
||||
b[c].checked = true; |
||||
break |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
function Ctrl_Select(g, d, f, e, c, a, b) { |
||||
this.type = "select"; |
||||
this.active = !(b == true); |
||||
this.id = g; |
||||
this.list = d; |
||||
this.value = f; |
||||
this.setcmd = e; |
||||
this.checker = a; |
||||
this.html = SelectObjectNoWrite(g, d, this.value, c); |
||||
this.GV = function () { return GetValue(this.id) }; |
||||
this.SV = function (h) { SetValue(this.id, h) } |
||||
} |
||||
|
||||
function SelectObjectNoWrite(d, c, e, a) { |
||||
var f = ""; |
||||
f += '<SELECT NAME="' + d + '" id="' + d + '" '; |
||||
if (a == null) { |
||||
f += ">" |
||||
} else { f += ' onChange="' + a + '" >' } aryOption = c.split(";"); |
||||
for (var b = 0; b < aryOption.length; b++) { |
||||
if (b == e) { |
||||
f += "<OPTION selected value=" + b + ">" + aryOption[b] |
||||
} else { |
||||
f += "<OPTION value=" + b + ">" + aryOption[b] |
||||
} |
||||
} |
||||
f += "</SELECT>"; |
||||
return f |
||||
} |
||||
|
||||
function Ctrl_Select_Hidden(g, d, f, e, c, a, b) { |
||||
this.type = "select"; |
||||
this.active = !(b == true); |
||||
this.id = g; |
||||
this.list = d; |
||||
this.value = f; |
||||
this.setcmd = e; |
||||
this.checker = a; |
||||
this.html = SelectObjectNoWrite_Hidden(g, d, this.value, c); |
||||
this.GV = function () { return GetValue(this.id) }; |
||||
this.SV = function (h) { SetValue(this.id, h) } |
||||
} |
||||
|
||||
function SelectObjectNoWrite_Hidden(d, c, e, a) { |
||||
var f = ""; |
||||
f += '<SELECT style="visibility:hidden;" NAME="' + d + '" id="' + d + '" '; |
||||
if (a == null) { |
||||
f += ">" |
||||
} else { f += ' onChange="' + a + '" >' } aryOption = c.split(";"); |
||||
for (var b = 0; b < aryOption.length; b++) { |
||||
if (b == e) { |
||||
f += "<OPTION selected value=" + b + ">" + aryOption[b] |
||||
} else { |
||||
f += "<OPTION value=" + b + ">" + aryOption[b] |
||||
} |
||||
} |
||||
f += "</SELECT>"; |
||||
return f |
||||
} |
||||
|
||||
function Ctrl_SelectNum(a, h, b, k, e, g, j, i, f, d, c) { |
||||
this.type = "selectNum"; |
||||
this.active = !(c == true); |
||||
this.id = a; |
||||
this.value = e; |
||||
this.setcmd = g; |
||||
this.checker = d; |
||||
this.html = GetSelectNumberHtml(a, h, b, k, this.value, j, i, f); |
||||
this.rehtml = function (l, m) { |
||||
return GetSelectNumberHtml(a, l, m, k, this.value, j, i |
||||
, f) |
||||
}; |
||||
this.GV = function () { return GetValue(this.id) }; |
||||
this.SV = function (l) { |
||||
this.value = l; |
||||
SetValue(this.id, l) |
||||
} |
||||
} |
||||
|
||||
function GetSelectNumberHtml(a, b, d, j, l, h, k, e) { |
||||
var c = ""; |
||||
c += '<select id="' + a + '" name="' + a + '" '; |
||||
if (h != null) { |
||||
c += ' onchange="' + h + '"' |
||||
} |
||||
if (k != null) { |
||||
c += ' onfocus="' + k + '"' |
||||
} |
||||
c += ">"; |
||||
var f = 0; |
||||
for (f = b; f <= d; f += j) { |
||||
var g = f; |
||||
if (e != null) { g = FixNum(f, e) } |
||||
if (f == l) { c += "<option selected value=" + f + ">" + g } else { |
||||
c += "<option value=" + f + ">" + g |
||||
} |
||||
} |
||||
c += "</select>"; |
||||
return c |
||||
} |
||||
|
||||
function Ctrl_SelectEx(g, d, f, e, c, a, b) { |
||||
this.type = "select"; |
||||
this.active = !(b == true); |
||||
this.id = g; |
||||
this.list = d; |
||||
this.value = f; |
||||
this.setcmd = e; |
||||
this.onChangeFunc = c; |
||||
this.checker = a; |
||||
this.html = SelectObjectNoWriteEx(this.id, this.list, this.value |
||||
, this.onChangeFunc); |
||||
this.GV = function () { return GetValue(this.id) }; |
||||
this.SV = function (h) { SetValue(this.id, h) }; |
||||
this.rehtml = function (h, i) { |
||||
return SelectObjectNoWriteEx(this.id, h, (i != null) ? i : |
||||
this.value, this.onChangeFunc) |
||||
} |
||||
} |
||||
|
||||
function SelectObjectNoWriteEx(d, c, e, a) { |
||||
var f = ""; |
||||
f += '<SELECT NAME="' + d + '" id="' + d + '" '; |
||||
if (a == null) { |
||||
f += ">" |
||||
} else { f += ' onChange="' + a + '" >' } aryOption = c.split(";"); |
||||
for (var b = 0; b < aryOption.length; b++) { |
||||
if (aryOption[b] == e) { |
||||
f += '<OPTION selected value="' + aryOption[b] + '">' + |
||||
aryOption[b] |
||||
} else { |
||||
f += '<OPTION value="' + aryOption[b] + '">' + aryOption[ |
||||
b] |
||||
} |
||||
} |
||||
f += "</SELECT>"; |
||||
return f |
||||
} |
||||
|
||||
function Ctrl_Select2List(h, a, g, f, e, d, b, c) { |
||||
this.type = "select"; |
||||
this.active = !(c == true); |
||||
this.id = h; |
||||
this.list1 = a; |
||||
this.list2 = g; |
||||
this.value = f; |
||||
this.setcmd = e; |
||||
this.onChangeFunc = d; |
||||
this.checker = b; |
||||
this.html = SelectObjectNoWrite2List(this.id, this.list1, this.list2 |
||||
, this.value, this.onChangeFunc); |
||||
this.GV = function () { return GetValue(this.id) }; |
||||
this.SV = function (i) { SetValue(this.id, i) } |
||||
} |
||||
|
||||
function SelectObjectNoWrite2List(d, g, c, e, a) { |
||||
var f = ""; |
||||
f += '<SELECT NAME="' + d + '" id="' + d + '" '; |
||||
if (a == null) { |
||||
f += ">" |
||||
} else { f += ' onChange="' + a + '" >' } aryOption = c.split(";"); |
||||
aryValue = g.split(";"); |
||||
for (var b = 0; b < aryOption.length; b++) { |
||||
if (aryValue[b] == e) { |
||||
f += '<OPTION selected value="' + aryValue[b] + '">' + |
||||
aryOption[b] |
||||
} else { |
||||
f += '<OPTION value="' + aryValue[b] + '">' + aryOption[b] |
||||
} |
||||
} |
||||
f += "</SELECT>"; |
||||
return f |
||||
} |
||||
|
||||
function DisableObjs(c, b) { |
||||
for (var a = 0; a < c.length; a++) { |
||||
DisableObject(c[a], b) |
||||
} |
||||
} |
||||
|
||||
function DisableObject(a, c) { |
||||
var f = GE(a); |
||||
if (f != null) { |
||||
f.disabled = c |
||||
} |
||||
try { SetCIA(a, !c) } catch (d) {} |
||||
var g = GES(a); |
||||
if (g != null) { |
||||
for (var b = 0; b < g.length; b++) { |
||||
g[b].disabled = c |
||||
} |
||||
} |
||||
} |
||||
|
||||
function SetCIA(b, a) { CTRLARY[b].active = (a == true) }; |
||||
var abab1=[11,99,33]; |
||||
@ -0,0 +1,121 @@
|
||||
|
||||
var MIN_RANGE_MIN_CHARACTERS = 0; |
||||
var MAX_RANGE_MIN_CHARACTERS = 100; |
||||
|
||||
var MIN_RANGE_MAX_CHARACTERS = 0; |
||||
var MAX_RANGE_MAX_CHARACTERS = 100; |
||||
|
||||
var MIN_RANGE_CONFIDENCE = 0; |
||||
var MAX_RANGE_CONFIDENCE = 100; |
||||
|
||||
var MIN_RANGE_OBJ_MAX_PROPORTION = 0; |
||||
var MAX_RANGE_OBJ_MAX_PROPORTION = 100; |
||||
|
||||
var MIN_RANGE_OBJ_MIN_PROPORTION = 0; |
||||
var MAX_RANGE_OBJ_MIN_PROPORTION = 100; |
||||
|
||||
var MIN_RANGE_NO_PARKING_TIME = 0; |
||||
var MAX_RANGE_NO_PARKING_TIME = 100; |
||||
|
||||
var G_CAM_SENSOR_RES_WIDTH = 3840; |
||||
var G_CAM_SENSOR_RES_HEIGHT = 2160; |
||||
var G_CAM_VIDEO_RES_WIDTH = 1920; |
||||
var G_CAM_VIDEO_RES_HEIGHT = 1080; |
||||
var G_VIEW_CANVAS_X = 480; |
||||
var G_VIEW_CANVAS_Y = 320; |
||||
|
||||
//trigger events
|
||||
var TRIGGER_ZONE_VIOLATION = 1; |
||||
var TRIGGER_PARKING_VIOLATION = 4; |
||||
var TRIGGER_GO_STRAIGHT = 8; |
||||
var TRIGGER_TURN_LEFT = 16; |
||||
var TRIGGER_TURN_RIGHT = 32; |
||||
var TRIGGER_SPEED_HIGH = 8192; |
||||
var TRIGGER_SPEED_LOW = 16384; |
||||
var TRIGGER_DISTANCE_VIOLATION = 262144; |
||||
var TRIGGER_ALLOW_LIST = 2097152; |
||||
var TRIGGER_BLOCK_LIST = 4194304; |
||||
var TRIGGER_GUEST_LIST = 8388608; |
||||
var TRIGGER_MISSING_UNATTENDED = 16777216; |
||||
var TRIGGER_BG_LEARNING = 33554432; |
||||
var TRIGGER_TAMPERING = 67108864; |
||||
var TRIGGER_HIGH_VIOLATION = 134217728; |
||||
|
||||
var TRIGGER_GO_STRAIGHT_RED_LIGHT = 1024; |
||||
var TRIGGER_TURN_LEFT_RED_LIGHT = 2048; |
||||
var TRIGGER_TURN_RIGHT_RED_LIGHT = 4096; |
||||
|
||||
var TRIGGER_QUEUING_VIOLATION = 268435456; |
||||
var TRIGGER_MISSING_OBJECT_DETECTION = 536870912; |
||||
var TRIGGER_ALL_OBJECTS = 1073741824; |
||||
var TRIGGER_LACK_OF_ANY_OBJECT = 2147483648; |
||||
|
||||
var COLOR_ARRAY = ["#F0F0F0", "Red", "#F0F0F0", "Yellow", "Green", "Blue", "Cyan", "Purple", "Black", "#F0F0F0", "Silver", "Darkgray"];//index 0、2、6 沒有在使用,所以一律設定成#F0F0F0
|
||||
|
||||
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"]; |
||||
|
||||
var myport = "80"; |
||||
|
||||
var g_check_if_airelay = 1; |
||||
|
||||
/* |
||||
var mymirror = "0"; |
||||
var myflip = "0"; |
||||
var myrotate = "0"; |
||||
*/ |
||||
/* |
||||
window.addEventListener("mousewheel", (e) => { |
||||
if (e.deltaY === 1) { |
||||
e.preventDefault(); |
||||
} |
||||
})*/ |
||||
|
||||
getIPCamSettings(); |
||||
// Restricts input for the given textbox to the given inputFilter.
|
||||
|
||||
function getIPCamSettings() { |
||||
var urlStr; |
||||
if (g_check_if_airelay == 1) { |
||||
urlStr = '/airelay/getipcamsettings'; |
||||
} |
||||
else { |
||||
urlStr = '/getipcamsettings'; |
||||
} |
||||
|
||||
if (localStorage.getItem('IPCAM_PORT') == null) { |
||||
$.ajax({ |
||||
//url: "/airelay/getipcamsettings",
|
||||
url: urlStr, |
||||
type: "GET", |
||||
async: false, |
||||
// timeout: 0,
|
||||
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); |
||||
|
||||
myport = jsonbuf["IPCAM_PORT"]; |
||||
localStorage.setItem("IPCAM_PORT", myport); |
||||
|
||||
/*mymirror = jsonbuf["IPCAM_MIRROR"]; |
||||
myflip = jsonbuf["IPCAM_FLIP"]; |
||||
myrotate = jsonbuf["IPCAM_ROTATE"]; |
||||
*/ |
||||
//console.info(retdata);
|
||||
}, |
||||
error: function (retdata) { |
||||
console.warn(retdata); |
||||
/* |
||||
if (localStorage.getItem('IPCAM_PORT') != null) { |
||||
myport = localStorage.getItem('IPCAM_PORT'); |
||||
}*/ |
||||
} |
||||
}); |
||||
} |
||||
else { |
||||
myport = localStorage.getItem('IPCAM_PORT'); |
||||
} |
||||
} |
||||
@ -0,0 +1,84 @@
|
||||
|
||||
!function (e, t) { |
||||
"function" == typeof define && define.amd ? define(t) : "object" == typeof exports && exports ? module.exports = t() : e.cookie = t(); |
||||
} |
||||
|
||||
("undefined" == typeof window ? this : window, function () |
||||
{ |
||||
function e(e) { |
||||
return !!e && "[object Object]" === Object.prototype.toString.call(e); |
||||
} |
||||
function t(e) { |
||||
return Array.prototype.slice.call(e); |
||||
} |
||||
function n(e) { |
||||
for (var t = e.split(":"), n = 0, r = t.length; n < r; n++) |
||||
0 == t[n].split("")[0] && (t[n] = t[n].split("")[1]); |
||||
var o = new Date, |
||||
i = parseInt(t[0]) - o.getHours(), |
||||
a = parseInt(t[1]) - o.getMinutes(), |
||||
s = parseInt(t[2]) - o.getSeconds(); |
||||
return 1e3 * (60 * i * 60 + 60 * a + s); |
||||
} |
||||
function r() { |
||||
if (!(this instanceof r)) |
||||
return new r; |
||||
} |
||||
var o = Object.keys || function (e) { |
||||
var t = [], n = ""; |
||||
for (n in e) |
||||
e.hasOwnProperty(n) && t.push(n); |
||||
return t; |
||||
}, |
||||
i = Array.isArray || function (e) { |
||||
return "[object Array]" === Object.prototype.toString.call(e); |
||||
}; |
||||
r.prototype = { |
||||
get: function (e) { |
||||
return e && "string" == typeof e ? this.all()[e] || null : null; |
||||
}, |
||||
set: function (t, r, o) { |
||||
var i = e(o) ? o : { |
||||
expires: o |
||||
}, |
||||
a = void 0 !== i.expires ? i.expires : "", |
||||
s = typeof a; |
||||
if ("string" === s && "" !== a) { |
||||
var u = /^([01]\d|2[0-3]):[0-5]\d:([0-5]\d)$/; |
||||
a = u.test(a) ? new Date(+new Date + n(a)) : new Date(a); |
||||
} else |
||||
"number" === s && (a = new Date(+new Date + 864e5 * a)); |
||||
"" !== a && "toGMTString" in a && (a = "; expires=" + a.toGMTString()); |
||||
var c = "; path=" + (i.path ? i.path : "/"), |
||||
p = i.domain ? "; domain=" + i.domain : "", |
||||
f = i.secure ? "; secure" : ""; |
||||
document.cookie = t + "=" + escape(r) + a + c + p + f; |
||||
}, |
||||
remove: function (e) { |
||||
e = i(e) ? e : t(arguments); |
||||
for (var n = 0, r = e.length; n < r; n++) |
||||
this.set(e[n], "", -1); |
||||
return e; |
||||
}, |
||||
clear: function () { |
||||
return this.remove(o(this.all())); |
||||
}, |
||||
all: function () { |
||||
var e = {}; |
||||
if (document.cookie) |
||||
for (var t = document.cookie.split("; "), n = 0, r = t.length; n < r; n++) { |
||||
var o = t[n].split("="); |
||||
e[unescape(o[0])] = unescape(o[1]); |
||||
} |
||||
return e; |
||||
} |
||||
}; |
||||
var a = function (e, t, n) { |
||||
var o = r(), |
||||
i = arguments.length; |
||||
return 1 === i && "string" == typeof e ? o.get(e) : i > 1 && e && t ? o.set(e, t, n) : null === t ? o.remove(e) : o.all(); |
||||
}; |
||||
for (var s in r.prototype) |
||||
a[s] = r.prototype[s]; |
||||
return a; |
||||
}); |
||||