PageSourceSearch

https://www.bildhau.de/themes/child_at_oreo/assets/js/all/__search_filter.js?v=9185de1c

js bildhau.de collected 2026-10-02 21:34:07 UTC 19,053 bytes, 371 lines download raw bytes

1$(document).ready(function() {
2    updateFixedActionsProductList();
3    $(window).on('resize', function() {
4        updateFixedActionsProductList();
5    });
6    $(window).on('scroll', function() {
7        updateFixedActionsProductList();
8    });
9    function updateFixedActionsProductList() {
10        if ($('#js-product-list').length > 0 && $('.js-products-bottom-actions').length > 0) {
11            var height_inner = window.innerHeight;
12            var scroll_top = $(window).scrollTop();
13            var top_block = $('#js-product-list').offset().top;
14            var height_block = $('#js-product-list').height();
15            if (scroll_top + height_inner + 20 > top_block
16                && scroll_top + height_inner <= top_block + height_block + (height_inner / 2)) {
17                $('.js-products-bottom-actions').removeClass('products-bottom-actions--hidden');
18            } else {
19                $('.js-products-bottom-actions').addClass('products-bottom-actions--hidden');
20            }
21            if (scroll_top + height_inner >= top_block + height_block + 20) {
22                var bottom = height_inner - ((top_block + height_block) - scroll_top);
23                $('.js-products-bottom-actions').css('bottom', bottom);
24            } else {
25                $('.js-products-bottom-actions').css('bottom', '');
26            }
27        }
28    }
29
30    /*prestashop.on('updateProductList', function() {
31        _search_filter.init();
32    });*/
33    _search_filter.init();
34    setTimeout(function() {
35        _search_filter.scrollTopFilters();
36    }, 1);
37
38    $('body').on('show.bs.modal', '#searchFilterCategory', function(data) {
39        setTimeout(function() {
40            if ($('.modal-backdrop').length > 0) {
41                $($('.modal-backdrop')[$('.modal-backdrop').length - 1]).addClass('modal-backdrop--open-search-filter');
42            }
43        }, 10);
44    });
45    /*$('body').on('hide.bs.modal', '#searchFilterCategory', function(data) {
46        $('html, body').stop().animate({
47            scrollTop : $('#js-product-list').offset().top - _scroll_header.config.static_current_height - 60
48        }, 300);
49    });*/
50    $('body').on('click', '.js-search-filter_bottom-actions_btn-show-products', function() {
51        if ($('#searchFilterCategory').length > 0) {
52            $('#searchFilterCategory').modal('toggle');
53        }
54        $('html, body').stop().animate({
55            scrollTop : $('#js-product-list').offset().top - _scroll_header.config.static_current_height - 60
56        }, 300);
57    });
58
59    function displayCountActiveFilters() {
60        if ($('.js-search-filter_count-active-filters').length > 0 && $('.js-search-filter_action_count-active-filters').length > 0) {
61            var count_active_filters = parseInt($('.js-search-filter_count-active-filters').data('countActiveFilters'));
62            if (count_active_filters > 0) {
63                $('.js-search-filter_action_count-active-filters').html('(' + count_active_filters + ')');
64            } else {
65                $('.js-search-filter_action_count-active-filters').html('');
66            }
67        }
68    }
69    displayCountActiveFilters();
70
71    if ($('.js-search-filter_total-items').length > 0 && $('.js-search-filter_total-items-show-products').length > 0) {
72        var count_items = parseInt($('.js-search-filter_total-items').data('countItems'));
73        $('.js-search-filter_total-items-show-products').html('(' + count_items + ')');
74    }
75
76    var scroll_top = 0;
77    prestashop.on('updateFacets', function() {
78        scroll_top = $(window).scrollTop();
79        /*$('html, body').stop().animate({
80            scrollTop : $('#js-product-list-top').offset().top - _scroll_header.static_current_height
81        }, 0, function() {});*/
82    });
83
84    function productsCopySortOrders() {
85        if ($('.js-product-list_nav-action--sort-orders').length > 0) {
86            var elem = $('.js-product-list_nav-action--sort-orders').clone();
87            $('.js-copy-sort-orders').each(function() {
88                var self_sort = this;
89                var index = $(this).index();
90                var is_open = $(this).data('open');
91                is_open = !is_open ? false : is_open;
92                if (elem.find('> .js-dropdown2').length > 0) {
93                    elem.find('> .js-dropdown2').removeClass('js-dropdown2').removeClass('dropdown');
94                    if (elem.find('.select-title').length > 0) {
95                        elem.find('.select-title').attr('data-toggle', 'collapse').attr('data-target', '#sort_by_' + index);
96                    }
97                    if (elem.find('.dropdown-menu').length > 0) {
98                        elem.find('.dropdown-menu').removeClass('dropdown-menu').addClass('collapse').attr('id', 'sort_by_' + index);
99                    }
100                }
101                $(this).html(elem[0].innerHTML);
102                if (is_open) {
103                    $(this).find('#sort_by_' + index).collapse('toggle');
104                    $(this).find('#sort_by_' + index).css({'height': 'auto'});
105                }
106                $(this).find('#sort_by_' + index).on('show.bs.collapse', function () {
107                    is_open = true;
108                    $(self_sort).data('open', is_open);
109                });
110                $(this).find('#sort_by_' + index).on('hide.bs.collapse', function () {
111                    is_open = false;
112                    $(self_sort).data('open', is_open);
113                });
114            });
115        }
116    }
117    productsCopySortOrders();
118
119    prestashop.on('updateProductList', function(data) {
120        displayCountActiveFilters();
121        productsCopySortOrders();
122        if ($('.js-products-rendered-facets').length > 0 && data.rendered_facets) {
123            var rendered_facets = data.rendered_facets;
124            function replaceAll(search, replacement, string) {
125                return string.replace(new RegExp(search, 'g'), replacement);
126            }
127            rendered_facets = replaceAll('data-target="#facet_', 'data-target="#facet__', rendered_facets);
128            rendered_facets = replaceAll('id="facet_', 'id="facet__', rendered_facets);
129            rendered_facets = replaceAll('id="facet__label_from', 'id="facet_label_from', rendered_facets);
130            rendered_facets = replaceAll('id="facet__label_before', 'id="facet_label_before', rendered_facets);
131            rendered_facets = replaceAll('id="facet_label_from_', 'id="facet_label_from_1', rendered_facets);
132            rendered_facets = replaceAll('id="facet_label_before_', 'id="facet_label_before_1', rendered_facets);
133            rendered_facets = replaceAll('data-slider-id="', 'data-slider-id="1', rendered_facets);
134            rendered_facets = replaceAll('id="slider-range_', 'id="slider-range_1', rendered_facets);
135            $('.js-products-rendered-facets').html(rendered_facets);
136        }
137        if ($('.js-search-filter_total-items-show-products').length > 0) {
138            $('.js-search-filter_total-items-show-products').html('(' + data.pagination.total_items + ')');
139        }
140        _search_filter.init();
141        setTimeout(function() {
142            window.scrollTo(scroll_top, scroll_top);
143            $('html, body').stop().animate({
144                scrollTop : ($('#js-product-list-top').offset().top - _scroll_header.static_current_height) + 1
145            }, 600, function() {});
146        }, 1);
147    });
148});
149
150// js plugin divleaf
151var _search_filter = {
152    config: {
153        self_item: '.js-search-filter_item',
154        self_item_content: '.js-search-filter_item-content',
155        self_item_list: '.js-search-filter_item-list',
156        self_header: '.js-search-filter_header',
157        self_btn_reset: '.js-search-filter_btn-reset',
158        self_btn_reset_inherit: '.js-filter-products_btn-rest',
159        self_elem_scroll_top: '#content-wrapper',
160        class_selector_active: 'scroll-active-category-header-elements',
161        selector_elements: '.js-category-header-elements',
162        attribute_connection: '-',
163        attribute_separation: '/',
164        width_top_scroll: 30,
165        speed_scroll_top: 1000,
166    },
167    scrollTopFilters: function () {
168        var self_obj = this;
169        $(self_obj.config.selector_elements).each(function() {
170            if ($('.js-category-header-elements--mask').length == 0) {
171                $(this).before('<div class="js-category-header-elements--mask"></div>');
172            }
173            var scroll_top_elem = $('.js-category-header-elements--mask').offset().top - _scroll_header.static_current_height;
174            if (_scroll_header.config.active_scroll_hide_bottom) {
175                scroll_top_elem = $('.js-category-header-elements--mask').offset().top + _scroll_header.static_current_height;
176            }
177            var height_elems = $(this).outerHeight(true);
178            if ($(window).scrollTop() >= scroll_top_elem) {
179                $('.js-category-header-elements--mask').css('height', height_elems);
180                $('body').addClass(self_obj.config.class_selector_active);
181                if ($('.' + self_obj.config.class_selector_active + '[data-scroll-direction-vertical="bottom"]').length) {
182                    $(this).css('top', (height_elems * -1));
183                } else {
184                    $(this).css('top', _scroll_header.static_current_height);
185                }
186            } else {
187                $('.js-category-header-elements--mask').css('height', 0);
188                $(this).css('top', '');
189                $('body').removeClass(self_obj.config.class_selector_active);
190            }
191        });
192    },
193    init: function() {
194        var self_base_obj = this;
195        var search_filter = this.config;
196
197        $(window).scroll(function() {
198            self_base_obj.scrollTopFilters();
199        });
200        $(window).resize(function() {
201            self_base_obj.scrollTopFilters();
202        });
203        self_base_obj.scrollTopFilters();
204
205        $(search_filter.self_btn_reset_inherit).each(function() {
206            if (!self_base_obj.is_active_event(this, 'self_btn_reset_inherit')) {
207                $(this).on('click', function(event) {
208                    event.preventDefault();
209                    $('.js-search-filters-clear-all').click();
210                });
211            }
212        });
213
214        if (!self_base_obj.is_active_event($('body'), 'cache_on_event_updateProductList_search_filter')) {
215            $('body').on('click', '.js-search-filters-clear-all', function(event) {
216                event.preventDefault();
217            });
218            var top_scroll = 0;
219            prestashop.on('updateProductList', function() {
220                var static_top_scroll = (_scroll_header.static_current_height * -1);
221                if (static_top_scroll != top_scroll) {
222                    top_scroll = static_top_scroll;
223                }
224                $(search_filter.self_elem_scroll_top).addClass('to-active-scroll');
225                $('html, body').stop().animate(
226                    { scrollTop : $(search_filter.self_elem_scroll_top).offset().top - search_filter.width_top_scroll + top_scroll},
227                    search_filter.speed_scroll_top,
228                    function() {
229                        setTimeout(function() {
230                            $(search_filter.self_elem_scroll_top).removeClass('to-active-scroll');
231                        }, 300);
232                    }
233                );
234            });
235        }
236
237        $(search_filter.self_item).each(function() {
238            var self_filter = this;
239            if (!$(this).is('.js-search-filter_item--start-open')) {
240                $(self_filter).find(search_filter.self_item_list).addClass(_specificsize.config.self_elem_class);
241                $(this).find(search_filter.self_header).each(function() {
242                    self_base_obj.is_active_event(this, 'search_filter_header_click');
243                });
244            } else {
245                $(self_filter).find(search_filter.self_item_list).addClass(_specificsize.config.self_elem_class);
246            }
247            $(this).find(search_filter.self_header).each(function() {
248                if (!self_base_obj.is_active_event(this, 'search_filter_header')) {
249                    var time_out_click = undefined;
250                    $(this).on('click', function() {
251                        window.dispatchEvent(new Event('resize'));
252                        var target = $(this).data('target');
253                        var self_click_header = this;
254                        if (time_out_click != undefined) {
255                            clearTimeout(time_out_click);
256                            time_out_click = undefined;
257                        }
258                        time_out_click = setTimeout(function() {
259                            window.dispatchEvent(new Event('resize'));
260                            $('.js-search-filter-important').find(search_filter.self_item).find(search_filter.self_header).each(function() {
261                                if (target != $(this).data('target')) {
262                                    $($(this).data('target')).collapse('hide');
263                                }
264                            });
265                            if (!self_base_obj.is_active_event(self_click_header, 'search_filter_header_click')) {
266                                setTimeout(function() {
267                                    $(self_filter).find(search_filter.self_item_list).addClass(_specificsize.config.self_elem_class);
268                                }, 100);
269                            }
270                        }, 250);
271                    });
272                }
273            });
274            $(this).find(search_filter.self_item_content).each(function() {
275                $(this).find(search_filter.self_btn_reset).each(function() {
276                    if (!self_base_obj.is_active_event(this, 'search_filter_reset')) {
277                        $(this).on('click', function(event) {
278                            event.preventDefault();
279
280                            var filters_active = $(this).attr('data-filters-active');
281                            var current_url = location.href;
282                            var attribute_connection = search_filter.attribute_connection;
283                            var attribute_separation = search_filter.attribute_separation;
284
285                            if (filters_active != undefined) {
286                                filters_active = JSON.parse(filters_active);
287                                var current_q = self_base_obj.getQueryStringParameter('q', current_url);
288                                var facet_label = '';
289                                var facet_filters_txt = [];
290                                var suffix_url_link = '';
291                                var symbol_price = '';
292
293                                for (var key_filter in filters_active) {
294                                    facet_label = filters_active[key_filter].facetLabel;
295
296                                    if (filters_active[key_filter]['type'] == 'price') {
297                                        symbol_price = filters_active[key_filter]['properties']['symbol'];
298                                    }
299                                    if (filters_active[key_filter]['type'] != 'price' && filters_active[key_filter]['type'] != 'weight') {
300                                        facet_filters_txt[facet_filters_txt.length] = filters_active[key_filter].label;
301                                    } else {
302                                        facet_filters_txt[facet_filters_txt.length] = filters_active[key_filter].value.join(attribute_connection);
303                                    }
304                                }
305                                if (facet_label != '' && facet_filters_txt.length != 0) {
306                                    if (symbol_price != '') {
307                                        suffix_url_link = facet_label + attribute_connection + symbol_price + attribute_connection + facet_filters_txt.join(attribute_connection);
308                                    } else {
309                                        suffix_url_link = facet_label + attribute_connection + facet_filters_txt.join(attribute_connection);
310                                    }
311                                }
312                                if (current_q != null && suffix_url_link != '') {
313                                    var list_facet = current_q.split(attribute_separation);
314                                    list_facet.forEach(function(name_facet, index) {
315                                        if (name_facet == suffix_url_link) {
316                                            list_facet.splice(index, 1);
317                                        }
318                                    });
319                                    var result_url = self_base_obj.getUpd
319ateQueryStringParameter(
320                                        'q',
321                                        list_facet.join(attribute_connection),
322                                        current_url
323                                    );
324                                    self_base_obj.emitFaceted(result_url);
325                                }
326                            }
327                        });
328                    }
329                });
330            });
331        });
332    },
333    emitFaceted: function(url, active_loading) {
334        /*if (active_loading == undefined || active_loading == true) {
335            this.loading_faceted.add();
336        }*/
337        setTimeout(function() {
338            window.prestashop.emit('updateFacets', url);
339        }, 100);
340    },
341    getUpdateQueryStringParameter(key, value, url)
342    {
343        url = url == undefined ? document.location.href : url;
344        var re = new RegExp('([?&])' + key + '=.*?(&|$)', 'i');
345        var separator = url.indexOf('?') !== -1 ? '&' : '?';
346        if (url.match(re)) {
347            return url.replace(re, '$1' + key + '=' + value + '$2');
348        }
349        return url + separator + key + '=' + value;
350    },
351    getQueryStringParameter(name, url)
352    {
353        url = url == undefined ? document.location.href : url;
354        name = name.replace(/[\[\]]/g, '\\$&');
355        var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)');
356        var results = regex.exec(url);
357        if (!results) {
358            return null;
359        } else if (!results[2]) {
360            return '';
361        }
362        return decodeURIComponent(results[2].replace(/\+/g, ' '));
363    },
364    is_active_event(self, name) {
365        if ($(self).data('init_events_' + name) == undefined) {
366            $(self).data('init_events_' + name, 'true');
367            return false;
368        }
369        return true;
370    },
371};

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.