try { (function () { if (typeof jQuery != "function") { console.log("jQuery not found!"); return false; } /* if ( typeof $ != 'function' ) { $ = jQuery; } */ jQuery(".btn-restore-default").click(function () { var a = jQuery(this).attr("data-set") || ""; var b = 'input[id="' + a + '"]'; jQuery(b).val(jQuery(b).attr("placeholder") || ""); preview_before_update_epa_option(); }); jQuery(".show-preview-after-change").change(function () { preview_before_update_epa_option(); }); jQuery("#html_template").change(function () {
jQuery(".hide-if-change-template").hide(); a = jQuery("#html_template").val() || "";
if (a == "call_mes" || a == "call_sms_mes" || a == "call_sms_zalo_mes") { jQuery(".show-if-using-smstemplate").fadeIn(); if (a == "call_sms_zalo_mes") { jQuery(".phonering-alo-zalo").show(); } else { jQuery(".phonering-alo-zalo").hide(); if (a == "call_mes") { jQuery(".phonering-alo-sms").hide(); } else { jQuery(".phonering-alo-sms").show(); } } } else if (a == "call_number") { jQuery(".echbay-phone-number").fadeIn(); } else { jQuery(".echbay-alo-phone").fadeIn(); } }); setTimeout(function () { jQuery("#html_template").change();
preview_before_update_epa_option(); }, 1000); })(); } catch (e) { console.log("stack: " + (e.stackTrace || e.stack)); } function EPA_hexToRgbColor(hex) { var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
/* return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : null; */ return result ? parseInt(result[1], 16) + "," + parseInt(result[2], 16) + "," + parseInt(result[3], 16) : ""; } function preview_before_update_epa_option() { var a = jQuery("#header_bg").val() || "",
dynamic_css = jQuery("#css_for_preview_epa").html();
a = jQuery.trim(a); if (a != "") { dynamic_css = dynamic_css.replace(/\{jmp\.header_bg\}/gi, a); } a = jQuery("#sms_bg").val() || "";
a = jQuery.trim(a); if (a != "") { dynamic_css = dynamic_css.replace(/\{jmp\.sms_bg\}/gi, a); } a = jQuery("#messenger_bg").val() || "";
a = jQuery.trim(a); if (a != "") { dynamic_css = dynamic_css.replace(/\{jmp\.messenger_bg\}/gi, a); } jQuery(".epa-exemple-preview-css").html("<style>" + dynamic_css + "</style>"); a = jQuery("#custom_icon").val() || "";
a = jQuery.trim(a); if (a != "") { jQuery(".phonering-alo-ph-img-circle a").addClass(a); } else { jQuery(".phonering-alo-ph-img-circle a").removeAttr("class"); } a = jQuery("#phone_number").val() || "";
a = jQuery.trim(a); if (a == "") { jQuery(".epa_preview_click_to_call").attr({ href: "javasciprt:;", }); } else { a = a.toString().replace(/[^0-9|\-|\+]/g, ""); jQuery(".epa_preview_click_to_call").attr({ href: "tel:" + a, }); jQuery(".epa_preview_click_to_sms").attr({ href: "sms:" + a, }); } a = jQuery("#messenger_full_url").val() || "";
a = jQuery.trim(a); if (a != "") { } else { a = jQuery("#messenger_url").val() || "";
a = jQuery.trim(a); if (a == "") { a = "javasciprt:;"; } else { a = "https://m.me/" + a;
} } jQuery(".epa_preview_click_to_messenger").attr({ href: a, }); } function check_before_update_epa_option() { var f = document.echbay_config_for_epa; f._epa_phone_number.value = jQuery.trim(f._epa_phone_number.value); f._epa_messenger_url.value = f._epa_messenger_url.value .split("/") .pop() .split("&")[0] .split("?")[0] .split("#")[0];
preview_before_update_epa_option(); } 