/**/ if(window.location.href.substring(0,8)!="file:///" && window.location.href.substring(0,17)!="http://localhost/" && window.location.href.substring(0,17)!="http://127.0.0.1/"){ /*=======================================================Global======================================================================================*/ /*--cookie添加、查询--*/ function setCookie(name,value,time) { var strsec = getsec(time); var exp = new Date(); exp.setTime(exp.getTime() + strsec*1); document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString()+";path=/;"; }; function getsec(str) { var str1=str.substring(1,str.length)*1; var str2=str.substring(0,1); if (str2=="s") { return str1*1000; } else if (str2=="h") { return str1*60*60*1000; } else if (str2=="d") { return str1*24*60*60*1000; }; }; function getCookie(name) { var offset = document.cookie.indexOf(name + "="); if (offset != -1) { offset += name.length + 1; var end = document.cookie.indexOf(";", offset); if (end == -1) { end = document.cookie.length; } return document.cookie.substring(offset, end); } else { return ""; }; }; function ttkefu_setCookie(name,value,time) { var strsec = ttkefu_getsec(time); var exp = new Date(); exp.setTime(exp.getTime() + strsec*1); document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString()+";path=/;"; }; function ttkefu_getsec(str) { var str1=str.substring(1,str.length)*1; var str2=str.substring(0,1); if (str2=="s") { return str1*1000; } else if (str2=="h") { return str1*60*60*1000; } else if (str2=="d") { return str1*24*60*60*1000; }; }; function ttkefu_getCookie(name) { var offset = document.cookie.indexOf(name + "="); if (offset != -1) { offset += name.length + 1; var end = document.cookie.indexOf(";", offset); if (end == -1) { end = document.cookie.length; } return document.cookie.substring(offset, end); } else { return ""; }; }; function ttkefu_gb2utf8(data){ if(document.characterSet=="UTF-8"){ if(data.length>30){ data=data.substring(0,30) +"..."; } return data; } return escape(data); }; /*--来路、关键词、客户编号--*/ var src1,sjs,ttmp,lailu,guanjianzi; function getlailu(){ var url=document.referrer; var reg=new RegExp("http://","g"); url=url.replace(reg,""); var righturl=url.split("/"); return righturl[0] } lailu=getlailu(); function getKeyword(){ var url=document.referrer,reg=new RegExp("http://","g"),keyword=""; url=url.replace(reg,""); var keywordsname = {s0:"word",s1:"q",s2:"p",s3:"w",s4:"query",s5:"name",s6:"_searchkey",s7:"wd",s8:"bs"}; for(var one in keywordsname){ keyword=getQueryString(url,keywordsname[one]) if(keyword!=null&&keyword!="") return keyword } if(keyword="") return null } guanjianzi=getKeyword(); if(typeof(guanjianzi)=="undefined")guanjianzi=""; if (getCookie("kfltjs")=="") { sjs=20510155753; setCookie("kfltjs",sjs,"d3000"); } else{ sjs=""+getCookie("kfltjs")+""; }; /*--当前页面信息采集--*/ /*强制留名*/ var ttkefu_isleave_name="False"; /**/ var ttkefu_limitwbsite="",ttkefu_pageurl="",ttkefu_pageurl1="",ttkefu_pagetitle="",ttkefu_pagetitle1="",ttkefu_Ut="",ttkefu_minipagetitle=""; /*--页面事件注册--*/ function ttkefu_EventReg(){ /*消息监听*/ ttkefu_Event_Listener(); /*元素拖动*/ ttkefu_Event_Drag(); } function ttkefu_Event_Listener(){ /*消息监听*/ if(window.addEventListener){ //跨域消息传递 window.addEventListener("message",ttkefu_HandleMsg,false); }else if(window.attachEvent){ //兼容ie8之流 window.attachEvent('onmessage',ttkefu_HandleMsg); } } function ttkefu_Event_Drag(){ } /*--公用函数--*/ function ttkefu_IsNum(str){ /*大于等于0正整数*/ return /^(0|([1-9]\d*))$/.test(str); } /*拖动*/ var ttkefu_diffX=0,ttkefu_diffY=0,ttkefu_Drag_Start=0; function ttkefu_Drag(drag){ var drag = document.getElementById(drag); // //点击某物体时,用drag对象即可,move和up是全局区域, // 也就是整个文档通用,应该使用document对象而不是drag对象(否则,采用drag对象时物体只能往右方或下方移动) drag.onmousedown = function(event){ ttkefu_Drag_Start=1; console.log("drag.onmousedown"); var event = event || window.event; //兼容IE浏览器 //鼠标点击物体那一刻相对于物体左侧边框的距离=点击时的位置相对于浏览器最左边的距离-物体左边框相对于浏览器最左边的距离 ttkefu_diffX = event.clientX - drag.offsetLeft; ttkefu_diffY = event.clientY - drag.offsetTop; if(typeof drag.setCapture !== 'undefined'){ drag.setCapture(); } } drag.onmouseup = function(event){ ttkefu_Drag_Start=0; console.log("drag.onmouseup"); } document.onmousemove = function(event){ console.log("document.onmousemove"); if(ttkefu_Drag_Start==1){ var event = event || window.event; var moveX = event.clientX - ttkefu_diffX; var moveY = event.clientY - ttkefu_diffY; if(moveX < 0){ moveX = 0 }else if(moveX > window.innerWidth - drag.offsetWidth){ moveX = window.innerWidth - drag.offsetWidth } if(moveY < 0){ moveY = 0 }else if(moveY > window.innerHeight - drag.offsetHeight){ moveY = window.innerHeight - drag.offsetHeight } drag.style.left = moveX + 'px'; drag.style.top = moveY + 'px' } } document.onmouseup = function(event){ console.log("document.onmouseup"); if(ttkefu_Drag_Start==1){ this.onmousemove = null; this.onmouseup = null; //修复低版本ie bug if(typeof drag.releaseCapture!='undefined'){ drag.releaseCapture(); } } } } /*渐隐渐现*/ var ttkefu_fadeOut_i=0 function ttkefu_fadeOut(ele,speed){ clearTimeout(ttkefu_fadeOut_i); var ele=document.getElementById(ele); ele.style.opacity=1; var opacitynum=ele.style.opacity; var speed=speed-1000; ttkefu_fadeOut_i=setTimeout(function(){ ttkefu_opacityOff(ele,100) },speed); } function ttkefu_opacityOff(ele,speed){ clearTimeout(ttkefu_fadeOut_i); if(ele.style.opacity>0){ ele.style.opacity=ele.style.opacity-0.1; ttkefu_fadeOut_i=setTimeout(function(){ ttkefu_opacityOff(ele,100) },100); } } function ttkefu_fadeIn(ele,hideTime){ clearTimeout(ttkefu_fadeOut_i); var ele=document.getElementById(ele); ele.style.display=""; ele.style.opacity=0.1; ttkefu_opacityIn(ele,100,hideTime); } function ttkefu_opacityIn(ele,speed,hideTime){ clearTimeout(ttkefu_fadeOut_i); if(ele.style.opacity<1){ ele.style.opacity=parseFloat(ele.style.opacity)+0.1; console.log("ttkefu_opacityIn_opacity:"+ele.style.opacity); ttkefu_fadeOut_i=setTimeout(function(){ ttkefu_opacityIn(ele,100,hideTime) },100); }else{ /*hideTime>0执行渐隐*/ if(hideTime>0){ ttkefu_fadeOut(ele.id,hideTime); } } } /*正则区*/ function ttkefu_Replace_Img(str){ return str.replace(/<\s?img[^>]*>/gi,''); } /*postMessage*/ function ttkefu_PostMessage(MsgData){ /**/ var vFraName=MsgData.FraName; /*frames[vFraName].postMessage(MsgData.Msg, '*');*/ /*自定义网址状态:0.未能应用1.应用中*/ document.getElementById(vFraName).contentWindow.postMessage(MsgData.Msg, '*'); } function ttkefu_HandleMsg(e){ // if(console){ console.log("ttkefu_HandleMsg"); console.log(e); } var MsgData=e.data; if(MsgData.types){ if(ttkefu_HandleMsg_JieTu){ ttkefu_HandleMsg_JieTu(MsgData); } }else{ if(MsgData.ActName){ if(MsgData.ActName=="ttkefu_Ifa_MbMinWindow"){ /*手机迷你窗口*/ switch(MsgData.CmdKey){ case "LinkParas_ttkefu_Ifa_MbMinWindow": /*记录对话连接-对话初始化完成*/ var vLinkParas=MsgData.CmdVal; var vLinkParasAry=vLinkParas.split('|'); var vKfId=vLinkParasAry[0]; var vIcoStyle=vLinkParasAry[1]; ttkefu_Mb_Min_LinkKfId_Set({KfId:vKfId}); ttkefu_setCookie("ttkefu_Mb_Min_LinkIcoStyle",vIcoStyle,"d1"); /*显示对话状态图标-隐藏其他图标*/ ttkefu_Mb_MinWindow_TakingIco_Show(); /*更新未读计数器以及弹出消息状态*/ ttkefu_MinWidow_NoReadMsg_Contrl({row:1110}); break; case "state_ttkefu_Ifa_MbMinWindow": /*心跳-更新ttkefu_Mb_Min_LinkKfId*/ ttkefu_Mb_MinWidow_LinkingSet(); break; case "Count_ttkefu_Ifa_MbMinWindow": /*更新未读记录数*/ ttkefu_MinWidow_EditNoRead({Num:MsgData.CmdVal,row:1055}); break; case "Msg_ttkefu_Ifa_MbMinWindow": /*最新一条未读消息*/ ttkefu_Mb_MinWidow_ShowMsg({Msg:MsgData.CmdVal,Name:MsgData.Name}); break; case "Shake_ttkefu_Ifa_MbMinWindow": /*震动*/ ttkefu_Mb_MinWindow_Show(); break; case "KfLx_ttkefu_Ifa_MbMinWindow": /*客服离线-手机版-小窗口-重置*/ ttkefu_Mb_MinWindow_Reset(); break; case "KfEndTalking_ttkefu_Ifa_MbMinWindow": /*结束对话-手机版-小窗口-重置*/ ttkefu_Mb_MinWindow_Reset(); break; } } } } } /*窗口打开 device:0.Pc 1.手机 || openstyle:0.大窗口 1.小窗口 || */ var ttkefu_fk_device="0",ttkefu_fk_pc_openstyle="0"; function ttkefu_WindowOpen(url,paras){ var vleft="0"; if(paras.left){ vleft=paras.left; } var vwidth="849px"; if(paras.width){ vwidth=paras.width; } var vheight="619px"; if(paras.height){ vheight=paras.height; } window.open(url,"36564","top=0,left="+vleft+",width="+vwidth+",height="+vheight+",scrollbars=no,resizable=yes,status=no,z-look=yes,alwaysRaised=yes,location=no,depended=no,center:yes"); } /*=====================================手机版=====================================*/ /*手机版-小窗口初始化*/ var G_ttkefu_Mb_Min_LinkKfId=""; if(ttkefu_getCookie("ttkefu_Mb_Min_LinkKfId")){ G_ttkefu_Mb_Min_LinkKfId=ttkefu_getCookie("ttkefu_Mb_Min_LinkKfId") } var G_ttkefu_Mb_Min_IcoAndYq_Dispaly="",G_ttkefu_Mb_Min_TalkingIco_Dispaly="none"; if(G_ttkefu_Mb_Min_LinkKfId!=""){ G_ttkefu_Mb_Min_IcoAndYq_Dispaly="none"; G_ttkefu_Mb_Min_TalkingIco_Dispaly=""; } function ttkefu_Mb_MinWindow_Init(){ /*小窗口默认地址*/ var vLinkUrl=""; if(ttkefu_getCookie("ttkefu_Mb_Min_LinkKfId")){ var vKfId=ttkefu_getCookie("ttkefu_Mb_Min_LinkKfId"); var vIcoStyle=ttkefu_getCookie("ttkefu_Mb_Min_LinkIcoStyle"); if(vKfId!="" && vIcoStyle!=""){ /*生成记忆对话地址*/ vLinkUrl=ttkefu_Com_TalkLinkParas({Talking:1,R5s6eT:vKfId,icostyle:vIcoStyle}); ttkefu_Mb_MinWindow_SetLinkUrl(vLinkUrl); /*读取设置未读记录*/ ttkefu_Mb_MinWindow_SetNoReadByCookie(); /*小窗口默认状态-打开or隐藏*/ if(ttkefu_getCookie("ttkefu_MinWidow_Close_State")){ /*显示*/ var vttkefu_MinWidow_Close_State=ttkefu_getCookie("ttkefu_MinWidow_Close_State"); if(vttkefu_MinWidow_Close_State=="1" && vLinkUrl!=""){ ttkefu_Mb_MinWindow_Show(); } } } } } /*手机版-事件监听*/ function ttkefu_Mb_EventReg(){ /*手机版-浏览器进出后台监听*/ ttkefu_Mb_VisChange(); } /*手机版-浏览器进入后台*/ function ttkefu_Mb_VisChange(){ document.addEventListener("visibilitychange",function(){ if(document.hidden) { /*页面被挂起*/ ttkefu_Mb_PageHide(); } else { /*页面呼出*/ ttkefu_Mb_PageShow(); } }); } /*手机版-页面被挂起*/ function ttkefu_Mb_PageHide(){ } /*手机版-页面呼出*/ function ttkefu_Mb_PageShow(){ } /*手机版-小窗口-结束对话*/ function ttkefu_Mb_MinWindow_StopConsult(){ /*手机版-小窗口-结束对话*/ ttkefu_PostMessage({FraName:"ttkefu_Ifa_MbMinWindow",Msg:{ActName:"ttkefu_Ifa_MbMinWindow",CmdKey:"StopConsult_ttkefu_Ifa_MbMinWindow"}}); } /*手机版-小窗口-重置*/ function ttkefu_Mb_MinWindow_Reset(){ /*清除对话客服Id(刷新时的地址)*/ ttkefu_setCookie("ttkefu_Mb_Min_LinkKfId","","s1"); /*设置Iframe重新加载生成新对话*/ ttkefu_Mb_MinWindow_SetLoad("0"); /*隐藏对话状态图标-显示其他图标*/ ttkefu_Mb_MinWindow_TakingIco_Hide(); } /*手机版-小窗口-读取设置未读记录*/ function ttkefu_Mb_MinWindow_SetNoReadByCookie(){ if(ttkefu_getCookie("ttkefu_Min_NoRead")){ var vNum=parseInt(ttkefu_getCookie("ttkefu_Min_NoRead")); if(vNum>=0){ /*更新未读记录数*/ ttkefu_MinWidow_EditNoRead({Num:vNum,row:1146}); } } } /*公用对话连接参数 icostyle 必填*/ function ttkefu_Com_TalkLinkParas(MsgData){ /*url参数整理*/ var GoUrl="http://w1.ttkefu.com/conversationormessage/ourcustomerservice/customerlist/chat_boxs.jsp?fgid=20794&t5Ys2R=36564&lang=0"; /*必填*/ GoUrl=GoUrl+"&dkfs="+MsgData.icostyle; /*T-指定客服*/ if(MsgData.R5s6eT){ GoUrl=GoUrl+"&R5s6eT="+MsgData.R5s6eT; } /*T-手机小窗口记忆标记*/ if(MsgData.Talking){ GoUrl=GoUrl+"&Talking="+MsgData.Talking; } GoUrl=GoUrl+"&tS4wJ7="+sjs; GoUrl=GoUrl+"&Purl="+ttkefu_pageurl; GoUrl=GoUrl+"&Pt="+ttkefu_pagetitleLimtit(ttkefu_pagetitle); GoUrl=GoUrl+""; return GoUrl; } /*手机版 | icostyle:0.邀请框 1.客服列表 2.浮动图标*/ function ttkefu_Mb_Open(MsgData){ /*url参数整理*/ var GoUrl=ttkefu_Com_TalkLinkParas(MsgData); /*打开窗口*/ MsgData.GoUrl=GoUrl; ttkefu_Mb_BigWindow(MsgData); } /*手机版-小窗口-开启*/ function ttkefu_Mb_MinWindow(MsgData){ console.log(MsgData); /*重置计数器*/ tkefu_Mb_MinWindow_SetNoReadNum(0); /*首次打开初始化*/ if(document.getElementById("ttkefu_Ifa_MbMinWindow").getAttribute("load")=="0"){ ttkefu_Mb_MinWindow_Open_Init(MsgData); } /*显示*/ ttkefu_Mb_MinWindow_Show(); /*通知聊天窗口-停止记录未读消息记录*/ document.getElementById("ttkefu_Ifa_MbMinWindow").onload=function(){ ttkefu_MinWidow_NoReadMsg_Contrl({row:1305}); } } /*手机版-小窗口-显示*/ function ttkefu_Mb_MinWindow_Show(){ document.getElementById("ttkefuminitishiwrapper_MbMinWindow").style.display=""; /*状态记忆*/ ttkefu_setCookie("ttkefu_MinWidow_Close_State","1","d1"); /*重置计数器*/ ttkefu_MinWidow_EditNoRead({Num:0,row:1233}); } /*手机版-小窗口-连接地址*/ function ttkefu_Mb_MinWindow_SetLinkUrl(GoUrl){ document.getElementById("ttkefu_Ifa_MbMinWindow").src=GoUrl; } /*手机版-小窗口-load设置-仅对话连接为1,0代表重新加载地址*/ function ttkefu_Mb_MinWindow_SetLoad(state){ document.getElementById("ttkefu_Ifa_MbMinWindow").setAttribute("load",state); } /*手机版-小窗口-开启-初始化*/ function ttkefu_Mb_MinWindow_Open_Init(MsgData){ var vGoUrl=ttkefu_Com_TalkLinkParas(MsgData); ttkefu_Mb_MinWindow_SetLinkUrl(vGoUrl); } /*手机版-小窗口-设置记录数*/ function tkefu_Mb_MinWindow_SetNoReadNum(vNoReadNum){ /**/ ttkefu_MinWidow_EditNoRead({Num:vNoReadNum,row:1252}); } /*手机版-大窗口*/ function ttkefu_Mb_BigWindow(MsgData){ /**/ ttkefu_WindowOpen(MsgData.GoUrl,{}); } /*手机迷你窗口-关闭*/ function ttkefu_MinWidow_Close(){ /*隐藏聊天小窗口*/ document.getElementById("ttkefuminitishiwrapper_MbMinWindow").style.display="none"; /*重置计数器*/ tkefu_Mb_MinWindow_SetNoReadNum(0); /*记录状态*/ ttkefu_setCookie("ttkefu_MinWidow_Close_State","0","d1"); /*更新未读计数器以及弹出消息状态*/ ttkefu_MinWidow_NoReadMsg_Contrl({row:1357}); } /*手机迷你窗口-更新未读记录数*/ function ttkefu_MinWidow_EditNoRead(MsgData){ var vNoReadNum=MsgData.Num; /*记录未读记录数*/ ttkefu_setCookie("ttkefu_Min_NoRead",vNoReadNum,"d1"); /*未读记录数显示*/ if(parseInt(vNoReadNum)>0){ document.getElementById("ttkefu_Mb_MinWindow_TakingIco_Num").innerHTML=vNoReadNum; document.getElementById("ttkefu_Mb_MinWindow_TakingIco_Num").style.display=""; }else{ document.getElementById("ttkefu_Mb_MinWindow_TakingIco_Num").innerHTML=0; document.getElementById("ttkefu_Mb_MinWindow_TakingIco_Num").style.display="none"; } } /*手机迷你窗口-未读记录及弹出消息-控制器*/ function ttkefu_MinWidow_NoReadMsg_Contrl(MsgData){ if(document.getElementById("ttkefuminitishiwrapper_MbMinWindow").style.display=="none"){ /*开启记录未读记录弹出显示未读消息*/ ttkefu_PostMessage({FraName:"ttkefu_Ifa_MbMinWindow",Msg:{ActName:"ttkefu_Ifa_MbMinWindow",CmdKey:"Close_ttkefu_Ifa_MbMinWindow"}}); }else{ /*关闭记录未读记录弹出显示未读消息*/ ttkefu_PostMessage({FraName:"ttkefu_Ifa_MbMinWindow",Msg:{ActName:"ttkefu_Ifa_MbMinWindow",CmdKey:"StopWrite_ttkefu_Ifa_MbMinWindow"}}); } } /*手机迷你窗口-对话状态图标-显示*/ function ttkefu_Mb_icoAndYq(state){ /*浮动图标*/ //侧边图标背景色 if(document.getElementById("ttkefu_Mb_Ico_Wrapper")){ document.getElementById("ttkefu_Mb_Ico_Wrapper").style.display=state; } //侧边图标Vip if(document.getElementById("ttkefu_Mb_Ele_0")){ document.getElementById("ttkefu_Mb_Ele_0").style.display=state; } //侧边图标第三方客服 if(document.getElementById("sj_ttkefu_ico")){ document.getElementById("sj_ttkefu_ico").style.display=state; } //底部图标 if(document.getElementById("ttkefuico")){ document.getElementById("ttkefuico").style.display=state; } /*邀请框-循环邀请的-通过ttkefu_getCookie("ttkefu_Mb_Min_LinkKfId")来阻止 */ if(document.getElementById("sj_ttkefuyaoqing")){ document.getElementById("sj_ttkefuyaoqing").style.display=state; } } /*手机迷你窗口-对话状态图标-显示*/ function ttkefu_Mb_MinWindow_TakingIco_Show(){ /*隐藏-手机迷你窗口-对话状态图标*/ ttkefu_Mb_icoAndYq("none"); /*读取设置未读记录*/ ttkefu_Mb_MinWindow_SetNoReadByCookie(); /*显示-手机小窗口-对话状态图标*/ document.getElementById("ttkefu_Mb_MinWindow_TakingIcoDiv").style.display=""; /*设置手机小窗口为已加载状态*/ ttkefu_Mb_MinWindow_SetLoad("1"); /*绑定拖动事件*/ //ttkefu_Drag("ttkefu_Mb_MinWindow_TakingIcoDiv"); } /*手机迷你窗口-对话状态图标-隐藏*/ function ttkefu_Mb_MinWindow_TakingIco_Hide(){ /*显示-手机迷你窗口-对话状态图标*/ ttkefu_Mb_icoAndYq(""); /*更新未读记录数*/ ttkefu_MinWidow_EditNoRead({Num:0,row:1347}); /*隐藏-手机小窗口-对话状态图标*/ document.getElementById("ttkefu_Mb_MinWindow_TakingIcoDiv").style.display="none"; } /*手机迷你窗口-最新消息*/ function ttkefu_Mb_MinWidow_ShowMsg(MsgData){ var vName=MsgData.Name; var vMsg=MsgData.Msg; document.getElementById("ttkefu_Mb_MinWindow_MsgDivTitle_Name").innerHTML=vName; document.getElementById("ttkefu_Mb_MinWindow_MsgDivTxt").innerHTML=vMsg; ttkefu_fadeIn("ttkefu_Mb_MinWindow_MsgDiv",5000); } /*手机迷你窗口-持续对话状态维持 | */ function ttkefu_Mb_MinWidow_LinkingSet(){ if(ttkefu_getCookie("ttkefu_Mb_Min_LinkKfId")){ var vKfId=ttkefu_getCookie("ttkefu_Mb_Min_LinkKfId"); if(vKfId!=""){ /*生成记忆对话地址*/ ttkefu_Mb_Min_LinkKfId_Set({KfId:vKfId,row:1380}); } } } /*手机迷你窗口-持续对话状态维持*/ function ttkefu_Mb_Min_LinkKfId_Set(MsgData){ if(ttkefu_getCookie("ttkefu_Mb_Min_LinkKfId")){ /*更新*/ }else{ /*新增*/ /*手机迷你窗口-新打开次数记录-适用未开通手机版且打开方式为手机小窗口*/ ttkefu_Mb_MinWindow_FreeOpenNum_Set(); } /*生成记忆对话地址*/ ttkefu_setCookie("ttkefu_Mb_Min_LinkKfId",MsgData.KfId,"s120"); } /*手机迷你窗口-新打开次数记录-适用未开通手机版且打开方式为手机小窗口*/ function ttkefu_Mb_MinWindow_FreeOpenNum_Set(){ var vOpenNum=ttkefu_Mb_MinWindow_FreeOpenNum_Get(); ttkefu_setCookie("ttkefu_Mb_MinWindow_FreeOpenNum",vOpenNum,"d3000"); } function ttkefu_Mb_MinWindow_FreeOpenNum_Get(){ var vOpenNum=1; if(ttkefu_getCookie("ttkefu_Mb_MinWindow_FreeOpenNum")){ vOpenNum=parseInt(ttkefu_getCookie("ttkefu_Mb_MinWindow_FreeOpenNum"))+1; } return vOpenNum; } /*手机-客服发起强制对话 or 访客点击邀请框-*/ function ttkefu_Mb_Kf_Tan(MsgData){ /*关闭邀请框*/ if(document.getElementById("sj_ttkefuyaoqing")){ document.getElementById("sj_ttkefuyaoqing").style.display="none"; } /*消息提示框*/ if(document.getElementById("ttkefu_Mb_Ele_110")){ document.getElementById("ttkefu_Mb_Ele_110").style.display="none"; } ttkefu_Mb_Open(MsgData); } /*初始加载*/ function ttkefu_Load(){ /*ttkefu事件注册*/ ttkefu_EventReg(); } /**/ var ttkefu_Load_i=setTimeout(function(){ ttkefu_Load();},1000); /*if (document.addEventListener){ document.addEventListener("DOMContentLoaded", function(){ }, false) } */ function myReplace(str,key,key2){ return str.replace(new RegExp(key,'g'),key2); } function FSenWords(str) { var vSenWords="枪|炸药|色"; var vAry=vSenWords.split("|"); for(var i=0;i200){ Mreferrer=Mreferrer.substring(0,200)+"..."; } src1="http://w1.ttkefu.com/online.jsp?k=37207&lailu="+Mreferrer+"&urll="+encodeURIComponent(document.location.href)+"&tS4wJ7="+sjs+"&t5Ys2R=36564&fid=20794&guanjianzi="+guanjianzi; } document.write(""); /*获取浏览器版本*/ function ttkefu_getBrowserInfo(){ var Sys = {}; if(!!window.ActiveXObject || "ActiveXObject" in window) { Sys.browser ="msie"; Sys.ver ="11"; }else{ var ua = navigator.userAgent.toLowerCase(); var re =/(msie|firefox|chrome|opera|version).*?([\d.]+)/; var m = ua.match(re); Sys.browser = m[1].replace(/version/, "'safari"); Sys.ver = m[2]; } return Sys; } function tana(dkfs){ /**/ window.open("http://w1.ttkefu.com/conversationormessage/ourcustomerservice/customerlist/chat_boxs.jsp?u=20794&t5Ys2R=36564&tS4wJ7="+sjs+"&fgid=20794&s2N6eL=36564&isshowstyle=1&dkfs="+dkfs+"&lang=0&Purl="+ttkefu_pageurl+"&Pt="+ttkefu_pagetitleLimtit(ttkefu_pagetitle)+"&xx=1","36564","top=0,left=100,width=849,height=619,scrollbars=no,resizable=yes,status=no,z-look=yes,alwaysRaised=yes,location=no,depended=no,center:yes") } function randtantel(){ var iLeft = (window.screen.availWidth-330)/2; window.open("http://w1.ttkefu.com/conversationormessage/ourcustomerservice/customerlist/randtel.jsp?u=20794&tS4wJ7="+sjs+"&kfid=37207&fgid=20794&s2N6eL=36564&isshowstyle=1&dkfs=tel","36564","top=200,left="+iLeft+",width=320,height=450,scrollbars=no,resizable=yes,status=no,z-look=yes,alwaysRaised=yes,location=no,depended=no,center:yes") } function ttkefu_randtantel(){ var iLeft = (window.screen.availWidth-330)/2; window.open("http://w1.ttkefu.com/conversationormessage/ourcustomerservice/customerlist/randtel.jsp?u=20794&tS4wJ7="+sjs+"&kfid=37207&fgid=20794&s2N6eL=36564&isshowstyle=1&dkfs=tel","36564","top=200,left="+iLeft+",width=320,height=450,scrollbars=no,resizable=yes,status=no,z-look=yes,alwaysRaised=yes,location=no,depended=no,center:yes") } function listtana(weburl,nicheng){ var str=weburl; /*新窗口*/ if(str.substr(str.indexOf("=")+1,str.indexOf("&")-str.indexOf("=")-1)==mini_dialog.zhidingkefu) { /*新窗口客服与迷你窗口客服相同则关闭迷你窗口*/ mini_dialog.isfirst=-1; mini_dialog.closewindow(); } window.open(weburl,"36564","top=0,left=100,width=849,height=619,scrollbars=no,resizable=yes,status=no,z-look=yes,alwaysRaised=yes,location=no,depended=no,center:yes") } function tanb(kuid,use,dkfs,nicheng){ document.getElementById("sendMsgTxt_chat").removeAttribute("readonly"); mini_dialog.state='0'; document.getElementById("minidialog").style.display=""; mini_dialog.zhidingkefu=kuid; mini_dialog.kfid=mini_dialog.zhidingkefu; document.getElementById('ttkefutitle').innerHTML='正与'; if(nicheng.length>4){ nicheng=nicheng.substring(0,4)+"..."; } document.getElementById('ttkefuonlineKefuName').innerHTML=nicheng+'对话'; mini_dialog.getmsg({HH:"770"}); } function tanac(str,dkfs){ window.open("http://w1.ttkefu.com/conversationormessage/ourcustomerservice/customerlist/chat_boxs.jsp?u=20794&t5Ys2R=36564&tS4wJ7="+sjs+"&zixun="+encodeURIComponent(str)+"&fgid=20794&s2N6eL=36564&dkfs="+dkfs+"&lang=0&Purl="+ttkefu_pageurl+"&Pt="+ttkefu_pagetitleLimtit(ttkefu_pagetitle)+"","36564","top=0,left=100,width=849,height=619,scrollbars=no,resizable=yes,status=no,z-look=yes,alwaysRaised=yes,location=no,depended=no,center:yes") } function tanbc(kuid,use,str,dkfs){ try{ var win=window.open('http://w1.ttkefu.com/conversationormessage/ourcustomerservice/customerlist/chat_boxs.jsp?R5s6eT='+kuid+'&t5Ys2R=36564&zixun='+encodeURIComponent(str)+'&fgid=20794&s2N6eL='+use+'&tS4wJ7='+sjs+'&dkfs='+dkfs+"&lang=0&Purl="+ttkefu_pageurl+"&Pt="+ttkefu_pagetitleLimtit(ttkefu_pagetitle)+"",'36564','top=120,left=200,width=849,height=619,scrollbars=no,resizable=yes,status=no,z-look=yes,alwaysRaised=yes,location=no,depended=no,center:yes'); if(win==null){ window.location.href='http://w1.ttkefu.com/conversationormessage/ourcustomerservice/customerlist/chat_boxs.jsp?R5s6eT='+kuid+'&t5Ys2R=36564&zixun='+encodeURIComponent(str)+'&fgid=20794&s2N6eL='+use+'&tS4wJ7='+sjs+'&dkfs='+dkfs+"&lang=0&Purl="+ttkefu_pageurl+"&Pt="+ttkefu_pagetitleLimtit(ttkefu_pagetitle); } }catch(e){ window.location.href='http://w1.ttkefu.com/conversationormessage/ourcustomerservice/customerlist/chat_boxs.jsp?R5s6eT='+kuid+'&t5Ys2R=36564&zixun='+encodeURIComponent(str)+'&fgid=20794&s2N6eL='+use+'&tS4wJ7='+sjs+'&dkfs='+dkfs+"&lang=0&Purl="+ttkefu_pageurl+"&Pt="+ttkefu_pagetitleLimtit(ttkefu_pagetitle); } } function tantel(s,dkfs){ var iLeft = (window.screen.availWidth-330)/2; window.open(s+"&fgid=20794&dkfs="+dkfs,"_blank","top=200,left="+iLeft+",width=320,height=450,align=center,crollbars=no,resizable=yes,status=yes,z-look=yes,alwaysRaised=yes,location=no,depended=no,center:yes"); } function tanteluid(telu_id,sjs){ var iLeft = (window.screen.availWidth-330)/2; window.open("http://w1.ttkefu.com/conversationormessage/ourcustomerservice/customerlist/tel.jsp?userid=36564&useid="+telu_id+"&khbh="+sjs+"&fgid=20794&dkfs=1","_blank","top=200,left="+iLeft+",width=320,height=450,align=center,crollbars=no,resizable=yes,status=yes,z-look=yes,alwaysRaised=yes,location=no,depended=no,center:yes"); } function ttkefu_pagetitleLimtit(str){ if(str!=""){ str=FSenWords(str); str=ttkefu_gb2utf8(str); return str; } } var isfrist="",mini_cytime,timerkkff,times2; function onner(){ var ycurl="http://w1.ttkefu.com/yc.jsp?k=36564&j="+sjs+"&f=20794&r="+encodeURIComponent(document.location.href)+"&s="+Math.random(); if(isfrist==""){ var Onner_Referrer=document.referrer; if(Onner_Referrer.length>200){ Onner_Referrer=Onner_Referrer.substring(0,200)+"..."; } if(Onner_Referrer.indexOf("https://www.baidu.com")>=0){ Onner_Referrer="https://www.baidu.com"; } ycurl="http://w1.ttkefu.com/yc.jsp?k=36564&t="+encodeURIComponent(document.title)+"&j="+sjs+"&f=20794&r="+encodeURIComponent(document.location.href)+"&g="+guanjianzi+"&s="+Math.random()+"&l="+Onner_Referrer; isfrist="1"; } mmaain=document.domain; setCookie("mmaain",mmaain,"s20"); var new_script = document.createElement("script"); new_script.src = ycurl; document.getElementsByTagName("HEAD")[0].appendChild(new_script); setTimeout("onner()",18000); } function ttkefu_hide(str){ document.getElementById(str).style.display='none' } function TTclosedivname(str) { if(document.getElementById(str)!=null){ document.getElementById(str).style.display="none"; } } /// var ttkefu_flashVideoPlayer; //连接 function ttkefu_connection_s(url){ var ie = navigator.appName.indexOf("ttkefu_Microsoft") != -1; ttkefu_flashVideoPlayer = (ie) ? window['ttkefu_Mchannel_Fid'] : document['ttkefu_Mchannel_Fid']; ttkefu_flashVideoPlayer.ttkefu_connection_s(url); } //调用flash function ttkefu_sendMessage(){ ttkefu_flashVideoPlayer.ttkefu_sendMessage("PRIV|"+ttkefu_Mchannel.lguseid+"|"+ttkefu_Mchannel.receivers+"|"+ttkefu_Mchannel.txt+"|"); } //flash调用 function ttkefu_send2JS(mymsg){ if(mymsg=="ttkefu_flash_connection_s_ok"){ ttkefu_flashVideoPlayer.ttkefu_sendMessage("flash请求连接服务器"); }else if(mymsg=="ttkefu_flash_connection_s_fail" || mymsg=="ttkefu_flash_send_error"){ //3秒后重连 ttkefu_Mchannel.ResetLink({err:"833",tishi:"连接失败"}); }else{ //已经与服务器建立了连接 if(mymsg=="$ttkefu_flash_link_ok$"){ //账号登陆 ttkefu_Mchannel.LgServer(); }else if(mymsg=="login=ok"){ document.getElementById("ttkefu_mini_tishi_parent").style.display='none'; //对话建立提醒 ttkefu_Mchannel.lg=true; document.getElementById("sendMsgTxt_chat").removeAttribute("readonly"); ttkefu_Mchannel.Send("shengchengduihua"); ttkefu_Mchannel.TT_shengcheng=ttkefu_Mchannel.TT_shengcheng+1; }else if(mymsg.indexOf("ttkefu_kaiqiyuzhi")>=0){ ttkefu_Mchannel.pme=true; }else if(mymsg.indexOf("ttkefu_guanbiyuzhi")>=0){ ttkefu_Mchannel.pme=false; }else if(mymsg.indexOf("ttkefu_kaiqiLisWriting")>=0){ ttkefu_Mchannel.LisWriting=true; }else if(mymsg.indexOf("ttkefu_guanbiLisWriting")>=0){ ttkefu_Mchannel.LisWriting=false; }else if(mymsg.indexOf("you_jieshuduihua_hao")>=0){ ttkekfu_yhAutoCloseTalkTs(); }else if(mymsg.indexOf("ttkefu_xiaoxiyuzhi")>=0){ //访客正在输入提示 document.getElementById("ttkefu_minit0").style.display='none'; document.getElementById("ttkefu_minit1").style.display=''; if(mymsg!="Fangkechats=ttkefu_xiaoxiyuzhi"){ mini_dialog.getmsg({HH:"910"}); } }else if(mymsg.indexOf("ttkefu_blur")>=0){ //访客正在输入关闭 document.getElementById("ttkefu_minit0").style.display=''; document.getElementById("ttkefu_minit1").style.display='none'; if(mymsg!="Fangkechats=ttkefu_blur"){ mini_dialog.getmsg({HH:"918"}); } }else if(mymsg.indexOf("m=fkjietuok")>=0){ if(mymsg.indexOf("m=fkjietuok0")>=0){ //截图插件已安装 mini_dialog.InStallJieTu(); }else{ //截图完成ttkefu_temp.bmp mini_dialog.BakCutImg({MsgData:mymsg}); } }else if(mymsg.length>1){ mini_dialog.getmsg({HH:"921"}); } } ttkefu_Mchannel.SendXTiaoTime1=new Date(); document.getElementById("ttkefusocketdiv").innerHTML=mymsg; } /*第三方网站反馈*/ var ttkefuGetWzLgInfo_i=0; function ttkefuGetWzLgInfo(MsgData){ if(MsgData.UserName==""){ if(confirm("您尚未登录网站,点击确定将跳转至登录页面")){ window.location.href=""; }else{ /**/ if(navigator.userAgent.toLowerCase().indexOf("micromessenger")>0){ WeixinJSBridge.call('closeWindow'); }else{ window.close(); window.history.back(); } } } var DBdWzHy_Url="http://w1.ttkefu.com/DBdWzHy.jsp"; DBdWzHy_Url=DBdWzHy_Url+"?UserName="+MsgData.UserName; DBdWzHy_Url=DBdWzHy_Url+"&UserTel="+MsgData.UserTel; DBdWzHy_Url=DBdWzHy_Url+"&UserMobile="+MsgData.UserMobile; DBdWzHy_Url=DBdWzHy_Url+"&UserFax="+MsgData.UserFax; DBdWzHy_Url=DBdWzHy_Url+"&UserName="+MsgData.UserFax; DBdWzHy_Url=DBdWzHy_Url+"&UserQQ="+MsgData.UserQQ; DBdWzHy_Url=DBdWzHy_Url+"&UserEmail="+MsgData.UserEmail; DBdWzHy_Url=DBdWzHy_Url+"&UserMsn="+MsgData.UserMsn; DBdWzHy_Url=DBdWzHy_Url+"&UserCompany="+MsgData.UserCompany; DBdWzHy_Url=DBdWzHy_Url+"&UserAddr="+MsgData.UserAddr; DBdWzHy_Url=DBdWzHy_Url+"&UserRemark="+MsgData.UserRemark; DBdWzHy_Url=DBdWzHy_Url+"&kuse="+"36564"; DBdWzHy_Url=DBdWzHy_Url+"&uid="+mini_dialog.khid; DBdWzHy_Url=DBdWzHy_Url+"&fgid="+"20794"; DBdWzHy_Url=DBdWzHy_Url+"&sjs="+sjs; DBdWzHy_Url=DBdWzHy_Url+"&kfid="+mini_dialog.kfid; DBdWzHy_Url=DBdWzHy_Url+"&call=mini_dialog.getmsg({HH:1186});"; var DBdWzHy_script = document.createElement("script"); DBdWzHy_script.src =DBdWzHy_Url; DBdWzHy_script.charset="utf-8"; document.getElementsByTagName("HEAD")[0].appendChild(DBdWzHy_script); } var ttkefu_ws,ttkefu_xmlHttp; var ttkefu_Mchannel={ types:0, firstload:0, firststr:"", ws:null, reset_i:0, rec_mode:168, senders:"", receivers:"", lguseid:"", txt:"", isrun:false, device:0, pushtype:0, pushi:0, pushlist:new Array(), pushsound:1, pme:false, /*客服是否有预知操作*/ socyz:"", dhpush:false, uid:0, apns:"", Plink:"http://47.105.108.112:8010", ipp:"47.105.108.112", servers:"47.105.108.112", serverport:":8009", Ci:"", Si:"", lg:false, nowtime:new Date(), zxtime:new Date(), LisWriting:false, IsSendWriting:false, TT_shengcheng:0, XinTiaoTime:0, SendXTiaoTime0:new Date(), SendXTiaoTime1:new Date(), ResetLinkTime:0, /*是否执行了退出操作*/ ExitState:0, /*是否处于对话提示中*/ TalkTs:0, initialize:function(lguseid,receivers,rec_mode){ //消息预知是否开启 //初始化 this.lguseid=lguseid; this.receivers=receivers; this.rec_mode=rec_mode; this.isrun=true; this.ExitState=0; this.TalkTs=0; /*输入框设为只读*/ document.getElementById("sendMsgTxt_chat").removeAttribute("readonly"); if(window.WebSocket){ this.SendXTiaoTime0=new Date(); this.types=1; ttkefu_ToggleConnectionClicked(); }else{ var fls=this.flashChecker(); if(fls.f){ if(fls.v<9){ document.getElementById("ttkefu_mini_tishi_parent").style.display='none'; }else{ this.SendXTiaoTime0=new Date(); this.types=2; setTimeout(function(){ttkefu_connection_s(ttkefu_Mchannel.ipp)},100) } } } }, LgServer:function(){ /*已经与服务器建立了连接*/ ttkefu_Mchannel.SendXTiaoTime1=new Date(); /*登录*/ if(this.types==1){ ttkefu_ws.send("CONN|"+ttkefu_Mchannel.lguseid+"|0|"); }else if(this.types==2){ ttkefu_flashVideoPlayer.ttkefu_sendMessage("CONN|"+ttkefu_Mchannel.lguseid+"|0|"); } /*对话建立*/ if(!ttkefu_Mchannel.dhpush && ttkefu_Mchannel.pushtype==2){ var dd=new Date(); var pushtxt=dd.getHours()+":"+dd.getMinutes()+"分,访客给您发送了新对话."; ttkefu_Mchannel.PushTxt("5",ttkefu_Mchannel.uid,ttkefu_Mchannel.pushsound,pushtxt); ttkefu_Mchannel.dhpush=true; } /*心跳发送*/ ttkefu_Mchannel.XinTiaoTime=setTimeout(function(){ ttkefu_Mchannel.SendXinTiao(); },50); }, flashChecker:function(){ var hasFlash = 0; var flashVersion = 0; try{ if (document.all) { var swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); if (swf) { hasFlash = 1; VSwf = swf.GetVariable("$version"); flashVersion = parseInt(VSwf.split(" ")[1].split(",")[0]); } } else { if (navigator.plugins && navigator.plugins.length > 0) { var swf = navigator.plugins["Shockwave Flash"]; if (swf) { hasFlash = 1; var words = swf.description.split(" "); for (var i = 0; i < words.length; ++i) { if (isNaN(parseInt(words[i]))) continue; flashVersion = parseInt(words[i]); } } } } } catch(e){ } return { f: hasFlash, v: flashVersion }; }, ResetLink:function(MsgData){ if(mini_dialog.state=="0"){ //退出检测 if(this.ExitState==1){ return false; } //与服务器连接断开,重连接中 ttkefu_Mchannel.lg=false; document.getElementById("sendMsgTxt_chat").setAttribute("readonly","true"); document.getElementById("ttkefu_mini_tishi").innerHTML="连接断开,重连接中["+MsgData.tishi+"]"; document.getElementById("ttkefu_mini_tishi_parent").style.display=''; //重连10次失败后,执行轮询 ttkefu_Mchannel.reset_i=ttkefu_Mchannel.reset_i+1; if(ttkefu_Mchannel.reset_i>11){ ttkefu_Mchannel.lg=true; document.getElementById("sendMsgTxt_chat").removeAttribute("readonly"); ttkefu_Mchannel.types=0; mini_dialog.getmsg({HH:"1035"}); }else{ //与服务器连接断开,3秒后重连 clearTimeout(ttkefu_Mchannel.ResetLinkTime); ttkefu_Mchannel.ResetLinkTime=setTimeout(function(){ ttkefu_Mchannel.initialize(mini_dialog.chatid,mini_dialog.kfid,ttkefu_Mchannel.rec_mode); },3000) } } }, /*心跳包发送*/ SendXinTiao:function(){ clearTimeout(ttkefu_Mchannel.XinTiaoTime); //仅在连接成功后执行 if(ttkefu_Mchannel.lg){ //退出检测 if(this.ExitState==1){ return false; } //心跳检测 var XTiaoTimeCha=ttkefu_Mchannel.SendXTiaoTime1.getTime()-ttkefu_Mchannel.SendXTiaoTime0.getTime(); if(Math.floor(XTiaoTimeCha/1000)>120){ ttkefu_Mchannel.ResetLink({err:"1076",tishi:"长时间未响应"}); return false; } //心跳发送 ttkefu_Mchannel.SendXTiaoTime0=new Date(); if(ttkefu_Mchannel.types==1){ ttkefu_ws.send("xintiao|"+ttkefu_Mchannel.lguseid+"|"); }else if(ttkefu_Mchannel.types==2){ ttkefu_flashVideoPlayer.ttkefu_sendMessage("xintiao|"+ttkefu_Mchannel.lguseid+"|"); } /*回调*/ ttkefu_Mchannel.XinTiaoTime=setTimeout(function(){ ttkefu_Mchannel.SendXinTiao(); },60000); //在线访客状态 mini_dialog.getmsg({HH:"1086"}); } }, Send:function(txt){ try{ this.txt=txt; if(this.types==1){ ttkefu_ws.send("PRIV|"+this.lguseid+"|"+this.receivers+"|"+txt+"|"); }else if(this.types==2){ ttkefu_sendMessage(); }else if(this.types==0 && this.device!=1){ if(this.receivers==""){ this.receivers=mini_dialog.kfid; } var new_script = document.createElement("script"); new_script.src ="http://"+ttkefu_Mchannel.ipp+":8009/pumsg.jsp?Myttkefu_fangke=dh_tishi&r="+this.receivers+"&m=fkxiaoxi&x="+Math.random(); document.getElementsByTagName("HEAD")[0].appendChild(new_script); } } catch(e){ setTimeout(function(){ if(ttkefu_Mchannel.lg){ ttkefu_Mchannel.Send(txt) } },500); } }, Push:function(MsgType,MsgId){ if(this.pushtype==2){ // var msg_script = document.createElement("script"); msg_script.id="msg_script"; msg_script.src ="http://w1.ttkefu.com/push1.aspx?act="+MsgType+"&d="+MsgId+"&x="+Math.random(); document.getElementsByTagName("HEAD")[0].appendChild(msg_script); }else if(this.pushtype==1){ } }, PushTxt:function(type,id,sd,txt){ if(this.pushtype==2 && txt!="undefined" && mini_dialog.imlixian==0){ txt=this.Ubb2Txt(txt); if(txt.length>45){ txt=txt.substring(0,45)+"..."; } txt=encodeURI(txt); var pmsg_script = document.createElement("script"); pmsg_script.id="pmsg_script"; pmsg_script.src =this.Plink+"/Myttkefu_fangke=push&r="+this.apns+"&m="+txt+"&t="+type+"&i="+id+"&s="+sd+"&x="+Math.random(); document.getElementsByTagName("HEAD")[0].appendChild(pmsg_script); } }, YPost:function(url,parameter,callback){ this.createXMLHttpRequest(); //ttkefu_xmlHttp.onreadystatechange = callback; ttkefu_xmlHttp.open("POST",url,true); ttkefu_xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;"); ttkefu_xmlHttp.send(parameter); }, createXMLHttpRequest:function(){ //Mozilla 浏览器(将XMLHttpRequest对象作为本地浏览器对象来创建) if(window.XMLHttpRequest){ //Mozilla 浏览器 ttkefu_xmlHttp = new XMLHttpRequest(); }else if(window.ActiveXObject) { //IE浏览器 //IE浏览器(将XMLHttpRequest对象作为ActiveX对象来创建) try{ ttkefu_xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){ try { ttkefu_xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){} } } if(ttkefu_xmlHttp == null){ //alert("不能创建XMLHttpRequest对象"); return false; } }, /*消息提示:访客等待超时0|访客无回复1|自动断开2*/ TsId:0, InsertTs:function(MsgData){ try{ var m=document.createElement("div"); m.style.margin="0px"; m.style.padding="0px"; m.style.width="98%"; /*消息ID*/ this.TsId=this.TsId+1; /*消息类型*/ var inserttxt=""; switch(MsgData.type){ case 0: inserttxt="

"+MsgData.TiShi+"

"; break; case 1: inserttxt=mini_dialog.kfhtmlheader+MsgData.TiShi+mini_dialog.kfhtmlfooter+"
" break; case 2: inserttxt="

"+MsgData.TiShi+"本次对话将在110秒后结束,回复消息将继续对话

"; break; } m.innerHTML=inserttxt; document.getElementById("ttkefucontainer").appendChild(m); document.getElementById("ttkefucontainer_wrapper").scrollTop=document.getElementById("ttkefucontainer_wrapper").scrollHeight; /*状态提示*/ mini_dialog.clear(timerkkff); timerkkff = mini_dialog.show('新消息'); window.focus(); }catch(ex){ //alert(ex.message); } }, Ubb2Txt:function(txt){ //表情替换 txt=txt.replace(/\[emo\](.+?)\[\/emo\]/ig,'[表情]'); //图片替换 txt=txt.replace(/\[img\](.+?)\[\/img\]/ig,'[图片]'); //超链接替换 txt=txt.replace(/\[url href='(.+?)'\](.+?)\[\/url\]/ig,'$1'); //文件替换 txt=txt.replace(/\[file\](.+?)\[\/file\]/ig,'[文件]'); return txt; }, IWriting:function(){ if(this.LisWriting && !this.IsSendWriting){ ttkefu_Mchannel.Send('ttkefu_xiaoxiyuzhi'); this.IsSendWriting=true; } }, CloseWriting:function(){ if(this.LisWriting){ setTimeout(function(){ ttkefu_Mchannel.Send('ttkefu_blur'); ttkefu_Mchannel.IsSendWriting=false; },500); } }, Exit:function(){ this.isrun=false; if(this.types>0){ try{ this.Send("tuichu"); if(this.types==1){ ttkefu_ws.send("EXIT|"+this.lguseid+"|"); }else if(this.types==2){ ttkefu_flashVideoPlayer.ttkefu_sendMessage("EXIT|"+this.lguseid+"|"); } }catch(ex){ } } /*输入框设为只读*/ document.getElementById("sendMsgTxt_chat").setAttribute("readonly","true"); /*标记连接已断开*/ this.lg=false; /*标记已退出*/ this.ExitState=1; } } function ttkefu_ToggleConnectionClicked(){ ttkefu_ws = new WebSocket("ws://"+ttkefu_Mchannel.ipp+":8009");//连接服务器 ttkefu_ws.onopen = function(event){ //账号登陆 ttkefu_Mchannel.LgServer(); }; ttkefu_ws.onmessage = function(event){ //获得消息 if(event.data=="login=ok"){ //对话建立提醒 ttkefu_Mchannel.lg=true; document.getElementById("sendMsgTxt_chat").removeAttribute("readonly"); document.getElementById("ttkefu_mini_tishi_parent").style.display='none'; ttkefu_ws.send("PRIV|"+ttkefu_Mchannel.lguseid+"|"+ttkefu_Mchannel.receivers+"|shengchengduihua|"); ttkefu_Mchannel.TT_shengcheng=ttkefu_Mchannel.TT_shengcheng+1; }else if(event.data.length>1){ if(event.data.indexOf("ttkefu_kaiqiyuzhi")>=0){ ttkefu_Mchannel.pme=true; }else if(event.data.indexOf("ttkefu_guanbiyuzhi")>=0){ ttkefu_Mchannel.pme=false; }else if(event.data.indexOf("ttkefu_kaiqiLisWriting")>=0){ ttkefu_Mchannel.LisWriting=true; }else if(event.data.indexOf("ttkefu_guanbiLisWriting")>=0){ ttkefu_Mchannel.LisWriting=false; }else if(event.data.indexOf("you_jieshuduihua_hao")>=0){ ttkekfu_yhAutoCloseTalkTs(); }else if(event.data.indexOf("ttkefu_xiaoxiyuzhi")>=0){ //访客正在输入提示 document.getElementById("ttkefu_minit0").style.display='none'; document.getElementById("ttkefu_minit1").style.display=''; if(event.data!="Fangkechats=ttkefu_xiaoxiyuzhi"){ mini_dialog.getmsg({HH:"1245"}); } }else if(event.data.indexOf("ttkefu_blur")>=0){ //访客正在输入关闭 document.getElementById("ttkefu_minit0").style.display=''; document.getElementById("ttkefu_minit1").style.display='none'; if(event.data!="Fangkechats=ttkefu_blur"){ mini_dialog.getmsg({HH:"1253"}); } }else if(event.data.indexOf("m=fkjietuok")>=0){ if(event.data.indexOf("m=fkjietuok0")>=0){ //截图插件已安装 mini_dialog.InStallJieTu(); }else{ //截图完成ttkefu_temp.bmp mini_dialog.BakCutImg({MsgData:event.data}); } }else{ mini_dialog.getmsg({HH:"1256"}); } } ttkefu_Mchannel.SendXTiaoTime1=new Date(); document.getElementById("ttkefusocketdiv").innerHTML=event.data; }; ttkefu_ws.onclose = function(event){ if(mini_dialog.chatid>0){ //重连 ttkefu_Mchannel.ResetLink({err:"1268",tishi:"客户端异常断开"}); } }; } var ttkefu_d=new Date(); //系统消息状态配置 var ttkefu_fkleavestate="True",ttkefu_fkstaytime=300000*6,ttkefu_fknoreplystate="False",ttkefu_fknoreplytime="300",ttkefu_fkwaitstate="False",ttkefu_fkwaittime="180"; //FkSendTime:访客发送消息时间,FkTimeOut:等待超时延迟函数 var ttkefu_FkSendTime=new Date(),ttkefu_leavetime=new Date(),ttkefu_FkTimeOut=0; //KfSendTime:客服回复消息时间,KfTimeOut:等待超时延迟函数 var ttkefu_KfSendTime=new Date(),ttkefu_KfTimeOut=0; //访客状态0空闲1对话 var ttkefu_fk_state=0; var mini_dialog={ display:0, chatid:0, kfid:0, kfname:"", khid:0, imlixian:0, imlixian1:0, Timer:'', use:'', i:0, issend:0, /*true:对话结束false:对话中*/ dialog:true, ycurl:"", yz:0, AutoClose_Ok:0, isfirst:0, iszhuanjie:0, windowstate:0, exiturl:'', zhidingkefu:0, state:'0', p:'0', waitno:'0', getmsg_i:0, location:'', kup:0, n:'0', id:0, mini_zs:'0', /*接待访客设置*/ duihuaxuanze:1, statemsg:'
当前对话已结束!
', title:document.title, titlebg:'#6BC1FA', fontcolor:'#FFFFFF', jstime:'2020-10-20 5:14:15', tshtmlheader:'
', tshtmlfooter:'
', fkhtmlheader:"
", fkhtmlfooter:"
", kfhtmlheader:"
", kfhtmlfooter:"
", first_to_msg:'', lastid:'', sendtime:new Date(), getCSS:function(obj,style){ if(window.getComputedStyle){ return getComputedStyle(obj)[style]; } return obj.currentStyle[style]; }, /*删除客服列表*/ clearKflb:function(){ if(document.getElementById("ttkefu_KfList_div")){ var miniP=document.getElementById("ttkefu_KfList_div").parentNode; miniP.removeChild(document.getElementById("ttkefu_KfList_div")); } }, /*迷你邀请*/ yaoqing:function(){ //删除结束对话提示 var Divlist=document.getElementById("ttkefucontainer").getElementsByTagName("div"); for(var i=0;i'; PJstr=PJstr+'
'+ttkefu_pagetitle+'
'+ttkefu_minipagetitle+'
发送
'; PJstr=PJstr+''; PJstr=PJstr+''; var m_Pstr=document.createElement("div"); m_Pstr.style.margin="0px"; m_Pstr.style.padding="0px"; m_Pstr.style.width="98%"; /*消息类型*/ m_Pstr.innerHTML=PJstr; document.getElementById("ttkefucontainer").appendChild(m_Pstr); document.getElementById("ttkefucontainer_wrapper").scrollTop=document.getElementById("ttkefucontainer_wrapper").scrollHeight; } }, shakeMove:function(json){ //声明要进行抖动的元素 var obj = json.obj; //声明元素抖动的最远距离 var target = json.target; //默认值为20 target = Number(target) || 20; //声明元素的变化样式 var attr = json.attr; //默认为'left' attr = attr || 'left'; //声明元素的起始抖动方向 var dir = json.dir; //默认为'1',表示开始先向右抖动 dir = Number(dir) || '1'; //声明元素每次抖动的变化幅度 var stepValue = json.stepValue; stepValue = Number(stepValue) || 2; //声明回调函数 var fn = json.fn; //声明步长step var step = 0; //保存样式初始值 var attrValue = parseFloat(this.getCSS(obj,attr)); //声明参照值value var value; //清除定时器 if(obj.timer){return;} //开启定时器 obj.timer = setInterval(function(){ //抖动核心代码 value = dir*(target - step); //当步长值大于等于最大距离值target时 if(step >= target){ step = target } //更新样式值 obj.style[attr] = attrValue + value + 'px'; //当元素到达起始点时,停止定时器 if(step == target){ clearInterval(obj.timer); obj.timer = 0; //设置回调函数 fn && fn.call(obj); } //如果此时为反向运动,则步长值变化 if(dir === -1){ step = step + stepValue; } //改变方向 dir = -dir; },50); }, fbb:function(){ document.getElementById("sendMsgTxt_chat").value=document.getElementById("ttkefu_ProInfo_span").getAttribute("data"); this.sendmsg(); }, tohtml:function(str){ str=str.replace(/\[url/g,""); return str; }, /*强制留名检测*/ qzlm:function(){ var ttkefu_qzlm_name=document.getElementById("ttkefu_qzlm_name").value; if(ttkefu_qzlm_name.length<2 || ttkefu_qzlm_name.length>20){ return "格式错误,姓名应在2-20个字符之间"; } var ttkefu_qzlm_qq=document.getElementById("ttkefu_qzlm_qq").value; if(! /^[0-9]*$/.test(ttkefu_qzlm_qq)){ return "QQ格式错误"; } var ttkefu_qzlm_phone=document.getElementById("ttkefu_qzlm_phone").value; if(! /1[0-9]{10}/.test(ttkefu_qzlm_phone)){ return "手机格式错误"; } /**/ ttkefu_isleave_name="False"; document.getElementById("ttkefu_qzlmDIv").style.display='none'; document.getElementById("sendMsgTxt_chat").style.display=''; return "留名:"+ttkefu_qzlm_name+",手机:"+ttkefu_qzlm_phone+",QQ:"+ttkefu_qzlm_qq; }, /*去除全部加载中*/ clearLoading:function(){ var MaxId=parseInt(mini_dialog.id); for(var i=0;i<=MaxId;i++){ if(document.getElementById("ttkefu_d"+i)){ document.getElementById("ttkefu_d"+i).style.display='none'; } } }, sendmsg:function(){ /*强制留名检测*/ if(ttkefu_isleave_name=="True"){ var qzlmstr=this.qzlm(); if(qzlmstr.indexOf("格式错误")>0){ alert(qzlmstr); return false; } document.getElementById("sendMsgTxt_chat").value=qzlmstr; } var sendminitxtmsg=document.getElementById("sendMsgTxt_chat").value; sendminitxtmsg=sendminitxtmsg.replace(/\s+/g,''); if(sendminitxtmsg==''){ return false; } if(this.duihuaxuanze==0 && this.zhidingkefu==0){ /*生成客服列表*/ if(document.getElementById("ttkefu_KfList_div")){ return false; }else{ document.getElementById("sendMsgTxt_chat").setAttribute("readonly","true"); var new_script = document.createElement("script"); //act:err:82 new_script.src = "http://w1.ttkefu.com/minimsg.jsp?f=0&zhidingkefu=0&fgid=20794&act=x"; new_script.charset="utf-8"; document.getElementsByTagName("HEAD")[0].appendChild(new_script); return false; } } // clearTimeout(times2); var nnntime = new Date(); var minsec = Date.parse(nnntime) - Date.parse(mini_dialog.sendtime); if(minsec<1000&&mini_dialog.i<31 ){ mini_dialog.i=mini_dialog.i+1; }else if(mini_dialog.i>30){ mini_dialog.i=30; }else if(mini_dialog.i>=1){ mini_dialog.i=mini_dialog.i-1; }else{ mini_dialog.i=0; } mini_dialog.sendtime=nnntime; if(mini_dialog.i>0 ){ document.getElementById("ttkefu_mini_tishi").innerHTML="操作太过频繁,请"+mini_dialog.i+"秒后再试"; document.getElementById("ttkefu_mini_tishi_parent").style.display=''; document.getElementById("sendMsgTxt_chat").setAttribute("readonly","true"); times2=setTimeout('mini_dialog.sendmsg()',1000) } else { document.getElementById("ttkefu_mini_tishi_parent").style.display='none'; document.getElementById("sendMsgTxt_chat").removeAttribute("readonly"); if(mini_dialog.state=="1"){ /*对话已结束*/ var m=document.createElement("div"); m.id="ttkefu_closetsdiv"; m.className="ttkefu_closetsdiv"; m.innerHTML=mini_dialog.tshtmlheader+"当前对话已结束!"+mini_dialog.tshtmlfooter+"
"; document.getElementById("ttkefucontainer").appendChild(m); document.getElementById("ttkefucontainer_wrapper").scrollTop=document.getElementById("ttkefucontainer_wrapper").scrollHeight; document.getElementById("sendMsgTxt_chat").value=""; }else if(document.getElementById("sendMsgTxt_chat").value.length>300){ /*聊天文字不能大于300字*/ var m=document.createElement("div"); m.innerHTML="
聊天文字不能大于300字!
"; document.getElementById("ttkefucontainer").appendChild(m); document.getElementById("ttkefucontainer_wrapper").scrollTop=document.getElementById("ttkefucontainer_wrapper").scrollHeight; }else if(document.getElementById("sendMsgTxt_chat").value==""){ /*聊天文字不能为空*/ var m=document.createElement("div"); m.innerHTML="
聊天文字不能为空!
"; document.getElementById("ttkefucontainer").appendChild(m); document.getElementById("ttkefucontainer_wrapper").scrollTop=document.getElementById("ttkefucontainer_wrapper").scrollHeight; }else if(document.getElementById("sendMsgTxt_chat").value==""){ /*接待访客模式*/ }else{ /*消息发送*/ var txtttt=document.getElementById("sendMsgTxt_chat").value; txtttt=txtttt.replace("[emo]","表情"); var sendtxt=""+txtttt+""; sendtxt=sendtxt.replace(/\r\n/ig,"
") ; sendtxt=sendtxt.replace(/\n/ig,"
") ; //图片替换 sendtxt=sendtxt.replace(/\[img\]/ig,""); //sendtxt=sendtxt.replace(" "," "); sendtxt=mini_dialog.tohtml(sendtxt); mini_dialog.id=mini_dialog.id+1; var jsonstr="{\"datalist\":[{\"type\":\"1\",\"msg\":\""+sendtxt+"\",\"id\":\""+mini_dialog.id+"\",\"reffer\":\"0\"}]}"; mini_dialog.issend=1; /*form*/ /*END---form*/ if(document.getElementById("sendMsgTxt_chat").value!=""){ var dd=new Date(); var sendtxtp=dd.getHours()+":"+dd.getMinutes()+"分,访客:"+document.getElementById("sendMsgTxt_chat").value; ttkefu_Mchannel.PushTxt("2",ttkefu_Mchannel.lguseid,ttkefu_Mchannel.pushsound,sendtxtp); } mini_dialog.addtimes(); mini_dialog.insertmsg(jsonstr); mini_dialog.getmsg({HH:"1431"}); ttkefu_Mchannel.CloseWriting(); if(mini_dialog.getmsg_i>0){ //连接成功后执行 }else{ mini_dialog.first_to_msg="{\"datalist\":[{\"type\":\"1\",\"msg\":\""+sendtxt+"\"}]}"; } } } }, getmsg:function(MsgData){ /*同步网站会员登录检测*/ if(ttkefuGetWzLgInfo_i==1 && mini_dialog.kfid>0){ var ts_script = document.createElement("script"); ts_script.src ="?x="+Math.random(); document.getElementsByTagName("HEAD")[0].appendChild(ts_script); setTimeout(function(){ if(ttkefuGetWzLgInfo_i==1){ alert("会员登录接口请求失败"); } },5000) ; return false; } /*发消息*/ var sendmsgtxt="",ttkefu_posturl=""; if(mini_dialog.issend==1 || (true && document.getElementById("sendMsgTxt_chat").value!="")){ sendmsgtxt=document.getElementById("sendMsgTxt_chat").value; sendmsgtxt=sendmsgtxt.replace(/\r\n/ig,"
") ; sendmsgtxt=sendmsgtxt.replace(/\n/ig,"
") ; // sendmsgtxt=sendmsgtxt.replace(" "," "); //sendmsgtxt=sendmsgtxt.replace(/\%/g,"%25"); //仅当点击发送时获取发送内容 if(mini_dialog.issend==1) { ttkefu_posturl="&txt="+escape(sendmsgtxt)+"&txti="+mini_dialog.id; } if(true && document.getElementById("sendMsgTxt_chat").value!="") { ttkefu_posturl=ttkefu_posturl+"&v="+escape(sendmsgtxt); } //仅当点击发送时清空输入框内容 if(mini_dialog.issend==1) { document.getElementById("sendMsgTxt_chat").value=""; } if(mini_dialog.dialog){ mini_dialog.dialog=false; mini_dialog.iarsfirst=2; } } /*首次应先产生对话连接,再发送消息,因发消息post提交,无法更新当前对话状态*/ if(mini_dialog.chatid>0){ mini_dialog.getmsg_i=mini_dialog.getmsg_i+1; mini_dialog.ycurl="http://w1.ttkefu.com/minimsg.jsp?c="+mini_dialog.chatid+"&f="+mini_dialog.isfirst+"&fgid=20794&ki="+mini_dialog.kfid+"&ku=36564&m=0&minikhid="+mini_dialog.khid+"&w=0&z="+mini_dialog.iszhuanjie+"&zhidingkefu="+mini_dialog.zhidingkefu+"&p="+mini_dialog.p+"&dkfs=5&wp="+mini_dialog.waitno+"&mp="+mini_dialog.n+"&tS4wJ7="+sjs+"&pst="+mini_dialog.issend+ttkefu_posturl+"&l="+ttkefu_Mchannel.types+"&Gl="+MsgData.HH+"&Timer="+mini_dialog.Timer; }else{ mini_dialog.ycurl="http://w1.ttkefu.com/minimsg.jsp?f="+mini_dialog.isfirst+"&tS4wJ7="+sjs+"&kfid=37207&fgid=20794&ki="+mini_dialog.kfid+"&z="+mini_dialog.iszhuanjie+"&zhidingkefu="+mini_dialog.zhidingkefu+"&p="+mini_dialog.p+"&dkfs=5&wp="+mini_dialog.waitno+"&mp="+mini_dialog.n+"&pst="+mini_dialog.issend+"&minikhid="+mini_dialog.khid+ttkefu_posturl+"&Gl="+MsgData.HH; mini_dialog.isfirst=2; } mini_dialog.p='1'; var new_script = document.createElement("script"); new_script.src = mini_dialog.ycurl; new_script.charset="utf-8"; document.getElementsByTagName("HEAD")[0].appendChild(new_script); mini_dialog.yz=0; //重置发送,因post快于连接提交,在连接中用该参数确认为post后的链接提交 mini_dialog.issend=0; clearTimeout(mini_cytime); if(ttkefu_Mchannel.types==0){ mini_cytime=setTimeout("mini_dialog.getmsg({HH:'1501'})",5000); } //自动断开 ttkekfu_AutoCloseTalkTs(); }, tishifk:function(){ //客服上线提示imlixian:服务器端更新imlixian1访客端更新 if(mini_dialog.imlixian1==1 && mini_dialog.imlixian==0){ var fk_tishimsg='{"datalist":[{"type":"3","msg":""+mini_dialog.kfname+"上线了"}]}'; mini_dialog.insertmsg(fk_tishimsg); mini_dialog.imlixian1=0; } }, yuzhimsg:function(){ if(true && mini_dialog.chatid>0 && ttkefu_Mchannel.lguseid!='' && ttkefu_Mchannel.pme ){ mini_dialog.kup=1; ttkefu_Mchannel.Send("ttkefu_xiaoxiyuzhi"+document.getElementById("sendMsgTxt_chat").value); mini_dialog.kup=0; ttkefu_Mchannel.IsSendWriting=true; } //发送正在输入 var sendminitxtmsg=document.getElementById("sendMsgTxt_chat").value; sendminitxtmsg=sendminitxtmsg.replace(/\s+/g,''); if(sendminitxtmsg!=''){ ttkefu_Mchannel.IWriting(); } }, miniwindow:function(){ if(mini_dialog.windowstate==0) { document.getElementById("minidialog").style.height="39px"; document.getElementById("minidialog").style.width="215px"; document.getElementById("ttkefuminidialogtitle").style.height="44px"; document.getElementById("ttkefuminidialogtitle").style.lineHeight="34px"; document.getElementById("ttkefutitle").style.height="39px"; document.getElementById("ttkefutitle").style.lineHeight="34px"; document.getElementById("ttkefu_minwindow_min").style.display="none"; //document.getElementById("ttkefu_minwindow_max").style.background="url(http://w1.ttkefu.com/images/maxmize.gif) no-repeat"; document.getElementById("ttkefu_minwindow_max").style.margin="17px 10px 0px 0px"; document.getElementById("ttkefu_minwindow_close").style.display="none"; document.getElementById("chat_div_main").style.display="none"; document.getElementById("cinv_dialogtool").style.display="none"; setCookie("miniwindowstate","1","d1"); setTimeout(function(){mini_dialog.windowstate=1;},500); } }, insertmsg:function(data){ if(data!="") { var json=eval("("+data+")"); var m=document.createElement("div"); m.style.margin="0px"; m.style.padding="0px"; m.style.width="98%"; var htmlstr=""; var TTKfMsg=""; var KfMsg_ls=""; //仅针对首次发送消息产生 for(ji=0;ji"+json.datalist[ji].sendtime+""; } htmlstr=htmlstr+mini_dialog.fkhtmlheader; if(json.datalist[ji].id){ htmlstr=htmlstr+"
"; } htmlstr=htmlstr+json.datalist[ji].msg+mini_dialog.fkhtmlfooter+"
"; } if(json.datalist[ji].type=="2") { if(json.datalist[ji].sendtime) { htmlstr=htmlstr+"
"+json.datalist[ji].sendtime+"
"; } KfMsg_ls=json.datalist[ji].msg; if(KfMsg_ls=="" ){ if(json.datalist.length==1){ var ox=document.getElementById("minidialog"); mini_dialog.shakeMove({obj:ox,attr:'right'}); } KfMsg_ls="发送了一个震动"; } htmlstr=htmlstr+mini_dialog.kfhtmlheader+KfMsg_ls+mini_dialog.kfhtmlfooter+"
"; } if(json.datalist[ji].type=="3") { if(document.getElementById("ttkefucontainer").lastChild.innerHTML.indexOf(json.datalist[ji].msg)<0) { htmlstr=htmlstr+"
"+json.datalist[ji].msg+"
"; } } if(json.datalist[ji].type=="4") { htmlstr=htmlstr+"
"+json.datalist[ji].msg+"
"; } if(json.datalist[ji].type=="5") { /*--*/ while(document.getElementById("ttkefu_pd")){ var objdiv=document.getElementById("ttkefu_pd"); objdiv.parentNode.removeChild(objdiv); } m.id="ttkefu_pd"; htmlstr=htmlstr+"
"+json.datalist[ji].msg+"
"; } if(json.datalist[ji].type=="6") { m.id="ttkefu_KfList_div"; htmlstr=htmlstr+"
请选择客服
"; m.innerHTML=htmlstr; document.getElementById("ttkefucontainer").appendChild(m); TTKfMsg=json.datalist[ji].msg; var ttkefuii_zxs=0; for(var ttkefuii=0; ttkefuii0 && ttkefuii_zxs0){ ttkefu_font.id="ttkefu_font"+MsgData.a; ttkefu_font.style.color="#000000"; ttkefu_font.style.margin="5px 0px 0px 0px"; ttkefu_font.style.textAlign="center"; ttkefu_font.style.padding="5px 0px"; ttkefu_font.style.cursor="pointer"; ttkefu_font.setAttribute("kf",MsgData.a); ttkefu_font.setAttribute("zt",MsgData.c); ttkefu_font.setAttribute("nc",MsgData.b); ttkefu_font.setAttribute("gh",MsgData.e); var ttkefu_font_glbh=MsgData.b,ttkefu_font_zxbz=MsgData.c,ttkefu_font_bm=MsgData.d; var ttkefu_font_glbhshow=ttkefu_font_glbh; if(ttkefu_font_glbh.length>6){ ttkefu_font_glbhshow=ttkefu_font_glbh.substring(0,6)+"..."; } var ttkefu_font_bmshow=ttkefu_font_bm; if(ttkefu_font_bm.length>6){ ttkefu_font_bmshow=ttkefu_font_bm.substring(0,6)+"..."; } ttkefu_font.innerHTML=ttkefu_font_glbhshow+" ["+ttkefu_font_bmshow+"]"; ttkefu_font.onclick=function(){ if(this.getAttribute("zt")=="离线"){ listtana('http://w1.ttkefu.com/conversationormessage/ourcustomerservice/customerlist/chat_boxs.jsp?R5s6eT="+this.getAttribute("kf")+"&t5Ys2R=36564&s2N6eL=this.getAttribute("gh")&fgid=20794&tS4wJ7='+sjs,this.getAttribute("nc")); }else{ mini_dialog.zhidingkefu=this.getAttribute("kf"); mini_dialog.kfid=mini_dialog.zhidingkefu; //ie不支持remove //document.getElementById("ttkefu_KfList_div").remove(0); var miniP=document.getElementById("ttkefu_KfList_div").parentNode; miniP.removeChild(document.getElementById("ttkefu_KfList_div")); document.getElementById("sendMsgTxt_chat").removeAttribute("readonly"); if(document.getElementById("sendMsgTxt_chat").value!=""){ document.getElementById("ttkefuMiniSendbtn").click(); }else{ mini_dialog.getmsg({HH:"1980"}); } } } ttkefu_font.onmouseover=function(){ if(this.getAttribute("zt")!="离线"){ ttkefu_minwindow_Over(ttkefu_font); } } ttkefu_font.onmouseout=function(){ if(this.getAttribute("zt")!="离线"){ ttkefu_minwindow_Out(ttkefu_font); } } }else{ //竖线 ttkefu_font.style.margin="5px 0px 0px 0px"; ttkefu_font.style.color="#cccccc"; ttkefu_font.style.textAlign="center"; ttkefu_font.style.padding="5px 0px"; ttkefu_font.style.cursor="pointer"; ttkefu_font.innerHTML=" | "; } document.getElementById("ttkefu_KfList").appendChild(ttkefu_font); }, alert:function(msg){ document.getElementById("ttkefuminitishi_txt_alert").innerHTML=msg; document.getElementById("ttkefuminitishi_alert").style.display=""; }, maxwindow:function(){ if(mini_dialog.windowstate==1) { document.getElementById("minidialog").style.height="auto"; document.getElementById("minidialog").style.width="236px"; document.getElementById("ttkefuminidialogtitle").style.height="31px"; document.getElementById("ttkefuminidialogtitle").style.lineHeight="22px"; document.getElementById("ttkefutitle").style.height="26px"; document.getElementById("ttkefutitle").style.lineHeight="22px"; document.getElementById("ttkefu_minwindow_max").style.margin="10px 0px 0px 0px"; document.getElementById("ttkefu_minwindow_min").style.display=""; //document.getElementById("ttkefu_minwindow_max").style.background="url(http://w1.ttkefu.com/images/yxjreply0.gif) no-repeat"; document.getElementById("ttkefu_minwindow_close").style.display=""; document.getElementById("chat_div_main").style.display=""; document.getElementById("cinv_dialogtool").style.display=""; mini_dialog.windowstate=0; document.getElementById("ttkefucontainer_wrapper").scrollTop=document.getElementById("ttkefucontainer_wrapper").scrollHeight; setCookie("miniwindowstate","0","d1"); } else { /*关闭当前循环以及迷你窗口*/ document.getElementById('minidialog').style.display='none'; clearTimeout(mini_cytime); /*弹出新窗口*/ if(mini_dialog.dialog&&mini_dialog.zhidingkefu==0) { /*tana('2');*/ window.open("http://w1.ttkefu.com/conversationormessage/ourcustomerservice/customerlist/chat_boxs.jsp?u=20794&t5Ys2R=36564&tS4wJ7="+sjs+"&fgid=20794&s2N6eL=36564&isshowstyle=1&dkfs=6&lang=0&Purl="+ttkefu_pageurl+"&Pt="+ttkefu_pagetitleLimtit(ttkefu_pagetitle)+"","36564","top=0,left=100,width=849,height=619,scrollbars=no,resizable=yes,status=no,z-look=yes,alwaysRaised=yes,location=no,depended=no,center:yes") } else { var weburl="http://w1.ttkefu.com/conversationormessage/ourcustomerservice/customerlist/chat_boxs.jsp?R5s6eT="+mini_dialog.zhidingkefu+"&t5Ys2R=36564&s2N6eL="+mini_dialog.use+"&fgid=20794&tS4wJ7="+sjs+"&dkfs=6&lang=0&Purl="+ttkefu_pageurl+"&Pt="+ttkefu_pagetitleLimtit(ttkefu_pagetitle); window.open(weburl,"36564","top=0,left=100,width=849,height=619,scrollbars=no,resizable=yes,status=no,z-look=yes,alwaysRaised=yes,location=no,depended=no,center:yes"); } } }, closetishi:function(){ if(mini_dialog.isfirst>0) { document.getElementById("ttkefuminitishiwrapperdiv").style.height="151px"; document.getElementById("ttkefuminitishi_txt").innerHTML="是否关闭该对话?请您对我的服务给予评价!"; document.getElementById('ttkefuminitishi').style.display=''; document.getElementById('ttkefuminitishiwrapper').style.display=''; document.getElementById('ttkefuminiqueding').onclick=function(){mini_dialog.pingfen();} } else { document.getElementById("ttkefuminitishiwrapperdiv").style.height="128px"; document.getElementById("ttkefuminitishi_txt").innerHTML="结束对话?"; document.getElementById('ttkefuminitishi').style.display=''; document.getElementById('ttkefuminitishiwrapper').style.display=''; document.getElementById('ttkefuminiqueding').onclick=function(){mini_dialog.closewindow();} } }, pingfen:function(){ document.getElementById('ttkefuminitishi').style.display='none'; document.getElementById('ttkefuminitishiwrapper').style.display='none'; document.getElementById("ttkefuminitishiwrapperdiv").style.height="238px"; document.getElementById('minittkefutitletxt').innerHTML='请为客服人员评分!'; document.getElementById('ttkefuminitishi_close').style.display='none'; /*document.getElementById('ttkefuminitishi_title').style.fontWeight="normal";*/ document.getElementById('ttkefuminitxtlimit').style.display=''; document.getElementById('ttkefuminitishi_txt').innerHTML='满意 较好 一般
较差 恶劣
您的建议
'; document.getElementById('ttkefuminitishi_txt').style.padding="5px 0px 5px 10px"; document.getElementById('ttkefuminiquxiao').style.display="none"; document.getElementById('ttkefuminiqueding').onclick=function(){mini_dialog.tijiaopingfen();} document.getElementById('ttkefuminitishi').style.display=''; document.getElementById('ttkefuminitishiwrapper').style.display=''; }, tijiaopingfen:function(){ document.getElementById('ttkefuminitishi').style.display='none'; document.getElementById('ttkefuminitishiwrapper').style.display='none'; /*关闭循环*/ if(mini_dialog.isfirst>0) { mini_dialog.stoploop(); } /*数据验证*/ var ttkefuminipftxt=document.getElementById('ttkefuminitxt').value; if(ttkefuminipftxt.length>150) { document.getElementById("ttkefuminitxtlimit").style.color="#ff0000"; return; } else { document.getElementById("ttkefuminitxtlimit").style.color="#555555"; } var mypingfen=0; for(var i=0;i0) { mini_dialog.stoploop(); } /* if(document.all) {window.external.AddFavorite('','');} else if(window.sidebar) {window.sidebar.addPanel('','','')};*/ }, closetishisign:function(){ if(document.getElementById('ttkefuminitishi_close').style.backgroundColor=="") { document.getElementById('ttkefuminitishi_close').style.backgroundColor="#CC0000"; document.getElementById('ttkefuminitishi_close').style.color="#ffffff"; } else { document.getElementById('ttkefuminitishi_close').style.backgroundColor=""; document.getElementById('ttkefuminitishi_close').style.color="#555555"; } }, closetishiwindow:function(){ document.getElementById('ttkefuminitishi').style.display='none'; document.getElementById('ttkefuminitishiwrapper').style.display='none'; document.getElementById('ttkefu_jietu_Install_minitishi').style.display='none'; document.getElementById('ttkefu_jietu_minitishiwrapper').style.display='none'; document.getElementById('ttkefuminitishi_jietu').style.display='none'; document.getElementById('ttkefuminitishi_alert').style.display='none'; document.getElementById('ttkefuminitishiwrapper_jietu_BigImg').style.display='none'; }, closeBigImg:function(){ document.getElementById('ttkefuminitishiwrapper_jietu_BigImg').style.display='none'; }, closewindow:function(){ if(mini_dialog.isfirst>0) { mini_dialog.exiturl="http://w1.ttkefu.com/minimsg.jsp?act=exit&ki="+mini_dialog.kfid+"&minikhid="+mini_dialog.khid+"&fgid=20794&dkfs=&c="+mini_dialog.chatid; var new_script = document.createElement("script"); new_script.src = mini_dialog.exiturl; document.getElementsByTagName("HEAD")[0].appendChild(new_script); } document.getElementById('minidialog').style.display='none'; document.getElementById('ttkefuminitishi').style.display='none'; document.getElementById('ttkefuminitishiwrapper').style.display='none'; clearTimeout(mini_cytime); mini_dialog.clear(timerkkff); var Jsinv_text="您好请问有什么可以帮您的?"; document.getElementById("ttkefucontainer").innerHTML='
ttkefu是一款免费的网页即时聊天、微信即时聊天的客服软件,免费申请网址:http://www.ttkefu.com
'+mini_dialog.kfhtmlheader+Jsinv_text+mini_dialog.kfhtmlfooter+"
"; mini_dialog.chatid=0; mini_dialog.kfid=0; mini_dialog.khid=0; mini_dialog.use=''; mini_dialog.i=0; mini_dialog.dialog=true; mini_dialog.isfirst=0; mini_dialog.iszhuanjie=0; mini_dialog.zhidingkefu=0; mini_dialog.state='0'; mini_dialog.p='0'; document.getElementById("ttkefuminitishi_txt").innerHTML="是否关闭该对话?请您对我的服务给予评价!"; }, stoploop:function(){ if(mini_dialog.isfirst>0) { mini_dialog.exiturl="http://w1.ttkefu.com/minimsg.jsp?act=exit&ki="+mini_dialog.kfid+"&minikhid="+mini_dialog.khid+"&fgid=20794&dkfs=&c="+mini_dialog.chatid; var new_script = document.createElement("script"); new_script.src = mini_dialog.exiturl; document.getElementsByTagName("HEAD")[0].appendChild(new_script); clearTimeout(mini_cytime); mini_dialog.clear(timerkkff); } clearTimeout(mini_cytime); mini_dialog.clear(timerkkff); var Jsinv_text="您好请问有什么可以帮您的?"; document.getElementById("ttkefucontainer").innerHTML='
ttkefu是一款免费的网页即时聊天、微信即时聊天的客服软件,免费申请网址:http://www.ttkefu.com
'+mini_dialog.kfhtmlheader+Jsinv_text+mini_dialog.kfhtmlfooter+'
'; mini_dialog.chatid=0; mini_dialog.kfid=0; mini_dialog.khid=0; mini_dialog.use=''; mini_dialog.i=0; mini_dialog.dialog=true; mini_dialog.isfirst=0; mini_dialog.iszhuanjie=0; mini_dialog.zhidingkefu=0; mini_dialog.state='0'; mini_dialog.p='0'; }, exit:function(){ if(mini_dialog.isfirst>0) { mini_dialog.exiturl="http://w1.ttkefu.com/minimsg.jsp?act=exit&ki="+mini_dialog.kfid+"&minikhid="+mini_dialog.khid+"&fgid=20794&dkfs=&c="+mini_dialog.chatid; var new_script = document.createElement("script"); new_script.src = mini_dialog.exiturl; document.getElementsByTagName("HEAD")[0].appendChild(new_script); } clearTimeout(mini_cytime); mini_dialog.clear(timerkkff); var Jsinv_text="您好请问有什么可以帮您的?"; document.getElementById("ttkefucontainer").innerHTML='
ttkefu是一款免费的网页即时聊天、微信即时聊天的客服软件,免费申请网址:http://www.ttkefu.com
'+mini_dialog.kfhtmlheader+Jsinv_text+mini_dialog.kfhtmlfooter+'
'; mini_dialog.chatid=0; mini_dialog.kfid=0; mini_dialog.khid=0; mini_dialog.use=''; mini_dialog.i=0; mini_dialog.dialog=true; mini_dialog.isfirst=0; mini_dialog.iszhuanjie=0; mini_dialog.zhidingkefu=0; mini_dialog.state='0'; mini_dialog.p='0'; document.getElementById("sendMsgTxt_chat").setAttribute("readonly","true"); document.getElementById("ttkefutitle").innerHTML="在线客服"; document.getElementById("ttkefuonlineKefuName").innerHTML=""; }, AutoDkexit:function(){ if(mini_dialog.isfirst>0) { mini_dialog.exiturl="http://w1.ttkefu.com/minimsg.jsp?act=exit&ki="+mini_dialog.kfid+"&minikhid="+mini_dialog.khid+"&fgid=20794&dkfs=&c="+mini_dialog.chatid; var new_script = document.createElement("script"); new_script.src = mini_dialog.exiturl; document.getElementsByTagName("HEAD")[0].appendChild(new_script); } clearTimeout(mini_cytime); mini_dialog.clear(timerkkff); mini_dialog.chatid=0; mini_dialog.kfid=0; mini_dialog.khid=0; mini_dialog.use=''; mini_dialog.i=0; mini_dialog.dialog=true; mini_dialog.isfirst=0; mini_dialog.iszhuanjie=0; mini_dialog.zhidingkefu=0; mini_dialog.state='0'; mini_dialog.p='0'; document.getElementById("sendMsgTxt_chat").setAttribute("readonly","true"); document.getElementById("ttkefutitle").innerHTML="在线客服"; document.getElementById("ttkefuonlineKefuName").innerHTML=""; }, sendtxtfoucs:function(){ mini_dialog.clear(timerkkff); document.getElementById("uploadFileBox1").style.display="none"; }, sendtxtblur:function(){ ttkefu_Mchannel.CloseWriting(); }, show:function(msgtype) { /*标题栏闪烁提示*/ var step=0, _title =mini_dialog.title; var timer = setInterval(function(){ step++; if (step==3) {step=1} if (step==1) { document.title="【   】"+_title; document.getElementById("ttkefutitle").style.color="#FF0000"; document.getElementById("ttkefuonlineKefuName").style.color="#FF0000"; document.getElementById("ttkefuminidialogtitle").style.background="#FFFF00 url(http://w1.ttkefu.com/images/kf.png) no-repeat 10px center"; } if (step==2) { document.title="【"+msgtype+"】"+_title; document.getElementById("ttkefutitle").style.color=mini_dialog.fontcolor; document.getElementById("ttkefuonlineKefuName").style.color=mini_dialog.fontcolor; document.getElementById("ttkefuminidialogtitle").style.background=mini_dialog.titlebg+" url(http://w1.ttkefu.com/images/kf.png) no-repeat 10px center";} }, 500); /*声音提示*/ document.getElementById('soundMsg').setAttribute('src','http://w1.ttkefu.com/sound/type.mp3'); /*如果窗口没有最大化则最大化*/ if(mini_dialog.windowstate==1){ mini_dialog.maxwindow() } document.getElementById("sendMsgTxt_chat").focus(); return [timer, _title]; }, clear : function(timerArr) { if(timerArr) { clearInterval(timerArr[0]); setTimeout(function(){document.title = timerArr[1]},500); document.getElementById("ttkefuminidialogtitle").style.background=mini_dialog.titlebg+" url(http://w1.ttkefu.com/images/kf.png) no-repeat 10px center"; document.getElementById("ttkefutitle").style.color=mini_dialog.fontcolor; document.getElementById("ttkefuonlineKefuName").style.color=mini_dialog.fontcolor; } }, addtimes:function(){ var mynowtime=new Date(); mynowtime=mynowtime.getFullYear()+"-"+(mynowtime.getMonth()+1)+"-"+(mynowtime.getDate()+1)+" "+(mynowtime.getHours()+1)+":"+(mynowtime.getMinutes()+1)+":"+(mynowtime.getSeconds()+1); /*1分钟添加一次时间*/ if(mini_dialog.GetDateDiff(mini_dialog.jstime,mynowtime,"minute")>=1) { mini_dialog.jstime=mynowtime; var nowday=new Date(); var m=document.createElement("div"); m.style.margin="0px"; m.style.padding="0px"; m.innerHTML="
"+nowday.getHours()+":"+nowday.getMinutes()+":"+nowday.getSeconds()+"
"; document.getElementById("ttkefucontainer").appendChild(m); document.getElementById('ttkefucontainer').scrollTop=document.getElementById('ttkefucontainer').scrollHeight; } }, GetDateDiff:function(startTime, endTime, diffType) { /*将xxxx-xx-xx的时间格式,转换为 xxxx/xx/xx的格式*/ startTime = startTime.replace(/\-/g, "/"); endTime = endTime.replace(/\-/g, "/"); /*将计算间隔类性字符转换为小写*/ diffType = diffType.toLowerCase(); var sTime = new Date(startTime); //开始时间 var eTime = new Date(endTime); //结束时间 /*作为除数的数字 */ var divNum = 1; switch (diffType) { case "second": divNum = 1000; break; case "minute": divNum = 1000 * 60; break; case "hour": divNum = 1000 * 3600; 0 break; case "day": divNum = 1000 * 3600 * 24; break; default: break; } return parseInt((eTime.getTime() - sTime.getTime()) / parseInt(divNum)); }, importhtml:function(){ //获取当前页面部分内容 var txt=""; var tongjiwrapper=document.getElementById("ttkefucontainer").innerHTML; txt=txt+tongjiwrapper+""; var mynowtime=new Date(); mynowtime=mynowtime.getFullYear()+"-"+(mynowtime.getMonth()+1)+"-"+(mynowtime.getDate()+1); var htmlname="聊天记录-"+mynowtime; ttkefuimport.document.location="about:blank"; ttkefuimport.document.open("text/html","utf-8"); ttkefuimport.document.write(txt); ttkefuimport.document.execCommand("SaveAs", true, htmlname+'.htm'); ttkefuimport.close(); } } /**/ document.addEventListener('paste', function (event) { var isChrome = false; if (event.clipboardData || event.originalEvent) { //某些chrome版本使用的是event.originalEvent var clipboardData = (event.clipboardData || event.originalEvent.clipboardData); if(clipboardData.items){ // for chrome var items = clipboardData.items, len = items.length, blob = null; isChrome = true; for (var i = 0; i < len; i++) { if (items[i].type.indexOf("image") !== -1) { //getAsFile() 此方法只是living standard firefox ie11 并不支持 blob = items[i].getAsFile(); } } console.log("len:"+len); if(blob!==null){ console.log("blob!==null"); var blobUrl=URL.createObjectURL(blob); console.log("blobUrl="+blobUrl); //blob对象显示 //document.getElementById("ttkefu_jietu_yulan").src=blobUrl; //document.getElementById("ttkefuminitishi_jietu").style.display=""; var reader = new FileReader(); //base64码显示 reader.onloadstart = function (event) { console.log("reader.onloadstart"); } reader.onprogress = function (event) { console.log("reader.onprogress"); } reader.onabort = function (event) { console.log("reader.onabort"); } //onerror reader.onerror = function (event) { console.log("reader.onerror"); } reader.onload = function (event) { console.log("reader.onload"); } reader.onloadend = function (event) { console.log("reader.onloadend"); // event.target.result 即为图片的Base64编码字符串 var base64_str = event.target.result; document.getElementById("ttkefu_jietu_yulan").src=base64_str; document.getElementById("ttkefuminitishi_jietu").style.display=""; document.getElementById("ttkefuminiqueding_jietu_val").value=base64_str; } reader.readAsDataURL(blob); } } } }) function ttkefu_hide(str){ document.getElementById(str).style.display='none' } /*访客等待超时提示:以访客发送消息成功为起始点*/ function ttkefu_FkWaitOvTime(){ //访客聊天状态设置vip是否开启 if(mini_dialog.AutoClose_Ok==0){ return false; } //客服是否在线 if(mini_dialog.imlixian==1){ return false; } //是否处于对话结束提示中 if(ttkefu_Mchannel.TalkTs==1){ return false; } //是否正处于对话中 if(!ttkefu_Mchannel.lg){ return false; } //是否开启 if(ttkefu_fkwaitstate!="True"){ return false; } //是否超时 var Ntime=new Date(); var OvTime_Cha=(Ntime.getTime()-ttkefu_FkSendTime.getTime())/1000; if(parseInt(OvTime_Cha)