// source --> https://rentingup.es/wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart.min.js?ver=3.5.3
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,a]):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 --> https://rentingup.es/wp-content/plugins/js_composer/assets/js/vendors/woocommerce-add-to-cart.js?ver=5.4.7
window.jQuery( document ).ready( function ( $ ) {
$( 'body' ).on( 'adding_to_cart', function ( event, $button, data ) {
$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' );
}
$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();
} );
} );
// source --> https://rentingup.es/wp-content/themes/motors/assets/js/classie.js?ver=4.3.0
/*!
* classie v1.0.1
* class helper functions
* from bonzo https://github.com/ded/bonzo
* MIT license
*
* classie.has( elem, 'my-class' ) -> true/false
* classie.add( elem, 'my-new-class' )
* classie.remove( elem, 'my-unwanted-class' )
* classie.toggle( elem, 'my-class' )
*/
/*jshint browser: true, strict: true, undef: true, unused: true */
/*global define: false, module: false */
( function( window ) {
'use strict';
// class helper functions from bonzo https://github.com/ded/bonzo
function classReg( className ) {
return new RegExp("(^|\\s+)" + className + "(\\s+|$)");
}
// classList support for class management
// altho to be fair, the api sucks because it won't accept multiple classes at once
var hasClass, addClass, removeClass;
if ( 'classList' in document.documentElement ) {
hasClass = function( elem, c ) {
return elem.classList.contains( c );
};
addClass = function( elem, c ) {
elem.classList.add( c );
};
removeClass = function( elem, c ) {
elem.classList.remove( c );
};
}
else {
hasClass = function( elem, c ) {
return classReg( c ).test( elem.className );
};
addClass = function( elem, c ) {
if ( !hasClass( elem, c ) ) {
elem.className = elem.className + ' ' + c;
}
};
removeClass = function( elem, c ) {
elem.className = elem.className.replace( classReg( c ), ' ' );
};
}
function toggleClass( elem, c ) {
var fn = hasClass( elem, c ) ? removeClass : addClass;
fn( elem, c );
}
var classie = {
// full names
hasClass: hasClass,
addClass: addClass,
removeClass: removeClass,
toggleClass: toggleClass,
// short names
has: hasClass,
add: addClass,
remove: removeClass,
toggle: toggleClass
};
// transport
if ( typeof define === 'function' && define.amd ) {
// AMD
define( classie );
} else if ( typeof exports === 'object' ) {
// CommonJS
module.exports = classie;
} else {
// browser global
window.classie = classie;
}
})( window );
// source --> https://rentingup.es/wp-content/themes/motors/assets/js/vivus.min.js?ver=4.3.0
/**
* vivus - JavaScript library to make drawing animation on SVG
* @version v0.3.0
* @link https://github.com/maxwellito/vivus
* @license MIT
*/
"use strict";!function(t,e){function r(r){if("undefined"==typeof r)throw new Error('Pathformer [constructor]: "element" parameter is required');if(r.constructor===String&&(r=e.getElementById(r),!r))throw new Error('Pathformer [constructor]: "element" parameter is not related to an existing ID');if(!(r.constructor instanceof t.SVGElement||/^svg$/i.test(r.nodeName)))throw new Error('Pathformer [constructor]: "element" parameter must be a string or a SVGelement');this.el=r,this.scan(r)}function n(t,e,r){this.isReady=!1,this.setElement(t,e),this.setOptions(e),this.setCallback(r),this.isReady&&this.init()}r.prototype.TYPES=["line","ellipse","circle","polygon","polyline","rect"],r.prototype.ATTR_WATCH=["cx","cy","points","r","rx","ry","x","x1","x2","y","y1","y2"],r.prototype.scan=function(t){for(var e,r,n,i,a=t.querySelectorAll(this.TYPES.join(",")),o=0;o=this.duration)throw new Error("Vivus [constructor]: delay must be shorter than duration")},n.prototype.setCallback=function(t){if(t&&t.constructor!==Function)throw new Error('Vivus [constructor]: "callback" parameter must be a function');this.callback=t||function(){}},n.prototype.mapping=function(){var e,r,n,i,a,s,h,u;for(u=s=h=0,r=this.el.querySelectorAll("path"),e=0;e1?r.length-1:1),e=0;e=this.frameLength?(this.stop(),this.currentFrame=this.frameLength,this.trace(),this.selfDestroy&&this.destroy(),this.callback(this)):(this.trace(),this.handle=i(function(){t.drawer()}))},n.prototype.trace=function(){var t,e,r,n;for(n=this.animTimingFunction(this.currentFrame/this.frameLength)*this.frameLength,t=0;t=o+a*e&&s>=r},n.prototype.docElem=t.document.documentElement,n.prototype.getViewportH=function(){var e=this.docElem.clientHeight,r=t.innerHeight;return r>e?r:e},n.prototype.scrollY=function(){return t.pageYOffset||this.docElem.scrollTop},i=function(){return t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.oRequestAnimationFrame||t.msRequestAnimationFrame||function(e){return t.setTimeout(e,1e3/60)}}(),a=function(){return t.cancelAnimationFrame||t.webkitCancelAnimationFrame||t.mozCancelAnimationFrame||t.oCancelAnimationFrame||t.msCancelAnimationFrame||function(e){return t.clearTimeout(e)}}(),o=function(t,e){var r=parseInt(t,10);return r>=0?r:e},"function"==typeof define&&define.amd?define([],function(){return n}):"object"==typeof exports?module.exports=n:t.Vivus=n}(window,document);
// source --> https://rentingup.es/wp-content/themes/motors/assets/js/jquery.cascadingdropdown.js?ver=4.3.0
/*! jquery-cascading-dropdown 1.2.7 | (c) 2016 Dzulqarnain Nasir | MIT */
(function ($, undefined) {
'use strict';
var defaultOptions = {
usePost: false,
useJson: false
};
// Constructor
function Dropdown(options, parent) {
this.el = $(options.selector, parent.el);
this.parent = parent;
this.options = $.extend({}, defaultOptions, options);
this.name = this.options.paramName || this.el.attr('name');
this.requiredDropdowns = options.requires && options.requires.length ? $(options.requires.join(','), parent.el) : null;
this.isLoadingClassName = this.options.isLoadingClassName || parent.options.isLoadingClassName || 'cascading-dropdown-loading';
}
// Methods
Dropdown.prototype = {
_create: function() {
var self = this;
self.pending = 0;
self.initialised = false;
self.initialState = self.el.clone(true);
self.el.data('plugin_cascadingDropdown', this);
self.originalDropdownItems = self.el.children('option');
// Init event handlers
if(typeof self.options.onChange === 'function') {
self.el.change(function(event) {
var requirementsMet = self._requirementsMet() && self.el[0].value;
self.options.onChange.call(self, event, self.el.val(), self.getRequiredValues(), requirementsMet);
});
}
if(typeof self.options.onEnable === 'function') {
self.el.on('enabled', function(event) {
self.options.onEnable.call(self, event, self.el.val());
});
}
if(typeof self.options.onDisable === 'function') {
self.el.on('disabled', function(event) {
self.options.onDisable.call(self, event, self.el.val());
});
}
if(self.requiredDropdowns) {
self.requiredDropdowns.change(function(event) {
self.update();
});
}
// Init source
self._initSource();
// Call update
self.update();
},
// Destroys the instance and reverts everything back to initial state
_destroy: function() {
this.el.replaceWith(this.initialState).removeData('plugin_cascadingDropdown');
},
// Enables the dropdown
enable: function() {
if(this.el.attr('disabled') === undefined) return;
this.el.removeAttr('disabled').triggerHandler('enabled');
},
// Disables the dropdown
disable: function() {
if(this.el.attr('disabled') !== undefined) return;
this.el.attr('disabled', 'disabled').triggerHandler('disabled');
},
// Checks if required dropdowns have value
_requirementsMet: function() {
var self = this;
if(!self.requiredDropdowns) {
return true;
}
if(self.options.requireAll) { // If requireAll is true, return true if all dropdowns have values
return (self.requiredDropdowns.filter(function() {
return !!$(this).val();
}).length == self.options.requires.length);
} else { // Otherwise, return true if any one of the required dropdowns has value
return (self.requiredDropdowns.filter(function() {
return !!$(this).val();
}).length > 0);
}
},
// Defines dropdown item list source - inspired by jQuery UI Autocomplete
_initSource: function() {
var self = this;
if($.isArray(self.options.source)) {
this.source = function(request, response) {
response($.map(self.options.source, function(item) {
return {
label: item.label || item.value || item,
value: item.value || item.label || item,
selected: item.selected
};
}));
};
} else if ( typeof self.options.source === 'string' ) {
var url = self.options.source;
this.source = function(request, response) {
if ( self.xhr ) {
self.xhr.abort();
}
self.xhr = $.ajax({
url: url,
data: self.options.useJson ? JSON.stringify(request) : request,
dataType: self.options.useJson ? 'json' : undefined,
type: self.options.usePost ? 'post' : 'get',
contentType: 'application/json; charset=utf-8',
success: function(data) {
response(data);
},
error: function() {
response([]);
}
});
};
} else {
this.source = self.options.source;
}
},
getRequiredValues: function() {
var data = {};
if(this.requiredDropdowns) {
$.each(this.requiredDropdowns, function() {
var instance = $(this).data('plugin_cascadingDropdown');
if(instance.name) {
data[instance.name] = instance.el.val();
}
});
}
return data;
},
// Update the dropdown
update: function() {
var self = this;
// Disable it first
self.disable();
// If required dropdowns have no value, return
if(!self._requirementsMet() && !self.options.allowAll) {
self.setSelected(0);
self._triggerReady();
return self.el;
}
// If source isn't defined, it's most likely a static dropdown, so just enable it
if(!self.source) {
self.enable();
self._triggerReady();
return self.el;
}
// Reset the dropdown value so we don't trigger a false call
self.el.val('').change();
// Fetch data from required dropdowns
var data = self.getRequiredValues();
// Pass it to defined source for processing
self.pending++;
self.el.addClass(self.isLoadingClassName);
self.source(data, self._response());
return self.el;
},
_response: function(items) {
var self = this;
return function(items) {
self._renderItems(items);
self.pending--;
if(!self.pending) {
self.el.removeClass(self.isLoadingClassName);
}
}
},
// Render the dropdown items
_renderItems: function(items) {
var self = this;
// Remove all dropdown items and restore to initial state
var val = self.el.val();
self.el.find('option, optgroup').remove();
self.el.append(self.originalDropdownItems);
self.el.val(val);
if(!items) {
self._triggerReady();
return;
}
var selected = [];
// Add all items as dropdown item
var getOption = function(item) {
var selectedAttr = '', classes = '';
if(item.selected) {
selected.push(item.value.toString());
}
if(item.classes && item.classes.length) {
classes = ' class="' + item.classes.join(' ') + '"';
}
return '';
};
if ($.isArray(items)) {
$.each(items, function(index, item) {
self.el.append(getOption(item));
});
} else {
$.each(items, function(key, value) {
var itemData = [];
itemData.push('');
self.el.append(itemData.join(''));
});
}
// Enable the dropdown
self.enable();
// If a selected item exists, set it as default
selected.length && self.setSelected(selected);
self._triggerReady();
},
// Trigger the ready event when instance is initialised for the first time
_triggerReady: function() {
if(this.initialised) return;
// Set selected dropdown item if defined
this.options.selected && this.setSelected(this.options.selected);
this.initialised = true;
this.el.triggerHandler('ready');
},
// Sets the selected dropdown item
setSelected: function(indexOrValue, triggerChange) {
var self = this,
dropdownItems = self.el.find('option');
// Trigger change event by default
if(typeof triggerChange === 'undefined') {
triggerChange = true;
}
var selectedItems = [];
// check if indexOrValue is an array
if($.isArray(indexOrValue)) {
selectedItems = indexOrValue;
} else {
selectedItems = selectedItems.concat(indexOrValue);
}
var selectedValue;
if(self.el.is('[multiple]')) {
selectedValue = selectedItems.map(function(item) {
if(typeof item === 'number'
&& (item !== undefined
&& item > -1
&& item < dropdownItems.length)) {
return dropdownItems[item].value
}
return item;
});
} else {
selectedValue = selectedItems[0];
// if selected item is a number, get the value for the item at that index
if(typeof selectedItems[0] === 'number'
&& (selectedItems[0] !== undefined
&& selectedItems[0] > -1
&& selectedItems[0] < dropdownItems.length)) {
selectedValue = dropdownItems[selectedItems[0]].value;
}
}
// Set the dropdown item
self.el.val(selectedValue);
// Trigger change event
if(triggerChange) {
self.el.change();
}
return self.el;
}
};
function CascadingDropdown(element, options) {
this.el = $(element);
this.options = $.extend({ selectBoxes: [] }, options);
this._init();
}
CascadingDropdown.prototype = {
_init: function() {
var self = this;
self.pending = 0;
// Instance array
self.dropdowns = [];
var dropdowns = $($.map(self.options.selectBoxes, function(item) {
return item.selector;
}).join(','), self.el);
// Init event handlers
var counter = 0;
function readyEventHandler(event) {
if(++counter == dropdowns.length) { // Once all dropdowns are ready, unbind the event handler, and execute onReady
dropdowns.unbind('ready', readyEventHandler);
self.options.onReady.call(self, event, self.getValues());
}
}
function changeEventHandler(event) {
self.options.onChange.call(self, event, self.getValues());
}
if(typeof self.options.onReady === 'function') {
dropdowns.bind('ready', readyEventHandler);
}
if(typeof self.options.onChange === 'function') {
dropdowns.bind('change', changeEventHandler);
}
// Init dropdowns
$.each(self.options.selectBoxes, function(index, item) {
// Create the instance
var instance = new Dropdown(this, self);
// Insert it into the dropdown instance array
self.dropdowns.push(instance);
// Call the create method
instance._create();
});
},
// Destroys the instance and reverts everything back to its initial state
destroy: function() {
$.each(this.dropdowns, function(index, item){
item._destroy();
});
this.el.removeData('plugin_cascadingDropdown');
return this.el;
},
// Fetches the values from all dropdowns in this group
getValues: function() {
var values = {};
// Build the object and insert values from instances with name
$.each(this.dropdowns, function(index, instance) {
if(instance.name) {
values[instance.name] = instance.el.val();
}
});
return values;
}
}
// jQuery plugin declaration
$.fn.cascadingDropdown = function(methodOrOptions) {
var $this = $(this),
args = arguments,
instance = $this.data('plugin_cascadingDropdown');
if(typeof methodOrOptions === 'object' || !methodOrOptions) {
return !instance && $this.data('plugin_cascadingDropdown', new CascadingDropdown(this, methodOrOptions));
} else if(typeof methodOrOptions === 'string') {
if(!instance) {
$.error('Cannot call method ' + methodOrOptions + ' before init.');
} else if(instance[methodOrOptions]) {
return instance[methodOrOptions].apply(instance, Array.prototype.slice.call(args, 1))
}
} else {
$.error('Method ' + methodOrOptions + ' does not exist in jQuery.cascadingDropdown');
}
};
})(jQuery);