mirror of
https://gitlab.com/futo-org/fcast.git
synced 2025-06-24 21:25:23 +00:00
Added website.
This commit is contained in:
parent
193dc032c5
commit
9c01167b96
32 changed files with 58625 additions and 0 deletions
0
website/js/custom.js
Normal file
0
website/js/custom.js
Normal file
13
website/js/script.js
Normal file
13
website/js/script.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
Name: App Landing
|
||||
Written by: Okler Themes - (http://www.okler.net)
|
||||
Theme Version: 9.9.3
|
||||
*/
|
||||
|
||||
(function( $ ) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
|
||||
}).apply( this, [ jQuery ]);
|
333
website/js/theme.init.js
Normal file
333
website/js/theme.init.js
Normal file
|
@ -0,0 +1,333 @@
|
|||
// Commom Plugins
|
||||
(function($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
// Scroll to Top Button.
|
||||
if (typeof theme.PluginScrollToTop !== 'undefined') {
|
||||
theme.PluginScrollToTop.initialize();
|
||||
}
|
||||
|
||||
// Tooltips
|
||||
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
|
||||
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
|
||||
return new bootstrap.Tooltip(tooltipTriggerEl)
|
||||
});
|
||||
|
||||
// Popovers
|
||||
var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'))
|
||||
var popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
|
||||
return new bootstrap.Popover(popoverTriggerEl)
|
||||
});
|
||||
|
||||
// Validations
|
||||
if ( $.isFunction($.validator) && typeof theme.PluginValidation !== 'undefined') {
|
||||
theme.PluginValidation.initialize();
|
||||
}
|
||||
|
||||
// Animate
|
||||
if ($.isFunction($.fn['themePluginAnimate']) && $('[data-appear-animation]').length) {
|
||||
theme.fn.dynIntObsInit( '[data-appear-animation], [data-appear-animation-svg]', 'themePluginAnimate', theme.PluginAnimate.defaults );
|
||||
}
|
||||
|
||||
// Animated Content
|
||||
if ($.isFunction($.fn['themePluginAnimatedContent'])) {
|
||||
theme.fn.intObsInit( '[data-plugin-animated-letters]:not(.manual), .animated-letters', 'themePluginAnimatedContent' );
|
||||
theme.fn.intObsInit( '[data-plugin-animated-words]:not(.manual), .animated-words', 'themePluginAnimatedContent' );
|
||||
}
|
||||
|
||||
// Before / After
|
||||
if ($.isFunction($.fn['themePluginBeforeAfter']) && $('[data-plugin-before-after]').length) {
|
||||
theme.fn.intObsInit( '[data-plugin-before-after]:not(.manual)', 'themePluginBeforeAfter' );
|
||||
}
|
||||
|
||||
// Carousel Light
|
||||
if ($.isFunction($.fn['themePluginCarouselLight']) && $('.owl-carousel-light').length) {
|
||||
theme.fn.intObsInit( '.owl-carousel-light', 'themePluginCarouselLight' );
|
||||
}
|
||||
|
||||
// Carousel
|
||||
if ($.isFunction($.fn['themePluginCarousel']) && $('[data-plugin-carousel]:not(.manual), .owl-carousel:not(.manual)').length) {
|
||||
theme.fn.intObsInit( '[data-plugin-carousel]:not(.manual), .owl-carousel:not(.manual)', 'themePluginCarousel' );
|
||||
}
|
||||
|
||||
// Chart.Circular
|
||||
if ($.isFunction($.fn['themePluginChartCircular']) && ( $('[data-plugin-chart-circular]').length || $('.circular-bar-chart').length )) {
|
||||
theme.fn.dynIntObsInit( '[data-plugin-chart-circular]:not(.manual), .circular-bar-chart:not(.manual)', 'themePluginChartCircular', theme.PluginChartCircular.defaults );
|
||||
}
|
||||
|
||||
// Countdown
|
||||
if ($.isFunction($.fn['themePluginCountdown']) && ( $('[data-plugin-countdown]').length || $('.countdown').length )) {
|
||||
theme.fn.intObsInit( '[data-plugin-countdown]:not(.manual), .countdown', 'themePluginCountdown' );
|
||||
}
|
||||
|
||||
// Counter
|
||||
if ($.isFunction($.fn['themePluginCounter']) && ( $('[data-plugin-counter]').length || $('.counters [data-to]').length )) {
|
||||
theme.fn.dynIntObsInit( '[data-plugin-counter]:not(.manual), .counters [data-to]', 'themePluginCounter', theme.PluginCounter.defaults );
|
||||
}
|
||||
|
||||
// Cursor Effect
|
||||
if ($.isFunction($.fn['themePluginCursorEffect']) && $('[data-plugin-cursor-effect]').length ) {
|
||||
theme.fn.intObsInit( '[data-plugin-cursor-effect]:not(.manual)', 'themePluginCursorEffect' );
|
||||
}
|
||||
|
||||
// Float Element
|
||||
if ($.isFunction($.fn['themePluginFloatElement']) && $('[data-plugin-float-element]').length) {
|
||||
theme.fn.intObsInit( '[data-plugin-float-element], [data-plugin-float-element-svg]', 'themePluginFloatElement' );
|
||||
}
|
||||
|
||||
// GDPR
|
||||
if ($.isFunction($.fn['themePluginGDPR']) && $('[data-plugin-gdpr]').length) {
|
||||
|
||||
$(function() {
|
||||
$('[data-plugin-gdpr]:not(.manual)').each(function() {
|
||||
var $this = $(this),
|
||||
opts;
|
||||
|
||||
var pluginOptions = theme.fn.getOptions($this.data('plugin-options'));
|
||||
if (pluginOptions)
|
||||
opts = pluginOptions;
|
||||
|
||||
$this.themePluginGDPR(opts);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// GDPR Wrapper
|
||||
if ($.isFunction($.fn['themePluginGDPRWrapper']) && $('[data-plugin-gdpr-wrapper]').length) {
|
||||
|
||||
$(function() {
|
||||
$('[data-plugin-gdpr-wrapper]:not(.manual)').each(function() {
|
||||
var $this = $(this),
|
||||
opts;
|
||||
|
||||
var pluginOptions = theme.fn.getOptions($this.data('plugin-options'));
|
||||
if (pluginOptions)
|
||||
opts = pluginOptions;
|
||||
|
||||
$this.themePluginGDPRWrapper(opts);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Hover Effect
|
||||
if ($.isFunction($.fn['themePluginHoverEffect']) && $('[data-plugin-hover-effect], .hover-effect-3d').length) {
|
||||
theme.fn.intObsInit( '[data-plugin-hover-effect]:not(.manual), .hover-effect-3d:not(.manual)', 'themePluginHoverEffect' );
|
||||
}
|
||||
|
||||
// Animated Icon
|
||||
if ($.isFunction($.fn['themePluginIcon']) && $('[data-icon]').length) {
|
||||
theme.fn.dynIntObsInit( '[data-icon]:not(.svg-inline--fa)', 'themePluginIcon', theme.PluginIcon.defaults );
|
||||
}
|
||||
|
||||
// In Viewport Style
|
||||
if ($.isFunction($.fn['themePluginInViewportStyle']) && $('[data-inviewport-style]').length) {
|
||||
|
||||
$(function() {
|
||||
$('[data-inviewport-style]:not(.manual)').each(function() {
|
||||
var $this = $(this),
|
||||
opts;
|
||||
|
||||
var pluginOptions = theme.fn.getOptions($this.data('plugin-options'));
|
||||
if (pluginOptions)
|
||||
opts = pluginOptions;
|
||||
|
||||
$this.themePluginInViewportStyle(opts);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Lightbox
|
||||
if ($.isFunction($.fn['themePluginLightbox']) && ( $('[data-plugin-lightbox]').length || $('.lightbox').length )) {
|
||||
theme.fn.execOnceTroughEvent( '[data-plugin-lightbox]:not(.manual), .lightbox:not(.manual)', 'mouseover.trigger.lightbox', function(){
|
||||
var $this = $(this),
|
||||
opts;
|
||||
|
||||
var pluginOptions = theme.fn.getOptions($this.data('plugin-options'));
|
||||
if (pluginOptions)
|
||||
opts = pluginOptions;
|
||||
|
||||
$this.themePluginLightbox(opts);
|
||||
});
|
||||
}
|
||||
|
||||
// Masonry
|
||||
if ($.isFunction($.fn['themePluginMasonry']) && $('[data-plugin-masonry]').length) {
|
||||
|
||||
$(function() {
|
||||
$('[data-plugin-masonry]:not(.manual)').each(function() {
|
||||
var $this = $(this),
|
||||
opts;
|
||||
|
||||
var pluginOptions = theme.fn.getOptions($this.data('plugin-options'));
|
||||
if (pluginOptions)
|
||||
opts = pluginOptions;
|
||||
|
||||
$this.themePluginMasonry(opts);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Match Height
|
||||
if ($.isFunction($.fn['themePluginMatchHeight']) && $('[data-plugin-match-height]').length) {
|
||||
|
||||
$(function() {
|
||||
$('[data-plugin-match-height]:not(.manual)').each(function() {
|
||||
var $this = $(this),
|
||||
opts;
|
||||
|
||||
var pluginOptions = theme.fn.getOptions($this.data('plugin-options'));
|
||||
if (pluginOptions)
|
||||
opts = pluginOptions;
|
||||
|
||||
$this.themePluginMatchHeight(opts);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Parallax
|
||||
if ($.isFunction($.fn['themePluginParallax']) && $('[data-plugin-parallax]').length) {
|
||||
theme.fn.intObsInit( '[data-plugin-parallax]:not(.manual)', 'themePluginParallax' );
|
||||
}
|
||||
|
||||
// Progress Bar
|
||||
if ($.isFunction($.fn['themePluginProgressBar']) && ( $('[data-plugin-progress-bar]') || $('[data-appear-progress-animation]').length )) {
|
||||
theme.fn.dynIntObsInit( '[data-plugin-progress-bar]:not(.manual), [data-appear-progress-animation]', 'themePluginProgressBar', theme.PluginProgressBar.defaults );
|
||||
}
|
||||
|
||||
// Random Images
|
||||
if ($.isFunction($.fn['themePluginRandomImages']) && $('[data-plugin-random-images]').length) {
|
||||
theme.fn.dynIntObsInit( '.plugin-random-images', 'themePluginRandomImages', theme.PluginRandomImages.defaults );
|
||||
}
|
||||
|
||||
// Read More
|
||||
if ($.isFunction($.fn['themePluginReadMore']) && $('[data-plugin-readmore]').length) {
|
||||
theme.fn.intObsInit( '[data-plugin-readmore]:not(.manual)', 'themePluginReadMore' );
|
||||
}
|
||||
|
||||
// Revolution Slider
|
||||
if ($.isFunction($.fn['themePluginRevolutionSlider']) && ( $('[data-plugin-revolution-slider]').length || $('.slider-container .slider').length )) {
|
||||
|
||||
$(function() {
|
||||
$('[data-plugin-revolution-slider]:not(.manual), .slider-container .slider:not(.manual)').each(function() {
|
||||
var $this = $(this),
|
||||
opts;
|
||||
|
||||
var pluginOptions = theme.fn.getOptions($this.data('plugin-options'));
|
||||
if (pluginOptions)
|
||||
opts = pluginOptions;
|
||||
|
||||
$this.themePluginRevolutionSlider(opts);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Scroll Spy
|
||||
if ($.isFunction($.fn['themePluginScrollSpy']) && $('[data-plugin-scroll-spy]').length) {
|
||||
|
||||
$(function() {
|
||||
$('[data-plugin-scroll-spy]:not(.manual)').each(function() {
|
||||
var $this = $(this),
|
||||
opts;
|
||||
|
||||
var pluginOptions = theme.fn.getOptions($this.data('plugin-options'));
|
||||
if (pluginOptions)
|
||||
opts = pluginOptions;
|
||||
|
||||
$this.themePluginScrollSpy(opts);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Scrollable
|
||||
if ( $.isFunction($.fn[ 'nanoScroller' ]) && $('[data-plugin-scrollable]').length ) {
|
||||
theme.fn.intObsInit( '[data-plugin-scrollable]', 'themePluginScrollable' );
|
||||
}
|
||||
|
||||
// Section Scroll
|
||||
if ($.isFunction($.fn['themePluginSectionScroll']) && $('[data-plugin-section-scroll]').length) {
|
||||
|
||||
$(function() {
|
||||
$('[data-plugin-section-scroll]:not(.manual)').each(function() {
|
||||
var $this = $(this),
|
||||
opts;
|
||||
|
||||
var pluginOptions = theme.fn.getOptions($this.data('plugin-options'));
|
||||
if (pluginOptions)
|
||||
opts = pluginOptions;
|
||||
|
||||
$this.themePluginSectionScroll(opts);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// Sort
|
||||
if ($.isFunction($.fn['themePluginSort']) && ( $('[data-plugin-sort]').length || $('.sort-source').length )) {
|
||||
theme.fn.intObsInit( '[data-plugin-sort]:not(.manual), .sort-source:not(.manual)', 'themePluginSort' );
|
||||
}
|
||||
|
||||
// Star Rating
|
||||
if ($.isFunction($.fn['themePluginStarRating']) && $('[data-plugin-star-rating]').length) {
|
||||
theme.fn.intObsInit( '[data-plugin-star-rating]:not(.manual)', 'themePluginStarRating' );
|
||||
}
|
||||
|
||||
// Sticky
|
||||
if ($.isFunction($.fn['themePluginSticky']) && $('[data-plugin-sticky]').length) {
|
||||
theme.fn.execOnceTroughWindowEvent( window, 'scroll.trigger.sticky', function(){
|
||||
$('[data-plugin-sticky]:not(.manual)').each(function() {
|
||||
var $this = $(this),
|
||||
opts;
|
||||
|
||||
var pluginOptions = theme.fn.getOptions($this.data('plugin-options'));
|
||||
if (pluginOptions)
|
||||
opts = pluginOptions;
|
||||
|
||||
$this.themePluginSticky(opts);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Toggle
|
||||
if ($.isFunction($.fn['themePluginToggle']) && $('[data-plugin-toggle]').length) {
|
||||
theme.fn.intObsInit( '[data-plugin-toggle]:not(.manual)', 'themePluginToggle' );
|
||||
}
|
||||
|
||||
// Video Background
|
||||
if ($.isFunction($.fn['themePluginVideoBackground']) && $('[data-plugin-video-background]').length) {
|
||||
theme.fn.intObsInit( '[data-plugin-video-background]:not(.manual)', 'themePluginVideoBackground' );
|
||||
}
|
||||
|
||||
// Sticky Header
|
||||
if (typeof theme.StickyHeader !== 'undefined') {
|
||||
theme.StickyHeader.initialize();
|
||||
}
|
||||
|
||||
// Nav Menu
|
||||
if (typeof theme.Nav !== 'undefined') {
|
||||
theme.Nav.initialize();
|
||||
}
|
||||
|
||||
// Search
|
||||
if (typeof theme.Search !== 'undefined' && ( $('#searchForm').length || $('.header-nav-features-search-reveal').length )) {
|
||||
theme.Search.initialize();
|
||||
}
|
||||
|
||||
// Newsletter
|
||||
if (typeof theme.Newsletter !== 'undefined' && $('#newsletterForm').length) {
|
||||
theme.fn.intObs( '#newsletterForm', 'theme.Newsletter.initialize();', {} );
|
||||
}
|
||||
|
||||
// Account
|
||||
if (typeof theme.Account !== 'undefined' && ( $('#headerAccount').length || $('#headerSignUp').length || $('#headerSignIn').length || $('#headerRecover').length || $('#headerRecoverCancel').length )) {
|
||||
theme.Account.initialize();
|
||||
}
|
||||
|
||||
}).apply(this, [jQuery]);
|
9660
website/js/theme.js
Normal file
9660
website/js/theme.js
Normal file
File diff suppressed because it is too large
Load diff
280
website/js/views/view.contact.js
Normal file
280
website/js/views/view.contact.js
Normal file
|
@ -0,0 +1,280 @@
|
|||
/*
|
||||
Name: View - Contact
|
||||
Written by: Okler Themes - (http://www.okler.net)
|
||||
Theme Version: 9.9.3
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
Custom Rules
|
||||
*/
|
||||
|
||||
// No White Space
|
||||
$.validator.addMethod("noSpace", function(value, element) {
|
||||
if( $(element).attr('required') ) {
|
||||
return value.search(/^(?! *$)[^]+$/) == 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}, 'Please fill this empty field.');
|
||||
|
||||
/*
|
||||
Assign Custom Rules on Fields
|
||||
*/
|
||||
$.validator.addClassRules({
|
||||
'form-control': {
|
||||
noSpace: true
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
Contact Form: Basic
|
||||
*/
|
||||
$('.contact-form').each(function(){
|
||||
$(this).validate({
|
||||
errorPlacement: function(error, element) {
|
||||
if(element.attr('type') == 'radio' || element.attr('type') == 'checkbox') {
|
||||
error.appendTo(element.closest('.form-group'));
|
||||
} else if( element.is('select') && element.closest('.custom-select-1') ) {
|
||||
error.appendTo(element.closest('.form-group'));
|
||||
} else {
|
||||
if( element.closest('.form-group').length ) {
|
||||
error.appendTo(element.closest('.form-group'));
|
||||
} else {
|
||||
error.insertAfter(element);
|
||||
}
|
||||
}
|
||||
},
|
||||
submitHandler: function(form) {
|
||||
|
||||
var $form = $(form),
|
||||
$messageSuccess = $form.find('.contact-form-success'),
|
||||
$messageError = $form.find('.contact-form-error'),
|
||||
$submitButton = $(this.submitButton),
|
||||
$errorMessage = $form.find('.mail-error-message'),
|
||||
submitButtonText = $submitButton.val();
|
||||
|
||||
$submitButton.val( $submitButton.data('loading-text') ? $submitButton.data('loading-text') : 'Loading...' ).attr('disabled', true);
|
||||
|
||||
// Fields Data
|
||||
var formData = $form.serializeArray(),
|
||||
data = {};
|
||||
|
||||
$(formData).each(function(index, obj){
|
||||
if( data[obj.name] ) {
|
||||
data[obj.name] = data[obj.name] + ', ' + obj.value;
|
||||
} else {
|
||||
data[obj.name] = obj.value;
|
||||
}
|
||||
});
|
||||
|
||||
// Google Recaptcha v2
|
||||
if( data["g-recaptcha-response"] != undefined ) {
|
||||
data["g-recaptcha-response"] = $form.find('#g-recaptcha-response').val();
|
||||
}
|
||||
|
||||
// Ajax Submit
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: $form.attr('action'),
|
||||
data: data
|
||||
}).always(function(data, textStatus, jqXHR) {
|
||||
|
||||
$errorMessage.empty().hide();
|
||||
|
||||
if (data.response == 'success') {
|
||||
|
||||
// Uncomment the code below to redirect for a thank you page
|
||||
// self.location = 'thank-you.html';
|
||||
|
||||
$messageSuccess.removeClass('d-none');
|
||||
$messageError.addClass('d-none');
|
||||
|
||||
// Reset Form
|
||||
$form.find('.form-control')
|
||||
.val('')
|
||||
.blur()
|
||||
.parent()
|
||||
.removeClass('has-success')
|
||||
.removeClass('has-danger')
|
||||
.find('label.error')
|
||||
.remove();
|
||||
|
||||
if (($messageSuccess.offset().top - 80) < $(window).scrollTop()) {
|
||||
$('html, body').animate({
|
||||
scrollTop: $messageSuccess.offset().top - 80
|
||||
}, 300);
|
||||
}
|
||||
|
||||
$form.find('.form-control').removeClass('error');
|
||||
|
||||
$submitButton.val( submitButtonText ).attr('disabled', false);
|
||||
|
||||
return;
|
||||
|
||||
} else if (data.response == 'error' && typeof data.errorMessage !== 'undefined') {
|
||||
$errorMessage.html(data.errorMessage).show();
|
||||
} else {
|
||||
$errorMessage.html(data.responseText).show();
|
||||
}
|
||||
|
||||
$messageError.removeClass('d-none');
|
||||
$messageSuccess.addClass('d-none');
|
||||
|
||||
if (($messageError.offset().top - 80) < $(window).scrollTop()) {
|
||||
$('html, body').animate({
|
||||
scrollTop: $messageError.offset().top - 80
|
||||
}, 300);
|
||||
}
|
||||
|
||||
$form.find('.has-success')
|
||||
.removeClass('has-success');
|
||||
|
||||
$submitButton.val( submitButtonText ).attr('disabled', false);
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/*
|
||||
Contact Form: Advanced
|
||||
*/
|
||||
$('#contactFormAdvanced').validate({
|
||||
onkeyup: false,
|
||||
onclick: false,
|
||||
onfocusout: false,
|
||||
rules: {
|
||||
'captcha': {
|
||||
captcha: true
|
||||
},
|
||||
'checkboxes[]': {
|
||||
required: true
|
||||
},
|
||||
'radios': {
|
||||
required: true
|
||||
}
|
||||
},
|
||||
errorPlacement: function(error, element) {
|
||||
if(element.attr('type') == 'radio' || element.attr('type') == 'checkbox') {
|
||||
error.appendTo(element.closest('.form-group'));
|
||||
} else if( element.is('select') && element.closest('.custom-select-1') ) {
|
||||
error.appendTo(element.closest('.form-group'));
|
||||
} else {
|
||||
error.insertAfter(element);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
Contact Form: reCaptcha v3
|
||||
*/
|
||||
$('.contact-form-recaptcha-v3').each(function(){
|
||||
$(this).validate({
|
||||
errorPlacement: function(error, element) {
|
||||
if(element.attr('type') == 'radio' || element.attr('type') == 'checkbox') {
|
||||
error.appendTo(element.closest('.form-group'));
|
||||
} else if( element.is('select') && element.closest('.custom-select-1') ) {
|
||||
error.appendTo(element.closest('.form-group'));
|
||||
} else {
|
||||
error.insertAfter(element);
|
||||
}
|
||||
},
|
||||
submitHandler: function(form) {
|
||||
|
||||
var $form = $(form),
|
||||
$messageSuccess = $form.find('.contact-form-success'),
|
||||
$messageError = $form.find('.contact-form-error'),
|
||||
$submitButton = $(this.submitButton),
|
||||
$errorMessage = $form.find('.mail-error-message'),
|
||||
submitButtonText = $submitButton.val();
|
||||
|
||||
$submitButton.val( $submitButton.data('loading-text') ? $submitButton.data('loading-text') : 'Loading...' ).attr('disabled', true);
|
||||
|
||||
var recaptchaSrcURL = $('#google-recaptcha-v3').attr('src'),
|
||||
newURL = new URL(recaptchaSrcURL),
|
||||
site_key = newURL.searchParams.get("render");
|
||||
|
||||
grecaptcha.execute(site_key, {action: 'contact_us'}).then(function(token) {
|
||||
|
||||
// Fields Data
|
||||
var formData = $form.serializeArray(),
|
||||
data = {};
|
||||
|
||||
$(formData).each(function(index, obj){
|
||||
data[obj.name] = obj.value;
|
||||
});
|
||||
|
||||
// Recaptcha v3 Token
|
||||
data["g-recaptcha-response"] = token;
|
||||
|
||||
// Ajax Submit
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: $form.attr('action'),
|
||||
data: data
|
||||
}).always(function(data, textStatus, jqXHR) {
|
||||
|
||||
$errorMessage.empty().hide();
|
||||
|
||||
if (data.response == 'success') {
|
||||
|
||||
// Uncomment the code below to redirect for a thank you page
|
||||
// self.location = 'thank-you.html';
|
||||
|
||||
$messageSuccess.removeClass('d-none');
|
||||
$messageError.addClass('d-none');
|
||||
|
||||
// Reset Form
|
||||
$form.find('.form-control')
|
||||
.val('')
|
||||
.blur()
|
||||
.parent()
|
||||
.removeClass('has-success')
|
||||
.removeClass('has-danger')
|
||||
.find('label.error')
|
||||
.remove();
|
||||
|
||||
if (($messageSuccess.offset().top - 80) < $(window).scrollTop()) {
|
||||
$('html, body').animate({
|
||||
scrollTop: $messageSuccess.offset().top - 80
|
||||
}, 300);
|
||||
}
|
||||
|
||||
$form.find('.form-control').removeClass('error');
|
||||
|
||||
$submitButton.val( submitButtonText ).attr('disabled', false);
|
||||
|
||||
return;
|
||||
|
||||
} else if (data.response == 'error' && typeof data.errorMessage !== 'undefined') {
|
||||
$errorMessage.html(data.errorMessage).show();
|
||||
} else {
|
||||
$errorMessage.html(data.responseText).show();
|
||||
}
|
||||
|
||||
$messageError.removeClass('d-none');
|
||||
$messageSuccess.addClass('d-none');
|
||||
|
||||
if (($messageError.offset().top - 80) < $(window).scrollTop()) {
|
||||
$('html, body').animate({
|
||||
scrollTop: $messageError.offset().top - 80
|
||||
}, 300);
|
||||
}
|
||||
|
||||
$form.find('.has-success')
|
||||
.removeClass('has-success');
|
||||
|
||||
$submitButton.val( submitButtonText ).attr('disabled', false);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}).apply(this, [jQuery]);
|
Loading…
Add table
Add a link
Reference in a new issue