PageSourceSearch

https://www.sbysolar.com/wp-content/themes/solar/assets/js/listing.js

js sbysolar.com collected 2026-10-04 18:59:45 UTC 9,362 bytes, 292 lines download raw bytes

1$(document).ready(function  () {
2      function gallery(filterValue = "") {
3      	var jQuerycontainer = jQuery('#listing-filters');
4	    jQuerycontainer.imagesLoaded(function() {
5	    	var jQuerygrid = jQuery('#listing-filters').isotope({
6	            itemSelector: '.listing-product',
7	            layoutMode: 'fitRows',
8	            cellsByRow: {
9	            	columnWidth: 200,
10	            	rowHeight: 150
11	            },
12	            masonry: {
13	            	columnWidth: 10,
14	            	isAnimated: true,
15	            	animationOptions: {
16	            		duration: 1,
17	            		easing: 'linear',
18	            		queue: false
19	            	},
20	            	gutterWidth: 0,
21	            	isAnimated: false,
22	            	isFitWidth: false,
23	            	isRTL: false,
24	            	isResizable: false
25	            }
26	        });
27
28			if(filterValue != "") {
29				jQuerygrid.isotope({
30					filter: filterValue
31				});
32			}
33
34	        var filterFns = {
35	            numberGreaterThan50: function() {
36	            	var number = jQuery(this).find('.number').text();
37	            	return parseInt(number, 10) > 50;
38	            },
39	            ium: function() {
40	            	var name = jQuery(this).find('.name').text();
41	            	return name.match(/iumjQuery/);
42	            }
43	        };
44	        // bind filter button click
45	        jQuery('.filters-button-group').on('click', 'li', function() {
46	        	$('.hidereal').removeClass('hidereal');
47	        	var filterValue = jQuery(this).attr('data-filter');
48				var url_string = window.location;
49				var url = new URL(url_string);
50				var material = url.searchParams.get("material");
51				if(material != null && material.length > 0) {
52					window.location = "/shop?filterValue="+filterValue;
53				}
54				else {
55					filterValue = filterFns[filterValue] || filterValue;
56					$('li.listing-product').each(function(){
57						var customFilterValue = filterValue.split('.')
58						if(customFilterValue[1] == "eu-made"){
59							customFilterValue[1] = 'made-in-europe';
60						}
61						if($(this).hasClass(customFilterValue[1])){
62							$(this).removeClass('customDisplayForListing');
63						}else{
64							$(this).addClass('customDisplayForListing');
65						}
66						if(filterValue == '*'){
67							$(this).removeClass('customDisplayForListing');
68						}
69					})
70					if(filterValue == ".eu-made"){
71						filterValue = '.made-in-europe';
72					}
73					jQuerygrid.isotope({
74						filter: filterValue
75					});
76				}
77	        });
78			jQuery('.inStockHidden').on('click', function() {
79	        	$('.hidereal').removeClass('hidereal');
80	        	var filterValue = jQuery(this).attr('data-filter');
81				var url_string = window.location;
82				var url = new URL(url_string);
83				var material = url.searchParams.get("material");
84				if(material != null && material.length > 0) {
85					window.location = "/shop?filterValue="+filterValue;
86				}
87				else {
88					filterValue = filterFns[filterValue] || filterValue;
89					$('li.listing-product').each(function(){
90						var customFilterValue = filterValue.split('.')
91						if(customFilterValue[1] == "eu-made"){
92							customFilterValue[1] = 'made-in-europe';
93						}
94						if($(this).hasClass(customFilterValue[1])){
95							$(this).removeClass('customDisplayForListing');
96						}else{
97							$(this).addClass('customDisplayForListing');
98						}
99						if(filterValue == '*'){
100							$(this).removeClass('customDisplayForListing');
101						}
102					})
103					if(filterValue == ".eu-made"){
104						filterValue = '.made-in-europe';
105					}
106					jQuerygrid.isotope({
107						filter: filterValue
108					});
109				}
110	        });
111	        jQuery('.button-group').each(function(i, buttonGroup) {
112	        	var jQuerybuttonGroup = jQuery(buttonGroup);
113	        	jQuerybuttonGroup.on('click', 'li', function() {
114	        		jQuerybuttonGroup.find('.is-checked').removeClass('is-checked');
115	        		jQuery(this).addClass('is-checked');
116	        	});
117	        });
118	    });
119    } // gallery
120
121
122	var url_string = window.location;
123	var url = new URL(url_string);
124	var filterValue = url.searchParams.get("filterValue");
125	if(filterValue != null && filterValue.length>0) {
126		gallery(filterValue);
127	}
128	else {
129		gallery();
130	}
131
132	$('.listing-filter').click(function () {
133		if ( $(this).data('filter') == '.stock-b'  )  {
134			$('.stock-b').show();
135		}else{
136			$('.stock-b').hide();
137		}
138	})
139
140	$('.inStockBtn').click(function () {
141		$('.inStockHidden').click();
142	})
143    $('.outOfStockBtn').click(function(){
144        event.preventDefault();
145		gallery('.stock-product-0')
146		$('li.listing-product').each(function(){
147			if($(this).hasClass('stock-product-0')){
148				$(this).removeClass('customDisplayForListing');
149			}else{
150				$(this).addClass('customDisplayForListing');
151			}
152		})
153    })
154	$('.isSampleFilterButton').on('click', function(){
155		event.preventDefault();
156		gallery('.is_sample')
157		$('li.listing-product').each(function(){
158			if($(this).hasClass('is_sample')){
159				$(this).removeClass('customDisplayForListing');
160			}else{
161				$(this).addClass('customDisplayForListing');
162			}
163		})
164	})
165	$('.isOutletFilterButton').on('click', function(){
166		event.preventDefault();
167		gallery('.is_outlet')
168		$('li.listing-product').each(function(){
169			if($(this).hasClass('is_outlet')){
170				$(this).removeClass('customDisplayForListing');
171			}else{
172				$(this).addClass('customDisplayForListing');
173			}
174		})
175	})
176    $('.isOutletOlaFilterButton').on('click', function(){
177		event.preventDefault();
178		gallery('.is_ola_sample')
179		$('li.listing-product').each(function(){
180			if($(this).hasClass('is_ola_sample')){
181				$(this).removeClass('customDisplayForListing');
182			}else{
183				$(this).addClass('customDisplayForListing');
184			}
185		})
186	})
187    // $('.mobile-menu .submenu, .filter-options-options .submenu').hide();
188    //
189    // $('.mobile-menu > ul > li.hasSub > a, .filter-options-options ul li.hasSub a').click(function() {
190    //     $(this).parents().eq(0).toggleClass('active')
191    //     $(this).siblings('.submenu').slideToggle();
192    // });
193
194    const urlString = window.location.href;
195
196    const urlFilter = new URL(urlString);
197
198    const params = new URLSearchParams(urlFilter.search);
199
200    var valeur_min = 0;
201    if(params.get('min')){
202        valeur_min = params.get('min');
203    }
204    var valeur_max = 5000;
205    if(params.get('max')){
206        valeur_max = params.get('max');
207    }
208
209	$('body').on('click', '.close_menu_filter', function  (e) {
210		$(".filter-options-options").removeClass('open')
211        $('.filter-options-options-container').removeClass('open')
212	})
213    $('body').on('click', '.backdrop', function  (e) {
214		$(".filter-options-options").removeClass('open')
215        $('.filter-options-options-container').removeClass('open')
216	})
217    $('body').on('click', '.filter-options-btn', function  (e) {
218		$(".filter-options-options").addClass('open')
219        $('.filter-options-options-container').addClass('open')
220
221    })
222    var initial_min = 229;
223    var initial_max = 699;
224
225    // if($('.price_for_filter').length > 0){
226    //     var prices = $('.price_for_filter').map(function() {
227    //       return parseFloat($(this).text());
228    //     }).get();
228 // Convertit le résultat en tableau
229    //
230    //     var initial_min = Math.min.apply(null, prices);
231    //     var initial_max = Math.max.apply(null, prices);
232    // }
233
234    $('.hasSub.price a').on('click', function(){
235        if($(this).parents().eq(0).hasClass('active')){
236            var slider = new rSlider({
237                target: '#sampleSlider_mobile',
238                values: {min: initial_min, max: initial_max},
239                step: 100,
240                range: true,
241                set: [parseInt(valeur_min), parseInt(valeur_max)],
242                scale: true,
243                labels: false,
244                onChange : function(values){
245                    var minmax =  values.split(',')
246                    $('#min_price').val(minmax[0])
247                    $('#max_price').val(minmax[1])
248
249                }
250            });
251        }else{
252            $('.rs-container').remove()
253        }
254    })
255
256    $('body').on('click', '.d-desktop .filter-options-btn', function  (e) {
257    	e.preventDefault();
258        $('.rs-container').remove()
259
260    	$(".filter-options-options").stop().slideToggle();
261
262        var slider = new rSlider({
263            target: '#sampleSlider',
264            values: {min: initial_min, max: initial_max},
265            step: 100,
266            range: true,
267            set: [parseInt(valeur_min), parseInt(valeur_max)],
268            scale: true,
269            labels: false,
270            onChange : function(values){
271                var minmax =  values.split(',')
272                $('#min_price_desktop').val(minmax[0])
273                $('#max_price_desktop').val(minmax[1])
274
275            }
276        });
277
278    })
279    $('.select2').each(function() {
280        var placeholder = $(this).attr('placeholder');
281        $(this).select2({
282            placeholder: placeholder,
283        });
284    });
285
286    $('body').on('click', '.filter-options-btn', function  (e) {
287        e.preventDefault();
288
289        $(".filter-options-options").stop().slideToggle();
290
291    })
292});

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.