PageSourceSearch

https://far.ru/local/templates/FAR2025/js/show-charactiristics.js

js far.ru collected 2026-10-02 05:46:43 UTC 1,516 bytes, 41 lines download raw bytes

1export default function showAllCaracteristics() {
2	const list = document.querySelector(".characteristics__list")
3	const button = document.querySelector(".characteristics-show-all")
4
5	if (!list || !button) return // Проверяем наличие элементов
6
7	const listItem = list.querySelector(".characteristics__item")
8	const items = list.querySelectorAll(".characteristics__item")
9
10	// Если элементов 4 или меньше — скрываем кнопку
11	if (items.length <= 4) {
12		button.style.display = "none"
13		return
14	}
15
16	// Функция для вычисления высоты 4 элементов
17	const getCollapsedHeight = () => {
18		const computedStyle = window.getComputedStyle(list)
19		const gapValue = parseFloat(computedStyle.gap) || 0
20		return listItem.offsetHeight * 4 + gapValue * 3
21	}
22
23	// Устанавливаем начальное состояние
24	list.style.maxHeight = getCollapsedHeight() + "px"
25	list.classList.remove("active")
26	button.textContent = "Все характеристики"
27
28	button.addEventListener("click", () => {
29		if (list.classList.contains("active")) {
30			// Скрыть часть списка
31			list.style.maxHeight = getCollapsedHeight() + "px"
32			list.classList.remove("active")
33			button.textContent = "Все характеристики"
34		} else {
35			// Показать весь список
36			list.classList.add("active")
37			list.style.maxHeight = list.scrollHeight + "px"
38			button.textContent = "Скрыть"
39		}
40	})
41}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.