Floating Chat Widget: Contact Chat Icons, Telegram Chat, Line, WeChat, Email, SMS, Call Button – Chaty - Version 2.6.6

Version Description

Triggers and devices selection bug fixed for the mobile chat buttons

Download this release

Release Info

Developer galdub
Plugin Icon wp plugin Floating Chat Widget: Contact Chat Icons, Telegram Chat, Line, WeChat, Email, SMS, Call Button – Chaty
Version 2.6.6
Comparing to
See all releases

Code changes from version 2.6.5 to 2.6.6

admin/assets/js/cht-scripts.js CHANGED
@@ -23,20 +23,20 @@ jQuery( function($) {
23
  var phoneNumberStatus = false;
24
  function checkForDevices() {
25
  $(".chaty-popup").hide();
26
- if($("#cht-form .js-chanel-desktop").length == 0 || $("#cht-form .js-chanel-desktop").length == 0) {
27
  $("#no-device-popup").show();
28
  return false;
29
- } else if($("#cht-form .js-chanel-desktop:checked").length == 0 && $("#cht-form .js-chanel-desktop:checked").length == 0) {
30
  $("#device-popup").show();
31
  return false;
32
  } else {
33
  var inputError = 0;
34
- $("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").each(function(){
35
  if(jQuery.trim($(this).val()) == "") {
36
  inputError++;
37
  }
38
  });
39
- if(inputError == $("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").length) {
40
  $("#no-device-value").show();
41
  return false;
42
  }
@@ -46,7 +46,7 @@ jQuery( function($) {
46
 
47
  function checkForTriggers() {
48
  $(".chaty-popup").hide();
49
- if(!$("#trigger_on_time").is(":checked") && !$("#chaty_trigger_on_scroll").is(":checked")) {
50
  $("#trigger-popup").show();
51
  return false;
52
  }
23
  var phoneNumberStatus = false;
24
  function checkForDevices() {
25
  $(".chaty-popup").hide();
26
+ if($("#cht-form .js-chanel-desktop").length == 0 || $("#cht-form .js-chanel-mobile").length == 0) {
27
  $("#no-device-popup").show();
28
  return false;
29
+ } else if($("#cht-form .js-chanel-desktop:checked").length == 0 && $("#cht-form .js-chanel-mobile:checked").length == 0) {
30
  $("#device-popup").show();
31
  return false;
32
  } else {
33
  var inputError = 0;
34
+ $("#channels-selected-list > li:not(#chaty-social-close)").find(".channels__input").each(function(){
35
  if(jQuery.trim($(this).val()) == "") {
36
  inputError++;
37
  }
38
  });
39
+ if(inputError == $("#channels-selected-list > li:not(#chaty-social-close)").find(".channels__input").length) {
40
  $("#no-device-value").show();
41
  return false;
42
  }
46
 
47
  function checkForTriggers() {
48
  $(".chaty-popup").hide();
49
+ if(!$("#trigger_on_time").is(":checked") && !$("#chaty_trigger_on_exit").is(":checked") && !$("#chaty_trigger_on_scroll").is(":checked")) {
50
  $("#trigger-popup").show();
51
  return false;
52
  }
admin/assets/js/cht-scripts.min.js CHANGED
@@ -1 +1 @@
1
- function check_for_number_chaty(e,t){return!(""==e||("+"==e[0]&&(e=e.substr(1,e.length)),"Phone"==t&&"*"==e[0]&&(e=e.substr(1,e.length)),!isNaN(e)))}function check_for_preview_pos(){if(jQuery(".chaty-setting-form").length)if(jQuery(window).width()>1179){var e=parseInt(jQuery(".chaty-setting-form").offset().top);jQuery(".btn-save-sticky, .chaty-sticky-buttons").css("top",e+58),jQuery(".preview").css("top",e+18),jQuery(".btn-help").css("top",e+58+145),jQuery("a.remove-chaty-widget-sticky").css("top",e+58+145+119)}else jQuery(".btn-save-sticky, .chaty-sticky-buttons").attr("style",""),jQuery(".preview").attr("style",""),jQuery(".btn-help").attr("style",""),jQuery("a.remove-chaty-widget-sticky").attr("style","");if(jQuery("#scroll-to-item").length&&jQuery("#admin-preview").length&&((e=jQuery("body").hasClass("has-premio-box")?jQuery("#scroll-to-item").offset().top-jQuery(window).scrollTop()-625:jQuery("#scroll-to-item").offset().top-jQuery(window).scrollTop()-485)<0?(e=Math.abs(e),jQuery("#admin-preview").css("margin-top",-1*e+"px")):jQuery("#admin-preview").css("margin-top","0")),jQuery(window).height()<=1180){var t=285;jQuery(window).width()<=600&&(t=310),jQuery(".chaty-sticky-buttons").css("top",jQuery(window).height()/2-t/2+"px")}}jQuery(function(e){"use strict";var t=!1,a=!1,o=!1,c=!1,i=!1,n=!1,s=!1;function r(){if(e(".chaty-popup").hide(),0==e("#cht-form .js-chanel-desktop").length||0==e("#cht-form .js-chanel-desktop").length)return e("#no-device-popup").show(),!1;if(0==e("#cht-form .js-chanel-desktop:checked").length&&0==e("#cht-form .js-chanel-desktop:checked").length)return e("#device-popup").show(),!1;var t=0;return e("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").each(function(){""==jQuery.trim(e(this).val())&&t++}),t==e("#channels-selected-list > li:not(#chaty-social-close").find(".channels__input").length?(e("#no-device-value").show(),!1):l()}function l(){return e(".chaty-popup").hide(),e("#trigger_on_time").is(":checked")||e("#chaty_trigger_on_scroll").is(":checked")?u():(e("#trigger-popup").show(),!1)}function u(){return e(".chaty-popup").hide(),e(".cht_active").is(":checked")?(t=!0,e("#cht-form").trigger("submit"),!0):(e("#status-popup").show(),!1)}function h(){if(a){if(o){if(c){if(i){if(n)s||(s=!0,e("#channels-selected-list .phone-number").length&&e("#channels-selected-list .phone-number").each(function(){if(""!=jQuery.trim(e(this).val())&&jQuery.trim(e(this).val()).length>13)return e("#custom-message-popup .chaty-popup-header").text(e(this).data("label")+" number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the "+e(this).data("label")+" number you're trying to enter isn't valid. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1}));else if(n=!0,e("#cht-form #Viber").length&&""!=e("#cht-form #Viber").val()){t=jQuery.trim(e("#cht-form #Viber").val());if(check_for_number_chaty(t,"Viber"))return e("#custom-message-popup .chaty-popup-header").text("Viber number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the Viber number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1}}else if(i=!0,e("#cht-form #SMS").length&&""!=e("#cht-form #SMS").val()){t=jQuery.trim(e("#cht-form #SMS").val());if(check_for_number_chaty(t,"SMS"))return e("#custom-message-popup .chaty-popup-header").text("SMS number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the SMS number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1}}else if(c=!0,e("#cht-form #Facebook_Messenger").length&&""!=e("#cht-form #Facebook_Messenger").val()){var t=jQuery.trim(e("#Facebook_Messenger").val());if(e("#cht-form #Facebook_Messenger").val(t),!/(?:http:\/\/)?facebook\.com\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-]*)/.test(t)&&!/(?:http:\/\/)?m\.me\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-]*)/.test(t))return e("#custom-message-popup .chaty-popup-header").text("Facebook page's URL is not valid"),e("#custom-message-popup .chaty-popup-body").text("Please make sure your Facebook page's URL looks like, <br/>https://m.me/YOURPAGE"),e("#custom-message-popup").show(),!1}}else if(o=!0,e("#cht-form #Phone").length&&""!=e("#cht-form #Phone").val()){var t=jQuery.trim(e("#cht-form #Phone").val());if(check_for_number_chaty(t,"Phone"))return e("#custom-message-popup .chaty-popup-header").text("Phone number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the phone number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1}}else{a=!0;if(e("#cht-form #Whatsapp").length&&""!=e("#cht-form #Whatsapp").val()){var t=jQuery.trim(e("#cht-form #Whatsapp").val());if(check_for_number_chaty(t,"Whatsapp"))return e("#custom-message-popup .chaty-popup-header").text("Whatsapp number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the WhatsApp number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1}}return r()}e(document).ready(function(){e(document).on("change","#cht-form input",function(){a=!1,o=!1,c=!1,i=!1,n=!1,s=!1}),e("#cht-form").submit(function(){if(t)return!0;set_social_channel_order();var a=0;return e("#chaty-page-options .cht-required").length&&e("#chaty-page-options .cht-required").each(function(){""==jQuery.trim(e(this).val())&&(e(this).addClass("cht-input-error"),a++)}),e(".chaty-data-and-time-rules .cht-required").length&&e(".chaty-data-and-time-rules .cht-required").each(function(){""==jQuery.trim(e(this).val())&&(e(this).addClass("cht-input-error"),a++)}),0==a?h():(e(".cht-input-error:first").focus(),!1)}),e(".close-chaty-popup-btn").click(function(t){t.stopPropagation(),e(".chaty-popup").hide(),e(this).hasClass("channel-setting-btn")?e("body, html").animate({scrollTop:e("#channel-list").offset().top-125},250):e(this).hasClass("select-trigger-btn")?e("body, html").animate({scrollTop:e("#trigger-setting").offset().top-50},250):e(this).hasClass("change-status-btn")&&e("body, html").animate({scrollTop:e("#launch-section").offset().top-100},250)}),e(".chaty-popup-inner").click(function(e){e.stopPropagation()}),e(".chaty-popup-outer").click(function(t){e(".chaty-popup").hide()}),e(".check-for-numbers").click(function(){h()}),e(".check-for-device").click(function(){r()}),e(".check-for-triggers").click(function(){l()}),e(".check-for-status").click(function(){u()}),e(".change-status-and-save").click(function(){e(".cht_active").prop("checked",!0),t=!0,e(".chaty-popup").hide(),e("#cht-form").trigger("submit")}),e(".status-and-save").click(function(){e(".cht_active").prop("checked",!1),t=!0,e(".chaty-popup").hide(),e("#cht-form").trigger("submit")}),e(document).on("click",".preview-section-chaty",function(e){e.stopPropagation()}),e(document).on("click",".preview-section-overlay",function(){e(".preview-help-btn").removeClass("active"),e(".preview-section-chaty").removeClass("active"),e(".preview-section-overlay").removeClass("active")}),e(document).on("click",".preview-help-btn",function(t){return t.preventDefault(),e(this).hasClass("active")?(e(this).removeClass("active"),e(".preview-section-chaty").removeClass("active"),e(".preview-section-overlay").removeClass("active")):(e(this).addClass("active"),e(".preview-section-chaty").addClass("active"),e(".preview-section-overlay").addClass("active")),!1})})}),function(e,t){jQuery.fn[t]=function(e){return e?this.bind("resize",(a=e,function(){var e=this,t=arguments;i?clearTimeout(i):c&&a.apply(e,t),i=setTimeout(function(){c||a.apply(e,t),i=null},o||100)})):this.trigger(t);var a,o,c,i}}(jQuery,"smartModalResize"),function(e){"use strict";var t={init:function(t){var a={top:"auto",left:"auto",autoOpen:!1,overlayOpacity:.5,overlayColor:"#000",overlayClose:!0,overlayParent:"body",closeOnEscape:!0,closeButtonClass:".close",transitionIn:"",transitionOut:"",onOpen:!1,onClose:!1,zIndex:function(){return(t=Math.max.apply(Math,e.makeArray(jQuery("*").map(function(){return jQuery(this).css("z-index")}).filter(function(){return e.isNumeric(this)}).map(function(){return parseInt(this,10)}))))===-1/0?0:t+1;var t},updateZIndexOnOpen:!0,hasVariableWidth:!1};return t=e.extend(a,t),this.each(function(){var e=t,a=jQuery('<div class="lean-overlay"></div>'),o=jQuery(this);a.css({display:"none",position:"fixed","z-index":e.updateZIndexOnOpen?0:e.zIndex(),top:0,left:0,height:"100%",width:"100%",background:e.overlayColor,opacity:e.overlayOpacity,overflow:"auto"}).appendTo(e.overlayParent),o.css({display:"none",position:"fixed","z-index":e.updateZIndexOnOpen?0:e.zIndex()+1,left:parseInt(e.left,10)>-1?e.left+"px":"50%",top:parseInt(e.top,10)>-1?e.top+"px":"50%"}),o.bind("openModal",function(){var t=e.updateZIndexOnOpen?e.zIndex():parseInt(a.css("z-index"),10),c=t+1;""!==e.transitionIn&&""!==e.transitionOut&&o.removeClass(e.transitionOut).addClass(e.transitionIn),o.css({display:"block","margin-left":(parseInt(e.left,10)>-1?0:-o.outerWidth()/2)+"px","margin-top":(parseInt(e.top,10)>-1?0:-o.outerHeight()/2)+"px","z-index":c}),a.css({"z-index":t,display:"block"}),e.onOpen&&"function"==typeof e.onOpen&&e.onOpen(o[0])}),o.bind("closeModal",function(){""!==e.transitionIn&&""!==e.transitionOut?(o.removeClass(e.transitionIn).addClass(e.transitionOut),o.one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){o.css("display","none"),a.css("display","none")})):(o.css("display","none"),a.css("display","none")),e.onClose&&"function"==typeof e.onClose&&e.onClose(o[0])}),a.click(function(){e.overlayClose&&o.trigger("closeModal")}),jQuery(document).keydown(function(t){e.closeOnEscape&&27===t.keyCode&&o.trigger("closeModal")}),jQuery(window).smartModalResize(function(){e.hasVariableWidth&&o.css({"margin-left":(parseInt(e.left,10)>-1?0:-o.outerWidth()/2)+"px","margin-top":(parseInt(e.top,10)>-1?0:-o.outerHeight()/2)+"px"})}),o.on("click",e.closeButtonClass,function(e){o.trigger("closeModal"),e.preventDefault()}),e.autoOpen&&o.trigger("openModal")})}};e.fn.easyModal=function(a){return t[a]?t[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?void e.error("Method "+a+" does not exist on jQuery.easyModal"):t.init.apply(this,arguments)}}(jQuery),function(e){jQuery(document).ready(function(){jQuery("body input, body .icon, body textarea, body .btn-cancel:not(.close-btn-set) ").click(function(e){window.onbeforeunload=function(e){(e=e||window.event).preventDefault=!0,e.cancelBubble=!0,e.returnValue="Your beautiful goodbye message"}}),jQuery(document).on("submit","form",function(e){window.onbeforeunload=null}),jQuery(document).on("change",".channel-select-input",function(t){var a=e(this).closest("li").attr("data-id");jQuery.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{social:jQuery(this).val(),channel:a,action:"get_chaty_settings"},success:function(e){1==e.status&&(jQuery(".custom-icon-"+e.channel+" svg").html(e.data.svg),jQuery("#chaty-social-"+e.channel).attr("data-channel",e.data.slug),jQuery("#chaty-social-"+e.channel).find(".sp-preview-inner").css("background-color",e.data.color),jQuery("#chaty-social-"+e.channel).find(".chaty-color-field").val(e.data.color),jQuery("#chaty-social-"+e.channel).find(".channels__input").attr("placeholder",e.data.placeholder),jQuery("#chaty-social-"+e.channel).find(".channel-example").text(e.data.example),jQuery("#chaty-social-"+e.channel).find(".chaty-title").val(e.data.title),jQuery("#chaty-social-"+e.channel).find(".icon").attr("data-title",e.data.title),jQuery("#chaty-social-"+e.channel).find(".chaty-color-field").trigger("change"),jQuery(".help-section").html(""),""!=e.data.help_link?jQuery(".help-section").html('<div class="viber-help"><a target="_blank" href="'+e.data.help_link+'">'+e.data.help_title+"</a></div>"):""!=e.data.help_text&&jQuery(".help-section").html('<div class="viber-help"><span class="help-text">'+e.data.help_text+'</span><span class="help-title">'+e.data.help_title+"</span></div>"))}})}),jQuery(document).on("click","#chaty_icons_view",function(e){jQuery(".page-body .chaty-widget").removeClass("vertical").removeClass("horizontal"),jQuery(".page-body .chaty-widget").addClass(jQuery(this).val())}),jQuery(".upg").click(function(e){jQuery(".valid_domain_input").val(jQuery(".valid_domain_input").val().replace(" ","")),/^(http(s)?:\/\/)?(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/.test(jQuery(".valid_domain_input").val())||(e.preventDefault(),jQuery(".valid_domain").fadeIn().css({display:"block"}))}),jQuery(".del_token").click(function(t){e.ajax({type:"POST",url:ajaxurl,data:{action:"del_token",nonce_code:cht_nonce_ajax.cht_nonce},success:function(e){location.reload()},error:function(e,t,a){}})}),jQuery(document).on("blur","#channels-selected-list > li:not(#chaty-social-close) .channels__input",function(){jQuery(this).hasClass("border-red")&&""!=jQuery(this).val()&&jQuery(this).removeClass("border-red")}),jQuery(".easy-modal").easyModal({top:150,overlay:.2}),jQuery(".easy-modal-open").click(function(e){var t=jQuery(this).attr("href");jQuery(t).trigger("openModal"),e.preventDefault()}),jQuery(".easy-modal-close").click(function(e){e.preventDefault(),jQuery(".easy-modal").trigger("closeModal")});var t=1000000003;jQuery(".show_up").click(function(){t+=10,jQuery("#upgrade-modal").css({"z-index":t,display:"block","margin-left":"-258px"})}),jQuery(".color-picker-btn, .color-picker-btn-close, .color-picker-custom button").on("click",function(e){e.preventDefault(),jQuery(".color-picker").toggle(),jQuery(".color-picker-btn").toggle()}),jQuery(".color-picker-radio input").change(function(){var e=jQuery(this);if(jQuery('.color-picker-custom input[name="cht_custom_color"]').val(""),jQuery(".color-picker-custom .circle").html("?").css({"background-color":"#fff"}),e.prop("checked")){jQuery(".color-picker-radio input").prop("checked",!1),e.prop("checked",!0);var t=e.val(),a=e.prop("title")}else t=jQuery(".color-picker-custom input").val(),a="Custom";""!=t&&-1==t.indexOf("#")&&(t="#"+t),jQuery(".color-picker-btn .circle").css({backgroundColor:t}),jQuery(".color-picker-btn .text").text(a),jQuery("#chaty-social-close ellipse").attr("fill",t)}),jQuery(".color-picker-custom input").change(function(){jQuery(".color-picker-radio input").prop("checked",!1);var e=jQuery(this).val();""!=e&&-1==e.indexOf("#")&&(e="#"+e),jQuery(".color-picker-btn .circle").css({backgroundColor:e}),jQuery(".color-picker-btn .text").text("Custom"),jQuery("#chaty-social-close ellipse").attr("fill",e)}),jQuery('[name="cht_position"]').change(function(){jQuery("#positionCustom").prop("checked")?jQuery("#positionPro").show():jQuery("#positionPro").hide()}),jQuery(".update_token").on("click",function(t){t.preventDefault();var a=jQuery('input[name="cht_token"]').val();e.ajax({type:"POST",url:ajaxurl,data:{action:"add_token",nonce_code:cht_nonce_ajax.cht_nonce,token:a},beforeSend:function(e){},success:function(e){e?(alert("Your pro plan is activated"),location.reload()):alert("You`ve entered a wrong token")},error:function(e,t,a){}})}),jQuery("textarea[name=cht_cta]").keyup(function(e){jQuery(".tooltiptext span").html(jQuery(this).val()),0==jQuery(this).val().length?(jQuery(".cta").hide(200),jQuery(".tooltiptext span").hide(200)):(jQuery(".cta").show(300),jQuery(".tooltiptext span").show(200))})})}(jQuery),function(e){jQuery(document).ready(function(){!function(){function e(){var e=jQuery("#positionBottom"),t=jQuery("#positionSide"),a=jQuery(".preview .page .chaty-widget"),o=jQuery('[name="cht_position"]:checked').val();if("right"===o)a.css({right:"7px",left:"auto",bottom:"7px"});else if("left"===o)a.css({left:"7px",right:"auto",bottom:"7px"});else if("custom"===o){if(e.val())var c=e.val()+"px";else c="7px";if(t.val())var i=t.val()+"px";else i="7px";e.change(function(){c=jQuery("#positionBottom").val()+"px",a.css({bottom:c})}),t.change(function(){var e=jQuery('[name="positionSide"]:checked').val();i=jQuery(this).val()+"px","right"===e?(jQuery(".page-body .chaty-widget ").removeClass("chaty-widget-icons-left"),jQuery(".page-body .chaty-widget ").addClass("chaty-widget-icons-right"),a.css({right:i,left:"auto"})):"left"===e&&(jQuery(".page-body .chaty-widget ").removeClass("chaty-widget-icons-right"),jQuery(".page-body .chaty-widget ").addClass("chaty-widget-icons-left"),a.css({left:i,right:"auto"}))}),jQuery('[name="positionSide"]').change(function(){var e=jQuery('[name="positionSide"]:checked').val();"right"===e?(jQuery(".page-body .chaty-widget ").removeClass("chaty-widget-icons-left"),jQuery(".page-body .chaty-widget ").addClass("chaty-widget-icons-right"),a.css({right:i,left:"auto"})):"left"===e&&(jQuery(".page-body .chaty-widget ").removeClass("chaty-widget-icons-right"),jQuery(".page-body .chaty-widget ").addClass("chaty-widget-icons-left"),a.css({left:i,right:"auto"}))})}}jQuery(".color-picker-radio input").change(function(){var e=jQuery(this);e.prop("checked")?e.val():jQuery(".color-picker-custom input").val(),u()}),jQuery(".color-picker-custom input").change(function(){jQuery(this).val(),u()}),jQuery(document).on("change","#chaty_default_state",function(){u()}),jQuery("#cht_close_button, #trigger_on_time, #chaty_trigger_on_scroll").click(function(){u()}),function(){var e=jQuery("#widgetTooltip"),t=jQuery(".preview .page .icon");function a(){jQuery("[name=cht_cta]").val().length>=1?t.removeClass("no-tooltip"):t.addClass("no-tooltip")}a(),e.change(function(){a()})}(),e(),jQuery('input[name="cht_position"]').change(function(){var t=jQuery('[name="cht_position"]:checked').val();"right"===t?(jQuery(".page-body .chaty-widget ").removeClass("chaty-widget-icons-left"),jQuery(".page-body .chaty-widget ").addClass("chaty-widget-icons-right")):"left"===t&&(jQuery(".page-body .chaty-widget ").removeClass("chaty-widget-icons-right"),jQuery(".page-body .chaty-widget ").addClass("chaty-widget-icons-left")),e()})}(),jQuery(".popover").hide(),o();var t=jQuery(".channels-icons > .icon-sm"),a=jQuery(".social-inputs");function o(){jQuery("section").is("#pro")||(jQuery(".channels-selected__item").length<=1?(jQuery(".channels-selected__item").hide(),jQuery(".popover").hide()):jQuery(".channels-selected__item").length>=2&&jQuery(".channels-selected__item").show())}jQuery("input[name=cht_custom_color]").keyup(function(e){var t=jQuery(this).val();(jQuery(".circle").html(""),""!=t)&&(-1==t.indexOf("#")&&(t="#"+t),jQuery(".color-picker-custom .circle").css({"background-color":t}));jQuery(this).val().length<1&&jQuery(".color-picker-custom .circle").html("?")}),t.on("click",function(){0,o();var c=jQuery(this),i=c.data("social");a.find(".social-form-group");if(c.hasClass("active")){var n=","+jQuery(this).attr("data-social");return s=(s=jQuery(".add_slug").val()).replace(n,""),jQuery(".add_slug").val(s),s=s.replace(n,""),jQuery(".add_slug").val(s),s=s.replace(n,""),jQuery(".add_slug").val(s),s=s.replace(n,""),jQuery(".add_slug").val(s),void c.toggleClass("active")}if(t.addClass("disabled"),icon=jQuery(this).data("social"),"1"==jQuery(".add_slug").val().indexOf(icon)&&""!=jQuery(".add_slug").val()){var s;n=","+icon;s=(s=jQuery(".add_slug").val()).replace(n,""),jQuery(".add_slug").val(s),s=s.replace(n,""),jQuery(".add_slug").val(s),s=s.replace(n,""),jQuery(".add_slug").val(s)}else jQuery(".add_slug").val(jQuery(".add_slug").val()+","+jQuery(this).attr("data-social"));if(!jQuery("section").is("#pro")&&jQuery(".channels-icons > .icon.active").length>=2)return jQuery(".popover").show().effect("shake",{times:3},600),void t.removeClass("disabled");if(c.toggleClass("active"),jQuery("section").is("#pro"))var r="pro";else r="free";e.ajax({type:"POST",dataType:"json",url:ajaxurl,data:{action:"choose_social",social:i,nonce_code:cht_nonce_ajax.cht_nonce,version:r,widget_index:jQuery("#widget_index").val()},beforeSend:function(e){},success:function(a){var c=jQuery(a),i=c.find(".icon").data("title");jQuery('.channels-selected div[data-social="'+i+'"]').length||jQuery("#chaty-social-close").before(c),t.removeClass("disabled"),e("#iconWidget").show(),u(),o(),set_social_channel_order(),check_for_chaty_close_button(),jQuery(".chaty-color-field").spectrum({chooseText:"Submit",preferredFormat:"hex",showInput:!0,cancelText:"Cancel",move:function(e){jQuery(this).val(e.toHexString()),chaty_set_bg_color()}}),check_for_chaty_close_button()},error:function(e,t,a){}}),o()}),jQuery("body").on("click",".icon, .btn-cancel:not(.close-btn-set)",function(e){if(!jQuery(this).hasClass("close-btn-set")&&(e.preventDefault(),!jQuery(this).hasClass("icon")||!jQuery(this).hasClass("active"))){if(icon=jQuery(this).data("social"),jQuery(this).hasClass("btn-cancel")){jQuery('.icon.active[data-social^="'+icon+'"]').removeClass("active");var t=","+icon,a=jQuery(".add_slug").val();a=a.replace(t,""),jQuery(".add_slug").val(a)}jQuery("#chaty-social-"+icon).remove();jQuery(this).parent(".channels-selected__item"),jQuery(this).data("social");u(),o(),set_social_channel_order(),check_for_chaty_close_button()}}),jQuery(".btn-help").click(function(e){window.open("https://premio.io/help/chaty/","_blank")}),jQuery(".free-custom-radio, .free-custom-checkbox").on("click",function(e){e.preventDefault()});var c=jQuery("[name=cht_cta]"),i=jQuery(".preview .tooltip-show");c.keyup(function(){var e=jQuery(".preview .page .icon");c.val().length>=1?e.removeClass("no-tooltip"):e.addClass("no-tooltip"),i.attr("data-title",c.val())});var n,s,r='<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n </svg>',l=document.getElementById("iconWidget");jQuery(".color-picker-radio input:checked").val();function u(){var t,a,o=!1;if(jQuery(".single-channel-setting").addClass("active"),jQuery("#iconWidget").removeClass("img-p-active"),d()?(0===jQuery(".js-chanel-desktop:checked").length?(t=!1,jQuery(".page-body .chaty-widget").hide()):jQuery(".page-body .chaty-widget").show(),1===jQuery(".js-chanel-desktop:checked").length&&(t=jQuery(".js-chanel-desktop:checked").closest("li").find(".icon.icon-md").html(),jQuery(".js-chanel-desktop:checked").closest(".channels-selected__item").hasClass("img-active")&&jQuery("#iconWidget").addClass("img-p-active"),jQuery(".single-channel-setting").removeClass("active")),jQuery(".js-chanel-desktop:checked").length>1&&(t=r,o=!0)):(0===jQuery(".js-chanel-mobile:checked").length?(a=!1,jQuery(".page-body .chaty-widget").hide()):jQuery(".page-body .chaty-widget").show(),1===jQuery(".js-chanel-mobile:checked").length&&(a=jQuery(".js-chanel-mobile:checked").closest("li").find(".icon.icon-md").html(),jQuery(".js-chanel-mobile:checked").closest(".channels-selected__item").hasClass("img-active")&&jQuery("#iconWidget").addClass("img-p-active"),jQuery(".single-channel-setting").removeClass("active")),jQuery(".js-chanel-mobile:checked").length>1&&(a=r,o=!0)),n=t,s=a,d()?h(n,o):h(s,o),e("#iconWidget .pop-number").remove(),jQuery("#cht_pending_messages").is(":checked")){var c=jQuery("#cht_number_of_messages").val();""!=c&&c>0&&(e("#iconWidget").append("<span class='pop-number'>"+c+"</span>"),e("#iconWidget .pop-number").css("color",jQuery("#cht_number_color").val()),e("#iconWidget .pop-number").css("background",jQuery("#cht_number_bg_color").val()))}e("#cta-box span").css("color",e("#cht_cta_text_color").val()),e("#cta-box span").css("background",e("#cht_cta_bg_color").val()),e("#custom-css").html("<style>.preview .page .chaty-widget .icon:before {border-color: transparent "+e("#cht_cta_bg_color").val()+" transparent transparent } .preview .page .chaty-widget[style*='left: auto;'] .icon:before {border-color: transparent transparent transparent "+e("#cht_cta_bg_color").val()+"}</style>")}function h(e,t){if(l.innerHTML=e||"",t){var a=jQuery(".color-picker-custom input").val()?jQuery(".color-picker-custom input").val():jQuery(".color-picker-radio input:checked").val();if(""!=a)-1==a.indexOf("#")&&(a="#"+a);jQuery(".preview .page svg circle").css({fill:a}),jQuery("#chaty-social-close ellipse").attr("fill",a)}thisVal=jQuery("#chaty_default_state").val(),"open"==thisVal?jQuery(".hide-show-button").addClass("active"):jQuery(".hide-show-button").removeClass("active"),jQuery(".chaty-widget").removeClass("active").removeClass("hover").removeClass("click").removeClass("hide_arrow"),"open"==thisVal?(jQuery(".chaty-widget").addClass("active").addClass("click"),"open"==thisVal&&jQuery(o+":checked").length>1&&jQuery(".chaty-widget").addClass("hide_arrow")):"hover"==thisVal?jQuery(".chaty-widget").addClass("hover"):jQuery(".chaty-widget").addClass("click"),jQuery(".chaty-channels").html("");var o=".js-chanel-mobile";if(d())o=".js-chanel-desktop";"open"==thisVal&&jQuery(o+":checked").length>1?(jQuery("#chaty_attention_effect").val(""),jQuery("#chaty_attention_effect, .test_textarea").attr("disabled",!0),jQuery("#chaty_attention_effect option:first-child").text("Doesn't apply for the open state"),"Doesn't apply for the open state"!=jQuery(".test_textarea").val()&&jQuery(".test_textarea").attr("data-value",jQuery(".test_textarea").val()),jQuery(".test_textarea").val("Doesn't apply for the open state"),jQuery("#cht_number_of_messages").attr("disabled",!0),jQuery("#cht_pending_messages").attr("disabled",!0),jQuery(".disable-message").addClass("label-tooltip").addClass("icon"),jQuery("#cht_pending_messages").attr("checked",!1),jQuery(".pending-message-items").removeClass("active"),jQuery(".cta-action-radio input").attr("disabled",!0)):(jQuery("#chaty_attention_effect, .test_textarea").attr("disabled",!1),jQuery("#chaty_attention_effect option:first-child").text("None"),jQuery(".test_textarea").attr("placeholder",""),"Doesn't apply for the open state"==jQuery(".test_textarea").val()&&jQuery(".test_textarea").val(jQuery(".test_textarea").attr("data-value")),jQuery("#cht_number_of_messages").attr("disabled",!1),jQuery("#cht_pending_messages").attr("disabled",!1),jQuery(".disable-message").removeClass("label-tooltip").removeClass("icon"),jQuery(".cta-action-radio input").attr("disabled",!1)),jQuery(".page-body .chaty-widget").removeClass("vertical").removeClass("horizontal"),console.log(jQuery(o+":checked").length),jQuery(o+":checked").length>1?(jQuery(o+":checked").each(function(){var e=jQuery(this).closest("li").find(".icon").html(),t=(e=jQuery(this).closest("li").find(".icon").html(),jQuery(this).closest("li").find(".chaty-title").val()),a=jQuery(this).closest(".channels-selected__item").hasClass("img-active")?"img-active":"";""!=t&&(t="<span class='social-tooltip'>"+t+"</span>"),jQuery(".chaty-channels").append("<div class='social-item-box "+a+"'><span class='tooltip-icon'>"+e+"</span>"+t+"</div>")}),"open"==jQuery("#chaty_default_state").val()&&jQuery("#cht_close_button").is(":checked")?(jQuery("#iconWidget").css("display","block"),jQuery(".chaty-widget .tooltiptext").css("display","block"),jQuery(".chaty-widget").removeClass("hide-arrow")):"open"!=jQuery("#chaty_default_state").val()?(jQuery("#iconWidget").css("display","block"),jQuery(".chaty-widget .tooltiptext").css("display","block"),jQuery(".chaty-widget").removeClass("hide-arrow")):"open"==jQuery("#chaty_default_state").val()&&(jQuery("#iconWidget").hide(),jQuery(".chaty-widget .tooltiptext").hide(),jQuery(".chaty-widget").addClass("hide-arrow")),jQuery(".chaty-widget").removeClass("has-single"),jQuery(".page-body .chaty-widget").addClass(jQuery("#chaty_icons_view").val())):1==jQuery(o+":checked").length?("open"!=jQuery("#chaty_default_state").val()||jQuery("#cht_close_button").is(":checked")?"open"!=jQuery("#chaty_default_state").val()&&(jQuery("#iconWidget").css("display","block"),jQuery(".chaty-widget .tooltiptext").css("display","block"),jQuery(".chaty-widget").removeClass("hide-arrow")):(jQuery("#iconWidget").css("display","block"),jQuery(".chaty-widget .tooltiptext").css("display","block"),jQuery(".chaty-widget").removeClass("hide-arrow")),jQuery(".chaty-widget").addClass("has-single"),jQuery(".chaty-widget").removeClass("hide-arrow")):0==jQuery(o+":checked").length&&(jQuery("#iconWidget").hide(),jQuery(".chaty-widget .tooltiptext").hide(),jQuery(".chaty-widget").addClass("hide-arrow"),jQuery(".chaty-widget").removeClass("has-single")),jQuery(".chaty-channels .remove-icon-img").remove(),jQuery("#trigger_on_time").is(":checked")?jQuery("#chaty_trigger_time").attr("readonly",!1):jQuery("#chaty_trigger_time").attr("readonly",!0),jQuery("#chaty_trigger_on_scroll").is(":checked")?jQuery("#chaty_trigger_on_page_scroll").attr("readonly",!1):jQuery("#chaty_trigger_on_page_scroll").attr("readonly",!0),""==jQuery(".chaty-widget .tooltiptext").text()?jQuery(".chaty-widget .tooltiptext").hide():"open"==jQuery("#chaty_default_state").val()&&jQuery(o+":checked").length>1?jQuery(".chaty-widget .tooltiptext").hide():jQuery(".chaty-widget .tooltiptext").css("display","block")}function d(){return"checked"===jQuery("#previewDesktop").attr("checked")}jQuery("#testUpload").on("change",function(){this.value.length>0?document.querySelector(".js-upload").disabled=!1:(document.querySelector(".js-upload").disabled=!0,document.getElementById("uploadInput").checked=!1)}),jQuery(document).on("keyup","textarea.test_textarea",function(){u()}),jQuery(".js-switch-preview").on("change",function(){d()?jQuery(this).closest(".preview").removeClass("mobiel-view"):jQuery(this).closest(".preview").addClass("mobiel-view"),u()}),jQuery(document).on("change","input[name='cht_pending_messages']",function(){jQuery("#cht_pending_messages").is(":checked")?jQuery(".pending-message-items").addClass("active"):jQuery(".pending-message-items").removeClass("active"),u()}),jQuery(document).on("change","#cht_number_of_messages",function(){u()}),jQuery(document).on("keyup","#cht_number_of_messages",function(){u()}),jQuery(document).on("blur","#cht_number_of_messages",function(){u()}),jQuery(document).on("change",".js-chanel-icon",function(){u()}),jQuery(document).on("change",".js-widget-i",function(e){r=e.target.classList.contains("js-upload")?jQuery(".file-preview-image").last().parent().html():jQuery("i[data-type="+e.target.dataset.type+"]").html(),u()}),"chat-image"!==jQuery(".js-widget-i:checked").attr("data-type")&&(r=jQuery("i[data-type="+jQuery(".js-widget-i:checked").attr("data-type")+"]").html(),u())}),jQuery(document).ready(function(){jQuery(document).on("click",".chaty-popup-box button, #chaty-intro-popup",function(t){t.stopPropagation();var a=jQuery("#chaty_update_popup_status").val();e("#chaty-intro-popup").remove(),e.ajax({type:"POST",url:ajaxurl,data:{action:"update_popup_status",nonce:a},beforeSend:function(e){},success:function(e){},error:function(e,t,a){}})}),jQuery(document).on("click",".chaty-popup-box",function(e){e.stopPropagation()}),jQuery(document).on("click",".remove-chaty-options",function(t){t.preventDefault(),t.stopPropagation(),confirm("Are you sure you want to delete this widget?")&&e.ajax({type:"POST",url:ajaxurl,data:{action:"remove_chaty_widget",nonce_code:cht_nonce_ajax.cht_nonce,widget_index:jQuery("#widget_index").val()},beforeSend:function(e){},success:function(e){window.location=e},error:function(e,t,a){}})});window.location.href;window.location.href.indexOf("page=chaty-app&widget=")>-1&&jQuery("#toplevel_page_chaty-app .wp-submenu.wp-submenu-wrap li").each(function(){var e=jQuery(this).find("a").attr("href");void 0!==e&&(jQuery(this).removeClass("current"),window.location.href.indexOf(e)>-1&&e.indexOf("&widget=")>-1&&jQuery(this).addClass("current"))})})}(jQuery),jQuery(window).resize(function(){check_for_preview_pos()}),jQuery(window).scroll(function(){check_for_preview_pos()}),jQuery(document).ready(function(){check_for_preview_pos()});var totalPageOptions=0,pageOptionContent="",totalDateAndTimeOptions=0,dateAndTimeOptionContent="";jQuery(document).ready(function(){totalPageOptions=parseInt(jQuery(".chaty-page-option").length),pageOptionContent=jQuery(".chaty-page-options-html").html(),jQuery(".chaty-page-options-html").remove(),totalDateAndTimeOptions=parseInt(jQuery(".chaty-date-time-option").length),dateAndTimeOptionContent=jQuery(".chaty-date-and-time-options-html").html(),jQuery(".chaty-date-and-time-options-html").remove(),jQuery("#create-rule").click(function(){jQuery(".page-options").toggle()}),jQuery("#create-data-and-time-rule").click(function(){jQuery(".chaty-data-and-time-rules").toggle()}),jQuery(document).on("change","#chaty_attention_effect",function(){var e=jQuery(this).attr("data-effect");""!=e&&jQuery("#iconWidget").removeClass("chaty-animation-"+e),jQuery("#iconWidget").removeClass("start-now"),jQuery("#iconWidget").addClass("chaty-animation-"+jQuery(this).val()).addClass("start-now"),jQuery(this).attr("data-effect",jQuery(this).val())}),setInterval(function(){var e=jQuery("#chaty_attention_effect").attr("data-effect");""!=e?(jQuery("#iconWidget").removeClass("chaty-animation-"+e),jQuery("#iconWidget").removeClass("start-now"),setTimeout(function(){jQuery("#iconWidget").addClass("chaty-animation-"+jQuery("#chaty_attention_effect").val()).addClass("start-now")},1e3)):jQuery("#chaty_attention_effect").attr("data-effect",jQuery("#chaty_attention_effect").val())},5e3),jQuery(document).on("click",".remove-chaty",function(){jQuery(".page-options").toggle()}),jQuery(document).on("click",".remove-page-option",function(){jQuery(".chaty-data-and-time-rules ").toggle()}),jQuery("#image-upload-content .custom-control-label").click(function(e){return e.stopPropagation(),jQuery(this).closest(".custom-control").find("input[type=radio]").attr("checked",!0),jQuery(".js-widget-i").trigger("change"),!1}),jQuery(".chaty-color-field").spectrum({chooseText:"Submit",preferredFormat:"hex",cancelText:"Cancel",showInput:!0,move:function(e){jQuery(this).val(e.toHexString()),chaty_set_bg_color(),change_custom_preview()}}),jQuery(".chaty-color-field").change(function(){chaty_set_bg_color(),change_custom_preview()}),jQuery(".remove-chaty-img").on("click",function(e){e.stopPropagation()}),jQuery("#channels-selected-list").sortable({placeholder:"ui-chaty-state-hl",items:"li:not(#chaty-social-close)",update:function(e,t){set_social_channel_order(),change_custom_preview()}}),jQuery(".close-button-img img, .close-button-img .image-upload").click(function(){var e=wp.media({title:"Upload Image",multiple:!1,library:{type:"image"}}).open().on("select",function(t){var a=e.state().get("selection").first();imageData=a.toJSON(),jQuery(".close-button-img").addClass("active"),jQuery(".close-button-img input").val(imageData.id),jQuery(".close-button-img img").attr("src",imageData.url),change_custom_preview()})}),jQuery(".remove-close-img").click(function(){default_image=jQuery("#default_image").val(),jQuery(".close-button-img").removeClass("active"),jQuery(".close-button-img input").val(""),jQuery(".close-button-img img").attr("src",default_image),change_custom_preview()}),jQuery(document).on("click",".chaty-widget.click",function(e){e.preventDefault(),jQuery(".chaty-widget").toggleClass("active")}),jQuery(document).on("change",".url-options.cht-required",function(e){thisVal=jQuery(this).val(),siteURL=jQuery("#chaty_site_url").val(),newURL=siteURL,"page_has_url"==thisVal?newURL=siteURL:"page_contains"==thisVal?newURL=siteURL+"%s%":"page_start_with"==thisVal?newURL=siteURL+"s%":"page_end_with"==thisVal&&(newURL=siteURL+"%s"),jQuery(this).closest(".url-content").find(".chaty-url").text(newURL)}),check_for_chaty_close_button(),chaty_set_bg_color(),change_custom_preview(),jQuery(".chaty-settings.cls-btn a, .close-btn-set").click(function(e){e.preventDefault(),jQuery(".cls-btn-settings, .close-btn-set").toggleClass("active")}),0==jQuery("input[name='cht_position']:checked").length&&(jQuery("#right-position").attr("checked",!0),jQuery("input[name='cht_position']:checked").trigger("change")),0==jQuery("input[name='widget_icon']:checked").length&&(jQuery("input[name='widget_icon']:first").attr("checked",!0),jQuery("input[name='widget_icon']:checked").trigger("change")),jQuery(".form-fonts").on("change",function(){var e=jQuery(this).val();jQuery(".chaty-google-font").remove(),""!=e?("Default"!=jQuery(".form-fonts option:selected").data("group")&&jQuery("head").append('<link href="https://fonts.googleapis.com/css?family='+e+':400,600,700" rel="stylesheet" type="text/css" class="chaty-google-font">'),jQuery(".preview-section-chaty #admin-preview .page-body").css("font-family",e)):jQuery(".preview-section-chaty #admin-preview .page-body").attr("style","")})}),jQuery(window).load(function(){check_for_chaty_close_button(),chaty_set_bg_color(),jQuery(".chaty-page-options .chaty-page-option").removeClass("last"),jQuery(".chaty-page-options .chaty-page-option:last").addClass("last"),jQuery(".url-options.cht-required").each(function(){jQuery(this).trigger("change")});var e=jQuery(".form-fonts").val();jQuery(".chaty-google-font").remove(),""!=e&&("Default"!=jQuery(".form-fonts option:selected").data("group")&&jQuery("head").append('<link href="https://fonts.googleapis.com/css?family='+e+':400,600,700" rel="stylesheet" type="text/css" class="chaty-google-font">'),jQuery(".preview-section-chaty #admin-preview .page-body").css("font-family",e))});var selectedsocialSlug="";function upload_chaty_image(e){selectedsocialSlug=e;var t=wp.media({title:"Upload Image",multiple:!1,library:{type:"image"}}).open().on("select",function(e){var a=t.state().get("selection").first();imageData=a.toJSON(),jQuery("#cht_social_image_"+selectedsocialSlug).val(imageData.id),jQuery(".custom-image-"+selectedsocialSlug+" img").attr("src",imageData.url),jQuery("#chaty-social-"+selectedsocialSlug+" .channels-selected__item").addClass("img-active"),change_custom_preview()})}function toggle_chaty_setting(e){jQuery("#chaty-social-"+e).find(".chaty-advance-settings").toggle(),change_custom_preview()}function chaty_set_bg_color(){jQuery(".chaty-color-field").each(function(){""!=jQuery(this).val()&&"#ffffff"!=jQuery(this).val()&&("Linkedin"!=jQuery(this).closest("li").data("id")||"Linkedin"==jQuery(this).closest("li").data("id")&&"#ffffff"!=jQuery(this).val())&&(defaultColor=jQuery(this).val(),jQuery(this).closest(".channels-selected__item").find(".color-element").css("fill",defaultColor),jQuery(this).closest(".channels-selected__item").find(".custom-chaty-image").css("background",defaultColor),jQuery(this).closest(".channels-selected__item").find(".facustom-icon").css("background",defaultColor))}),change_custom_preview()}function upload_qr_code(){var e=wp.media({title:"Upload QR Image",multiple:!1,library:{type:"image"}}).open().on("select",function(t){var a=e.state().get("selection").first();imageData=a.toJSON(),jQuery("#upload_qr_code_val").val(imageData.id),jQuery("#upload_qr_code img").attr("src",imageData.url),jQuery(".remove-qr-code").addClass("active"),change_custom_preview()})}function remove_qr_code(){jQuery(".remove-qr-code").removeClass("active"),jQuery("#upload_qr_code_val").val(""),default_image=jQuery("#default_image").val(),jQuery("#upload_qr_code img").attr("src",default_image),change_custom_preview()}function remove_chaty_image(e){default_image=jQuery("#default_image").val(),jQuery("#chaty-social-"+e+" .channels-selected__item").removeClass("img-active"),jQuery("#cht_social_image_"+e).val(""),jQuery("#cht_social_image_src_"+e).attr("src",default_image),change_custom_preview()}var baseIcon='<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n </svg>',defaultIcon='<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n </svg>',iconBlock=document.getElementById("iconWidget");function set_social_channel_order(){socialString=[],jQuery("#channels-selected-list li").each(function(){socialString.push(jQuery(this).attr("data-id"))}),socialString=socialString.join(","),jQuery("#cht_numb_slug").val(socialString),check_for_chaty_close_button()}function check_for_chaty_close_button(){jQuery("#channels-selected-list > li:not(.chaty-cls-setting)").length>=2?jQuery("#chaty-social-close").show():jQuery("#chaty-social-close").hide(),change_custom_preview();var e="";jQuery("#channels-selected-list > li").each(function(){"undefined"!=jQuery(this).attr("data-id")&&""!=jQuery(this).attr("data-id")&&(e+=jQuery(this).attr("data-id")+","),e=e.trimRight(",")}),jQuery(".add_slug").val(e)}function change_custom_preview(){var e,t,a=!1;jQuery("#iconWidget").removeClass("img-p-active"),getChtPreviewDesktop()?(0===jQuery(".js-chanel-desktop:checked").length&&(e=!1),1===jQuery(".js-chanel-desktop:checked").length&&(e=jQuery(".js-chanel-desktop:checked").closest("li").find(".icon.icon-md").html(),jQuery(".js-chanel-desktop:checked").closest(".channels-selected__item").hasClass("img-active")&&jQuery("#iconWidget").addClass("img-p-active")),jQuery(".js-chanel-desktop:checked").length>1&&(e=defaultIcon,a=!0)):(0===jQuery(".js-chanel-mobile:checked").length&&(t=!1),1===jQuery(".js-chanel-mobile:checked").length&&(t=jQuery(".js-chanel-mobile:checked").closest("li").find(".icon.icon-md").html(),jQuery(".js-chanel-mobile:checked").closest(".channels-selected__item").hasClass("img-active")&&jQuery("#iconWidget").addClass("img-p-active")),jQuery(".js-chanel-mobile:checked").length>1&&(t=defaultIcon,a=!0)),desktopIcon=e,mobileIcon=t,getChtPreviewDesktop()?setChtIcon(desktopIcon,a):setChtIcon(mobileIcon,a),jQuery("#channels-selected-list > li.chaty-channel").length<=1?jQuery(".o-channel, .font-section").removeClass("active"):jQuery(".o-channel, .font-section").addClass("active")}function getChtPreviewDesktop(){return"checked"===jQuery("#previewDesktop").attr("checked")}function setChtIcon(e,t){if((iconBlock=document.getElementById("iconWidget")).innerHTML=e||"",t){var a=jQuery(".color-picker-custom input").val()?jQuery(".color-picker-custom input").val():jQuery(".color-picker-radio input:checked").val();jQuery(".preview .page svg circle").css({fill:a}),jQuery("#chaty-social-close ellipse").attr("fill",a)}jQuery(".js-widget-i:checked").trigger("change")}
1
+ function check_for_number_chaty(e,t){return!(""==e||("+"==e[0]&&(e=e.substr(1,e.length)),"Phone"==t&&"*"==e[0]&&(e=e.substr(1,e.length)),!isNaN(e)))}function check_for_preview_pos(){if(jQuery(".chaty-setting-form").length)if(jQuery(window).width()>1179){var e=parseInt(jQuery(".chaty-setting-form").offset().top);jQuery(".btn-save-sticky, .chaty-sticky-buttons").css("top",e+58),jQuery(".preview").css("top",e+18),jQuery(".btn-help").css("top",e+58+145),jQuery("a.remove-chaty-widget-sticky").css("top",e+58+145+119)}else jQuery(".btn-save-sticky, .chaty-sticky-buttons").attr("style",""),jQuery(".preview").attr("style",""),jQuery(".btn-help").attr("style",""),jQuery("a.remove-chaty-widget-sticky").attr("style","");if(jQuery("#scroll-to-item").length&&jQuery("#admin-preview").length&&((e=jQuery("body").hasClass("has-premio-box")?jQuery("#scroll-to-item").offset().top-jQuery(window).scrollTop()-625:jQuery("#scroll-to-item").offset().top-jQuery(window).scrollTop()-485)<0?(e=Math.abs(e),jQuery("#admin-preview").css("margin-top",-1*e+"px")):jQuery("#admin-preview").css("margin-top","0")),jQuery(window).height()<=1180){var t=285;jQuery(window).width()<=600&&(t=310),jQuery(".chaty-sticky-buttons").css("top",jQuery(window).height()/2-t/2+"px")}}jQuery(function(e){"use strict";var t=!1,a=!1,o=!1,c=!1,i=!1,n=!1,s=!1;function r(){if(e(".chaty-popup").hide(),0==e("#cht-form .js-chanel-desktop").length||0==e("#cht-form .js-chanel-mobile").length)return e("#no-device-popup").show(),!1;if(0==e("#cht-form .js-chanel-desktop:checked").length&&0==e("#cht-form .js-chanel-mobile:checked").length)return e("#device-popup").show(),!1;var t=0;return e("#channels-selected-list > li:not(#chaty-social-close)").find(".channels__input").each(function(){""==jQuery.trim(e(this).val())&&t++}),t==e("#channels-selected-list > li:not(#chaty-social-close)").find(".channels__input").length?(e("#no-device-value").show(),!1):l()}function l(){return e(".chaty-popup").hide(),e("#trigger_on_time").is(":checked")||e("#chaty_trigger_on_exit").is(":checked")||e("#chaty_trigger_on_scroll").is(":checked")?u():(e("#trigger-popup").show(),!1)}function u(){return e(".chaty-popup").hide(),e(".cht_active").is(":checked")?(t=!0,e("#cht-form").trigger("submit"),!0):(e("#status-popup").show(),!1)}function h(){if(a){if(o){if(c){if(i){if(n)s||(s=!0,e("#channels-selected-list .phone-number").length&&e("#channels-selected-list .phone-number").each(function(){if(""!=jQuery.trim(e(this).val())&&jQuery.trim(e(this).val()).length>13)return e("#custom-message-popup .chaty-popup-header").text(e(this).data("label")+" number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the "+e(this).data("label")+" number you're trying to enter isn't valid. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1}));else if(n=!0,e("#cht-form #Viber").length&&""!=e("#cht-form #Viber").val()){t=jQuery.trim(e("#cht-form #Viber").val());if(check_for_number_chaty(t,"Viber"))return e("#custom-message-popup .chaty-popup-header").text("Viber number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the Viber number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1}}else if(i=!0,e("#cht-form #SMS").length&&""!=e("#cht-form #SMS").val()){t=jQuery.trim(e("#cht-form #SMS").val());if(check_for_number_chaty(t,"SMS"))return e("#custom-message-popup .chaty-popup-header").text("SMS number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the SMS number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1}}else if(c=!0,e("#cht-form #Facebook_Messenger").length&&""!=e("#cht-form #Facebook_Messenger").val()){var t=jQuery.trim(e("#Facebook_Messenger").val());if(e("#cht-form #Facebook_Messenger").val(t),!/(?:http:\/\/)?facebook\.com\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-]*)/.test(t)&&!/(?:http:\/\/)?m\.me\/(?:(?:\w)*#!\/)?(?:pages\/)?(?:[\w\-]*\/)*([\w\-]*)/.test(t))return e("#custom-message-popup .chaty-popup-header").text("Facebook page's URL is not valid"),e("#custom-message-popup .chaty-popup-body").text("Please make sure your Facebook page's URL looks like, <br/>https://m.me/YOURPAGE"),e("#custom-message-popup").show(),!1}}else if(o=!0,e("#cht-form #Phone").length&&""!=e("#cht-form #Phone").val()){var t=jQuery.trim(e("#cht-form #Phone").val());if(check_for_number_chaty(t,"Phone"))return e("#custom-message-popup .chaty-popup-header").text("Phone number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the phone number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1}}else{a=!0;if(e("#cht-form #Whatsapp").length&&""!=e("#cht-form #Whatsapp").val()){var t=jQuery.trim(e("#cht-form #Whatsapp").val());if(check_for_number_chaty(t,"Whatsapp"))return e("#custom-message-popup .chaty-popup-header").text("Whatsapp number is not valid"),e("#custom-message-popup .chaty-popup-body").text("Seems like the WhatsApp number you're trying to enter isn't in the right syntax. Would you like to publish it anyway?"),e("#custom-message-popup").show(),!1}}return r()}e(document).ready(function(){e(document).on("change","#cht-form input",function(){a=!1,o=!1,c=!1,i=!1,n=!1,s=!1}),e("#cht-form").submit(function(){if(t)return!0;set_social_channel_order();var a=0;return e("#chaty-page-options .cht-required").length&&e("#chaty-page-options .cht-required").each(function(){""==jQuery.trim(e(this).val())&&(e(this).addClass("cht-input-error"),a++)}),e(".chaty-data-and-time-rules .cht-required").length&&e(".chaty-data-and-time-rules .cht-required").each(function(){""==jQuery.trim(e(this).val())&&(e(this).addClass("cht-input-error"),a++)}),0==a?h():(e(".cht-input-error:first").focus(),!1)}),e(".close-chaty-popup-btn").click(function(t){t.stopPropagation(),e(".chaty-popup").hide(),e(this).hasClass("channel-setting-btn")?e("body, html").animate({scrollTop:e("#channel-list").offset().top-125},250):e(this).hasClass("select-trigger-btn")?e("body, html").animate({scrollTop:e("#trigger-setting").offset().top-50},250):e(this).hasClass("change-status-btn")&&e("body, html").animate({scrollTop:e("#launch-section").offset().top-100},250)}),e(".chaty-popup-inner").click(function(e){e.stopPropagation()}),e(".chaty-popup-outer").click(function(t){e(".chaty-popup").hide()}),e(".check-for-numbers").click(function(){h()}),e(".check-for-device").click(function(){r()}),e(".check-for-triggers").click(function(){l()}),e(".check-for-status").click(function(){u()}),e(".change-status-and-save").click(function(){e(".cht_active").prop("checked",!0),t=!0,e(".chaty-popup").hide(),e("#cht-form").trigger("submit")}),e(".status-and-save").click(function(){e(".cht_active").prop("checked",!1),t=!0,e(".chaty-popup").hide(),e("#cht-form").trigger("submit")}),e(document).on("click",".preview-section-chaty",function(e){e.stopPropagation()}),e(document).on("click",".preview-section-overlay",function(){e(".preview-help-btn").removeClass("active"),e(".preview-section-chaty").removeClass("active"),e(".preview-section-overlay").removeClass("active")}),e(document).on("click",".preview-help-btn",function(t){return t.preventDefault(),e(this).hasClass("active")?(e(this).removeClass("active"),e(".preview-section-chaty").removeClass("active"),e(".preview-section-overlay").removeClass("active")):(e(this).addClass("active"),e(".preview-section-chaty").addClass("active"),e(".preview-section-overlay").addClass("active")),!1})})}),function(e,t){jQuery.fn[t]=function(e){return e?this.bind("resize",(a=e,function(){var e=this,t=arguments;i?clearTimeout(i):c&&a.apply(e,t),i=setTimeout(function(){c||a.apply(e,t),i=null},o||100)})):this.trigger(t);var a,o,c,i}}(jQuery,"smartModalResize"),function(e){"use strict";var t={init:function(t){var a={top:"auto",left:"auto",autoOpen:!1,overlayOpacity:.5,overlayColor:"#000",overlayClose:!0,overlayParent:"body",closeOnEscape:!0,closeButtonClass:".close",transitionIn:"",transitionOut:"",onOpen:!1,onClose:!1,zIndex:function(){return(t=Math.max.apply(Math,e.makeArray(jQuery("*").map(function(){return jQuery(this).css("z-index")}).filter(function(){return e.isNumeric(this)}).map(function(){return parseInt(this,10)}))))===-1/0?0:t+1;var t},updateZIndexOnOpen:!0,hasVariableWidth:!1};return t=e.extend(a,t),this.each(function(){var e=t,a=jQuery('<div class="lean-overlay"></div>'),o=jQuery(this);a.css({display:"none",position:"fixed","z-index":e.updateZIndexOnOpen?0:e.zIndex(),top:0,left:0,height:"100%",width:"100%",background:e.overlayColor,opacity:e.overlayOpacity,overflow:"auto"}).appendTo(e.overlayParent),o.css({display:"none",position:"fixed","z-index":e.updateZIndexOnOpen?0:e.zIndex()+1,left:parseInt(e.left,10)>-1?e.left+"px":"50%",top:parseInt(e.top,10)>-1?e.top+"px":"50%"}),o.bind("openModal",function(){var t=e.updateZIndexOnOpen?e.zIndex():parseInt(a.css("z-index"),10),c=t+1;""!==e.transitionIn&&""!==e.transitionOut&&o.removeClass(e.transitionOut).addClass(e.transitionIn),o.css({display:"block","margin-left":(parseInt(e.left,10)>-1?0:-o.outerWidth()/2)+"px","margin-top":(parseInt(e.top,10)>-1?0:-o.outerHeight()/2)+"px","z-index":c}),a.css({"z-index":t,display:"block"}),e.onOpen&&"function"==typeof e.onOpen&&e.onOpen(o[0])}),o.bind("closeModal",function(){""!==e.transitionIn&&""!==e.transitionOut?(o.removeClass(e.transitionIn).addClass(e.transitionOut),o.one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend",function(){o.css("display","none"),a.css("display","none")})):(o.css("display","none"),a.css("display","none")),e.onClose&&"function"==typeof e.onClose&&e.onClose(o[0])}),a.click(function(){e.overlayClose&&o.trigger("closeModal")}),jQuery(document).keydown(function(t){e.closeOnEscape&&27===t.keyCode&&o.trigger("closeModal")}),jQuery(window).smartModalResize(function(){e.hasVariableWidth&&o.css({"margin-left":(parseInt(e.left,10)>-1?0:-o.outerWidth()/2)+"px","margin-top":(parseInt(e.top,10)>-1?0:-o.outerHeight()/2)+"px"})}),o.on("click",e.closeButtonClass,function(e){o.trigger("closeModal"),e.preventDefault()}),e.autoOpen&&o.trigger("openModal")})}};e.fn.easyModal=function(a){return t[a]?t[a].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof a&&a?void e.error("Method "+a+" does not exist on jQuery.easyModal"):t.init.apply(this,arguments)}}(jQuery),function(e){jQuery(document).ready(function(){jQuery("body input, body .icon, body textarea, body .btn-cancel:not(.close-btn-set) ").click(function(e){window.onbeforeunload=function(e){(e=e||window.event).preventDefault=!0,e.cancelBubble=!0,e.returnValue="Your beautiful goodbye message"}}),jQuery(document).on("submit","form",function(e){window.onbeforeunload=null}),jQuery(document).on("change",".channel-select-input",function(t){var a=e(this).closest("li").attr("data-id");jQuery.ajax({type:"POST",url:ajaxurl,dataType:"json",data:{social:jQuery(this).val(),channel:a,action:"get_chaty_settings"},success:function(e){1==e.status&&(jQuery(".custom-icon-"+e.channel+" svg").html(e.data.svg),jQuery("#chaty-social-"+e.channel).attr("data-channel",e.data.slug),jQuery("#chaty-social-"+e.channel).find(".sp-preview-inner").css("background-color",e.data.color),jQuery("#chaty-social-"+e.channel).find(".chaty-color-field").val(e.data.color),jQuery("#chaty-social-"+e.channel).find(".channels__input").attr("placeholder",e.data.placeholder),jQuery("#chaty-social-"+e.channel).find(".channel-example").text(e.data.example),jQuery("#chaty-social-"+e.channel).find(".chaty-title").val(e.data.title),jQuery("#chaty-social-"+e.channel).find(".icon").attr("data-title",e.data.title),jQuery("#chaty-social-"+e.channel).find(".chaty-color-field").trigger("change"),jQuery(".help-section").html(""),""!=e.data.help_link?jQuery(".help-section").html('<div class="viber-help"><a target="_blank" href="'+e.data.help_link+'">'+e.data.help_title+"</a></div>"):""!=e.data.help_text&&jQuery(".help-section").html('<div class="viber-help"><span class="help-text">'+e.data.help_text+'</span><span class="help-title">'+e.data.help_title+"</span></div>"))}})}),jQuery(document).on("click","#chaty_icons_view",function(e){jQuery(".page-body .chaty-widget").removeClass("vertical").removeClass("horizontal"),jQuery(".page-body .chaty-widget").addClass(jQuery(this).val())}),jQuery(".upg").click(function(e){jQuery(".valid_domain_input").val(jQuery(".valid_domain_input").val().replace(" ","")),/^(http(s)?:\/\/)?(www\.)?[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/.test(jQuery(".valid_domain_input").val())||(e.preventDefault(),jQuery(".valid_domain").fadeIn().css({display:"block"}))}),jQuery(".del_token").click(function(t){e.ajax({type:"POST",url:ajaxurl,data:{action:"del_token",nonce_code:cht_nonce_ajax.cht_nonce},success:function(e){location.reload()},error:function(e,t,a){}})}),jQuery(document).on("blur","#channels-selected-list > li:not(#chaty-social-close) .channels__input",function(){jQuery(this).hasClass("border-red")&&""!=jQuery(this).val()&&jQuery(this).removeClass("border-red")}),jQuery(".easy-modal").easyModal({top:150,overlay:.2}),jQuery(".easy-modal-open").click(function(e){var t=jQuery(this).attr("href");jQuery(t).trigger("openModal"),e.preventDefault()}),jQuery(".easy-modal-close").click(function(e){e.preventDefault(),jQuery(".easy-modal").trigger("closeModal")});var t=1000000003;jQuery(".show_up").click(function(){t+=10,jQuery("#upgrade-modal").css({"z-index":t,display:"block","margin-left":"-258px"})}),jQuery(".color-picker-btn, .color-picker-btn-close, .color-picker-custom button").on("click",function(e){e.preventDefault(),jQuery(".color-picker").toggle(),jQuery(".color-picker-btn").toggle()}),jQuery(".color-picker-radio input").change(function(){var e=jQuery(this);if(jQuery('.color-picker-custom input[name="cht_custom_color"]').val(""),jQuery(".color-picker-custom .circle").html("?").css({"background-color":"#fff"}),e.prop("checked")){jQuery(".color-picker-radio input").prop("checked",!1),e.prop("checked",!0);var t=e.val(),a=e.prop("title")}else t=jQuery(".color-picker-custom input").val(),a="Custom";""!=t&&-1==t.indexOf("#")&&(t="#"+t),jQuery(".color-picker-btn .circle").css({backgroundColor:t}),jQuery(".color-picker-btn .text").text(a),jQuery("#chaty-social-close ellipse").attr("fill",t)}),jQuery(".color-picker-custom input").change(function(){jQuery(".color-picker-radio input").prop("checked",!1);var e=jQuery(this).val();""!=e&&-1==e.indexOf("#")&&(e="#"+e),jQuery(".color-picker-btn .circle").css({backgroundColor:e}),jQuery(".color-picker-btn .text").text("Custom"),jQuery("#chaty-social-close ellipse").attr("fill",e)}),jQuery('[name="cht_position"]').change(function(){jQuery("#positionCustom").prop("checked")?jQuery("#positionPro").show():jQuery("#positionPro").hide()}),jQuery(".update_token").on("click",function(t){t.preventDefault();var a=jQuery('input[name="cht_token"]').val();e.ajax({type:"POST",url:ajaxurl,data:{action:"add_token",nonce_code:cht_nonce_ajax.cht_nonce,token:a},beforeSend:function(e){},success:function(e){e?(alert("Your pro plan is activated"),location.reload()):alert("You`ve entered a wrong token")},error:function(e,t,a){}})}),jQuery("textarea[name=cht_cta]").keyup(function(e){jQuery(".tooltiptext span").html(jQuery(this).val()),0==jQuery(this).val().length?(jQuery(".cta").hide(200),jQuery(".tooltiptext span").hide(200)):(jQuery(".cta").show(300),jQuery(".tooltiptext span").show(200))})})}(jQuery),function(e){jQuery(document).ready(function(){!function(){function e(){var e=jQuery("#positionBottom"),t=jQuery("#positionSide"),a=jQuery(".preview .page .chaty-widget"),o=jQuery('[name="cht_position"]:checked').val();if("right"===o)a.css({right:"7px",left:"auto",bottom:"7px"});else if("left"===o)a.css({left:"7px",right:"auto",bottom:"7px"});else if("custom"===o){if(e.val())var c=e.val()+"px";else c="7px";if(t.val())var i=t.val()+"px";else i="7px";e.change(function(){c=jQuery("#positionBottom").val()+"px",a.css({bottom:c})}),t.change(function(){var e=jQuery('[name="positionSide"]:checked').val();i=jQuery(this).val()+"px","right"===e?(jQuery(".page-body .chaty-widget ").removeClass("chaty-widget-icons-left"),jQuery(".page-body .chaty-widget ").addClass("chaty-widget-icons-right"),a.css({right:i,left:"auto"})):"left"===e&&(jQuery(".page-body .chaty-widget ").removeClass("chaty-widget-icons-right"),jQuery(".page-body .chaty-widget ").addClass("chaty-widget-icons-left"),a.css({left:i,right:"auto"}))}),jQuery('[name="positionSide"]').change(function(){var e=jQuery('[name="positionSide"]:checked').val();"right"===e?(jQuery(".page-body .chaty-widget ").removeClass("chaty-widget-icons-left"),jQuery(".page-body .chaty-widget ").addClass("chaty-widget-icons-right"),a.css({right:i,left:"auto"})):"left"===e&&(jQuery(".page-body .chaty-widget ").removeClass("chaty-widget-icons-right"),jQuery(".page-body .chaty-widget ").addClass("chaty-widget-icons-left"),a.css({left:i,right:"auto"}))})}}jQuery(".color-picker-radio input").change(function(){var e=jQuery(this);e.prop("checked")?e.val():jQuery(".color-picker-custom input").val(),u()}),jQuery(".color-picker-custom input").change(function(){jQuery(this).val(),u()}),jQuery(document).on("change","#chaty_default_state",function(){u()}),jQuery("#cht_close_button, #trigger_on_time, #chaty_trigger_on_scroll").click(function(){u()}),function(){var e=jQuery("#widgetTooltip"),t=jQuery(".preview .page .icon");function a(){jQuery("[name=cht_cta]").val().length>=1?t.removeClass("no-tooltip"):t.addClass("no-tooltip")}a(),e.change(function(){a()})}(),e(),jQuery('input[name="cht_position"]').change(function(){var t=jQuery('[name="cht_position"]:checked').val();"right"===t?(jQuery(".page-body .chaty-widget ").removeClass("chaty-widget-icons-left"),jQuery(".page-body .chaty-widget ").addClass("chaty-widget-icons-right")):"left"===t&&(jQuery(".page-body .chaty-widget ").removeClass("chaty-widget-icons-right"),jQuery(".page-body .chaty-widget ").addClass("chaty-widget-icons-left")),e()})}(),jQuery(".popover").hide(),o();var t=jQuery(".channels-icons > .icon-sm"),a=jQuery(".social-inputs");function o(){jQuery("section").is("#pro")||(jQuery(".channels-selected__item").length<=1?(jQuery(".channels-selected__item").hide(),jQuery(".popover").hide()):jQuery(".channels-selected__item").length>=2&&jQuery(".channels-selected__item").show())}jQuery("input[name=cht_custom_color]").keyup(function(e){var t=jQuery(this).val();(jQuery(".circle").html(""),""!=t)&&(-1==t.indexOf("#")&&(t="#"+t),jQuery(".color-picker-custom .circle").css({"background-color":t}));jQuery(this).val().length<1&&jQuery(".color-picker-custom .circle").html("?")}),t.on("click",function(){0,o();var c=jQuery(this),i=c.data("social");a.find(".social-form-group");if(c.hasClass("active")){var n=","+jQuery(this).attr("data-social");return s=(s=jQuery(".add_slug").val()).replace(n,""),jQuery(".add_slug").val(s),s=s.replace(n,""),jQuery(".add_slug").val(s),s=s.replace(n,""),jQuery(".add_slug").val(s),s=s.replace(n,""),jQuery(".add_slug").val(s),void c.toggleClass("active")}if(t.addClass("disabled"),icon=jQuery(this).data("social"),"1"==jQuery(".add_slug").val().indexOf(icon)&&""!=jQuery(".add_slug").val()){var s;n=","+icon;s=(s=jQuery(".add_slug").val()).replace(n,""),jQuery(".add_slug").val(s),s=s.replace(n,""),jQuery(".add_slug").val(s),s=s.replace(n,""),jQuery(".add_slug").val(s)}else jQuery(".add_slug").val(jQuery(".add_slug").val()+","+jQuery(this).attr("data-social"));if(!jQuery("section").is("#pro")&&jQuery(".channels-icons > .icon.active").length>=2)return jQuery(".popover").show().effect("shake",{times:3},600),void t.removeClass("disabled");if(c.toggleClass("active"),jQuery("section").is("#pro"))var r="pro";else r="free";e.ajax({type:"POST",dataType:"json",url:ajaxurl,data:{action:"choose_social",social:i,nonce_code:cht_nonce_ajax.cht_nonce,version:r,widget_index:jQuery("#widget_index").val()},beforeSend:function(e){},success:function(a){var c=jQuery(a),i=c.find(".icon").data("title");jQuery('.channels-selected div[data-social="'+i+'"]').length||jQuery("#chaty-social-close").before(c),t.removeClass("disabled"),e("#iconWidget").show(),u(),o(),set_social_channel_order(),check_for_chaty_close_button(),jQuery(".chaty-color-field").spectrum({chooseText:"Submit",preferredFormat:"hex",showInput:!0,cancelText:"Cancel",move:function(e){jQuery(this).val(e.toHexString()),chaty_set_bg_color()}}),check_for_chaty_close_button()},error:function(e,t,a){}}),o()}),jQuery("body").on("click",".icon, .btn-cancel:not(.close-btn-set)",function(e){if(!jQuery(this).hasClass("close-btn-set")&&(e.preventDefault(),!jQuery(this).hasClass("icon")||!jQuery(this).hasClass("active"))){if(icon=jQuery(this).data("social"),jQuery(this).hasClass("btn-cancel")){jQuery('.icon.active[data-social^="'+icon+'"]').removeClass("active");var t=","+icon,a=jQuery(".add_slug").val();a=a.replace(t,""),jQuery(".add_slug").val(a)}jQuery("#chaty-social-"+icon).remove();jQuery(this).parent(".channels-selected__item"),jQuery(this).data("social");u(),o(),set_social_channel_order(),check_for_chaty_close_button()}}),jQuery(".btn-help").click(function(e){window.open("https://premio.io/help/chaty/","_blank")}),jQuery(".free-custom-radio, .free-custom-checkbox").on("click",function(e){e.preventDefault()});var c=jQuery("[name=cht_cta]"),i=jQuery(".preview .tooltip-show");c.keyup(function(){var e=jQuery(".preview .page .icon");c.val().length>=1?e.removeClass("no-tooltip"):e.addClass("no-tooltip"),i.attr("data-title",c.val())});var n,s,r='<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n </svg>',l=document.getElementById("iconWidget");jQuery(".color-picker-radio input:checked").val();function u(){var t,a,o=!1;if(jQuery(".single-channel-setting").addClass("active"),jQuery("#iconWidget").removeClass("img-p-active"),d()?(0===jQuery(".js-chanel-desktop:checked").length?(t=!1,jQuery(".page-body .chaty-widget").hide()):jQuery(".page-body .chaty-widget").show(),1===jQuery(".js-chanel-desktop:checked").length&&(t=jQuery(".js-chanel-desktop:checked").closest("li").find(".icon.icon-md").html(),jQuery(".js-chanel-desktop:checked").closest(".channels-selected__item").hasClass("img-active")&&jQuery("#iconWidget").addClass("img-p-active"),jQuery(".single-channel-setting").removeClass("active")),jQuery(".js-chanel-desktop:checked").length>1&&(t=r,o=!0)):(0===jQuery(".js-chanel-mobile:checked").length?(a=!1,jQuery(".page-body .chaty-widget").hide()):jQuery(".page-body .chaty-widget").show(),1===jQuery(".js-chanel-mobile:checked").length&&(a=jQuery(".js-chanel-mobile:checked").closest("li").find(".icon.icon-md").html(),jQuery(".js-chanel-mobile:checked").closest(".channels-selected__item").hasClass("img-active")&&jQuery("#iconWidget").addClass("img-p-active"),jQuery(".single-channel-setting").removeClass("active")),jQuery(".js-chanel-mobile:checked").length>1&&(a=r,o=!0)),n=t,s=a,d()?h(n,o):h(s,o),e("#iconWidget .pop-number").remove(),jQuery("#cht_pending_messages").is(":checked")){var c=jQuery("#cht_number_of_messages").val();""!=c&&c>0&&(e("#iconWidget").append("<span class='pop-number'>"+c+"</span>"),e("#iconWidget .pop-number").css("color",jQuery("#cht_number_color").val()),e("#iconWidget .pop-number").css("background",jQuery("#cht_number_bg_color").val()))}e("#cta-box span").css("color",e("#cht_cta_text_color").val()),e("#cta-box span").css("background",e("#cht_cta_bg_color").val()),e("#custom-css").html("<style>.preview .page .chaty-widget .icon:before {border-color: transparent "+e("#cht_cta_bg_color").val()+" transparent transparent } .preview .page .chaty-widget[style*='left: auto;'] .icon:before {border-color: transparent transparent transparent "+e("#cht_cta_bg_color").val()+"}</style>")}function h(e,t){if(l.innerHTML=e||"",t){var a=jQuery(".color-picker-custom input").val()?jQuery(".color-picker-custom input").val():jQuery(".color-picker-radio input:checked").val();if(""!=a)-1==a.indexOf("#")&&(a="#"+a);jQuery(".preview .page svg circle").css({fill:a}),jQuery("#chaty-social-close ellipse").attr("fill",a)}thisVal=jQuery("#chaty_default_state").val(),"open"==thisVal?jQuery(".hide-show-button").addClass("active"):jQuery(".hide-show-button").removeClass("active"),jQuery(".chaty-widget").removeClass("active").removeClass("hover").removeClass("click").removeClass("hide_arrow"),"open"==thisVal?(jQuery(".chaty-widget").addClass("active").addClass("click"),"open"==thisVal&&jQuery(o+":checked").length>1&&jQuery(".chaty-widget").addClass("hide_arrow")):"hover"==thisVal?jQuery(".chaty-widget").addClass("hover"):jQuery(".chaty-widget").addClass("click"),jQuery(".chaty-channels").html("");var o=".js-chanel-mobile";if(d())o=".js-chanel-desktop";"open"==thisVal&&jQuery(o+":checked").length>1?(jQuery("#chaty_attention_effect").val(""),jQuery("#chaty_attention_effect, .test_textarea").attr("disabled",!0),jQuery("#chaty_attention_effect option:first-child").text("Doesn't apply for the open state"),"Doesn't apply for the open state"!=jQuery(".test_textarea").val()&&jQuery(".test_textarea").attr("data-value",jQuery(".test_textarea").val()),jQuery(".test_textarea").val("Doesn't apply for the open state"),jQuery("#cht_number_of_messages").attr("disabled",!0),jQuery("#cht_pending_messages").attr("disabled",!0),jQuery(".disable-message").addClass("label-tooltip").addClass("icon"),jQuery("#cht_pending_messages").attr("checked",!1),jQuery(".pending-message-items").removeClass("active"),jQuery(".cta-action-radio input").attr("disabled",!0)):(jQuery("#chaty_attention_effect, .test_textarea").attr("disabled",!1),jQuery("#chaty_attention_effect option:first-child").text("None"),jQuery(".test_textarea").attr("placeholder",""),"Doesn't apply for the open state"==jQuery(".test_textarea").val()&&jQuery(".test_textarea").val(jQuery(".test_textarea").attr("data-value")),jQuery("#cht_number_of_messages").attr("disabled",!1),jQuery("#cht_pending_messages").attr("disabled",!1),jQuery(".disable-message").removeClass("label-tooltip").removeClass("icon"),jQuery(".cta-action-radio input").attr("disabled",!1)),jQuery(".page-body .chaty-widget").removeClass("vertical").removeClass("horizontal"),console.log(jQuery(o+":checked").length),jQuery(o+":checked").length>1?(jQuery(o+":checked").each(function(){var e=jQuery(this).closest("li").find(".icon").html(),t=(e=jQuery(this).closest("li").find(".icon").html(),jQuery(this).closest("li").find(".chaty-title").val()),a=jQuery(this).closest(".channels-selected__item").hasClass("img-active")?"img-active":"";""!=t&&(t="<span class='social-tooltip'>"+t+"</span>"),jQuery(".chaty-channels").append("<div class='social-item-box "+a+"'><span class='tooltip-icon'>"+e+"</span>"+t+"</div>")}),"open"==jQuery("#chaty_default_state").val()&&jQuery("#cht_close_button").is(":checked")?(jQuery("#iconWidget").css("display","block"),jQuery(".chaty-widget .tooltiptext").css("display","block"),jQuery(".chaty-widget").removeClass("hide-arrow")):"open"!=jQuery("#chaty_default_state").val()?(jQuery("#iconWidget").css("display","block"),jQuery(".chaty-widget .tooltiptext").css("display","block"),jQuery(".chaty-widget").removeClass("hide-arrow")):"open"==jQuery("#chaty_default_state").val()&&(jQuery("#iconWidget").hide(),jQuery(".chaty-widget .tooltiptext").hide(),jQuery(".chaty-widget").addClass("hide-arrow")),jQuery(".chaty-widget").removeClass("has-single"),jQuery(".page-body .chaty-widget").addClass(jQuery("#chaty_icons_view").val())):1==jQuery(o+":checked").length?("open"!=jQuery("#chaty_default_state").val()||jQuery("#cht_close_button").is(":checked")?"open"!=jQuery("#chaty_default_state").val()&&(jQuery("#iconWidget").css("display","block"),jQuery(".chaty-widget .tooltiptext").css("display","block"),jQuery(".chaty-widget").removeClass("hide-arrow")):(jQuery("#iconWidget").css("display","block"),jQuery(".chaty-widget .tooltiptext").css("display","block"),jQuery(".chaty-widget").removeClass("hide-arrow")),jQuery(".chaty-widget").addClass("has-single"),jQuery(".chaty-widget").removeClass("hide-arrow")):0==jQuery(o+":checked").length&&(jQuery("#iconWidget").hide(),jQuery(".chaty-widget .tooltiptext").hide(),jQuery(".chaty-widget").addClass("hide-arrow"),jQuery(".chaty-widget").removeClass("has-single")),jQuery(".chaty-channels .remove-icon-img").remove(),jQuery("#trigger_on_time").is(":checked")?jQuery("#chaty_trigger_time").attr("readonly",!1):jQuery("#chaty_trigger_time").attr("readonly",!0),jQuery("#chaty_trigger_on_scroll").is(":checked")?jQuery("#chaty_trigger_on_page_scroll").attr("readonly",!1):jQuery("#chaty_trigger_on_page_scroll").attr("readonly",!0),""==jQuery(".chaty-widget .tooltiptext").text()?jQuery(".chaty-widget .tooltiptext").hide():"open"==jQuery("#chaty_default_state").val()&&jQuery(o+":checked").length>1?jQuery(".chaty-widget .tooltiptext").hide():jQuery(".chaty-widget .tooltiptext").css("display","block")}function d(){return"checked"===jQuery("#previewDesktop").attr("checked")}jQuery("#testUpload").on("change",function(){this.value.length>0?document.querySelector(".js-upload").disabled=!1:(document.querySelector(".js-upload").disabled=!0,document.getElementById("uploadInput").checked=!1)}),jQuery(document).on("keyup","textarea.test_textarea",function(){u()}),jQuery(".js-switch-preview").on("change",function(){d()?jQuery(this).closest(".preview").removeClass("mobiel-view"):jQuery(this).closest(".preview").addClass("mobiel-view"),u()}),jQuery(document).on("change","input[name='cht_pending_messages']",function(){jQuery("#cht_pending_messages").is(":checked")?jQuery(".pending-message-items").addClass("active"):jQuery(".pending-message-items").removeClass("active"),u()}),jQuery(document).on("change","#cht_number_of_messages",function(){u()}),jQuery(document).on("keyup","#cht_number_of_messages",function(){u()}),jQuery(document).on("blur","#cht_number_of_messages",function(){u()}),jQuery(document).on("change",".js-chanel-icon",function(){u()}),jQuery(document).on("change",".js-widget-i",function(e){r=e.target.classList.contains("js-upload")?jQuery(".file-preview-image").last().parent().html():jQuery("i[data-type="+e.target.dataset.type+"]").html(),u()}),"chat-image"!==jQuery(".js-widget-i:checked").attr("data-type")&&(r=jQuery("i[data-type="+jQuery(".js-widget-i:checked").attr("data-type")+"]").html(),u())}),jQuery(document).ready(function(){jQuery(document).on("click",".chaty-popup-box button, #chaty-intro-popup",function(t){t.stopPropagation();var a=jQuery("#chaty_update_popup_status").val();e("#chaty-intro-popup").remove(),e.ajax({type:"POST",url:ajaxurl,data:{action:"update_popup_status",nonce:a},beforeSend:function(e){},success:function(e){},error:function(e,t,a){}})}),jQuery(document).on("click",".chaty-popup-box",function(e){e.stopPropagation()}),jQuery(document).on("click",".remove-chaty-options",function(t){t.preventDefault(),t.stopPropagation(),confirm("Are you sure you want to delete this widget?")&&e.ajax({type:"POST",url:ajaxurl,data:{action:"remove_chaty_widget",nonce_code:cht_nonce_ajax.cht_nonce,widget_index:jQuery("#widget_index").val()},beforeSend:function(e){},success:function(e){window.location=e},error:function(e,t,a){}})});window.location.href;window.location.href.indexOf("page=chaty-app&widget=")>-1&&jQuery("#toplevel_page_chaty-app .wp-submenu.wp-submenu-wrap li").each(function(){var e=jQuery(this).find("a").attr("href");void 0!==e&&(jQuery(this).removeClass("current"),window.location.href.indexOf(e)>-1&&e.indexOf("&widget=")>-1&&jQuery(this).addClass("current"))})})}(jQuery),jQuery(window).resize(function(){check_for_preview_pos()}),jQuery(window).scroll(function(){check_for_preview_pos()}),jQuery(document).ready(function(){check_for_preview_pos()});var totalPageOptions=0,pageOptionContent="",totalDateAndTimeOptions=0,dateAndTimeOptionContent="";jQuery(document).ready(function(){totalPageOptions=parseInt(jQuery(".chaty-page-option").length),pageOptionContent=jQuery(".chaty-page-options-html").html(),jQuery(".chaty-page-options-html").remove(),totalDateAndTimeOptions=parseInt(jQuery(".chaty-date-time-option").length),dateAndTimeOptionContent=jQuery(".chaty-date-and-time-options-html").html(),jQuery(".chaty-date-and-time-options-html").remove(),jQuery("#create-rule").click(function(){jQuery(".page-options").toggle()}),jQuery("#create-data-and-time-rule").click(function(){jQuery(".chaty-data-and-time-rules").toggle()}),jQuery(document).on("change","#chaty_attention_effect",function(){var e=jQuery(this).attr("data-effect");""!=e&&jQuery("#iconWidget").removeClass("chaty-animation-"+e),jQuery("#iconWidget").removeClass("start-now"),jQuery("#iconWidget").addClass("chaty-animation-"+jQuery(this).val()).addClass("start-now"),jQuery(this).attr("data-effect",jQuery(this).val())}),setInterval(function(){var e=jQuery("#chaty_attention_effect").attr("data-effect");""!=e?(jQuery("#iconWidget").removeClass("chaty-animation-"+e),jQuery("#iconWidget").removeClass("start-now"),setTimeout(function(){jQuery("#iconWidget").addClass("chaty-animation-"+jQuery("#chaty_attention_effect").val()).addClass("start-now")},1e3)):jQuery("#chaty_attention_effect").attr("data-effect",jQuery("#chaty_attention_effect").val())},5e3),jQuery(document).on("click",".remove-chaty",function(){jQuery(".page-options").toggle()}),jQuery(document).on("click",".remove-page-option",function(){jQuery(".chaty-data-and-time-rules ").toggle()}),jQuery("#image-upload-content .custom-control-label").click(function(e){return e.stopPropagation(),jQuery(this).closest(".custom-control").find("input[type=radio]").attr("checked",!0),jQuery(".js-widget-i").trigger("change"),!1}),jQuery(".chaty-color-field").spectrum({chooseText:"Submit",preferredFormat:"hex",cancelText:"Cancel",showInput:!0,move:function(e){jQuery(this).val(e.toHexString()),chaty_set_bg_color(),change_custom_preview()}}),jQuery(".chaty-color-field").change(function(){chaty_set_bg_color(),change_custom_preview()}),jQuery(".remove-chaty-img").on("click",function(e){e.stopPropagation()}),jQuery("#channels-selected-list").sortable({placeholder:"ui-chaty-state-hl",items:"li:not(#chaty-social-close)",update:function(e,t){set_social_channel_order(),change_custom_preview()}}),jQuery(".close-button-img img, .close-button-img .image-upload").click(function(){var e=wp.media({title:"Upload Image",multiple:!1,library:{type:"image"}}).open().on("select",function(t){var a=e.state().get("selection").first();imageData=a.toJSON(),jQuery(".close-button-img").addClass("active"),jQuery(".close-button-img input").val(imageData.id),jQuery(".close-button-img img").attr("src",imageData.url),change_custom_preview()})}),jQuery(".remove-close-img").click(function(){default_image=jQuery("#default_image").val(),jQuery(".close-button-img").removeClass("active"),jQuery(".close-button-img input").val(""),jQuery(".close-button-img img").attr("src",default_image),change_custom_preview()}),jQuery(document).on("click",".chaty-widget.click",function(e){e.preventDefault(),jQuery(".chaty-widget").toggleClass("active")}),jQuery(document).on("change",".url-options.cht-required",function(e){thisVal=jQuery(this).val(),siteURL=jQuery("#chaty_site_url").val(),newURL=siteURL,"page_has_url"==thisVal?newURL=siteURL:"page_contains"==thisVal?newURL=siteURL+"%s%":"page_start_with"==thisVal?newURL=siteURL+"s%":"page_end_with"==thisVal&&(newURL=siteURL+"%s"),jQuery(this).closest(".url-content").find(".chaty-url").text(newURL)}),check_for_chaty_close_button(),chaty_set_bg_color(),change_custom_preview(),jQuery(".chaty-settings.cls-btn a, .close-btn-set").click(function(e){e.preventDefault(),jQuery(".cls-btn-settings, .close-btn-set").toggleClass("active")}),0==jQuery("input[name='cht_position']:checked").length&&(jQuery("#right-position").attr("checked",!0),jQuery("input[name='cht_position']:checked").trigger("change")),0==jQuery("input[name='widget_icon']:checked").length&&(jQuery("input[name='widget_icon']:first").attr("checked",!0),jQuery("input[name='widget_icon']:checked").trigger("change")),jQuery(".form-fonts").on("change",function(){var e=jQuery(this).val();jQuery(".chaty-google-font").remove(),""!=e?("Default"!=jQuery(".form-fonts option:selected").data("group")&&jQuery("head").append('<link href="https://fonts.googleapis.com/css?family='+e+':400,600,700" rel="stylesheet" type="text/css" class="chaty-google-font">'),jQuery(".preview-section-chaty #admin-preview .page-body").css("font-family",e)):jQuery(".preview-section-chaty #admin-preview .page-body").attr("style","")})}),jQuery(window).load(function(){check_for_chaty_close_button(),chaty_set_bg_color(),jQuery(".chaty-page-options .chaty-page-option").removeClass("last"),jQuery(".chaty-page-options .chaty-page-option:last").addClass("last"),jQuery(".url-options.cht-required").each(function(){jQuery(this).trigger("change")});var e=jQuery(".form-fonts").val();jQuery(".chaty-google-font").remove(),""!=e&&("Default"!=jQuery(".form-fonts option:selected").data("group")&&jQuery("head").append('<link href="https://fonts.googleapis.com/css?family='+e+':400,600,700" rel="stylesheet" type="text/css" class="chaty-google-font">'),jQuery(".preview-section-chaty #admin-preview .page-body").css("font-family",e))});var selectedsocialSlug="";function upload_chaty_image(e){selectedsocialSlug=e;var t=wp.media({title:"Upload Image",multiple:!1,library:{type:"image"}}).open().on("select",function(e){var a=t.state().get("selection").first();imageData=a.toJSON(),jQuery("#cht_social_image_"+selectedsocialSlug).val(imageData.id),jQuery(".custom-image-"+selectedsocialSlug+" img").attr("src",imageData.url),jQuery("#chaty-social-"+selectedsocialSlug+" .channels-selected__item").addClass("img-active"),change_custom_preview()})}function toggle_chaty_setting(e){jQuery("#chaty-social-"+e).find(".chaty-advance-settings").toggle(),change_custom_preview()}function chaty_set_bg_color(){jQuery(".chaty-color-field").each(function(){""!=jQuery(this).val()&&"#ffffff"!=jQuery(this).val()&&("Linkedin"!=jQuery(this).closest("li").data("id")||"Linkedin"==jQuery(this).closest("li").data("id")&&"#ffffff"!=jQuery(this).val())&&(defaultColor=jQuery(this).val(),jQuery(this).closest(".channels-selected__item").find(".color-element").css("fill",defaultColor),jQuery(this).closest(".channels-selected__item").find(".custom-chaty-image").css("background",defaultColor),jQuery(this).closest(".channels-selected__item").find(".facustom-icon").css("background",defaultColor))}),change_custom_preview()}function upload_qr_code(){var e=wp.media({title:"Upload QR Image",multiple:!1,library:{type:"image"}}).open().on("select",function(t){var a=e.state().get("selection").first();imageData=a.toJSON(),jQuery("#upload_qr_code_val").val(imageData.id),jQuery("#upload_qr_code img").attr("src",imageData.url),jQuery(".remove-qr-code").addClass("active"),change_custom_preview()})}function remove_qr_code(){jQuery(".remove-qr-code").removeClass("active"),jQuery("#upload_qr_code_val").val(""),default_image=jQuery("#default_image").val(),jQuery("#upload_qr_code img").attr("src",default_image),change_custom_preview()}function remove_chaty_image(e){default_image=jQuery("#default_image").val(),jQuery("#chaty-social-"+e+" .channels-selected__item").removeClass("img-active"),jQuery("#cht_social_image_"+e).val(""),jQuery("#cht_social_image_src_"+e).attr("src",default_image),change_custom_preview()}var baseIcon='<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n </svg>',defaultIcon='<svg version="1.1" id="ch" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="-496 507.7 54 54" style="enable-background:new -496 507.7 54 54;" xml:space="preserve">\n <style type="text/css">.st0 {fill: #A886CD;} .st1 {fill: #FFFFFF;}\n </style><g><circle class="st0" cx="-469" cy="534.7" r="27"/></g><path class="st1" d="M-459.9,523.7h-20.3c-1.9,0-3.4,1.5-3.4,3.4v15.3c0,1.9,1.5,3.4,3.4,3.4h11.4l5.9,4.9c0.2,0.2,0.3,0.2,0.5,0.2 h0.3c0.3-0.2,0.5-0.5,0.5-0.8v-4.2h1.7c1.9,0,3.4-1.5,3.4-3.4v-15.3C-456.5,525.2-458,523.7-459.9,523.7z"/>\n <path class="st0" d="M-477.7,530.5h11.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-11.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,530.8-478.2,530.5-477.7,530.5z"/>\n <path class="st0" d="M-477.7,533.5h7.9c0.5,0,0.8,0.4,0.8,0.8l0,0c0,0.5-0.4,0.8-0.8,0.8h-7.9c-0.5,0-0.8-0.4-0.8-0.8l0,0\n C-478.6,533.9-478.2,533.5-477.7,533.5z"/>\n </svg>',iconBlock=document.getElementById("iconWidget");function set_social_channel_order(){socialString=[],jQuery("#channels-selected-list li").each(function(){socialString.push(jQuery(this).attr("data-id"))}),socialString=socialString.join(","),jQuery("#cht_numb_slug").val(socialString),check_for_chaty_close_button()}function check_for_chaty_close_button(){jQuery("#channels-selected-list > li:not(.chaty-cls-setting)").length>=2?jQuery("#chaty-social-close").show():jQuery("#chaty-social-close").hide(),change_custom_preview();var e="";jQuery("#channels-selected-list > li").each(function(){"undefined"!=jQuery(this).attr("data-id")&&""!=jQuery(this).attr("data-id")&&(e+=jQuery(this).attr("data-id")+","),e=e.trimRight(",")}),jQuery(".add_slug").val(e)}function change_custom_preview(){var e,t,a=!1;jQuery("#iconWidget").removeClass("img-p-active"),getChtPreviewDesktop()?(0===jQuery(".js-chanel-desktop:checked").length&&(e=!1),1===jQuery(".js-chanel-desktop:checked").length&&(e=jQuery(".js-chanel-desktop:checked").closest("li").find(".icon.icon-md").html(),jQuery(".js-chanel-desktop:checked").closest(".channels-selected__item").hasClass("img-active")&&jQuery("#iconWidget").addClass("img-p-active")),jQuery(".js-chanel-desktop:checked").length>1&&(e=defaultIcon,a=!0)):(0===jQuery(".js-chanel-mobile:checked").length&&(t=!1),1===jQuery(".js-chanel-mobile:checked").length&&(t=jQuery(".js-chanel-mobile:checked").closest("li").find(".icon.icon-md").html(),jQuery(".js-chanel-mobile:checked").closest(".channels-selected__item").hasClass("img-active")&&jQuery("#iconWidget").addClass("img-p-active")),jQuery(".js-chanel-mobile:checked").length>1&&(t=defaultIcon,a=!0)),desktopIcon=e,mobileIcon=t,getChtPreviewDesktop()?setChtIcon(desktopIcon,a):setChtIcon(mobileIcon,a),jQuery("#channels-selected-list > li.chaty-channel").length<=1?jQuery(".o-channel, .font-section").removeClass("active"):jQuery(".o-channel, .font-section").addClass("active")}function getChtPreviewDesktop(){return"checked"===jQuery("#previewDesktop").attr("checked")}function setChtIcon(e,t){if((iconBlock=document.getElementById("iconWidget")).innerHTML=e||"",t){var a=jQuery(".color-picker-custom input").val()?jQuery(".color-picker-custom input").val():jQuery(".color-picker-radio input:checked").val();jQuery(".preview .page svg circle").css({fill:a}),jQuery("#chaty-social-close ellipse").attr("fill",a)}jQuery(".js-widget-i:checked").trigger("change")}
cht-icons.php CHANGED
@@ -7,7 +7,7 @@
7
  Author URI: https://premio.io/downloads/chaty/
8
  Text Domain: chaty
9
  Domain Path: /languages
10
- Version: 2.6.5
11
  License: GPL2
12
  */
13
 
@@ -27,7 +27,7 @@ define('CHT_INC', CHT_DIR . '/includes');
27
  define('CHT_PRO_URL', admin_url("admin.php?page=chaty-app-upgrade"));
28
  define('CHT_PLUGIN_URL', plugin_dir_url(__FILE__));
29
  define('CHT_PLUGIN_BASE', plugin_basename(CHT_FILE));
30
- define('CHT_VERSION', "2.6.5");
31
 
32
  if (!function_exists('wp_doing_ajax')) {
33
  function wp_doing_ajax()
7
  Author URI: https://premio.io/downloads/chaty/
8
  Text Domain: chaty
9
  Domain Path: /languages
10
+ Version: 2.6.6
11
  License: GPL2
12
  */
13
 
27
  define('CHT_PRO_URL', admin_url("admin.php?page=chaty-app-upgrade"));
28
  define('CHT_PLUGIN_URL', plugin_dir_url(__FILE__));
29
  define('CHT_PLUGIN_BASE', plugin_basename(CHT_FILE));
30
+ define('CHT_VERSION', "2.6.6");
31
 
32
  if (!function_exists('wp_doing_ajax')) {
33
  function wp_doing_ajax()
readme.txt CHANGED
@@ -2,11 +2,11 @@
2
  Contributors: galdub, tomeraharon, premio
3
  Tags: whatsapp, whatsapp chat, facebook messenger, click to chat, chat, chat button, call now button, messenger, whatsapp button, chat icon, contact button, click to call
4
  Requires at least: 3.1
5
- Tested up to: 5.5
6
- Stable tag: 2.6.5
7
  Plugin URI: https://premio.io/downloads/chaty/
8
 
9
- Let your visitors contact you via Facebook Messenger, Whatsapp, Telegram, Viber, Email, Phone call, SMS and more with customizable chat & call buttons
10
 
11
  == Description ==
12
 
@@ -23,12 +23,12 @@ Show a chat button on the bottom of your site and communicate with your customer
23
  = The ultimate click to chat and call now button =
24
  Are you looking for a chat button or a click to call button? Want to make it easier for your potential customers to contact you via WhatsApp, Facebook Messenger or Telegram?
25
 
26
- Chaty is the perfect chat plugin for you! With Chaty you can display call widget, Whatsapp button, email button, SMS button, Google Maps button, Vkontakte button, Line.me button, Viber button and other chat widgets. Your visitors are already using their favorite chat apps, and most of them prefer to contact you using those chat apps. By using Chaty, you give your website visitors the option to chat with you even after they leave your website. Want to use our robust pro version? Check out <a href="https://premio.io/downloads/chaty/?utm_source=wordpressorg" target="_blank" title="Chaty pro plans"><strong>Chaty Pro Plans</strong></a>.
27
 
28
  = What can you do with Chaty =
29
  Here are some classic use cases for Chaty
30
 
31
- * Chaty VS live chat alternatives - there's a big benefit in giving your visitors the option to use the chat channels they already use. When you use "regular" live chat alternatives, your visitors must stay on your website and wait for your response. When you let your visitors chat with you using chat apps like Facebook Messenger, WhatsApp, Viber, Telegram, etc, you give them to freedom of chatting with you whenever they go.
32
  * A direct click to chat method - show your visitors the chat channels you're available at, and let them choose the method that suits them. Your website visitors are one click away from chatting with you.
33
  * Help your website visitors navigate to your address - if you have a physical business and want your visitors to be able to navigate to you with ease, you can use our Google Maps and Waze channels.
34
  * Click to call - show a phone icon and let your visitors click to call you. If you want to show different local phone numbers based on page URL you can use the multi widget pro feature.
@@ -70,7 +70,7 @@ Link to an external channel/contact page (New feature: add 2 custom buttons and
70
  3. Add a custom Call-To-Action message besides your chat widget and set its display frequency
71
  4. Set a display trigger - decide when the widget will appear for the first time. You can show it after a few seconds, on page scroll, or use our powerful exit intent trigger. When you choose more than one trigger, the widget will appear when the first trigger takes place. The exit intent trigger will help you get your website's visitors' attention when they plan to leave your website.
72
  5. Attention effect - choose from 5 stunning attention effects including bounce, waggle, sheen, spin, and fade. Your attention effect will help you capture the attention of your website visitors. Once the see your chat widget, your conversation rate will increase significantly.
73
- 6. Pending messages icon - increase your chat button click-rate by displaying a pending messages icon with the number of pending messages near your Chaty widget to let your visitors know that you're waiting for them to contact you.
74
  6. Fully customize all chat icons including colors and text on hover. You can also translate the "Hide" text to your language now :)
75
  7. Choose between 7 different colors.
76
  8. New! Show your chat buttons vertical mode or horizontal mode.
@@ -107,7 +107,7 @@ Different chats buttons based on purpose (support, sales, etc)
107
  8. Create a pre-set WhatsApp chat message and pre-set email subject line. When people click on your WhatsApp button or email icon, you pre-set message will be automatically loaded
108
  9. Fire a Google Analytics event every time one of your channels buttons is clicked. That's great news for you, because now you can fully track any click to call, chat, navigate, and more
109
  10. Available days and hours - display the widget on specific days and hours based on your opening days and hours. E.g. You can show live chat channels like Facebook Messenger and WhatsApp on certain days & hours, and when you're not available for live chat you can display email and Instagram.
110
- 11. New! Country targeting - show different chat button for different countries. For example, you can show Line, Viber, WeChat, and Whatsapp chat for Chinese users, and Facebook Messenger, email button, and SMS text icon for visitors from the US.
111
  12. New! Add your own custom CSS.
112
  13. New! Duplicate your Chaty widget to save time and use the same settings and chat channels from another widget
113
  Works great for multi-language websites and WPML plugin, for different products, landing pages, and any other URL targeting rule.
@@ -130,17 +130,17 @@ Works great for multi-language websites and WPML plugin, for different products,
130
 
131
  * Skype - Skype is a telecommunications app that provides free online voice calls, video chat calls, messaging, affordable international calling to mobiles or landlines. Add your Skype username and let your visitors call and message you easily via Skype.
132
 
133
- * Vkontakte - is a russian online social network. Vkontakte is available in a few languages and it is very popular among Russian-speaking users. Add you Vkontakte username and let your visitors contact you directly through the app.
134
 
135
  * LinkedIn icon - link to your LinkedIn profile so your vistors can connect with you and send you direct messages.
136
 
137
  * Phone (click to call) - one of the most useful cases. Add your phone number and let your visitors call you in a click of a button. Call now button is very popular for mobile visitors and can help you get more calls easily.
138
 
139
- * Telegram - is a instant messaging and voice over IP app developed by Telegram Messenger LLP. Add your Telegram username and let your visitors contact your directly via Telegram app.
140
 
141
  * Line.me - Line is a free app for instant communications on desktop and mobile devices. With Line you can send texts, images, video and audio, and conduct free VoIP conversations and video conferences. Add your Line URL and let your visitors contact you easily via Line app.
142
 
143
- * WeChat - is a Chinese multi-purpose messaging, social media and mobile payment app. Add your WeChat User ID and let your visitors search for you easily WeChat app. In the pro plan, you can upload a QR code.
144
 
145
  * Slack - Slack is a business chat and communication platform that enables organizations to communicate better. Add your Slack workspace and give your visitors the option to find your Slack workspace and chat with you.
146
 
@@ -184,7 +184,7 @@ We don't store any local data about your visitors. Any time your visitors click
184
  You can choose up to two channels (unlimited in the pro plan), display the widget on mobile and desktop, choose from 6 available colors (unlimited in the pro plan), position the widget on the left or right (custom positioning in the pro plan), custom call-to-action.
185
 
186
  = Is there a time limit for the free plan? =
187
- No. you can use the free plan as long as you want.
188
 
189
  = Will Chaty work with any theme and page builder? =
190
  Yes! Chaty works great with all themes and page builders including Elementor, Divi, Visual Composer, WPBakery, Beaver, SiteOrigin, Gutenberg, WooCommerce and more
@@ -232,6 +232,9 @@ Yes! You can even decide what chat buttons will show up on each device (desktop/
232
 
233
 
234
  == Changelog ==
 
 
 
235
  = 2.6.5 =
236
  You can change the background color of the call-to-action message + bug fixes
237
 
2
  Contributors: galdub, tomeraharon, premio
3
  Tags: whatsapp, whatsapp chat, facebook messenger, click to chat, chat, chat button, call now button, messenger, whatsapp button, chat icon, contact button, click to call
4
  Requires at least: 3.1
5
+ Tested up to: 5.6
6
+ Stable tag: 2.6.6
7
  Plugin URI: https://premio.io/downloads/chaty/
8
 
9
+ Whatsapp, Facebook Messenger, Telegram, Viber, Email, Phone call, SMS and more with customizable chat & call buttons. Chat with your visitors on WhatsApp, Facebook Messenger, and other chat channels!
10
 
11
  == Description ==
12
 
23
  = The ultimate click to chat and call now button =
24
  Are you looking for a chat button or a click to call button? Want to make it easier for your potential customers to contact you via WhatsApp, Facebook Messenger or Telegram?
25
 
26
+ Chaty is the perfect chat plugin for you! With Chaty you can display a call widget, Whatsapp button, email button, SMS button, Google Maps button, Vkontakte button, Line.me button, Viber button and other chat widgets. Your visitors are already using their favorite chat apps, and most of them prefer to contact you using those chat apps. By using Chaty, you give your website visitors the option to chat with you even after they leave your website. Want to use our robust pro version? Check out <a href="https://premio.io/downloads/chaty/?utm_source=wordpressorg" target="_blank" title="Chaty pro plans"><strong>Chaty Pro Plans</strong></a>.
27
 
28
  = What can you do with Chaty =
29
  Here are some classic use cases for Chaty
30
 
31
+ * Chaty VS live chat alternatives - there's a big benefit in giving your visitors the option to use the chat channels they already use. When you use "regular" live chat alternatives, your visitors must stay on your website and wait for your response. When you let your visitors chat with you using chat apps like Facebook Messenger, WhatsApp, Viber, Telegram, etc, you give them the freedom of chatting with you whenever they go.
32
  * A direct click to chat method - show your visitors the chat channels you're available at, and let them choose the method that suits them. Your website visitors are one click away from chatting with you.
33
  * Help your website visitors navigate to your address - if you have a physical business and want your visitors to be able to navigate to you with ease, you can use our Google Maps and Waze channels.
34
  * Click to call - show a phone icon and let your visitors click to call you. If you want to show different local phone numbers based on page URL you can use the multi widget pro feature.
70
  3. Add a custom Call-To-Action message besides your chat widget and set its display frequency
71
  4. Set a display trigger - decide when the widget will appear for the first time. You can show it after a few seconds, on page scroll, or use our powerful exit intent trigger. When you choose more than one trigger, the widget will appear when the first trigger takes place. The exit intent trigger will help you get your website's visitors' attention when they plan to leave your website.
72
  5. Attention effect - choose from 5 stunning attention effects including bounce, waggle, sheen, spin, and fade. Your attention effect will help you capture the attention of your website visitors. Once the see your chat widget, your conversation rate will increase significantly.
73
+ 6. Pending messages icon - increase your chat button click-rate by displaying a pending messages icon with the number of pending messages in your Chaty widget to let your visitors know that you're waiting for them to contact you.
74
  6. Fully customize all chat icons including colors and text on hover. You can also translate the "Hide" text to your language now :)
75
  7. Choose between 7 different colors.
76
  8. New! Show your chat buttons vertical mode or horizontal mode.
107
  8. Create a pre-set WhatsApp chat message and pre-set email subject line. When people click on your WhatsApp button or email icon, you pre-set message will be automatically loaded
108
  9. Fire a Google Analytics event every time one of your channels buttons is clicked. That's great news for you, because now you can fully track any click to call, chat, navigate, and more
109
  10. Available days and hours - display the widget on specific days and hours based on your opening days and hours. E.g. You can show live chat channels like Facebook Messenger and WhatsApp on certain days & hours, and when you're not available for live chat you can display email and Instagram.
110
+ 11. New! Country targeting - show a different chat button for different countries. For example, you can show Line, Viber, WeChat, and Whatsapp chat for Chinese users, and Facebook Messenger, email button, and SMS text icon for visitors from the US.
111
  12. New! Add your own custom CSS.
112
  13. New! Duplicate your Chaty widget to save time and use the same settings and chat channels from another widget
113
  Works great for multi-language websites and WPML plugin, for different products, landing pages, and any other URL targeting rule.
130
 
131
  * Skype - Skype is a telecommunications app that provides free online voice calls, video chat calls, messaging, affordable international calling to mobiles or landlines. Add your Skype username and let your visitors call and message you easily via Skype.
132
 
133
+ * Vkontakte - is a russian online social network. Vkontakte is available in a few languages and it is very popular among Russian-speaking users. Add your Vkontakte username and let your visitors contact you directly through the app.
134
 
135
  * LinkedIn icon - link to your LinkedIn profile so your vistors can connect with you and send you direct messages.
136
 
137
  * Phone (click to call) - one of the most useful cases. Add your phone number and let your visitors call you in a click of a button. Call now button is very popular for mobile visitors and can help you get more calls easily.
138
 
139
+ * Telegram - is a instant messaging and voice over IP app developed by Telegram Messenger LLP. Add your Telegram username and let your visitors contact you directly via Telegram app.
140
 
141
  * Line.me - Line is a free app for instant communications on desktop and mobile devices. With Line you can send texts, images, video and audio, and conduct free VoIP conversations and video conferences. Add your Line URL and let your visitors contact you easily via Line app.
142
 
143
+ * WeChat - is a Chinese multi-purpose messaging, social media and mobile payment app. Add your WeChat User ID and let your visitors search for you easily with the WeChat app. In the pro plan, you can upload a QR code.
144
 
145
  * Slack - Slack is a business chat and communication platform that enables organizations to communicate better. Add your Slack workspace and give your visitors the option to find your Slack workspace and chat with you.
146
 
184
  You can choose up to two channels (unlimited in the pro plan), display the widget on mobile and desktop, choose from 6 available colors (unlimited in the pro plan), position the widget on the left or right (custom positioning in the pro plan), custom call-to-action.
185
 
186
  = Is there a time limit for the free plan? =
187
+ No. You can use the free plan as long as you want.
188
 
189
  = Will Chaty work with any theme and page builder? =
190
  Yes! Chaty works great with all themes and page builders including Elementor, Divi, Visual Composer, WPBakery, Beaver, SiteOrigin, Gutenberg, WooCommerce and more
232
 
233
 
234
  == Changelog ==
235
+ = 2.6.6 =
236
+ Triggers and devices selection bug fixed for the mobile chat buttons
237
+
238
  = 2.6.5 =
239
  You can change the background color of the call-to-action message + bug fixes
240
 
views/admin/popup.php CHANGED
@@ -41,7 +41,7 @@
41
  </div>
42
  <input type="hidden" id="delete_widget_id" value="">
43
  <div class="chaty-popup-footer">
44
- <button type="button" class="close-chaty-popup-btn channel-setting-btn btn btn-primary">Select Device</button>
45
  <button type="button" class="btn btn-default check-for-triggers">Save Anyway</button>
46
  </div>
47
  </div>
41
  </div>
42
  <input type="hidden" id="delete_widget_id" value="">
43
  <div class="chaty-popup-footer">
44
+ <button type="button" class="close-chaty-popup-btn channel-setting-btn btn btn-primary">Select Channel</button>
45
  <button type="button" class="btn btn-default check-for-triggers">Save Anyway</button>
46
  </div>
47
  </div>