PageSourceSearch

https://naga-project.com/wp-content/themes/smaek/resources/js/filtered-list.js

js naga-project.com collected 2026-09-28 09:43:55 UTC 6,325 bytes, 203 lines download raw bytes

1/**
2 * All functions for filtering without isotope:
3 * - Set up daterange picker
4 */
5/**
6 * Get query parameters from document.location.search
7 */
8//alert("filtered-list");
9(function($) {
10
11    //Alle Filter-Optionen in der Konsole ausgeben
12    // $('select').each(function(){
13    //     var out = $(this).attr('name');
14    //     //console.log($(this).val());
15    //     $(this).find('option').each(function(){
16    //         //console.log($(this).val());
17    //         out += "\n"+$(this).val();
18    //     })
19    //     console.log(out);
20    // })
21
22    /**
23     * DATE FILTER: TYPE
24     */
25    function dateFilterTypeChange() {
26        //console.log("datefilterchange");
27        if ($(this).val() == 'range'){
28            $('.date-range').show();
29            return; //no reload, first wait for range input
30        }
31        //NOW RELOAD WITH CHANGED FILTERS
32        updateOverview();
33    }
34
35    /**
36     * DATE FILTER: RANGE
37     */
38    function dateFilterRangeChange() {
39        var fromDate = $('.date-range').data('daterangepicker').startDate.toDate();
40        var toDate = $('.date-range').data('daterangepicker').endDate.toDate();
41        $('input[name="from_filter"]').val(fromDate.getTime()/1000);
42        $('input[name="to_filter"]').val(toDate.getTime()/1000);
43        console.log("filter daterange: ",fromDate,toDate);
44        //NOW RELOAD WITH CHANGED FILTERS
45        updateOverview();
46    }
47
48    // bind filter update on DATE TYPE CHANGE
49    $('.date-filter-select').on( 'change', dateFilterTypeChange );
50
51    // bind filter update on DATE RANGE CHANGE
52    $('.date-range').on( 'apply.daterangepicker', dateFilterRangeChange );
53
54    // bind filter update on TERM CHANGE
55    $('.term-filter-select').on( 'change', function(){
56        //NOW RELOAD WITH CHANGED FILTERS
57        updateOverview();
58    } );
59
60    // bind filter update on AUDIENCE CHANGE
61    $('.audience-filter-select').on('change', function () {
62        //NOW RELOAD WITH CHANGED FILTERS
63        updateOverview();
64    });
65
66    // bind filter update on AUDIENCE CHANGE
67    $('.registration-filter-select').on('change', function () {
68        //NOW RELOAD WITH CHANGED FILTERS
69        updateOverview();
70    });
71
72    // bind filter update on THEME CHANGE
73    $('.theme-filter-select').on('change', function () {
74        //NOW RELOAD WITH CHANGED FILTERS
75        updateOverview();
76    });
77
78    // bind filter update on ORDER CHANGE
79    $('.order-filter-select').on('change', function () {
80        //NOW RELOAD WITH CHANGED FILTERS
81        updateOverview();
82    });
83
84    // bind filter update on THEME CHANGE
85    $('.language-filter-select').on( 'change', function(){
86        //NOW RELOAD WITH CHANGED FILTERS
87        updateOverview();
88    } );
89
90    // bind filter update on PAGE CHANGE
91    $('.page-link').click(function(){
92        if ($(this).hasClass("active")) return;
93        setPage($(this).data('page'));
94        submitFilters();
95    });
96
97    // OUTPUT INITAL FORM VALUES
98    console.log("FORM on load:", $('.filter-form').serialize() );
99
100
101    function setPage(page=1){
102        $('input[name="page_filter"]').val(page);
103    }
104    function submitFilters(){
105        $('.filter-form').submit();
106    }
107    function updateOverview(){
108        setPage();
109        submitFilters();
110    }
111
112   /**
113     * Setup daterange picker
114     */
115    var locale = {
116        "format": "DD.MM.YYYY",
117        "separator": " - ",
118        "applyLabel": "Auswählen",
119        "cancelLabel": "Abbrechen",
120        "fromLabel": "Von",
121        "toLabel": "Bis",
122        "customRangeLabel": "Custom",
123        "weekLabel": "W",
124        "daysOfWeek": [
125            "So",
126            "Mo",
127            "Di",
128            "Mi",
129            "Do",
130            "Fr",
131            "Sa"
132        ],
133        "monthNames": [
134            "Januar",
135            "Februar",
136            "März",
137            "April",
138            "Mai",
139            "Juni",
140            "Juli",
141            "August",
142            "September",
143            "Oktober",
144            "November",
145            "Dezember"
146        ],
147        "firstDay": 1
148    };
149    if ($('.date-range').data('archive') === false) {
150        console.log("setup daterange WITHOUT archive option (no dates in past allowed)");
151        $('.date-range').daterangepicker({
152            "minDate": moment(),
153            "locale": locale
154        });
155    } else {
156        console.log("setup daterange WITH archive option (dates in past allowed)");
157        $('.date-range').daterangepicker({
158            "locale": locale
159        });
160    }
161
162    /**
163     * setup CROSS-LANGUAGE-LINKS in event calendar
164     */
165
166
167    function setupCrossLanguageLinks(){
168        console.log('cross-language-dont-ask', Cookies.get('cross-language-dont-ask'));
169        if(Cookies.get('cross-language-dont-ask') === "true") return;
170        // --------------
171        // find CrossLanguageLinks and set up
172        $('.exhibition-link-wrapper a').each(function(){
173            var main_language = $('html').attr('lang');
174            var target_url = $(this).attr('href');
175            //console.log(main_language+" vs. "+target_url);
176            if (main_language==="de-DE" && target_url.indexOf('/en/')>=0){
177                //its a DE => EN link
178                $(this).click(handleCrossLanguageLinkClick);
179            } else if (main_language==="en-GB" && !(target_url.indexOf('/en/')>=0)){
180                //its a EN => DE link
181                $(this).click(handleCrossLanguageLinkClick);
182            }
183        });
184        // --------------
185        // Modal was closed with "continue"
186        $('#cross-language-modal-continue').click(function(){
187            Cookies.set('cross-language-dont-ask', $('#cross-language-dont-ask').is(":checked")?"true":"false");
188            //var cookie_tour = Cookies.getJSON(cookiename+'-combo-tour');
189            window.location = $('#cross-language-modal').data('url');
190        });
191
192    }
193
194    function handleCrossLanguageLinkClick(event){
195        event.preventDefault();
196        $('#cross-language-modal').data('url', $(this).attr('href'));
197        $('#cross-language-modal').modal('show');
198    }
199    setupCrossLanguageLinks();
200
201}(jQuery));
202
203

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.