PageSourceSearch

https://onlineborenkopen.nl/wp-content/themes/Impreza/common/js/elements/list-order.js?ver=8.39.2

js onlineborenkopen.nl collected 2026-10-08 07:27:52 UTC 2,018 bytes, 94 lines download raw bytes

1/**
2 * UpSolution Element: List Order
3 */
4! function( $, _undefined ) {
5	"use strict";
6
7	const DELETE_FILTER = null;
8	const urlManager = $ush.urlManager();
9	const urlParam = '_orderby';
10
11	/**
12	 * @param {Node} container.
13	 */
14	function usListOrder( container ) {
15		const self = this;
16
17		// Bondable events
18		self._events = {
19			selectChanged: self._selectChanged.bind( self ),
20		};
21
22		// Elements
23		self.$container = $( container );
24		self.$pageContent = $( 'main#page-content' );
25
26		// Sets value from URL
27		if ( self.changeURLParams() ) {
28			let urlValue = urlManager.get( urlParam );
29			if ( ! $ush.isUndefined( urlValue ) ) {
30				$( 'select', container ).val( urlValue );
31			}
32		}
33
34		// Events
35		self.$container.on( 'change', 'select', self._events.selectChanged );
36	}
37
38	// List Order API
39	$.extend( usListOrder.prototype, {
40
41		/**
42		 * Determines if enabled URL.
43		 *
44		 * @return {Boolean} True if enabled url, False otherwise.
45		 */
46		changeURLParams: function() {
47			return this.$container.hasClass( 'change_url_params' );
48		},
49
50		/**
51		 * @event handler
52		 * @param {Event} e The Event interface represents an event which takes place in the DOM.
53		 */
54		_selectChanged: function( e ) {
55			const self = this;
56
57			const $firstList = $( `
58				.w-grid.us_post_list:visible,
59				.w-grid.us_product_list:visible,
60				.w-grid-none:visible
61			`, self.$pageContent ).first();
62
63			if ( $firstList.hasClass( 'w-grid' ) ) {
64				$firstList.addClass( 'used_by_list_order' );
65			}
66
67			let value = e.target.value;
68			if ( value === '' ) {
69				value = DELETE_FILTER;
70			}
71			if ( value === self.lastValue ) {
72				return;
73			}
74			self.lastValue = value;
75
76			if ( self.changeURLParams() ) {
77				urlManager.set( urlParam, value ).push();
78			}
79
80			$firstList.trigger( 'usListOrder', [ urlParam, value ] );
81		}
82	} );
83
84	$.fn.usListOrder = function() {
85		return this.each( function() {
86			$( this ).data( 'usListOrder', new usListOrder( this ) );
87		} );
88	};
89
90	$( () => {
91		$( '.w-order.for_list' ).usListOrder();
92	} );
93
94}( 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.