PageSourceSearch

https://im.tongtool.com/im-service/chat/im.min.js

js tongtool.com collected 2026-10-03 19:21:31 UTC 7,180 bytes, 1 lines download raw bytes

1(()=>{const e="width=860,height=720,top=200,left=600,titlebar=no,menubar=no,scrollbars=no,location=no,fullscreen=yes,toolbar=no",t=["1","2","3","4","6","7","8"],n="/im-service/index.html#/chat";let o="/im-service/chat/im.css?v=1.0.2",i=n,s=o;const c="tms-im-class-top";var a;function l(e){let t="?";for(let n in e)"role"===n||"memberName"===n?t+=n+"="+encodeURI(encodeURI(e[n]))+"&":e[n]&&(t+=n+"="+e[n]+"&");return t.slice(0,-1)}function r(e,t,n){var o;o=window.open(e,t,n);try{"about:blank"===o.location.href?o=window.open(e,t,n):o.focus()}catch(e){o.focus()}return o}function d(e){return new Promise((t=>{let n=document.createElement("script");n.type="text/javascript",n.readyState?n.onreadystatechange=function(){"loaded"!=n.readyState&&"complete"!=n.readyState||(n.onreadystatechange=null,t(!0))}:n.onload=function(){t(!0)},n.src=e,document.getElementsByTagName("head")[0].appendChild(n)}))}function m(e,t){return e.className.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}window.tmsIm=function(v){if(!v.projectCode)return void console.error("projectCode必填");const h=["dev","test","uat","pro","local"];if(v.serviceUrl)a=v.serviceUrl;else{if(!v.env||!h.includes(v.env))return void console.error("env 必填,可选值为dev,test,pro");!function(e){switch(i=n,s=o,e){case"local":a="https://localhost:8167",s="/chat/im.css?v=1.0.1",i="/index.html#/chat";break;case"dev":a="https://tms-dev1.pvt.tongtool.com";break;case"test":a="https://tms-test.pvt.tongtool.com";break;case"uat":a="https://tms-uat.pvt.tongtool.com";break;case"pro":a="https://im.tongtool.com"}}(v.env)}if(!t.includes(v.projectCode))return void console.error("projectCode error");const f="3"===v.projectCode;var y,w,b=!0,S=null,E=Date.now(),C=null;Promise.all([(w=a+s,new Promise((e=>{let t=document.createElement("link");t.rel="stylesheet",t.type="text/css",t.readyState?t.onreadystatechange=function(){"loaded"!=t.readyState&&"complete"!=t.readyState||(t.onreadystatechange=null,e(!0))}:t.onload=function(){e(!0)},t.href=w,document.getElementsByTagName("head")[0].appendChild(t)}))),d(a+"/im-service/chat/socket.io.min.js"),d(a+"/im-service/chat/iife.min.js")]).then((t=>{var n=FingerprintJS.load();let o=document.querySelector(".tms-im");o&&o.remove();let s=document.createElement("div"),d=document.createElement("img");s.className="tms-im tms-im-shadow",d.setAttribute("width",f?"17px":"15px"),d.setAttribute("src",a+"/im-service/chat/sm.svg"),s.appendChild(d);let h=document.createElement("span");h.className=f?"text-full":"text",h.innerText="在线客服",s.appendChild(h);let w=localStorage.getItem(c);
1w&&(isNaN(parseInt(w))||(s.style.top=window.innerHeight<parseInt(w)+s.clientHeight?window.innerHeight/2+"px":parseInt(w)+"px"));let N=document.createElement("span");N.className="tms-im-count-h",N.innerText="",s.appendChild(N),document.body.appendChild(s);let T=v.touristId||"";n.then((e=>e.get())).then((t=>{let n=v.memberId?1:3,o=Object.assign({visitorId:t.visitorId+T,memberType:n,lineType:1,url:window.location.href},v);function s(){const e=Math.floor(6e4*Math.random())+6e4;C=setTimeout((()=>{y.connected||(console.log("check --- connection",g()),y.connect()),s()}),e)}(y=io(a+"/tongtool",{reconnectionDelayMax:1e4,query:o,transports:["websocket"],path:"/im-socketio-service"})).on("systemMessage",(e=>{if(console.log(e),e)if(6===e.messageResponseBo.type){if(E=Date.now(),e.messageResponseBo.body&&e.messageResponseBo.body>0){m(t=document.querySelector(".tms-im-count-h"),"tms-im-count")||(t.className+=" tms-im-count")}else!function(e,t){if(m(e,t)){var n=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ")}}(document.querySelector(".tms-im-count-h"),"tms-im-count"),document.querySelector(".tms-im-count-h").innerHTML="";e.messageResponseBo.windowJitterNum&&e.messageResponseBo.windowJitterNum>0&&(p.show(y,o),u("客服消息提醒","客服向您发送了一条消息提醒,请点击右下角客服图标查看。","im-dou")),clearTimeout(S),b&&(console.log("关闭"),S=setTimeout((()=>{y.disconnect()}),6e3))}else 21===e.messageResponseBo.type?(console.log("调用disconnect"),y.disconnect()):e.messageResponseBo.type;var t})),window._imOpen=function(){r(a+i+l(v),"imChat",e)},function(t,n,o){let s=null,d=0;t.onmousedown=function(m){(m=m||window.event).stopPropagation();let u=m.clientY-t.offsetTop;void 0!==t.setCapture&&t.setCapture(),d=(new Date).getTime(),o&&o(),s=setTimeout((()=>{r(a+i+l(n),"imChat",e)}),200),document.onmousemove=function(e){if((new Date).getTime()-d>100){e=e||window.event,clearTimeout(s);let n=e.clientY-u;n<0?n=0:n>window.innerHeight-t.offsetHeight&&(n=window.innerHeight-t.offsetHeight),t.style.top=n+"px",localStorage.setItem(c,n)}},document.onmouseup=function(e){this.onmousemove=null,this.onmouseup=null,void 0!==t.releaseCapture&&t.releaseCapture()}}}(document.getElementsByClassName("tms-im")[0],o,(()=>{b=!1,y.connect()})),s(),document.addEventListener("visibilitychange",(()=>{"visible"===document.visibilityState?(clearTimeout(C),y.connected||(console.log("visible -- connection",g()),y.connect()),s()):clearTimeout(C)}))})),setInterval((()=>{Date.now()-E>36e5&&y.connected&&y.disconnect()}),5e3)}))};const u=async(e,t,n,o)=>{if(!("Notification"in window))return console.log("该浏览器不支持桌面通知"),!1;if(await Notification.requestPermission()){let i=new Notification(e,{body:t,tag:n,requireInteraction:!0});o&&i.addEventListener("click",o)}},p=function(){let e=null,t=null,n=null;function o(){e&&e.classList.remove("active"),t.connected&&t.connect(),t.emit("addMessage",{type:38,body:n})}function i(){o()}function s(){o()}function c(t){t.target===e&&o()}function a(t){"Escape"===t.key&&e&&e.classList.contains("active")&&o()}return{show:function(o,l){t=o,e||(document.body.insertAdjacentHTML("beforeend",'\n            <div id="im-dialogOverlay" class="dialog-overlay">\n                <div class="dialog-box">\n                    <div class="dialog-header">\n                        <span class="dialog-title">客服消息提醒</span>\n                        <button id="im-closeBtn" class="close-btn">✕</button>\n                    </div>\n                    <div class="dialog-content">\n                        <p>客服向您发送了一条消息提醒,请点击右下角客服图标查看。</p>\n                    </div>\n                    <div class="dialog-footer">\n                        <button id="im-confirmBtn" class="confirm-btn">关闭</button>\n                    </div>\n                </div>\n            </div>\n        '),e=document.getElementById("im-dialogOverlay"),function(){const t=document.getElementById("im-closeBtn"),n=document.getElementById("im-confirmBtn");
1t.addEventListener("click",i),n.addEventListener("click",s),e.addEventListener("click",c),document.addEventListener("keydown",a)}()),n=l,e.classList.add("active")},close:o}}();function g(){var e=new Date;const t={YYYY:e.getFullYear(),MM:String(e.getMonth()+1).padStart(2,"0"),DD:String(e.getDate()).padStart(2,"0"),HH:String(e.getHours()).padStart(2,"0"),mm:String(e.getMinutes()).padStart(2,"0"),ss:String(e.getSeconds()).padStart(2,"0")};return"YYYY-MM-DD HH:mm:ss".replace(/YYYY|MM|DD|HH|mm|ss/g,(e=>t[e]))}})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.