var ASSET_DIR = 'https://w.cokhach.com' ; function addWidget(){ addCSS('//w.cokhach.com/assets/css/slickModal.min.css'); addCSS('//w.cokhach.com/assets/css/style.css'); setTimeout(function(){addJs('//w.cokhach.com/assets/js/slickModal.min.js');},500); setTimeout(function(){addJs('//w.cokhach.com/assets/v1/plugin/js/jquery.slickmodal.min.js');},1000); /* if (window.jQuery){ addJs('//w.cokhach.com/assets/js/slickModal.min.js'); }{ setTimeout(function(){addJs('//w.cokhach.com/assets/js/slickModal.min.js');},500); } */ addCSS('//w.cokhach.com/assets/v1/plugin/css/slickmodal.min.css'); // console.log('1111: ', jQuery().jquery); if (window.jQuery){ addJs('//w.cokhach.com/assets/v1/plugin/js/jquery.slickmodal.min.js'); } else { setTimeout(function(){addJs('//w.cokhach.com/assets/v1/plugin/js/jquery.slickmodal.min.js');},1000); } } addWidget(); // Include CSS file function addCSS(filename){ var head = document.getElementsByTagName('head')[0]; var style = document.createElement('link'); style.href = filename; style.type = 'text/css'; style.rel = 'stylesheet'; head.append(style); } function addJs(filename){ var a = document.createElement("script"); a.src = filename; a.type = "text/javascript"; var head = document.getElementsByTagName('head')[0]; head.appendChild(a); } addCSS("//w.cokhach.com/assets/widgets/nutgoidienthoai/style-new.css"); function waitingJqueryLoadedNutGoiDienThoai(){ if (window.jQuery && typeof window.jQuery.fn.slickModals !== 'undefined') { JsCoKhachNutGoiDienThoai(); }else{ setTimeout(waitingJqueryLoadedNutGoiDienThoai,500); } } waitingJqueryLoadedNutGoiDienThoai(); function JsCoKhachNutGoiDienThoai(){ jQuery(document).ready(function($){ $("body").append('
Bấm để gọi hỗ trợ - 0123456789
Bấm để gọi hỗ trợ - 0123456789
'); function popupCoKhachNutGoiDienThoai(){ $(".cokhach-PopupConntroller").show(); $('#popupNutGoiDienThoai').slickModals({ overlayVisible: true, overlayClosesModal: true, overlayColor: 'rgba(0,0,0,0.8)', overlayAnimationDuration: '0.3', popupWidth: '560px', popupHeight: '320px', popupLocation: 'center', popupAnimationDuration: '0.8', popupAnimationEffect: 'slideTop', popupBackground: "rgba(255,255,255,1)", popupRadius: '0', popupMargin: '0', popupPadding: '0', addCloseButton: true, buttonStyle: 'tag', enableESC: true, reopenClass: 'openModalNutGoiDienThoai', }); } popupCoKhachNutGoiDienThoai(); $(".cokhach-submit").click(function(){ $(".popup-cokhach-open").hide(); $(".popup-cokhach-finish").fadeIn(); setTimeout(function () {$('.closeModal').click();}, 4000); }); $(".slickForm").submit(function(e){ e.preventDefault(); }); }); } window.addEventListener('message', function(event) { if (event){ if (event.data =="hidePopupContent"){ $("#popupNutGoiDienThoai").removeClass('isActive'); }else if (event.data =="showPopupContent"){ $("#popupNutGoiDienThoai").addClass('isActive'); $(".popup-cokhach-open").show(); $(".popup-cokhach-finish").hide(); }else if (event.data =="showPopupEnd"){ $("#popupNutGoiDienThoai").addClass('isActive'); $(".popup-cokhach-open").hide(); $(".popup-cokhach-finish").show(); } } }); var demo_stage = '' ; addJs("//w.cokhach.com/assets/widgets/hoikhithoattrang/js/ouibounce.min.js"); function waitingJqueryLoadedHoiKhiThoatTrang(){ if (window.jQuery && typeof window.jQuery.fn.slickModals !== 'undefined') { JsCoKhachHoiKhiThoatTrang(); }else{ setTimeout(waitingJqueryLoadedHoiKhiThoatTrang,500); } } waitingJqueryLoadedHoiKhiThoatTrang(); function JsCoKhachHoiKhiThoatTrang(){ jQuery(document).ready(function($){ $("body").append(''); $(".cokhach-PopupConntroller").show(); function loadExitPageFun(){ var _ouibounce = ouibounce(document.getElementById('popupHoiKhiThoatTrang'), { aggressive: true, timer: 0, callback: function() {$("#popupHoiKhiThoatTrang").addClass('isActive'); } }); } function popupCoKhachHoiKhiThoatTrang(){ $('#popupHoiKhiThoatTrang').slickModals({ popupType: 'exit', // "exit" delayTime: 1000, overlayVisible: true, overlayClosesModal: true, // true overlayColor: 'rgba(0,0,0,0.8)', overlayAnimationDuration: '0.3', popupWidth: '560px', popupHeight: '320px', popupLocation: 'center', popupAnimationDuration: '0.4', popupAnimationEffect: 'slideTop', popupBackground: "rgba(255,255,255,1)", popupRadius: '0', popupMargin: '0', popupPadding: '0', addCloseButton: true, // true buttonStyle: 'tag', enableESC: true, // true }); } loadExitPageFun(); $(".cokhach-submit").click(function(){ $(".popup-cokhach-open").hide(); $(".popup-cokhach-finish").fadeIn(); setTimeout(function () {$('.closeModal').click();}, 4000); }); $(".slickForm").submit(function(e){ e.preventDefault(); }); // set time to show if(getCookie('times_to_show') == null) { setCookie('times_to_show',5,1); } if(getCookie('current_date') == null) { var date = new Date(); setCookie('current_date',date); } var oldDate = new Date(getCookie('current_date')); var t1 = oldDate.getUTCDate() + "/" + (oldDate.getUTCMonth() + 1) + "/" + oldDate.getUTCFullYear(); ; var currentDate = new Date(); var t2 = currentDate.getUTCDate() + "/" + (currentDate.getUTCMonth() + 1) + "/" + currentDate.getUTCFullYear() var t3 = 0; if(t1 == t2) { t3 = getCookie('times_to_show') - 1; setCookie('times_to_show',t3,1); } else { setCookie('times_to_show',5,1); var date = new Date(); setCookie('current_date',date); t3 = getCookie('times_to_show'); //setCookie('times_to_show',t3,1); } if(t3 > 0 ) popupCoKhachHoiKhiThoatTrang(); if(demo_stage) popupCoKhachHoiKhiThoatTrang(); // end set time to show function setCookie(name,value,days) { var expires = ""; if (days) { var date = new Date(); date.setTime(date.getTime() + (days*24*60*60*1000)); expires = "; expires=" + date.toUTCString(); } document.cookie = name + "=" + (value || "") + expires + "; path=/"; } function getCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function eraseCookie(name) { document.cookie = name+'=; Max-Age=-99999999;'; } }); } window.addEventListener('message', function(event) { if (event){ if (event.data =="hidePopupContent"){ $("#popupHoiKhiThoatTrang").removeClass('isActive'); }else if (event.data =="showPopupContent"){ $("#popupHoiKhiThoatTrang").addClass('isActive'); $(".popup-cokhach-open").show(); $(".popup-cokhach-finish").hide(); }else if (event.data =="showPopupEnd"){ $("#popupHoiKhiThoatTrang").addClass('isActive'); $(".popup-cokhach-open").hide(); $(".popup-cokhach-finish").show(); } } });