PageSourceSearch

https://www.bielersee.ch/typo3temp/assets/compressed/custom-92453a2a081d879e1d75d65439f2dc16.js?1780305284

js bielersee.ch collected 2026-10-02 11:43:11 UTC 14,336 bytes, 372 lines download raw bytes

1$(document).ready(function () {
2
3    initialiseDatatable();
4    if ($('#document-table tr').length < 20) {
5        $('.dataTables_paginate').hide();
6    }
7
8    var buttons = $('#download-zip-button').parent();
9    buttons.insertBefore('#document-table_paginate');
10    $('#download-zip-button').prop('disabled', true);
11    var filterSelectLabel = $('#download-filter-select-label').val();
12
13
14
15
16    function initialiseDatatable() {
17        var mydata = $('#document-table').DataTable({
18            "dom": 'Bfrtip',
19            "info": false,
20            "pageLength": 20,
21            "searching": false,
22            "lengthChange": false,
23            "paging": true,
24            "select": {
25                'style': 'multi',
26                'selector': 'tr td:not(.no-select)'
27            },
28            "language": {
29                "paginate": {
30                    "previous": "",
31                    "next": ""
32                }
33            },
34            "createdRow": function (row, data, index) {
35                if (data[2] == '') {
36                    $('td:eq(0)', row).removeClass('select-checkbox');
37                    $(row).addClass('no-select');
38                    $(row).removeClass('select-row');
39                }
40                else {
41                    $(row).removeClass('no-select');
42                    $(row).addClass('select-row');
43                }
44            },
45            "initComplete": function (settings, json) {
46                var buttons = $('#download-zip-button').parent();
47                buttons.insertBefore('#document-table_paginate');
48                $('#download-zip-button').prop('disabled', true);
49            },
50            "columnDefs": [
51                {
52                    'targets': 0,
53                    'checkboxes': {
54                        'selectRow': true
55                    },
56                    'render': function () {
57                        return '';
58                    }
59                },
60                { "orderable": false, "targets": 0, className: 'select-checkbox' },
61                { "orderable": false, "targets": 4 }
62            ],
63            "order": [[1, 'asc']],
64            "buttons": [
65                {
66                    attr: {
67                        id: 'download-zip-button'
68                    },
69                    text: 'Download files as zip',
70                    action: function (e, dt, node, config) {
71                        var rows_selected = mydata.rows({ selected: true });
72                        var selected_ids = rows_selected.ids();
73                        var uri = $('#document-table').attr('data-url');
74                        $.ajax({
75                            url: uri,
76                            type: 'POST',
77                            data: {
78                                'tx_pandadownload_pandadownloadcenter[documents]': selected_ids.toArray(),
79                            },
80                            success: function (data) {
81                                var data = jQuery.parseJSON(data);
82                                if (data.count > 0) {
83                                    document.location = data.url;
84                                }
85                                else {
86                                    $("<div>" + data.error + "</div>").dialog({
87                                        dialogClass: "no-close",
88                                        buttons: [
89                                            {
90                                                text: "OK",
91                                                click: function () {
92                                                    $(this).dialog("close");
93                                                }
94                                            }
95                                        ]
96                                    });
97                                }
98
99                            },
100                            error: function (XMLHttpRequest, textStatus, errorThrown) {
101                                $("<div>You are selected links only.Please select atleast one file</div>").dialog({
102                                    dialogClass: "no-close",
103                                    buttons: [
104                                        {
105                                            text: "OK",
106                                            click: function () {
107                                                $(this).dialog("close");
108                                            }
109                                        }
110                                    ]
111                                });
112                            }
113                        });
114                    }
115                }
116            ],
117            "aoColumns": [
118                {
119                    "bSortable": false
120                },
121                {
122                    "bSortable": true
123
124                },
125                {
126                    "bSortable": true
127                },
128                {
129                    "sType": "num-html",
130                    "bSortable": true
131
132                },
133                {
134                    "bSortable": false
135
136                }
137
138            ]
139
140        });
141
142
143
144        jQuery.extend(jQuery.fn.dataTableExt.oSort, {
145            "num-html-pre": function (a) {
146                var x = String(a).replace(/(?!^-)[^0-9.]/g, "");
147                return parseFloat(x);
148            },
149
150            "num-html-asc": function (a, b) {
151                return ((a < b) ? -1 : ((a > b) ? 1 : 0));
152            },
153
154            "num-html-desc": function (a, b) {
155                return ((a < b) ? 1 : ((a > b) ? -1 : 0));
156            }
157        });
158
159        // mydata.on('draw', function () {
160        //     console.log( 'Redraw occurred at: '+new Date().getTime() );
161        // } );
162
163        mydata.on("click", "th.select-checkbox", function () {
164            if ($("th.select-checkbox").hasClass("selected")) {
165                mydata.rows().deselect();
166                $("th.select-checkbox").removeClass("selected");
167            } else {
168                mydata.rows().select();
169                $("th.select-checkbox").addClass("selected");
170            }
171        }).on("select deselect", function () {
172            var count = mydata.rows({
173                selected: true
174            }).count();
175            if (count > 1) {
176                $("#download-zip-button").removeAttr("disabled");
177                $('#download-zip-button').html('Download Files as zip (' + count + ')');
178            }
179            else {
180                $('#download-zip-button').prop('disabled', true);
181                $('#download-zip-button').html('Download Files as zip (' + count + ')');
182
183            }
184
185            if (count !== mydata.rows().count()) {
186                $("th.select-checkbox").removeClass("selected");
187            } else {
188                $("th.select-checkbox").addClass("selected");
189            }
190        });
191
192        mydata.on('select.dt', function (e, dt, type, indexes) {
193            mydata.rows('tr.no-select').deselect();
194        });
195
196
197    }
198
199    for (var i = 1; i <= 3; i++) {
200        $('#category-filterlevel-' + i).prepend($("<option></option>")
201            .attr("value", 0)
202            .text(filterSelectLabel));
203        $('#category-filterlevel-' + i).val(0);
204    }
205
206
207
208    $(".subfilter-selection").change(function () {
209        var category = $(this).val();
210        var uri = $('.download-filter').attr('data-url');
211        var elm = $(this).attr('id');
212        var buttons = $('#download-zip-button').parent();
213        buttons.insertBefore('#document-table_paginate');
214        $('#download-zip-button').show();
215        $('#download-zip-button').prop('disabled', true);
216        $.ajax({
217            url: uri,
218            type: 'POST',
219            data: {
220                'tx_pandadownload_pandadownloadcenter[category]': category,
221            },
222            success: function (data) {
223                var obj = jQuery.parseJSON(data);
224                var elemlevel = elm.split('-');
225                var idval = parseInt(elemlevel[2]) + 1;
226                var targetElm = 'category-filterlevel-' + idval;
227                $('#' + targetElm).empty();
228                $.each(obj, function (key, value) {
229                    $('#' + targetElm).append($("<option></option>")
230                        .attr("value", value.uid)
231                        .text(value.title));
232                });
233                $('#' + targetElm).prepend($("<option></option>")
234                    .attr("value", 0)
235                    .text(filterSelectLabel));
236                $('#' + targetElm).val(0);
237                if (obj.length > 0) {
238                    $('#' + targetElm).removeAttr("disabled");
239                    $('#' + targetElm).parent().removeClass('disable');
240                }
241                else {
242                    for (var i = idval; i <= 3; i++) {
243                        $('#category-filterlevel-' + i).attr("disabled", true);
244                        $('#category-filterlevel-' + i).parent().addClass('disable');
245                    }
246                }
247                if (parseInt(elemlevel[2]) == 1) {
248                    $('#category-filterlevel-3').empty();
249                    $('#category-filterlevel-3').prepend($("<option></option>")
250                        .attr("value", 0)
251                        .text(filterSelectLabel));
252                    $('#category-filterlevel-3').val(0);
253                    $('#category-filterlevel-3').attr('disabled', true);
254                    $('#category-filterlevel-3').parent().addClass('disable');
255                    var currentUrl = window.location.href;
256                    url = new URL(currentUrl);
257                    url.searchParams.delete('tx_pandadownload_pandadownloadcenter[category-filterlevel-' + i + ']');
258                    newurl = url.href;
259                    window.history.pushState({ path: currentUrl }, '', newurl);
260
261                }
262
263                updateList(category, elm);
264            }
265        });
266        var currentUrl = window.location.href;
267        var sectionSplit = currentUrl.split('#');
268        if (category != 0) {
269            // var appendurl = '&tx_kkdownload_kkdownloadcenter['+elm+']='+category;
270            // var newurl = sectionSplit[0] + appendurl;
271            // if(sectionSplit[1] != ''){
272            //     newurl += '#'+sectionSplit[1];
273            // }
274            url = new URL(currentUrl);
275            url.searchParams.set('tx_pandadownload_pandadownloadcenter[' + elm + ']', category);
276            newurl = url.href;
277            window.history.pushState({ path: currentUrl }, '', newurl);
278            $('.lang-navig-content').find('a').each(function (e) {
279                var appendurl = '&tx_pandadownload_pandadownloadcenter[' + elm + ']=' + category;
280                var langurl = $(this).attr('href');
281                var newlangurl = langurl + appendurl;
282                $(this).attr("href", newlangurl.href);
283            });
284        }
285        else {
286            var idtargt = $(this)[0].id;
287            var currentUrl = window.location.href;
288            url = new URL(currentUrl);
289            url.searchParams.delete('tx_pandadownload_pandadownloadcenter[' + idtargt + ']');
290            newurl = url.href;
291            window.history.pushState({ path: currentUrl }, '', newurl);
292        }
293
294    });
295
296    updateList = function (category, element) {
297        var elemlevel = element.split('-');
298        var idval = parseInt(elemlevel[2]) - 1;
299        var prev = 'category-filterlevel-' + idval;
300        if (category == 0) {
301            if (idval == 0) {
302                category = $('#main-category-selected').val();
303            }
304            else {
305                category = $('#' + prev).val();
306            }
307            for (var i = parseInt(elemlevel[2]) + 1; i <= 3; i++) {
308                $('#category-filterlevel-' + i).empty();
309                $('#category-filterlevel-' + i).prepend($("<option></option>")
310                    .attr("value", 0)
311                    .text(filterSelectLabel));
312                $('#category-filterlevel-' + i).prop("disabled", true);
313                $('#category-filterlevel-' + i).parent().addClass('disable');
314                var currentUrl = window.location.href;
315                url = new URL(currentUrl);
316                url.searchParams.delete('tx_pandadownload_pandadownloadcenter[category-filterlevel-' + i + ']');
317                newurl = url.href;
318                window.history.pushState({ path: currentUrl }, '', newurl);
319
320            }
321        }
322        var uri = $('.download-filter').attr('data-urlFilterDoc');
323        if (category != 0) {
324            $.ajax({
325                url: uri,
326                type: 'POST',
327                data: {
328                    'tx_pandadownload_pandadownloadcenter[category]': category,
329                    'tx_pandadownload_pandadownloadcenter[parent]': $('#data-table-result').attr('data-maincategory'),
330                },
331                success: function (data) {
332                    $('#data-table-result').html(data);
333                    initialiseDatatable();
334                    if ($('#document-table tr').length < 20) {
335                        $('.dataTables_paginate').hide();
336                    }
337                    // $('#document-table').dataTable({
338                    //     "fnDrawCallback": function (oSettings) {
339                    //         if ($('#document-table tr').length < 20) {
340                    //             $('.dataTables_paginate').hide();
341                    //         }
342                    //     }
343                    // });
344                }
345            });
346        }
347    }
348    retainFilters();
349});
350
351function retainFilters() {
352    $('.subfilter-selection').find('option[selected="selected"]').each(function () {
353        $(this).prop('selected', true);
354    });
355    var levelThree = $('#category-filterlevel-3').val();
356    if (levelThree != '') {
357        $('#category-filterlevel-3').change();
358    }
359    else {
360        var levelTwo = $('#category-filterlevel-2').val();
361        if (levelTwo != '') {
362            $('#category-filterlevel-2').change();
363        }
364        else {
365            var levelOne = $('#category-filterlevel-1').val();
366            if (levelOne != '') {
367                $('#category-filterlevel-1').change();
368            }
369        }
370    }
371}
372

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.