PageSourceSearch

https://mailticket.it/js/mltk_util.js?v=3.7.3

js mailticket.it collected 2026-09-24 09:40:36 UTC 29,848 bytes, 743 lines download raw bytes

1
2function mailticketLoginRequire() {
3    $(".show_login").click();
4}
5
6
7/**
8 * abilitazione / disabilitazione di HoldOn per bloccare interazione utente sulla pagina
9 * @param {any} bVal
10 */
11function mailticketUIHoldOn(bVal) {
12    if (bVal) {
13        var options = {
14            theme: "sk-circle",
15            //message: 'some cool message for your user here ! Or where the logo is ! Your skills are the only limit. ',
16            //backgroundColor: "#1847B1",
17            //textColor: "white"
18        };
19        HoldOn.open(options);
20    } else {
21        HoldOn.close();
22    }
23
24}
25
26//gestione box modale per avvisi utente
27$(document).ready(function () {
28    
29    var modalDiv = '<div class="modal fade" id="bx_dialog" role="dialog"> \
30	    <div class="modal-dialog"> \
31	      <div class="modal-content"> \
32		    <div class="modal-header"> \
33		      <button type="button" class="close" data-dismiss="modal">&times;</button> \
34		      <h4 class="modal-title"></h4> \
35		    </div> \
36		    <div class="modal-body"> \
37		    </div > \
38            <div class="modal-footer"> \
39                <div id="modal-additional-buttons"></div> \
40		      <button type="button" id="default-modal-close-button" class="btn btn-default" data-dismiss="modal">chiudi/close</button> \
41		    </div> \
42	      </div > \
43	    </div > \
44    </div > ';
45    var bDone = false;
46    $('body #bx_dialog').each(function () {
47        bDone = true;
48    });
49    if (!bDone) {
50        $('body').append(modalDiv);
51    }
52
53    
54});
55
56
57/**
58* Register a function to handle long click via mouse or touch
59*
60* @author Torge Kummerow Modificato da LM
61*/
62(function ($) {
63    $.fn.longClick = function (longClickCallback, clickCallback = null, timeout = 1000) {
64        if (longClickCallback == null && clickCallback == null)
65            throw new Error("Neither longClickCallback nor clickCallback defined");
66
67        let _t = this; //Nailing this to _t for all following function contexts
68
69        //Struct to keep track of the state.
70        let state = {
71            started: false,
72            triggered: false,
73            timer: null,
74
75            clear: function () {
76                state.started = false;
77                state.triggered = false;
78                if (state.timer != null)
79                    clearTimeout(state.timer);
80                state.timer = null;
81            }
82        }
83
84        //Disable native longpress touch handling on touch devices (like copy/paste)
85        $(_t).css({
86            '-webkit-touch-callout': 'none',
87            '-webkit-user-select': 'none',
88            '-khtml-user-select': 'none',
89            '-moz-user-select': 'none',
90            '-ms-user-select': 'none',
91            'user-select': 'none'
92        });
93
94        //Handling events
95        $(_t).on('mousedown mouseup mouseout touchstart touchend touchcancel touchmove contextmenu', function (event) {
96            event.preventDefault();
97            event.stopPropagation();
98            switch (event.type) {
99
100                case 'contextmenu':
101
102                    break;
103                case 'touchstart':
104                case 'mousedown':
105
106                    if (state.started)
107                        return; //Click handling alread in progress. A touch will trigger both touchstart and mousedown (but mousedown only after touchend)
108
109                    state.clear(); //To be safe
110                    state.started = true;
111
112                    //starting a timer when to handle the long press
113                    state.timer = setTimeout(function () {
114                        //User pressed for long enough to handle the press
115                        if (longClickCallback != null && state.started && !state.triggered) {
116                            state.triggered = true;
117                            longClickCallback(event);
118                        }
119                    }, timeout);
120                    break;
121
122                case 'touchend':
123                case 'mouseup':
124                    if (clickCallback != null && state.started && !state.triggered) {
125                        //No long press or click handled yet, So fire normal click event if callback was provided
126                        state.triggered = true;
127                        clickCallback(event);
128                    }
129
130                    /*  Delay clearing state because the event order is
131                     *  touchstart ... touchend mousedown mouseup
132                     *  if not done this way, mousedown will trigger a second click
133                     *  This also means the user can only click once every 100 ms which should be fine normally
134                     */
135                    setTimeout(function () {
136                        state.clear();
137                    }, 100);
138
139                    break;
140
141                case 'mouseout':
142                case 'touchcancel':
143                    // Cancel progress as mouse was moved outside of the element or finger outside of the canvas
144                    state.clear();
145                    break;
146
147                case 'touchmove':
148                    // There is no touchout event, so we check ourself if the user is still above the element after
149                    // moving. Note that with scrollable content, this will always return false, even if the finger
150                    // actually is outside, as the scroll area is ment to move with the finger.
151                    // This is especially happening for "rubberband" effects at the edge of scrollable content
152                    let x = event.originalEvent.touches[0].pageX;
153                    let y = event.originalEvent.touches[0].pageY;
154                    let elBelowMouse = document.elementFromPoint(x, y);
155                    if ($(_t)[0] != elBelowMouse) {
156                        state.clear();
157                    }
158                    break;
159            }
160        });
161
162
163        return this;
164    };
165
166})(jQuery);
167
168
169function visualBoxMsg(msg, title, w, h, closeCallback, footerActions, hideDefaultButton, shownCallback) {
170    if (trim(msg) != "") {
171        
172
173        if (trim(title) != "") { $('#bx_dialog .modal-header h4').html(title); } else { $('#bx_dialog .modal-header h4').html(LBL_DEFAULT_MSG_BOX); }
174        if (trim(w) != "") { $('#bx_dialog .modal-dialog').width(w); } else { $('#bx_dialog').width('auto'); }
175        if (trim(h) != "") { $('#bx_dialog .modal-body').height(h); } else { $('#bx_dialog').height('auto'); }
176        var msg_htm = "<p>" + trim(msg) + "</p>";
177        $('#bx_dialog .modal-body').html(msg_htm); 
178        $('#bx_dialog').on("hide.bs.modal", function () {
179            $('#bx_dialog').off("hide.bs.modal");
180            if (closeCallback) {
181                setTimeout(function () { closeCallback(); }, 1);
182            }
183        });
184        $('#bx_dialog').on("shown.bs.modal", function () {
185            $('#bx_dialog').off("shown.bs.modal");
186            if (shownCallback) {
187                setTimeout(function () { shownCallback(); }, 1);
188            }
189        });
190        if (footerActions) {
191            $('#bx_dialog #modal-additional-buttons').empty().append(footerActions);
192        } else {
193            $('#bx_dialog #modal-additional-buttons').html('');
194        }
195        if (hideDefaultButton) {
196            $('#bx_dialog #default-modal-close-button').hide();
197        } else {
198            $('#bx_dialog #default-modal-close-button').show();
199        }
200
201        $('#bx_dialog').modal({ backdrop: "static" });
202
203    }
204    mailticketUIHoldOn(false);
205}
206//chiude dialogo modale senza eseguire azioni di close callback
207function doneBoxMsg() {
208    $('#bx_dialog').off("hide.bs.modal");
209    $('#bx_dialog').modal('hide');
210}
211
212function visualBoxMsgCodif(msg, title, w, h) {
213    if (trim(msg) != "") {
214        var msg_htm = urldecode(trim(msg));
215        visualBoxMsg(msg_htm, title, w, h);
216    }
217}
218function urldecode(str) {
219    return decodeURIComponent((str + '').replace(/\+/g, '%20'));
220}
221//
222function htmlentities(str) {
223    return String(str)
224        .replace(/&/g, '&amp;')
225        .replace(/"/g, '&quot;')
226        .replace(/'/g, '&#39;')
227        .replace(/</g, '&lt;')
228        .replace(/>/g, '&gt;');
229}
230//trim della stringa e sostituzione di doppi spazi con singoli spazi
231function trim(inputString) {
232    if (typeof inputString != "string") { return inputString; }
233
234    var retValue = inputString.replace(/^\s+|\s+$/gm, '');
235
236    retValue = retValue.replace(/ +/gm, " ");
237
238    return retValue;
239}
240
241// https://github.com/uxitten/polyfill/blob/master/string.polyfill.js
242// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart
243if (!String.prototype.padStart) {
244    String.prototype.padStart = function padStart(targetLength, padString) {
245        targetLength = targetLength >> 0; //truncate if number, or convert non-number to 0;
246        padString = String(typeof padString !== 'undefined' ? padString : ' ');
247        if (this.length >= targetLength) {
248            return String(this);
249        } else {
250            targetLength = targetLength - this.length;
251            if (targetLength > padString.length) {
252                padString += padString.repeat(targetLength / padString.length); //append to original to ensure we are longer than needed
253            }
254            return padString.slice(0, targetLength) + String(this);
255        }
256    };
257}
258function validName(s) {
259    //regexp con tutti i caratteri unicode validi per un nome/cognome (da XRegExp)
260    var re = /^[A-Za-z '"\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u
2600EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]+$/u;
261    var reSpecialChars = /[ '"]/g;
262    s = trim(s);
263    var valid = s != "" && re.test(s);
264    valid = valid && s.replace(reSpecialChars, "")!="";
265    return valid;
266}
267function validEmail(email) {
268    //return /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+.([a-zA-Z])+([a-zA-Z])+/.test(email);
269    //https://emailregex.com/
270    return /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(email);
271}
272function validCell(cell) {  
273    if (cell.substring(0, 2) == "00" && cell.substring(0, 4) != "0039") {
274        var filter = /^[0-9]+$/;
275        if (filter.test(cell)) {
276            return true;
277        } else {
278            return false;
279        }
280    } else {
281        return /^[+]*[{0,1}[0-9]{1,4}[)]{0,1}[-\s\./0-9]*$/.test(cell);
282    }
283}
284function simple() {
285    return false;
286}
287function visualmsg(msg1, msg2) {
288    //
289    mailticketUIHoldOn(true);
290    visualBoxMsg(msg1 +"<br>"+ msg2,"","","");
291    //
292}
293/*function addanaplus(idrow) {
294    alert("add ana plus....");
295}*/
296function chkdatifatt(i_e, az, msg_visual_custom_callback) {
297    var bok = true;
298    var msg = "";
299    var msg2 = "";
300    //
301    if ($("#fatt_privacy").is(":not(:checked)")) {
302        bok = false;
303        msg = MSG_ERR_ACCETTAZ_PRIVACY;
304    } else {
305        const az = trim($('#fatt_az').val()); 
306        const rs = trim($('#fatt_rs').val()); 
307        const ie = trim($('#fatt_ie').val());
308        const pi = trim($('#fatt_pi').val());
309        const pec = trim($('#fatt_pec').val());
310        const cod_dest = trim($('#fatt_cod_dest').val());
311        const nome = trim($('#fatt_nome').val());
312        const cogn = trim($('#fatt_cogn').val());
313        const cf = trim($('#fatt_cf').val());
314        const passaporto = trim($('#fatt_passaporto').val());
315
316        if (az == "1") {
317            /* azienda */
318
319            if (rs == "") {
320                bok = false;
321                msg = MSG_ERR_FATT_RS;
322            } else {
323                if (trim(pi).length == 0) {
324                    bok = false;
325                    msg = MSG_ERR_FATT_PI_EMPTY;
326                }
327
328                if (bok && ie === "IT") {
329                    if (!checkpi(pi)) {
330                        bok = false;
331                        msg = MSG_ERR_FATT_PI;
332                    }
333                }
334            }
335            if (bok) {
336                if (ie === "IT") {
337                    if (pec == "" && cod_dest == "") {
338                        bok = false;
339                        msg = MSG_ERR_FATT_DATI_SDI;
340                    } else if (pec != "" && cod_dest == "") {
341                        if (!validEmail(pec)) {
342                            bok = false;
343                            msg = "PEC non valida";
344                        }
345                    } else if (cod_dest == "") {
346                        $('#fatt_cod_dest').val("0000000")
347                    }
348                }
349            }
350
351        } else if (az == "0") {
352            /* persona fisica */
353
354            if (nome == "") {
355                bok = false;
356                msg = MSG_ERR_FATT_NOME;
357            } else if (cogn == "") {
358                bok = false;
359                msg = MSG_ERR_FATT_COGN;
360            } else {
361                if (ie === "IT") {
362                    if (trim(cf).length == 0) {
363                        bok = false;
364                        msg = MSG_ERR_FATT_CF_EMPTY;
365                    }
366
367                    if (bok && !checkcf(cf)) {
368                        bok = false;
369                        msg = MSG_ERR_FATT_CF;
370                    }
371                } else {
372                    if (trim(cf).length == 0) {
373                        bok = false;
374                        msg = MSG_ERR_FATT_CF;
375                    }
376                }
377            }
378        } else if (az == "2") {
379            /* lavoratore autonomo / ditta individuale */
380
381            if (nome == "") {
382                bok = false;
383                msg = MSG_ERR_FATT_NOME;
384            } else if (cogn == "") {
385                bok = false;
386                msg = MSG_ERR_FATT_COGN;
387            } else {
388                if (ie === "IT") {
389                    if (trim(cf).length == 0) {
390                        bok = false;
391                        msg = MSG_ERR_FATT_CF_EMPTY;
392                    }
393
394                    if (bok && !checkcf(cf)) {
395                        bok = false;
396                        msg = MSG_ERR_FATT_CF;
397                    }
398                } else {
399                    if (trim(cf).length == 0) {
400                        bok = false;
401                        msg = MSG_ERR_FATT_PASSAPORTO;
402                    }
403                }
404            }
405
406            if (bok) {
407                if (trim(pi).length == 0) {
408                    bok = false;
409                    msg = MSG_ERR_FATT_PI_EMPTY;
410                }
411
412                if (bok && ie === "IT") {
413                    if (!checkpi(pi)) {
414                        bok = false;
415                        msg = MSG_ERR_FATT_PI;
416                    }
417                }
418            }
419
420            if (bok) {
421                if (ie === "IT") {
422                    if (pec == "" && cod_dest == "") {
423                        bok = false;
424                        msg = MSG_ERR_FATT_DATI_SDI;
425                    } else if (pec != "" && cod_dest == "") {
426                        if (!validEmail(pec)) {
427                            bok = false;
428                            msg = "PEC non valida";
429                        }
430                    } else if (cod_dest == "") {
431                        $('#fatt_cod_dest').val("0000000")
432                    }
433                }
434            }
435        }
436        //
437        if (bok) {
438            const indirizzo = trim($('#fatt_indiriz').val());
439            const cap = trim($('#fatt_cap').val());
440            const city = ie === 'IT' ? trim($('#fatt_city_i').val()) : trim($('#fatt_city_e').val());
441            const prov = ie === 'IT' ? trim($('#fatt_prov').val()) : "provprovprov";
442            const mail = trim($('#fatt_mail').val());
443
444            if (prov == "") {
445                bok = false;
446                msg = MSG_ERR_FATT_PROV;
447            } else if (city == "") {
448                bok = false;
449                msg = MSG_ERR_FATT_CITY;
450            } else if (indirizzo == "") {
451                bok = false;
452                msg = MSG_ERR_FATT_INDIRIZZO;
453            } else if (!cap) {
454                bok = false;
455                msg = MSG_ERR_FATT_CAP_EMPTY;
456            } else if (ie == "IT" && !/^\d{5}$/g.test(cap)) {
457                bok = false;
458                msg = MSG_ERR_FATT_CAP;
459            } else if (!mail) {
460                bok = false;
461                msg = MSG_ERR_FATT_MAIL_EMPTY;
462            } else if (!validEmail(mail)) {
463                bok = false;
464                msg = MSG_ERR_FATT_MAIL;
465            }
466        }
467    }
468    //
469    if (!bok) {
470        if (msg_visual_custom_callback) {
471            mailticketUIHoldOn(false);
472            msg_visual_custom_callback(msg);
473        } else {
474            visualmsg(msg, msg2);
475        }
476    }
477    return bok;
478}
479function checkpi(pi) {
480    var bok = true;
481    var cd_err = "";
482    //
483    if (trim(pi) == "") {
484        bok = false;
485        cd_err = "01";
486    }
487    if (bok) {
488        if (trim(pi).length != 11) {
489            bok = false;
490            cd_err = "02";
491        }
492        if (bok) {
493            validi = "0123456789";
494            for (i = 0; i < 11; i++) {
495                if (validi.indexOf(pi.charAt(i)) == -1) { //char non valido in pi
496                    bok = false;
497                    cd_err = "03";
498                    break;
499                }
500            }
501            if (bok) {
502                s = 0;
503                for (i = 0; i <= 9; i += 2)
504                    s += pi.charCodeAt(i) - '0'.charCodeAt(0);
505                for (i = 1; i <= 9; i += 2) {
506                    c = 2 * (pi.charCodeAt(i) - '0'.charCodeAt(0));
507                    if (c > 9) c = c - 9;
508                    s += c;
509                }
510                if ((10 - s % 10) % 10 != pi.charCodeAt(10) - '0'.charCodeAt(0)) { //codice controllo pi non corrisponde
511                    bok = false;
512                    cd_err = "04";
513                }
514            }
515        }
516    }
517    //
518    return bok;
519}
520function checkcf(cf) {
521    var bok = true;
522    var cd_err = "";
523    //
524    var validi, i, s, set1, set2, setpari, setdisp;
525    if (trim(cf) == "") {
526        bok = false;
527        cd_err = "01";
528    }
529    if (bok) {
530        cf = cf.toUpperCase();
531        if (cf.length != 16) {
532            bok = false;
533            cd_err = "02";
534        }
535        if (bok) {
536            validi = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
537            for (i = 0; i < 16; i++) {
538                if (validi.indexOf(cf.charAt(i)) == -1) { //car nn valido in cf
539                    bok = false;
540                    cd_err = "03";
541                    break;
542                }
543            }
544            if (bok) {
545                set1 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
546                set2 = "ABCDEFGHIJABCDEFGHIJKLMNOPQRSTUVWXYZ";
547                setpari = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
548                setdisp = "BAKPLCQDREVOSFTGUHMINJWZYX";
549                s = 0;
550                for (i = 1; i <= 13; i += 2)
551                    s += setpari.indexOf(set2.charAt(set1.indexOf(cf.charAt(i))));
552                for (i = 0; i <= 14; i += 2)
553                    s += setdisp.indexOf(set2.charAt(set1.indexOf(cf.charAt(i))));
554                if (s % 26 != cf.charCodeAt(15) - 'A'.charCodeAt(0)) { //code controllo cf nn valido
555                    bok = false;
556                    cd_err = "04";
557                }
558            }
559        }
560    }
561    //
562    return bok;
563}
564
565
566
567//Gestione Cookies
568function setCookie(cname, cvalue, exdays) {
569    var d = new Date();
570    d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
571    var expires = "expires=" + d.toUTCString();
572    document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
573}
574
575function getCookie(cname) {
576    var name = cname + "=";
577    var ca = document.cookie.split(';');
578    for (var i = 0; i < ca.length; i++) {
579        var c = ca[i];
580        while (c.charAt(0) == ' ') {
581            c = c.substring(1);
582        }
583        if (c.indexOf(name) == 0) {
584            return c.substring(name.length, c.length);
585        }
586    }
587    return "";
588}
589
590const validaCaptcha = (tipo, successFunc, closeFunc) => {
591    //Off?
592    if (tipo == "off") {
593        //FIXME: Fare submit col verify "a secco"
594        //       Per il momento non serve a niente tanto il captcha è sempre ON in produzione
595    }
596
597    //ReCaptcha v3
598    if (tipo === "r3") {
599        grecaptcha.execute(sitekeycaptcha, { action: 'submit' }).then(function (token) {
600            ajpage = "ws_cms/WsCms.asmx/WSmltk_verifyCaptcha";
601            $.ajax({
602                type: "POST",
603                contentType: "application/json; charset=utf-8",
604                url: ajpage,
605                dataType: "json",
606                processData: false,
607                data: "{response: '" + token + "'}",
608                beforeSend: function () { },
609                complete: function () { },
610                success: function (data) {
611                    $("#captcha_dialog").modal("hide");
612                    if (data.d.WS_esito == "ok") {
613                        successFunc();
614                    } else {
615
616                        msg_out_visual = MSGERR_SENDFORM_FAILED;
617                        visualBoxMsg(msg_out_visual, "", "", "");
618
619                    }
620
621
622                },
623                error: function (msg, error, errorThrown) {
624                    $("#captcha_dialog").modal("hide");
625                    msg_out_visual = MSGERR_SENDFORM_FAILED;
626                    visualBoxMsg(msg_out_visual, "", "", "");
627                    closeFunc();
628
629                }
630            });
631        });
632
633        return;
634    }
635
636    //ReCaptcha v2 / Turnstile
637    const { target, cls, obj } = tipo == "cf"
638        ? { target: "#captcha2", cls: "", obj: turnstile }
639        : { target: "captcha2", cls: "google-captcha", obj: grecaptcha };
640
641    var firstInit = captchaModalInit(cls);
642    var opt_widget_id;
643    if (firstInit) {
644        opt_widget_id = obj.render(target, {
645            sitekey: sitekeycaptcha,
646            'callback': function (response) {
647                ajpage = "ws_cms/WsCms.asmx/WSmltk_verifyCaptcha";
648                $.ajax({
649                    type: "POST",
650                    contentType: "application/json; charset=utf-8",
651                    url: ajpage,
652                    dataType: "json",
653                    processData: false,
654                    data: "{response: '" + response + "'}",
655                    beforeSend: function () { },
656                    complete: function () { },
657                    success: function (data) {
658                        $("#captcha_dialog").modal("hide");
659                        if (data.d.WS_esito == "ok") {
660                            successFunc();
661                        } else {
662                            msg_out_visual = MSGERR_SENDFORM_FAILED;
663                            visualBoxMsg(msg_out_visual, "", "", "");
664                        }
665                    },
666                    error: function (msg, error, errorThrown) {
667                        $("#captcha_dialog").modal("hide");
668                        msg_out_visual = MSGERR_SENDFORM_FAILED;
669                        visualBoxMsg(msg_out_visual, "", "", "");
670                        closeFunc();
671
672                    }
673                });
674            }, theme: "light"
675        });
676
677        $('#captcha_dialog').on('hide.bs.modal', function () {
678            obj.reset();
679
680            if (typeof closeFunc != "undefined") {
681                closeFunc();
682            }
683        });
684    }
685
686    $('#captcha_dialog').modal("show");
687    mailticketUIHoldOn(false);
688};
689
690function checkDwnlTktCaptcha(successFunc, closeFunc, tipo){
691    validaCaptcha(tipo, successFunc, closeFunc);
692}
693
694
695function checkCartCaptcha(successFunc, closeFunc) {
696
697    var sFunc = successFunc;
698    var cFunc = closeFunc;
699
700    var skipCaptcha = PageMethods.getCartCaptcha(
701        function (result) {
702            if (result === "") {
703                successFunc();
704            } else {
705                validaCaptcha(result, successFunc, closeFunc);
706            }
707        },
708        function (error) {
709        });
710    
711}
712
713 
714
715function captchaModalInit(tipo) {
716
717    var modalDiv = '<div class="modal fade" id="captcha_dialog" role="dialog"> \
718	    <div class="modal-dialog"> \
719	      <div class="modal-content"> \
720		    <div class="modal-header"> \
721		      <button type="button" class="close" data-dismiss="modal">&times;</button> \
722		      <h4 class="modal-title">'+ t('LBL_CAPTCHA_CART_TITLE') + '</h4> \
723		    </div> \
724		    <div class="modal-body"> \
725            <p>'+ t('LBL_CAPTCHA_CART_INFO') + '</p><br>\
726            <div id="captcha2" class="' + tipo + '"></div> \
727		    </div > \
728            <div class="modal-footer"> \
729                <div id="modal-additional-buttons"></div> \
730		      <button type="button" class="btn btn-default" data-dismiss="modal">' + t('ID_BUTTON_MODAL_CLOSE') + '</button> \
731		    </div> \
732	      </div > \
733	    </div > \
734    </div > ';
735    var bDone = false;
736    $('body #captcha_dialog').each(function () {
737        bDone = true;
738    });
739    if (!bDone) {
740        $('body').append(modalDiv);
741    }
742    return !bDone;
743}

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.