PageSourceSearch

https://www.lepasseurdevin.ch/wp-content/themes/passeur/assets/js/shop.js?ver=1790151514

js lepasseurdevin.ch collected 2026-09-28 13:07:04 UTC 3,876 bytes, 145 lines download raw bytes

1(function(window, document, $, undefined){
2
3	'use strict';
4
5	window.passeurShop = {};
6
7	/* Initialization
8	-------------------------------------------------- */
9	passeurShop.init = function() 
10	{
11	  passeurShop.initSelectBoxes();
12	  passeurShop.addListeners();
13	  //passeurShop.infiniteLoading();
14	}
15	
16	/* Initialization
17	-------------------------------------------------- */
18	passeurShop.initSelectBoxes = function() 
19	{
20		$( '.woocommerce-ordering select' ).selectWoo({
21			minimumResultsForSearch: Infinity
22		});
23	
24		$( '.select-field select[name="tax[region][]"]' ).selectWoo({
25			templateResult: function (data, container) 
26			{
27				if (data.element) 
28					$(container).addClass($(data.element).attr("class"));
29				
30				return data.text;
31			},
32			minimumResultsForSearch: Infinity,
33		});
34	
35		$( '.select-field select[name!="tax[region][]"]' ).each(function(){
36			$( this ).selectWoo({ 
37				minimumResultsForSearch: Infinity,
38				placeholder: $( this ).attr('placeholder'),
39			});
40		});
41		
42		$('select').on('select2:open', function(e) {
43			$('.select2-search input').prop('focus',false);
44		})
45	}
46	
47	/* Listeners
48	-------------------------------------------------- */
49	passeurShop.addListeners = function()
50	{
51		$( document ).on( 'blur', 'input[name="search"]', passeurShop.executeSearch );
52		$( document ).on( 'change', '.select-field select', passeurShop.executeSearch );
53		$( document ).on( 'keypress', 'input[name="search"]', passeurShop.keywordsEnter );
54		
55		$( document ).on( 'submit', '.woocommerce-ordering', function(){ return false; } );
56
57		$( document ).on( 'change', '.woocommerce-ordering select[name="orderby"]', passeurShop.updateOrderBy );
58	}
59	
60	/* Detect enter key on search input
61	-------------------------------------------------- */
62	passeurShop.keywordsEnter = function( event )
63	{
64		if ( event.which == 13 ) 
65		{
66			event.preventDefault();
67			passeurShop.executeSearch();
68		}
69	}
70	
71	/* Execute AJAX search
72	-------------------------------------------------- */
73	passeurShop.executeSearch = function()
74	{		
75		$( '.filters-form' ).submit();
76		
77		/*$.get(
78			$( '.filters-form' ).attr( 'action' ),
79			$( '.filters-form' ).serialize() + '&ajax=1',
80		).done(function( data )
81		{
82			var grid = $( 'ul.products' ),
83				items = $( data ).find( 'ul.products li' );
84
85			$( '.page-numbers' ).remove();
86			$( '.woocommerce-pagination' ).append( $( data ).find( '.woocommerce-pagination' ).html() );
87						
88			grid.masonry( 'remove', grid.find('.product') );
89			grid.append( items ).masonry( 'appended', items ).masonry('layout');
90			
91			Waypoint.refreshAll();
92		})*/
93	}
94	
95	/* Update orderby field
96	-------------------------------------------------- */
97	passeurShop.updateOrderBy = function()
98	{
99		var orderbySelect = $( '.woocommerce-ordering select[name="orderby"]' ),
100			orderbyHidden = $( '.filters-form input[name="orderby"]' );
101		
102		orderbyHidden.val( orderbySelect.val() );
103		
104		passeurShop.executeSearch();
105	}
106
107	/* Infinite loading
108	-------------------------------------------------- */
109	passeurShop.infiniteLoading = function()
110	{
111		var grid = $( 'ul.products' ),
112			loader = $( '.sk-circle' );
113
114		var waypoint = new Waypoint({
115			element: grid,
116			handler: function(direction) 
117			{				
118				var nextURL = $( '.page-numbers span.current' ).parent().next().find( 'a' ).attr( 'href' );
119
120				if ( nextURL == undefined )
121					return;
122				
123				$( '.page-numbers' ).remove();
124				loader.show();
125
126				$.get( nextURL ).done( function( data )
127				{
128					$( '.woocommerce-pagination' ).append( $( data ).find( '.woocommerce-pagination' ).html() );
129					
130					loader.hide();
131										
132					var items = $( data ).find( 'ul.products li' );					
133
134					grid.append( items ).masonry( 'appended', items );
135					
136					Waypoint.refreshAll();
137				});
138			},
139			offset: 'bottom-in-view'
140		});
141	}
142
143	$( document ).on( 'ready', passeurShop.init() );
144
145})(window, document, 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.