25 lines
1.9 KiB
JavaScript
25 lines
1.9 KiB
JavaScript
/* WEVAL Chat Fix v4 — No double header */
|
|
(function(){
|
|
var css=document.createElement('style');
|
|
css.id='weval-chat-fix-v4';
|
|
css.textContent='.chat-toggle-btn{bottom:80px!important;right:24px!important;z-index:10001!important;pointer-events:auto!important}.wr-floating-cta{pointer-events:none!important;z-index:9000!important}.wr-floating-cta *{pointer-events:auto!important}.chatbot-fab{display:none!important}@media(max-width:768px){.chat-toggle-btn{bottom:72px!important;right:16px!important}body{overflow-x:hidden!important}}#wevia-chat-overlay{position:fixed;bottom:100px;right:24px;width:400px;height:560px;z-index:10005;border-radius:16px;overflow:hidden;box-shadow:0 10px 40px rgba(0,0,0,.3);display:none;flex-direction:column;background:#0a0f1a}#wevia-chat-overlay.open{display:flex}@media(max-width:768px){#wevia-chat-overlay{bottom:72px;right:0;width:100%;height:calc(100vh - 140px);border-radius:16px 16px 0 0}}';
|
|
document.head.appendChild(css);
|
|
var overlay=document.createElement('div');
|
|
overlay.id='wevia-chat-overlay';
|
|
var closeBtn=document.createElement('button');
|
|
closeBtn.textContent='\u00d7';
|
|
closeBtn.style.cssText='position:absolute;top:8px;right:12px;background:rgba(0,0,0,0.5);border:none;color:#fff;font-size:22px;cursor:pointer;z-index:10;width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center';
|
|
closeBtn.onclick=function(){overlay.classList.remove('open')};
|
|
var ifr=document.createElement('iframe');
|
|
ifr.src='/wevia-widget.html';
|
|
ifr.style.cssText='width:100%;height:100%;border:none;background:#0a0f1a';
|
|
overlay.appendChild(closeBtn);
|
|
overlay.appendChild(ifr);
|
|
document.body.appendChild(overlay);
|
|
function attach(){
|
|
var btn=document.querySelector('.chat-toggle-btn');
|
|
if(btn&&!btn._wvFix){btn._wvFix=true;btn.addEventListener('click',function(e){e.preventDefault();e.stopPropagation();overlay.classList.toggle('open')},true)}
|
|
}
|
|
attach();setInterval(attach,500);
|
|
})();
|