PageSourceSearch

https://www.niraalpina.com/wp-content/plugins/cn-core-widgets/widgets/post-grid-filter/js/post-grid-filter.js

js niraalpina.com collected 2026-09-29 09:03:55 UTC 1,676 bytes, 59 lines download raw bytes

1(function($) {
2    'use strict';
3
4    /**
5     * Utlity function to return part of a URL string
6     * e.g. var foo = getParameterByName('foo')
7     */
8    function getParameterByName(name) {
9        var url = window.location.search.substring(1);
10        var params = url.split('&');
11        var value = null;
12
13        $.each(params, function (index, param) {
14            var param = param.split('=');
15
16            if (param[0] === name) {
17                value = param[1];
18            }
19        });
20
21        return value;
22    }
23
24    $('[data-module="grid-filter"]').each(function(){
25        new CN.GridFilter( $(this) );
26    });
27
28    var filterGrid = getParameterByName('filter-grid');
29
30    if (filterGrid) {
31        var filterValues = filterGrid.split(',');
32
33        $.each(filterValues, function (index, filterValue) {
34            var foundMatch = false;
35
36            $('[data-module="grid-filter"] .js-filter').each(function() {
37                var filterChildren = $(this).children();
38                var filterOptions = (filterChildren.length) ? $(this).children('option') : $(this);
39
40                $.each(filterOptions, function() {
41                    var filterOption = $(this);
42
43                    if (filterOption.val() === filterValue) {
44                        filterOption.prop('selected', 'selected');
45                        filterOption.prop('checked', 'checked');
46                        foundMatch = true;
47                        return;
48                    }
49                });
50
51                if (foundMatch) {
52                    $(this).trigger('change');
53                    return;
54                }
55            });
56        });
57    }
58
59})(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.