var urlOrigen = btoa(document.location.host); var base_url_wolkvox = "https://chat01.ipdialbox.com/chat/"; var oriChatwolkvox = "https://chat01.ipdialbox.com/"; var operation = "Y29vbWV2YS1jYWMuMjA3="; var sizeboton = "l"; var sizechat = "m"; var fullscreen = "0"; var icoboton = "question_answer"; var fondoboton = "0"; var idConfig = "207"; var txt1 = ""; var txt2 = ""; var txt3 = ""; var txt4 = ""; var txt5 = ""; var txt6 = ""; var context = ""; var heightIniChatWolkvox = ''; var widthIniChatWolkvox = ''; switch(sizeboton){ case "l": heightIniChatWolkvox = '73px'; widthIniChatWolkvox = '75px'; break; case "m": heightIniChatWolkvox = '55px'; widthIniChatWolkvox = '60px'; break; case "s": heightIniChatWolkvox = '45px'; widthIniChatWolkvox = '50px'; break; case "custom": heightIniChatWolkvox = "120px"; widthIniChatWolkvox = "120px"; break; } var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent"; var eventer = window[eventMethod]; var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message"; eventer(messageEvent, function(e) { try { if (e.data.indexOf('resize::') != -1) { var height = e.data.replace('resize::', ''); height = height.split("||"); document.getElementById('frameChatWolkvox').style.height = height[0].indexOf("%") != -1 ? height[0] : height[0] + 'px'; document.getElementById('frameChatWolkvox').style.width = height[1].indexOf("%") != -1 ? height[1] : height[1] + 'px'; document.getElementById('frameChatWolkvox').style.right = height[0].indexOf("%") != -1 ? "0%" : height[2]; document.getElementById('frameChatWolkvox').style.bottom = height[3]; } if (e.data.indexOf('start') != -1) { init(); } } catch(excep) { // console.log("excep",excep); } }, false); var urlFrame = base_url_wolkvox+'iframe.php?prodId='+operation var iframe = document.createElement('IFRAME'); iframe.setAttribute('id', 'frameChatWolkvox'); iframe.setAttribute('name', 'frameChatWolkvox'); iframe.setAttribute('name', 'frameChatWolkvox'); iframe.setAttribute('allow', 'geolocation; microphone; camera; midi; encrypted-media;'); iframe.setAttribute('allowtransparency', 'true'); iframe.setAttribute('frameBorder', '0'); iframe.setAttribute('src', urlFrame); iframe.setAttribute('style', 'height: '+heightIniChatWolkvox+';width:'+widthIniChatWolkvox+';position: fixed;right: 1%;bottom: 1%;z-index: 2009;overflow: hidden;'); document.children[0].appendChild(iframe); /* create in page original */ // document.children[0].children[1].appendChild(iframe); function init(){ var data = { "urlOrigen": urlOrigen, "sizeboton": sizeboton, "sizechat": sizechat, "fullscreen": fullscreen, "idConfig": idConfig, "txt1": txt1, "txt2": txt2, "txt3": txt3, "txt4": txt4, "txt5": txt5, "txt6": txt6, "context": context, }; if (navigator.vendor != "") { document.frameChatWolkvox.postMessage(btoa(JSON.stringify(data)),"*"); } else { window.frameChatWolkvox.postMessage(btoa(JSON.stringify(data)),"*"); } }