PageSourceSearch

https://fck.de/wp-content/plugins/blog-post-carousel/assets/js/news-grid.js?ver=1.0

js fck.de collected 2026-09-24 09:44:05 UTC 6,007 bytes, 162 lines download raw bytes

1(function($) {
2    'use strict';
3    
4    $(document).ready(function() {
5        // Variablen für Filter-Status
6        var currentPage = 1;
7        var isLoading = false;
8        var currentFilter = {
9            category: '',
10            year: '',
11            month: '',
12            search: '',
13            posts_per_page: 12,
14            shortcode_category: bpg_ajax.shortcode_category || '' // Kategorie aus dem Shortcode
15        };
16        
17        // Mobile Filter Toggle
18        $('.bpg-filter-toggle').on('click', function() {
19            $('.bpg-filter-form').toggleClass('active');
20            
21            // Text und Icon ändern
22            if ($('.bpg-filter-form').hasClass('active')) {
23                $('.bpg-filter-toggle-text').text('Filter ausblenden');
24                $('.bpg-filter-toggle-icon').text('-');
25            } else {
26                $('.bpg-filter-toggle-text').text('Filter anzeigen');
27                $('.bpg-filter-toggle-icon').text('+');
28            }
29        });
30        
31        // Funktion zum Scrollen zum Anfang des Grids
32        function scrollToGrid() {
33            var gridOffset = $('#bpg-grid-container').offset().top - 100; // 100px Abstand nach oben
34            $('html, body').animate({
35                scrollTop: gridOffset
36            }, 500);
37        }
38        
39        // Filter-Formular absenden
40        $('#bpg-filter-form').on('submit', function(e) {
41            e.preventDefault();
42            
43            // Filter-Werte sammeln
44            currentFilter.category = $('#bpg-category').val();
45            currentFilter.year = $('#bpg-year').val();
46            currentFilter.month = $('#bpg-month').val();
47            currentFilter.search = $('#bpg-search').val();
48            
49            // Zurück zur ersten Seite
50            currentPage = 1;
51            
52            // Grid leeren und neue Ergebnisse laden
53            $('#bpg-grid').empty();
54            loadPosts();
55            
56            // Auf Mobilgeräten Filter nach Absenden ausblenden
57            if (window.innerWidth <= 1300) {
58                $('.bpg-filter-form').removeClass('active');
59                $('.bpg-filter-toggle-text').text('Filter anzeigen');
60                $('.bpg-filter-toggle-icon').text('+');
61            }
62            
63            // Zum Anfang des Grids scrollen
64            scrollToGrid();
65        });
66        
67        // Filter zurücksetzen
68        $('#bpg-filter-form').on('reset', function() {
69            setTimeout(function() {
70                currentFilter.category = '';
71                currentFilter.year = '';
72                currentFilter.month = '';
73                currentFilter.search = '';
74                
75                currentPage = 1;
76                
77                $('#bpg-grid').empty();
78                loadPosts();
79                
80                // Zum Anfang des Grids scrollen
81                scrollToGrid();
82            }, 10);
83        });
84        
85        // Mehr anzeigen Button
86        $('#bpg-load-more').on('click', function() {
87            if (!isLoading) {
88                currentPage++;
89                loadPosts(true);
90            }
91        });
92        
93        // Funktion zum Laden der Beiträge
94        function loadPosts(append = false) {
95            if (isLoading) return;
96            
97            isLoading = true;
98            
99            if (!append) {
100                $('#bpg-grid').html('<div class="bpg-loading">Lade Beiträge...</div>');
101            }
102            
103            $('#bpg-load-more').text('Lade...').prop('disabled', true);
104            
105            $.ajax({
106                url: bpg_ajax.ajax_url,
107                type: 'POST',
108                data: {
109                    action: 'bpg_filter_posts',
110                    nonce: bpg_ajax.nonce,
111                    page: currentPage,
112                    category: currentFilter.category,
113                    year: currentFilter.year,
114                    month: currentFilter.month,
115                    search: currentFilter.search,
116                    posts_per_page: currentFilter.posts_per_page,
117                    shortcode_category: currentFilter.shortcode_category // Übergebe die Shortcode-Kategorie
118                },
119                success: function(response) {
120                    if (response.success) {
121                        if (!append) {
122                            $('#bpg-grid').empty();
123                        }
124                        
125                        if (response.html) {
126                            $('#bpg-grid').append(response.html);
127                        } else {
128                            if (!append) {
129                                $('#bpg-grid').html('<div class="bpg-no-results">Keine Beiträge gefunden.</div>');
130                            }
131                        }
132                        
133                        // "Mehr anzeigen" Button aktualisieren
134                        if (currentPage >= response.max_pages) {
135                            $('#bpg-load-more').hide();
136                        } else {
137                            $('#bpg-load-more').show();
138                        }
139                    } else {
140                        if (!append) {
141                            $('#bpg-grid').html('<div class="bpg-no-results">Fehler beim Laden der Beiträge.</div>');
142                        }
143                    }
144                    
145                    $('#bpg-load-more').text('Mehr anzeigen').prop('disabled', false);
146                    isLoading = false;
147                },
148                error: function() {
149                    if (!append) {
150                        $('#bpg-grid').html('<div class="bpg-no-results">Fehler beim Laden der Beiträge.</div>');
151                    }
152                    
153                    $('#bpg-load-more').text('Mehr anzeigen').prop('disabled', false);
154                    isLoading = false;
155                }
156            });
157        }
158        
159        // Initial die ersten Beiträge laden
160        loadPosts();
161    });
162})(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.