PageSourceSearch

https://www.icdonmilanimassa.edu.it/pvw2/lib/js/functions.js?v=202610022

js icdonmilanimassa.edu.it collected 2026-10-02 01:03:45 UTC 7,066 bytes, 253 lines download raw bytes

1$(document).on('show.bs.modal', '.modal', function (event) {
2    var zIndex = 1040 + (10 * $('.modal:visible').length);
3    $(this).css('z-index', zIndex);
4    $('.modal:visible').modal('handleUpdate');
5    setTimeout(function() {
6        $('.modal-backdrop').not('.modal-stack').css('z-index', zIndex - 1).addClass('modal-stack');
7    }, 0);
8});
9
10function inviaDatiASync(pagina, dato, onSuccess)
11{
12    $.ajax({
13        type: "POST",
14        url: pagina,
15        data: dato,
16        async: true,
17        success: function(data)
18        {
19            if(typeof(onSuccess)=='function')
20            {
21                onSuccess(data);
22            }
23        }
24    });
25    return true;
26}
27
28function inviaFileASync(pagina, dato, onSuccess)
29{
30    $.ajax({
31        type: "POST",
32        url: pagina,
33        data: dato,
34        async: true,
35        processData: false,
36        contentType: false,
37        success: function(data)
38        {
39            if(typeof(onSuccess)=='function')
40            {
41                onSuccess(data);
42            }
43        }
44    });
45    return true;
46}
47
48function inviaDati(pagina, dato)
49{
50    var risultato="";
51    $.ajax({
52        type: "POST",
53        url: pagina,
54        data: dato,
55        async: false,
56        success: function(data)
57        {
58            risultato=data;
59        }
60    });
61    return risultato;
62}
63
64function ajaxRequest
65(
66    pagina,
67    dato,
68    onSuccess = false,
69    onError = false,
70    onComplete = false,
71    processData = true,
72    contentType = 'application/x-www-form-urlencoded; charset=UTF-8',
73    dataType = 'json',
74    async = true,
75    type = 'POST'
76)
77{
78    $.ajax({
79        type: type,
80        url: pagina,
81        data: dato,
82        async: async,
83        dataType: dataType,
84        processData: processData,
85        contentType: contentType,
86        success: function(data)
87        {
88            if (typeof(onSuccess) == 'function')
89            {
90                var result = (typeof data !== 'undefined' && 'result' in data) ? data.result : data;
91                onSuccess(result);
92            }
93        },
94        error: function(err)
95        {
96            if (typeof(onError) == 'function')
97            {
98                onError(err);
99            }
100            else
101            {
102                if (err.responseJSON.message != 'undefined')
103                {
104                    errorModal(err.responseJSON.message);
105                }
106                else
107                {
108                    errorModal('Errore del server');
109                }
110            }
111        },
112        complete: function()
113        {
114            if (typeof(onComplete) == 'function')
115            {
116                onComplete();
117            }
118        }
119    });
120    return true;
121}
122
123function ajaxSelectpickerInit(selector, ajaxUrl, ajaxAct, extraParams = {})
124{
125    let data = {
126        cerca: '{{{q}}}',
127        act: ajaxAct
128    };
129    data = {...data, ...extraParams};
130
131    $(selector).selectpicker({
132        'deselectAllText'   :   'Deseleziona tutto',
133        'selectAllText'     :   'Seleziona tutto',
134        'noneSelectedText'  :   'Nessun elemento selezionato',
135        'noneResultsText'   :   'Nessun risultato corrispondente a {0}',
136        'liveSearch'        :   true
137    }).ajaxSelectPicker({
138        ajax: {
139            url: ajaxUrl,
140            data: data
141        },
142        minLength: 3,
143        requestDelay: 1000,
144        locale: {
145            emptyTitle: 'Nessun elemento selezionato',
146            statusInitialized: 'Digitare qualche carattere per iniziare la ricerca...',
147            searchPlaceholder: 'Cerca',
148            statusNoResults: 'Nessun risultato',
149            errorText: 'Nessun risultato',
150            statusSearching: 'Ricerca in corso...',
151            statusTooShort: 'Inserire almeno 3 caratteri'
152        },
153        preprocessData: function(data){
154            data = data.result;
155            var i, l = data.length, array = [];
156            if (l) {
157                for (i = 0; i < l; i++) {
158                    array.push($.extend(true, data[i], {
159                        text : data[i].text,
160                        value: data[i].value,
161                        data : {
162                            subtext: data[i].subtext
163                        }
164                    }));
165                }
166            }
167            return array;
168        },
169        preserveSelected: false
170    });
171}
172
173function selectpickerInit()
174{
175    $('.selectpicker').selectpicker({
176        'deselectAllText'   :   'Deseleziona tutto',
177        'selectAllText'     :   'Seleziona tutto',
178        'noneSelectedText'  :   'Nessun elemento selezionato',
179        'noneResultsText'   :   'Nessun risultato corrispondente a {0}',
180        'liveSearch'        :   true
181    });
182    $('.selectpicker').selectpicker('refresh');
183}
184
185function tokenizeInit(selector)
186{
187    var tomselect = new TomSelect(selector, {
188        plugins: ['remove_button'],
189        create: true,
190        selectOnTab: true,
191        render: {
192            option: function(data, escape){
193                return '<div>' + escape(data.text) + '</div>';
194            },
195            item: function(data, escape){
196                return '<div>' + escape(data.text) + '</div>';
197            },
198            option_create: function(data, escape){
199                return '<div class="create">Aggiungi <strong>' + escape(data.input) + '</strong>&hellip;</div>';
200            },
201            no_results: function(data,escape){
202                return '<div class="no-results">Nessun risultato per "'+escape(data.input)+'"</div>';
203            },
204            not_loading: function(data,escape){
205                // no default content
206            },
207            optgroup: function(data){
208                let optgroup = document.createElement('div');
209                optgroup.className = 'optgroup';
210                optgroup.appendChild(data.options);
211                return optgroup;
212            },
213            optgroup_header: function(data, escape){
214                return '<div class="optgroup-header">' + escape(data.label) + '</div>';
215            },
216            loading: function(data,escape){
217                return '<div class="spinner"></div>';
218            },
219            dropdown: function(){
220                return '<div></div>';
221            }
222        },
223        onItemAdd: function(value, $item){
224            $('#tags-ts-control').val('');
225            $('#tags-ts-dropdown').html('');
226        }
227    });
228    return tomselect;
229}
230
231function autoCompleteInit(selector, url, act, tipo = '', minLength = 0)
232{
233    $(selector).autoComplete({
234        minLength: minLength,
235        resolver: 'custom',
236        events: {
237            search: function (qry, callback) {
238                $.ajax(
239                    url,
240                    {
241                        data: {
242                            'act'   : act,
243                            'tipo'  : tipo,
244                            'q'     : qry
245                        }
246                    }
247                ).done(function (res) {
248                    callback(res.result)
249                });
250            }
251        }
252    });
253}

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.