function CreateWhatsappChatWidget(option = { brandSetting: { autoShow: true, backgroundColor: "#0a6114", borderRadius: "25", brandImg: "", siteadi:"UzmanDil", brandImgData: null, brandName: "UzmanDil", brandSubTitle: "Online", ctaText: "Sohbete Başla", welcomeText: "Merhaba, bir sorum var, yardımcı olur musunuz?", messageText: "", phoneNumber: "+905468550715" }, chatButtonSetting: { backgroundColor: "#4dc247", borderRadius: "25", ctaText: "", marginLeft: "0", marginRight: "20", marginBottom: "20", position: "right" }, enabled: false }) { if (option.enabled == false) { return; } if (!option.chatButtonSetting.position) { option.chatButtonSetting.position = "right"; option.chatButtonSetting.marginBottom = "30"; option.chatButtonSetting.marginLeft = "0"; option.chatButtonSetting.marginRight = "0"; } var css = document.createElement("STYLE"); if (window.jQuery) { initWidget(); } else { var script = document.createElement("SCRIPT"); script.src = 'https://theme.uzmandil.com/all/jss/chatter/jquery.js'; script.type = 'text/javascript'; script.onload = function () { initWidget(); }; document.getElementsByTagName("head")[0].appendChild(script); } function initWidget() { if (option.brandSetting.messageText) { option.brandSetting.messageText = option.brandSetting.messageText.replaceAll("{{page_link}}", encodeURIComponent(window.location.href)); option.brandSetting.messageText = option.brandSetting.messageText.replaceAll("{{page_title}}", window.document.title); option.brandSetting.messageText = option.brandSetting.messageText.replaceAll("\n", "%0A"); } jQuery('body').append(`
${option.chatButtonSetting.ctaText}
`); jQuery('#whatsapp_chat_widget').append(`
Merhaba, bilgi alabilir miyim?
%100 Başarı garantisi nedir?
Lütfen! beni arar mısınız?
`); if (option.brandSetting.autoShow) { function openChatter(){ jQuery(".wa-chat-box").css("display", "block"); clearTimeout(myTimeout); } const myTimeout = setTimeout(openChatter, 6000); } else { jQuery(".wa-chat-box").css("display", "none"); } jQuery("#whatsapp_chat_widget").on('click', '.wa-chat-bubble-close-btn', function () { jQuery(".wa-chat-box").css("display", "none"); }) jQuery("#whatsapp_chat_widget").on('click', '#wa-widget-send-button', function () { jQuery(".wa-chat-box").css("display", "block"); }) } function sendRequest(type, url, callback) { var xhr = new XMLHttpRequest(); xhr.open(type, encodeURI(url), true); xhr.send(); xhr.onreadystatechange = function () { if (xhr.readyState === 4 && xhr.status === 200) { callback && callback() } }; } var styles = ` .button_edf6{ background: #fff; border-radius: 20px!important; box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 0 6px -2px rgba(0,0,0,.05); color: rgba(0,0,0,.87); cursor: pointer; display: inline-block; font-size: 15px!important; line-height: 19.6px; margin-bottom: 6px; margin-left: 8px; max-width: 98%; min-height: 24px; overflow: hidden; padding: 8px 16px; position: relative; text-align: right; text-overflow: ellipsis; -webkit-user-select: text; -moz-user-select: text; user-select: text; white-space: pre; } .button_edf6:hover{background:linear-gradient(315deg,#12a730,#36df57);box-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 0 6px -2px rgba(0,0,0,.05);color:#fff} .__green_ea92{ box-shadow: 0 10px 15px -3px rgba(0,0,0,.1), 0 0 6px -2px rgba(0,0,0,.05), inset 0 0 0 1px #12a730; color: #12a730; } #whatsapp_chat_widget{ display: ${option.enabled ? "block" : "none"} } .wa-chat-box-content-send-btn-text{ margin-left: 8px; margin-right: 8px; z-index: 1; color: rgb(255, 255, 255); } .wa-chat-box-content-send-btn-icon{ width: 16px; height: 16px; fill: rgb(255, 255, 255); z-index: 1; flex: 0 0 16px; } .wa-chat-box-content-send-btn{ text-decoration: none; color: rgb(255, 255, 255); font-size: 15px; font-weight: 700; line-height: 20px; cursor: pointer; position: relative; display: flex; -webkit-box-pack: center; justify-content: center; -webkit-box-align: center; align-items: center; -webkit-appearance: none; padding: 8px 12px; border-radius: ${option.brandSetting.borderRadius}px; border-width: initial; border-style: none; border-color: initial; border-image: initial; background-color: ${option.chatButtonSetting.backgroundColor}; margin: 20px; overflow: hidden; } .wa-chat-box-send{ background-color:white; } .wa-chat-box-content-chat-brand{ font-size: 13px; font-weight: 700; line-height: 18px; color: rgba(0, 0, 0, 0.4); } .wa-chat-box-content-chat-welcome{ font-size: 14px; line-height: 19px; margin-top: 4px; color: rgb(17, 17, 17); } .wa-chat-box-content-chat{ background-color: white; display: inline-block; margin: 20px; padding: 10px; border-radius: 10px; } .wa-chat-box-content{ background: url('https://theme.uzmandil.com/all/jss/chatter/bg.png'); } .wa-chat-bubble-close-btn{ cursor: pointer; position: absolute; right: 20px; top: 20px; } .wa-chat-box-brand-text{ margin-left: 20px; } .wa-chat-box-brand-name{ font-size: 16px; font-weight: 700; line-height: 20px; } .wa-chat-box-brand-subtitle{ font-size: 13px; line-height: 18px; margin-top: 4px; } .wa-chat-box-header{ height: 100px; max-height: 100px; min-height: 100px; background-color: ${option.brandSetting.backgroundColor}; color: white; border-radius: 10px 10px 0px 0px; display:flex; align-items: center; } .wa-chat-box-brand{ margin-left: 20px; width: 50px; height: 50px; border-radius: 25px; box-shadow: 2px 2px 6px rgba(0,0,0,0.4); } .wa-chat-box{ background-color:white; z-index: 16000160 !important; margin-bottom: 60px; width: 360px; position: fixed !important; bottom: ${option.chatButtonSetting.marginBottom}px !important; ${option.chatButtonSetting.position == "left" ? "left : " + option.chatButtonSetting.marginLeft + "px" : "right : " + option.chatButtonSetting.marginRight + "px"}; border-radius: 10px; box-shadow: 2px 2px 6px rgba(0,0,0,0.4); font: 400 normal 15px/1.3 -apple-system, BlinkMacSystemFont, Roboto, Open Sans, Helvetica Neue, sans-serif; } #wa-widget-send-button { margin: 0 0 ${option.chatButtonSetting.marginBottom}px 0 !important; padding-left: ${option.chatButtonSetting.ctaText ? "15px" : "0px"}; padding-right: ${option.chatButtonSetting.ctaText ? "15px" : "0px"}; position: fixed !important; z-index: 16000160 !important; bottom: 0 !important; text-align: center !important; height: 40px; min-width: 40px; border-radius: ${option.chatButtonSetting.borderRadius}px; visibility: visible; transition: none !important; background-color: ${option.chatButtonSetting.backgroundColor}; box-shadow: 2px 2px 6px rgba(0,0,0,0.4); ${option.chatButtonSetting.position == "left" ? "left : " + option.chatButtonSetting.marginLeft + "px" : "right : " + option.chatButtonSetting.marginRight + "px"}; cursor: pointer; display: flex; align-items: center; justify-content:center; } .wa-messenger-svg-whatsapp{ fill: white; width: 31px; height: 40px; stroke: none; } .wa-chat-box-poweredby{ text-align: center; font: 400 normal 15px/1.3 -apple-system, BlinkMacSystemFont, Roboto, Open Sans, Helvetica Neue, sans-serif; margin-bottom: 15px; margin-top: -10px; font-style: italic; font-size: 12px; color: lightgray; } @media only screen and (max-width: 600px) { .wa-chat-box { width: auto; position: fixed !important; right: 20px!important; left: 20px!important; } } ` var styleSheet = document.createElement("style") styleSheet.type = "text/css" styleSheet.innerText = styles document.getElementsByTagName("head")[0].appendChild(styleSheet); }