var data = {}; /****** id:"xxxxxxxxxxxx", name:'UKeFu', email:'ukefu@ukewo.cn', mobile:'18588888888' ****/ ;(function(name,context,definition){if(typeof module!=='undefined'&&module.exports){ module.exports=definition()}else if(typeof define==='function'&&define.amd){ define(definition)}else{context[name]=definition()}})('Fingerprint',this,function(){'use strict';var Fingerprint=function(options){ var nativeForEach,nativeMap;nativeForEach=Array.prototype.forEach;nativeMap=Array.prototype.map;this.each=function(obj,iterator,context){ if(obj===null){return}if(nativeForEach&&obj.forEach===nativeForEach){obj.forEach(iterator,context)}else if( obj.length===+obj.length){for(var i=0,l=obj.length;i>>16)*c1)&0xffff)<<16)))&0xffffffff;k1=(k1<<15)|(k1>>>17);k1=((((k1&0xffff)*c2)+((((k1>>>16)*c2)&0xffff)<<16)))&0xffffffff;h1^=k1;h1=(h1<<13)|(h1>>>19);h1b=((((h1&0xffff)*5)+((((h1>>>16)*5)&0xffff)<<16)))&0xffffffff;h1=(((h1b&0xffff)+0x6b64)+((((h1b>>>16)+0xe654)&0xffff)<<16))}k1=0;switch(remainder){case 3:k1^=(key.charCodeAt(i+2)&0xff)<<16;case 2:k1^=(key.charCodeAt(i+1)&0xff)<<8;case 1:k1^=(key.charCodeAt(i)&0xff);k1=(((k1&0xffff)*c1)+((((k1>>>16)*c1)&0xffff)<<16))&0xffffffff;k1=(k1<<15)|(k1>>>17);k1=(((k1&0xffff)*c2)+((((k1>>>16)*c2)&0xffff)<<16))&0xffffffff;h1^=k1}h1^=key.length;h1^=h1>>>16;h1=(((h1&0xffff)*0x85ebca6b)+((((h1>>>16)*0x85ebca6b)&0xffff)<<16))&0xffffffff;h1^=h1>>>13;h1=((((h1&0xffff)*0xc2b2ae35)+((((h1>>>16)*0xc2b2ae35)&0xffff)<<16)))&0xffffffff;h1^=h1>>>16;return h1>>>0},hasLocalStorage:function(){try{return!!window.localStorage}catch(e){return true;}},hasSessionStorage:function(){try{return!!window.sessionStorage}catch(e){return true;}},hasIndexDb:function(){try{return!!window.indexedDB}catch(e){return true;}},isCanvasSupported:function(){var elem=document.createElement('canvas');return!!(elem.getContext&&elem.getContext('2d'))},isIE:function(){if(navigator.appName==='Microsoft Internet Explorer'){return true}else if(navigator.appName==='Netscape'&&/Trident/.test(navigator.userAgent)){return true}return false},getPluginsString:function(){if(this.isIE()&&this.ie_activex){return this.getIEPluginsString()}else{return this.getRegularPluginsString()}},getRegularPluginsString:function(){return this.map(navigator.plugins,function(p){var mimeTypes=this.map(p,function(mt){return[mt.type,mt.suffixes].join('~')}).join(',');return[p.name,p.description,mimeTypes].join('::')},this).join(';')},getIEPluginsString:function(){if(window.ActiveXObject){var names=['ShockwaveFlash.ShockwaveFlash','AcroPDF.PDF','PDF.PdfCtrl','QuickTime.QuickTime','rmocx.RealPlayer G2 Control','rmocx.RealPlayer G2 Control.1','RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)','RealVideo.RealVideo(tm) ActiveX Control (32-bit)','RealPlayer','SWCtl.SWCtl','WMPlayer.OCX','AgControl.AgControl','Skype.Detection'];return this.map(names,function(name){try{new ActiveXObject(name);return name}catch(e){return null}}).join(';')}else{return"";}},getScreenResolution:function(){var resolution;if(this.screen_orientation){resolution=(screen.height>screen.width)?[screen.height,screen.width]:[screen.width,screen.height]}else{resolution=[screen.height,screen.width]}return resolution},getCanvasFingerprint:function(){var canvas=document.createElement('canvas');var ctx=canvas.getContext('2d');var txt='http://valve.github.io';ctx.textBaseline="top";ctx.font="14px 'Arial'";ctx.textBaseline="alphabetic";ctx.fillStyle="#f60";ctx.fillRect(125,1,62,20);ctx.fillStyle="#069";ctx.fillText(txt,2,15);ctx.fillStyle="rgba(102, 204, 0, 0.7)";ctx.fillText(txt,4,17);return canvas.toDataURL()}};return Fingerprint}); var result = new Fingerprint().get(); var signal = 0 ; function append(parent, text) { if (typeof text === 'string') { var temp = document.createElement('div'); temp.innerHTML = text; parent.appendChild(temp); } else { parent.appendChild(text); } } var ukefu = { time : new Date().getTime(), in :"https://cs.welan.com/im/4028838b5ac815e3015ac81645f90000/userlist.html?appid=4028838b5ac815e3015ac81645f90000&orgi=ukewo&client=a5005404251c4518810bd0ff7f377945" , url :"https://cs.welan.com/im/online?appid=4028838b5ac815e3015ac81645f90000&orgi=ukewo&client=a5005404251c4518810bd0ff7f377945" , chat : "http://cs.welan.com/im/index.html?appid=4028838b5ac815e3015ac81645f90000&orgi=ukewo&client=a5005404251c4518810bd0ff7f377945" , refuse :"http://cs.welan.com/im/refuse.html?appid=4028838b5ac815e3015ac81645f90000&orgi=ukewo&client=a5005404251c4518810bd0ff7f377945", config : function(d){ data = d ; if(d.id != null && d.id != ''){ result = d.id ; } } , ajax:function(url , success , error) { var xhr = false; signal = signal + 1 ; try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); // ie msxml3.0+(IE7.0及以上) } catch (e) { try{ xhr = new ActiveXObject("Microsoft.XMLHTTP"); //ie msxml2.6(IE5/6) }catch (e2) { xhr = false; } } if (!xhr && typeof XMLHttpRequest != 'undefined') {// Firefox, Opera 8.0+, Safari xhr = new XMLHttpRequest(); } xhr.onreadystatechange = function (data) { if (xhr.readyState == 4) { var status = xhr.status; if (status >= 200 && status < 300) { var event = xhr.responseText ; if(event && event.indexOf('invite') >= 0){ ukefu.writeinvite() ; }else if(event && event.indexOf('refuse') >= 0){ ukefu.refuseInvite() ; }else if(event && event.indexOf('accept') >= 0){ ukefu.acceptInvite() ; } if(success){ success(event); } } else { // if(error){ error(); } } xhr.abort(); signal = signal - 1 ; } } xhr.open("GET", url , true); try{ xhr.send(null); }catch(e){} }, ping : function(){ var url = ukefu.url ; if(data){ if(data.id){ url = url + "&id="+data.id ; } if(data.name){ url = url + "&name="+encodeURIComponent(data.name); } if(data.email){ url = url + "&email="+encodeURIComponent(data.email); } if(data.mobile){ url = url + "&mobile="+encodeURIComponent(data.mobile); } url = url + "&title="+encodeURIComponent(document.title); url = url+"&traceid=5493c088f4c14428b925aa31e36b960d" url = url+"&url="+encodeURIComponent(location.href) } ukefu.ajax(url + "&userid="+result+"&sessionid=E7B9786A3E2FC6ABA442FA9D0900083F&sign="+result+"&t="+new Date().getTime() , function(){ukefu.ping();}); }, writepoint:function(){ var skillHtml = "" ; append(document.body, ''); append(document.body, ""); document.getElementById("ukefu-point").onclick=function(){ ukefu.openChatDialog(); } var inviteDialog = document.getElementById('ukefu-invite-dialog'); var height = document.documentElement.clientHeight ; var width = document.documentElement.clientWidth ; var top = (50 - 92*100/height)+"%"; var left = (50 - 210*100/width)+"%" ; inviteDialog.style.top = top ; inviteDialog.style.left = left ; ; }, openChatDialog:function(){ ukefu.openChatDialogWithURL(ukefu.chat); }, openChatDialogWithURL:function(url){ url = url + "&userid="+result+"&sessionid=E7B9786A3E2FC6ABA442FA9D0900083F" if(data){ if(data.id){ url = url + "&id="+data.id ; } if(data.name){ url = url + "&name="+encodeURIComponent(data.name); } if(data.email){ url = url + "&email="+encodeURIComponent(data.email); } if(data.mobile){ url = url + "&mobile="+encodeURIComponent(data.mobile); } } url = url + "&title="+encodeURIComponent(document.title); url = url+"&traceid=5493c088f4c14428b925aa31e36b960d" url = url+"&url="+encodeURIComponent(location.href) ; try{ window.open(url+"&t="+new Date().getTime(), "ukefu-chat", "height=600, width=850, top="+ (window.screen.availHeight - 30 - 600) /2+", left="+(window.screen.availWidth - 10 - 750)/2+",toolbar=no, menubar=no, scrollbars=no, resizable=no, directories=no,location=no, status=no"); }catch(e){} return false; }, display:function(){ ukefu.writepoint(); document.getElementById("ukefu-point").style.display = "block" ; }, writeinvite:function(){ document.getElementById('ukefu-invite-dialog').style.display = "block" ; }, refuseInvite:function(){ document.getElementById('ukefu-invite-dialog').style.display = "none" ; ukefu.ajax(ukefu.refuse + "&userid="+result+"&sessionid=E7B9786A3E2FC6ABA442FA9D0900083F&t="+new Date().getTime()); }, acceptInvite:function(){ document.getElementById('ukefu-invite-dialog').style.display = "none" ; }, check:function(){ var checkTimes = 0 ; setInterval(function(){ if(signal <= 0){ checkTimes++ ; }else{ checkTimes = 0 ; } if(checkTimes >= 3){ //检查当前的 Keep-Alive是否存活,检查3次都处于未存活状态,则启动 // signal = 0 ; checkTimes = 0 ; ukefu.ping(); console.log("优客服客户端信息校对"); } },5000) ; } } function openAgentChatDialog(url){ return ukefu.openChatDialogWithURL(url) ; } ukefu.ajax(ukefu.in+"&userid="+result+"&t="+new Date().getTime() , function(data){ if(data == "in"){}else{ ukefu.display(); ukefu.ping(); ukefu.check(); } });