1var light = ''; 2 3$(document).ajaxStop(function() { 4 $(light).unblock(); 5}); 6 7 8if(typeof WOW !== 'undefined'){ 9 var wow = new WOW(); 10 wow.init(); 11} 12 13$(document).ready(function(){ 14 /* PRE TOP */ 15 "use strict"; 16 17 scrollActions(); 18 counter_progress(); 19 20 seo(); 21 22 $(window).on('scroll resize', function() { 23 scrollActions(); 24 }); 25 26 $(window).on('resize', function() { 27 seo(); 28 }); 29 30 $(window).on('scroll', function() { 31 counter_progress(); 32 }); 33 34 /* TOP */ 35 if ($('.menu-fixed-right').length > 0) { 36 var winHeight = $(window).height(); 37 /*var heightPretop = $('.pre-top').height();*/ 38 $('.menu-fixed-right, .scroll-menu').height(winHeight); 39 } 40 41 /* scroll to top */ 42 $('#scroll-top').click(function() { 43 $('html, body').animate({ 44 scrollTop: 0 45 }, 1000); 46 }); 47 48 $.fn.toggleAttr = function(attr, val) { 49 var test = $(this).attr(attr); 50 if ( test ) { 51 // if attrib exists with ANY value, still remove it 52 $(this).removeAttr(attr); 53 } else { 54 $(this).attr(attr, val); 55 } 56 return this; 57 }; 58 59 /* TOP SEARCH */ 60 $('.icon-search[searchtype=1]').on("click",function(){ 61 $('.search-simple').toggleClass('active'); 62 $('.search-simple input').toggleAttr('tabindex', "-1"); 63 $('.search-simple a').toggleAttr('tabindex', "-1"); 64 if($('.search-simple').hasClass('active')) 65 $('.search-simple input').focus(); 66 }); 67 68 /* MOBILE MENU */ 69 $("#menu-trigger").on("click",function(){ 70 $('.menu-wrapper').toggleClass("active"); 71 $(this).toggleClass('active'); 72 $('.menu').slideToggle(); 73 }); 74 75 /* FIXED MENU */ 76 $("#menu-trigger-fixed").on("click",function(){ 77 $('.menu-wrapper').toggleClass("active"); 78 $(this).toggleClass('active'); 79 }); 80 81 // funzione hide/show popup 82 togglePopup(); 83 84 // FILTER PRODUCTS 85 $('.filter-btn').on("click", function(){ 86 var targetDiv=$(this).attr('targetContainer'); 87 $('.'+targetDiv).slideToggle(150); 88 var icon=$(this).children().closest('i').attr('class')==='fa fa-angle-down'; 89 $(this).children().closest('i').attr('class',icon?'fa fa-angle-up':'fa fa-angle-down'); 90 }); 91 92 increaser(); 93 94 //videoStp(); 95 96 $('.slideshow').on('init', function(e, slick) { 97 var $firstAnimatingElements = $('div.item:first-child').find('[data-animation]'); 98 doAnimations($firstAnimatingElements); 99 }); 100 $('.slideshow').on('beforeChange', function(e, slick, currentSlide, nextSlide) { 101 var $animatingElements = $('div.item[data-slick-index="' + nextSlide + '"]').find('[data-animation]'); 102 doAnimations($animatingElements); 103 }); 104 105 function doAnimations(elements) { 106 var animationEndEvents = 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend'; 107 elements.each(function() { 108 var $this = $(this); 109 var $animationDelay = $this.data('delay'); 110 var $animationType = 'animated ' + $this.data('animation'); 111 $this.css({ 112 'animation-delay': $animationDelay, 113 '-webkit-animation-delay': $animationDelay 114 }); 115 $this.addClass($animationType).one(animationEndEvents, function() { 116 $this.removeClass($animationType); 117 }); 118 }); 119 } 120 121 122 // slideshow prodotto 123 $(".slideshow-prod:not(.slideshow-swipe)").slick({ //5008 - escludo gli slick che hanno slideshow-swipe in template11.php 124 autoplay: false, 125 arrows: false, 126 dots: false, 127 draggable: false, 128 touchMove: false, 129 vertical: false, 130 centerMode: false, 131 slidesToShow: 1, 132 slidesToScroll: 1, 133 lazyLoad: 'ondemand', 134 infinite: true, 135 fade: false, 136 cssEase: 'linear' 137 }); 138 139 //slideshow template generico e news 140 $(".slideshow-img").slick({ 141 autoplay: false, 142 arrows: false, 143 dots: false, 144 draggable: false, 145 touchMove: false, 146 vertical: false, 147 centerMode: false, 148 slidesToShow: 1, 149 slidesToScroll: 1, 150 lazyLoad: 'ondemand', 151 infinite: true, 152 fade: false, 153 cssEase: 'linear' 154 }); 155 156 157 // tabs 158 $('.tabs li a:not(:first)').addClass('inactive'); 159 $('.tab-container').hide(); 160 $('.tab-container:first').show(); 161 $('.tabs li a').click(function(){ 162 var t = $(this).attr('href'); 163 $('.tabs li a').addClass('inactive'); 164 $(this).removeClass('inactive'); 165 $('.tab-container').hide(); 166 $(t).fadeIn('slow'); 167 return false; 168 }); 169 170 if($(this).hasClass('inactive')){ 171 $('.tabs li a').addClass('inactive'); 172 $(this).removeClass('inactive'); 173 $('.tab-container').hide(); 174 $(t).fadeIn('slow'); 175 } 176 177 // jump to 178 $('.jump:not(.down)').click(function(event){ 179 event.preventDefault(); 180 $('html, body').animate({ scrollTop: $($(this).attr('href')).offset().top - 60},900); 181 }); 182 183 184 // magnific popup 185 /*$('.image-popup-no-margins').magnificPopup({ 186 type: 'image', 187 closeOnContentClick: true, 188 closeBtnInside: false, 189 fixedContentPos: true, 190 mainClass: 'mfp-no-margins mfp-with-zoom', // classe per rimuovere il margine predefinito dal lato sinistro e destro 191 image: { verticalFit: true }, 192 zoom: { 193 enabled: true, 194 duration: 300 // ricordarsi di specificare la durata anche nel css 195 } 196 });*/ 197 198 // fancybox single image 199 $('.blk-img a:not(.linkeable)').each(function() { 200 $(this).fancybox({ 201 // Options will go here 202 }); 203 }); 204 205 // SIDEBAR MENU
206 $('.sidebar-products i').click(function() { 207 var level = $(this).parent().parent().attr('class').split(' ').pop(); 208 $('.'+level+' li a').not($(this).next().parent().children().first('a')).removeClass('active'); 209 $(this).next().parent().children().first('a').toggleClass('active'); 210 $('.'+level+' li i').not($(this)).removeClass('active'); 211 $(this).toggleClass('active'); 212 $('.'+level+' ul').not($(this).next()).slideUp(300); 213 $(this).next().slideToggle(300); 214 }); 215 216}); 217 218function scrollToID(id){ 219 $('html, body').animate({ scrollTop: $('#'+id).offset().top - 200},1000); 220} 221 222function scrollActions() { 223 224 if ($('.pre-top').length > 0) { // controllo che esista il 'pre-top' 225 var heighPretop = $('.pre-top').outerHeight(true); 226 } else heighPretop = 0; 227 if ($('#top').length > 0) { // controllo che esista il 'top' 228 heighTop = heighPretop + $('#top').outerHeight(true); 229 } else heighTop = heighPretop; 230 231 232 if ($(window).scrollTop() > heighTop) { 233 $('#scroll-top').addClass('show'); 234 } else { 235 $('#scroll-top').removeClass('show'); 236 } 237} 238 239function togglePopup() { 240 // apro o chiudo il popup desiderato e chiudo gli altri 241 $('.togglePopup').on('click', function(e) { 242 e.preventDefault(); 243 // questa icona 244 var $this = $(this); 245 // ottengo la classe del popup, che è la seconda classe di questa icona 246 //fixed per 3 classi 247 var arr_class_popup = $this.attr('class').split(' '); 248 //alert(arr_class_popup.length); 249 if(arr_class_popup.length >= 2){ 250 var classPopup = $this.attr('class').split(' ').pop(); 251 if(classPopup == "active") 252 classPopup = arr_class_popup[1]; 253 } 254 else 255 var classPopup = arr_class_popup[1]; 256 // chiudo gli altri popup 257 $('.popup:not(.'+classPopup+')').removeClass('transition-3s').slideUp('fast').css('top', '').attr("data-open", "false"); 258 // ottengo il punto in cui vedere il popup, per attaccarlo alla fascia del top 259 var $top = $('#top').outerHeight( true ) - $this.offset().top + $(window).scrollTop(); 260 // mostro/nascondo il popup 261 var popupDataOpenAttr=$('.popup.'+classPopup).data("open")==true?false:true; 262 $('.popup.'+classPopup).removeClass('transition-3s').slideToggle('slow').css( 'top', $top ).attr("data-open", popupDataOpenAttr); 263 // se il popup è della ricerca 264 if($('.popup.'+classPopup).css('display') == 'block' && classPopup == 'popup-search') 265 // focus sull'input 266 $('.popup.'+classPopup+' input').focus(); 267 268 // allo scroll, ricalcolo la posizione per ancorarlo alla fascia top 269 $(window).scroll( function() { 270 var $top = $('#top').outerHeight( true ) - $this.offset().top + $(window).scrollTop(); 271 $('.popup.'+classPopup).css( 'top', $top ); 272 }); 273 274 e.stopPropagation(); 275 }); 276 277 // chiudo tutti i popup se clicco sul documento 278 /*$(document).on('click',function(event){ 279 if(!($(event.target).is('.popup *'))){ 280 $('.popup').slideUp('fast'); 281 } 282 });*/ 283} 284 285$('#loginUserID').keypress(function(event){ 286 if(event.keyCode == 13){ 287 $('#loginBtn').click(); 288 } 289}); 290 291function increaser() { 292 var container = $('.increaser-container'); 293 container.on('keydown', function(e) { 294 if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 || 295 (e.keyCode === 65 && (e.ctrlKey === true || e.metaKey === true)) || 296 (e.keyCode >= 35 && e.keyCode <= 40)) { 297 return; 298 } 299 if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) { 300 e.preventDefault(); 301 } 302 303 }); 304 305 var down; 306 307 var btn = $('.increase'); 308 309 btn.on('click', function() { 310 increase(this); 311 }); 312} 313 314function increase(btn) { 315 var container = $(btn).parent().parent().parent().children().closest('.increaser-container'); 316 317 var step; 318 var start = 1; 319 var min = parseInt(container.attr('min')); 320 /*if(min < start) 321 min = start;*/ 322 var result = parseInt(container.val() || 1); 323 step = parseInt($(btn).attr('step')); 324 result = result + step; 325 if(result < min) 326 result = min; 327 328 // var prezzo = parseFloat(result * prezzo).toFixed(2).replace('.',',').toLocaleString() 329 container.val(result); 330} 331 332function videoStp() { 333 $('.video iframe').on('mouseout', function() { 334 var url = $(this).attr('src'); 335 $(this).attr('src', url); 336 }); 337} 338 339function showLoader(container, msg){ 340 341 light = $(container); 342 343 $(light).block({ 344 message: '<img src="/img/ajax-loader.gif"/><br>
344' + msg, 345 346 overlayCSS: { 347 backgroundColor: '#fff', 348 opacity: 0.8, 349 cursor: 'wait' 350 }, 351 css: { 352 border: 0, 353 padding: 0, 354 backgroundColor: 'none' 355 }, 356 357 blockMsgClass: 'wait-loader-btn' 358 }); 359} 360 361function emailCheck(emailStr) { 362 var emailPat = /^(.+)@(.+)$/; 363 var specialChars = "\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"; 364 var validChars = "[^\\s" + specialChars + "]"; 365 var quotedUser = "(\"[^\"]*\")"; 366 var ipDomainPat = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/; 367 var atom = validChars + "+"; 368 var word = "(" + atom + "|" + quotedUser + ")"; 369 var userPat = new RegExp("^" + word + "(\\." + word + ")*$"); 370 var domainPat = new RegExp("^" + atom + "(\\." + atom + ")*$"); 371 var matchArray = emailStr.match(emailPat); 372 if (matchArray == null) { 373 return false; 374 } 375 var user = matchArray[1]; 376 var domain = matchArray[2]; 377 if (user.match(userPat) == null) { 378 return false; 379 } 380 var IPArray = domain.match(ipDomainPat); 381 if (IPArray != null) { 382 for (var i = 1; i <= 4; i++) { 383 if (IPArray[i] > 255) { 384 return false; 385 } 386 } 387 return true; 388 } 389 var domainArray = domain.match(domainPat); 390 if (domainArray == null) { 391 return false; 392 } 393 var atomPat = new RegExp(atom, "g"); 394 var domArr = domain.match(atomPat); 395 var len = domArr.length; 396 if (domArr[domArr.length - 1].length < 2 || 397 domArr[domArr.length - 1].length > 6) { 398 return false; 399 } 400 if (len < 2) { 401 return false; 402 } 403 return true; 404} 405 406// seo 407function seo(){ 408 "use strict"; 409 // if ($('#seo').length > 0) { 410 // var heightSeo = $('#seo').outerHeight(); 411 // $('body').css('padding-bottom', heightSeo); 412 // } 413} 414 415function delCookieUltimiVisti(urlPage){ 416 var url="/controller.php"; 417 var pars="action=delCookieUltimiVisti"; 418 $.ajax({type:"POST",url:url,data:pars,success:function(ResponseText){ 419 location.href = urlPage; 420 }}); 421} 422 423function apriModaleAttach(tabella, idBlocco, path, idRecord, idLinguaSito = "") { 424 var url="/controller.php"; 425 var pars="action=apriModaleAttach&tabella="+tabella+"&idBlocco="+idBlocco+"&path="+path+"&idRecord="+idRecord+"&idLinguaSito="+idLinguaSito; 426 $.ajax({type:"POST",url:url,data:pars,success:function(ResponseText){ 427 $("html").addClass("fixed-html"); 428 $(".modale-container .modale-content").html(ResponseText); 429 $(".modale-container").fadeIn(); 430 }}); 431} 432 433function apriModaleAttachPrincipale(tabella, idFile, path, idPagina) { 434 var url="/controller.php"; 435 var pars="action=apriModaleAttachPrincipale&tabella="+tabella+"&idFile="+idFile+"&path="+path+"&idPagina="+idPagina; 436 $.ajax({type:"POST",url:url,data:pars,success:function(ResponseText){ 437 $("html").addClass("fixed-html"); 438 $(".modale-container .modale-content").html(ResponseText); 439 $(".modale-container").fadeIn(); 440 }}); 441} 442 443function apriModaleRegistratiCorso(idCorso) { 444 var url="/controller.php"; 445 var pars="action=apriModaleRegistratiCorso&idCorso="+idCorso; 446 $.ajax({type:"POST",url:url,data:pars,success:function(ResponseText){ 447 $("html").addClass("fixed-html"); 448 $(".modale-container .modale-content").html(ResponseText); 449 $(".modale-container").fadeIn(); 450 }}); 451 /* 452 $("html").addClass("fixed-html"); 453 $("#modaleRegistratiCorso").fadeIn();*/ 454} 455 456//ticket 3278: $pntLayout->getIDLinguaSito() nel controller ritorna sempre 1, se ho più lingue da quindi errore, lo aggiungo qui 457function apriModaleRegistratiEvento(idEvento, idLinguaSito = "") { 458 var url="/controller.php"; 459 var pars="action=apriModaleRegistratiEvento&idEvento="+idEvento+"&idLinguaSito="+idLinguaSito; 460 $.ajax({type:"POST",url:url,data:pars,success:function(ResponseText){ 461 $("html").addClass("fixed-html"); 462 $(".modale-container .modale-content").html(ResponseText); 463 $(".modale-container").fadeIn(); 464 }}); 465 /* 466 $("html").addClass("fixed-html"); 467 $("#modaleRegistratiCorso").fadeIn();*/ 468} 469 470function apriModaleMappa(idRivenditore) { 471 var url="/controller.php"; 472 var pars="action=apriModaleMappa&idRivenditore="+idRivenditore; 473 $.ajax({type:"POST",url:url,data:pars,success:function(ResponseText){ 474 $("html").addClass("fixed-html"); 475 $(".modale-container").addClass('modale-mappa'); 476 $(".modale-container .modale-content").html(ResponseText); 477 $(".modale-container").fadeIn(); 478 }}); 479} 480 481function chiudiModaleAttach() { 482 $.when( 483 $(".modale-container").fadeOut() 484 ).then( function() { 485 if($(".modale-container").hasClass('modale-mappa')) $(".modale-container").removeClass('modale-mappa'); 486 $("html").removeClass("fixed-html"); 487 $(".modale-container .modale-content").html(""); 488 }); 489} 490 491function numberWithCommas(number) { 492 var parts = number.toString().split("."); 493 parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, "."); 494 return parts.join("."); 495} 496 497function counter_progress() { 498 setTimeout ( function () { 499 var vis_coutner = $('.counter.animated'); 500 if(vis_coutner.length > 0) { 501 vis_coutner.each( function() { 502 // var oTop = $(this).offset().top - window.innerHeight; 503 // if($(window).scrollTop() > oTop) { 504 var $this = $(this).find('.counter-val-container').find('.numero'), 505 countTo = $this.attr('data-count'); 506 if($this.attr('data-val') == '0') { 507 $({ countNum: $this.attr('data-val')}).animate({ countNum: countTo }, 508 { duration:3000,easing:'swing',step:function(){ 509 $this.attr('data-val', Math.floor(this.countNum)); 510 $this.text( numberWithCommas ( $this.attr('data-val') ) ); 511 },complete:function(){ 512 $this.text(numberWithCommas ( this.countNum ) ); 513 } 514 }); 515 } 516 // } 517 }); 518 } 519 }, 100); 520} 521 522function login(id, backurl=""){ 523 var x; 524 if (typeof id !== 'undefined') x=id; 525 else x=''; 526 527 //if(validaLogin()){ 528 var ric_log = 'no'; 529 var url="/controller_ecommerce.php?action=login_fe"; 530 if ($('#ricorda_login'+x).is(':checked')) ric_log='si'; else ric_log='no'; 531 var pars="email_login="+encodeURIComponent($('#email_login'+x).val())+"&idLinguaSito="+idLinguaSito+"&md5ed_login="+encodeURIComponent(hex_md5($('#password_login'+x).val()))+"&ricorda_login="+ric_log; 532 if(backurl!="") pars=pars+'&backurl='+backurl; 533 $.ajax({ 534 type:"POST", 535 url:url, 536 data:pars, 537 success:function(ResponseText){ 538 var arr_response=ResponseText.split("|"); 539 if(arr_response[0]=="ko"){ 540 $("#password_login").val(""); 541 swal({title:arr_response[1], type:"error", confirmButtonColor: "#EF5350"}); 542 } else if(arr_response[0]=='koPWD') { 543 $("#password_login").val(""); 544 545 swal({ 546 title: "Devi cambiare la password", 547 text: "E' da tanto tempo che non cambi la tua password.", 548 type: "warning", 549 showCancelButton: true, 550 confirmButtonColor: "#EF5350", 551 confirmButtonText: "Modifica ora!", 552 closeOnConfirm: false 553 }).then( 554 result => { 555 if (result.value) { 556 var url="/controller.php"; 557 var pars = "action=rec_psw_by_username&idLinguaSito="+idLinguaSito+"&email="+encodeURIComponent($('#email_login'+x).val()); 558 $.ajax({ 559 type: 'POST', 560 url: url, 561 data: pars, 562 beforeSend: function(){ 563 // showLoader('body', ''); 564 }, 565 success: function(result){ 566 var arr_response=result.split("|"); 567 if(arr_response[0]=="ko"){ 568 // swal({type: "error", confirmButtonColor: "#EF5350", title:arr_response[1]}).then((result) => { modalRecPsw(); }); 569 swal({type: "error", confirmButtonColor: "#EF5350", title:arr_response[1]}).then( function(result) { modalRecPsw(); }); 570 }else{ 571 $.fancybox.close(); 572 setTimeout(function(){ 573 swal({type: "success", title:arr_response[1]}); 574 $('#password_login'+x).val(""); 575 }, 200); 576 577 } 578 } 579 }); 580 } else { 581 582 } 583 } 584 ); 585 586 587 } else if(arr_response[0]=='ok') { 588 location.reload(); 589 } else if(arr_response[0]=='goto') { 590 location.href=arr_response[1]; 591 } 592 } 593 }); 594 //} 595} 596 597function invia_opt(){ 598 var url="/controller_ecommerce.php?action=invia_opt"; 599 var pars="prefisso_login="+encodeURIComponent($("#prefisso_login").val())+"&telefono_login="+encodeURIComponent($("#telefono_login").val())+"&idLinguaSito="+idLinguaSito; 600 601 $("#riceviOTP").attr("disabled", true); 602 $("#riceviOTP").parent().addClass("disabled"); 603 604 $.ajax({ 605 type:"POST", 606 url:url, 607 data:pars, 608 success:function(ResponseText){ 609 var arr_response=ResponseText.split("|"); 610 if(arr_response[0]=="ko"){ 611 $("#prefisso_login").val(""); 612 $("#telefono_login").val(""); 613 swal({title:arr_response[1], html:arr_response[2] ,type:"error", confirmButtonColor: "#D8000C"}); 614 615 $("#riceviOTP").attr("disabled", false); 616 $("#riceviOTP").parent().removeClass("disabled"); 617 } else if(arr_response[0]=="ok") { 618 swal({title:arr_response[1], type:"success", confirmButtonColor: "#D8000C"}); 619 620 $("#invia_opt").hide(); 621 $("#login_opt").show(); 622 $("#login_standard").hide(); 623 624 $("#riceviOTP").attr("disabled", false); 625 $("#riceviOTP").parent().removeClass("disabled"); 626 } 627 } 628 }); 629} 630 631function login_opt(tipo=""){ 632 var url="/controller_ecommerce.php?action=login_opt"; 633 var pars="prefisso_login="+encodeURIComponent($("#prefisso_login").val())+"&telefono_login="+encodeURIComponent($("#telefono_login").val())+"&optin_login="+encodeURIComponent($("#optin_login").val())+"&idLinguaSito="+idLinguaSito; 634 635 $.ajax({ 636 type:"POST", 637 url:url, 638 data:pars, 639 success:function(ResponseText){ 640 var arr_response=ResponseText.split("|"); 641 if(arr_response[0]=="ko"){ 642 $("#optin_login").val(""); 643 swal({title:arr_response[1], type:"error", confirmButtonColor: "#D8000C"}); 644 } else if(arr_response[0]=="ok") { 645 646 //location.href=arr_response[1]; 647 648 //se veniamo dall'accettazione dei tds rimandiamo all'account 649 if (tipo=="tds") { 650 location.href='/it/account'; 651 //altrimenti rimandiamo alla home 652 } else { 653 location.href=arr_response[1]; 654 } 655 656 } 657 } 658 }); 659} 660 661function logout(){ 662 663 var url="/controller_ecommerce.php?action=logout_fe"; 664 var pars="&idLinguaSito="+idLinguaSito; 665 $.ajax({ 666 type:"POST", 667 url:url, 668 data:pars, 669 success:function(ResponseText){ 670 var arr_response=ResponseText.split("|"); 671 if(arr_response[0]=="ko"){ 672 $("#password_login").val(""); 673 swal({title:arr_response[1], type:"error", confirmButtonColor: "#EF5350"}); 674 } else { 675 //location.reload(); 676 location.href ="/"; //così rimando alla home 677 } 678 } 679 }); 680} 681 682function modalRecPsw(){ 683 var url="/controller.php"; 684 var pars = "action=modal_rec_psw&idLinguaSito="+idLinguaSito; 685 $.ajax({ 686 type: 'POST', 687 url: url, 688 data: pars, 689 beforeSend: function(){ 690 showLoader('body', ''); 691 }, 692 success: function(result){ 693 var arr_response=result.split("|"); 694 if(arr_response[0]=="ko"){ 695 swal({type: "error", confirmButtonColor: "#EF5350", title:arr_response[1]}); 696 }else{ 697 /*swal({ 698 html: arr_response[0],
699 showConfirmButton: false, 700 showCloseButton: true 701 })*/ 702 $.fancybox.open(arr_response[0]); 703 $('#email-rec-psw').focus(); 704 } 705 } 706 }); 707} 708 709function generaNewPsw(){ 710 var email = $('#email-rec-psw').val(); 711 /*if(email == '' || !validateEmail(email)){ 712 swal({ 713 type: "error", 714 confirmButtonColor: "#EF5350", 715 title:errorEmailRecPsw 716 }).then((result) => { 717 modalRecPsw(); 718 }) 719 return false; 720 }*/ 721 722 var url="/controller.php"; 723 var pars = "action=rec_psw_by_username&idLinguaSito="+idLinguaSito+"&email="+encodeURIComponent(email);//rec_psw_byemail 724 $.ajax({ 725 type: 'POST', 726 url: url, 727 data: pars, 728 beforeSend: function(){ 729 showLoader('body', ''); 730 }, 731 success: function(result){ 732 var arr_response=result.split("|"); 733 if(arr_response[0]=="ko"){ 734 // swal({type: "error", confirmButtonColor: "#EF5350", title:arr_response[1]}).then((result) => { modalRecPsw(); }); 735 swal({type: "error", confirmButtonColor: "#EF5350", title:arr_response[1]}).then( function(result) { modalRecPsw(); }); 736 }else{ 737 $.fancybox.close(); 738 setTimeout(function(){ 739 swal({type: "success", title:arr_response[1]}); 740 }, 200); 741 742 } 743 } 744 }); 745} 746 747function validateEmail(email) { 748 var re = /^(([^<>()\[\]\\.,;:\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,}))$/; 749 return re.test(String(email).toLowerCase()); 750} 751 752/* 753 754da finire 755ho iniziato questa funzione per tracciare l'apertura/download di un allegato 756ai fini di analitics 757 758$('.blk-attachment a').on('click', function(e) { 759 e.preventDefault(); 760 var attach = $(this); 761 if(attach.attr('href') !== undefined && attach.attr('href') != "javascript:void(0);") { 762 var url = this.href; 763 var target = this.target; 764 $.ajax({ 765 url: "controller.php", 766 data: "action=saveDownloadAttach&url="+encodeURIComponent(url), 767 method: 'POST', 768 success: function ( response ) { 769 // if response 770 if(target !== undefined) { 771 window.open(url, target); 772 } else window.location.href=url; 773 } 774 }); 775 } 776}); 777*/ 778 779 780/* rating */ 781if( $('.contentRating').length > 0 ) { 782 $('.faceSuccess').click(function(){ 783 var idDomanda = $(this).attr('idDomanda'); 784 $(this).addClass('faceSuccessClick'); 785 $(this).addClass('selected'); 786 $('#warning_'+idDomanda).removeClass('faceWarningClick'); 787 $('#danger_'+idDomanda).removeClass('faceDangerClick'); 788 $('#faceRating'+idDomanda).val('Good'); 789 }); 790 791 $('.faceWarning').click(function(){ 792 var idDomanda = $(this).attr('idDomanda'); 793 $(this).addClass('faceWarningClick'); 794 $(this).addClass('selected'); 795 $('#success_'+idDomanda).removeClass('faceSuccessClick'); 796 $('#danger_'+idDomanda).removeClass('faceDangerClick'); 797 $('#faceRating'+idDomanda).val('Normal'); 798 }); 799 800 $('.faceDanger').click(function(){ 801 var idDomanda = $(this).attr('idDomanda'); 802 $(this).addClass('faceDangerClick'); 803 $(this).addClass('selected'); 804 $('#warning_'+idDomanda).removeClass('faceWarningClick'); 805 $('#success_'+idDomanda).removeClass('faceSuccessClick'); 806 $('#faceRating'+idDomanda).val('Bad'); 807 }); 808} 809 810
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.