-
Notifications
You must be signed in to change notification settings - Fork 44
fix(js): resolved JavaScript validation and dead code issues #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,10 +6,9 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (function($) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "use strict"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var cfg = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| scrollDuration : 800, // smoothscroll duration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mailChimpURL : 'https://facebook.us8.list-manage.com/subscribe/post?u=cdb7b577e41181934ed6a6a44&id=e6957d85dc' // mailchimp url | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var cfg = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| scrollDuration : 800 // smoothscroll duration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Removed hardcoded mailChimpURL as it's not used in the current implementation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $WIN = $(window); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -203,78 +202,80 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* slick slider | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * ------------------------------------------------------ */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var clSlickSlider = function() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('.clients').slick({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| arrows: false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dots: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| infinite: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToShow: 6, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToScroll: 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //autoplay: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pauseOnFocus: false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| autoplaySpeed: 1000, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| responsive: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| breakpoint: 1200, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| settings: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToShow: 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| breakpoint: 1000, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| settings: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToShow: 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| breakpoint: 800, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| settings: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToShow: 3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToScroll: 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| breakpoint: 500, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| settings: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToShow: 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToScroll: 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Check if .clients element exists before initializing slider | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($('.clients').length > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('.clients').slick({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| arrows: false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dots: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| infinite: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToShow: 6, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToScroll: 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| //autoplay: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pauseOnFocus: false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| autoplaySpeed: 1000, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| responsive: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| breakpoint: 1200, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| settings: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToShow: 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| breakpoint: 1000, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| settings: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToShow: 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| breakpoint: 800, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| settings: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToShow: 3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToScroll: 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| breakpoint: 500, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| settings: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToShow: 2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToScroll: 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('.testimonials').slick({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| arrows: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dots: false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| infinite: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToShow: 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToScroll: 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| adaptiveHeight: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pauseOnFocus: false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| autoplaySpeed: 1500, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| responsive: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| breakpoint: 900, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| settings: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToShow: 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToScroll: 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| breakpoint: 800, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| settings: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| arrows: false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dots: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } // Check if .testimonials element exists before initializing slider | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($('.testimonials').length > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('.testimonials').slick({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| arrows: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dots: false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| infinite: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToShow: 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToScroll: 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| adaptiveHeight: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pauseOnFocus: false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| autoplaySpeed: 1500, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| responsive: [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| breakpoint: 900, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| settings: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToShow: 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| slidesToScroll: 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| breakpoint: 800, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| settings: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| arrows: false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dots: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -321,59 +322,72 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* Contact Form | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * ------------------------------------------------------ */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var clContactForm = function() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* local validation */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('#contactForm').validate({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Check if contact form exists before initializing validation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($('#contactForm').length > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* local validation */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('#contactForm').validate({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* submit via ajax */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| submitHandler: function(form) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var sLoader = $('.submit-loader'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $.ajax({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: "POST", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| url: "inc/sendEmail.php", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| data: $(form).serialize(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| beforeSend: function() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sLoader.slideDown("slow"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| success: function(msg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Message was sent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (msg == 'OK') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sLoader.slideUp("slow"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('.message-warning').fadeOut(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('#contactForm').fadeOut(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('.message-success').fadeIn(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // There was an error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sLoader.slideUp("slow"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('.message-warning').html(msg); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('.message-warning').slideDown("slow"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| error: function(xhr, status, error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* submit via ajax */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| submitHandler: function(form) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var sLoader = $('.submit-loader'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $.ajax({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: "POST", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| url: "inc/sendEmail.php", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| data: $(form).serialize(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| beforeSend: function() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sLoader.slideDown("slow"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| success: function(msg) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Message was sent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (msg == 'OK') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sLoader.slideUp("slow"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('.message-warning').fadeOut(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('#contactForm').fadeOut(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('.message-success').fadeIn(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // There was an error | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sLoader.slideUp("slow"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('.message-warning').html(msg); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var errorMessage = "Something went wrong. Please try again."; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Provide more specific error messages based on status | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (xhr.status === 404) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| errorMessage = "Contact form handler not found. Please contact the administrator."; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (xhr.status === 500) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| errorMessage = "Server error occurred. Please try again later."; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (status === 'timeout') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| errorMessage = "Request timed out. Please check your internet connection and try again."; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('.message-warning').html(errorMessage); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('.message-warning').slideDown("slow"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| error: function() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sLoader.slideUp("slow"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('.message-warning').html("Something went wrong. Please try again."); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('.message-warning').slideDown("slow"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| timeout: 10000 // 10 second timeout | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -391,38 +405,63 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* AjaxChimp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* Newsletter Forms | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * ------------------------------------------------------ */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var clAjaxChimp = function() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var clNewsletterForms = function() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $('#mc-form').ajaxChimp({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| language: 'es', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| url: cfg.mailChimpURL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // Handle newsletter forms that actually exist in the HTML | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var newsletterForms = ['#newsletter', '#newsletter-1']; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| newsletterForms.forEach(function(formId) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($(formId).length > 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $(formId).on('submit', function(e) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| e.preventDefault(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var $form = $(this); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var $email = $form.find('input[name="email"]'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var $submitBtn = $form.find('.submit-btn'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var $info = $form.find('.info'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var $alert = $form.next('.alert'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var $alert = $form.next('.alert'); | |
| var $alert = $form.find('.alert'); |
Copilot
AI
Jun 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] This setTimeout block currently simulates the newsletter signup process. It would be clearer to add a TODO comment or refactor this to make it obvious where to integrate a real API call.
| // Simulate newsletter signup (replace with actual API call) | |
| setTimeout(function() { | |
| showMessage($info, $alert, '<i class="fa fa-check"></i> Thank you for subscribing! We\'ll keep you updated.', 'success'); | |
| $email.val(''); // Clear the email field | |
| $submitBtn.prop('disabled', false); | |
| // Hide message after 5 seconds | |
| setTimeout(function() { | |
| $info.html(''); | |
| $alert.removeClass('alert-success alert-warning alert-info').addClass('text-hide'); | |
| }, 5000); | |
| }, 1500); | |
| }); | |
| // TODO: Replace this simulated API call with an actual API integration. | |
| simulateNewsletterSignup($email, $submitBtn, $info, $alert); | |
| }); | |
| // Simulates the newsletter signup process. Replace this with an actual API call. | |
| function simulateNewsletterSignup($email, $submitBtn, $info, $alert) { | |
| setTimeout(function() { | |
| showMessage($info, $alert, '<i class="fa fa-check"></i> Thank you for subscribing! We\'ll keep you updated.', 'success'); | |
| $email.val(''); // Clear the email field | |
| $submitBtn.prop('disabled', false); | |
| // Hide message after 5 seconds | |
| setTimeout(function() { | |
| $info.html(''); | |
| $alert.removeClass('alert-success alert-warning alert-info').addClass('text-hide'); | |
| }, 5000); | |
| }, 1500); | |
| } |
Copilot
AI
Jun 18, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider moving the showMessage helper outside of the clNewsletterForms function to improve reusability and keep nested scopes cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The comment for the testimonials existence check is placed on the same line as the closing brace, which can reduce readability. Consider moving the comment above the
ifstatement or onto its own line.