PATH:
home
/
lab2454c
/
dansact.com
/
wp-content
/
themes
/
igpma
/
inc
/
assets
/
js
(function ($) { $(document).ready(function ($) { "use strict"; $("#nav-item").click(function () { // Remove active if this does not have active class if (!($(this).closest("nav-item").hasClass("active"))) { $(this).closest("#nav-item").find("active").removeClass('active'); } $(this).closest("nav-item").addClass('selected'); }); $('.hamburger-menu').on('click', function () { $('.bar').toggleClass('animate'); }) // $('.dropdown-menu > li > .dropdown-menu').parent().addClass('dropdown-submenu').find(' > .dropdown-item').attr('href', 'javascript:;').addClass('dropdown-toggle'); // $('.dropdown-submenu > a').on("click", function(e) { // var dropdown = $(this).parent().find(' > .show'); // $('.dropdown-submenu .dropdown-menu').not(dropdown).removeClass('show'); // $(this).next('.dropdown-menu').toggleClass('show'); // e.stopPropagation(); // }); // $('.dropdown').on("hidden.bs.dropdown", function() { // $('.dropdown-menu.show').removeClass('show'); // }); $('.dropdown-menu > li > .dropdown-menu').parent().addClass('dropdown-submenu').find(' > .dropdown-item').addClass('dropdown-toggle'); $('.dropdown-submenu > a').on("click", function (e) { if (!$(this).next().hasClass('show')) { $(this).parents('.dropdown-menu').first().find('.show').removeClass('show'); } var $subMenu = $(this).next('.dropdown-menu'); $subMenu.toggleClass('show'); $(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function (e) { $('.dropdown-submenu .show').removeClass('show'); }); return false; }); $('.dropdown-item').click(function () { $('.dropdown-item').removeClass('dropdown__item__show') $(this).addClass('dropdown__item__show'); }); if ($(window).width() > 769) { $('.navbar .dropdown').hover(function () { $(this).find('.dropdown-menu').first().stop(true, true).delay(250).slideDown(); }, function () { $(this).find('.dropdown-menu').first().stop(true, true).delay(100).slideUp(); }); $('.navbar .dropdown > a').click(function () { location.href = this.href; }); } $(".product__wrapp__bottom > a").on('click', function (e) { e.preventDefault() let btn = $(this), product = btn.data('product'), qty = $(this).parent().find("input[name='quantity']").val(), varnt = $(this).parent().parent().find("input[name='radio-" + product + "']:checked").val() btn.attr("tabindex", "-1").addClass("disabled") if (parseInt(product) && parseInt(qty) > 9 && typeof woocommerce_params.ajax_url != 'undefined') { data = { action: 'add_checkout', product, varnt, qty } $.post(woocommerce_params.ajax_url, data, function (response) { btn.attr("tabindex", "").removeClass("disabled") if (response == 'success') { window.location = site_object.wc_checkout_url return; } if ('yes' === wc_add_to_cart_params.cart_redirect_after_add) { window.location = wc_add_to_cart_params.cart_url return } // refresh cart fragments etc $(document.body).trigger('added_to_cart', [response.fragments, response.cart_hash]) }) } }) // $(".quantity__selectors > .increment__quantity").on('click', function () { // let inpt = $(this).closest(".product__wrapp__bottom").find("input[name='quantity']") // inpt.val(parseInt(inpt.val()) + 1000) // if ($(document).find(".woocommerce-cart").length) { // $(".actions > .button").attr('disabled', false).attr('aria-disabled', false) // } // }) // $(".quantity__selectors > .decrement__quantity").on('click', function () { // let inpt = $(this).closest(".product__wrapp__bottom").find("input[name='quantity']") // parseInt(inpt.val()) > 1000 && ( // inpt.val(parseInt(inpt.val()) - 1000), // $(document).find(".woocommerce-cart").length && $(".actions > .button").attr('disabled', false).attr('aria-disabled', false) // ) // }) $("input[type='radio']").on('change', function () { let sprice = $(this).data('sprice'), product = $(this).data('product') sprice != '' && product != '' && $(`.spot__price__${product}`).html(sprice) }) window.onload = () => { (typeof $.cookie('invite_code') === 'undefined') && $("#myModal").modal('show') ($(".post-type-archive-product").length || $(".single-product").length) && $('input[name="quantity"]').length && ( $('input[name="quantity"]').val(10), $('input[name="quantity"]').attr('data-min',10) ) } $('form[name="invite_codes"]').on('submit', function () { var form_data = $(this).serializeArray(); // Here we add our nonce (The one we created on our functions.php. WordPress needs this code to verify if the request comes from a valid source. form_data.push({ "name": "security", "value": ajax_nonce }); // Here is the ajax petition. $.ajax({ url: ajax_url, // Here goes our WordPress AJAX endpoint. type: 'post', data: form_data, success: function (response) { if (response == 'success') { // You can craft something here to handle the message return $.cookie("invite_code", 1, { expires: 7, path: '/' }); $("#myModal").modal('hide'); } else { alert(response); // window.onload = () => { // $("#myModal").modal('show'); // } } }, fail: function (err) { // You can craft something here to handle an error if something goes wrong when doing the AJAX request. alert("There was an error: " + err); } }); // This return prevents the submit event to refresh the page. return false; }); $(".increment__quantity,.decrement__quantity").on("click", function (ev) { var curInpt = $(this).closest(".product__wrapp__bottom").find("input[name='quantity']") var currentQty = curInpt.val() //$('input[name="quantity"]').val(); var qtyDirection = $(this).data("direction"); var newQty = 0; if (qtyDirection == "1") { newQty = parseInt(currentQty) + 1; } else if (qtyDirection == "-1") { newQty = parseInt(currentQty) - 1; } if (newQty == 1) { $(".decrement__quantity").attr("disabled", "disabled"); } if (newQty > 1) { $(".decrement__quantity").removeAttr("disabled"); } if (newQty > 0) { newQty = newQty.toString(); curInpt.val(newQty); } else { curInpt.val("1"); } }); }) })(jQuery)
[+]
..
[-] script.js
[edit]
[-] scripts.js
[edit]
[-] main.js
[edit]
[-] owl.carousel.js
[edit]