HEX
Server: Apache/2.4.37 (CentOS Stream) OpenSSL/1.1.1k
System: Linux ysnet.com.tw 4.18.0-553.5.1.el8.x86_64 #1 SMP Tue May 21 05:46:01 UTC 2024 x86_64
User: test (521)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /var/www/test/wp-content/plugins/bit-assist/iframe/bit-assist.js
!function(){"use strict";const t=window?.bit_assist_?.api?.base,i="1"!==window?.bit_assist_?.isDev,e=i?`${t}/iframe`:"http://localhost:5000",o=new URL(e).origin,n=i&&window?.bit_assist_?.api?.separator||"?",s=window?.bit_assist_?.nonce,{protocol:a,host:d,hostname:r,href:c}=window.location,w="http:"===a?"i":"s",l="localhost"===r||"127.0.0.1"===r?d:r,h=c;let p="100px",u="100px",f=0;const b=`\n#bit-assist-widget-container{--ba-top:auto;--ba-left:auto;--ba-bottom:10;--ba-right:10;position:fixed;z-index:2147483646;bottom:0;right:0;width:${u};height:${p};max-width:100%}\n#bit-assist-widget-container.bottom-right{left:var(--ba-left);right:var(--ba-right);top:var(--ba-top);bottom:var(--ba-bottom)}\n#bit-assist-widget-container.bottom-left{left:var(--ba-left);right:var(--ba-right);top:var(--ba-top);bottom:var(--ba-bottom)}\n#bit-assist-widget-container.top-right{left:var(--ba-left);right:var(--ba-right);top:var(--ba-top);bottom:var(--ba-bottom)}\n#bit-assist-widget-container.top-left{left:var(--ba-left);right:var(--ba-right);top:var(--ba-top);bottom:var(--ba-bottom)}\n#bit-assist-widget-iframe{width:100%;height:100%;border:none;}\n.bit-assist-hide{visibility:hidden;pointer-events:none}\n`,g=document.createElement("style");g.appendChild(document.createTextNode(b));const m=document.createElement("div");m.id="bit-assist-widget-container",H();const v=document.createElement("iframe");function y(t,i=!1){const e=window.scrollY,o=document.body.offsetHeight,n=window.innerHeight,s=Math.round(e/(o-n)*100);if(!i)return s;!f&&s>=i?(f=1,A(s)):f&&s<i&&(f=0,A(s))}function A(t){v.contentWindow.postMessage({action:"scrollPercent",scrollPercent:t},o)}function _(t,i){u=`${t}px`,p=`${i}px`,Object.assign(m.style,{width:u,height:p})}v.title="wp-bit-assist",v.src=`${e}${n}clientDomain=${w}-protocol-bit-assist-${l}`,v.id="bit-assist-widget-iframe",v.setAttribute("allowfullscreen",""),v.setAttribute("scrolling","no"),m.appendChild(v),document.body.append(g,m),document.addEventListener("click",t=>{m.classList.contains("bit-assist-open")&&!t.target.closest("#bit-assist-widget-container")&&v.contentWindow.postMessage({action:"clickOutside"},o)}),window.addEventListener("message",i=>{if(i.origin!==o)return;const{action:e}=i.data;if("getClientInfo"===e){const i=y(),e=document.documentElement.offsetWidth,n=window.innerHeight;v.contentWindow.postMessage({action:"windowLoaded",url:h,winWidth:e,winHeight:n,scrollPercent:i,apiEndPoint:t,nonce:s},o)}else if("widgetLoaded"===e){const{height:t,width:e,position:o,top:n,bottom:s,left:a,right:d,pageScroll:r}=i.data;!function(t,i,e,o,n){t.includes("top")&&m.style.setProperty("--ba-top",`${i}px`);t.includes("bottom")&&m.style.setProperty("--ba-bottom",`${e}px`);t.includes("left")&&m.style.setProperty("--ba-left",`${o}px`);t.includes("right")&&m.style.setProperty("--ba-right",`${n}px`)}(o,n,s,a,d),m.classList.remove("bit-assist-hide"),m.classList.add(o),_(e,t),r>0&&window.addEventListener("scroll",t=>y(0,r))}else if("widgetOpen"===e){P()&&!0===Boolean(window.Tawk_API?.isChatMaximized?.())&&window.Tawk_API?.minimize();const{isWidgetOpen:t}=i.data;m.classList.toggle("bit-assist-open",t)}else if("removeWidget"===e)m.remove(),g.remove();else if("resetWidgetSize"===e){const{height:t,width:e}=i.data;_(e,t)}else if("chatWidgetClick"===e){const{chatWidgetName:t}=i.data;!function(t){M(),"tawk"===t&&function(){if(!C)return S("Tawk"),null;try{window.Tawk_API.showWidget(),window.Tawk_API.toggle(),H()}catch(t){console.log(t),S("Tawk"),z()}}();"crisp"===t&&function(){if(!I)return S("Crisp"),null;try{window.$crisp.push(["do","chat:show"]),window.$crisp.push(["do","chat:toggle"]),H()}catch{S("Crisp"),z()}}();"intercom"===t&&function(){if(!L)return S("Intercom"),null;try{window.Intercom("show"),H()}catch(t){console.log(t),S("Intercom"),z()}}();"tidio"===t&&function(){if(!$)return S("Tidio"),null;try{window.tidioChatApi.open(),window.tidioChatApi.show(),H()}catch(t){console.log(t),S("Tidio"),z()}}()}(t)}else if("bitAssistChannelClick"===e){const{channelInfo:t}=i.data;window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"bitAssistChannel",...t})}}),window.addEventListener("load",()=>{P()&&(window.Tawk_API.onLoad=function(){C=!0,window.Tawk_API.hideWidget()},window.Tawk_API.onChatMinimized=function(){window.Tawk_API.hideWidget(),z()}),k()&&(I=!0,window.$crisp.push(["do","chat:hide"]),window.$crisp.push(["on","chat:closed",function(){window.$crisp.push(["do","chat:hide"]),z()}])),T()&&(L=!0,window.Intercom("update",{hide_default_launcher:!0}),window.Intercom("onShow",()=>{H()}),window.Intercom("onHide",()=>{z()})),E()?(window.tidioChatApi.on("ready",x),window.tidioChatApi.on("close",W)):(document.addEventListener("tidioChat-ready",x),document.addEventListener("tidioChat-close",W))});let C=!1,$=!1,I=!1,L=!1;function P(){return"undefined"!=typeof Tawk_API}function k(){return"undefined"!=typeof $crisp}function T(){return"undefined"!=typeof Intercom}function x(){$=!0,window.tidioChatApi.hide()}function W(){z(),window.tidioChatApi.hide()}function E(){return"undefined"!=typeof tidioChatApi}function z(){m.classList.remove("bit-assist-hide"),M()}function M(){P()&&window.Tawk_API?.minimize?.(),k()&&window.$crisp?.push?.(["do","chat:hide"]),T()&&window.Intercom?.("hide"),E()&&window.tidioChatApi?.hide?.()}function H(){m.classList.add("bit-assist-hide")}function S(t){const i="undefined"!=typeof wp&&wp?.i18n?wp.i18n.sprintf(wp.i18n.__("Sorry, %s is not loaded yet!","bit-assist"),t):`Sorry, ${t} is not loaded yet!`;return alert(i)}}();