1(function ($) { 2 var wa_time_out, wa_time_in; 3 $(document).ready(function () { 4 $(".wa__btn_popup").on("click", function () { 5 if ($(".wa__popup_chat_box").hasClass("wa__active")) { 6 $(".wa__popup_chat_box").removeClass("wa__active"); 7 $(".wa__btn_popup").removeClass("wa__active"); 8 clearTimeout(wa_time_in); 9 if ($(".wa__popup_chat_box").hasClass("wa__lauch")) { 10 wa_time_out = setTimeout(function () { 11 $(".wa__popup_chat_box").removeClass("wa__pending"); 12 $(".wa__popup_chat_box").removeClass("wa__lauch"); 13 }, 400); 14 } 15 } else { 16 $(".wa__popup_chat_box").addClass("wa__pending"); 17 $(".wa__popup_chat_box").addClass("wa__active"); 18 $(".wa__btn_popup").addClass("wa__active"); 19 clearTimeout(wa_time_out); 20 if (!$(".wa__popup_chat_box").hasClass("wa__lauch")) { 21 wa_time_in = setTimeout(function () { 22 $(".wa__popup_chat_box").addClass("wa__lauch"); 23 }, 100); 24 } 25 } 26 }); 27 28 function setCookie(cname, cvalue, exdays) { 29 var d = new Date(); 30 d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000); 31 var expires = "expires=" + d.toUTCString(); 32 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 33 } 34 35 function getCookie(cname) { 36 var name = cname + "="; 37 var ca = document.cookie.split(";"); 38 for (var i = 0; i < ca.length; i++) { 39 var c = ca[i]; 40 while (c.charAt(0) == " ") { 41 c = c.substring(1); 42 } 43 if (c.indexOf(name) == 0) { 44 return c.substring(name.length, c.length); 45 } 46 } 47 return ""; 48 } 49 50 $("#nta-wa-gdpr").change(function () { 51 if (this.checked) { 52 setCookie("nta-wa-gdpr", "accept", 30); 53 if (getCookie("nta-wa-gdpr") != "") { 54 $(".nta-wa-gdpr").hide(500); 55 $(".wa__popup_content_item").each(function () { 56 $(this).removeClass("pointer-disable"); 57 $(".wa__popup_content_list").off("click"); 58 }); 59 } 60 } 61 }); 62 63 if (getCookie("nta-wa-gdpr") != "") { 64 $(".wa__popup_content_list").off("click"); 65 } else { 66 $(".wa__popup_content_list").click(function () { 67 $(".nta-wa-gdpr").delay(500).css({ background: "red", color: "#fff" }); 68 }); 69 } 70 71 // google analytics 72 if (ntaWA.ga) { 73 $("a.wa__stt_online").click(function () { 74 var href = $(this).attr("href"); 75 var startPhone = href.indexOf("phone=") + 6; 76 var endPhone = href.indexOf("&text="); 77 if (endPhone === -1) { 78 endPhone = href.length; 79 } 80 var phone = href.substring(startPhone, endPhone); 81 var gaCategory = "NinjaTeam WhatsApp"; 82 var gaAction = "Phone Number: " + phone; 83 var gaLabel = document.title; 84 85 if (typeof gtag !== "undefined") { 86 gtag("event", gaAction, { 87 event_category: gaCategory, 88 event_label: gaLabel, 89 }); 90 return; 91 } 92 if (typeof ga !== "undefined" && typeof ga.getAll !== "undefined") { 93 var tracker = ga.getAll(); 94 tracker[0].send("event", gaCategory, gaAction, gaLabel); 95 return; 96 } 97 98 if (typeof __gaTracker !== "undefined") { 99 __gaTracker("send", "event", gaCategory, gaAction, gaLabel); 100 } 101 }); 102 } 103 104 function isMobileWA() { 105 return /Android|webOS|iPhone|iPad|iPod|Windows Phone|IEMobile|Mobile|BlackBerry/i.test(navigator.userAgent); 106 } 107 var elm = jQuery('a[href*="whatsapp.com"]'); 108 jQuery.each(elm, function (index, value) { 109 var item = jQuery(value).attr("href"); 110 if (item.indexOf("chat") != -1) { 111 //nothing 112 } else if (item.indexOf("web.whatsapp") != -1 && isMobileWA()) { 113 var itemLink = item; 114 var newLink = itemLink.replace("web.whatsapp", "api.whatsapp"); 115 jQuery(value).attr("href", newLink); 116 } else if (item.indexOf("api.whatsapp") != -1 && !isMobileWA()) { 117 var itemLink = item; 118 var newLink = itemLink.replace("api.whatsapp", "web.whatsapp"); 119 jQuery(value).attr("href", newLink); 120 } 121 });
122 }); 123})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.