PageSourceSearch

https://theeffectivesyndicate.com/wp-content/plugins/matador-jobs-…/scripts/matador-orderby.js?ver=1791215359

js theeffectivesyndicate.com collected 2026-10-05 19:44:20 UTC 1,921 bytes, 55 lines download raw bytes

1/**
2 * This function initializes the Matador Jobs Pro orderby functionality.
3 * It adds an event listener to the orderby select element, which updates the URL with the selected orderby value.
4 * Additionally, it hides the re-order submit button if it exists.
5 *
6 * @since 3.9.0
7 *
8 * @returns {void}
9 */
10(function () {
11    'use strict';
12
13    /**
14     * Select elements with class 'matador-orderby-form > select'
15     * @type {NodeList}
16     */
17    const orderbySelects = document.querySelectorAll( '.matador-orderby-form > select' );
18
19    // If no orderby select elements found, return early
20    if (  !orderbySelects || orderbySelects.length === 0  ) return;
21
22    // If more than one orderby select element found, log an error and return early
23    if ( 1 < orderbySelects.length) return console.error( 'Multiple Matador Orderby elements found on this page. Only one per page is supported.' );
24
25    /**
26     * The first orderby select element
27     * @type {HTMLSelectElement}
28     */
29    const orderbySelect = orderbySelects[0];
30
31    // Add event listener to the orderby select element
32    orderbySelect.addEventListener('change', function (event) {
33        event.preventDefault();
34
35        // Create a new URL object from the current window location
36        const currentUrl = new URL(window.location.href);
37
38        // Update the search parameters with the selected orderby value
39        currentUrl.searchParams.set('matador-jobs-orderby', event.target.value);
40
41        // Redirect to the updated URL
42        window.location.href = currentUrl.toString();
43    });
44
45    /**
46     * The re-order submit button
47     * @type {HTMLButtonElement}
48     */
49    const reOrderButton = document.querySelector('#re-order-submit');
50
51    // If the re-order submit button exists, hide it as submitting the form is handled by the event listener above
52    if ( reOrderButton ) { 
53        reOrderButton.style.display = 'none';
54    }
55})();

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.