var entranceStyleConfigVO_buttonColor = '#079ed8'; var entranceStyleConfigVO_buttonText = '点我咨询'; var entranceStyleConfigVO_picUrl = 'https://yunwen.kinghangame.com/upload/material/3483/20200513/E99A3E9E04A344EF8C1144564C611A6C.png'; var entranceStyleConfigVO_style = 1; var entranceStyleConfigVO_textColor = '#ffffff'; var entranceStyleConfigVO_type = 1; var entrancePositionConfigVO_position = 6; var entrancePositionConfigVO_longitudinal = 50; var entrancePositionConfigVO_transverse = 50; var windowStyleConfigVO_type = 1; var chat_window_url = 'https://yunwen.kinghangame.com/webchatbot/chat.html?sysNum=1578898069071&sourceId=62139'; var yw_div = document.createElement('div');var yw_chat_window = null;var yw_mask = null;var yw_isDown = false;document.body.appendChild(yw_div);var w_inner_w = window.innerWidth;var w_inner_h = window.innerHeight;var entrancePositionArray = ['', 'left:' + entrancePositionConfigVO_transverse + 'px; top:' + entrancePositionConfigVO_longitudinal + 'px;', 'right:' + entrancePositionConfigVO_transverse + 'px; top:' + entrancePositionConfigVO_longitudinal + 'px;', 'left:' + entrancePositionConfigVO_transverse + 'px; top:' + (w_inner_h / 2 + entrancePositionConfigVO_longitudinal) + 'px;', 'right:' + entrancePositionConfigVO_transverse + 'px; top:' + (w_inner_h / 2 + entrancePositionConfigVO_longitudinal) + 'px;', 'left:' + entrancePositionConfigVO_transverse + 'px; bottom:' + entrancePositionConfigVO_longitudinal + 'px;', 'right:' + entrancePositionConfigVO_transverse + 'px; bottom:' + entrancePositionConfigVO_longitudinal + 'px;'];var textLength = entranceStyleConfigVO_buttonText.length * 20;var entranceStyleTypeArray = ['', { outerStyle: 'width:35px;background:' + entranceStyleConfigVO_buttonColor + ';', imgStyle: 'width:35px;', textStyle: 'width: 13px;padding: 10px;word-break: break-all;text-align: center;display: inline-block;font-size: 14px;color:' + entranceStyleConfigVO_textColor + ';'}, { outerStyle: 'height: 35px;line-height: 35px;background:' + entranceStyleConfigVO_buttonColor + ';', imgStyle: 'height: 30px;vertical-align: middle;', textStyle: 'padding-right:5px;color:' + entranceStyleConfigVO_textColor + ';' }, { outerStyle: 'width:' + textLength + 'px;height:' + textLength + 'px;line-height:' + textLength + 'px;text-align:center;border-radius:50%;background:' + entranceStyleConfigVO_buttonColor + ';', imgStyle: 'display:none;', textStyle: 'color:' + entranceStyleConfigVO_textColor + ';' }, { outerStyle: '', imgStyle: 'display:none;', textStyle: 'color:' + entranceStyleConfigVO_textColor + ';' }];var yw_html = '';if (entranceStyleConfigVO_type == 1) { yw_html = "
" + "
";} else { yw_html = "
" + "
";}yw_div.outerHTML = yw_html;var yw_icon = document.getElementById('yw_icon');yw_icon.src = entranceStyleConfigVO_picUrl;var yw_text = document.getElementById('yw_text');if (yw_text) { yw_text.innerText = entranceStyleConfigVO_buttonText;}var yw_link = document.getElementById('yw_link');function createChatwindowCommon (width, height) { yw_chat_window = document.getElementById('yw_chat_window'); if (yw_chat_window) { if (yw_mask.style.display === 'block') { yw_mask.style.display = 'none'; } else { yw_mask.style.display = 'block'; } } else { yw_mask = document.createElement('div'); document.body.appendChild(yw_mask); yw_mask.outerHTML = '
'; yw_mask = document.getElementById('yw_chat_mask'); yw_chat_window = document.createElement('div'); var windowHtml = "
"; var banner = document.createElement('div'); var bannerHtml = '
' + 'x' + '
'; var iframe = document.createElement('iframe'); var iframeHtml = ""; yw_mask.appendChild(yw_chat_window); yw_chat_window.outerHTML = windowHtml; yw_chat_window = document.getElementById('yw_chat_window'); yw_chat_window.appendChild(banner); banner.outerHTML = bannerHtml; yw_chat_window.appendChild(iframe); iframe.outerHTML = iframeHtml; var yw_chat_close = document.getElementById('yw_chat_close'); yw_chat_close.addEventListener('click', function () { yw_mask.style.display = 'none'; }); }};function createChatwindow3 (width, height) { yw_chat_window = document.getElementById('yw_chat_window'); var dec = ''; var dis = 0; if (entrancePositionConfigVO_position === 1 || entrancePositionConfigVO_position === 3 || entrancePositionConfigVO_position === 5) { dec = 'left'; dis = entrancePositionConfigVO_transverse + 50; } else { dec = 'right'; dis = entrancePositionConfigVO_transverse + 50; } if (yw_chat_window) { if (yw_chat_window.style.width === (width + 'px')) { yw_chat_window.style.width = '0'; } else { yw_chat_window.style.width = width + 'px'; } } else { yw_chat_window = document.createElement('div'); var windowHtml = "
"; var banner = document.createElement('div'); var bannerHtml = '
' + 'x' + '
'; var iframe = document.createElement('iframe'); var iframeHtml = ""; document.body.appendChild(yw_chat_window); yw_chat_window.outerHTML = windowHtml; yw_chat_window = document.getElementById('yw_chat_window'); yw_chat_window.appendChild(banner); banner.outerHTML = bannerHtml; yw_chat_window.appendChild(iframe); iframe.outerHTML = iframeHtml; var yw_chat_close = document.getElementById('yw_chat_close'); yw_chat_close.addEventListener('click', function () { yw_chat_window.style.width = '0'; }); setTimeout(function () { yw_chat_window.style.width = width + 'px'; }, 20); addMoveEvent(); }};function addMoveEvent () { var banner = document.getElementById('yw_chat_banner'); var x = 0; var y = 0; var l = 0; var t = 0; banner.addEventListener('mousedown', function (e) { x = e.clientX; y = e.clientY; l = yw_chat_window.offsetLeft; t = yw_chat_window.offsetTop; yw_isDown = true; banner.style.cursor = 'move'; }); banner.addEventListener('mouseleave', release); window.addEventListener('mousemove', function (e) { if (yw_isDown === false) { return; } var nx = e.clientX; var ny = e.clientY; var nl = nx - (x - l); var nt = ny - (y - t); nl = Math.min(Math.max(0, nl), w_inner_w - yw_chat_window.offsetWidth); nt = Math.min(Math.max(0, nt), w_inner_h - yw_chat_window.offsetHeight); yw_chat_window.style.left = nl + 'px'; yw_chat_window.style.top = nt + 'px'; }); function release () { yw_isDown = false; banner.style.cursor = 'default'; if (yw_chat_window.style.right) { yw_chat_window.style.right = w_inner_w - parseInt(yw_chat_window.style.left) - yw_chat_window.offsetWidth + 'px'; yw_chat_window.style.left = 'inherit'; } }; window.addEventListener('mouseup', release);};switch (windowStyleConfigVO_type) { case 1: case 2: yw_link.href = chat_window_url; break; case 3: yw_link.addEventListener('click', function (e) { e.preventDefault(); createChatwindow3(400, 680); }); break; case 4: yw_link.addEventListener('click', function (e) { e.preventDefault(); createChatwindowCommon(850, 700); }); break; default: break;}window.closeYWChatWindow = function () { if (windowStyleConfigVO_type === 5) { yw_chat_window.style.right = '-400px'; setTimeout(function () { document.body.removeChild(document.getElementById('yw_chat_window')); }, 300); } else { document.body.removeChild(document.getElementById('yw_chat_window')); }}