?? monitorstatic.js
字號:
window.onerror = function(){return true;}
Sys = function(){;}
Sys.NS = (document.layers) ? true : false;
Sys.IE = (document.all) ? true : false;
Sys.DOM = (document.getElementById) ? true : false;
if (Sys.IE) Sys.DOM = false;
Sys.MAC = (navigator.platform) && (navigator.platform.toUpperCase().indexOf('MAC') >= 0);
if (Sys.NS) Sys.MAC = false;
Sys.getObj = function(objId){if (document.getElementById)return document.getElementById(objId);else if (document.all)return document.all(objId);};
Sys.urlEncode = function(str)
{
var i,c,ret="",strSpecial="!\"#$%&'()*+,/:;<=>?@[\]^`{|}~%";
for(i=0;i<str.length;i++)
{
c=str.charAt(i);
if(c==" ")
ret+="+";
else if(strSpecial.indexOf(c)!=-1)
ret+="%"+str.charCodeAt(i).toString(16);
else
ret+=c;
}
return ret;
};
Sys.urlDecode = function(str)
{
if("undefined" == typeof decodeURIComponent)
{
return unescape(str).replace(/\+/g, ' ').replace(/%2B/g,'+');
} else {
/*just use my self decode script*/
/*return decodeURIComponent(str.replace(/\+/g, ' ').replace(/%2B/g,'+'));*/
return unescape(str).replace(/\+/g, ' ').replace(/%2B/g,'+');
}
};
Sys.urlToParams = function(urlContent)
{
cmdMap = new Array();
cmdParams = new Array();
pos = -1;
while (true)
{
newPos = urlContent.indexOf('&', pos+1);
if (newPos>=0) {
encodedProperty = urlContent.substring(pos+1, newPos);
}
else {
encodedProperty = urlContent.substring(pos+1, urlContent.length);
}
equalsPos = encodedProperty.indexOf('=');
paramName = encodedProperty.substring(0, equalsPos);
paramValue =(encodedProperty.substring(equalsPos+1, encodedProperty.length));
cmdParams[paramName] = paramValue;
if (newPos==-1) {
break;
}
pos = newPos;
}
return cmdParams;
};
Sys.addEvent = function(objectId, eventName, eventFunction)
{
if(document.attachEvent)
objectId.attachEvent("on"+eventName, eventFunction);
else
objectId.addEventListener(eventName, eventFunction, false);
}
function getTrustfulVisitorInfo(){
var visitorInfoUrl="";
if(typeof trustfulInfo!="undefined"&&trustfulInfo.length>0&&trustfulInfo!=null&&trustfulInfo!="null"){
visitorInfoUrl="info="+trustfulInfo+"";
}
return visitorInfoUrl;
}
function StaticIcon(inLogger, inPreferences)
{
this.logger = inLogger;
this.preferences = inPreferences;
this.companyID = this.preferences["companyID"];
this.iconIndex = this.preferences["iconIndex"];
this.online = this.preferences["online"];
this.offline = this.preferences["offline"];
this.parentObject = null;
this.reload = StaticIcon_reload;
this.generate = StaticIcon_generate;
this.onIconClick = StaticIcon_onIconClick
this.start = StaticIcon_start;
}
function StaticIcon_start()
{
this.generate();
};
function StaticIcon_reload()
{
/*
var baseIconUrl = this.preferences["protocol"] + "://" + this.preferences["baseHtmlUrl"] + this.preferences["baseWebapp"] + this.preferences["baseChatHtmlDir"] + "/icons";
if(this.online == null || this.offline == null)
{
onlineUrl = baseIconUrl + "/" + this.iconIndex + "_online.gif";
offlineUrl = baseIconUrl + "/" + this.iconIndex + "_offline.gif";
}else
{
onlineUrl = this.online;
offlineUrl = this.offline;
}
var reloadUrl = this.preferences["protocol"] + "://" + this.preferences["baseUrl"] + this.preferences["baseWebapp"] + "/SurferServer?cmd=111";
reloadUrl += "&companyID=" + this.companyID;
reloadUrl += "&online=" + onlineUrl;
reloadUrl += "&offline=" + offlineUrl;
Sys.getObj("live800icon").src = reloadUrl;
*/
// version 3 do nothing, the reload function remove to visiteHandle
};
function StaticIcon_generate()
{
var live800IconLink = Sys.getObj("live800iconlink");
var live800Icon = Sys.getObj("live800icon");
if(live800Icon == null) return;
var baseIconUrl = this.preferences["protocol"] + "://" + this.preferences["baseHtmlUrl"] + this.preferences["baseWebapp"] + this.preferences["baseChatHtmlDir"] + "/icons";
if(this.preferences["online"] == null || this.preferences["offline"] == null)
{
onlineUrl = baseIconUrl + "/" + this.preferences["iconIndex"] + "_online.gif";
offlineUrl = baseIconUrl + "/" + this.preferences["iconIndex"] + "_offline.gif";
}else
{
onlineUrl = this.preferences["online"];
offlineUrl = this.preferences["offline"];
}
live800Icon.src = this.preferences["protocol"] + "://" + this.preferences["baseUrl"] + this.preferences["baseWebapp"] + '/SurferServer?'+getParam()+'&cmd=111&companyID=' + this.preferences["companyID"] + '&online=' + onlineUrl + '&offline=' + offlineUrl+'&'+getTrustfulVisitorInfo();
var attr='width=541,height=401';
var tempsurl=this.preferences["protocol"] + "://" + this.preferences["baseUrl"] + this.preferences["baseWebapp"]+"/chatClient/chatbox.jsp?"+getGid()+getParam()+"&companyID="+ this.preferences["companyID"]+getEnterUrl()+"&"+getTrustfulVisitorInfo();
var boxname="chatbox"+this.preferences["companyID"];
live800IconLink.href ="javascript:window.open('"+tempsurl+"','"+boxname+"','"+attr+"')";
Sys.addEvent(live800IconLink, "click", function(){staticIconOnIconClick();return false;});
live800Icon.border = 0;
this.reload();
};
function staticIconOnIconClick()
{
globalIcon.onIconClick();
}
function StaticIcon_onIconClick()
{
this.parentObject.onIconClick();
};
function Logger()
{
//document.write('<div style="position: absolute; top: 430; left: 0;"><textarea style=" width:800px; height:600px;" id="loggerTextarea"></textarea>');
this.textarea = document.getElementById('loggerTextarea');
this.log = Logger_log;
}
function Logger_log(message)
{
if(this.textarea!=null)
{
newMessage = new Date() + ' ' +message + '\r\n';
this.textarea.value += newMessage;
this.textarea.scrollTop = 999999;
}
};
function RpcMethod(inServiceName, inCmdNo, inParams, inRetryTimes, inOnSuccess, inOnError)
{
this.serviceName = inServiceName;
this.cmdNo = inCmdNo;
this.params = inParams;
this.retryTimes = inRetryTimes;
this.onSuccess = inOnSuccess;
this.onError = inOnError;
}
function SendDriver(inLogger, inPreferences)
{
this.logger = inLogger;
this.preferences = inPreferences;
this.busy = false;
this.rpcImage = null;
this.onRpcSuccess = SendDriver_onRpcSuccess;
this.onRpcError = SendDriver_onRpcError;
this.execute = SendDriver_execute;
}
function SendDriver_execute(inRpcMethod)
{
this.logger.log("SendDriver_execute():inRpcMethod.cmdNo=" + inRpcMethod.cmdNo);
this.busy = true;
this.rpcMethod = inRpcMethod;
var rpcImageUrl = this.preferences["protocol"] + "://" + this.preferences["baseUrl"] + preferences["baseWebapp"] + "/" + this.rpcMethod.serviceName + "?cmd=" + this.rpcMethod.cmdNo + "&visitorIDInSession=" + this.preferences["visitorIDInSession"];
if(this.rpcMethod.params != null)
{
for (i in this.rpcMethod.params)
{
pos = this.rpcMethod.params[i].indexOf("=");
paramName = this.rpcMethod.params[i].substring(0,pos);
paramValue = this.rpcMethod.params[i].substring(pos+1);
rpcImageUrl += '&' +paramName+ '=' +Sys.urlEncode(paramValue);
}
}
rpcImageUrl += '&rpcImageId=' +(new Date()).getTime();/*this param keep browser do not cache the rpcImage*/
this.rpcImage = new Image();
this.rpcImage.onload = onRpcSuccess;
this.rpcImage.onerror = onRpcError;
this.rpcImage.src = rpcImageUrl;
};
function onRpcSuccess(){globalSendDriver.onRpcSuccess(this.width, this.height);};
function SendDriver_onRpcSuccess(inWidth, inHeight)
{
if(this.rpcMethod.onSuccess != null)
this.rpcMethod.onSuccess(inWidth, inHeight);
this.busy = false;
};
function onRpcError(){globalSendDriver.onRpcError();};
function SendDriver_onRpcError()
{
if(this.rpcMethod.retryTimes <=0)
{
if(this.rpcMethod.onError != null)
this.rpcMethod.onError(this.rpcMethod);
this.busy = false;
}else
{
this.logger.log("SendDriver_onRpcError():rpcMethod.retryTimes=" + this.rpcMethod.retryTimes);
this.rpcMethod.retryTimes--;
this.execute(this.rpcMethod);
}
};
function getCookie(name)
{
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg)) return unescape(arr[2]);
else return null;
};
function setCookie(name,value)
{
var Days = 30;
var exp = new Date(); //new Date("December 31, 9998");
exp.setTime(exp.getTime() + Days*24*60*60*1000);
//document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
document.cookie = name + "="+ escape (value);
};
function getGid(){
if(typeof jid!="undefined"){
return "jid="+jid+"&";
}
else
return "";
};
function getParam()
{
var paramUrl="";
if(getCookie("operatorId")!=null&&typeof getCookie("operatorId")!="undefined"&&getCookie("operatorId").length!=0&&getCookie("operatorId")!="undefined")
{
paramUrl="operatorId="+getCookie("operatorId")+"&";
}
if(getCookie("skillId")!=null&&getCookie("skillId")!="undefined"&&getCookie("skillId").length!=0&&getCookie("skillId")!="undefined")
{
paramUrl=paramUrl+"skillId="+getCookie("skillId")+"&";
}
return paramUrl;
};
function ReceiveDriver(inLogger, inPreferences)
{
this.logger = inLogger;
this.preferences = inPreferences;
this.receiveDriverListeners = new Array();
this.loadingTag = false;
this.lastMsgTime = "-1";
this.tagImage = new Image();
this.tags = new Array();
this.receiveTimer = null;
var paramUrl=getParam();
this.tagUrl = this.preferences["protocol"] + "://" + this.preferences["baseUrl"] + live800_baseWebApp+"/SurferServer?cmd=101&companyID=" + this.preferences["companyID"]+"&"+getTrustfulVisitorInfo()+getParam();
this.localTyping = false;
this.initTags = ReceiveDriver_initTags;
this.getTag = ReceiveDriver_getTag;
this.onTagSuccess = ReceiveDriver_onTagSuccess;
this.onTagError = ReceiveDriver_onTagError;
this.sendMessage = function(cmdParams){this.logger.log("ReceiveDriver_sendMessage: cmdNo=" + cmdParams["content"]);};
this.start = ReceiveDriver_start;
this.stop = ReceiveDriver_stop;
this.addReceiveDriverListener = ReceiveDriver_addReceiveDriverListener;
this.initTags();
}
function ReceiveDriver_stop()
{
clearTimeout(this.receiveTimer);
};
function ReceiveDriver_initTags()
{
this.tags["1"] = ["0000"];/*loadContent*/
this.tags["2"] = ["6040"];/*iconreload*/
this.tags["3"] = ["6021"];/*BeInvitedToChat invite show*/
this.tags["4"] = ["6020"];/*invite hide*/
this.tags["5"] = ["6031"];/*openInitiatedChat*/
};
function URLEncode(Str){
if(Str==null||Str=="")
return "";
var newStr="";
function toCase(sStr){
return sStr.toString(16).toUpperCase();
}
for(var i=0,icode,len=Str.length;i<len;i++){
icode=Str.charCodeAt(i);
if( icode<0x10)
newStr+="%0"+icode.toString(16).toUpperCase();
else if(icode<0x80){
if(icode==0x20)
newStr+="+";
else if((icode>=0x30&&icode<=0x39)||(icode>=0x41&&icode<=0x5A)||(icode>=0x61&&icode<=0x7A))
newStr+=Str.charAt(i);
else
newStr+="%"+toCase(icode);
}
else if(icode<0x800){
newStr+="%"+toCase(0xC0+(icode>>6));
newStr+="%"+toCase(0x80+icode%0x40);
}
else{
newStr+="%"+toCase(0xE0+(icode>>12));
newStr+="%"+toCase(0x80+(icode>>6)%0x40);
newStr+="%"+toCase(0x80+icode%0x40);
}
}
return newStr;
};
var pagetitle=URLEncode(document.title);
var pagelocation=URLEncode(document.URL);
var pagereferrer=URLEncode(document.referrer);
function JustUrlLen()
{
pagetitle=URLEncode(document.title);
pagelocation=URLEncode(document.URL);
pagereferrer=URLEncode(document.referrer);
if(pagelocation.length>=1600)
pagelocation=pagelocation.substring(0,1600);
if(pagereferrer.length>=1600)
pagereferrer=pagereferrer.substring(0,1600);
if(pagetitle.length>1600)
pagetitle=pagetitle.substring(0,1600);
for(var i=1;i>0;i++)
{
if((pagetitle+pagelocation+pagereferrer).length>1600)
{
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -