{"version":3,"sources":["main.js"],"names":["mobileNavigationToggle","$","this","toggleClass","setTimeout","css","removeClass","hasClass","scrollBarWidth","window","outerWidth","width","fadeIn","addClass","fadeOut","mobileNavigationHide","on","e","preventDefault","val","attr","submit","parent","find","url","value","encodeURIComponent","location","keyCode","trigger","cart","change","el","key","qtyEl","qtyVal","parseInt","match","Number","isNaN","update","plus","closest","minus","add","product_id","quantity","ajax","type","data","dataType","success","json","remove","toastr","html","load","initHeight","outerHeight","newHeight"],"mappings":"AAAA,aAiCA,SAASA,yBASP,GARAC,EAAEC,MAAMC,YAAY,QACpBC,YACE,WAAA,OAAMH,EAAE,iBAAiBE,YAAY,UACvC,KAEAF,EAAE,YAAYI,IAAI,QAAS,IAC3BJ,EAAE,QAAQI,IAAI,eAAgB,IAAIC,YAAY,mBAE1CL,EAAEC,MAAMK,SAAS,QAAS,CAC5B,IAAIC,EAAiBP,EAAEQ,QAAQC,aAAeT,EAAEQ,QAAQE,QAExDV,EAAE,YAAYW,OAAO,QAAQP,IAAI,QAASG,GAC1CP,EAAE,QAAQY,SAAS,mBAAmBR,IAAI,eAAgBG,QAE1DJ,YAAW,WAAA,OAAMH,EAAE,YAAYa,QAAQ,UAAS,KAKpD,SAASC,uBACPd,EAAE,0BAA0BK,YAAY,QACxCL,EAAE,iBAAiBK,YAAY,QAC/BL,EAAE,YAAYI,IAAI,QAAS,IAAIS,QAAQ,QAEvCb,EAAE,QAAQI,IAAI,eAAgB,IAAIC,YAAY,mBAxDhDL,GAAE,WAEDA,EAAE,mCAAmCe,GAAG,SAAS,SAASC,GACzDA,EAAEC,iBAEFjB,EAAE,qCAAuCkB,IAAIlB,EAAEC,MAAMkB,KAAK,SAE1DnB,EAAE,kBAAkBoB,YAIrBpB,EAAE,gCAAkCqB,SAASC,KAAK,UAAUP,GAAG,SAAS,WACvE,IAAIQ,EAAMvB,EAAE,QAAQmB,KAAK,QAAU,iCAE/BK,EAAQxB,EAAE,uCAAyCkB,MAEnDM,IACHD,GAAO,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,EAAE,mDAAmDyD,cACxEzD,EAAE,mDAAmDI,IAAI,SAAUoD,GAEnExD,EAAE8C,KAAK,CACNvB,IAAK,qCACLwB,KAAM,OACHC,KAAM,YAAchB,EAAM,WAA4B,IAAba,EAA2BA,EAAW,GAClFI,SAAU,OACVC,QAAS,SAAAA,QAASC,GAEjBhD,YAAW,WACVH,EAAE,cAAcsD,KAAKH,EAAI,SACvB,KAEH,IAAMO,EAAY1D,EAAE,mDAAmDyD,cACvEzD,EAAE,mDAAmDI,IAAI,SAAUsD,GAEnE1D,EAAE,8BAA8BuD,KAAK,uDAIxCH,OAAU,SAAAA,OAASpB,GAClBhC,EAAE8C,KAAK,CACNvB,IAAK,uCACLwB,KAAM,OACNC,KAAM,OAAShB,EACfiB,SAAU,OACVC,QAAS,SAAAA,QAASC,GAEjBhD,YAAW,WACVH,EAAE,cAAcsD,KAAKH,EAAI,SACvB,KAEHnD,EAAE,uCAAuCuD,KAAK","file":"common.min.js","sourcesContent":["'use strrict'\n\n$(function() {\n\t// Language\n\t$('#form-language .language-select').on('click', function(e) {\n\t\te.preventDefault()\n\n\t\t$('#form-language input[name=\\'code\\']').val($(this).attr('name'))\n\n\t\t$('#form-language').submit()\n\t})\n\n // Search\n\t$('#search input[name=\\'search\\']').parent().find('button').on('click', function() {\n\t\tvar url = $('base').attr('href') + 'index.php?route=product/search'\n\n\t\tvar value = $('header #search input[name=\\'search\\']').val()\n\n\t\tif (value) {\n\t\t\turl += '&search=' + encodeURIComponent(value)\n\t\t}\n\n\t\tlocation = url\n\t})\n\n\t$('#search input[name=\\'search\\']').on('keydown', function(e) {\n\t\tif (e.keyCode == 13) {\n\t\t\t$('header #search input[name=\\'search\\']').parent().find('button').trigger('click')\n\t\t}\n\t})\n})\n\n// Открытие/Закрытие мобильного навигационного меню\nfunction mobileNavigationToggle() {\n $(this).toggleClass('open')\n setTimeout(\n () => $('#navbarMobile').toggleClass('open'),\n 200)\n\n $('.overlay').css('right', '')\n $('body').css('paddingRight', '').removeClass('overflow-hidden')\n\n if ($(this).hasClass('open')) {\n let scrollBarWidth = $(window).outerWidth() - $(window).width()\n\n $('.overlay').fadeIn('fast').css('right', scrollBarWidth)\n $('body').addClass('overflow-hidden').css('paddingRight', scrollBarWidth)\n } else {\n setTimeout(() => $('.overlay').fadeOut('fast'), 200)\n }\n}\n\n// Скрытие мобильного навигационного меню\nfunction mobileNavigationHide() {\n $('[data-toggle=\"navbar\"]').removeClass('open')\n $('#navbarMobile').removeClass('open')\n $('.overlay').css('right', '').fadeOut('fast')\n\n $('body').css('paddingRight', '').removeClass('overflow-hidden')\n}\n\n// Cart add remove functions\nvar cart = {\n\t'change': function(el, key) {\n let qtyEl = $(el),\n qtyVal = parseInt(qtyEl.val().match(/\\d+/g), 10);\n\n qtyVal = qtyVal > 1 && !Number.isNaN(qtyVal) ? qtyVal : 1;\n\n\t\tthis.update(key, qtyVal);\n\t},\n\t'plus': function(el, key) {\n let qtyEl = $(el).closest('.cart-quantity').find('input[name^=\"quantity\"]'),\n qtyVal = parseInt(qtyEl.val().match(/\\d+/g), 10);\n\n qtyVal = !Number.isNaN(qtyVal) ? ++qtyVal : 1;\n\n this.update(key, qtyVal);\n\t},\n\t'minus': function(el, key) {\n let qtyEl = $(el).closest('.cart-quantity').find('input[name^=\"quantity\"]'),\n qtyVal = parseInt(qtyEl.val().match(/\\d+/g), 10);\n\n\t\tqtyVal = qtyVal > 1 && !Number.isNaN(qtyVal) ? --qtyVal : 1;\n\n this.update(key, qtyVal);\n\t},\n\t'add': function(product_id, quantity) {\n\t\t$.ajax({\n\t\t\turl: 'index.php?route=checkout/cart/add',\n\t\t\ttype: 'post',\n\t\t\tdata: 'product_id=' + product_id + '&quantity=' + (typeof(quantity) != 'undefined' ? quantity : 1),\n\t\t\tdataType: 'json',\n\t\t\tsuccess: function(json) {\n\t\t\t\t$('.alert-dismissible, .text-danger').remove();\n\n\t\t\t\tif (json['redirect']) {\n\t\t\t\t\tlocation = json['redirect'];\n\t\t\t\t}\n\n\t\t\t\tif (json['success']) {\n toastr.success(json['success']);\n\n $('#cartTotal').html(json['total']);\n\n $('#modalHeaderCart .modal-header-cart').load('index.php?route=common/cart/info .modal-header-cart > div');\n }\n\t\t\t}\n\t\t});\n\t},\n\t'update': function(key, quantity) {\n\t\tconst initHeight = $('#modalHeaderCart .modal-header-cart .modal-body').outerHeight();\n\t\t$('#modalHeaderCart .modal-header-cart .modal-body').css('height', initHeight);\n\t\t\n\t\t$.ajax({\n\t\t\turl: 'index.php?route=checkout/cart/edit',\n\t\t\ttype: 'post',\n data: 'quantity[' + key + ']=' + (typeof(quantity) != 'undefined' ? quantity : 1),\n\t\t\tdataType: 'json',\n\t\t\tsuccess: function(json) {\n\t\t\t\t// Need to set timeout otherwise it wont update the total\n\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t$('#cartTotal').html(json['total']);\n\t\t\t\t}, 100);\n\n\t\t\t\tconst newHeight = $('#modalHeaderCart .modal-header-cart .modal-body').outerHeight();\n\t\t\t\t$('#modalHeaderCart .modal-header-cart .modal-body').css('height', newHeight);\n\n\t\t\t\t$('#modalHeaderCart #cartBody').load('index.php?route=common/cart/info #cartBody > li');\n\t\t\t}\n\t\t});\n\t},\n\t'remove': function(key) {\n\t\t$.ajax({\n\t\t\turl: 'index.php?route=checkout/cart/remove',\n\t\t\ttype: 'post',\n\t\t\tdata: 'key=' + key,\n\t\t\tdataType: 'json',\n\t\t\tsuccess: function(json) {\n\t\t\t\t// Need to set timeout otherwise it wont update the total\n\t\t\t\tsetTimeout(function () {\n\t\t\t\t\t$('#cartTotal').html(json['total']);\n\t\t\t\t}, 100);\n\n\t\t\t\t$('#modalHeaderCart .modal-header-cart').load('index.php?route=common/cart/info .modal-header-cart > div');\n\t\t\t}\n\t\t});\n\t}\n}"]}