Domain: antoinekatan.com
Server Adress: 10.127.20.23
privdayz.com
(function($) {
'use strict';
var woocommerce = {};
mkdf.modules.woocommerce = woocommerce;
woocommerce.mkdfOnDocumentReady = mkdfOnDocumentReady;
$(document).ready(mkdfOnDocumentReady);
/*
All functions to be called on $(document).ready() should be in this function
*/
function mkdfOnDocumentReady() {
mkdfInitQuantityButtons();
mkdfInitSelect2();
mkdfInitSingleProductLightbox();
mkdfInitWooCommerceCustomNavigation();
}
/*
** Init quantity buttons to increase/decrease products for cart
*/
function mkdfInitQuantityButtons() {
$(document).on('click', '.mkdf-quantity-minus, .mkdf-quantity-plus', function (e) {
e.stopPropagation();
var button = $(this),
inputField = button.siblings('.mkdf-quantity-input'),
step = parseFloat(inputField.data('step')),
max = parseFloat(inputField.data('max')),
min = parseFloat(inputField.data('min')),
minus = false,
inputValue = typeof Number.isNaN === 'function' && Number.isNaN(parseFloat(inputField.val())) ? min : parseFloat(inputField.val()),
newInputValue;
if (button.hasClass('mkdf-quantity-minus')) {
minus = true;
}
if (minus) {
newInputValue = inputValue - step;
if (newInputValue >= 1) {
inputField.val(newInputValue);
} else {
inputField.val(0);
}
} else {
newInputValue = inputValue + step;
if (max === undefined) {
inputField.val(newInputValue);
} else {
if (newInputValue >= max) {
inputField.val(max);
} else {
inputField.val(newInputValue);
}
}
}
inputField.trigger('change');
});
}
/*
** Init select2 script for select html dropdowns
*/
function mkdfInitSelect2() {
var orderByDropDown = $('.woocommerce-ordering .orderby');
if (orderByDropDown.length) {
orderByDropDown.select2({
minimumResultsForSearch: Infinity
});
}
var variableProducts = $('.mkdf-woocommerce-page .mkdf-content .variations td.value select');
if (variableProducts.length) {
variableProducts.select2();
}
var shippingCountryCalc = $('#calc_shipping_country');
if (shippingCountryCalc.length) {
shippingCountryCalc.select2();
}
var shippingStateCalc = $('.cart-collaterals .shipping select#calc_shipping_state');
if (shippingStateCalc.length) {
shippingStateCalc.select2();
}
}
/*
** Init Product Single Pretty Photo attributes
*/
function mkdfInitSingleProductLightbox() {
var item = $('.mkdf-woo-single-page.mkdf-woo-single-has-pretty-photo .images .woocommerce-product-gallery__image');
if(item.length) {
item.children('a').attr('data-rel', 'prettyPhoto[woo_single_pretty_photo]');
if (typeof mkdf.modules.common.mkdfPrettyPhoto === "function") {
mkdf.modules.common.mkdfPrettyPhoto();
}
}
}
/*
** Init Woo Nav
*/
function mkdfInitWooCommerceCustomNavigation() {
var item = $('.woocommerce-pagination .page-numbers.current');
if(item.length) {
item.parent().prev().children().append('<span class="mkdf-icon-font-elegant arrow_left"></span>');
item.parent().next().children().prepend('<span class="mkdf-icon-font-elegant arrow_right"></span>');
}
}
})(jQuery);
