.product { display: flex;
flex-direction: column; для .product. Элементам внутри .product, которые должны находиться на одной строке, добавьте общие обёртки, которым также будет задан display: flex;.
$('.problem').change(({ target: t }) => {
const attrsSelector = [ 'type', 'problem' ]
.map(n => `[data-${n}="${t.dataset[n]}"]`)
.join('');
$(`.price-problem ${attrsSelector}`).toggle(t.checked);
}).find('input').change();
$('.item img').wrap(function() {
return '<a href="' + $(this).attr('src') + '"></a>';
});document.querySelectorAll('.item img').forEach(n => {
n.outerHTML = `<a href="${n.attributes.src.value}">${n.outerHTML}</a>`;
});for (const n of document.querySelectorAll('.item img')) {
const a = document.createElement('a');
a.href = n.getAttribute('src');
n.after(a);
a.append(n);
}
const markersData = [
{ position: { lat: ..., lng: ... }, content: '...' },
{ position: { lat: ..., lng: ... }, content: '...' },
...
];const infoWindow = new google.maps.InfoWindow();const markers = markersData.map(({ position, content }) => {
const marker = new google.maps.Marker({ position, map });
marker.addListener('click', () => {
infoWindow.setContent(content);
infoWindow.open(map, marker);
});
return marker;
});null):const setActiveIcon = marker => markers.forEach(n => n.setIcon(n === marker ? iconActive : icon));
function createTree({
data,
key = 'id',
childrenKeysKey = 'children',
childrenKey = 'children',
}) {
const tree = Object.fromEntries(data.map(({ [childrenKeysKey]: _, ...n }) => [ n[key], n ]));
data.forEach(n => tree[n[key]][childrenKey] = n[childrenKeysKey]?.map?.(m => tree[m]) ?? []);
const nonRootIds = new Set(data.flatMap(n => n[childrenKeysKey] ?? []));
return Object.values(tree).filter(n => !nonRootIds.has(n[key]));
}const tree = createTree({
data,
childrenKeysKey: 'parts',
});
<div class="wrapper">.const containerSelector = '.wrapper';
const headerSelector = '.request__nav__item';
const contentSelector = '.request__field';
const activeClass = 'active';
$(containerSelector).on('click', headerSelector, function(e) {
const $headers = $(headerSelector, e.delegateTarget);
const index = $headers.index(this);
$headers.removeClass(activeClass).eq(index).addClass(activeClass);
$(contentSelector, e.delegateTarget).hide().eq(index).fadeIn();
}).each(function() {
$(headerSelector, this).first().click();
});
$('a').click(function() {
const $tabs = $('.splCont');
const $tab = $tabs.eq($(this).index()).toggle('normal');
$tabs.not($tab).hide('normal');
return false;
});
const toSeconds = str => str
.split(':')
.reverse()
.reduce((acc, n, i) => acc + n * (60 ** i), 0);
const sumDiagonals = matrix =>
matrix.reduce((acc, n, i) => {
acc.principal += n[i];
acc.secondary += n[n.length - i - 1];
return acc;
}, {
principal: 0,
secondary: 0,
});
const result = [];
for (const n of numbers) {
if (!objects.some(m => m.number === n)) {
result.push(n);
}
}const result = [];
COLLECT_NUMBERS:
for (let i = 0; i < numbers.length; i++) {
for (let j = 0; j < objects.length; j++) {
if (objects[j].number === numbers[i]) {
continue COLLECT_NUMBERS;
}
}
result[result.length] = numbers[i];
}const result = numbers.filter(function(n) {
return !this.has(n);
}, new Set(objects.map(n => n.number)));const result = (function get(exclude, i, n = numbers[--i]) {
return i >= 0
? get(exclude, i).concat(~exclude.indexOf(n) ? [] : n)
: [];
})(objects.map(n => n.number), numbers.length);const result = [...objects.reduce(
(acc, n) => (acc.delete(n.number), acc),
new Set(numbers)
)];
const newArr = [...arr]
.sort((a, b) => a.name.localeCompare(b.name) || (a.price - b.price))
.filter((n, i, a) => n.name === a[i - 1]?.name);const newArr = [...arr]
.sort((a, b) => a.name.localeCompare(b.name) || (a.price - b.price))
.filter((n, i, a) => n.name === a[~-i]?.name || n.name !== a[-~i]?.name);const newArr = [...arr]
.sort((a, b) => a.price - b.price)
.filter((n, i, a) => n !== a.find(m => m.name === n.name));const newArr = [...arr].sort((a, b) => a.price - b.price);
Object
.values(newArr.reduce((acc, n) => ((acc[n.name] ??= []).push(n), acc), {}))
.forEach(n => n.length !== 1 && newArr.splice(newArr.indexOf(n[0]), 1));
def replacer(m):
val = m.group(0)
return str(int(val or '0') + 1).rjust(len(val), '0')
def increment(s):
return re.sub(r'\d*$', replacer, s, 1)
const values = Object.values(obj);
const min = Math.min(...values);
const max = Math.max(...values);const [ min, max ] = Object
.values(obj)
.reduce(([ min, max ], n) => [
n < min ? n : min,
n > max ? n : max,
], [ Infinity, -Infinity ]);let min = Infinity;
let max = -Infinity;
for (const k in obj) {
if (obj.hasOwnProperty(k)) {
const v = obj[k];
(min > v) && (min = v);
(max < v) && (max = v);
}
}