1(function ($, Drupal) { 2 Drupal.behaviors.hubspotIntegration = { 3 attach: function (context, settings) { 4 $(once('hubspot_integration', 'html', context)).each(function () { 5 6 if (getCookie("hubspotutk") != '' && getCookie("hubspot_integration") == '' && settings.hubspot_integration.anonymous_contact == true) { 7 var contactLimitReached = false; 8 $.get('/hubspot_integration/ajax/is-limit-reached', function (data) { 9 contactLimitReached = data.data.is_limit_reached; 10 }, 'json'); 11 12 if (contactLimitReached == false) { 13 var template = "" + settings.hubspot_integration.mail_template; 14 var mail = template.replace('[hub_cookie]', getCookie("hubspotutk")); 15 var _hsq = window._hsq = window._hsq || []; 16 _hsq.push(["identify", { 17 email: mail 18 }]); 19 } 20 21 $.get('/hubspot_integration/ajax/is-contact', function (data) { 22 if (data.data.is_contact == true) { 23 setCookie('hubspot_integration', data.data.cookie); 24 } 25 }, 'json'); 26 } 27 28 $('div[data-type="hubspot"]').each(function() { 29 hbspt.forms.create({ 30 portalId: $(this).attr("data-portal-id"), 31 formId: $(this).attr("data-form-id"), 32 target: '#hs-' + $(this).attr("data-form-id"), 33 }); 34 }); 35 36 }) 37 } 38 }; 39 40 function getCookie(cname) { 41 var name = cname + "="; 42 var ca = document.cookie.split(';'); 43 for (var i = 0; i < ca.length; i++) { 44 var c = ca[i]; 45 while (c.charAt(0) == ' ') { 46 c = c.substring(1); 47 } 48 if (c.indexOf(name) == 0) { 49 return c.substring(name.length, c.length); 50 } 51 } 52 return ""; 53 } 54 55 function setCookie(cname, cvalue, exdays) { 56 var d = new Date(); 57 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 58 var expires = "expires=" + d.toUTCString(); 59 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 60 } 61})(jQuery, Drupal);
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.