PageSourceSearch

https://www.bregtobjects.nl/wp-content/themes/bz-waas/assets/essentials/es-equal.js?v=26.0

js bregtobjects.nl collected 2026-10-09 23:22:01 UTC 6,892 bytes, 241 lines download raw bytes

1/**
2 * Plugin Name: jQuery Essentials Equal
3 * Version: 3.1
4 * Date: 10-01-2022
5 * License: CC0 1.0 (https://creativecommons.org/publicdomain/zero/1.0/deed)
6 *
7 * Usage:
8 jQuery(itemsContainer).esEqual({
9            itemSelector: ".item",
10            maxAuto: false,
11            maxAutoWidth: 480,
12            perRow: false,
13            heightSelector: 'height',
14            extraAttributes:[]
15       });
16 *
17 **/
18
19
20(function ( jQuery ) {
21
22  jQuery.fn.esEqual = function( options ) {
23
24    var itemsContainer = jQuery(this);
25    var settings = jQuery.extend({
26      itemSelector: ".item",
27      maxAuto: false,
28      maxAutoWidth: 480,
29      perRow: false,
30      heightSelector: 'height',
31      extraAttributes:[]
32    }, options);
33
34    function equalHeights(){
35      itemsContainer.each(function(){
36        var items = jQuery(this).find(settings.itemSelector);
37        var equalHeight = 0;
38
39        if(settings.maxAuto && (jQuery(window).width() <= settings.maxAutoWidth)){
40          items.height('auto');
41          if (typeof settings.extraAttributes !== 'undefined' && settings.extraAttributes.length > 0) {
42            $.each(settings.extraAttributes, function( index, value ) {
43              items.css(''+value+'','');
44            });
45          }
46        } else {
47          items.height('auto');
48          if (typeof settings.extraAttributes !== 'undefined' && settings.extraAttributes.length > 0) {
49            $.each(settings.extraAttributes, function( index, value ) {
50              items.css(''+value+'','');
51            });
52          }
53
54          if(!settings.perRow){
55            items.each(function(){
56              var offsetTop = jQuery(this).offset().top;
57              if(settings.heightSelector == 'outerHeight'){
58                var itemHeight = jQuery(this).outerHeight(true);
59              } else {
60                var itemHeight = jQuery(this).height();
61              }
62              if(itemHeight > equalHeight){
63                equalHeight = itemHeight;
64              }
65            });
66            equalHeight = Math.ceil(equalHeight);
67            items.height(equalHeight);
68            if (typeof settings.extraAttributes !== 'undefined' && settings.extraAttributes.length > 0) {
69              $.each(settings.extraAttributes, function( index, value ) {
70                items.css(''+value+'',equalHeight+'px');
71              });
72            }
73
74          } else {
75
76
77
78            var offsetTop = 0;
79
80            var rows = [];
81            var current_row = null;
82
83            if(items.length){
84              items.each(function(){
85                var item = jQuery(this);
86
87                var itemOffsetTop = jQuery(this).offset().top;
88
89                if(settings.heightSelector == 'outerHeight'){
90                  var itemHeight = jQuery(this).outerHeight(true);
91                } else {
92                  var itemHeight = jQuery(this).height();
93                }
94
95                if(current_row == null || itemOffsetTop > offsetTop){
96                  if(current_row != null){
97                    rows.push(current_row);
98                  }
99                  current_row = {max_height: itemHeight, items: []};
100                  offsetTop = itemOffsetTop;
101                }else if(itemHeight > current_row.max_height){
102                  current_row.max_height = itemHeight;
103                }
104
105                current_row.items.push(item);
106              });
107
108              rows.push(current_row);
109
110              jQuery(rows).each(function(index, row){
111                jQuery(row.items).each(function(){
112                  var item = jQuery(this);
113                  var rowMaxHeight = Math.ceil(row.max_height);
114                  item.height(rowMaxHeight);
115
116                  if (typeof settings.extraAttributes !== 'undefined' && settings.extraAttributes.length > 0) {
117                    $.each(settings.extraAttributes, function( index, value ) {
118                      item.css(''+value+'',rowMaxHeight+'px');
119                    });
120                  }
121                });
122              });
123
124            }
125
126
127          }
128        }
129
130      });
131      jQuery(window).trigger('esEqualComplete',[{itemsContainer: itemsContainer, settings: settings}]);
132    }
133    equalHeights();
134
135    jQuery(window).on('esAjaxLoad',function(){
136      equalHeights();
137    });
138
139    jQuery(window).on('esEqualHeights',function() {
140      equalHeights();
141    });
142
143  };
144
145}( jQuery ));
146
147function productsEqual(loop) {
148  var the_product_loop = loop;
149  the_product_loop.find('.item-products-1').first().find('.product-1-reset-height').each(function () {
150    var reset_index = jQuery(this).data('reset-index');
151
152    the_product_loop.esEqual({
153      itemSelector: ".product-1-reset-height[data-reset-index='" + reset_index + "']",
154      maxAuto: false,
155      maxAutoWidth: 768,
156      perRow: false,
157      extraAttributes: []
158    });
159
160  });
161}
162
163jQuery('.brick-posts-selected-1 .loop-posts-2, .brick-posts-archive-1 .loop-posts-2, .brick-assortiment-archive-1 .loop-assortiment-1, .brick-projects-1 .loop-projects-1, .loop-page-links-1, .loop-featured-blocks-1, .brick-team-1 .loop-team-1').esEqual({
164  itemSelector: ".loop-equal",
165  maxAuto: false,
166  maxAutoWidth: 480,
167  perRow: true,
168  extraAttributes: []
169});
170
171
172jQuery('.brick-posts-selected-2 .loop-posts-2, .brick-assortiment-selected-1 .loop-assortiment-1, .brick-projects-2 .loop-projects-1').esEqual({
173  itemSelector: ".loop-equal",
174  maxAuto: false,
175  maxAutoWidth: 480,
176  perRow: false,
177  extraAttributes: []
178});
179
180jQuery('.loop-categories-1').esEqual({
181  itemSelector: ".box-in",
182  maxAuto: false,
183  maxAutoWidth: 768,
184  perRow: false,
185  extraAttributes: []
186});
187jQuery('.loop-gallery-albums-1').esEqual({
188  itemSelector: ".item-in",
189  maxAuto: true,
190  maxAutoWidth: 768,
191  perRow: true,
192  extraAttributes: []
193});
194
195jQuery('.configurator-radio').esEqual({
196  itemSelector: ".configurator-swatch",
197  maxAuto: false,
198  maxAutoWidth: 480,
199  perRow: false,
200  extraAttributes: []
201});
202
203jQuery('.component_options, .product-single-colors .color-swatch-items').esEqual({
204  itemSelector: ".color-swatch-item",
205  maxAuto: false,
206  maxAutoWidth: 768,
207  perRow: false,
208  extraAttributes: []
209});
210
211
212jQuery('.loop-products-1').each(function () {
213  productsEqual(jQuery(this));
214});
215
216jQuery('.loop-featured-blocks-1, .loop-assortiment-1, .loop-page-links-1, .loop-projects-1, .loop-reviews-1, .loop-services-1, .loop-team-1, .loop-videos-1').esEqual({
217  itemSelector: ".item-in",
218  maxAuto: true,
219  maxAutoWidth: 768,
220  perRow: false,
221  extraAttributes: []
222});
223
224jQuery('.loop-posts-2').esEqual({
225  itemSelector: ".item-in",
226  maxAuto: true,
227  maxAutoWidth: 1024,
228  perRow: false,
229  extraAttributes: []
230});
231
232jQuery('[data-equal-base]').each(function(){
233  var breakPoint = jQuery(this).attr('data-equal-base');
234  jQuery(this).esEqual({
235    itemSelector: ".equal-item",
236    maxAuto: true,
237    maxAutoWidth: breakPoint,
238    perRow: false,
239    extraAttributes: []
240  });
241});

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.