PageSourceSearch

https://www.paradisohotel.it/form/js/formFunctions.js

js paradisohotel.it collected 2026-10-06 10:21:32 UTC 16,815 bytes, 350 lines download raw bytes

1$(document).ready(function(){
2    var popup = '';
3            popup += '<div class="modal fade" id="myModal" role="dialog">';
4                popup += '<div class="modal-dialog modal-lg">';
5                    popup += '<div class="modal-content">';
6                        popup += '<div class="modal-header">';
7                            popup += '<button type="button" class="close" data-dismiss="modal">&times;</button>';
8                            popup += '<h4 class="modal-title">Attenzione</h4>';
9                        popup += '</div>';
10                        popup += '<div class="modal-body">';
11                            popup += '<p id="testopopup"></p>';
12                        popup += '</div>';
13                        popup += '<div class="modal-footer">';
14                            popup += '<button type="button" class="btn btn-default" data-dismiss="modal">Chiudi</button>';
15                        popup += '</div>';
16                    popup += '</div>';
17                popup += '</div>';
18            popup += '</div>';
19        popup += '</div>';
20	
21	$("body").append(popup);
22	$("#msg").delay(500).fadeIn(1000);
23	$("#msg").click(function(){
24            $("#msg").fadeOut(1000);
25        });
26        
27		$('form[name=formdirichiesta]').captcha();
28		
29        $("body").on("input propertychange", ".floating-label-form-group", function(e) {
30            $(this).toggleClass("floating-label-form-group-with-value", !!$(e.target).val());
31        }).on("focus", ".floating-label-form-group", function() {
32            $(this).addClass("floating-label-form-group-with-focus");
33        }).on("blur", ".floating-label-form-group", function() {
34            $(this).removeClass("floating-label-form-group-with-focus");
35        });
36            
37	$("form[name='formdirichiesta']").on("submit", function(event){
38            event.preventDefault();
39            
40            var maildestinatario = $("form[name='formdirichiesta'] input[name='maildestinatario']").val();
41            var linguaform = $("form[name='formdirichiesta'] input[name='linguaform']").val();
42            var urlform = $("form[name='formdirichiesta'] input[name='urlform']").val();
43            var idform = $("form[name='formdirichiesta'] input[name='idform']").val();
44
45            var campitrovati = [];
46            $("form[name='formdirichiesta'] input:text[data-dbcampo='1'], form[name='formdirichiesta'] input[type='email'][data-dbcampo='1'], form[name='formdirichiesta'] input:radio[data-dbcampo='1']:checked, form[n
46ame='formdirichiesta'] input:checkbox[data-dbcampo='1']:checked, form[name='formdirichiesta'] select[data-dbcampo='1'], form[name='formdirichiesta'] textarea[data-dbcampo='1']").each(function(){
47                var campo = $(this).attr("data-idcampo");
48                var tipocampo = $(this).attr("data-tipocampo");
49				
50                if(tipocampo == 2){
51                    var valore = $(this).find('option').filter(':selected').text();
52                } else {
53                    var valore = $(this).val();
54                }
55				
56                if(!valore || valore === null){ valore = ''; }
57
58                if(campo){
59                    campitrovati.push({idcampo:campo,testo:valore,tipo:tipocampo});
60                }
61            });
62
63            if(campitrovati.length > 0){
64                $.ajax({
65                    type: 'POST',
66                    url: urlform+'/form/actionform.php',
67                    data: {
68                        postajax: 'salvacampiform',
69                        lingua: linguaform,
70                        url: urlform,
71                        idform: idform,
72                        campidb: campitrovati
73                    },
74                    datatype: 'text',
75                    async: true,
76                    beforeSend: function(){
77                        $('#areaspinnerform').show();
78                        $('#inviaformrichiesta').css('display', 'none');
79                    },
80                    success: function(data, stato){
81                        /*console.log(data); return;*/
82                        var risultato = JSON.parse(data);
83                        if(risultato['esito'] === "success"){
84                            if(risultato['database'] === true){
85                                var idrichiesta = risultato['idrichiesta'];
86                                var idformreturn = risultato['idform'];
87                                inviomailform(linguaform, urlform, maildestinatario, idrichiesta, idformreturn);
88                            }
89                        }
90                        else{
91                            /*console.log("errrore: "+risultato['esito']);*/
92                            if(linguaform === 'it'){
93                                var messerror = "Errore invio mail.<br>Si prega di riprovare.<br>Se l'errore persiste contattare la struttura.";
94                            } else {
95                                var messerror = "Error sending mail.<br>Please try again.<br>If the error persists contact the structure.";
96                            }
97                            $("#areaspinnerform").hide();
98                            $("#testopopup").html(messerror);
99                            $('#myModal').modal({show: 'false'});
100                        }
101                    },
102                    error: function(richiesta, stato, errore){
103                        console.log(errore);
104                    },
105                    complete: function(){}
106                });
107            }
108            else if(campitrovati.length === 0){
109                inviomailform(linguaform, urlform, maildestinatario, 0, idform);
110            }
111            
112            return;
113	});
114        
115        function inviomailform(linguaform, urlform, maildestinatario, idrichiesta, idform){
116            var dataform = new FormData();
117            
118            $("form[name='formdirichiesta'] input:text[type!='hidden'], form[name='formdirichiesta'] input[type='email'], form[name='formdirichiesta'] input:radio:checked, form[n
118ame='formdirichiesta'] input:checkbox:checked, form[name='formdirichiesta'] select, form[name='formdirichiesta'] textarea").each(function(){
119                var nomecampo = $(this).attr("data-nomecampo");
120                var valoritrovati = [];
121				
122                if(nomecampo){
123                    var tipocampo = $(this).attr("data-tipocampo");
124                    if(tipocampo == 2){
125                        var valore = $(this).find('option').filter(':selected').text();
126                    }
127                    else {
128                        var valore = $(this).val();
129                    }
130
131                    if(!valore || valore == null){valore = ''; }
132
133                    if(tipocampo && valore){
134                        valoritrovati.push(JSON.stringify({nome:nomecampo,testo:valore,tipo:tipocampo}));
135                        dataform.append('campiinput[]', valoritrovati);
136                    }
137                }
138            });
139            
140            if($('form[name="formdirichiesta"] input[name="uploadedfile"]').length){
141                var file_allegato = $('form[name="formdirichiesta"] input[name="uploadedfile"]')[0].files[0];
142                if(file_allegato){
143                    dataform.append('fileallegato', file_allegato);
144                }
145            }
146
147            dataform.append('postajax', 'inviarichiestaform');
148            dataform.append('lingua', linguaform);
149            dataform.append('url', urlform);
150            dataform.append('maildest', maildestinatario);
151            dataform.append('idrichiesta', idrichiesta);
152            dataform.append('idform', idform);
153
154            $.ajax({
155                type: 'POST',
156                url: urlform+"/form/actionform.php",
157                data: dataform,
158                cache: false,
159                contentType: false,
160                processData:false,
161                beforeSend: function(){
162                    $("#areaspinnerform").show();
163                },
164                success: function(data, stato){
165                    /*console.log(data); return;*/
166                    $("#testopopup").html(data);
167                    $('#myModal').modal({show: 'false'});
168                },
169                error: function(richiesta, stato, errore){
170                    console.log(richiesta+" - "+stato+" - "+errore);
171					return;
172                },
173                complete: function(){
174                   $("#areaspinnerform").hide(); 
175                }
176            });
177            
178            return;
179        }
180        
181        $("form .inviaformrichiestapopup").click(function(){
182            var idnameform = $(this).attr('id');
183
184            var controllacheck = $("form[name='"+idnameform+"'] .checkprivacypopup").is(":checked");
185            if(!controllacheck){
186                $("form[name='"+idnameform+"'] .checkprivacypopup").focus();
187                $("#testopopup").html("Accetta acconsenso alla privacy.");
188                $('#myModal').modal({show: 'false'});
189                return;
190            }
191
192            var maildestinatario = $("form[name='"+idnameform+"'] input[name='maildestinatario']").val();
193            var linguaform = $("form[name='"+idnameform+"'] input[name='linguaform']").val();
194            var urlform = $("form[name='"+idnameform+"'] input[name='urlform']").val();
195            var idform =  $("form[name='"+idnameform+"'] input[name='idform']").val();
196 
197            /*console.log(maildestinatario+" "+linguaform+" "+urlform); return;*/
198
199            var campitrovati = [];
200            $("form[name='"+idnameform+"'] input:text[data-dbcampo='1'], form[name='"+idnameform+"'] input[type='email'][data-dbcampo='1'], form[name='"+idnameform+"'] input:radio[data-dbcampo='1']:checked, form[n
200ame='"+idnameform+"'] input:checkbox[data-dbcampo='1']:checked, form[name='"+idnameform+"'] select[data-dbcampo='1'], form[name='"+idnameform+"'] textarea[data-dbcampo='1']").each(function(){
201                var campo = $(this).attr("data-idcampo");
202                var tipocampo = $(this).attr("data-tipocampo");
203                var valore = $(this).val();
204                if(!valore){valore = ""; }
205
206                if(campo){
207                    campitrovati.push({idcampo:campo,testo:valore,tipo:tipocampo});
208                }
209            });
210
211            if(campitrovati.length > 0){
212                $.ajax({
213                    type: 'POST',
214                    url: urlform+"/form/actionform.php",
215                    data: {
216                        postajax: "salvacampiform",
217                        lingua: linguaform,
218                        url: urlform,
219                        idform: idform,
220                        campidb: campitrovati
221                    },
222                    datatype: "text",
223                    async: true,
224                    beforeSend: function(){
225                        $("#areaspinnerform").show();
226                        $("#inviaformrichiesta").css("display", "none");
227                    },
228                    success: function(data, stato){
229                        /*console.log(data);*/
230                        var risultato = JSON.parse(data);
231                        if(risultato['esito'] === "success"){
232                            if(risultato['database'] === true){
233                                var idrichiesta = risultato['idrichiesta'];
234                                var idformreturn = risultato['idform'];
235                                inviomailformpopup(linguaform, urlform, maildestinatario, idrichiesta, idformreturn);
236                            }
237                        }
238                        else{
239                            /*console.log("errrore: "+risultato['esito']);*/
240                            if(linguaform === "it"){
241                                var messerror = "Errore invio mail.<br>Si prega di riprovare.<br>Se l'errore persiste contattare la struttura.";
242                            } else {
243                                var messerror = "Error sending mail.<br>Please try again.<br>If the error persists contact the structure.";
244                            }
245                            $("#areaspinnerform").hide();
246                            $("#testopopup").html(messerror);
247                            $('#myModal').modal({show: 'false'});
248                        }
249                    },
250                    error: function(richiesta, stato, errore){
251                        console.log(errore);
252                    },
253                    complete: function(){}
254                });
255            }
256            else if(campitrovati.length === 0){
257                inviomailformpopup(linguaform, urlform, maildestinatario, 0, idform);
258            }
259
260            return;
261	});
262	
263	function inviomailformpopup(idnameform, linguaform, urlform, maildestinatario, idrichiesta, idform){
264            var valoritrovati = [];
265            $("form[name='"+idnameform+"'] input:text[type!='hidden'], form[name='"+idnameform+"'] input[type='email'], form[name='"+idnameform+"'] input:radio:checked, form[n
265ame='"+idnameform+"'] input:checkbox:checked, form[name='"+idnameform+"'] select, form[name='"+idnameform+"'] textarea").each(function(){
266                var nomecampo = $(this).attr("data-nomecampo");
267                if(nomecampo){
268                    var tipocampo = $(this).attr("data-tipocampo");
269                    var valore = $(this).val();
270                    valoritrovati.push(JSON.stringify({nome:nomecampo,testo:valore,tipo:tipocampo}));
271                }
272            });
273
274            $.ajax({
275                type: 'POST',
276                url: urlform+"/form/actionform.php",
277                data: {
278                    postajax: "inviarichiestaform",
279                    lingua: linguaform,
280                    url: urlform,
281                    maildest: maildestinatario,
282                    campiinput: valoritrovati,
283                    idrichiesta: idrichiesta,
284                    idform: idform
285                },
286                datatype: "text",
287                async: true,
288                beforeSend: function(){
289                    $("#areaspinnerform").show();
290                },
291                success: function(data, stato){
292                    /*console.log(data); return;*/
293                    $("#testopopup").html(data);
294                    $("#invia").css("display", "none");
295                    $('#myModal').modal({show: 'false'});
296                },
297                error: function(richiesta, stato, errore){
298                    $("#testopopup").html(data);
299                    $("#invia").css("display", "none");
300                    $('#myModal').modal({show: 'false'});
301                },
302                complete: function(){
303                    $("#areaspinnerform").hide(); 
304                }
305            });
306
307            return;
308	}
309        
310	/*datepicker*/
311	$("#datepickerco").datepicker({
312            showButtonPanel: false,	//mostra i bottoni chiudi e oggi
313            changeMonth: true,	//mostra il cambio del mese
314            changeYear: true,	//mostra il cambio dell'anno
315            showAnim: "fadeIn",	//effetto apertura del calendario
316            dateFormat: 'dd/mm/yy'
317	});
318        
319        $("#datepickerci").val(convertiData(new Date(), "DD/MM/YYYY"));
320        $("#datepickerci").datepicker({
321            showButtonPanel: false,	//mostra i bottoni chiudi e oggi
322            changeMonth: true,	//mostra il cambio del mese
323            changeYear: true,	//mostra il cambio dell'anno
324            showAnim: "fadeIn",	//effetto apertura del calendario
325            dateFormat: 'dd/mm/yy',
326            minDate: new Date(anno(), 1 - 1, 1),	//imposta la data minima che si vuole visualizzare nel calendario
327            maxDate: new Date(anno()+1, 12, 1),	//imposta la data massima che si vuole visualizzare nel calendario
328            firstDay: 1,//il primo giorno della settimana, 0 per domenica, 1 per Lunedì;
329            dayNamesMin: ["Do", "Lu", "Ma", "Me", "Gi", "Ve", "Sa"],
330            monthNamesShort: ['Gen','Feb','Mar','Apr','Mag','Giu','Lug','Ago','Set','Ott','Nov','Dic'],
331            monthNames: ['Gennaio','Febbraio','Marzo','Aprile','Maggio','Giugno','Luglio','Agosto','Settembre','Ottobre','N
331ovembre','Dicembre'],
332            closeText: 'Chiudi',
333            currentText: 'Oggi'
334        });
335        
336        $("#datepickerci").click(function(){$("#datepickerci").datepicker("show");});
337        $('.ui-datepicker').addClass('notranslate');
338});
339
340function convertiData(data, formato) {
341    formato = formato.replace("DD", (data.getDate() < 10 ? '0' : '') + data.getDate());
342    formato = formato.replace("MM", (data.getMonth() < 9 ? '0' : '') + (data.getMonth() + 1));
343    formato = formato.replace("YYYY", data.getFullYear());
344    return formato;
345}
346
347function anno(){
348    var anno = new Date();
349    return anno.getFullYear();
350}

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.