1$ = jQuery.noConflict(); 2 3$(function() { 4 var htmlHandler = $('html'); 5 6 htmlHandler.on('click', '#menu-opener', function() { 7 $(this).toggleClass('active'); 8 $('#mobile-menu').toggleClass('opened'); 9 if ($('#mobile-menu').hasClass('opened')) { 10 $('body').css('overflow-y', 'hidden'); 11 } else { 12 $('body').css('overflow-y', 'auto'); 13 } 14 }); 15 16 htmlHandler.on('click', '.show-popup-form', function() { 17 $('#popup').find('input[name="subject"]').val($(this).data('subject')); 18 $('#popup').fadeIn(); 19 }); 20 21 htmlHandler.on('click', '.show-popup-offer-form', function() { 22 $('#popup').find('input[name="subject"]').val($(this).data('subject')); 23 $('#popup-offer').fadeIn(); 24 }); 25 26 htmlHandler.on('click', '.close-popup', function() { 27 $('#popup').fadeOut(); 28 }); 29 30 htmlHandler.on('click', '.close-popup-offer', function() { 31 $('#popup-offer').fadeOut(); 32 }); 33 34 htmlHandler.on('click', '.show-offerform', function() { 35 $('#popup-offer').fadeIn(); 36 }); 37 38 htmlHandler.on('click', '.close-offerform', function() { 39 $('#popup-offer').fadeOut(); 40 }); 41 42 $('.services-slider .slider').slick({ 43 variableWidth: true, 44 slidesToScroll: 1, 45 infinite: true, 46 speed: 1000, 47 autoplay: true, 48 autoplaySpeed: 5000, 49 prevArrow: '.slider-arrow-left', 50 nextArrow: '.slider-arrow-right', 51 }); 52 53 $('.team-slider .slider').slick({ 54 slidesToShow: 2, 55 slidesToScroll: 1, 56 infinite: true, 57 speed: 1000, 58 autoplay: true, 59 autoplaySpeed: 5000, 60 prevArrow: '.team-slider-arrow-left', 61 nextArrow: '.team-slider-arrow-right', 62 responsive: [ 63 { 64 breakpoint: 1025, 65 settings: { 66 slidesToShow: 1, 67 }, 68 }, 69 ], 70 }); 71 72 $('#home-slider .slider').slick({ 73 slidesToScroll: 1, 74 infinite: true, 75 speed: 2000, 76 autoplay: true, 77 autoplaySpeed: 5000, 78 prevArrow: '.home-slider-left', 79 nextArrow: '.home-slider-right', 80 pauseOnHover: false, 81 pauseOnFocus: false, 82 fade: true, 83 }); 84 85 htmlHandler.on('click', '.our-rules .show-tab', function() { 86 var that = $(this); 87 var target = that.data('target'); 88 that.parents('ul').find('.active').removeClass('active'); 89 that.parent('li').addClass('active'); 90 $('.our-rules .tabs-content').find('.active').removeClass('active'); 91 $(target).addClass('active'); 92 }); 93 94 if (window.location.hash) { 95 setTimeout(function() { 96 var anchor = $(window.location.hash); 97 $('html,body').animate({scrollTop: anchor.offset().top}); 98 }, 500); 99 } 100 101 // Iterate over each select element 102 $('select').each(function() { 103 104 // Cache the number of options 105 var $this = $(this), numberOfOptions = $(this).children('option').length; 106 107 if ($this.prop('multiple')) { 108 return; 109 } 110 111 // Hides the select element 112 $this.addClass('s-hidden'); 113 114 // Wrap the select element in a div 115 $this.wrap('<div class="select"></div>'); 116 117 // Insert a styled div to sit over the top of the hidden select element 118 $this.after('<div class="styledSelect"></div>'); 119 120 // Cache the styled div 121 var $styledSelect = $this.next('div.styledSelect'); 122 123 // Show the first select option in the styled div 124 $styledSelect.text($this.children('option').eq(0).text()); 125 126 // Insert an unordered list after the styled div and also cache the list 127 var $list = $('<ul />', { 128 'class': 'options', 129 }).insertAfter($styledSelect); 130 131 // Insert a list item into the unordered list for each select option 132 for (var i = 0; i < numberOfOptions; i++) { 133 $('<li />', { 134 text: $this.children('option').eq(i).text(), 135 rel: $this.children('option').eq(i).val(), 136 }).appendTo($list); 137 } 138 139 // Cache the list items 140 var $listItems = $list.children('li'); 141 142 // Show the unordered list when the styled div is clicked (also hides it if the div is clicked again) 143 $styledSelect.click(function(e) { 144 e.stopPropagation(); 145 $('div.styledSelect.active').each(function() { 146 $(this).removeClass('active').next('ul.options').hide(); 147 }); 148 $(this).toggleClass('active').next('ul.options').toggle(); 149 }); 150 151 // Hides the unordered list when a list item is clicked and updates the styled div to show the selected list item 152 // Updates the select element to have the value of the equivalent option 153 $listItems.click(function(e) { 154 e.stopPropagation(); 155 $styledSelect.text($(this).text()).removeClass('active'); 156 var userType = $(this).attr('rel'); 157 var relatedSelect = $styledSelect.parent('.select').find('select'); 158 var relatedId = $(relatedSelect).attr('id'); 159 $this.val(userType); 160 $list.hide(); 161 162 if (relatedId === 'your-subject') { 163 let isClient = userType === 'Cliente' || userType === 'Quiero ser cliente'; 164 $('#00N5w00000QJ7cE').prop('required', isClient); 165 $('#company').prop('required', isClient); 166 if (!isClient) { 167 var companyErrorDiv = $('#company').parent('.has-error'); 168 var serviceErrorDiv = $('#00N5w00000QJ7cE').parent('.has-error'); 169 $(companyErrorDiv).removeClass('has-error'); 170 $(serviceErrorDiv).removeClass('has-error'); 171 } 172 } 173 174 /* alert($this.val()); Uncomment this for demonstration! */ 175 var $errorDiv = $styledSelect.parents('.has-error'); 176 if ($errorDiv.length > 0 && $this.val() !== '') { 177 $errorDiv.removeClass('has-error'); 178 } 179 }); 180 181 // Hides the unordered list when clicking outside of it 182 $(document).click(function() { 183 $styledSelect.removeClass('active'); 184 $list.hide(); 185 }); 186 }); 187 188 var form = $('.contact-form-wrapper form'); 189 var submitButton = $('.contact-form-wrapper form input[type="submit"]'); 190 var agreementRadio = $('.contact-form-wrapper form input[name="acepto_tyc"]'); 191 var agreementParent = agreementRadio.parents('.field-wrapper'); 192 $(submitButton).on('click', function(event) { 193 var emptyTextFields = $('.contact-form-wrapper form input[type="text"]').filter(function() { 194 var isRequiredEmpty = $(this).val() === '' && $(this).prop('required'); 195 if (isRequiredEmpty) { 196 $(this).parent('.field-wrapper').addClass('has-error'); 197 return true; 198 } 199 }).length; 200 201 var emptyRequiredEmails = $('.contact-form-wrapper form input[type="email"]').filter(function() { 202 var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; 203 var isRequiredEmpty = $(this).val() === '' && $(this).prop('required'); 204 var isEmail = regex.test($(this).val()); 205 if (isRequiredEmpty || !isEmail) { 206 $(this).parent('.field-wrapper').addClass('has-error'); 207 return true; 208 } 209 }).length; 210 211 var emptySelectFields = $('.contact-form-wrapper form select').filter(function() { 212 var isRequiredEmpty = $(this).prop('required'); 213 if (isRequiredEmpty && ( 214 $(this).val() === '' 215 || $(this).val() === null 216 || ($(this).prop('multiple') && $(this).val().length === 0) 217 )) { 218 $(this).parents('.field-wrapper').addClass('has-error'); 219 return true; 220 } 221 }).length; 222 223 if (emptyTextFields + emptySelectFields + emptyRequiredEmails !== 0) { 224 event.preventDefault(); 225 return false;
226 } 227 228 if (agreementRadio.prop('required') && !agreementRadio.is(':checked')) { 229 agreementParent.addClass('has-error'); 230 event.preventDefault(); 231 return false; 232 } else if (agreementParent.hasClass('has-error') && agreementRadio.is(':checked')) { 233 agreementParent.removeClass('has-error'); 234 } 235 236 if ($('#your-subject').val() === 'Cliente' || $('#your-subject').val() === 'Quiero ser cliente') { 237 event.preventDefault(); 238 $(this).prop('disabled', true); 239 form.attr('action', '//eficacia.topleads.co/proc.php'); 240 sendCombineResponse(); 241 } 242 }); 243 244 $('.contact-form-wrapper form input[type="text"]').on('focusout', function() { 245 if ($(this).val() !== '') { 246 var fieldWithError = $(this).parents('.has-error'); 247 fieldWithError.removeClass('has-error'); 248 } 249 }); 250 251 $('.contact-form-wrapper form input[type="email"]').on('focusout', function() { 252 if ($(this).val() !== '') { 253 var fieldWithError = $(this).parents('.has-error'); 254 fieldWithError.removeClass('has-error'); 255 } 256 }); 257 258 agreementRadio.on('click', function() { 259 if (agreementParent.hasClass('has-error')) { 260 agreementParent.removeClass('has-error'); 261 } 262 }) 263 264 $('.multiple-select option').mousedown(function(e) { 265 e.preventDefault(); 266 $(this).prop('selected', !$(this).prop('selected')); 267 var $multipleErrorDiv = $('.multiple-select').parent('.field-wrapper'); 268 var isMultipleSelect = $('.multiple-select').prop('multiple'); 269 var isRequired = $('.multiple-select').prop('required'); 270 var hasAtLeastOneOptionSelected = $('.multiple-select').val().length > 0; 271 var hasError = $multipleErrorDiv.hasClass('has-error'); 272 273 if (isMultipleSelect && isRequired && hasAtLeastOneOptionSelected && hasError) { 274 $($multipleErrorDiv).removeClass('has-error'); 275 } else if (isMultipleSelect && isRequired && !hasAtLeastOneOptionSelected) { 276 $($multipleErrorDiv).addClass('has-error'); 277 } 278 279 return false; 280 }); 281 282 $('.solution-content').on('hide.bs.collapse', function(e) { 283 var collapsedSolutionId = e.currentTarget.id; 284 var relatedImage = $('.solution-image[data-parent="#' + collapsedSolutionId + '"]'); 285 $(relatedImage).collapse('hide'); 286 }); 287 288 $('.solution').on('transitionstart', function(event) { 289 if (event.originalEvent && event.originalEvent.propertyName === 'width') { 290 $('.solution .actions-wrapper').fadeOut('fast'); 291 $('.solution .description').fadeOut('fast'); 292 } 293 }); 294 295 $('.solution').on('transitionend', function(event) { 296 if (event.originalEvent && event.originalEvent.propertyName === 'width') { 297 var solutionBox = $(event.currentTarget); 298 var solutionBoxWidth = $(event.currentTarget).length 299 ? $(event.currentTarget).outerWidth() 300 : 0; 301 var solutionWrapperWidth = $('.solutions-wrapper__desktop').length 302 ? $('.solutions-wrapper__desktop').width() / 2 303 : 0; 304 305 if (solutionBoxWidth > solutionWrapperWidth) { 306 solutionBox.find('.actions-wrapper').fadeIn('slow'); 307 solutionBox.find('.description').fadeIn('slow'); 308 } 309 310 if (solutionBoxWidth === solutionWrapperWidth) { 311 $('.solution .description').fadeIn('fast'); 312 } 313 } 314 }); 315 316 $('.show-offer-button').on('click', function(event) { 317 event.preventDefault(); 318 $('#solution-offer-presentation .collapse').collapse('hide'); 319 var targetLink = $(this).data('target'); 320 $(targetLink).collapse('show'); 321 }); 322 323 if ($('.about .item').length > 0) { 324 var maxTitleHeight = 0; 325 var maxDescriptionHeight = 0; 326 $('.about .item').each(function() { 327 maxTitleHeight = Math.max(maxTitleHeight, $(this).find('.title').height()); 328 maxDescriptionHeight = Math.max(maxDescriptionHeight, $(this).find('.description').height()); 329 }); 330 331 $('.about .item .title').height(maxTitleHeight); 332 $('.about .item .description').height(maxDescriptionHeight); 333 } 334 335 $('.navbar .dropdown-toggle').on('click', function() { 336 if ($(this).attr('aria-expanded') === 'true') { 337 var dropdownLink = $(this).attr('href'); 338 window.location.href = dropdownLink; 339 } 340 }); 341 342 $('.linkedin-share-button').on('click', function(e) { 343 e.preventDefault(); 344 var linkedinShareUrl = $(this).attr('href'); 345 if (linkedinShareUrl) { 346 window.open(linkedinShareUrl, '', '_blank, width=500, height=500, resizable=yes, scrollbars=yes'); 347 return false;
348 } 349 }); 350}); 351 352/** port from TopLeads integration **/ 353window._load_script = function(url, callback) { 354 var head = document.querySelector('head'), script = document.createElement('script'), r = false; 355 script.type = 'text/javascript'; 356 script.charset = 'utf-8'; 357 script.src = url; 358 if (callback) { 359 script.onload = script.onreadystatechange = function() { 360 if (!r && (!this.readyState || this.readyState == 'complete')) { 361 r = true; 362 callback(); 363 } 364 }; 365 } 366 head.appendChild(script); 367}; 368function sendCombineResponse() { 369 const formDOM = document.getElementById('_form_1_'); 370 if (formDOM) { 371 const originalForm = new FormData(formDOM); 372 const topLeadsForm = new FormData(); 373 topLeadsForm.append('u','1'); 374 topLeadsForm.append('f','1'); 375 topLeadsForm.append('s',''); 376 topLeadsForm.append('c','0'); 377 topLeadsForm.append('m','0'); 378 topLeadsForm.append('act','sub'); 379 topLeadsForm.append('v','2'); 380 topLeadsForm.append('or','a57b4511c995ded2cb84296175cea52a'); 381 topLeadsForm.append('field[4]',originalForm.get('your-subject')); 382 topLeadsForm.append('firstname',originalForm.get('first_name')); 383 topLeadsForm.append('lastname',originalForm.get('last_name')); 384 topLeadsForm.append('email',originalForm.get('email')); 385 topLeadsForm.append('phone',originalForm.get('phone')); 386 topLeadsForm.append('field[1]',originalForm.get('company')); 387 topLeadsForm.append('field[2]',originalForm.get('00N5w00000QJ7cE')); 388 topLeadsForm.append('field[3]',originalForm.get('00N5w00000QJ7c4')); 389 topLeadsForm.append('field[6]',originalForm.get('acepto_tyc')); 390 let serialized = new URLSearchParams(topLeadsForm).toString() 391 .replace(/%0A/g, '\\n') 392 .replace(/%5B/g, '[') 393 .replace(/%5D/g, ']'); 394 _load_script('//eficacia.topleads.co/proc.php?' + serialized + '&jsonp=true'); 395 } 396} 397 398// create empty function to prevent console error 399window._show_error = function(id, message, html) { 400 const submitButton = $('.contact-form-wrapper form input[type="submit"]'); 401 submitButton.prop('disabled', false); 402 submitButton.after("<div class='text-danger font-semibold mt-2'>"+message+"</div>"); 403} 404 405window._show_thank_you = function(id, message, trackcmp_url, email) { 406 var form = $('.contact-form-wrapper form'); 407 console.log(form); 408 form.attr('action', 'https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8'); 409 form.submit(); 410};
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.