Your IP : 3.145.191.128
/* new_category.js */
$(document).ready(function() {
// костыли что бы убрать ненужное форматирование
$('.layout__content > .content-center').removeClass('content-center');
$('.layout__page-header').remove();
$('.breadcrumbs').remove();
//скрол по стрелке
$(document).on('click', '.move-to-next-block', function() {
var scroll_el = $(this).parents('.block').next('.block');
$(this).parents('.block').next('.block');
if ($(scroll_el).length != 0) {
$('html, body').animate({ scrollTop: $(scroll_el).offset().top }, 500); // анимируем скроолинг к элементу scroll_el
}
});
if ($(window).width() < 767) {
$('video').removeAttr('autoplay');
$('video').removeAttr('controls');
} else {
$('video').removeAttr('controls');
if ($('.video-container').find('video').get(0)) {
$('.video-container').find('video').get(0).play();
}
}
$('.video-container').click(function() {
$(this).find('video').get(0).play();
$(this).addClass('play');
});
/*
$('.block__item-half-image-text_right').each(function() {
var current = $(this);
$(current).load(function() {
alert(`Изображение загружено, размеры1 ${this.width}x${this.height}`);
$(current).parents('.block__item_half').height($(this).height());
$(current).hide();
});
});
$('.block__item-half-image-text_left').each(function() {
var current = $(this);
$(current).load(function() {
alert(`Изображение загружено, размеры2 ${this.width}x${this.height}`);
$(current).parents('.block__item_half').height($(this).height());
$(current).hide();
});
});
*/
// task #127521
if($(window).width() > 767) {
$('.block__item-half-image-text_right, .block__item-half-image-text_right, .block__item-half-image').one("load", function() {
}).each(function() {
if(this.complete) {
$(this).load(); // For jQuery < 3.0
// $(this).trigger('load'); // For jQuery >= 3.0
var current = $(this);
// alert(`Изображение загружено, размеры2 ${this.width}x${this.height}`);
$(current).parents('.block__item_half').height($(this).height());
$(current).hide();
}
});
}
else {
$('.block__item-half-image-text_right,.block__item-half-image-text_right, .block__item-half-image').hide();
}
$('#calculation__select-box').on('change', function () {
if ($(this).val() === '2') {
$('.calculation__col-floor.hidden').removeClass('hidden');
$('.calculation__col-items.hidden').removeClass('hidden');
} else {
$('.calculation__col-floor').last().addClass('hidden');
$('.calculation__col-items').last().addClass('hidden');
}
});
// Открытие popup
(function () {
var $btn = $('.js-open-popup');
var $popup = $('.calculation-example-popup');
$btn.on('click', function (e) {
e.preventDefault();
var text = $(this)
.closest('.multiple-items__item')
.find('.multiple-items__item-head-center')
.text();
$popup.find('.multiple-popup__object').text(text);
$popup.fadeIn(300);
$('body').css('overflow', 'hidden');
});
$popup.find('.multiple-popup__close').on('click', function () {
$popup.fadeOut(300);
$('body').css('overflow', 'visible');
});
})();
(function () {
var $select = $('.calculation__select');
var selectFlag = true;
$select.on('click', function (e) {
var target = $(e.target);
if (selectFlag) {
selectFlag = false;
$(this).find('.calculation__select-list').css('visibility', 'visible');
} else {
selectFlag = true;
$(this).find('.calculation__select-list').css('visibility', 'hidden');
}
if (target.hasClass('calculation__select-item')) {
target.closest('.calculation__select').find('.calculation__select-text').text(target.text());
}
});
})();
// Попап формы
(function () {
var $form = $('.js-popup-form');
var series = $form.find('.js-series').find('.calculation__select-text').text();
var power;
var konvektor;
if ($form.length) {
/*Выбор серии*/
$('.js-series').on('click', function (e) {
var target = $(e.target);
if (target.hasClass('calculation__select-item')) {
series = target.text();
sendAjax(JSON.stringify({ series: series}));
/*показать поля выбора мощности*/
$('.multiple-popup__title').css('visibility','');
$('.js-power').css('visibility','');
}
});
/*Выбор мощности*/
$('.js-power').on('click', function (e) {
var target = $(e.target);
if (target.hasClass('calculation__select-item')) {
power = parseFloat(target.text());
/*Добавление кнопки Купить*/
$('.js-add-to-cart').css('visibility','');
konvektor = sendAjax(JSON.stringify({ series: series, power: power }));
konvektor.then(function (data) {
var quantity = $form.find('.input-number__input').val();
var id = data[0].id;
/*показать поля выбора количества*/
$('.input-number-konvektor').css('visibility','');
/*показать кнопку Добавить в корзину*/
$('.js-add-to-cart').attr('href', '/ajax/add2basketpromo.php?ID=' + id + '&quantity=' + quantity);
$('.js-add-to-cart').attr('data-id', id);
});
}
});
}
function sendAjax(data) {
return new Promise(function (resolve) {
$.ajax({
url: '/local/templates/home-comfort/components/bitrix/catalog/promo/bitrix/catalog.section/.default/order_send.php',
method: 'POST',
data: data,
contentType: 'application/json',
success: function (data) {
resolve(data);
//console.log(data);
}
});
});
}
}());
// Калькулятор
(function () {
var $addRoomButton = $('.js-add-room');
var $roomContainer = $('.js-append-room');
var $select = $('.calculation__select');
var listRooms = [{
nameRoom: '',
square: '',
ceilingHeight: '',
windows: ''
}];
var values = {
roomsNames: [],
sumSquare: 0,
averageCeilingHeight: 0,
sumWindows: 0,
radio: 0,
monthEnergy: 0,
series: '',
}
var goodsArr = [];
$select.on('click', function (e) {
var target = $(e.target);
if (target.hasClass('calculation__select-item')) {
values.series = target.text();
}
});
$addRoomButton.on('click', function () {
var $roomHtml = $('<div class="inline">\n' +
'<div class="calculation__field calculation__field_big">\n' +
'<div class="calculation__field-name js-increment">Название помещения #<span><span></div>\n' +
'<input class="calculation__field-enter" type="text" name="name-room" value="">\n' +
'</div>\n' +
'<div class="calculation__field calculation__field_small">\n' +
'<div class="calculation__field-name">Площадь</div>\n' +
'<input class="calculation__field-enter" type="text" name="square" value="" onkeyup="this.value = this.value.replace (/\\D/, \'\')">\n' +
'<div class="calculation__field-measurement">м<sup>2</sup></div>\n' +
'</div>\n' +
'<div class="calculation__field calculation__field_small">\n' +
'<div class="calculation__field-name">Высота потолка</div>\n' +
'<input class="calculation__field-enter" type="text" name="ceiling-height" value="" >\n' +
'<div class="calculation__field-measurement">м</div>\n' +
'</div>\n' +
'<div class="calculation__field calculation__field_small">\n' +
'<div class="calculation__field-name">Количество окон</div>\n' +
'<input class="calculation__field-enter calculation__field-enter_full" type="text" name="windows" value="">\n' +
'</div>\n' +
'</div>');
var $increment;
if ($addRoomButton.closest('.calculation__col-floor').length) {
$(this).before($roomHtml);
$increment = $(this).closest('.calculation__col-floor').find('.js-increment');
$increment.last().find('span').text($increment.length);
} else {
$addRoomButton.before($roomHtml);
$increment = $('.js-increment');
$increment.last().find('span').text($increment.length);
}
listRooms.push({
nameRoom: '',
square: '',
ceilingHeight: '',
windows: ''
});
$('.js-averageCeilingHeight').val('');
values.averageCeilingHeight = 0;
});
$roomContainer.on('input', function (e) {
var self = $(e.target);
var index = self.closest('.inline').index();
if (self.hasClass('calculation__field-enter')) {
if (self.attr('name') === 'name-room') {
listRooms[index].nameRoom = self.val();
} else if (self.attr('name') === 'square') {
self.val(self.val().replace(',', '.'));
listRooms[index].square = self.val();
} else if (self.attr('name') === 'ceiling-height') {
self.val(self.val().replace(',', '.'));
listRooms[index].ceilingHeight = self.val();
} else if (self.attr('name') === 'windows') {
self.val(parseInt(self.val()) || '' || '0');
listRooms[index].windows = self.val();
}
}
if (listRooms[index].square ||
listRooms[index].ceilingHeight ||
listRooms[index].windows ||
listRooms[index].nameRoom) {
var sumSquare = 0;
var averageCeilingHeight = 0;
var sumWindows = 0;
var printAverageCeilingHeight = true;
for (var i = 0; i < listRooms.length; i++) {
sumSquare += parseFloat(listRooms[i].square) || 0;
sumWindows += parseInt(listRooms[i].windows) || 0;
if (!listRooms[i].ceilingHeight) {
printAverageCeilingHeight = false;
}
averageCeilingHeight += parseFloat(listRooms[i].ceilingHeight) || 0;
}
averageCeilingHeight /= listRooms.length;
values.sumSquare = parseFloat(sumSquare.toFixed(2));
values.sumWindows = parseInt(sumWindows);
values.roomsNames[index] = listRooms[index].nameRoom;
$('.js-sumSquare').val(values.sumSquare || '');
if (printAverageCeilingHeight) {
values.averageCeilingHeight = parseFloat(averageCeilingHeight.toFixed(2));
$('.js-averageCeilingHeight').val(values.averageCeilingHeight || '');
}
}
});
var radioInputs = $('.calculation__radio').find('.calculation__radio-input');
radioInputs.on('change', function () {
var self = $(this);
if (self.prop('checked')) {
var $userValueRadio = $('.js-custom-value');
var $userValueInput = $userValueRadio
.closest('.calculation__radio')
.find('.calculation__field-enter');
if (self.hasClass('js-custom-value')) {
$userValueInput.prop('disabled', false);
$userValueInput.on('input', function () {
var value = parseInt($(this).val()) || 0;
$(this).val(value);
self.val(value);
values.radio = value;
});
} else {
if (!$userValueInput.prop('disabled')) {
$userValueRadio.val('');
$userValueInput.val('');
$userValueInput.prop('disabled', true);
$userValueInput.off('input');
}
}
values.radio = self.val();
}
});
var $calculateButton = $('.js-calculate');
$calculateButton.on('click', function () {
var flag = true;
for (var i = 0; i < listRooms.length; i++) {
for (var key in listRooms[i]) {
if (!listRooms[i][key]) {
flag = false;
}
}
}
if (!values.radio) {
flag = false;
}
if (flag) {
var roomHtml = function(room, square, goods, controllers) {
return $('<tr class="calculation__result-row js-calculation-data">\n' +
'<td class="calculation__result-cell"><span class="mob-hidden">Помещение: </span><span class="calculation__result-room-name">' + room + '</span></td>\n' +
'<td class="calculation__result-cell"><span class="calculation__result-room-square">' + square + '</span> м<sup>2</sup></td>\n' +
'<td class="calculation__result-cell">\n' + goods +
'</td>\n' +
'<td class="calculation__result-cell">' + controllers +
'</td>\n' +
'</tr>');
}
var info = {
series: values.series || 'AIR GATE Transformer System',
min: parseFloat(listRooms[0].square),
max: parseFloat(listRooms[0].square)
};
for (var i = 0; i < listRooms.length; i++) {
var square = parseFloat(listRooms[i].square);
if (square % 10 !== 5 && square % 10 !== 0) {
var dig = square % 10;
if (5 - dig < 0) {
square = ((5 - dig) + 5) + square;
} else if (5 - dig > 0) {
square = (5 - dig) + square;
}
}
if (listRooms.length > 1) {
if (parseFloat(listRooms[i].square) > info.max) {
info.max = square;
}
if (parseFloat(listRooms[i].square) < info.min) {
info.min = square;
}
} else {
info.min = square;
info.max = square;
}
}
$.ajax({
url: '/heating-calculation/send.php',
method: 'POST',
data: JSON.stringify(info),
contentType: "application/json",
success: function (response) {
// обнуляем список товаров.
goodsArr.length = 0;
response.controller[0].price = parseFloat(response.controller[0].price);
var controller = response.controller[0];
var min = parseFloat(response.goods[0].square);
for (var i = 0; i < response.goods.length; i++) {
response.goods[i].price = parseFloat(response.goods[i].price);
response.goods[i].square = parseInt(response.goods[i].square);
if (response.goods[i].square < min) {
min = response.goods[i].square;
}
}
function findGoods(over) {
var inc = 2;
var index = 0;
for (var j = 0; j < response.goods.length; j++) {
if (square === response.goods[j].square) {
goodsArr[i].room.push({
name: [response.goods[j].name],
price: response.goods[j].price
});
break;
} else if (square <= response.goods[j].square && over) {
goodsArr[i].room.push({
name: [response.goods[j].name],
price: response.goods[j].price
});
break;
}
}
if (!goodsArr[i].room.length) {
index = 0;
for (var j = 0; j < response.goods.length; j++) {
if (square === response.goods[index].square + response.goods[j].square) {
goodsArr[i].room.push({
name: [response.goods[index].name, response.goods[j].name],
price: response.goods[j].price
});
break;
} else if (square <= response.goods[index].square + response.goods[j].square && over) {
goodsArr[i].room.push({
name: [response.goods[index].name, response.goods[j].name],
price: response.goods[j].price
});
break;
}
if (j === response.goods.length - 1) {
j = 0;
index += 1;
}
if (index === response.goods.length - 1) {
break;
}
}
}
if (!goodsArr[i].room.length) {
inc = 2;
for (var j = 0; j < response.goods.length; j++) {
if (square === response.goods[j].square * inc) {
goodsArr[i].room.push({
name: [],
price: 0.
});
for (var k = 0; k < inc; k++) {
goodsArr[i].room[0].name.push(response.goods[j].name);
goodsArr[i].room[0].price += response.goods[j].price;
}
break;
} else if (square <= response.goods[j].square * inc && over) {
goodsArr[i].room.push({
name: [],
price: 0.
});
for (var k = 0; k < inc; k++) {
goodsArr[i].room[0].name.push(response.goods[j].name);
goodsArr[i].room[0].price += response.goods[j].price;
}
break;
}
if (j === response.goods.length - 1) {
j = 0;
inc += 1;
}
if (inc === 10) {
break;
}
}
}
if (!goodsArr[i].room.length) {
index = 0;
inc = 2;
for (var j = 0; j < response.goods.length; j++) {
if (j !== response.goods.length - 1 &&
square === response.goods[index].square + response.goods[j].square * inc + response.goods[j + 1].square) {
goodsArr[i].room.push({
name: [response.goods[j].name, response.goods[j + 1].name],
price: response.goods[j].price + response.goods[j + 1].price,
});
for (var k = 0; k < inc; k++) {
goodsArr[i].room[0].name.push(response.goods[j].name);
goodsArr[i].room[0].price += response.goods[j].price;
}
break;
} else if (
j !== response.goods.length - 1
&&
square <= response.goods[index].square + response.goods[j].square * inc + response.goods[j + 1].square
&&
over) {
goodsArr[i].room.push({
name: [response.goods[j].name, response.goods[j + 1].name],
price: response.goods[j].price + response.goods[j + 1].price,
});
for (var k = 0; k < inc; k++) {
goodsArr[i].room[0].name.push(response.goods[j].name);
goodsArr[i].room[0].price += response.goods[j].price;
}
break;
}
if (j === response.goods.length - 1) {
j = 0;
index += 1;
}
if (index === response.goods.length - 1) {
index = 0;
inc += 1;
}
if (inc === 10) {
break;
}
}
}
if (!goodsArr[i].room.length) {
index = 0;
inc = 2;
for (var j = 0; j < response.goods.length; j++) {
if (square === response.goods[index].square + response.goods[j].square * inc) {
goodsArr[i].room.push({
name: [response.goods[index].name],
price: response.goods[index].price,
});
for (var k = 0; k < inc; k++) {
goodsArr[i].room[0].name.push(response.goods[j].name);
goodsArr[i].room[0].price += response.goods[j].price;
}
break;
} else if (square <= response.goods[index].square + response.goods[j].square * inc && over) {
goodsArr[i].room.push({
name: [response.goods[index].name],
price: response.goods[index].price,
});
for (var k = 0; k < inc; k++) {
goodsArr[i].room[0].name.push(response.goods[j].name);
goodsArr[i].room[0].price += response.goods[j].price;
}
break;
}
if (j === response.goods.length - 1) {
j = 0;
inc += 1;
}
if (inc === 10) {
j = 0;
index += 1;
inc = 2;
}
if (index === response.goods.length - 1) {
break;
}
}
}
}
for (var i = 0; i < listRooms.length; i++) {
var square = Math.round(parseFloat(listRooms[i].square));
if (square < min) {
square = min;
}
if (square % 10 !== 5 && square % 10 !== 0) {
var dig = square % 10;
if (5 - dig < 0) {
square = ((5 - dig) + 5) + square;
} else if (5 - dig > 0) {
square = (5 - dig) + square;
}
}
goodsArr.push({
room: [],
});
findGoods();
if (!goodsArr[i].room.length) {
findGoods(true); // Если не нашлись точные значения, берем <=
}
}
var goods = function (list) {
var html = '';
for (var i = 0; i < list.length; i++) {
var count = list[i].name.reduce(function(acc, n) {
return (acc[n] = (acc[n] || 0) + 1, acc);
}, {});
for (var key in count) {
html += '<div class="calculation__result-cell-field">' + key + ' ' + count[key] + ' шт' + '</div>\n';
}
}
return html;
}
function controllers(list, controller) {
var count = list.length + ' шт';
return '<div class="calculation__result-cell-field">' + controller.name + ' ' + count + '</div>';
}
var fragment = document.createDocumentFragment();
for (var i = 0; i < listRooms.length; i++) {
var square = parseFloat(listRooms[i].square);
var nameRoom = listRooms[i].nameRoom;
fragment.append(roomHtml(
nameRoom,
square,
goods(goodsArr[i].room),
controllers(goodsArr[i].room[0].name, controller))[0]
);
}
//почистить лишние строки
$('.js-calculation-data').remove();
$('.calculation__result-row_head:first-child').after(fragment);
$('.calculation__result-row').each(function (index, el) {
if ($(el).next().hasClass('calculation__result-row_head')) {
$(el).addClass('calculation__result-row_border_none');
}
});
values.monthEnergy = (values.sumSquare * values.averageCeilingHeight) * values.radio;
values.monthEnergy = values.monthEnergy.toFixed(2);
var sumMonthEnergy = values.monthEnergy * 3; // 3 рубля 1квт*ч
sumMonthEnergy = sumMonthEnergy.toFixed(2);
var goodsSum = 0;
var controllersSum = 0;
for (var i = 0; i < goodsArr.length; i++) {
goodsSum += goodsArr[i].room[0].price;
for (var j = 0; j < goodsArr[i].room[0].name.length; j++) {
controllersSum += response.controller[0].price;
}
}
var sum = goodsSum + controllersSum;
$('.js-month-energy span').text(values.monthEnergy);
$('.js-sum-month-energy span').text(sumMonthEnergy);
if(!isNaN(values.monthEnergy)) {
console.log('NAN');
$('.js-month-energy span').text(values.monthEnergy);
}
else {
console.log('ne NAN');
$('.js-month-energy span').text('(Расчет затруднен)');
}
if(!isNaN(values.monthEnergy)) {
$('.js-sum-month-energy span').text(sumMonthEnergy);
}
else {
$('.js-sum-month-energy span').text('(Расчет затруднен)');
}
$('.js-sum').text(sum + ' руб');
$('.calculation__result').css('display', 'flex');
}
});
$(this).prop('disabled', false);
}
});
$('.js-clean-calculate').on('click', function () {
for (var key in values) {
if (key === 'roomsNames') {
values[key].length = 0;
} else {
values[key] = 0;
}
}
goodsArr.length = 0;
for (var i = 0; i < listRooms.length; i++) {
if (i > 0) {
listRooms.splice(i, 1);
} else {
for (var key in listRooms[i]) {
listRooms[i][key] = 0;
}
}
}
$('.js-calculation-data').remove();
$('.calculation__radio')
.find('.calculation__radio-input')
.prop('checked', false)
.closest('.iradio')
.removeClass('checked');
$('.calculation__person-value')
.find('.calculation__field-enter')
.val('')
.prop('disabled', true)
.off('input')
.closest('.calculation__radio')
.find('.calculation__radio-input')
.val('');
$('.js-append-room')
.find('.calculation__field-enter')
.val('')
.closest('.js-append-room')
.find('.inline')
.slice(1)
.remove();
$('.js-sumSquare, .js-averageCeilingHeight').val('');
$('.calculation__result').hide();
$('.js-calculate').prop('disabled', false);
});
})();
// (function () {
// var multipleItemsItemBody = $('.multiple-items__item-body');
// var multipleItemsContentToggle = $('.multiple-items_content_toggle');
//
// multipleItemsItemBody.addClass('hide');
//
// multipleItemsContentToggle.on('click', function(e) {
// e.preventDefault();
//
// $(this).prev('.multiple-items__item-body').toggleClass('hide');
//
// if (multipleItemsItemBody.hasClass('hide')) {
// multipleItemsContentToggle.text('Читать еще');
// }
// else {
// multipleItemsContentToggle.text('Показать меньше');
// }
// });
// })();
(function () {
$('.block-questions__item').on('click', '.question__item', function() {
$(this)
.toggleClass('question__item-text-open')
.siblings('.question__item-text')
.slideToggle(0);
});
})();
(function() {
$('.block-questions-conteiner').addClass('hide');
$('.block-questions-content_toggle').click(function(e) {
e.preventDefault();
$('.block-questions-conteiner').toggleClass('hide');
if ($('.block-questions-conteiner').hasClass('hide')) {
$('.block-questions-content_toggle').text('Показать больше');
} else {
$('.block-questions-content_toggle').text('Показать меньше');
}
});
})();
(function () {
var $slider = $('.block-two_image-slide, .big-slider-block__list');
$slider.slick({
dots: false,
slidesToShow: 1,
prevArrow: '<button class="ProductGallery-prevButton"><svg viewBox="75 71.5 10 17" class="SvgIcon SvgIcon--chevron-left"><path d="M75.77 80.03L82.758 72l1.473 1.238-5.908 6.792 5.908 6.731L82.758 88l-6.988-7.97z"></path></svg></button>',
nextArrow: '<button class="ProductGallery-nextButton"><svg viewBox="0 0 10 17" class="SvgIcon SvgIcon--chevron-right"><path d="M9.23 8.03L2.242 0 .769 1.238 6.677 8.03.769 14.761 2.242 16z"></path></svg></button>',
responsive: [
{
breakpoint: 768,
settings: {
dots: true
}
}
]
});
$slider.on('breakpoint', function (event, slick, breakpoint) {
if (breakpoint === 768) {
AddslickDotsWidth();
}
});
if ($(window).width() < 768) {
AddslickDotsWidth();
}
function AddslickDotsWidth() {
var dots = $('.block-two_image-slide .slick-dots').children();
dots.css('width', 'calc(100% / ' + dots.length + ')');
}
})();
// (function () {
// var multipleItemsItemBody = $('.multiple-items__item-body, .js-block-two__text-body-hide, .block__text-right, .block-two__text-body-desk');
// var multipleItemsContentToggle = $('.multiple-items_content_toggle');
//
// multipleItemsItemBody.addClass('hide');
//
// multipleItemsContentToggle.on('click', function(e) {
// e.preventDefault();
//
// $(this).prev('.multiple-items__item-body, .js-block-two__text-body-hide, .block__text-right, .block-two__text-body-desk').toggleClass('hide');
// if ($(this).prev().hasClass('hide')) {
// multipleItemsContentToggle.text('Читать еще');
// } else {
// multipleItemsContentToggle.text('Показать меньше');
// }
// });
// })();
(function () {
var $calculationItem = $('.calculation-block-item');
$calculationItem.on('click', function () {
var self = $(this);
self.removeClass('calculation-block-item_active');
self.siblings().addClass('calculation-block-item_active');
});
$('.js-open-calculation').on('click', function () {
$('.calculation').toggle();
if ($(window).width() < 768) {
$('.calculation-callBack').hide();
}
});
$('.js-open-form').on('click', function () {
$('.calculation').hide();
$('.calculation-callBack').show();
});
$(window).on('resize', function () {
if ($(window).width() > 768) {
$('.calculation-callBack').show();
}
});
})();
(function () {
$(document).on('click', '.input-number__minus', function () {
let total = $(this).next();
if (total.val() > 1) {
total.val(+total.val() - 1);
}
var quan = $('.input-number__plus').prev().val();
var id = $('.js-add-to-cart').attr('data-id');
$('.js-add-to-cart').attr('href', '/ajax/add2basketpromo.php?ID=' + id + '&quantity=' + quan);
});
$(document).on('click', '.input-number__plus', function () {
let total = $(this).prev();
total.val(+total.val() + 1);
var quan = $('.input-number__plus').prev().val();
var id = $('.js-add-to-cart').attr('data-id');
$('.js-add-to-cart').attr('href', '/ajax/add2basketpromo.php?ID=' + id + '&quantity=' + quan);
});
document.querySelectorAll('.input-number__input').forEach(function (el) {
el.addEventListener('input', function () {
this.value = this.value.replace(/[^\d]/g, '');
});
});
})();
});
$( document ).ready(function(){
$(".heating-calculation-form").submit(function() {
$.ajax({
type: "POST",
url: "/heating-calculation/",
data: $(this).serialize()
}).done(function() {
window.location = "/contact-us/contact_thanks.php";
});
return false;
});
});
$( document ).ready(function(){
$(".calculation-callBack").submit(function() {
$.ajax({
type: "POST",
url: "/promo/konvektory/system-calculation/",
data: $(this).serialize()
}).done(function() {
window.location = "/promo/konvektory/system-calculation/";
});
return false;
});
});
$( document ).ready(function(){
$(".calculation-example").submit(function() {
$.ajax({
type: "POST",
url: "/promo/konvektory/system-installation/",
data: $(this).serialize()
}).done(function() {
window.location = "/promo/konvektory/system-installation/";
});
return false;
});
$(document).on('change','.calculation__radio-input',function(){
$('.js-calculate').prop('disabled',false);
});
/* $('body').on('click', 'a[href*=add2basketpromo]', function(e){
location.reload();
})*/
});