vendor: 9,370 bytes, lines 1-253
1/* 2 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/ 3 * 4 * Uses the built in easing capabilities added In jQuery 1.1 5 * to offer multiple easing options 6 * 7 * TERMS OF USE - EASING EQUATIONS 8 * 9 * Open source under the BSD License. 10 * 11 * Copyright é 2001 Robert Penner 12 * All rights reserved. 13 * 14 * TERMS OF USE - jQuery Easing 15 * 16 * Open source under the BSD License. 17 * 18 * Copyright é 2008 George McGinley Smith 19 * All rights reserved. 20 * 21 * Redistribution and use in source and binary forms, with or without modification, 22 * are permitted provided that the following conditions are met: 23 * 24 * Redistributions of source code must retain the above copyright notice, this list of 25 * conditions and the following disclaimer. 26 * Redistributions in binary form must reproduce the above copyright notice, this list 27 * of conditions and the following disclaimer in the documentation and/or other materials 28 * provided with the distribution. 29 * 30 * Neither the name of the author nor the names of contributors may be used to endorse 31 * or promote products derived from this software without specific prior written permission. 32 * 33 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 34 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 35 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 36 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 37 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 38 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 39 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 40 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 41 * OF THE POSSIBILITY OF SUCH DAMAGE. 42 * 43*/ 44jQuery.easing.jswing = jQuery.easing.swing; 45jQuery.extend(jQuery.easing, { 46 def: "easeOutQuad", swing: function (e, f, a, h, g) { 47 return jQuery.easing[jQuery.easing.def](e, f, a, h, g) 48 }, easeInQuad: function (e, f, a, h, g) { 49 return h * (f /= g) * f + a 50 }, easeOutQuad: function (e, f, a, h, g) { 51 return -h * (f /= g) * (f - 2) + a 52 }, easeInOutQuad: function (e, f, a, h, g) { 53 if ((f /= g / 2) < 1) { 54 return h / 2 * f * f + a 55 } 56 return -h / 2 * ((--f) * (f - 2) - 1) + a 57 }, easeInCubic: function (e, f, a, h, g) { 58 return h * (f /= g) * f * f + a 59 }, easeOutCubic: function (e, f, a, h, g) { 60 return h * ((f = f / g - 1) * f * f + 1) + a 61 }, easeInOutCubic: function (e, f, a, h, g) { 62 if ((f /= g / 2) < 1) { 63 return h / 2 * f * f * f + a 64 } 65 return h / 2 * ((f -= 2) * f * f + 2) + a 66 }, easeInQuart: function (e, f, a, h, g) { 67 return h * (f /= g) * f * f * f + a 68 }, easeOutQuart: function (e, f, a, h, g) { 69 return -h * ((f = f / g - 1) * f * f * f - 1) + a 70 }, easeInOutQuart: function (e, f, a, h, g) { 71 if ((f /= g / 2) < 1) { 72 return h / 2 * f * f * f * f + a 73 } 74 return -h / 2 * ((f -= 2) * f * f * f - 2) + a 75 }, easeInQuint: function (e, f, a, h, g) { 76 return h * (f /= g) * f * f * f * f + a 77 }, easeOutQuint: function (e, f, a, h, g) { 78 return h * ((f = f / g - 1) * f * f * f * f + 1) + a 79 }, easeInOutQuint: function (e, f, a, h, g) { 80 if ((f /= g / 2) < 1) { 81 return h / 2 * f * f * f * f * f + a 82 } 83 return h / 2 * ((f -= 2) * f * f * f * f + 2) + a 84 }, easeInSine: function (e, f, a, h, g) { 85 return -h * Math.cos(f / g * (Math.PI / 2)) + h + a 86 }, easeOutSine: function (e, f, a, h, g) { 87 return h * Math.sin(f / g * (Math.PI / 2)) + a 88 }, easeInOutSine: function (e, f, a, h, g) { 89 return -h / 2 * (Math.cos(Math.PI * f / g) - 1) + a 90 }, easeInExpo: function (e, f, a, h, g) { 91 return (f == 0) ? a : h * Math.pow(2, 10 * (f / g - 1)) + a 92 }, easeOutExpo: function (e, f, a, h, g) { 93 return (f == g) ? a + h : h * (-Math.pow(2, -10 * f / g) + 1) + a 94 }, easeInOutExpo: function (e, f, a, h, g) { 95 if (f == 0) { 96 return a 97 } 98 if (f == g) { 99 return a + h 100 } 101 if ((f /= g / 2) < 1) { 102 return h / 2 * Math.pow(2, 10 * (f - 1)) + a 103 } 104 return h / 2 * (-Math.pow(2, -10 * --f) + 2) + a 105 }, easeInCirc: function (e, f, a, h, g) { 106 return -h * (Math.sqrt(1 - (f /= g) * f) - 1) + a 107 }, easeOutCirc: function (e, f, a, h, g) { 108 return h * Math.sqrt(1 - (f = f / g - 1) * f) + a 109 }, easeInOutCirc: function (e, f, a, h, g) { 110 if ((f /= g / 2) < 1) { 111 return -h / 2 * (Math.sqrt(1 - f * f) - 1) + a 112 } 113 return h / 2 * (Math.sqrt(1 - (f -= 2) * f) + 1) + a 114 }, easeInElastic: function (f, h, e, l, k) { 115 var i = 1.70158; 116 var j = 0; 117 var g = l; 118 if (h == 0) { 119 return e 120 } 121 if ((h /= k) == 1) { 122 return e + l 123 } 124 if (!j) { 125 j = k * 0.3 126 } 127 if (g < Math.abs(l)) { 128 g = l; 129 var i = j / 4 130 } else { 131 var i = j / (2 * Math.PI) * Math.asin(l / g) 132 } 133 return -(g * Math.pow(2, 10 * (h -= 1)) * Math.sin((h * k - i) * (2 * Math.PI) / j)) + e 134 }, easeOutElastic: function (f, h, e, l, k) { 135 var i = 1.70158; 136 var j = 0; 137 var g = l; 138 if (h == 0) { 139 return e 140 } 141 if ((h /= k) == 1) { 142 return e + l 143 } 144 if (!j) { 145 j = k * 0.3 146 } 147 if (g < Math.abs(l)) { 148 g = l; 149 var i = j / 4 150 } else { 151 var i = j / (2 * Math.PI) * Math.asin(l / g) 152 } 153 return g * Math.pow(2, -10 * h) * Math.sin((h * k - i) * (2 * Math.PI) / j) + l + e 154 }, easeInOutElastic: function (f, h, e, l, k) { 155 var i = 1.70158; 156 var j = 0; 157 var g = l; 158 if (h == 0) { 159 return e 160 } 161 if ((h /= k / 2) == 2) { 162 return e + l 163 } 164 if (!j) { 165 j = k * (0.3 * 1.5) 166 } 167 if (g < Math.abs(l)) { 168 g = l; 169 var i = j / 4 170 } else { 171 var i = j / (2 * Math.PI) * Math.asin(l / g) 172 } 173 if (h < 1) { 174 return -0.5 * (g * Math.pow(2, 10 * (h -= 1)) * Math.sin((h * k - i) * (2 * Math.PI) / j)) + e 175 } 176 return g * Math.pow(2, -10 * (h -= 1)) * Math.sin((h * k - i) * (2 * Math.PI) / j) * 0.5 + l + e 177 }, easeInBack: function (e, f, a, i, h, g) { 178 if (g == undefined) { 179 g = 1.70158 180 } 181 return i * (f /= h) * f * ((g + 1) * f - g) + a 182 }, easeOutBack: function (e, f, a, i, h, g) { 183 if (g == undefined) { 184 g = 1.70158 185 } 186 return i * ((f = f / h - 1) * f * ((g + 1) * f + g) + 1) + a 187 }, easeInOutBack: function (e, f, a, i, h, g) { 188 if (g == undefined) { 189 g = 1.70158 190 } 191 if ((f /= h / 2) < 1) { 192 return i / 2 * (f * f * (((g *= (1.525)) + 1) * f - g)) + a 193 } 194 return i / 2 * ((f -= 2) * f * (((g *= (1.525)) + 1) * f + g) + 2) + a 195 }, easeInBounce: function (e, f, a, h, g) { 196 return h - jQuery.easing.easeOutBounce(e, g - f, 0, h, g) + a 197 }, easeOutBounce: function (e, f, a, h, g) { 198 if ((f /= g) < (1 / 2.75)) { 199 return h * (7.5625 * f * f) + a 200 } else { 201 if (f < (2 / 2.75)) { 202 return h * (7.5625 * (f -= (1.5 / 2.75)) * f + 0.75) + a 203 } else { 204 if (f < (2.5 / 2.75)) { 205 return h * (7.5625 * (f -= (2.25 / 2.75)) * f + 0.9375) + a 206 } else { 207 return h * (7.5625 * (f -= (2.625 / 2.75)) * f + 0.984375) + a 208 } 209 } 210 } 211 }, easeInOutBounce: function (e, f, a, h, g) { 212 if (f < g / 2) { 213 return jQuery.easing.easeInBounce(e, f * 2, 0, h, g) * 0.5 + a 214 } 215 return jQuery.easing.easeOutBounce(e, f * 2 - g, 0, h, g) * 0.5 + h * 0.5 + a 216 } 217}); 218(function ($) { 219 220 'use strict'; 221 222 /** 223 * All of the code for your public-facing JavaScript source 224 * should reside in this file. 225 * 226 * Note: It has been assumed you will write jQuery code here, so the 227 * $ function reference has been prepared for usage within the scope 228 * of this function. 229 * 230 * This enables you to define handlers, for when the DOM is ready: 231 * 232 * $(function() { 233 * 234 * }); 235 * 236 * When the window is loaded: 237 * 238 * $( window ).load(function() { 239 * 240 * }); 241 * 242 * ...and/or other possibilities. 243 * 244 * Ideally, it is not considered best practise to attach more than a 245 * single DOM-ready or window-load handler for a particular page. 246 * Although scripts in the WordPress core, Plugins and Themes may be 247 * practising this, we should strive to set a better example in our own work. 248 */ 249 250 function IsEmail(email) { 251 var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; 252 if (!regex.test(email)) { 253 return false;
254 } else { 255 return true; 256 } 257 } 258 259 260 function checkNext($this) { 261 262 var name = $this.parentsUntil("form").find("input[name=first_name]"); 263 var surname = $this.parentsUntil("form").find("input[name=last_name]"); 264 var telefono = $this.parentsUntil("form").find("input[name=phone]"); 265 var tel = $this.parentsUntil("form").find("input[name=telefono]"); 266 var email = $this.parentsUntil("form").find("input[name=email]"); 267 var position = $this.parentsUntil("form").find("#posizione").children("option:selected").val(); 268 var interesse = $this.parentsUntil("form").find("#interesse").children("option:selected").val(); 269 var sede = $this.parentsUntil("form").find("#sede").children("option:selected").val(); 270 271 272 var error = false; 273 274 if (name.val().length === 0) { 275 name.addClass("error"); 276 error = true; 277 } 278 279 if (surname.val().length === 0) { 280 surname.addClass("error"); 281 error = true; 282 } 283 284 if (telefono.val().length === 0) { 285 telefono.addClass("error"); 286 error = true; 287 } 288 289 /*if (tel.val().length === 0 ) { 290 tel.addClass("error"); 291 error = true; 292 }*/ 293 294 if (email.val().length === 0) { 295 email.addClass("error"); 296 error = true; 297 } else { 298 if (IsEmail(email.val()) == false) { 299 email.addClass("error"); 300 error = true; 301 } 302 } 303 304 305 if (position == 0) { 306 $this.parentsUntil("form").find("select#posizione").parent(".select").addClass("error"); 307 error = true; 308 } 309 310 if (interesse == 0) { 311 $this.parentsUntil("form").find("select#interesse").parent(".select").addClass("error"); 312 error = true; 313 } 314 315 if (sede == 0) { 316 $this.parentsUntil("form").find("select#sede").parent(".select").addClass("error"); 317 error = true; 318 } 319 320 //return false; 321 return error; 322 }; 323 324 function checkSubmit($this) { 325 326 327 var comune = $this.parentsUntil("form").find("input[name=city]"); 328 var anni = $this.parentsUntil("form").find("select#anni").children("option:selected").val(); 329 330 331 var message = $this.parentsUntil("form").find("textarea#message").val(); 332 333 var privacyChecked = $this.parentsUntil("form").find("input[name=00NSX000000QqXd]").prop("checked"); 334 var trattamentoDatiChecked = $this.parentsUntil("form").find("input[name=00NSX000000QqRC]").prop("checked"); 335 336 var start = $this.parentsUntil("form").find("select.starts").children("option:selected").val(); 337 338 var error = false; 339 340 if (!privacyChecked) { 341 $this.parentsUntil("form").find("#privacy").parent("div").addClass("error"); 342 console.log('privacy obbligatoria') 343 error = true; 344 } 345 346 347 var $provincia = $("select.provincia"); 348 if ($provincia.length > 0) { 349 var provincia = $this.parentsUntil("form").find("select.provincia").children("option:selected").val(); 350 if (!provincia) { 351 $this.parentsUntil("form").find("#provincia").parent(".select").addClass("error"); 352 console.log('provincia') 353 error = true; 354 } 355 } else { 356 var state = $this.parentsUntil("form").find("input.state").val(); 357 358 if (!state) { 359 $this.parentsUntil("form").find("input.state").addClass("error"); 360 error = true; 361 } 362 } 363 364 if (comune.val().length === 0) { 365 comune.addClass("error"); 366 error = true; 367 } 368 369 /* if (message.replace(/^\s+|\s+$/g, "").length == 0 || message=="") { 370 $this.parentsUntil("form").find("textarea#message").addClass("error"); 371 error = true; 372 }*/ 373 374 if (!start) { 375 $this.parentsUntil("form").find(".starts").parent(".select").addClass("error"); 376 error = true; 377 } 378 379 if (anni && anni < 18) { 380 var nome_g = $this.parentsUntil("form").find("input[name=00N1r00000KQroB]"); 381 var cognome_g = $this.parentsUntil("form").find("input[name=00N1r00000KQroG]"); 382 var telefono_g = $this.parentsUntil("form").find("input[name=00N1r00000KQroL
382]"); 383 384 if (nome_g.val().length === 0) { 385 nome_g.addClass("error"); 386 error = true; 387 } 388 389 if (cognome_g.val().length === 0) { 390 cognome_g.addClass("error"); 391 error = true; 392 } 393 394 if (telefono_g.val().length === 0) { 395 telefono_g.addClass("error"); 396 error = true; 397 } 398 } 399 400 return error; 401 }; 402 403 function checkSubmitComplete($this) { 404 405 406 var name = $this.closest("form").find("input[name=first_name]"); 407 var surname = $this.closest("form").find("input[name=last_name]"); 408 var telefono = $this.closest("form").find("input[name=phone]"); 409 var email = $this.closest("form").find("input[name=email]"); 410 var position = $this.closest("form").find("#posizione").children("option:selected").val(); 411 var interesse = $this.closest("form").find("#interesse").children("option:selected").val(); 412 var sede = $this.closest("form").find("#sede").children("option:selected").val(); 413 414 var comune = $this.closest("form").find("input[name=city]"); 415 var anni = $this.closest("form").find("select#anni").children("option:selected").val(); 416 var regione = $this.closest("form").find("select#regione").children("option:selected").val(); 417 var provincia = $this.closest("form").find("select#provincia").children("option:selected").val(); 418 var message = $this.closest("form").find("textarea#message").val(); 419 420 var error = false; 421 422 if (name.val().length === 0) { 423 name.addClass("error"); 424 error = true; 425 } 426 427 if (surname.val().length === 0) { 428 surname.addClass("error"); 429 error = true; 430 } 431 432 if (telefono.val().length === 0) { 433 telefono.addClass("error"); 434 error = true; 435 } 436 437 if (email.val().length === 0) { 438 email.addClass("error"); 439 error = true; 440 } 441 /* 442 else { 443 if (IsEmail(email.val())==false) { 444 email.addClass("error"); 445 error = true; 446 } 447 } 448 */ 449 450 if (position == 0) { 451 $this.parentsUntil("form").find("select#posizione").parent(".select").addClass("error"); 452 error = true; 453 } 454 455 if (interesse == 0) { 456 $this.parentsUntil("form").find("select#interesse").parent(".select").addClass("error"); 457 error = true; 458 } 459 460 if (sede == 0) { 461 $this.parentsUntil("form").find("select#sede").parent(".select").addClass("error"); 462 error = true; 463 } 464 465 if (!regione) { 466 $this.parentsUntil("form").find("#regione").parent(".select").addClass("error"); 467 //error = true; 468 } 469 470 if (!provincia) { 471 $this.parentsUntil("form").find("#provincia").parent(".select").addClass("error"); 472 //error = true; 473 } 474 475 if (comune.val().length === 0) { 476 comune.addClass("error"); 477 //error = true; 478 } 479 480 if (!anni) { 481 $this.parentsUntil("form").find("#anni").parent(".select").addClass("error"); 482 error = true; 483 } 484 485 /* 486 if (message.replace(/^\s+|\s+$/g, "").length == 0 || message=="") { 487 $this.parentsUntil("form").find("textarea#message").addClass("error"); 488 error = true; 489 } 490 */ 491 492 493 if (anni && anni < 18) { 494 var nome_g = $this.parentsUntil("form").find("input[name=00N1r00000KQroB]"); 495 var cognome_g = $this.parentsUntil("form").find("input[name=00N1r00000KQroG]"); 496 var telefono_g = $this.parentsUntil("form").find("input[name=00N1r00000KQroL]"); 497 498 if (nome_g.val().length === 0) { 499 nome_g.addClass("error"); 500 error = true; 501 } 502 503 if (cognome_g.val().length === 0) { 504 cognome_g.addClass("error"); 505 error = true; 506 } 507 508 if (telefono_g.val().length === 0) { 509 telefono_g.addClass("error"); 510 error = true; 511 } 512 } 513 514 if (error == true) { 515 console.log( 516 "errore" 517 ) 518 } 519 520 return error; 521 }; 522 523 $(window).load(function () { 524 var current_fs, next_fs, previous_fs; //fieldsets 525 var left, opacity, scale; //fieldset properties which we will animate 526 var animating; //flag to prevent quick multi-click glitches 527 528 $(".next").click(function () { 529 var check = checkNext($(this)); 530 531 if (check == true) { 532 console.log("errore, dei campi sono obbligatori") 533 return false;
534 } 535 536 var form = $(this).closest("form"); 537 jQuery.ajax({ 538 url: accademia_ajax.ajax_url, 539 dataType: "html", 540 type: "POST", 541 data: form.serialize() + "&action=save_step", 542 success: function (data) { 543 form.find(".theid").attr("value", data); 544 } 545 }); 546 547 var residenzaValue = $("#residenza").children("option:selected").attr('data-residenza'); 548 549 if (residenzaValue == 2) { 550 $('div.select-regione').addClass('hidden'); 551 $('div.provincia').removeClass("select") 552 $('div.provincia').html('<input type="text" name="state" class="state" placeholder="Stato" />') 553 } 554 555 if (animating) return false; 556 animating = true; 557 558 current_fs = $(this).parent(); 559 next_fs = $(this).parent().next(); 560 561 //show the next fieldset 562 next_fs.show(); 563 //hide the current fieldset with style 564 current_fs.animate({opacity: 0}, { 565 step: function (now, mx) { 566 //as the opacity of current_fs reduces to 0 - stored in "now" 567 //1. scale current_fs down to 80% 568 scale = 1 - (1 - now) * 0.2; 569 //2. bring next_fs from the right(50%) 570 left = (now * 50) + "%"; 571 //3. increase opacity of next_fs to 1 as it moves in 572 opacity = 1 - now; 573 current_fs.css({ 574 'transform': 'scale(' + scale + ')', 575 'position': 'absolute' 576 }); 577 next_fs.css({'left': left, 'opacity': opacity}); 578 }, 579 duration: 800, 580 complete: function () { 581 current_fs.hide(); 582 animating = false; 583 }, 584 //this comes from the custom easing plugin 585 easing: 'easeInOutBack' 586 }); 587 }); 588 589 $(".previous").click(function () { 590 if (animating) return false; 591 animating = true; 592 593 current_fs = $(this).parent(); 594 previous_fs = $(this).parent().prev(); 595 596 //show the previous fieldset 597 previous_fs.show(); 598 //hide the current fieldset with style 599 current_fs.animate({opacity: 0}, { 600 step: function (now, mx) { 601 //as the opacity of current_fs reduces to 0 - stored in "now" 602 //1. scale previous_fs from 80% to 100% 603 scale = 0.8 + (1 - now) * 0.2; 604 //2. take current_fs to the right(50%) - from 0% 605 left = ((1 - now) * 50) + "%"; 606 //3. increase opacity of previous_fs to 1 as it moves in 607 opacity = 1 - now; 608 current_fs.css({'left': left}); 609 previous_fs.css({'transform': 'scale(' + scale + ')', 'opacity': opacity}); 610 }, 611 duration: 800, 612 complete: function () { 613 current_fs.hide(); 614 animating = false; 615 }, 616 //this comes from the custom easing plugin 617 easing: 'easeInOutBack' 618 }); 619 }); 620 621 $(document).on("click", ".submit-nostep", function (e) { 622 e.preventDefault(); 623 624 var check = checkSubmitComplete($(this)); 625 if (check == true) { 626 627 console.log("errore, dei campi sono obbligatori") 628 return false; 629 } 630 631 var form = $(this).closest("form"); 632 jQuery.ajax({ 633 url: accademia_ajax.ajax_url, 634 dataType: "html", 635 type: "POST", 636 data: form.serialize() + "&action=save_step", 637 success: function (data) { 638 } 639 }); 640 641 $(".spinning").css({"display": "block"}); 642 643 }); 644 645 $(document).on("click", ".send_request", function (e) { 646 647 // ICON 648 e.preventDefault(); 649 // disable submit button 650 $(".send_request").attr('disabled', true); 651 // ICON 652 653 var $this = $(this); 654 var name = $this.parentsUntil("form").find("input[name=first_name]"); 655 var surname = $this.parentsUntil("form").find("input[name=last_name]"); 656 var telefono = $this.parentsUntil("form").find("input[name=phone]"); 657 658 var email = $this.parentsUntil("form").find("input[name=email]"); 659 var sede = $this.closest("form").find("#sede").children("option:selected").val(); 660 var interesse = $this.parentsUntil("form").find("#interesse").children("option:selected").val(); 661 var privacyChecked = $this.parentsUntil("form").find("input[name=00NSX000000QqXd]").prop("checked"); 662 663 var error = false;
664 665 if (name.val().length === 0) { 666 console.log('nome obbligatoria'); 667 name.addClass("error"); 668 error = true; 669 } 670 671 if (surname.val().length === 0) { 672 console.log('cognome obbligatoria'); 673 surname.addClass("error"); 674 error = true; 675 } 676 677 if (telefono.val().length === 0) { 678 console.log('telefono obbligatoria'); 679 telefono.addClass("error"); 680 error = true; 681 } 682 683 if (email.val().length === 0) { 684 console.log('email obbligatoria'); 685 email.addClass("error"); 686 error = true; 687 } else { 688 if (IsEmail(email.val()) == false) { 689 email.addClass("error"); 690 error = true; 691 } 692 } 693 694 if (interesse == 0) { 695 console.log('interesse obbligatoria'); 696 $this.parentsUntil("form").find("select#interesse").parent(".select").addClass("error"); 697 error = true; 698 } 699 700 if (sede == 0) { 701 console.log('sede obbligatoria'); 702 $this.parentsUntil("form").find("select#sede").parent(".select").addClass("error"); 703 error = true; 704 } 705 706 if (!privacyChecked) { 707 $this.parentsUntil("form").find("#privacy").parent("div").addClass("error"); 708 console.log('privacy obbligatoria'); 709 error = true; 710 } 711 712 if (error == true) { 713 console.log("Errori nella form"); 714 $(".send_request").attr('disabled', false); 715 return false; 716 } 717 718 var form = $this.closest("form"); 719 jQuery.ajax({ 720 url: accademia_ajax.ajax_url, 721 dataType: "html", 722 type: "POST", 723 data: form.serialize() + "&action=save_submit", 724 success: function (data) { 725 726 var response = JSON.parse(data); 727 728 console.log("p2sq"); 729 window.p2sq = window.p2sq || []; 730 731 p2sq.push({et:'Init',p:{ 732 em: sha256(email.val().toLowerCase()), 733 fn: sha256(name.val().toLowerCase()), 734 ln: sha256(surname.val().toLowerCase()) 735 }}); 736 737 p2sq.push({ et: 'Lead', p:{} }); 738 739 740 if( typeof cmplz_has_consent === "function" && cmplz_has_consent("statistics") ) { 741 742 if (typeof window.dataLayer !== 'undefined') { 743 console.log("dataLayer"); 744 window.dataLayer.push({event: 'generate_lead', value: 0, currency:'EUR' }); 745 } 746 } 747 748 749 if(response.retUrl != "") { 750 setTimeout(function() { 751 window.location.href = response.retUrl; 752 }, 500); 753 } else { 754 $(".send_request").attr('disabled', false); 755 } 756 757 } 758 }); 759 760 761 }) 762 763 $(document).on("click", ".submit", function (e) { 764 e.preventDefault(); 765 766 var check = checkSubmit($(this)); 767 if (check == true) { 768 e.preventDefault(); 769 console.log("errore, alcuni campi sono obbligatori") 770 return false; 771 } 772 773 var form = $(this).closest("form"); 774 jQuery.ajax({ 775 url: accademia_ajax.ajax_url, 776 dataType: "html", 777 type: "POST", 778 data: form.serialize() + "&action=save_step", 779 success: function (data) { 780 781 } 782 }); 783 784 $(".spinning").css({"display": "block"}); 785 786 }); 787 788 789 // disable mousewheel on a input number field when in focus 790 // (to prevent Cromium browsers change the value when scrolling) 791 $('form').on('focus', 'input[type=number]', function (e) { 792 $(this).on('wheel.disableScroll', function (e) { 793 e.preventDefault() 794 }) 795 }) 796 $('form').on('blur', 'input[type=number]', function (e) { 797 $(this).off('wheel.disableScroll') 798 }) 799 800 $(document).on("change", "select", function () { 801 if ($(this).parent(".select").hasClass("error")) { 802 $(this).parent(".select").removeClass("error") 803 } 804 }); 805 806 $(document).on("focusout", "input", function () { 807 if ($(this).hasClass("error") && $(this).val().length > 0) { 808 $(this).removeClass("error") 809 } 810 }); 811 812 $(document).on("change", "#lingua", function () { 813 $(this).find('option[value=""]').remove(); 814 $('div.residenza').removeClass('hidden') 815 816 var opt = $(this).children("option:selected"); 817 var linguaSelezionata = opt.attr('data-lang'); 818 819 console.log("cambio della lingua") 820 // Selezioniamo solo le opzioni con la lingua corrispondente e le mostriamo 821 $("select#posizione").val('').trigger('change'); 822 823 // Imposta la prima opzione come selezionata nella select "interesse" 824 $("select#interesse").val(''); 825 // Svuota la select "sede" e inserisci le due nuove opzioni 826 $("select#sede").html('<option value="">Nella sede di:</option><option value="">Seleziona il corso</option>'); 827 828 }); 829 830 831 $(document).on("change", "#residenza", function () { 832 $(this).find('option[value=""]').remove(); 833 $('div.posizione').removeClass('hidden'); 834 }); 835 836 $(document).on("change", "#posizione", function () { 837 838 var select = $(this); 839 var v = select.children("option:selected").attr("data-value"); 840 var age = jQuery("select#anni").find(".selected").attr("value"); 841 842 jQuery.ajax({ 843 url: accademia_ajax.ajax_url, 844 dataType: "html", 845 type: "POST", 846 data: { 847 "action": "select_request", 848 "interesse": v, 849 "age": age 850 }, 851 success: function (data) { 852 var t = select.closest("form").find(".interesse"); 853 t.html(data); 854 var l = $("#lingua option:selected").attr('data-lang'); 855 console.log("che codice è? " + l) 856 $("select#interesse option").each(function () { 857 // Se "l" è 1, nascondi le opzioni con data-lang diverso da 1, altrimenti nascondi quelle con data-lang diverso da 2 858 if ((l == 1 && $(this).data('lang') != 1) || (l == 2 && $(this).data('lang') != 2)) { 859 $(this).remove(); 860 861 } 862 }); 863 864 865 $('.next').prop('disabled', false); 866 } 867 }); 868 }); 869 870 $(document).on("change", "#interesse", function () { 871 872 var select = $(this); 873 var v = select.children("option:selected").attr("data-value"); 874 875 jQuery.ajax({ 876 url: accademia_ajax.ajax_url, 877 dataType: "html", 878 type: "POST", 879 data: { 880 "action": "sede_request", 881 "interesse": v, 882 }, 883 success: function (data) { 884 select.closest("form").find(".sede").html(data); 885 } 886 }); 887 }); 888 889 $(document).on("change", "#regione", function () { 890 891 var select = $(this); 892 var v = select.children("option:selected").val(); 893 894 jQuery.ajax({ 895 url: accademia_ajax.ajax_url, 896 dataType: "html", 897 type: "POST", 898 data: { 899 "action": "ajax_request", 900 "regione": v, 901 }, 902 success: function (data) { 903 select.closest("form").find(".provincia").html(data); 904 905 } 906 907 }); 908 }); 909 910 $(document).on("change", "#anni", function () { 911 912 var select = $(this); 913 select.find(".selected").removeClass("selected"); 914 var opt = select.children("option:selected"); 915 opt.addClass("selected"); 916 var v = opt.val(); 917 var l = opt.attr("data-lang") 918 jQuery.ajax({ 919 url: accademia_ajax.ajax_url, 920 dataType: "html", 921 type: "POST", 922 data: { 923 "action": "age_request", 924 "age": v, 925 "l": l, 926 }, 927 success: function (data) { 928 select.closest("form").find(".age").html(data); 929 } 930 }); 931 932 }); 933 934 935 jQuery('#msform input').on('change', function () { 936 console.log('Input cambiato:', jQuery(this).val()); 937 // Esegui altre azioni qui 938 var form = $(this).closest("form"); 939 jQuery.ajax({ 940 url: accademia_ajax.ajax_url, 941 dataType: "json", 942 type: "POST", 943 data: form.serialize() + "&action=check", 944 success: function (response) { 945 946 } 947 }); 948 }); 949 950 // Monitora il cambio di valore nelle select 951 jQuery(document).on('change', '#msform select', function () { 952 console.log('Select cambiatas:', jQuery(this).val()); 953 // Esegui altre azioni qui 954 var form = $(this).closest("form"); 955 jQuery.ajax({ 956 url: accademia_ajax.ajax_url, 957 dataType: "json", 958 type: "POST", 959 data: form.serialize() + "&action=check", 960 success: function (response) { 961 962 } 963 }); 964 }); 965 966 967 function dump(obj) { 968 var out = ''; 969 for (var i in obj) { 970 out += i + ": " + obj[i] + "\n"; 971 } 972 973 alert(out); 974 975 // or, if you wanted to avoid alerts... 976 977 var pre = document.createElement('pre'); 978 pre.innerHTML = out; 979 document.body.appendChild(pre) 980 } 981 982 }); 983 984})(jQuery); 985 986 987function capitalizeFirstLetter(input) { 988 let value = input.value; 989 // Trasforma la prima lettera in maiuscola e le altre in minuscolo 990 input.value = value.charAt(0).toUpperCase() + value.slice(1).toLowerCase(); 991}
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.