// source --> http://travel.ketrintours.com/wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart.min.js?ver=3.4.8
jQuery(function(e){if("undefined"==typeof wc_add_to_cart_params)return!1;var t=function(){e(document.body).on("click",".add_to_cart_button",this.onAddToCart).on("click",".remove_from_cart_button",this.onRemoveFromCart).on("added_to_cart",this.updateButton).on("added_to_cart",this.updateCartPage).on("added_to_cart removed_from_cart",this.updateFragments)};t.prototype.onAddToCart=function(t){var a=e(this);if(a.is(".ajax_add_to_cart")){if(!a.attr("data-product_id"))return!0;t.preventDefault(),a.removeClass("added"),a.addClass("loading");var o={};e.each(a.data(),function(t,a){o[t]=a}),e(document.body).trigger("adding_to_cart",[a,o]),e.post(wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","add_to_cart"),o,function(t){t&&(t.error&&t.product_url?window.location=t.product_url:"yes"!==wc_add_to_cart_params.cart_redirect_after_add?e(document.body).trigger("added_to_cart",[t.fragments,t.cart_hash,a]):window.location=wc_add_to_cart_params.cart_url)})}},t.prototype.onRemoveFromCart=function(t){var a=e(this),o=a.closest(".woocommerce-mini-cart-item");t.preventDefault(),o.block({message:null,overlayCSS:{opacity:.6}}),e.post(wc_add_to_cart_params.wc_ajax_url.toString().replace("%%endpoint%%","remove_from_cart"),{cart_item_key:a.data("cart_item_key")},function(t){t&&t.fragments?e(document.body).trigger("removed_from_cart",[t.fragments,t.cart_hash]):window.location=a.attr("href")}).fail(function(){window.location=a.attr("href")})},t.prototype.updateButton=function(t,a,o,r){(r=void 0!==r&&r)&&(r.removeClass("loading"),r.addClass("added"),wc_add_to_cart_params.is_cart||0!==r.parent().find(".added_to_cart").length||r.after(' '+wc_add_to_cart_params.i18n_view_cart+""),e(document.body).trigger("wc_cart_button_updated",[r]))},t.prototype.updateCartPage=function(){var t=window.location.toString().replace("add-to-cart","added-to-cart");e(".shop_table.cart").load(t+" .shop_table.cart:eq(0) > *",function(){e(".shop_table.cart").stop(!0).css("opacity","1").unblock(),e(document.body).trigger("cart_page_refreshed")}),e(".cart_totals").load(t+" .cart_totals:eq(0) > *",function(){e(".cart_totals").stop(!0).css("opacity","1").unblock(),e(document.body).trigger("cart_totals_refreshed")})},t.prototype.updateFragments=function(t,a){a&&(e.each(a,function(t){e(t).addClass("updating").fadeTo("400","0.6").block({message:null,overlayCSS:{opacity:.6}})}),e.each(a,function(t,a){e(t).replaceWith(a),e(t).stop(!0).css("opacity","1").unblock()}),e(document.body).trigger("wc_fragments_loaded"))},new t});
// source --> http://travel.ketrintours.com/wp-content/plugins/js_composer/assets/js/vendors/woocommerce-add-to-cart.js?ver=7.9
(function ( $ ) {
'use strict';
$( document ).ready( function () {
$( 'body' ).on( 'adding_to_cart', function ( event, $button, data ) {
if ( $button && $button.hasClass( 'vc_gitem-link' ) ) {
$button
.addClass( 'vc-gitem-add-to-cart-loading-btn' )
.parents( '.vc_grid-item-mini' )
.addClass( 'vc-woocommerce-add-to-cart-loading' )
.append( $( '
' ) );
}
} ).on( 'added_to_cart', function ( event, fragments, cart_hash, $button ) {
if ( 'undefined' === typeof ($button) ) {
$button = $( '.vc-gitem-add-to-cart-loading-btn' );
}
if ( $button && $button.hasClass( 'vc_gitem-link' ) ) {
$button
.removeClass( 'vc-gitem-add-to-cart-loading-btn' )
.parents( '.vc_grid-item-mini' )
.removeClass( 'vc-woocommerce-add-to-cart-loading' )
.find( '.vc_wc-load-add-to-loader-wrapper' ).remove();
}
} );
} );
})( window.jQuery );
// source --> http://travel.ketrintours.com/wp-content/themes/traveler/js/init/single-rental.js?ver=4.9.26
/**
* Created by me664 on 3/3/15.
*/
jQuery(document).ready(function($){
$('.btn_booking_modal').click(function(){
var form=$(this).closest('form');
$('.alert',form).remove();
var validate_form=true;
var data=[];
$('input.required,textarea.required,select.required',form).each(function(){
$(this).removeClass('error');
if(!$(this).val()){
validate_form=false;
$(this).addClass('error');
}
if($(this).attr('name')){
data.push({
'value':$(this).val(),
'name':$(this).attr('name')
});
}
});
if(!validate_form)
{
form.prepend(''+st_checkout_text.validate_form+'
');
return false;
}else
{
var tar_get=$(this).data('target');
for(i=0;i');
}
$.magnificPopup.open({
items: {
type: 'inline',
src: tar_get
}
});
}
});
var RentalCalendar = function(container){
var self = this;
this.container = container;
this.calendar= null;
this.form_container = null;
this.init = function(){
self.container = container;
self.calendar = $('.calendar-content', self.container);
self.form_container = $('.calendar-form', self.container);
self.initCalendar();
}
this.initCalendar = function(){
self.calendar.fullCalendar({
firstDay: 1,
lang:st_params.locale,
customButtons: {
reloadButton: {
text: st_params.text_refresh,
click: function() {
self.calendar.fullCalendar( 'refetchEvents' );
}
}
},
header : {
left: 'prev',
center: 'title',
right: 'next, '
},
contentHeight: 360,
events:function(start, end, timezone, callback) {
$.ajax({
url: st_params.ajax_url,
dataType: 'json',
type:'post',
data: {
action:'st_get_availability_rental_single',
post_id:self.container.data('post-id'),
start: start.unix(),
end: end.unix()
},
success: function(doc){
if(typeof doc == 'object'){
callback(doc);
}
},
error:function(e)
{
alert('Can not get the availability slot. Lost connect with your sever');
}
});
},
eventClick: function(event, element, view){
/*$('#calendar_price', self.form_container).val(event.price);
$('#calendar_number', self.form_container).val(event.number);
$('#calendar_status option[value='+event.date+']', self.form_container).prop('selected');*/
},
eventRender: function(event, element, view){
var html = "";
var title = "";
var html_class = "btn-disabled";
var is_disabled = "disabled";
var today_y_m_d = new Date().getFullYear() +"-"+(new Date().getMonth()+1)+"-"+new Date().getDate();
if(event.status == 'booked'){ }
if(event.status == 'past'){ }
if(event.status == 'disabled'){ }
if(event.status == 'avalable'){
html_class = "btn-available";
is_disabled = "";
title = st_checkout_text.origin_price + ": "+event.price;
}
html += "";
$('.fc-content', element).html(html);
},
eventAfterRender: function( event, element, view ) {
$('[data-toggle="tooltip"]').tooltip({html:true});
},
loading: function(isLoading, view){
if(isLoading){
$('.calendar-wrapper-inner .overlay-form').fadeIn();
}else{
$('.calendar-wrapper-inner .overlay-form').fadeOut();
}
},
});
}
};
if($('.calendar-wrapper').length){
$('.calendar-wrapper').each(function(index, el) {
var t = $(this);
var rental = new RentalCalendar(t);
rental.init();
});
}
});