PageSourceSearch

https://www.neuchatelville.ch/typo3temp/assets/compressed/Activiti…c734497af08388520192e7113721e.js?1783607243

js neuchatelville.ch collected 2026-10-02 05:13:40 UTC 4,890 bytes, 120 lines download raw bytes

1/**
2 * jQuery plugin for activities datatables
3 */
4(function ($) {
5    $.Activities = function (el, options) {
6        var base = this;
7
8        // Version jQuery de l'élément
9        var $el = $(el);
10
11        // Ajoute une référence inverse sur le plugin dans le DOM
12        $el.data("Activities", base);
13
14        /**
15         * Point d'entrée, appelé lors de l'instanciation du plugin
16         */
17        var init = function () {
18            var table = $el.DataTable({
19                dom: 'Bfrtip',
20                select: true,
21                autoWidth: false,
22                responsive: true,
23                order: [3, 'asc'],
24                columnDefs: [
25                    { orderable: false, targets: 0 }
26                ],
27                buttons: [
28                    {
29                        extend: 'print',
30                        text: 'Tout imprimer',
31                        exportOptions: {
32                            modifier: {
33                                selected: null
34                            }
35                        }
36                    },
37                    {
38                        extend: 'print',
39                        text: 'Imprimer la sélection'
40                    }
41                ],
42                language: {
43                    "url": "//cdn.datatables.net/plug-ins/9dcbecd42ad/i18n/French.json"
44                },
45                initComplete: function () {
46                    // create columns filters
47                    var columnCount = 0;
48                    this.api().columns().every( function () {
49                        var column = this;
50                        if(column[0][0] !== 0) {
51                            var $headers = $('table#activities').find('th:visible');
52                            var select = $('<select><option value="" disabled selected>'+$($headers[columnCount + 1]).text()+'</select>')
53                                .appendTo( $(column.footer()).empty() )
54                                .on( 'change', function () {
55                                    var val = $.fn.dataTable.util.escapeRegex(
56                                        $(this).val()
57                                    );
58
59                                    if(val === "") {
60                                        select.find('option[data-reset="1"]').remove();
61                                        select.val("");
62                                    } else {
63                                        select.find('option:disabled').after('<option data-reset="1" value="">Réinitialiser le filtre</option>');
64                                    }
65
66                                    column
67                                        .search( val ? '^'+val+'$' : '', true, false )
68                                        .draw();
69                                } );
70
71                            column.data().unique().sort().each( function ( d, j ) {
72                                if(d) {
73                                    select.append( '<option value="'+d+'">'+d+'</option>' );
74                                }
75                            } );
76                            columnCount++;
77                        }
78                    });
79                }
80            });
81
82            // hide "space_available" field when no subscription available
83            table.on('responsive-display.dt', function(e, datatable, row) {
84                $('li[data-dt-row="'+row.index()+'"]').find('span.no-subscription').each(function() {
85                   $(this).parents('ul.dtr-details').find('li[data-dtr-index="7"]').remove();
86                });
87            });
88
89            // hide "subscription_link" and "price" for guided tour activities
90            table.on('responsive-display.dt', function(e, datatable, row) {
91                $('li[data-dt-row="'+row.index()+'"]').find('span.guided-tour').each(function() {
92                    $(this).parents('ul.dtr-details').find('li[data-dtr-index="11"]').remove();
93                    $(this).parents('ul.dtr-details').find('li[data-dtr-index="10"]').remove();
94                });
95            });
96
97            // Handle click on "Expand All" button
98            $('#btn-show-all-children').on('click', function () {
99                // Expand row details
100                table.rows(':not(.parent)').nodes().to$().find('td:first-child').trigger('click');
101            });
102
103            // Handle click on "Collapse All" button
104            $('#btn-hide-all-children').on('click', function () {
105                // Collapse row details
106                table.rows('.parent').nodes().to$().find('td:first-child').trigger('click');
107            });
108        }
109
110        // Initialisation du plugin
111        init();
112    };
113
114    $.fn.Activities = function (options) {
115        return this.each(function () {
116            (new $.Activities(this, options));
117        });
118    };
119
120})(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.