/******/ (() => { // webpackBootstrap var __webpack_exports__ = {}; /*!**********************************!*\ !*** ./assets/src/js/scripts.js ***! \**********************************/ /** * Frontend scripts. * */ /* global wc_add_to_cart_params */ (function ($, window, document) { 'use strict'; /** * File skip-link-focus-fix.js. * * Helps with accessibility for keyboard only users. * * This is the source file for what is minified in the twenty_twenty_one_skip_link_focus_fix() PHP function. * * Learn more: https://git.io/vWdr2 */ function fixFocusLink() { var isIe = /(trident|msie)/i.test(navigator.userAgent); if (isIe && document.getElementById && window.addEventListener) { window.addEventListener('hashchange', function () { var id = location.hash.substring(1); if (!/^[A-z0-9_-]+$/.test(id)) { return; } var element = document.getElementById(id); if (element) { if (!/^(?:a|select|input|button|textarea)$/i.test(element.tagName)) { element.tabIndex = -1; } element.focus(); } }, false); } } fixFocusLink(); // on ready. $(document).ready(function () { $('.ayyash-countdown').each(function () { var $countdown = $(this); $countdown.countdown($countdown.data('date'), function (event) { $(this).html(event.strftime('
%D
' + 'Days' + '
%H
' + 'Hrs' + '
%M
' + 'Mins' + '
%S
' + 'Secs' + '
')); }); }); // Prevent Disable Functions $('.disabled').click(function (e) { e.preventDefault(); }); $('.variations_form .variations ul.variable-items-wrapper').each(function () { var select = $(this).prev('select'); var li = $(this).find('li'); $(this).on('click', 'li:not(.selected)', function () { var value = $(this).data('value'); li.removeClass('selected'); select.val(value).trigger('change'); $(this).addClass('selected'); }); $(this).on('click', 'li.selected', function () { li.removeClass('selected'); select.val('').trigger('change'); select.trigger('click'); select.trigger('focusin'); select.trigger('touchstart'); }); }); $('.quantity input.qty').after('+-'); $(document).on('click', 'span.qty-btn', function (event) { var $target = $(event.target); var $input = $target.parents('.quantity').find('input[type="number"]'); var max = Number($input.attr('max')); var min = Number($input.attr('min')); var step = Number($input.attr('step')); var value = Number($input.val()); if ($target.hasClass('inc')) { value = value + step; if (max !== 0 && value > max) { return; } $input.val(value); $input.trigger('change'); } if ($target.hasClass('dec')) { value = value - step; if (value < min) { return; } $input.val(value); $input.trigger('change'); } }); $(document).on('click', '.mini_cart_item a.remove', function (e) { e.preventDefault(); var product_id = $(this).attr('data-product_id'); var cart_item_key = $(this).attr('data-cart_item_key'); var product_container = $(this).parents('.mini_cart_item'); // Add loader product_container.block({ message: null, overlayCSS: { cursor: 'none' } }); $.ajax({ type: 'POST', dataType: 'json', url: wc_add_to_cart_params.ajax_url, data: { action: 'product_remove', product_id: product_id, cart_item_key: cart_item_key }, success: function success(response) { if (!response || response.error) { return; } var fragments = response.fragments; // Replace fragments if (fragments) { $.each(fragments, function (key, value) { $(key).replaceWith(value); }); } } }); }); $(document).on('change', '.ayyash-attributes input', function () { $('.ayyash-attributes input:checked').each(function (index, element) { var $el = $(element); $('select[name="' + $el.attr('name') + '"]').val($el.attr('value')).trigger('change'); }); }); $(document).on('woocommerce_update_variation_values', function () { $('.ayyash-attributes input').each(function (index, element) { var $el = $(element); $el.removeAttr('disabled'); if ($('select[name="' + $el.attr('name') + '"] option[value="' + $el.attr('value') + '"]').is(':disabled')) { $el.prop('disabled', true); } }); }); $('.variations_form').on('click', '.reset_variations', function () { $('.ayyash-attributes input').val('').removeAttr('checked').prop('checked', false); }); // $( '.post-medium' ).each( function() { // const self = $( this ); // self.find( '.post-image' ).css( 'height', self.height() ); // } ); }); //$( "#preloader" ).hide(); // Grid masonary $('.grid-container').masonry({ itemSelector: '.post-grid-wrap', gutter: 30, percentPosition: true }); // Ayyash all slider activations $(document).ready(function () { $('.ayyash-slider-active').slick(); }); /** * Counter js */ $(document).ready(function () { $('.counter').counterUp({ delay: 10, time: 1000 }); }); /** * Product value for buy now button */ /*$(document).ready( function () { let url = ayyash_ajax.siteurl + '/cart', productId = ayyash_ajax.post_id, productIdWrap = $( '.woocommerce-variation-add-to-cart .variation_id' ), qtyWrap = $( '.woocommerce-variation-add-to-cart .qty' ), qty = 1; $( " .woocommerce-variation-add-to-cart .variation_id, .woocommerce-variation-add-to-cart .qty " ).change( function() { productId = productIdWrap.val(); qty = qtyWrap.val(); $('.ayyash-single-buy-now').attr('href', url + '?add-to-cart=' + productId + '&quantity=' + qty ); }); });*/ })(jQuery, window, document); /******/ })() ;