From 03afb35510b9dfd3d710c2335bc7bbf8daf5189e Mon Sep 17 00:00:00 2001 From: Alex Savenko Date: Wed, 20 Sep 2017 17:20:13 +0300 Subject: [PATCH] conflict --- frontend/web/js/custom.js | 6 +----- frontend/web/js/script.js | 397 +++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2 files changed, 4 insertions(+), 399 deletions(-) diff --git a/frontend/web/js/custom.js b/frontend/web/js/custom.js index d724a0a..8cf2829 100644 --- a/frontend/web/js/custom.js +++ b/frontend/web/js/custom.js @@ -1,8 +1,4 @@ -<<<<<<< HEAD -$(document).ready(function () { - -======= + $(document).ready(function () { ->>>>>>> 783eb6592414578ef89358f667fc9a8f2540d10f }) \ No newline at end of file diff --git a/frontend/web/js/script.js b/frontend/web/js/script.js index 0ad5334..2d7d28f 100755 --- a/frontend/web/js/script.js +++ b/frontend/web/js/script.js @@ -1,395 +1,8 @@ -<<<<<<< HEAD -$(function() { - - function scrollToMenu() { - $('.main-nav-item') - } - var basket = new ArtboxBasket({ - 'cartSelector': '#cart' - }); - - /** - * Modal form submit code - */ - $(document) - .on('beforeSubmit', '#feedback-form', function(e) { - var f = this; - var form = $(this); - var formData = form.serialize(); - $.ajax({ - url: form.attr("action"), - type: form.attr("method"), - data: formData, - success: function(data) { - f.reset(); - $('#feedback-modal') - .modal('hide'); - $('#success-modal') - .modal('show'); - }, - error: function() { - $('#feedback-modal') - .modal('hide'); - } - }); - }) - .on('submit', '#feedback-form', function(e) { - e.preventDefault(); - }); - - /** - * Contact form submitting - */ - $(document) - .on('beforeSubmit', '#contact-form', function(e) { - var f = this; - var form = $(this); - var formData = form.serialize(); - $.ajax({ - url: form.attr("action"), - type: form.attr("method"), - data: formData, - success: function(data) { - f.reset(); - form.replaceWith(data.alert); - }, - error: function() { - - } - }); - }) - .on('submit', '#contact-form', function(e) { - e.preventDefault(); - }); - - /** - * Button UP code - */ - if ($('#back-to-top').length) { - var scrollTrigger = 100, // px - backToTop = function() { - var scrollTop = $(window) - .scrollTop(); - if (scrollTop > scrollTrigger) { - $('#back-to-top') - .addClass('show'); - } else { - $('#back-to-top') - .removeClass('show'); - } - }; - backToTop(); - $(window) - .on('scroll', function() { - backToTop(); - }); - $('#back-to-top') - .on('click', function(e) { - e.preventDefault(); - $('html,body') - .animate({ - scrollTop: 0 - }, 700); - }); - } - - $(document) - .on('click', '.add-to-basket', function(e) { - e.preventDefault(); - var id = $(this) - .data('id'); - var xhr = basket.add(id, 1); - xhr.done(function() { - $.pjax.reload({ - container: '#basket-modal', - fragment: '#basket-modal', - timeout: 5000 - }); - }); - if ($('.alert-cart').length > 0) { - } else { - $('body') - .prepend($("
Товар добавлен в корзину.
")); - setTimeout(function() { - $(".alert-cart") - .addClass("active"); - }, 100); - setTimeout(function() { - $(".alert-cart") - .removeClass("active"); - }, 3500); - setTimeout(function() { - $(".alert-cart") - .remove(); - }, 3600); - } - }); - - $(document) - .on('click', '.remove-product-cart', function(e) { - e.preventDefault(); - var id = $(this) - .parents('.product-row-basket') - .data('id'); - showLoader('#basket'); - var xhr = basket.remove(id); - xhr.done(function() { - $.pjax.reload({ - container: '#basket', - fragment: '#basket', - timeout: 5000 - }); - }) - }); - - $(document) - .on('change', '.increase-product-basket', function(e) { - var id = $(this) - .parents('.product-row-basket') - .data('id'); - showLoader('#basket'); - showLoader('#basket-modal'); - var xhr = basket.set(id, $(this) - .val()); - xhr.done(function() { - if ($('#basket').length) { - $.pjax.reload({ - container: '#basket', - fragment: '#basket', - timeout: 5000 - }); - } - $.pjax.reload({ - container: '#basket-modal', - fragment: '#basket-modal', - timeout: 5000 - }); - }); - }); - - $(document) - .on('click', 'li.disabled a', function(e) { - e.preventDefault(); - }); - - $(document) - .on('submit', '#fast-buy-form', function(e) { - e.preventDefault(); - }); - - $(document) - .on('afterValidate', '#fast-buy-form', function(e, m, errors) { - if (!errors.length) { - var form = $(e.target); - var action = form.attr('action'); - $.post(action, form.serialize(), function(data) { - if (data.success) { - $('#oneclick-modal') - .find('.modal-body') - .text(data.msg); - } - }); - } - }.bind(this)); - - $(document) - .on( - 'click', '.wishlist-rm, .wishlist-add', function() { - var button = $(this); - $.ajax( - { - url: button.data('url'), - type: "POST", - data: { - 'variant': button.data('variant'), - 'product': button.data('product'), - 'user': button.data('user') - }, - success: function(data) { - button.replaceWith(data.button); - new PNotify( - { - title: 'Info', - text: data.message, - type: 'info', - styling: 'fontawesome' - } - ); - - } - } - ) - } - ); - - $(document) - .on( - 'click', '.wishlist-delete', function(e) { - e.preventDefault(); - var button = $(this); - $.ajax( - { - url: button.data('url'), - type: "POST", - data: { - 'product': button.data('product'), - 'variant': button.data('variant'), - 'user': button.data('user') - }, - success: function(data) { - if (data.success) { - $.pjax.reload({container: '#wishlist-products'}); - new PNotify( - { - title: 'Info', - text: data.message, - type: 'info', - styling: 'fontawesome' - } - ); - } - } - } - ); - } - ); - -}); -function showLoader(container) { - $(container) - .prepend('
'); -} - -$(document).ready(function ($) { - $('.vcovers').perfectScrollbar({wheelSpeed: 0.5}); -======= $(function() { - clickMenuButton(); - openMobMenu(); - closeMobMenu(); - addArrowMobMenuAndOpen(); - - function clickMenuButton() { - var menuButtonParent = $('.main-nav-item') - menuButtonParent.find('.btn-like').click(function (e) { - if(menuButtonParent.hasClass('home-page-menu')) { - e.preventDefault; - $('body, html').animate({scrollTop:$('.dropdown-menu.sidebar').offset().top + 2},500) - } else { - - $('body').append('
') - $('.catalog-menu-wrapper-start').addClass('opened'); - setTimeout(function () { - $('.catalog-menu-wrapper-start').addClass('visible_catalog') - },10) - } - }) - - $('body').on('click','.catalog-overlay',function () { - $(this).remove(); - $('.main-nav-item').removeClass('open'); - $('.catalog-menu-wrapper-start').removeClass('visible_catalog opened') - }) - } - - - - function mobOverlayAdd() { - $('body').append('
') - } - function mobOverlayRemove() { - $('.mob-overlay').remove() - } - - function openMobMenu() { - $('.menu_mob').click(function () { - mobOverlayAdd() - $('body').addClass('off-scroll') - $('#menu-mob-hidden').addClass('opens') - setTimeout(function () { - $('#menu-mob-hidden').addClass('visible') - },10) - }) - } - - function closeMobMenu() { - $('body').on('click','.mob-overlay',function () { - mobOverlayRemove() - if($('#menu-mob-hidden').hasClass('visible')) { - $('#menu-mob-hidden').removeClass('visible') - setTimeout(function () { - $('#menu-mob-hidden').removeClass('opens') - },200) - $('body').removeClass('off-scroll') - } - if($('.btn_call').hasClass('close')) { - $('.btn_call').removeClass('close') - closeCallMobileHide() - } - - }) - $('.close-menu-mob .close_mob').click(function () { - mobOverlayRemove() - $('#menu-mob-hidden').removeClass('visible') - setTimeout(function () { - $('#menu-mob-hidden').removeClass('opens') - },200) - $('body').removeClass('off-scroll') - $('#menu-mob-hidden ul li.has_ul').removeClass('open') - }) - } - - function closeCallMobileHide() { - $('.call-mobile-wr').removeClass('visible') - setTimeout(function () { - $('.call-mobile-wr').removeClass('open') - },200) - } - - function addArrowMobMenuAndOpen() { - $('#menu-mob-hidden ul li').each(function () { - if($(this).find('ul').length>0){ - $(this).addClass('has_ul') - $(this).parent().addClass('sub_m') - $('#menu-mob-hidden>ul').removeClass('sub_m').addClass('sub_m-first'); - } - }) - - - - $('body').on('click','#menu-mob-hidden ul li.has_ul a',function () { - if($(this).parent().parent().hasClass('sub_m')){ //если li элемент вложженый - if($(this).parent().hasClass('open')){ - $(this).parent().removeClass('open') - } else { - $('.sub_m').find('.has_ul').removeClass('open') - $(this).parent().addClass('open') - } - } - - if($(this).parent().parent().hasClass('sub_m-first')) { //если ли родительский открываем/закрываем - if($(this).parent().hasClass('open')) { - $(this).parent().removeClass('open') - $(this).parent().find('.open').removeClass('open') - } else { - $(this).parent().addClass('open') - } - - } - - }) - - - + + function scrollToMenu() { + $('.main-nav-item') } - - - - - - - - var basket = new ArtboxBasket({ 'cartSelector': '#cart' }); @@ -646,7 +259,3 @@ function showLoader(container) { .prepend('
'); } -$(document).ready(function ($) { - $('.vcovers').perfectScrollbar({wheelSpeed: 0.5}); ->>>>>>> 783eb6592414578ef89358f667fc9a8f2540d10f -}); \ No newline at end of file -- libgit2 0.21.4