1jQuery(document).ready(function ($) { 2 /*===== Js For SVG =====*/ 3 jQuery(function () { 4 activate('img[src*=".svg"]'); 5 function activate(string) { 6 jQuery(string).each(function () { 7 var $img = jQuery(this); 8 var imgID = $img.attr('id'); 9 var imgClass = $img.attr('class'); 10 var imgURL = $img.attr('src'); 11 jQuery.get(imgURL, function (data) { 12 var $svg = jQuery(data).find('svg'); 13 if (typeof imgID !== 'undefined') { 14 $svg = $svg.attr('id', imgID); 15 } 16 if (typeof imgClass !== 'undefined') { 17 $svg = $svg.attr('class', imgClass + ' replaced-svg'); 18 } 19 $svg = $svg.removeAttr('xmlns:a'); 20 $img.replaceWith($svg); 21 22 }, 'xml'); 23 }); 24 } 25 }); 26 27 28 /*===== LAZY LOAD =====*/ 29 jQuery(document).ready(function ($) { 30 function lazyimg() { 31 var imgDefer = document.getElementsByTagName('img'); 32 for (var i = 0; i < imgDefer.length; i++) { 33 if (imgDefer[i].getAttribute('data-src' 34 )) { 35 imgDefer[i].setAttribute('src', imgDefer[i].getAttribute('data-src' 36 )); 37 } 38 } 39 var imgbgDefer = document.querySelectorAll('[data-src-bg]'); 40 var style = "background-image: url({url})"; 41 for (var i = 0; i < imgbgDefer.length; i++) { 42 imgbgDefer[i].setAttribute('style', style.replace("{url}", imgbgDefer[i].getAttribute('data-src-bg'))); 43 } 44 } 45 lazyimg(); 46 $(document).ajaxComplete(function () { 47 lazyimg(); 48 }); 49 }); 50 51 52 /*===== Small Header =====*/ 53 jQuery(window).scroll(function () { 54 if (jQuery(this).scrollTop() > 0) { 55 jQuery('#header').addClass('small-header'); 56 } else { 57 jQuery('#header').removeClass('small-header'); 58 } 59 }); 60 if (jQuery(this).scrollTop() > 0) { 61 jQuery('#header').addClass('small-header'); 62 } else { 63 jQuery('#header').removeClass('small-header'); 64 } 65 jQuery("input").focus(function () { 66 jQuery(this).next("span").fadeOut(1000); 67 }); 68 69 jQuery("textarea").focus(function () { 70 jQuery(this).next("span").fadeOut(1000); 71 }); 72 // Show search box 73$('.search-icon').on('click', function () { 74 $('.header-search-box input.search').val(''); // Clear input 75 $('.search-input-wrap .msg-side-form').addClass('d-none'); // Hide error 76 $('#responsive-menu-button').hide(); 77 $('.header-search-box, .header-search').addClass('open-search'); 78}); 79 80// Close search box 81$('.closebtn').on('click', function () { 82 $('body').removeClass('no-scroll'); 83 $('#responsive-menu-button').show(); 84 $('.header-search-box').removeClass('open-search'); 85 $('.search-input-wrap .msg-side-form').addClass('d-none'); 86 $('.header-search-box input.search').val(''); // Clear on close 87}); 88 89// Add error message only once 90if ($('.search-input-wrap .msg-side-form').length === 0) { 91 $('<span class="msg-side-form d-none">Required</span>').insertAfter('.search-input-wrap input.search'); 92} 93 94// Validate input on click of button (assumed ID) 95$('#site-searchs').on('click', function (e) { 96 let searchVal = $('.search-input-wrap input.search').val().trim(); 97 98 if (searchVal === '') { 99 e.preventDefault(); 100 $('.search-input-wrap .msg-side-form').removeClass('d-none'); 101 } else { 102 $('.search-input-wrap .msg-side-form').addClass('d-none'); 103 $('.searchform').trigger('submit'); // Trigger form submit 104 } 105}); 106 107// On typing, remove error message 108$('.search-input-wrap input.search').on('input', function () { 109 let val = $(this).val().replace(/\s{2,}/g, ' '); 110 $(this).val(val); 111 $('.search-input-wrap .msg-side-form').addClass('d-none'); 112}); 113 114// Prevent submit if empty (form submit check) 115$('.searchform').on('submit', function (e) { 116 let val = $('.search-input-wrap input.search').val().trim(); 117 if (val === '') { 118 e.preventDefault(); 119 $('.search-input-wrap .msg-side-form').removeClass('d-none'); 120 return false;
121 } 122 return true; 123}); 124 125 /*===== Hamburger Button =====*/ 126 if ($('.menu-bar-wrapper li').hasClass('menu-item-has-children')) { 127 $(".menu-item-has-children > a").after("<span class='sidebar-menu-arrow'></span>"); 128 } 129 var $toggleButton = $('.menu_icon'), 130 $menuWrap = $('.menu-wrap'), 131 $sidebarArrow = $('.sidebar-menu-arrow'); 132 $toggleButton.on('click', function () { 133 $(this).toggleClass('button-open'); 134 $menuWrap.toggleClass('menu-show'); 135 }); 136 jQuery('.sidebar-menu-arrow').click(function () { 137 if (jQuery(this).next().is(':visible')) { 138 jQuery(this).next().slideUp(300); 139 } else { 140 jQuery(this).next().slideDown(300); 141 } 142 if (jQuery(this).hasClass('responsive-up-arrow')) { 143 jQuery(this).removeClass('responsive-up-arrow'); 144 } else { 145 jQuery(this).addClass('responsive-up-arrow'); 146 } 147 }); 148 jQuery('.menu_icon').on('click', function () { 149 jQuery('body').toggleClass('nav-open-menu'); 150 }); 151 152 /*===== Slick Slider =====*/ 153 jQuery('.home-hero-slider').slick({ 154 155 }); 156}); 157/*===== Popup =====*/ 158jQuery('.html5lightbox').click(function () { 159 jQuery('body').addClass('noscroll'); 160}); 161jQuery(document).click(function (e) { 162 var targetbox = jQuery('#html5-lightbox-box'); 163 if (!targetbox.is(e.target) && targetbox.has(e.target).length === 0) { 164 jQuery('body').removeClass('noscroll'); 165 } 166}); 167jQuery(document).ajaxComplete(function () { 168 jQuery(".html5lightbox").html5lightbox(); 169}); 170 171 172jQuery(document).ready(function ($) { 173 //load more post 174 jQuery(".default-cat-hide").hide(); 175 jQuery(".default-cat-hide:nth-child(-n+6)").show(); 176 jQuery("#default-more-post").on('click', function () { 177 jQuery(".default-cat-hide:hidden").slice(0, 6).slideDown(); 178 if (jQuery(".default-cat-hide:hidden").length == 0) { 179 jQuery("#default-more-post").fadeOut('1500'); 180 } 181 }); 182 183 if (jQuery(".default-cat-hide").length <= 6) { 184 jQuery("#default-more-post").fadeOut('1500'); 185 } 186}); 187jQuery(document).ready(function ($) { 188 //load more post 189 jQuery(".default-cat-hide").hide(); 190 jQuery(".default-cat-hide:nth-child(-n+8)").show(); 191 jQuery("#default-more-post").on('click', function () { 192 jQuery(".default-cat-hide:hidden").slice(0, 8).slideDown(); 193 if (jQuery(".default-cat-hide:hidden").length == 0) { 194 jQuery("#default-more-post").fadeOut('1500'); 195 } 196 }); 197 198 if (jQuery(".default-cat-hide").length <= 6) { 199 jQuery("#default-more-post").fadeOut('1500'); 200 } 201}); 202 203 204 205jQuery(document).ready(function ($) { 206 //load more post 207 jQuery(".parent-menu").hide(); 208 jQuery(".parent-menu:nth-child(-n+6)").show(); 209 jQuery("#more-menu").on('click', function () { 210 jQuery(".parent-menu:hidden").slice(0, 6).slideDown(); 211 if (jQuery(".parent-menu:hidden").length == 0) { 212 jQuery("#more-menu").fadeOut('1500'); 213 } 214 }); 215 216 if (jQuery(".parent-menu").length <= 6) { 217 jQuery("#more-menu").fadeOut('1500'); 218 } 219}); 220 221jQuery('.wpcf7 input[type="text"], .wpcf7 textarea').attr("onpaste", "return false"); 222jQuery('.wpcf7 input[type="text"], .wpcf7 textarea').attr("oncopy", "return false"); 223 224 225 226 227jQuery(".wpcf7-form-control").attr("onpaste", "return false"); 228 229jQuery('[data-name="FirstName"] input, [data-name="LastName"] input, [data-name="firstName"] input, [data-name="lastName"] input, [data-name="FullName"] input').bind('keydown', function (event) { 230 var key = event.which; 231 if (key >= 48 && key <= 57) { 232 event.preventDefault(); 233 } 234 if (key >= 96 && key <= 105) { 235 event.preventDefault(); 236 } 237}); 238jQuery('[data-name="FirstName"] input, [data-name="LastName"] input, [data-name="firstName"] input, [data-name="lastName"] input, [data-name="FullName"] input').bind('[data-name="FirstName"] input, [data-name="LastName"] input, [data-name="FullName"] input', function () { 239 var c = this.selectionStart, 240 r = /[^a-z0-9 .]/gi, 241 v = jQuery(this).val(); 242 if (r.test(v)) { 243 jQuery(this).val(v.replace(r, '')); 244 c--; 245 } 246 this.setSelectionRange(c, c); 247}); 248 249jQuery('[data-name="FirstName"] input, [data-name="firstName"] input, [data-name="emailAddress"] input[type="email"], [data-name="EmailAddress"] input[type="email"]').on({
250 keydown: function (e) { 251 if (e.which === 32) 252 return false; 253 }, 254 change: function () { 255 this.value = this.value.replace(/\s/g, ""); 256 } 257}); 258jQuery('.wpcf7-form input, .wpcf7-form textarea').on('keydown', function (e) { 259 if (e.which === 32 && e.target.selectionStart === 0) { 260 return false; 261 } 262}); 263 264jQuery('input[name="FullName"], input[name="FirstName"], input[name="LastName"], input[name="firstName"], input[name="lastName"], input[name="Subject"], input[name="SpanishFullName"], input[name="SpanishYourName"], input[name="SpanishFirstName"], input[name="SpanishLastName"], input[name="SpanishSubject"]').on('keydown', function (event) { 265 if (event.key >= '0' && event.key <= '9') { 266 event.preventDefault(); 267 } 268}); 269jQuery('[data-name="LastName"] input, [data-name="lastName"] input').on('keydown', function (e) { 270 var key = e.which; 271 272 // Allow A-Z, a-z, Backspace, Delete, Arrow keys, Tab 273 if ( 274 (key >= 65 && key <= 90) || // AâZ 275 key === 8 || key === 46 || // Backspace, Delete 276 key === 9 || // Tab 277 (key >= 37 && key <= 40) // Arrow keys 278 ) { 279 return true; 280 } 281 282 // Allow ONE space if not already present 283 if (key === 32 && !this.value.includes(' ')) { 284 return true; 285 } 286 287 // Block everything else 288 e.preventDefault(); 289}); 290 291jQuery('input[name="FullName"], input[name="SpanishFullName"], input[name="SpanishYourName"], input[name="SpanishSubject"], input[name="Subject"]').on('input', function () { 292 var inputVal = jQuery(this).val(); 293 jQuery(this).val(inputVal ? inputVal.trimStart() : ''); 294}); 295 296// In first and last name fields add charcter limit. 297jQuery('[data-name="FirstName"] input, [data-name="LastName"] input, [data-name="firstName"] input, [data-name="lastName"] input, [data-name="FullName"] input').bind('keydown', function (event) { 298 jQuery(this).attr("maxlength", "50"); 299}); 300jQuery('[data-name="SpanishFirstName"] input, [data-name="SpanishLastName"] input, [data-name="SpanishFullName"] input').bind('keydown', function (event) { 301 jQuery(this).attr("maxlength", "50"); 302}); 303 304// Form Validation Message 305jQuery(document).ready(function ($) { 306 // Define custom validation method for email 307 jQuery.validator.addMethod('validEmail', function (value, element) { 308 var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; 309 return this.optional(element) || emailPattern.test(value); 310 }, 'Please enter valid email address.'); 311jQuery('[data-name="Zipcode"] input').keypress(function(e) { 312 var charCode = (e.which) ? e.which : e.keyCode; 313 if (charCode > 31 && (charCode < 48 || charCode > 57)) { // Numbers are 48-57 314 e.preventDefault(); 315 } 316}); 317jQuery.validator.addMethod("validPhone", function (value, element) { 318 var digits_only = value.replace(/\D/g, ''); 319 var total_length = value.length; 320 321 return this.optional(element) || (digits_only.length >= 10 && total_length <= 20); 322 }, "Please enter a valid phone number (10 digits minimum, max 20 characters)."); 323 324 // Prevent typing disallowed characters in multiple phone number fields 325 jQuery(document).on("input", "input[name='PhoneNumber'], input[name='SpanishPhone'], input[name='phoneNumber']", function () { 326 this.value = this.value.replace(/[^0-9+\-\(\)\s]/g, ''); 327 328 if (this.value.length > 20) { 329 this.value = this.value.substring(0, 20); 330 } 331 }); 332jQuery.validator.addMethod("zipCodeValidation", function(value, element) { 333 return /^\d{5}$/.test(value); 334}, "Please enter a valid zip code."); 335 // Validation rules and messages 336 var validationRules = { 337 rules: { 338 FullName: "required", 339 YourName: "required", 340 FirstName: "required", 341 firstName: "required", 342 LastName: "required", 343 gameattended: "required", 344 ticketnumber: "required", 345 lastName: "required", 346 PhoneNumber: { 347 required: true, 348 validPhone: true 349 }, 350 phoneNumber: { 351 required: true, 352 validPhone: true 353 }, 354 Subject: "required", 355 Message: "required", 356 yourMessage: "required", 357 Client: "required", 358 Zipcode: { 359 zipCodeValidation: true 360 }, 361 SpanishFullName: "required", 362 SpanishYourName: "required", 363 SpanishFirstName: "required", 364 SpanishLastName: "required", 365 SpanishPhone: { 366 required: true, 367 validPhone: true 368 }, 369 SpanishSubject: "required", 370 SpanishMessage: "required", 371 SpanishClient: "required", 372 EmailAddress: { 373 required: true, 374 validEmail: true // Use the custom email validation method 375 }, 376 emailAddress: { 377 required: true, 378 validEmail: true // Use the custom email validation method 379 }, 380 SpanishEmailAddress: { 381 required: true, 382 validEmail: true // Use the custom email validation method 383 } 384 }, 385 messages: { 386 FullName: "Please enter your name.", 387 YourName: "Please enter your name.", 388 FirstName: "Please enter your first name.", 389 LastName: "Please enter your last name.", 390 gameattended: "Please enter game attended", 391 ticketnumber: "Please enter ticket number", 392 PhoneNumber: "Please enter valid phone number.", 393 EmailAddress: "Please enter valid email address.", 394 firstName: "Please enter your first name.", 395 lastName: "Please enter your last name.", 396 phoneNumber: "Please enter valid phone number.", 397 emailAddress: "Please enter valid email address.", 398 Client: "Please fill the field.", 399 Zipcode: "Please enter valid zip code.", 400 Message: "Please enter your message.", 401 yourMessage: "Please enter your message.", 402 SpanishFirstName: "Por favor escriba su nombre.", 403 SpanishLastName: "Por favor ingrese su apellido.", 404 SpanishFullName: "Por favor, escriba su nombre.", 405 SpanishYourName: "Por favor, escriba su nombre.", 406 SpanishPhone: "Por favor ingrese un número de teléfono válido.", 407 SpanishEmailAddress: "Por favor ingrese una dirección de correo electrónico válida.", 408 SpanishClient: "Por favor ingresa a este campo.", 409 SpanishMessage: "Por favor ingrese su mensaje." 410 } 411 }; 412 413 // Apply validation rules to each form individually 414 $(".wpcf7-form").each(function () {
415 $(this).validate(validationRules); 416 }); 417 418 // Handle form submission 419 $(".wpcf7-form .wpcf7-submit").on("click", function (event) { 420 var form = $(this).closest('.wpcf7-form'); 421 if (!form.valid()) { 422 event.preventDefault(); 423 form.validate(validationRules).focusInvalid(); 424 } 425 }); 426}); 427 428 429 430jQuery('#teamslider').slick({ 431 autoplay: false, 432 dots: true, 433 arrow: true, 434 infinite: true, 435 autoplaySpeed: 1500, 436 slidesToShow: 3, 437 pauseOnHover: false, // Prevent pause on hover 438 pauseOnFocus: false, // Prevent pause on focus 439 slidesToScroll: 1, 440 prevArrow: '<button class="prev-arrow"><svg width="9" height="15" viewBox="0 0 9 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M0.419749 6.65585L7.1041 0.00664586L8.7661 1.67744L2.91715 7.49564L8.73535 13.3446L7.06456 15.0066L0.415357 8.32225C0.195005 8.10066 0.0716806 7.80063 0.0725043 7.48814C0.073328 7.17564 0.198233 6.87627 0.419749 6.65585Z" fill="#FDFDFD"/></svg></button>', 441 nextArrow: '<button class="next-arrow"><svg width="9" height="15" viewBox="0 0 9 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.65498 8.3332L1.98818 15L0.321776 13.3336L6.15537 7.5L0.321777 1.6664L1.98818 1.98651e-07L8.65498 6.6668C8.87591 6.8878 9.00003 7.1875 9.00003 7.5C9.00003 7.8125 8.87591 8.1122 8.65498 8.3332Z" fill="#FDFDFD"/></svg></button>' 442}); 443 444jQuery('.logo-slider').slick({ 445 autoplay: true, 446 autoplaySpeed: 1500, 447 dots: false, 448 infinite: true, 449 slidesToShow: 5, 450 pauseOnHover: false, 451 pauseOnFocus: false, 452 slidesToScroll: 1, 453 responsive: [ 454 { 455 breakpoint: 1024, 456 settings: { 457 slidesToShow: 3 458 } 459 }, 460 { 461 breakpoint: 767, 462 settings: { 463 slidesToShow: 2 464 } 465 }, 466 { 467 breakpoint: 576, 468 settings: { 469 slidesToShow: 1 470 } 471 } 472 ] 473}); 474 475jQuery('.case-slider').slick({ 476 autoplay: true, 477 autoplaySpeed:1500, 478 dots: false, 479 infinite: true, 480 slidesToShow: 3, 481 pauseOnHover: false, // Prevent pause on hover 482 pauseOnFocus: false, // Prevent pause on focus 483 slidesToScroll: 1, 484 responsive: [ 485 { 486 breakpoint: 1024, 487 settings: { 488 slidesToShow: 3 489 } 490 }, 491 { 492 breakpoint: 767, 493 settings: { 494 slidesToShow: 1 495 } 496 } 497 ] 498}); 499 500// jQuery('#testimonialslider').slick({ 501// autoplay: false, 502// dots: false, 503// infinite: false, 504// autoplaySpeed: 1500, 505// slidesToShow: 1, 506// slidesToScroll: 1, 507// prevArrow: '<button class="prev-arrow"><svg width="9" height="15" viewBox="0 0 9 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M0.419749 6.65585L7.1041 0.00664586L8.7661 1.67744L2.91715 7.49564L8.73535 13.3446L7.06456 15.0066L0.415357 8.32225C0.195005 8.10066 0.0716806 7.80063 0.0725043 7.48814C0.073328 7.17564 0.198233 6.87627 0.419749 6.65585Z" fill="#FDFDFD"/></svg></button>', 508// nextArrow: '<button class="next-arrow"><svg width="9" height="15" viewBox="0 0 9 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.65498 8.3332L1.98818 15L0.321776 13.3336L6.15537 7.5L0.321777 1.6664L1.98818 1.98651e-07L8.65498 6.6668C8.87591 6.8878 9.00003 7.1875 9.00003 7.5C9.00003 7.8125 8.87591 8.1122 8.65498 8.3332Z" fill="#FDFDFD"/></svg></button>' 509// }); 510 511jQuery(document).ready(function($) { 512 var sliderTimer = 3500; 513 var beforeEnd = 500; 514 var $testimonialslider = $('#testimonialslider'); 515 $testimonialslider.slick({ 516 autoplay: false, 517 dots: false, 518 infinite: true, 519 autoplaySpeed: 3500, 520 pauseOnHover: false, // Prevent pause on hover 521 pauseOnFocus: false, // Prevent pause on focus 522 slidesToShow: 1, 523 slidesToScroll: 1, 524 prevArrow: '<button class="prev-arrow"><svg width="9" height="15" viewBox="0 0 9 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M0.419749 6.65585L7.1041 0.00664586L8.7661 1.67744L2.91715 7.49564L8.73535 13.3446L7.06456 15.0066L0.415357 8.32225C0.195005 8.10066 0.0716806 7.80063 0.0725043 7.48814C0.073328 7.17564 0.198233 6.87627 0.419749 6.65585Z" fill="#FDFDFD"/></svg></button>', 525 nextArrow: '<button class="next-arrow"><svg width="9" height="15" viewBox="0 0 9 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.65498 8.3332L1.98818 15L0.321776 13.3336L6.15537 7.5L0.321777 1.6664L1.98818 1.98651e-07L8.65498 6.6668C8.87591 6.8878 9.00003 7.1875 9.00003 7.5C9.00003 7.8125 8.87591 8.1122 8.65498 8.3332Z" fill="#FDFDFD"/></svg></button>' 526}); 527 528function progressBar(){ 529 $('.slider-progress').find('span').removeAttr('style'); 530 $('.slider-progress').find('span').removeClass('active'); 531 setTimeout(function(){ 532 $('.slider-progress').find('span').css('transition-duration', (sliderTimer/1000)+'s').addClass('active'); 533 }, 100); 534 } 535 progressBar(); 536 $testimonialslider.on('beforeChange', function(e, slick) { 537 progressBar(); 538 }); 539 $testimonialslider.on('afterChange', function(e, slick, nextSlide) { 540 titleAnim(nextSlide); 541 }); 542 543 function titleAnim(ele){ 544 $testimonialslider.find('.slick-current').find('h1').addClass('show'); 545 setTimeout(function(){ 546 $testimonialslider.find('.slick-current').find('h1').removeClass('show'); 547 }, sliderTimer - beforeEnd); 548 } 549 titleAnim(); 550}); 551 552 553//phone formet and validation 554// jQuery(document).ready(function ($) { 555// // Set min and max lengths 556// $('input[type="tel"]').attr({ 557// "minlength": "10", 558// "maxlength": "20"
559// }); 560 561// // Phone formatter function 562// function phoneFormatter() { 563// $('input[type="tel"]').on('input', function () { 564// // Remove any character except numbers, +, -, () and remove space 565// const sanitizedValue = $(this).val().replace(/[^0-9+\-()]/g, ''); 566// $(this).val(sanitizedValue); 567// }); 568// } 569 570// $(phoneFormatter); 571// });
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.