window.__YSFWINTYPE__ = Number('1'); window.__YSFMODILEWINTYPE__ = Number('2'); window.__YSFTHEMELAYEROUT__ = 1; window.__YSFBGCOLOR__ = "0"; window.__YSFBGTONE__ = "notone"; window.__YSFSDKADR__ = "https://cs.you.163.com"; window.__YSFDASWITCH__ = 0; window.__YSFDAROOT__ = "https://cs.you.163.com/webda/da.gif"; window.__YSFISGA__ = 0; !function(){function execEvent(e,t){var n=ysf[e];if(util.isFunction(n))if(inited)return n.apply(null,t);else switch(e){case"onready":case"onLayerload":case"onunread":case"config":case"product":case"logoff":case"setAuthToken":case"pollAuthToken":callbacksBeforeLoad.push({func:n,arg:t});break;case"open":case"url":case"track":case"getUnreadMsg":console.warn("can not exec"+e+"before sdk ready")}}function sendData2box(){function e(e){var t,n;var o="";for(n=0;n-1&&navigator.userAgent.indexOf("Chrome")==-1)return!0;else return!1},getcookie:function(e){var t=document.cookie,n="\\b"+e+"=",o=t.search(n);if(o<0)return"";o+=n.length-2;var i=t.indexOf(";",o);if(i<0)i=t.length;return t.substring(o,i)||""},createAjax:function(){var e=null;var t=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","Msxml2.XMLHTTP.4.0","Msxml2.XMLHTTP.5.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];if(window.XMLHttpRequest){e=new XMLHttpRequest;if("withCredentials"in e)return e}if(window.xDomainRequest)e=new Window.xDomainRequest;return e},mergeParams:function(e){var t=[];for(var n in e)if(e.hasOwnProperty(n))t.push(encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t.join("&")},ajax:function(conf){var method=conf.method||"get",contentType=conf.contentType,url=conf.url,data=conf.data,result={},success=conf.success,error=conf.error;var xhr=util.createAjax();if(xhr){try{if("GET"===method.toUpperCase())if(data)url=url+"?"+util.mergeParams(data);if(conf.synchronous)xhr.open(method,url,!1);else xhr.open(method,url)}catch(ex){error();return}xhr.onreadystatechange=function(){if(4==xhr.readyState)if(200===xhr.status)try{result=eval("("+xhr.responseText+")");if(200==(result&&result.code))success(result.result);else error(result)}catch(err){error(result)}else error()};if("GET"==method.toUpperCase())xhr.send(null);else if("json"==contentType){xhr.setRequestHeader("content-type","application/json");xhr.send(JSON.stringify(data))}else{xhr.setRequestHeader("content-type","application/x-www-form-urlencoded");xhr.send(util.mergeParams(data))}}else error()},findLocalItems:function(e,t){var n,o=[],i;for(n in localStorage)if(n.match(e)||!e&&"string"==typeof n){i=!t?localStorage.getItem(n):JSON.parse(localStorage.getItem(n));o.push({key:n,val:i})}return o},clearLocalItems:function(e){for(var t=0;t=0;e--)n[e]()}var t=!1;var n=[];return function(o){n.push(o);if(!t){if(proxy.addEventListener)proxy.addEventListener("load",e,!1);else if(proxy.attachEvent)proxy.attachEvent("onload",e);t=!0}}}(),mergeUrl:function(e,t){var n=e.split("?"),o=n.shift(),i=util.query2Object(n.shift()||"","&");for(var a in t)i[a]=t[a];return o+"?"+serialize(i)},query2Object:function(e,t){var n=e.split(t),o={};for(var i=0;i$/,t={r:/\<|\>|\&|\r|\n|\s|\'|\"/g,"<":"<",">":">","&":"&"," ":" ",'"':""","'":"'","\n":"
","\r":""};return function(n){n=util.encode(t,n);return n.replace(e,"

")}}(),unescape:function(){var e={r:/\&(?:lt|gt|amp|nbsp|#39|quot)\;|\/gi,"<":"<",">":">","&":"&"," ":" ","'":"'",""":'"',"
":"\n"};return function(t){return util.encode(e,t)}}(),replaceRichAndUnescape:function(e){var t=/]+>/g;e=e.replace(t,"[图片]");var n=/<\/?[^>]*>/g;e=e.replace(n,"");return util.unescape(e)}};var winParam={};var cache={};var proxy;var chatProxy;var layerCnt;var chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";var firstBtnClick=!0;var hasConnected=!1;var connectTimer;var doConnectInterval=5e3;var CircleNumberFlag=0;var msgSessionIds=[];var getUnreadTimer;var unreadPollingInterval=5e3;var inited=!1;var callbacksBeforeLoad=[];var cachedArgs=[];var bodyscrollTop=0;if(window.ysf&&window.ysf.a)cachedArgs=window.ysf.a;if(window.ysf)var RESROOT=window.ysf.RESROOT;window.ysf=function(){try{var e=arguments[0],t=Array.prototype.slice.call(arguments,1);return execEvent(e,t)}catch(n){}};ysf.ROOT=window.__YSFSDKADR__||"";ysf.RESROOT=RESROOT;var each=function(e,t){if(e&&t)for(var n in e)if(e.hasOwnProperty(n))t.call(null,n,e[n])};var rand=function(e){if(e)return"ysf-"+e;var t=[];for(var n=0,o;n<20;++n){o=Math.floor(Math.random()*chars.length);t.push(chars.charAt(o))}return t.join("").toLowerCase()};var initPageId=function(e){e=e||10;var t=[];for(var n=0,o;n';proxy=proxy.getElementsByTagName("IFRAME")[0];util.addLoadEventForProxy(function(){inited=!0;syncWebAnalytics();if(!util.isMobilePlatform())sendData2box();ysf.analytics(window.__YSFDASWITCH__);for(var e=0;e0){var t=layerCnt&&layerCnt.getAttribute("data-switch");if("1"==t)sendChatMsg("doconnect",{reconnect:1})}if(e.needPolling)getUnreadTimer=setTimeout(getUnread,e.delay||unreadPollingInterval)},error:function(e){var t=unreadPollingInterval;if(e&&e.result&&e.result.delay)t=e.result.delay;if(!e||8112!=e.code&&19104!=e.code&&14001!=e.code&&16001!=e.code&&8013!=e.code)getUnreadTimer=setTimeout(getUnread,t)}});else getUnreadTimer=setTimeout(getUnread,unreadPollingInterval)};var updateUnread=function(e,t){if(e>0){formatMessage(t);if(cache["notifyContent"]&&t.time';return t};var n=function(e){var t=document.createElement("span");t.setAttribute("id","YSF-BTN-CIRCLE"); e.appendChild(t)};var o=function(e){var t=document.createElement("div"),n=document.createElement("div"),o=document.createElement("span"),i=document.createElement("span");t.setAttribute("id","YSF-BTN-BUBBLE");n.setAttribute("id","YSF-BTN-CONTENT");o.setAttribute("id","YSF-BTN-ARROW");i.setAttribute("id","YSF-BTN-CLOSE");i.onclick=function(e){e.stopPropagation();e.preventDefault();ysf.NotifyMsgAndBubble({category:"clearCircle"})};e.appendChild(t);t.appendChild(n);t.appendChild(o);t.appendChild(i)};var i=t();n(i);o(i)};ysf.entryPanel=function(e){var t=document.createElement("div"),n=util.isFrameModule()?0:1;if(util.isMobilePlatform()){t.setAttribute("id","YSF-PANEL-MOBILE");t.onclick=function(){receivePkg({category:"closeIframe"})}}else parseInt(e)?t.setAttribute("id","YSF-PANEL-CORPINFO"):t.setAttribute("id","YSF-PANEL-INFO");t.className="ysf-chat-layer";document.body.appendChild(t);t.setAttribute("data-switch",n);layerCnt=t;try{sendChatMsg("status",{layerOpen:n})}catch(o){}createDvcTimer();if(cache.preloadIframe)ysf.openInline(ysf.url())};ysf.invite=function(){var e,t,n,o=document.createDocumentFragment();var i=function(){if(!e){e=document.createElement("div");e.className="ysf-online-invite-wrap";if(n.style&&n.style.type){e.innerHTML='
';var t=e.childNodes[0],o=t.childNodes,i=o[0];if(util.isArray(n.style.oprs)){var s=null,l=null;for(var d=0;d99?"99+":e.data.circleNum;o.innerHTML=r[e.data.type](e.data.notifyCnt)}}};var n=t[e.category];if(n)n(e)};ysf.getUnreadMsg=function(){return{type:cache["notifyContent"].type,message:cache["notifyContent"].content,total:cache["notifyNumber"]}};ysf.config=function(e){if(e){merge(e);console.log("config",cache,!!cache.appKey);if(cache.appKey){refresh(e.uid);syncProfile({upToServer:!0,success:e.success,error:e.error});initWinConfig();getUnread();console.log("ysf.config",cache)}}};ysf.url=function(e){console.log("打开客服聊天窗口");if(!cache.appKey)return"";var t={k:cache.appKey,u:cache.uid,d:device(),uuid:cache.uuid,gid:cache.groupid||0,sid:cache.staffid||0,qtype:cache.qtype||0,dvctimer:cache.dvctimer||0,robotShuntSwitch:cache.robotShuntSwitch||0,hc:cache.hc||0,orderId:cache["orderId"]||0,itemId:cache["itemId"]||0,applyId:cache["applyId"]||0,entranceType:cache["entranceType"]||0,outerEntranceKey:cache["outerEntranceKey"],robotId:cache.robotId||0,pageId:ysf.PAGEID};if(e&&e.templateId)t.templateId=e.templateId;if(cache.unconfirm)t.unconfirm=cache.unconfirm;if(cache.channelId)t.channelId=cache.channelId;if(cache.navigationTitle)t.navigationTitle=cache.navigationTitle;each({n:"name",e:"email",m:"mobile"},function(e,n){var o=cache[n];if(o)t[e]=o});if(cache.customSkin)each({topbarBgColor:"topbarBgColor",chatPanelBgColor:"chatPanelBgColor",lMsgColor:"lMsgColor",rMsgColor:"rMsgColor",lMsgBgColor:"lMsgBgColor",rMsgBgColor:"rMsgBgColor",buttonColor:"buttonColor",buttonBgColor:"buttonBgColor",editorColor:"editorColor",editorBgColor:"editorBgColor",corpInfoColor:"corpInfoColor",corpInfoTitleColor:"corpInfoTitleColor",corpInfoBgColor:"corpInfoBgColor",tipColor:"tipColor",linkColor:"linkColor",borderColor:"borderColor"},function(e,n){var o=cache.customSkin[n];if(o)t[e]=o});t.t=encodeURIComponent(document.title);if(cache.bid){t.bid=cache.bid;return ysf.IMROOT+"/trade?"+serialize(t)}return ysf.IMROOT+"?"+serialize(t)};ysf.track=function(e,t){var n=cache.appKey,o=device(),i=encodeURIComponent(location.href),a=localStorage.getItem("DA-LANDPAGE")||"",r=(new Date).getTime(),c=e,s="";desc=JSON.stringify(t),tp=1;var l=function(){try{var e=window.__YSFDAROOT__+"?ak="+n+"&dv="+o+"&cup="+i+"&lp="+a+"&tm="+r+"&ct="+c+"<="+s+"&tp="+tp+"&desc="+desc+"&u="+window.ysf.PAGEID;loadImage(e)}catch(t){}};l()};ysf.logoff=function(){updateDevice();util.clearLocalItems(util.findLocalItems(/msgnumbers/gi))};ysf.openByLink=function(e){var t=ysf.url();if(t){e=e||{};var n=e.target||e.srcElement;if(n&&"A"==n.tagName)n.href=t}};ysf.product=function(){var e=function(e){e.title=e.title&&e.title.length>100?e.title.slice(0,100):e.title;e.desc=e.desc&&e.desc.length>300?e.desc.slice(0,300):e.desc;e.note=e.note&&e.note.length>100?e.note.slice(0,100):e.note;var t={pageId:ysf.PAGEID,title:e.title,desc:e.desc,picture:e.picture,url:e.url,note:e.note,show:e.show,sendByUser:e.sendByUser,sendProToRobot:e.sendProToRobot,actionText:e.actionText,actionTextColor:e.actionTextColor,spuId:e.spuId,other:e.other,orderIdNew:e.orderId};if(e.template)t.template=e.template;if(1==t.sendByUser){t.show=1;t.auto=0}if(e.tags&&util.isArray(e.tags))t.tags=JSON.stringify(e.tags);if(e.orderId)t.orderId=e.orderId;return t};return function(t){var n=e(t);if(cache.bid)n.bid=cache.bid;syncCustomProfile({data:n,success:t.success,error:t.error})}}();ysf.open=function(e){var t=ysf.url(e);if(t)switch(winParam.type){case"win":ysf.openWin(t,winParam);break;case"layer":ysf.openInline(t,function(){ysf.openLayer();try{if(firstBtnClick&&0==cache["dvcswitch"]){sendChatMsg("doconnect",{doconnect:1});firstBtnClick=!1}}catch(e){}if(0==cache["dvcswitch"]&&1==cache["pushswitch"]||CircleNumberFlag>0){sendChatMsg("dopushmsgread",{ids:msgSessionIds});msgSessionIds=[]}if(!firstBtnClick&&cache["notifyNumber"]>0)sendChatMsg("doconnect",{reconnect:1});ysf.NotifyMsgAndBubble({category:"clearCircle"})});break;case"url":ysf.openUrl(t,winParam)}};ysf.init=function(e){var t=function(){ysf.entry({src:e});if(util.isFrameModule())ysf.entryPanel(cache["corpInfo"])};if(util.isFrameModule())setTimeout(function(){util.ajax({url:ysf.DOMAIN+"webapi/user/dvcSession.action?k="+cache["appKey"]+"&d="+cache["device"]+"&f="+cache["uid"],method:"post",success:function(e){cache["dvcswitch"]=e.dvcSwitch;cache["pushswitch"]=e.pushSwitch||0;cache["pushmsgid"]=e.batchIdList||0;if("mobileFrame"==util.isFrameModule())cache["dvcswitch"]=0;t()},error:function(){cache["dvcswitch"]=0;cache["pushswitch"]=0;t()}})},1e3);else{cache["dvcswitch"]=0;cache["pushswitch"]=0;t()}};util.addEvent(window,"beforeunload",function(){var e="YSFDVC-"+cache["device"],t="YSFMSG-"+cache["appKey"],n=Number(localStorage.getItem(e)); if(n>0)localStorage.setItem(e,--n);util.clearLocalItems(util.findLocalItems(new RegExp(t,"ig")))});ysf.on=function(){var e={onload:"load",unread:1};return function(e){var t=Object.prototype.toString.call(e).slice(8,-1);if(/object/gi.test(t)){for(var n in e)if("onload"==n&&util.isFunction(e[n]))if(!inited)util.addLoadEventForProxy(e[n]);else e[n]();else if("onLayerload"==n&&util.isFunction(e[n]))if("loaded"==ysf.openInline.loadStatus)e[n]();else ysf["_"+n]=e[n];else if(util.isFunction(ysf[n])&&util.isFunction(e[n]))ysf["_"+n]=e[n]}else console.warn("波比(。・∀・)ノ: 请保持正确的监听姿势...")}}();ysf.getPushMessage=function(e){sendChatMsg("dogetpushmsg",{ids:e})};ysf._unread=function(){};ysf.unread=function(){return{type:cache["notifyContent"].type,message:cache["notifyContent"].content,total:cache["notifyNumber"]}};ysf._onLayerload=function(){};ysf.clearDragresize=function(e){try{var t=window.location.hostname.split(".")[0];var n=["callcenter","session","qualitysession","qualitycallsession","worksheet","callflow","leave","monitor","usercenter"];if(n.indexOf(e)>-1)util.clearLocalItems(util.findLocalItems(new RegExp(t+"-"+e,"ig")));else for(var o=0;o