Andrei | удалил лишний закоменченный js

pull/36/head
parent 963bc398c0
commit 6edee6712d
  1. 175
      wp-content/themes/cosmopet/modules/layout/assets/js/gp-main.js
  2. 77
      wp-content/themes/cosmopet/modules/shop/components/catalog/assets/js/_gp-function.js

@ -1,133 +1,5 @@
'use strict'; 'use strict';
jQuery(document).ready(function ($) {
// OVERLAY
// $('.product__main').on('click', '.open-overlay', function () {
// let product = $(this).closest('.product__item'),
// overlay = product.find('.product-item__overlay');
// $('.product__item').find('.product-item__overlay').css('top', '100%');
// overlay.css('top', 0);
// })
// END OVERLAY
// $('.product__main').on('click', '.state__button', function(evt) {
// evt.preventDefault();
// let product = $(this).closest('.product__item');
// let price = $(this).data('product_price');
// let id = $(this).data('product_id');
// let qty = product.find('.counter__input').val();
// product.find('.product-item-overlay__price').html(price * qty + ' ');
// product.find('.select__state').data('product_price', price).data('product_id', id).val($(this).text().trim());
// product.find('.state__block').removeClass('expanded').css('height', '0');
// product.find('.add_to_cart_button').detach();
// product.find('.product-item-overlay__button').prepend('<a href="?add-to-cart=' + id + '" data-quantity="' + qty +'" class="ajax_add_to_cart add_to_cart_button button button--gradient button--base button--100-perc" data-product_id="'+id+'">Добавить в корзину</a>');
// })
// $('.product__main').on('click', '.counter__button', function(evt) {
// evt.preventDefault();
// let product = $(this).closest('.product__item');
// let price = parseFloat(product.find('.select__state').data('product_price'));
// if (!price){
// price = parseFloat(product.find('.product-item__price p').html());
// }
// let qty = product.find('.counter__input');
// if ($(this).hasClass('minus') && parseInt(qty.val()) >= 2) {
// qty.val(parseInt(qty.val()) - 1);
// } else {
// if ($(this).hasClass('plus')) {
// qty.val(parseInt(qty.val()) + 1);
// }
// }
// product.find('.product-item-overlay__button a').attr('data-quantity', qty.val())
// product.find('.product-item-overlay__price').html(price * qty.val() + ' ');
// })
// $('.product__main').on('click', '.select__state', function(evt) {
// evt.preventDefault();
// let product = $(this).closest('.product__item'),
// listing = product.find('.state__block');
// if (listing.hasClass('expanded')) {
// listing.removeClass('expanded').css('height', '0');
// } else {
// listing.addClass('expanded').css('height', 'auto');
// }
// product.find('.state__block').find('.state__button').removeClass('active');
// product.find('.state__button').each(function () {
// if (product.find('.select__state').data('product_id') === $(this).data('product_id')) {
// $(this).addClass('active');
// }
// })
// })
// let page = 1;
// jQuery('body').on('click', '#load-more-products', function(e) {
// e.preventDefault();
// page++;
// let category = $(this).data('category_id');
// let category_type = $(this).data('category_type');
// $.ajax({
// type: 'POST',
// url: '/wp-admin/admin-ajax.php',
// dataType: 'html',
// data: {
// 'action' : 'get_products',
// 'get_page' : page,
// 'get_category' : category,
// 'get_category_type' : category_type,
// },
// success: function(data) {
// // if($('<div></div>').html(data).find('.archive__item.ended').size() > 0) $('#load-more-products').parents('.cta').remove();
// // else $('#load-more-products').parents('.cta').show();
// $('#load-more-products').detach();
// $('.product__main').append(data);
// $('#load-more-products').prependTo('.product__footer');
// },
// error: function(data) {
// console.log(data);
// }
// });
// });
// $('.wpfMainWrapper').prepend('<div class="wpfFilters"></div>');
// $('.wpfMainWrapper').find('.wpfFilterWrapper').appendTo($('.wpfFilters'));
// $('.wpfFilterWrapper').each(function () {
// if ($(this).data('filter-type') === 'wpfPrice') {
// $(this).find('.wpfFilterContent').append('<div class="wpfExpandablePart"></div>');
// $(this).find('.wpfPriceFilterRange').appendTo('.wpfExpandablePart');
// $(this).find('.wpfPriceInputs').appendTo('.wpfExpandablePart');
// $(this).find('.wpfCurrencySymbol').detach();
// $(this).find('.wpfFilterDelimeter').detach();
// }
// });
// $('.wfpDescription').on('click', function () {
// $(this).closest('.wpfFilterWrapper').toggleClass('expanded').find('.wpfCheckboxHier').slideToggle();
// $(this).parent().find('.wpfExpandablePart').slideToggle();
// })
})
// header // header
toggleOpenX('.lang', '.lang__open', '.lang__list', '.lang__content', false); toggleOpenX('.lang', '.lang__open', '.lang__list', '.lang__content', false);
toggleHeader('#pc-menu','.header__menu-block','.header__pc-menu', '.white', 'white'); toggleHeader('#pc-menu','.header__menu-block','.header__pc-menu', '.white', 'white');
@ -304,50 +176,3 @@ jQuery(document).ready(function($) {
}); });
// // Находим все элементы с классом login-open
// document.addEventListener('DOMContentLoaded', function() {
// const loginButtons = document.querySelectorAll('.login-open');
// loginButtons.forEach(button => {
// button.addEventListener('click', function(event) {
// event.preventDefault();
// const modal = document.querySelector('.modal');
// const modalAside = document.querySelector('.modal__aside');
// const modalLogin = document.querySelector('.modal__login');
// modal.classList.add('active');
// modalLogin.classList.add('active');
// // Set width and slide in from right
// modalAside.style.width = '20vw';
// modalAside.style.right = '0';
// });
// });
// const closeButtons = document.querySelectorAll('.modal-close');
// const modal = document.querySelector('.modal');
// closeButtons.forEach(button => {
// button.addEventListener('click', closeModal);
// });
// modal.addEventListener('click', function(event) {
// if (event.target === modal) {
// closeModal();
// }
// });
// function closeModal() {
// const modal = document.querySelector('.modal');
// const modalAside = document.querySelector('.modal__aside');
// const modalLogin = document.querySelector('.modal__login');
// modal.classList.remove('active');
// modalLogin.classList.remove('active');
// // Reset styles
// modalAside.style.width = '';
// modalAside.style.right = '-30vw';
// }
// });

