Depuración de tamplete
This commit is contained in:
262
resources/public/js/views/view.contact.js
Normal file
262
resources/public/js/views/view.contact.js
Normal file
@ -0,0 +1,262 @@
|
||||
/*
|
||||
Name: View - Contact
|
||||
Written by: Okler Themes - (http://www.okler.net)
|
||||
Theme Version: 12.1.0
|
||||
*/
|
||||
|
||||
(($ => {
|
||||
/*
|
||||
Custom Rules
|
||||
*/
|
||||
|
||||
// No White Space
|
||||
$.validator.addMethod("noSpace", (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(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(form) {
|
||||
|
||||
const $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
|
||||
const formData = $form.serializeArray(), data = {};
|
||||
|
||||
$(formData).each((index, {name, value}) => {
|
||||
if( data[name] ) {
|
||||
data[name] = data[name] + ', ' + value;
|
||||
} else {
|
||||
data[name] = 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
|
||||
}).always(({response, errorMessage, responseText}, textStatus, jqXHR) => {
|
||||
|
||||
$errorMessage.empty().hide();
|
||||
|
||||
if (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 (response == 'error' && typeof errorMessage !== 'undefined') {
|
||||
$errorMessage.html(errorMessage).show();
|
||||
} else {
|
||||
$errorMessage.html(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(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(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(form) {
|
||||
|
||||
const $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);
|
||||
|
||||
const recaptchaSrcURL = $('#google-recaptcha-v3').attr('src'), newURL = new URL(recaptchaSrcURL), site_key = newURL.searchParams.get("render");
|
||||
|
||||
grecaptcha.execute(site_key, {action: 'contact_us'}).then(token => {
|
||||
|
||||
// Fields Data
|
||||
const formData = $form.serializeArray(), data = {};
|
||||
|
||||
$(formData).each((index, {name, value}) => {
|
||||
data[name] = value;
|
||||
});
|
||||
|
||||
// Recaptcha v3 Token
|
||||
data["g-recaptcha-response"] = token;
|
||||
|
||||
// Ajax Submit
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: $form.attr('action'),
|
||||
data
|
||||
}).always(({response, errorMessage, responseText}, textStatus, jqXHR) => {
|
||||
|
||||
$errorMessage.empty().hide();
|
||||
|
||||
if (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 (response == 'error' && typeof errorMessage !== 'undefined') {
|
||||
$errorMessage.html(errorMessage).show();
|
||||
} else {
|
||||
$errorMessage.html(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]);
|
46
resources/public/js/views/view.home.js
Normal file
46
resources/public/js/views/view.home.js
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
Name: View - Home
|
||||
Written by: Okler Themes - (http://www.okler.net)
|
||||
Theme Version: 12.1.0
|
||||
*/
|
||||
|
||||
(($ => {
|
||||
/*
|
||||
Circle Slider
|
||||
*/
|
||||
if ($.isFunction($.fn.flipshow)) {
|
||||
const circleContainer = $('.fc-slideshow');
|
||||
|
||||
$.each( circleContainer, function() {
|
||||
|
||||
const $container = $(this);
|
||||
|
||||
$container.flipshow();
|
||||
|
||||
setTimeout(function circleFlip() {
|
||||
$container.data().flipshow._navigate($container.find('div.fc-right span:first'), 'right');
|
||||
setTimeout(circleFlip, 3000);
|
||||
}, 3000);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
Move Cloud
|
||||
*/
|
||||
if ($('.cloud').get(0)) {
|
||||
const moveCloud = () => {
|
||||
$('.cloud').animate({
|
||||
'top': '+=20px'
|
||||
}, 3000, 'linear', () => {
|
||||
$('.cloud').animate({
|
||||
'top': '-=20px'
|
||||
}, 3000, 'linear', () => {
|
||||
moveCloud();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
moveCloud();
|
||||
}
|
||||
})).apply(this, [jQuery]);
|
30
resources/public/js/views/view.landing.js
Normal file
30
resources/public/js/views/view.landing.js
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
Name: View - Landing
|
||||
Written by: Okler Themes - (http://www.okler.net)
|
||||
Theme Version: 12.1.0
|
||||
*/
|
||||
|
||||
(($ => {
|
||||
let timeout = false;
|
||||
|
||||
$('#demoFilter').keyup(() => {
|
||||
|
||||
if(!timeout) {
|
||||
|
||||
timeout = true;
|
||||
|
||||
$('html, body').animate({
|
||||
scrollTop: $('#demos').offset().top - 90
|
||||
}, 600, 'easeOutQuad', () => {
|
||||
$('body').removeClass('scrolling');
|
||||
timeout = false;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('.custom-banner-content-item-1').on('click', () => {
|
||||
$('.style-switcher-open-loader').trigger('click');
|
||||
});
|
||||
})).apply( this, [ jQuery ]);
|
133
resources/public/js/views/view.shop.js
Normal file
133
resources/public/js/views/view.shop.js
Normal file
@ -0,0 +1,133 @@
|
||||
/*
|
||||
Name: View - Shop
|
||||
Written by: Okler Themes - (http://www.okler.net)
|
||||
Theme Version: 12.1.0
|
||||
*/
|
||||
|
||||
(($ => {
|
||||
/*
|
||||
* Quantity
|
||||
*/
|
||||
$( document ).on('click', '.quantity .plus',function(){
|
||||
const $qty=$(this).parents('.quantity').find('.qty');
|
||||
const currentVal = parseInt($qty.val());
|
||||
if (!isNaN(currentVal)) {
|
||||
$qty.val(currentVal + 1);
|
||||
}
|
||||
});
|
||||
|
||||
$( document ).on('click', '.quantity .minus',function(){
|
||||
const $qty=$(this).parents('.quantity').find('.qty');
|
||||
const currentVal = parseInt($qty.val());
|
||||
if (!isNaN(currentVal) && currentVal > 1) {
|
||||
$qty.val(currentVal - 1);
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* Quick View Lightbox/Popup With Ajax
|
||||
*/
|
||||
$('.quick-view').magnificPopup({
|
||||
type: 'ajax',
|
||||
fixedContentPos: true,
|
||||
fixedBgPos: true,
|
||||
overflowY: 'auto',
|
||||
closeBtnInside: true,
|
||||
preloader: false,
|
||||
midClick: true,
|
||||
removalDelay: 300,
|
||||
mainClass: '',
|
||||
callbacks: {
|
||||
open() {
|
||||
$('html').addClass('lightbox-opened');
|
||||
},
|
||||
close() {
|
||||
$('html').removeClass('lightbox-opened');
|
||||
setTimeout(() => {
|
||||
$('html').removeClass('lightbox-beforeclose');
|
||||
}, 500);
|
||||
},
|
||||
beforeClose() {
|
||||
$('html').addClass('lightbox-beforeclose');
|
||||
},
|
||||
ajaxContentAdded() {
|
||||
|
||||
/*
|
||||
Thumb Gallery
|
||||
*/
|
||||
$('.thumb-gallery-wrapper').each(function(){
|
||||
const $thumbGalleryDetail = $(this).find('.thumb-gallery-detail');
|
||||
const $thumbGalleryThumbs = $(this).find('.thumb-gallery-thumbs');
|
||||
let flag = false;
|
||||
const duration = 300;
|
||||
|
||||
$thumbGalleryDetail
|
||||
.owlCarousel({
|
||||
items: 1,
|
||||
margin: 10,
|
||||
nav: true,
|
||||
dots: false,
|
||||
loop: false,
|
||||
autoHeight: true,
|
||||
navText: [],
|
||||
rtl: ( $('html').attr('dir') == 'rtl' ) ? true : false
|
||||
})
|
||||
.on('changed.owl.carousel', ({item}) => {
|
||||
if (!flag) {
|
||||
flag = true;
|
||||
$thumbGalleryThumbs.trigger('to.owl.carousel', [item.index-1, duration, true]);
|
||||
|
||||
$thumbGalleryThumbs.find('.owl-item').removeClass('selected');
|
||||
$thumbGalleryThumbs.find('.owl-item').eq( item.index ).addClass('selected');
|
||||
flag = false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$thumbGalleryThumbs
|
||||
.owlCarousel({
|
||||
margin: 15,
|
||||
items: $(this).data('thumbs-items') ? $(this).data('thumbs-items') : 4,
|
||||
nav: false,
|
||||
center: $(this).data('thumbs-center') ? true : false,
|
||||
dots: false,
|
||||
rtl: ( $('html').attr('dir') == 'rtl' ) ? true : false
|
||||
})
|
||||
.on('click', '.owl-item', function() {
|
||||
$thumbGalleryDetail.trigger('to.owl.carousel', [$(this).index(), duration, true]);
|
||||
})
|
||||
.on('changed.owl.carousel', ({item}) => {
|
||||
if (!flag) {
|
||||
flag = true;
|
||||
$thumbGalleryDetail.trigger('to.owl.carousel', [item.index, duration, true]);
|
||||
flag = false;
|
||||
}
|
||||
});
|
||||
|
||||
$thumbGalleryThumbs.find('.owl-item').eq(0).addClass('selected');
|
||||
});
|
||||
|
||||
/*
|
||||
* Star Rating
|
||||
*/
|
||||
if ($.isFunction($.fn['themePluginStarRating'])) {
|
||||
|
||||
$(() => {
|
||||
$('[data-plugin-star-rating]:not(.manual)').each(function() {
|
||||
const $this = $(this);
|
||||
let opts;
|
||||
|
||||
const pluginOptions = theme.fn.getOptions($this.data('plugin-options'));
|
||||
if (pluginOptions)
|
||||
opts = pluginOptions;
|
||||
|
||||
$this.themePluginStarRating(opts);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
})).apply(this, [jQuery]);
|
Reference in New Issue
Block a user