PageSourceSearch

https://solarix-pv.de/wp-content/plugins/SV-BUILD%20Bewertungen%20widget/assets/script.js?ver=7.0.2

js solarix-pv.de collected 2026-10-06 21:59:18 UTC 3,371 bytes, 68 lines download raw bytes

1(function($) {
2    $(document).ready(function() {
3        const reviews = reviewsData.reviews || [];
4        const settings = reviewsData.settings || {};
5        
6        // Сортировка отзывов по дате, начиная с самых новых
7        reviews.sort((a, b) => new Date(b.date) - new Date(a.date));
8        
9        // Количество отзывов для показа в зависимости от устройства
10        const reviewsPerPage = settings.reviews_per_load || 3;
11        const initialReviewsDesktop = settings.initial_reviews_desktop || 6;
12        const initialReviewsMobile = settings.initial_reviews_mobile || 3;
13        let currentIndex = 0;
14
15        // Функция для определения устройства
16        function isMobileDevice() {
17            return window.innerWidth <= 768;
18        }
19
20        // Функция для отображения отзывов
21        function displayReviews(start, end) {
22            const reviewsGrid = $('#SVVReviewsGrid');
23            reviewsGrid.empty(); // Очистим текущие отзывы перед отображением новых
24
25            const reviewsToShow = reviews.slice(start, end);
26            reviewsToShow.forEach(function(review) {
27                const reviewElement = `
28                    <div class="SVV-review">
29                        <div class="SVV-review-header">
30                            <div class="SVV-avatar" style="background-color: ${review.avatarColor}; color: ${review.avatarTextColor};">${review.avatar}</div>
31                            <div class="SVV-name-date">
32                                <div class="SVV-name">${review.name}</div>
33                                <div class="SVV-date">${review.date}</div>
34                            </div>
35                        </div>
36                        <div class="SVV-stars">${'★'.repeat(review.stars)}</div>
37                        <div class="SVV-content">${review.content}</div>
38                    </div>
39                `;
40                reviewsGrid.append(reviewElement);
41            });
42
43            // Проверка на необходимость скрытия кнопки
44            if (end >= reviews.length) {
45                $('#SVVLoadMoreBtn').hide();
46            } else {
47                $('#SVVLoadMoreBtn').show();
48            }
49        }
50
51        // Инициализация отзывов
52        function initializeReviews() {
53            const initialCount = isMobileDevice() ? initialReviewsMobile : initialReviewsDesktop;
54            displayReviews(0, initialCount);
55            currentIndex = initialCount; // Обновление текущего индекса
56        }
57
58        // Обработчик нажатия на кнопку "Mehr laden"
59        $('#SVVLoadMoreBtn').on('click', function() {
60            const nextIndex = currentIndex + reviewsPerPage;
61            displayReviews(0, nextIndex); // Всегда показываем от 0 до nextIndex, чтобы избежать дублирования
62            currentIndex = nextIndex; // Обновление текущего индекса
63        });
64
65        // Начальная инициализация
66        initializeReviews();
67    });
68})(jQuery);

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.