@ -1,82 +1,5 @@
'use strict'; 'use strict';
// // function
// export function modalOpen(buttonElement, contentElement){
// let modal = document.querySelector('.modal'),
// aside = document.querySelector('.modal__aside'),
// elements = document.querySelectorAll(buttonElement),
// device = window.screen.width;
// elements.forEach(e => {
// let thisContentElement = document.querySelector(contentElement);
// e.onclick = function () {
// modal.classList.add('active');
// thisContentElement.classList.add('active');
// let width = thisContentElement.clientWidth;
// setTimeout(() => {
// if (device <= 720) {
// aside.style.width = `${device}px`;
// thisContentElement.style.opacity = 1;
// thisContentElement.style.filter = 'blur(0px)';
// }else{
// aside.style.width = `${width}px`;
// thisContentElement.style.opacity = 1;
// thisContentElement.style.filter = 'blur(0px)';
// }
// }, 10);
// }
// })
// }
// export function modalClose(buttonElement) {
// let modal = document.querySelector('.modal'),
// aside = document.querySelector('.modal__aside'),
// asideItems = document.querySelectorAll('.modal__item'),
// elements = document.querySelectorAll(buttonElement);
// elements.forEach(e => {
// e.onclick = function () {
// aside.style.width = '0px';
// asideItems.forEach(e => {
// if (e.classList.contains('active')) {
// e.style.filter = 'blur(10px)';
// }
// });
// setTimeout(() => {
// asideItems.forEach(e => {
// if (e.classList.contains('active')) {
// e.classList.remove('active');
// }
// });
// modal.classList.remove('active');
// }, 300);
// }
// })
// }
// export function closeModalForm(close){
// let buttons = document.querySelectorAll(close),
// modal = document.querySelector('.modal');
// buttons.forEach(button => {
// button.onclick = function (buttonEvent) {
// modal.classList.remove('active');
// if (!modal.querySelector('.modal-map.active')) {
// modal.querySelector('.modal-form.active').classList.remove('active');
// }else{
// modal.querySelector('.modal-map.active').classList.remove('active');
// }
// }
// })
// }
export function toggleOpenX(mainElement, buttonElement ,heightElement, contentElement, close) { export function toggleOpenX(mainElement, buttonElement ,heightElement, contentElement, close) {
let elements = document.querySelectorAll(mainElement); let elements = document.querySelectorAll(mainElement);

Loading…
Cancel
Save