1const llstyle = document.createElement("link"); 2llstyle.type = "text/css"; 3llstyle.rel = "stylesheet"; 4llstyle.href = "/mstinc/web/linklive/ll_pop.css?v=2"; 5const llcustom = document.createElement("link"); 6llcustom.type = "text/css"; 7llcustom.rel = "stylesheet"; 8llcustom.href = "/ll_custom.css"; 9document.head.append(llstyle); 10if(llstore.custom){ document.head.append(llcustom); } 11 12const source = "https://"+llstore.id+".revation.com/widget/?rev-group="+llstore.id+"&rev-brand="+llstore.id+"&rev-dst-pid="+llstore.group+""; 13const status_source = "https://"+llstore.id+".revation.com/status/js/?im="+llstore.group+"&group="+llstore.id+"&id=statusdiv"; 14let widget = sessionStorage.getItem('widget'); 15 16window.addEventListener('message', function(e) { 17 var eventName = e.data.event; 18 console.log("Event Received : ", eventName); 19 switch(eventName) { 20 case 'pending_msgs': 21 var pendingMsgs = document.getElementById('pendingMsgs'); 22 pendingMsgs.innerText = e.data.pendingMsgs; 23 pendingMsgs.style.display = "inline-block"; 24 break; 25 26 case 'session_initialized': 27 break; 28 29 case 'session_started': 30 sessionStorage.setItem('widget', true); 31 break; 32 33 case 'session_ended': 34 //surfaced once the session has ended 35 console.log("cause : ", e.data.cause); 36 break; 37 38 case 'widget_beforeunload': 39 widget = null; 40 sessionStorage.removeItem('widget'); 41 sessionStorage.removeItem('msgCount'); 42 console.info('purge sessionStorage'); 43 break; 44 45 case 'widget_unload': 46 widget = null; 47 break; 48 } 49}, false); 50 51var rwc_headScripts = new Array; 52function rwc_getStatus() { 53 var script = document.createElement('script'); 54 script.type = 'text/javascript'; 55 script.id = 'rwc_myScript_status'; 56 script.defer = true; 57 script.src = status_source; 58 document.body.appendChild(script); 59} 60 61function rwc_statusUpdated(pid, status, custom, display, group, id) { 62 var obj = document.getElementById(id); 63 var path = ''; 64 if (obj) { 65 switch (status) { 66 case 'busy': 67 path = 'M256 32C114.6 32 0 125.1 0 240c0 49.6 21.4 95 57 130.7C44.5 421.1 2.7 466 2.2 466.5c-2.2 2.3-2.8 5.7-1.5 8.7S4.8 480 8 480c66.3 0 116-31.8 140.6-51.4 32.7 12.3 69 19.4 107.4 19.4 141.4 0 256-93.1 256-208S397.4 32 256 32z'; 68 break; 69 case 'away': 70 path = 'M256 32C114.6 32 0 125.1 0 240c0 49.6 21.4 95 57 130.7C44.5 421.1 2.7 466 2.2 466.5c-2.2 2.3-2.8 5.7-1.5 8.7S4.8 480 8 480c66.3 0 116-31.8 140.6-51.4 32.7 12.3 69 19.4 107.4 19.4 141.4 0 256-93.1 256-208S397.4 32 256 32z'; 71 break; 72 case 'online': 73 path = 'M256 32C114.6 32 0 125.1 0 240c0 49.6 21.4 95 57 130.7C44.5 421.1 2.7 466 2.2 466.5c-2.2 2.3-2.8 5.7-1.5 8.7S4.8 480 8 480c66.3 0 116-31.8 140.6-51.4 32.7 12.3 69 19.4 107.4 19.4 141.4 0 256-93.1 256-208S397.4 32 256 32z'; 74 break; 75 default: 76 path = 'M256 32C114.6 32 0 125.1 0 240c0 49.6 21.4 95 57 130.7C44.5 421.1 2.7 466 2.2 466.5c-2.2 2.3-2.8 5.7-1.5 8.7S4.8 480 8 480c66.3 0 116-31.8 140.6-51.4 32.7 12.3 69 19.4 107.4 19.4 141.4 0 256-93.1 256-208S397.4 32 256 32z'; 77 break; 78 } 79 //if( (await (await fetch( window.location.origin + '/chat/live/branding/avatar/live-agent/link-live/retail/' + diid + '-live-agent-avatar.svg') 80 fetch( window.location.origin + '/diid').then(res=> res.text()).then(data=> { 81 let diid = data.includes("-") ? data.slice(0, -2) : data; 82 let onclick = "ll_pop()"; 83 if(status == "away" || status == "offline"){ 84 onclick = ""; 85 } 86 obj.innerHTML = '<button class="rev-btn '+ status +'" onclick="'+ onclick +'"><img id="agentImg" src="'+ window.location.origin + '/chat/live/branding/avatar/live-agent/link-live/retail/' + diid + '-live-agent-avatar.svg" onerror="this.onerror=null; this.src=\''+ window.location.origin + '/chat/live/branding/avatar/live-agent/link-live/retail/default-live-agent-avatar.svg\'" /><span class="sr-only">Chat '+ status +'</span></button>'; 87 }); 88 } 89} 90 91let ll_pop = () => { 92 if( widget) { 93 console.info("loading active widget"); 94 window.open('', 'RevEngWidget').focus(); 95 } 96 else { 97 console.info("initializing linklive widget"); 98 let vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
99 let vh = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0); 100 let wl = (vw - 350); 101 let wt = (vh - 600)/2; 102 widget = window.open(source, "RevEngWidget", "toolbar=no,scrollbars=no,resizable=no,top="+ wt +",left="+ wl +",width=300,height=600"); 103 } 104 console.info("sessionStorage ", sessionStorage); 105} 106 107const chat = document.createElement('div'); 108chat.setAttribute("class", "chat"); 109const stat = document.createElement('div'); 110stat.setAttribute("id", "statusdiv"); 111chat.appendChild(stat); 112const pmsg = document.createElement('div'); 113pmsg.setAttribute("id", "pendingMsgs"); 114pmsg.setAttribute("class", "rev-pendingMsgs"); 115chat.appendChild(pmsg); 116 117document.body.appendChild(chat); 118 119chat.style.right = llstore.right+"px"; 120chat.style.bottom = llstore.bottom+"px"; 121 122rwc_getStatus(); 123 124window.addEventListener("message", function(e) { 125 var eventName = e.data.event; 126 console.log("Event Received: ", eventName); 127 switch(eventName) { 128 case 'session_ended': 129 console.log("session_ended received"); 130 // document.getElementById('RevEngWidget').classList.toggle('hidden'); 131 // document.getElementById('chatHeader').classList.toggle('hidden'); 132 // wid.src += ''; 133 } 134}); 135const buttons = document.getElementsByClassName('chatButton'); 136 for (let i = 0; i < buttons.length; i++) { 137 buttons[ i ].addEventListener('click', function () { 138 ll_pop(); 139 }); 140}
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.