// JavaScript Document var channelPlay = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; var channelRec = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; var autoSize = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; var audioControl = false; var curSelChn = 0; var ptzSelChn = 1; var hue = {}; var Bright = {}; var Contrast = {}; var Saturation = {}; var Sharp = {}; var IEVersion = "18.06.11.4441"; var pluginVersion = "1.0.0.4380"; var g_bIsIE = !(/(msie\s|trident.*rv:)([\w.]+)/.exec(navigator.userAgent.toLowerCase()) == null); var autoCloseTime = 10; function ReSetMaskLayer() { $("#MaskLayout").css("width",document.body.clientWidth); $("#MaskLayout").css("height",document.body.clientHeight); } function DivBox(objMain, obj){ var $obj = $(obj); if (String($(objMain).prop("checked")) == "false"){ $obj.find("select").prop("disabled",true); $obj.children().prop("disabled",true); if($.browser.chrome){ $obj.find(":text").each(function(){ $(this).attr("readonly","true"); }); $obj.find(":password").each(function(){ $(this).attr("readonly","true"); }); $obj.find(".addTimeClick").each(function(){ $(this).attr("black","true"); }); }else{ $obj.find(":text").each(function(){ $(this).prop("readonly","true"); }); $obj.find(":password").each(function(){ $(this).prop("readonly","true"); }); $obj.find(".addTimeClick").each(function(){ $(this).prop("black","true"); }); } if($obj.css("display") != "none")$obj.fadeTo("slow", 0.2); }else{ $obj.find("select").prop("disabled",false); if($obj.css("display") != "none"){ $obj.fadeTo("slow", 1,function(){ //兼容safari处理 $obj.css("filter",""); }); } $obj.children().prop("disabled",false); if($.browser.chrome){ $obj.find(":text").each(function(){ $(this).removeAttr("readonly"); }); $obj.find(":password").each(function(){ $(this).removeAttr("readonly"); }); $obj.find(".addTimeClick").each(function(){ $(this).attr("black","false"); }); }else{ $obj.find(":text").each(function(){ $(this).removeProp("readonly"); }); $obj.find(":password").each(function(){ $(this).removeProp("readonly"); }); $obj.find(".addTimeClick").each(function(){ $(this).prop("black","false"); }); } } } function showDiv(objMain, obj){//0显示,1隐藏 var $obj = $(obj); if (objMain == 1){ $obj.find("select").prop("disabled",true); $obj.children().prop("disabled",true); $obj.find(":text").each(function(){ $(this).attr("disabled", true); }); $obj.find(":password").each(function(){ $(this).attr("disabled", true); }); if($obj.css("display") != "none")$obj.fadeTo("slow", 0.2); }else{ $obj.find("select").prop("disabled",false); if($obj.css("display") != "none"){ $obj.fadeTo("slow", 1,function(){ //兼容safari处理 $obj.css("filter",""); }); } $obj.children().prop("disabled",false); $obj.find(":text").each(function(){ $(this).attr("disabled", false); }); $obj.find(":password").each(function(){ $(this).attr("disabled", false); }); } } Date.prototype.Format = function(fmt) { var o = { "M+" : this.getMonth()+1, //月份 "d+" : this.getDate(), //日 "h+" : this.getHours(), //小时 "m+" : this.getMinutes(), //分 "s+" : this.getSeconds(), //秒 "q+" : Math.floor((this.getMonth()+3)/3), //季度 "S" : this.getMilliseconds() //毫秒 }; if(/(y+)/.test(fmt)) fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length)); for(var k in o) if(new RegExp("("+ k +")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length))); return fmt; }; function NotifyActiveX(p) { if (p.object == null) { ShowDownloadPluginHyperLink(); return; } } function ShowDownloadPluginHyperLink() { window.location.href = "html/webplugin.html"; } //显示遮罩层 function MasklayerShow() { //HidePaop(); //clearTimeout(gVar.nTimer); var bgObj=document.getElementById("MaskLayout"); bgObj.style.width = document.body.offsetWidth + "px"; bgObj.style.height = screen.height + "px"; bgObj.style.display = "block"; } //隐藏遮罩层 function MasklayerHide() { var bgObj=document.getElementById("MaskLayout"); bgObj.style.width = document.body.offsetWidth + "px"; bgObj.style.height = screen.height + "px"; bgObj.style.display = "none"; } function ShowPaop(title, contant){ // if(gVar.sPage == "live"){ // if (typeof contant != 'undefined'){ // clearTimeout(gVar.nTimer); // if ($("#IPCTooltip").attr("name") != "in"){ // $("#IPCTooltip").css("display", "").slideDown("slow").attr("name", "in"); // } // $("#IPCTooltip").prop("innerHTML", contant); // // setTimeout(function(){ // $("#IPCTooltip").css("background-position", "0 0") // setTimeout(function(){ // $("#IPCTooltip").css("background-position", "0 -62px") // setTimeout(function(){$("#IPCTooltip").css("background-position", "0 -31px")}, 200); // }, 200); // }, 200); // // gVar.nTimer = setTimeout(function(){ // HidePaop(); // }, 3000); // } // }else{ if (typeof title != 'undefined' && typeof contant != 'undefined'){ clearTimeout(gVar.nTimer); if ($("#MsgPaop").attr("name") != "in"){ $("#MsgPaop").css("display", "").slideDown("slow").attr("name", "in"); } $("#Paoptitle").prop("innerHTML", ""+title+""); $("#PaopContant").prop("innerHTML", contant); setTimeout(function(){ $("#PaopBg").css("background-position", "0 -38px"); setTimeout(function(){ $("#PaopBg").css("background-position", "0px -76px"); setTimeout(function(){$("#PaopBg").css("background-position", "0 0")}, 200); }, 200); }, 200); gVar.nTimer = setTimeout(function(){ HidePaop(); }, 3000); } // } } function HidePaop(){ // if(gVar.sPage == "live"){ // $("#IPCTooltip").fadeOut("slow").slideUp("slow", function(){ // $(this).css("display", "none"); // }).attr("name", "out"); // }else{ $("#MsgPaop").fadeOut("slow").slideUp("slow", function(){ $(this).css("display", "none"); }).attr("name", "out"); // } } function parseXmlFromStr(szXml) { if(null == szXml || '' == szXml) { return null; } var xmlDoc = new createxmlDoc(); if(!$.browser.msie) { var oParser = new DOMParser(); xmlDoc = oParser.parseFromString(szXml, "text/xml"); } else { xmlDoc.loadXML(szXml); } return xmlDoc; } function createxmlDoc() { var xmlDoc; var aVersions = ["MSXML2.DOMDocument", "MSXML2.DOMDocument.5.0", "MSXML2.DOMDocument.4.0", "MSXML2.DOMDocument.3.0", "Microsoft.XmlDom"]; for(var i = 0; i < aVersions.length; i++) { try { xmlDoc = new ActiveXObject(aVersions[i]); break; } catch(oError) { xmlDoc = document.implementation.createDocument("", "", null); break; } } xmlDoc.async = "false"; return xmlDoc; } function Web_prompt(str){ MasklayerHide(); if(str == "" || str == null) { str = "can't find the language !";} $("#Web_false").text(str).css("color","red"); setTimeout('$("#Web_false").fadeIn("slow")',500); setTimeout('$("#Web_false").fadeOut("slow")',5000); } //IE下 function findNode(name, xml){ xml = '' + xml + ''; xml = xml.split(name).join("p"); xml = $(xml).find("p").html(); return xml == null? -1: xml; } function findChildNode(name, child, xml){ var s = xml.indexOf(name); if (s == -1) {alert(lg.get("IDS_REFRESH_NONODE"));return;} s = s + name.length + 1; xml = xml.substring(s, xml.length); var e = xml.indexOf(name); if (e == -1) {alert(lg.get("IDS_REFRESH_NONODE"));return;} e = e - 2; xml = xml.substring(0, e); xml = '' + xml + ''; // xml = xml.split(child).join("p"); xml = xml.split("<"+child+">")[1].split("")[0]; // xml.replace(/(^\s*)|(\s*$)/g, " "); // xml = $(xml).find("p").html(); return xml == null? "": xml; } //让文本框、文本域和密码框可以选择 function fbd() { var the = event.srcElement ; //通过body的onselectstart属性,控制叶面内容的可选状态。 //标签是 input text 以及 文本域textarea 的,均为可以选择项目。 if( !( ( the.tagName== "INPUT" && the.type.toLowerCase() == "password" ) ||( the.tagName== "INPUT" && the.type.toLowerCase() == "text" ) || the.tagName== "TEXTAREA" )){ return false; } return true; } //复制通道公共方法 function copyTD(displayDiv,checkboxIds,joinDiv, num){ if (typeof num == 'undefined') num = gDvr.nChannel; $(displayDiv).css("display","block"); var tempstr = ""; var tempstr1 = ""; var tempstr2 = ""; var tempstr3 = ""; if(num<=8){ $('#'+joinDiv+'_2_2').css("display","none"); $('#'+joinDiv+'_3_3').css("display","none"); $('#'+joinDiv+'_4_4').css("display","none"); }else if(num<=16){ $('#'+joinDiv+'_3_3').css("display","none"); $('#'+joinDiv+'_4_4').css("display","none"); }else if(num<=24){ $('#'+joinDiv+'_4_4').css("display","none"); } var chnName = ''; for(var i=0;i'; if(i<8){ tempstr += inner; } else{ tempstr1 += inner; } } else{ chnName = lg.get("IDS_CH")+(i+1); if(i<16){ tempstr1+='
'; }else if(i<24){ tempstr2+='
'; }else{ tempstr3+='
'; } } } document.getElementById(joinDiv+"_1").innerHTML=tempstr; document.getElementById(joinDiv+"_2").innerHTML=tempstr1; if(gDvr.nChannel>16 && gDvr.nChannel<=24){ document.getElementById(joinDiv+"_3").innerHTML=tempstr2; } if(gDvr.nChannel>24){ document.getElementById(joinDiv+"_3").innerHTML=tempstr2; document.getElementById(joinDiv+"_4").innerHTML=tempstr3; } } function CreateLiveBtn(){ //live页面根据通道号生成通道 if ($(".mclcontainer").attr("name") != "isDown"){return;} var liveHtml=""; for(var i=1;i<=gDvr.nChannel;i++){ liveHtml+='
\
'+gDvr.chname[i-1]+'
\
\
\
\
'; } $("#liveleft").html(liveHtml); //回放页面根据通道生成通道号 var playHtml=""; if(gDvr.nChannel===32){ // $("#playBackChannal").css("height","385px"); $("#rss").css("margin-top","5px"); for(var i=1;(i<=gDvr.nChannel) && (i<=16);i++){ playHtml+=("
\
"+ "
" +gDvr.chname[i-1]+"
"+ "
"); } $("#playBack_td1").prop("innerHTML", playHtml); playHtml=""; for(var i=17;(i<=gDvr.nChannel) && (i<=32);i++){ playHtml+=("
\
"+ "
" +gDvr.chname[i-1]+"
"+ "
"); } $("#playBack_td2").prop("innerHTML", playHtml); }else if(gDvr.nChannel===24 || gDvr.nChannel===25){ // $("#playBackChannal").css("height","290px"); $("#rss").css("margin-top","5px"); for(var i=1;(i<=gDvr.nChannel) && (i<=12);i++){ playHtml+=("
\
"+ "
" +gDvr.chname[i-1]+"
"+ "
"); } $("#playBack_td1").prop("innerHTML", playHtml); playHtml=""; for(var i=13;i<=gDvr.nChannel;i++){ playHtml+=("
\
"+ "
" +gDvr.chname[i-1]+"
"+ "
"); } $("#playBack_td2").prop("innerHTML", playHtml); }else if(gDvr.nChannel===20){ // $("#playBackChannal").css("height","290px"); $("#rss").css("margin-top","5px"); for(var i=1;(i<=gDvr.nChannel) && (i<=8);i++){ playHtml+=("
\
"+ "
" +gDvr.chname[i-1]+"
"+ "
"); } $("#playBack_td1").prop("innerHTML", playHtml); playHtml=""; for(var i=9;i<=gDvr.nChannel;i++){ playHtml+=("
\
"+ "
" +gDvr.chname[i-1]+"
"+ "
"); } $("#playBack_td2").prop("innerHTML", playHtml); }else if(gDvr.nChannel===10 || gDvr.nChannel===12){ // $("#playBackChannal").css("height","230px"); $("#rss").css("margin-top","5px"); for(var i=1;(i<=gDvr.nChannel) && (i<=4);i++){ playHtml+=("
\
"+ "
" +gDvr.chname[i-1]+"
"+ "
"); } $("#playBack_td1").prop("innerHTML", playHtml); playHtml=""; for(var i=5;i<=gDvr.nChannel;i++){ playHtml+=("
\
"+ "
" +gDvr.chname[i-1]+"
"+ "
"); } $("#playBack_td2").prop("innerHTML", playHtml); }else{ for(var i=1;(i<=gDvr.nChannel) && (i<=8);i++){ playHtml+=("
\
"+ "
" +gDvr.chname[i-1]+"
"+ "
"); } $("#playBack_td1").prop("innerHTML", playHtml); playHtml=""; for(var i=9;(i<=gDvr.nChannel) && (i<=16);i++){ playHtml+=("
\
"+ "
" +gDvr.chname[i-1]+"
"+ "
"); } $("#playBack_td2").prop("innerHTML", playHtml); } UI.Button("div[id^='liveChn_Play_']", 31, null, function(e, p){ //live页面左边栏按钮注册 var $p = $(p); var str = $p.attr("id"); var cmd = (str.split("_")[2]*1-1); if (e.type == "mousedown"){ if ($p.attr("name") == "disable" ){ return false; }else if($p.attr("name") != "active" ){ gDvr.PlayVideo(cmd, gVar.nStreamType); getOSDName(cmd); channelPlay[cmd] = 1; if(cmd == curSelChn){ showPTZ(cmd); } $p.css("background-position", "-31px 0px").attr("name","active"); $(".liveBtnBt2").css("background-position", "0px -31px"); } else{ gDvr.StopVideo(cmd); channelPlay[cmd] = 0; if(cmd == curSelChn){ hidePTZ(cmd); } $p.css("background-position", "0px 0px").attr("name",""); //点击left页面的play图标,关掉任何一个视频,Zoom图标都切到off状态 if($(".liveBtnBt11").attr("name") == "active"){ $(".liveBtnBt11").css("background-position", "-32px 0px").attr("name", ""); } } return false; }else if(e.type == "mouseover"){ if($p.attr("name")=="disable") return false; } else if(e.type == "mouseout"){ if($p.attr("name")=="disable") return false;} else if(e.type == "mouseup"){ if($p.attr("name")=="disable") return false; } if($p.attr("name") != "active"){ return true; } return false; }); UI.Button("div[id^='liveChn_Rec_']", 31, null, function(e, p){ //Rec页面左边栏按钮注册 var $p = $(p); var str = $p.attr("id"); var cmd = (str.split("_")[2]*1-1); if (e.type == "mousedown"){ if($p.attr('name') == "disable"){ return false; } else { if(channelPlay[cmd] == 1 && channelRec[cmd] != 1){ var nRet = gDvr.StartRecord(cmd); $p.css("background-position", "-31px -25px"); channelRec[cmd] = 1; if(nRet != 0){ ShowPaop(lg.get("IDS_RECORD_SAVE_PATH"),lg.get("IDS_REC_ERR")); } }else if(channelRec[cmd] == 1){ gDvr.StopRecord(cmd); channelRec[cmd] = 0; $p.css("background-position", "0px -25px"); var str = gDvr.GetLocalSettings(); var xmlDoc = parseXmlFromStr(str); var strTemp = xmlDoc.getElementsByTagName("LocalSettings")[0].getAttribute("SelectDiskDriver"); ShowPaop(lg.get("IDS_RECORD_SAVE_PATH"), "
" + strTemp + ":\\webclient2\\videos" + "
" + lg.get("IDS_PATH") + "
"); } } } }); UI.Button("div[id^='liveChn_Cap_']", 31, null, function(e, p){ //CAP页面左边栏按钮注册 var $p = $(p); var cmd = ($p.attr("id").split("_")[2]*1-1); if (e.type == "mousedown") { if ($p.attr('name') == "disable") { return false; } else if (channelPlay[cmd] == 1) { gDvr.CaptureImage(cmd); var str = gDvr.GetLocalSettings(); var xmlDoc = parseXmlFromStr(str); var strTemp = xmlDoc.getElementsByTagName("LocalSettings")[0].getAttribute("SelectDiskDriver"); ShowPaop(lg.get("IDS_IMAGE_SAVE_PATH"), "
" + strTemp + ":\\webclient2\\images" + "
" + lg.get("IDS_PREVIEW") + "   " + lg.get("IDS_PATH") + ""); } } return true; }); $(".liveChannelRow").mouseover(function(){$(this).css("background", "#0f2c47");}).mouseout(function(){$(this).css("background", "url(images/content_bg.png)");}); } //过滤方向键 function keyboardFilter(e){ e = e || window.event; if(!e.srcElement) e.srcElement = e.target; if ((e.keyCode >= 37 && e.keyCode <= 40) /*|| (e.keyCode == 8)*/ || (e.keyCode == 9)){//取消 退格键 过滤 return false; } return true; } //对端口进行限制 function NumberRangeLimt(ctrId,minVal,maxVal){ var str = ($("#"+ctrId.id).val()).replace(/\D/g,''); if(minVal != maxVal) { if(str != "" && str < minVal) {return minVal;} if(str > maxVal) {return maxVal;} } return str; } function Reset(){ $("#username").val(""); $("#passwd").val(""); $("#login_language").val(gVar.lg); // $("#login_language").change(); $("#username").focus(); } function AutoClose(title) { autoCloseTime--; if(autoCloseTime <= 0) { if($.browser.msie){ window.opener=null; window.open('', '_self', ''); window.close(); }else{ window.location.reload(true); } } if($.browser.msie){ ShowPaop(title, lg.get("IDS_DVR_REBOOT")+" "+autoCloseTime.toString()+" "+lg.get("IDS_SECOND")); }else{ ShowPaop(title, lg.get("IDS_DVR_REBOOT")+" "+autoCloseTime.toString()+" "+lg.get("IDS_SECOND")); } window.setTimeout(function(){AutoClose(title);}, 1000); } function CreateCalendar(iType) { var szLanguage = ''; if ($.cookie("language") == 'CHS') { szLanguage = 'zh-cn'; } else if ($.cookie("language") == 'CHT'){ szLanguage = 'zh-tw'; } else { szLanguage = 'en'; } if (iType == 0) { WdatePicker({startDate:'%y-%M-%d %h:%m:%s', dateFmt:'yyyy-MM-dd HH:mm:ss', alwaysUseStartDate:false, minDate:'1970-01-01 00:00:00', maxDate:'2037-12-31 23:59:59', readOnly:true, lang:szLanguage, isShowClear:false}); } else if (2 == iType) { WdatePicker({dateFmt:'HH:mm:ss', alwaysUseStartDate:false, readOnly:true, lang:szLanguage, isShowClear:false}); } else { WdatePicker({startDate:'%y-%M-%d %h:%m:%s', dateFmt:'yyyy-MM-ddTHH:mm:ss', alwaysUseStartDate:false, minDate:'1970-01-01 00:00:00', maxDate:'2037-12-31 23:59:59', readOnly:true, lang:szLanguage, isShowClear:false}); } } /************************************************* Function: Base64 Description: Base64编码解码 Input: 无 Output: 无 return: 无 *************************************************/ var Base64 = { // private property _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", // public method for encoding encode: function(input) { var output = ""; var chr1, chr2, chr3, enc1, enc2, enc3, enc4; var i = 0; input = Base64._utf8_encode(input); while(i < input.length) { chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if(isNaN(chr2)) { enc3 = enc4 = 64; } else if(isNaN(chr3)) { enc4 = 64; } output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4); } return output; }, // public method for decoding decode: function(input) { var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); while(i < input.length) { enc1 = this._keyStr.indexOf(input.charAt(i++)); enc2 = this._keyStr.indexOf(input.charAt(i++)); enc3 = this._keyStr.indexOf(input.charAt(i++)); enc4 = this._keyStr.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if(enc3 != 64) { output = output + String.fromCharCode(chr2); } if(enc4 != 64) { output = output + String.fromCharCode(chr3); } } output = Base64._utf8_decode(output); return output; }, // private method for UTF-8 encoding _utf8_encode: function(string) { string = string.replace(/\r\n/g, "\n"); var utftext = ""; for(var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if(c < 128) { utftext += String.fromCharCode(c); } else if((c > 127) && (c < 2048)) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; }, // private method for UTF-8 decoding _utf8_decode: function(utftext) { var string = ""; var i = 0; var c = c1 = c2 = 0; while(i < utftext.length) { c = utftext.charCodeAt(i); if(c < 128) { string += String.fromCharCode(c); i++; } else if((c > 191) && (c < 224)) { c2 = utftext.charCodeAt(i + 1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; } else { c2 = utftext.charCodeAt(i + 1); c3 = utftext.charCodeAt(i + 2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; } } return string; } };