1/*function modificaLinkedin(){ 2 if($('.jssocials-share-linkedin > .jssocials-share-link').length >0) 3 { 4 var newUrl = "https://www.linkedin.com/sharing/share-offsite/?url=" + encodeURIComponent(jQuery('meta[property="og:url"]').attr('content')); 5 $('.jssocials-share-linkedin > .jssocials-share-link').unbind() 6 $('.jssocials-share-linkedin > .jssocials-share-link').on("click",function() { window.open(newUrl,"_blank","width=600,height=400");}) 7 } 8 }*/ 9 10$(document).ready(function () { 11 12 var o = getUrlParams(); 13 if (o["isOverlay"]) { 14 15 $('#caricatore').delay('800').fadeOut(500); 16 $('#ms-designer-ribbon').css("display", "none !important").css("visibility", "hide"); 17 $('#ms-designer-ribbon').hide(); 18 $('header.l-header').hide(); 19 $('footer.l-footer').hide(); 20 $('nav.l-pre-footer').hide(); 21 $('div.l-sub-footer').hide(); 22 $('.theme-breadribbon').hide(); 23 $('.l-container-sm-padding').hide(); 24 $('#l-pre-footer').hide(); 25 $('#mostra-News').hide(); //Nasconde il link verso l'archivio NEWS quando sono in Overlay 26 27 if (o["sch"]) { 28 var ind = o["sch"].replace(/%20/g, ' '); 29 //$('h3').first().hide(); 30 $('#txtIndirizzo').val(ind); 31 } 32 33 } 34 35 //funzione per popolare il disclaimer 36 //var testo = $('#AreaDisclaimer').val(); 37 //$('.' + testo).css('display','block'); 38 39 40 var ctaOfferta = $('.cta-promo'); 41 if(ctaOfferta.length){ 42 ctaOfferta.on('click',function(){ 43 $("#s4-workspace").animate({scrollTop: $('#map-locator').position().top}, 800, 'swing'); 44 }) 45 } 46 47 48 var $windowHeight = $(window).outerHeight(); 49 50 // sharepoint elements 51 var docHeight = document.getElementById('s4-bodyContainer').scrollHeight; 52 var $ribbonHeight = $('#ms-designer-ribbon').outerHeight(); 53 var $DeltaUpdater = $('#DeltaWebPartAdderUpdatePanelContainer'); 54 // var $ribbonRow = $('#s4-ribbonrow').height(); 55 var $DeltaPageStatusBar = $('#DeltaPageStatusBar').outerHeight(); 56 var $scrollRef = $('#s4-workspace'); 57 var $pageContentWrapper = $('#l-wrapper'); 58 59 // menu 60 var $themeHeaderHeight = $('.theme-header').height(); 61 var $btnMenuIco = $('.btn-menu span'); 62 var $mainMenu = $('.l-main-menu'); 63 64 // navigazione 65 var $navBar = $('.theme-nav'); 66 var $navbarHeight = $('.theme-nav').height(); 67 var $btnSearch = $('.btn-search'); 68 var $navBarSearch = $('.l-nav-search-bar'); 69 70 // carousel 71 var $offerCarousel = $('#offerta-carousel'); 72 73 // footer 74 var $footerHeight = $('.l-footer').outerHeight(); 75 var $subFooterHeight = $('.l-sub-footer').outerHeight(); 76 var $backToTopBtn = $('.back-to-top'); 77 78 //form 79 var $inputText = $('.theme-box-ricerca input:not([type="button"],[type="radio"]),.l-box-form input:not([type="button"],[type="radio"]),.l-box-form textarea,.main-banner-text input[type="text"]'); 80 var $inputLabel = $('.theme-box-ricerca .labels:not(.field),.l-box-form .labels:not(.field),.labels'); 81 82 //social Tool 83 var $socialShare = $('.l-share'); 84 85 // controllo ingombro ribbon sharepoint 86 if ($DeltaUpdater.length) { 87 $navBar.addClass('reset-ribbon-pos'); 88 } 89 //interazioni con i tools della ribbon riposizionano l'header 90 $('#ms-designer-ribbon').wrap('<div id="ribbon-wrapper"></div>'); 91 $('#ribbon-wrapper').on('click', function () { 92 setTimeout(function () { 93 var altezzaRibbon = $('#ribbon-wrapper').height(); 94 //console.log('il wrapper della ribbon è alto ' + altezzaRibbon); 95 $navBar.animate({ 96 'top': altezzaRibbon + 'px' 97 }) 98 if ($DeltaUpdater.length && $mainMenu.hasClass('in') && $navBar.hasClass('theme-nav-scroll')) { 99 $mainMenu.animate({ 100 'top': $navBar.height() + $DeltaUpdater.offset().top + 'px' 101 }); 102 103 //console.log('evento 1 delta + scroll + collapse in -> top: ' + ($navBar.height() + $DeltaUpdater.offset().top)); 104 } 105 106 if ($DeltaUpdater.length && $mainMenu.hasClass('in') && !$navBar.hasClass('theme-nav-scroll')) { 107 $mainMenu.animate({ 108 'top': $navBar.height() + $DeltaUpdater.offset().top + $('.l-pre-nav').height() + 'px' 109 }); 110 111 //console.log('evento 2 delta + collapse in: ' + ($navBar.height() + $navBar.offset().top)); 112 113 } 114 } 115 116 117 , 700); 118 }) 119 120 121 122 //padding TOP per il wrapper di pagina = all'altezza della navbar 123 // escludo preventivatore 124 if ( window.location.href.toLowerCase().indexOf("/utility/preventivatore/preventivatore.aspx")== -1) 125 { 126 $pageContentWrapper.css('padding-top', $navbarHeight); 127 } 128 129 130 //contollo sticky header 131 function navbarCheckWidth() { 132 $navBar.css('width', $scrollRef.prop('clientWidth') + 'px'); 133 } 134 135 function checkSticky() { 136 137 $('.btn-menu-scroll').addClass('btn-menu-scroll-visible'); 138 139 if ($scrollRef.scrollTop() > $themeHeaderHeight) { 140 141 142 $navBar 143 .addClass('theme-nav-scroll') 144 .css({ 145 'width': $scrollRef.prop('clientWidth') + 'px' 146 }); 147 $('.main-logo').addClass('main-logo-scroll'); 148 //$('.l-header .utility-menu li').css('padding', '10px 5px '); 149
150 if ($('#l-carousel').length) { 151 $('#l-carousel').css('padding-top', 100) 152 } 153 154 155 } else { 156 157 $navBar 158 .removeClass('theme-nav-scroll') 159 .css({ 160 'width': $scrollRef.prop('clientWidth') + 'px' 161 }); 162 $('.main-logo').removeClass('main-logo-scroll'); 163 // $('.l-header .utility-menu li').css('padding', '20px 5px '); 164 165 if ($('#l-carousel').length) { 166 $('#l-carousel').css('padding-top', 0) 167 } 168 169 170 } 171 } 172 173 174 checkSticky(); 175 navbarCheckWidth(); 176 backToTop(); 177 checkIfIsEmpty(); 178 179 180 181 182 $scrollRef 183 .on('scroll', checkSticky) 184 .on('scroll', closeSearch) 185 .on('scroll', backToTop); 186 187 188 // barra ricerca 189 function openSearch() { 190 191 $btnSearch.addClass('btn-search-selected'); 192 $navBarSearch.fadeIn().attr('data-open', 'true'); 193 } 194 195 function closeSearch() { 196 197 $btnSearch.removeClass('btn-search-selected'); 198 $navBarSearch.fadeOut().attr('data-open', 'false'); 199 $navBarSearch.find('input').val(''); 200 201 } 202 203 $btnSearch.on('click', function () { 204 205 if ($navBarSearch.attr('data-open') === 'false') { 206 207 if ($mainMenu.attr('data-open') === 'true') { 208 $mainMenu.attr('data-open', 'false').removeClass('in'); 209 closeMainMenu(); 210 } 211 212 openSearch(); 213 214 } else { 215 216 closeSearch(); 217 } 218 219 }); 220 221 222 // controllo menu 223 $('.btn-menu').on('click', function (e) { 224 225 e.preventDefault(); 226 227 }); 228 229 function closeMainMenu() { 230 231 $mainMenu.attr('data-open', 'false'); 232 $btnMenuIco.removeClass('icon-close').addClass('icon-menu'); 233 $offerCarousel.carousel('cycle'); 234 $('body, #s4-workspace').removeClass('no-scrolling'); 235 236 } 237 238 function openMainMenu() { 239 240 if ($DeltaUpdater.length) { 241 242 var $DeltaUpdaterTop = $DeltaUpdater.offset().top; 243 244 if ($navBar.hasClass('theme-nav-scroll')) { 245 var menuTop = $DeltaUpdaterTop + $('.theme-nav').height(); 246 //console.log('delta presente, theme-nav-scroll -> top menu scrolling: ' + menuTop); 247 248 } else { 249 250 var menuTop = $DeltaUpdaterTop + $navbarHeight + $themeHeaderHeight; 251 //console.log('delta presente theme nav no scroll ->top menu no scrolling: ' + menuTop); 252 253 } 254 255 } else { 256 257 var $DeltaUpdaterTop = 0; 258 259 if ($navBar.hasClass('theme-nav-scroll')) { 260 261 var menuTop = $('.theme-nav').height(); 262 //console.log('no Delta, theme-nav-scroll -> top menu scrolling: ' + menuTop); 263 264 } else { 265 266 var menuTop = $('.theme-nav').outerHeight() + $('.l-pre-nav').outerHeight(); 267 // var menuTop = $DeltaUpdaterTop + $navbarHeight + $themeHeaderHeight; 268 //console.log('>>no Delta, no scroll ->top menu no scrolling: ' + menuTop); 269 270 } 271 272 } 273 274 275 276 $mainMenu 277 .attr('data-open', 'true') 278 .css({ 279 'top': menuTop + 'px' 280 }); 281 //console.log('MenuTop Main Menu: ' + menuTop); 282 $btnMenuIco.removeClass('icon-menu').addClass('icon-close'); 283 $offerCarousel.carousel('pause'); 284 $('body, #s4-workspace').addClass('no-scrolling'); 285 286 } 287 288 $mainMenu 289 .on('shown.bs.collapse', closeSearch) 290 .on('shown.bs.collapse', openMainMenu) 291 .on('shown.bs.collapse', navbarCheckWidth); 292 293 294 $mainMenu 295 .on('hide.bs.collapse', closeMainMenu) 296 .on('hide.bs.collapse', navbarCheckWidth); 297 298 // impostazioni slider 299 $offerCarousel.carousel({ 300 interval: 10000 301 }); 302 303 $('.fdi-Carousel .item').each(function () { 304 var next = $(this).next(); 305 if (!next.length) { 306 next = $(this).prev(); 307 } 308 }); 309 310 // scroll sezioni 311 var $scrollSections = $('.scroll-el'); 312 var $scrollControl = $('.scroll-control'); 313 314 // per ogni sezione assegno un id e inserisco un link con un ancora nella navigazione 315 $scrollSections.each(function (i) { 316 var nEl = i + 1; 317 var sectionTitle = $(this).find('[data-scroll-ttl]').attr('data-scroll-ttl'); 318 $(this).attr('id', 's' + nEl); 319 var listItem = '<li><a class="scroll-link" href="#s' + nEl + '"><span>' + sectionTitle + '</span></a></li>'; 320 $scrollControl.append(listItem); 321 322 }); 323 324 // controllo in che sezione sto scrollando 325 $scrollRef.on('scroll', function () { 326 327 // se non ci sono elementi esco 328 if ($scrollSections.length === 0) { 329 return false; 330 } 331 332 if ($scrollRef.scrollTop() < $scrollSections.eq(0).offset().top) {
333 $scrollControl.addClass('inside') 334 // se sono piu in alto della prima sezione rimuovo la selezione dai bullet 335 $scrollControl.find('a').removeClass('scroll-selected').closest('ul').addClass('fuori'); 336 337 338 339 340 } else if ($scrollRef.scrollTop() >= docHeight - $('s4-bodyContainer').height()) { 341 342 // se sono alla fine della pagina seleziono l'ultimo bullet 343 $scrollControl.find('a').removeClass('scroll-selected'); 344 345 346 } else { 347 // per ogni sezione applico la selezione al bullet corrispondente 348 $scrollControl.find('li').last().find('a').addClass('scroll-selected').closest('ul').removeClass('fuori'); 349 $scrollSections.each(function (i) { 350 351 if ($scrollRef.scrollTop() >= $scrollRef.scrollTop() + $(this).offset().top - $navBar.outerHeight() - $ribbonHeight && $scrollRef.scrollTop() <= ($scrollRef.scrollTop() + $(this).offset().top + $(this).innerHeight() - $navBar.outerHeight() - $ribbonHeight)) { 352 $scrollControl.find('a').removeClass('scroll-selected'); 353 $scrollControl.find('li').eq(i).find('a').addClass('scroll-selected'); 354 } 355 }); 356 357 } 358 359 }); 360 361 // intercetto la sezione 362 $(".scroll-link").on('click', function (e) { 363 364 e.preventDefault(); 365 var dest; 366 var elTop = $(this.hash).offset().top + 1; 367 var $scrollRefCurrent = $("#s4-workspace").scrollTop(); 368 369 if ($scrollRefCurrent + $(this.hash).offset().top > docHeight - $('s4-bodyContainer').height()) { 370 371 dest = docHeight - $('#s4bodyContainer').height(); 372 373 } else { 374 375 dest = $scrollRefCurrent + elTop - $navBar.outerHeight() - $ribbonHeight; 376 console.log('destinazione: ' + dest); 377 } 378 379 //scrolla alla sezione 380 $scrollRef.animate({ 381 scrollTop: dest 382 }, 1000, 'swing'); 383 }); 384 385 //torna al top di pagina 386 $backToTopBtn.on('click', function () { 387 388 $scrollRef.animate({ 389 scrollTop: 0 390 }, 500, 'swing'); 391 392 }); 393 394 function backToTop() { 395 //console.log('condi 1' + $scrollRef.scrollTop() > $windowHeight / 2); 396 397 if ($scrollRef.scrollTop() > $windowHeight / 2) { 398 399 $backToTopBtn.fadeIn(); 400 //$backToTopBtn.removeClass('go-up'); 401 402 // } else if ($scrollRef.scrollTop() >= docHeight - window.innerHeight - $subFooterHeight) { 403 404 //$backToTopBtn.addClass('go-up'); 405 406 } else { 407 408 $backToTopBtn.fadeOut(); 409 410 } 411 } 412 /*mega menu trigger hover*/ 413 414 //animazione label 415 $inputLabel.on('click', function () { 416 $(this).css({ 417 'transform': 'translateY(-45px)' 418 }).next().focus(); 419 }); 420 421 $inputText.on('focus', function () { 422 if($(this).parent().attr("class").indexOf("searchNews")<0){ //Se non presente la classe "searchNews" (Ovvero sto esludendo la ricerca nell'archivio News). 423 $(this).prev().css({ 424 'transform': 'translateY(-45px)' 425 }); 426 } 427 }); 428 429 $inputText.on('blur', function () { 430 if($(this).parent().attr("class").indexOf("searchNews")<0){ //Se non presente la classe "searchNews" (Ovvero sto esludendo la ricerca nell'archivio News). 431 432 if ($(this).val() != '') { 433 $(this).prev().css({ 434 'transform': 'translateY(-45px)' 435 }); 436 437 } else { 438 $(this).prev().css({ 439 'transform': 'translateY(-50%)' 440 }); 441 } 442 } 443 }) 444 445 446 $('select').on('change', function () { 447 var selezionato = $(this).val(); 448 449 if (selezionato == 'empty') { 450 $(this).prev('.labels').css({ 451 'transform': 'translateY(-50%)' 452 }) 453 } else $(this).prev('.labels').css({ 454 'transform': 'translateY(-45px)' 455 }) 456 }) 457 //funzione per .labels NDG 458 function checkIfIsEmpty() { 459 $inputText.each(function () { 460 if ($(this).val() != '') { 461 $(this).prev().css({ 462 'transform': 'translateY(-45px)' 463 }); 464 } else return 465 }); 466 } 467 468 469 470 //liste ordinate 471 472 // segnatura numeri arabi 473 $('ol.numbers').css({ 474 'list-style': 'none' 475 }); 476 477 $('ol.numbers').each(function () { 478 var dataStart = $(this).data('start'); 479 var listItem = $(this).find('li'); 480 listItem.each(function (j) { 481 //console.log(dataStart) 482 $(this).prepend('<span class="item-numbers">' + (dataStart + j + 1) + '.</span>'); 483 }) 484 485 486 487 }); 488 489 // segnatura alfabetica a,b,c,d 490 $('.theme-letter li').each(function (k) { 491 $(this).prepend('<span class="item-letters">' + String.fromCharCode(k + 97) + '.</span>'); 492 }); 493 494 // segnatura ordinali Romani I,II,III 495 $('.theme-roman li').each(function (y) { 496 $(this).prepend('<span class="item-romans" data-format="roman">' + (y + 1) + '<i>.<i></span>'); 497 }); 498 499 // funzione di conversione Arabic > Roman 1->I, 2->II 500 Number.prototype.toRoman = function () { 501 var e = Math.floor(this), 502 t, n = "", 503 i = 3999, 504 s = 0; 505 v = [1e3, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1], 506 r = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"]; 507 if (e < 1 || e > i) return ""; 508 while (s < 13) { 509 t = v[s]; 510 while (e >= t) { 511 e -= t; 512 n += r[s] 513 } 514 if (e == 0) return n; 515 ++s 516 } 517 return "" 518 }; 519 var fnrom = function (e) { 520 if (parseInt(e.innerHTML)) { 521 e.innerHTML = parseInt(e.innerHTML).toRoman() 522 } 523 }; 524 setTimeout(function () { 525 [].forEach.call(document.querySelectorAll("[data-format=roman]"), fnrom) 526 }, 10); 527 528 529 //Social Tool 4 sharing 530 $socialShare.on('click', function (e) { 531 $(this).toggleClass('opened').find('ul').fadeToggle(); 532 }) 533 534/* //CP: SocialTool Circolare 535 //Social Tool 5 sharing 536 $socialShareCircolare.on('click', function (e) { 537 $(this).toggleClass('opened').find('ul').fadeToggle(); 538 539 }) 540*/ 541 542 //News 543 544 //--get the text lenght > add class to manage the font-size 545 var newsHeading = $('#l-first-news-wrapper h3 '); 546 newsHeading.each(function () { 547 var testo = $(this).text(); 548 var numeroCaratteri = testo.length; 549 /*console.log('il titolo ' + $(this).prop('nodeName') + 550 ' dell\'article ' + $(this).parents('article').attr('class') + 551 ' ha ' + numeroCaratteri + ' caratteri spazi inclusi');*/ 552 if (numeroCaratteri < 40) { 553 $(this).addClass('l-txt-lenght-xl'); 554 } else if (numeroCaratteri >= 40 && numeroCaratteri < 80) { 555 $(this).addClass('l-txt-lenght-l'); 556 } else if (numeroCaratteri >= 80 && numeroCaratteri < 120) { 557 $(this).addClass('l-txt-lenght-m'); 558 } else { 559 $(this).addClass('l-txt-lenght-s'); 560 } 561 562 }) 563 //--set height and margin 564 var newsLg = $('#news-lg').outerHeight(); 565 $('#news-md').outerHeight(newsLg / 100 * 63).css({ 566 'margin-bottom': newsLg / 100 * 5 567 }); 568 $('#news-sm').outerHeight(newsLg / 100 * 32); 569 570 571 572 /*******************************/ 573 /******** FORM COMPLESSO ******/ 574 /*****************************/ 575 576 /*form complesso controlli input-radio-checkbox-select... REQUIRED*/ 577 578 var onFocusStep = $('[data-step].on-focus').attr('data-step'); 579 var stepBox = $('[id*=step-]').hide(); 580 var stepBoxOnFocus = $('[id*=step-' + onFocusStep + ']').show().addClass('focus-step'); 581 //var campi = $('.focus-step .required').siblings();
582 //var alerts = $('.l-alert-required'); 583 var stepProgressPerc = $('#l-progress').width() / ($('[data-step]').length); 584 585 /*mobile step title*/ 586 function mobileTabTitle() { 587 var testoFocus = $('#l-form-control>li.on-focus span').text(); 588 $('#clone-mobile').html(testoFocus); 589 } 590 591 if ($(window).width() < 640) { 592 mobileTabTitle(); 593 } 594 595 checkRequired = function (lastStep) { 596 var campi = $('.focus-step .required').siblings(); 597 campi.focus(function () { 598 $(this).parent().removeClass('alerts') 599 }) 600 campi.find('[type=radio]').on('change', function () { 601 $(this).closest('.alerts').removeClass('alerts') 602 }) 603 604 605 campi.each(function () { 606 if ($(this).is('[type=text]')) { 607 var valore = $(this).val(); 608 if (valore == '') { 609 $(this).parent().addClass('alerts'); 610 $('.error-msg').fadeIn(); 611 $('.l-status').removeClass('status-ok').addClass('status-no'); 612 $(this).removeClass('isOk') 613 614 615 } else { 616 var idType = $(this).attr('id'); 617 618 switch (idType) { 619 620 case "c-f": 621 //console.log(idType); 622 if ($(this).val().length == 16) { 623 $(this).addClass('isOk').removeClass('alerts'); 624 $(this).css({ 625 'background-color': 'transparent' 626 });
627 } else { 628 //console.log('il codice fiscale inserito ha meno di 16 caratteri'); 629 $(this).removeClass('isOk').css({ 630 'background-color': '#d9e793' 631 }).addClass('alerts'); 632 633 634 } 635 break; 636 637 case "email-format": 638 //console.log(idType); 639 var email = $(this).val(); 640 //console.log(email); 641 var pattern = /^([a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+(\.[a-z\d!#$%&'*+\-\/=?^_`{|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+)*|"((([ \t]*\r\n)?[ \t]+)?([\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*(([ \t]*\r\n)?[ \t]+)?")@(([a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\d\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.)+([a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF][a-z\d\-._~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]*[a-z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])\.?$/i; 642 var result = pattern.test(email); 643 if (result == true) { 644 $(this).addClass('isOk').removeClass('alerts'); 645 $(this).css({ 646 'background-color': 'transparent' 647 });
648 } else { 649 $(this).css({ 650 'background-color': '#d9e793' 651 }).addClass('alerts') 652 653 } 654 break; 655 case "numero": 656 //console.log(idType); 657 if ($(this).val().match(/^[0-9 \+\-]+$/)) { 658 $(this).addClass('isOk').removeClass('alerts'); 659 $(this).css({ 660 'background-color': 'transparent' 661 }); 662 } else { 663 //console.log('non hai inserito solo cifre'); 664 $(this).removeClass('isOk').css({ 665 'background-color': '#d9e793' 666 }).addClass('alerts') 667 } 668 break; 669 670 default: 671 $(this).addClass('isOk'); 672 //console.log('no id per controlli') 673 } 674 675 } 676 }; 677 678 if ($(this).is('select')) { 679 if ($(this).children('option:first-child').is(':selected')) { 680 $(this).closest('.form-group').addClass('alerts'); 681 $('.error-msg').fadeIn(); 682 $('.l-status').removeClass('status-ok').addClass('status-no'); 683 $(this).removeClass('isOk'); 684 685 686 } else { 687 $(this).parent().removeClass('alerts'); 688 $(this).addClass('isOk') 689 } 690 691 } 692 if ($(this).is('.l-radio-wrap')) { 693 var radioBtn = $(this).find('[type=radio]:checked'); 694 if (radioBtn.length) { 695 $(this).closest('.form-group').removeClass('alerts'); 696 $(this).addClass('isOk') 697 } else { 698 $(this).closest('.form-group').addClass('alerts'); 699 $('.error-msg').fadeIn(); 700 $('.l-status').removeClass('status-ok').addClass('status-no'); 701 $(this).removeClass('isOk'); 702 703 } 704 705 706 } 707 708 }) 709 710 return checkisOk(campi, lastStep); 711 712 } 713 714 function checkisOk(campi, lastStep) { 715 716 //console.log('totale campi richiesti' + campi.length + 'quelli con isok' + $('.focus-step .isOk').length); 717 718 if (campi.length == $('.focus-step .isOk').length) { 719 //console.log('ok'); 720 $('.alerts').removeClass('alerts'); 721 var step = $('.on-focus').attr('data-step'); 722 $('.error-msg').fadeOut(); 723 $('.l-status').removeClass('status-no'); 724 $('.l-status').animate({ 725 left: stepProgressPerc * step + 'px' 726 }, 1000, 727 function () { 728 $(this).addClass('status-ok') 729 }) 730 $('.l-progress-bar').animate({ 731 width: stepProgressPerc * step + 'px' 732 }, 1000, 733 function () { 734 var percentValue = (100 / ($('[data-step]').length)) * $('[data-step].on-focus').attr('data-step'); 735 $('.percent').html(percentValue + '%'); 736 $('.l-feedback').fadeIn(); 737 $('.on-focus, .edited.ex').each(function () { 738 $(this).attr('onclick', ' backFunction(this, "#step-' + $('.on-focus') 739 .attr('data-step') + '")') 740 .removeClass('on-focus') 741 .addClass('edited') 742 .removeClass('ex') 743 .next().addClass('on-focus'); 744 745 if ($(window).width() < 640) { 746 mobileTabTitle(); 747 } 748 749 750 }); 751 if (lastStep == null) { 752 $('.focus-step') 753 .fadeOut() 754 .removeClass('focus-step') 755 .next().fadeIn() 756 .addClass('focus-step'); 757 } else if (lastStep != null) { 758 759 /*utile solo per la demo*/ 760 if (lastStep === 10) { 761 $('.focus-step').fadeOut().removeClass('focus-step'); 762 $('.l-feedback').html('Complimenti! Hai compilato correttamente tutti i campi.'); 763 $('[data-step]').removeAttr('onclick').css('cursor', 'default').addClass('sending'); 764 $('.last-step').removeAttr('onclick').css('cursor', 'default'); 765 $('#invio').fadeIn().delay(2000).fadeOut(); 766 $('#inviato').fadeIn() 767 768 return null; 769 770 } 771 772 /*fine utile solo per la demo*/ 773 $('.focus-step') 774 .fadeOut() 775 .removeClass('focus-step'); 776 $('#step-' + lastStep) 777 .fadeIn() 778 .addClass('focus-step'); 779 $('.step-button').attr('onclick', 'return checkRequired()') 780 $('.l-progress-bar').animate({ 781 width: stepProgressPerc * (lastStep - 1) + 'px' 782 }, 1000, 783 function () { 784 var percentValue = (100 / ($('[data-step]').length)) * (lastStep - 1); 785 $('.percent').html(percentValue + '%'); 786 }) 787 $('.l-status').animate({ 788 left: stepProgressPerc * (lastStep - 1) + 'px' 789 }, 1000, 790 function () { 791 $(this).addClass('status-ok') 792 }) 793 794 795 796 797 } 798 799 800 if ($('.on-focus').attr('data-step') == ($('[data-step]').length)) { 801 $('#l-form-complex button') 802 /* riabilitare type submit post demo*/ 803 /*.attr('type', 'submit' )*/ 804 .addClass('last-step') 805 806 /*togliere utile solo per demo*/ 807 .attr('onclick', 'return checkRequired(10)') 808 /*--end*/ 809 810 .find('i.first-arrow').fadeOut().siblings('.btn-text') 811 .text('INVIA'); 812 } 813 814 /*scrollo in cima al form*/ 815 var scrollTo = $("#l-form-control").offset().top - $("#s4-bodyContainer").offset().top - $('.theme-nav').height() - 50; 816 $('#s4-workspace').animate({ 817 scrollTop: scrollTo 818 }, 1000, 'swing'); 819 }); 820 821 } else { 822 /*scrollo al primo campo non validato*/ 823 var scrollTo = $(".alerts:first").offset().top - $("#s4-bodyContainer").offset().top - $('.theme-nav').height() - 50; 824 $('#s4-workspace').animate({ 825 scrollTop: scrollTo 826 }, 1000, 'swing'); 827 828 //console.log('nn ci siamo') 829 830 } 831 832 } 833 834 //datapicker init 835 if ($("[class*='datepicker']").length) { 836 $("[class*='datepicker']").datetimepicker({ 837 // locale: 'it', 838 /*icons: { 839 time: "fa fa-clock-o", 840 date: "fa fa-calendar", 841 up: "fa fa-arrow-up", 842 down: "fa fa-arrow-down" 843 },*/ 844 viewMode: 'years', 845 format: 'DD/MM/YYYY' 846 847 }); 848 } 849 850 //input number arrows UI + arrows key down 851 $('.l-number-control>span').on('click', numeri); 852 $('.l-numbers').focus(function () { 853 $(this).css('color', '#222') 854 }); 855 856 function numeri() { 857 var inputField = $(this).closest('.l-number-control').siblings('.l-numbers'); 858 var currentValue = parseInt(inputField.val()); 859 if ($(this).hasClass('add')) { 860 if (!isNaN(currentValue)) { 861 inputField.val(currentValue + 1); 862 inputField.css('color', '#222'); 863 } 864 } 865 if ($(this).hasClass('sub')) { 866 if (!isNaN(currentValue) && currentValue > 0) { 867 inputField.val(currentValue - 1); 868 } 869 if (currentValue == 1) { 870 inputField.css('color', '#eee'); 871 } 872 873 } 874 } 875 876 877 878 backFunction = function (el, dataStepValue) { 879 var lastStep = $('.on-focus').attr('data-step'); 880 $('.step-button').removeAttr('onclick').attr('onclick', 'return checkRequired(' + lastStep + ')') 881 882 //console.log('salto dallo step' + lastStep); 883 //console.log(el.tagName); 884 $(el).addClass('on-focus') 885 .removeClass('edited ') 886 .siblings().removeClass('on-focus ') 887 .siblings('.edited').addClass('ex') 888 .removeAttr('onclick'); 889 890 if ($(window).width() < 640) { 891 mobileTabTitle(); 892 } 893 894 //per muovere la barra 895 var stepTofadeIn = $(dataStepValue); 896 //console.log(stepTofadeIn); 897 var step = $('.on-focus').attr('data-step'); 898 $('.l-status').animate({ 899 left: stepProgressPerc * step + 'px' 900 }, 1000) 901 $('.l-progress-bar').animate({ 902 width: stepProgressPerc * step + 'px' 903 }, 1000, 904 function () { 905 var percentValue = (100 / ($('[data-step]').length)) * $('[data-step].on-focus').attr('data-step'); 906 $('.percent').html(percentValue + '%'); 907 }); 908 909 //fine controllo barra 910 stepTofadeIn.fadeIn().addClass('focus-step').siblings('[id*=step-]').removeClass('focus-step').fadeOut(); 911 if ($('#l-form-complex button').has('.last-step')) { 912 $('#l-form-complex button').removeClass('last-step').attr('type', 'button') 913 .find('i.first-arrow').fadeIn().siblings('.btn-text').text('PROCEDI') 914 915 916 } 917 918 } 919 920 /*fine controlli form*/ 921 922 /*-------check if is*/ 923 $.fn.inView = function () { 924 //view 925 var win = $(window); 926 927 //Object to Check 928 obj = $(this); 929 //top Scroll Position 930 var scrollPosition = win.scrollTop(); 931 //console.log('scroll top di s4 ' +scrollPosition); 932 //the end of the visible area 933 var visibleArea = win.scrollTop() + win.height(); 934 //console.log('area visibile' + visibleArea); 935 //the end of the object to check 936 var objEndPos = (obj.offset().top + obj.outerHeight()); 937 //console.log('fine dell\oggetto nel vieport ' + objEndPos); 938 return (visibleArea >= objEndPos && scrollPosition <= objEndPos ? obj.addClass('inview') : obj.removeClass('inview')) 939 }; 940 $('#s4-workspace').scroll(function () { 941 if ($('[class*=checkIfIs]').length) { 942 var animateEl = $('[class*=checkIfIs]'); 943 animateEl.each(function () { 944 $(this).inView(); 945 }) 946 } 947 }) 948 /*-------end-check-if-is*/ 949 950 951 /*-------stickit 4 the f**c#*## MAp */ 952 $.fn.stickIt = function () { 953 //view 954 var win = $(window); 955 956 //Object to Check 957 obj = $(this); 958 var objStartPos = $('#lista_bcc').offset().top; 959 if (objStartPos <= 10) { 960 obj.addClass('lets-stick-it') 961 } else { 962 obj.removeClass('lets-stick-it') 963 } 964 }; 965 $('#s4-workspace').on('scroll', function () { 966 console.log('stickit'); 967 if ($('[class*=stickit]').length && $(window).width()>=992) { 968 var animateEl = $('[class*=stickit]'); 969 animateEl.each(function () { 970 $(this).stickIt(); 971 }) 972 } 973 }) 974 /*-------end stickit*/ 975 976 /*---footer mobile menu---*/ 977 /*function accordionFoo() { 978 if ($(window).innerWidth() <= 480) { 979 $('.FooterHTML').addClass('mobile-foo'); 980 $('.FooterHTML ul').hide(); 981 $('.FooterHTML h6').on('click', function () {
982 $('.foo-m-open').slideUp(); 983 $(this).next('ul').slideToggle().addClass('foo-m-open'); 984 985 }); 986 987 } else { 988 989 $('.FooterHTML h6').off('click'); 990 $('.FooterHTML ul').slideDown(); 991 $('.FooterHTML').removeClass('mobile-foo'); 992 993 } 994 } 995 accordionFoo();*/ 996 /*---end footer mobile menu---*/ 997 998 /*******************************/ 999 /*** carousel tab banner ***/ 1000 /*****************************/ 1001 1002 if ($('#l-carousel').length) { 1003 var themeNav = $('.theme-nav').outerHeight() 1004 var themePreNav = $('.l-pre-nav').outerHeight(); 1005 var sliderHeight = 600 // $windowHeight - themePreNav; 1006 //console.log(sliderHeight) 1007 //ALTEZZA BANNER 1008 //$('.l-main-banner.theme-main-banner').height(sliderHeight); 1009 //$('.main-banner-text').outerHeight(sliderHeight + 60); 1010 1011 $('#l-carousel').carousel({ 1012 interval: 4000 1013 }).height(sliderHeight).css({ 1014 //'transform': 'translateY(-' + themeNav + 'px)' 1015 }); 1016 $('#l-carousel .item').height(sliderHeight); 1017 1018 $('#l-carousel').hover(function () { 1019 $(this).carousel('pause'); 1020 }, function () { 1021 $(this).carousel('cycle'); 1022 }); 1023 1024 var clickEvent = false; 1025 $('#l-carousel').on('click', ' .nav#l-carousel-controls a', function () { 1026 clickEvent = true; 1027 $('.nav#l-carousel-controls li').removeClass('active'); 1028 $(this).parent().addClass('active'); 1029 }).on('slid.bs.carousel', function (e) { 1030 if (!clickEvent) { 1031 var count = $('.nav#l-carousel-controls').children().length - 1; 1032 var current = $('.nav#l-carousel-controls li.active'); 1033 current.removeClass('active').next().addClass('active'); 1034 var id = parseInt(current.data('slide-to')); 1035 if (count == id) { 1036 $('.nav#l-carousel-controls li').first().addClass('active'); 1037 } 1038 } 1039 clickEvent = false; 1040 }); 1041 1042 /*swipe*/ 1043 $(".carousel").on("touchstart", function (event) { 1044 var xClick = event.originalEvent.touches[0].pageX; 1045 $(this).one("touchmove", function (event) { 1046 var xMove = event.originalEvent.touches[0].pageX; 1047 if (Math.floor(xClick - xMove) > 5) { 1048 $(".carousel").carousel('next'); 1049 } else if (Math.floor(xClick - xMove) < -5) { 1050 $(".carousel").carousel('prev'); 1051 } 1052 }); 1053 $(".carousel").on("touchend", function () { 1054 $(this).off("touchmove"); 1055 }); 1056 }); 1057 1058 } 1059 /*evento resize finestra*/ 1060 $(window).on('resize', function () { 1061 //console.log('resize'); 1062 1063 var $windowHeight = $(window).outerHeight(); 1064 var themeNav = $('.theme-nav').outerHeight() 1065 var themePreNav = $('.l-pre-nav').outerHeight(); 1066 var sliderHeight = 600 //$windowHeight - themePreNav; 1067 //console.log($windowHeight); 1068 $('#l-carousel').height(sliderHeight); 1069 $('#l-carousel .item').height(sliderHeight); 1070 1071 //ALTEZZA BANNER 1072 //$('.l-main-banner.theme-main-banner').height(sliderHeight); 1073 //$('.main-banner-text').outerHeight(sliderHeight + 60); 1074 1075 1076 1077 }) 1078 1079 /*end carousel tab banner*/ 1080 //--------------->CREDIPER // 1081 /*lista progetti*/ 1082 var projectItem = $(".project-item"); 1083 if (projectItem.length) { 1084 1085 $(".project-item").html($(".project-item").attr("data-testo")); 1086 $(".project-item").removeAttr("data-testo") 1087 } 1088 var linkProject = $('.p-item'); 1089 linkProject.each(function () { 1090 var spanP = $(this).find('span'); 1091 var ancP = $(this).find('a'); 1092 spanP.remove(); 1093 ancP.append(spanP) 1094 }) 1095 1096 /*preventivatore su banner home*/ 1097 1098 progetto = ""; 1099 var doveSono = ""; 1100 1101 var myproject = $('.project-list li'); 1102 myproject.on('click', function () { 1103 $('.to-fill').removeClass('to-fill'); 1104 var valoreP = $(this).text(); 1105 var valoreDbP = $(this).data('progetto'); 1106 var campo = $(this).closest('.form-group').find(' input[disabled]'); 1107 campo.attr('placeholder', valoreP).attr('value', valoreP).addClass('isOk'); 1108 campo.data('progetto', valoreDbP); 1109 progetto = valoreDbP; 1110 doveSono = $(this).data('sonoin'); 1111 //alert(doveSono); 1112 }) 1113 1114 1115 var importo = $('.importo-i'); 1116 var rata = $('.rata-i'); 1117 var promo = $('#promo,.promo-i'); 1118 var widget = $('#w-address,#foot-w-address'); 1119 var invioBtn = $('.richiedi'); 1120 1121 var triggeringEnterFied = rata.add(promo).add( importo);
1122 triggeringEnterFied.keypress(function (e) { 1123 1124 var key = e.which; 1125 if (key == 13) // the enter key code 1126 { 1127 $(this).blur(); 1128 //setTimeout($('.richiedi').click(),9000); 1129 1130 //$('.richiedi').click(); 1131 if(doveSono=='menu'){ 1132 doveSono = ''; 1133 $('input').blur(); 1134 inviaRichiesta($('.richiediheaderMenu')); 1135 } 1136 else if(doveSono=='header'){ 1137 doveSono = ''; 1138 $('input').blur(); 1139 inviaRichiesta($('.richiediheader')); 1140 } 1141 else { 1142 doveSono = ''; 1143 $('input').blur(); 1144 $('.paginaInterna').click(); 1145 } 1146 return false; 1147 } 1148 }); 1149 1150 1151 importo.on('focus', function () { 1152 $('.error-target').slideUp(); 1153 $('.to-fill').removeClass('to-fill'); 1154 if ($(this).hasClass('isOk')) { 1155 $(this).removeClass('isOk'); 1156 var rawNum = $(this).attr('placeholder'); 1157 $(this).val(rawNum) 1158 } else { 1159 $(this).addClass('info-p').attr('placeholder', 'Es: 10000') 1160 } 1161 doveSono = $(this).data('sonoin'); 1162 1163 }) 1164 1165 importo.on('blur', function () { 1166 1167 if ($(this).attr('placeholder') == 'Es: 10000') { 1168 $(this).removeClass('info-p').attr('placeholder', 'Di che importo hai bisogno?'); 1169 } else if ($(this).hasClass('isOk')) { 1170 $(this).removeClass('info-p').attr('placeholder', ''); 1171 } 1172 checkIt($(this)); 1173 doveSono = $(this).data('sonoin'); 1174 1175 }) 1176 1177 1178 1179 rata.on('focus', function () { 1180 $('.error-target').slideUp(); 1181 $('.to-fill').removeClass('to-fill'); 1182 if ($(this).hasClass('isOk')) { 1183 $(this).removeClass('isOk'); 1184 var rawNum = $(this).attr('placeholder'); 1185 $(this).val(rawNum) 1186 } else { 1187 $(this).addClass('info-p').attr('placeholder', 'Es: 400') 1188 } 1189 }) 1190 1191 rata.on('blur', function () { 1192 1193 if ($(this).attr('placeholder') == 'Es: 400') { 1194 $(this).removeClass('info-p').attr('placeholder', 'Quale rata vorresti pagare?'); 1195 } else if ($(this).hasClass('isOk')) { 1196 $(this).removeClass('info-p').attr('placeholder', ''); 1197 } 1198 checkIt($(this)); 1199 doveSono = $(this).data('sonoin'); 1200 1201 }) 1202 1203 1204 1205 promo.on('focus', function () { 1206 $(this).addClass('info-p').attr('placeholder', 'Inserisci il codice'); 1207 $('.error-target').slideUp(); 1208 $('.to-fill').removeClass('to-fill'); 1209 doveSono = $(this).data('sonoin'); 1210 1211 }) 1212 1213 1214 widget.on('blur', function () { 1215 if ($(this).val() == '') { 1216 $(this).attr('placeholder', 'Cerca indirizzo, localit\u00e0 o denominazione'); 1217 1218 1219 } 1220 }) 1221 widget.on('focus', function () { 1222 $(this).attr('placeholder', ''); 1223 $(this).parent().next('.error-target').slideUp() 1224 }) 1225 1226 1227 promo.on('blur', function () { 1228 if ($(this).val() == '') { 1229 $(this).removeClass('info-p').attr('placeholder', 'Hai un codice promozionale o aziendale?') 1230 } 1231 doveSono = $(this).data('sonoin'); 1232 1233 }) 1234 1235 1236 invioBtn.on('click', function () { 1237 inviaRichiesta($(this)) 1238 }) 1239 1240 1241 var inviaRichiesta = function (el) { 1242 console.log(el) 1243 var proceed = false; 1244 var checkInput = el.closest('.richiedi-input').find('input:not([type="checkbox"])'); 1245 var checkisOk = el.closest('.richiedi-input').find('input.isOk'); 1246 console.log('checkInput -- ' + checkInput.length); 1247 console.log('checkisOk -- ' + checkisOk.length); 1248 1249 if (checkisOk.length >= checkInput.length - 1) { 1250 proceed = true; 1251 } else { 1252 var campi = el.closest('.richiedi-input').find('input:not([type="checkbox"])');//.find('input:not([data-promo])'); 1253 campi.each(function () { 1254 if ($(this)[0].id != "promo" && $(this).attr("class").indexOf("promo-i")==-1) { 1255 if (!$(this).hasClass("isOk")) { 1256 $(this).addClass('to-fill'); 1257 1258 } 1259 } 1260 }) 1261 el.prev('.error-target').text("I campi evidenziati sono obbligatori.").slideDown() 1262 //alert("Il Progetto, l'importo e la rata massima sono campi obbligatori."); 1263 proceed = false 1264 } 1265 1266 1267 console.log(proceed) 1268 var ee = el.data('previnpagina'); 1269 1270 var p = "" 1271 var i = "" 1272 var r = "" 1273 var c = "" 1274 1275 if (ee == null) { 1276 p = progetto; 1277 i = $('#importo')[0].placeholder;//$('#importo').data('importo'); 1278 r = $('#rata')[0].placeholder;//$('#rata').data('rata'); 1279 c = $('#promo').val(); 1280 } 1281 1282 if (ee == 'paginaInterna') { 1283 p = $('#hidMot').val(); 1284 1285 /*p = progetto; 1286 if (p == "") { 1287 p = $('#hidMot').val(); 1288 }*/ 1289 1290 i = $('.in-page .importo-i')[0].placeholder;//$('.in-page .importo-i').data('importo'); 1291 r = $('.in-page .rata-i')[0].placeholder;//$('.in-page .rata-i').data('rata'); 1292 c = $('.in-page .promo-i').val(); 1293 1294 } 1295 1296 if (ee == 'headerMenu') { 1297 p = progetto; 1298 i = $('.in-h-menu .importo-i')[0].placeholder;//$('.in-h-menu .importo-i').data('importo'); 1299 r = $('.in-h-menu .rata-i')[0].placeholder;//$('.in-h-menu .rata-i').data('rata'); 1300 c = $('.in-h-menu .promo-i').val(); 1301 1302 } 1303 1304 var c_nospace = c.replace(/ /g, ''); 1305 c_nospace = c_nospace.replace(/\s/g, ''); //La replace serve per risolvere il problema del campo vuoto nella variabile "queryS" 1306 1307 //La replace seguente su 'p' serve per risolvere il problema del campo vuoto nella variabile "queryS" 1308 //var queryS = 'mot=' + p + '&importo=' + i + '&iamount=' + r + '&ident=' + c_nospace; 1309 var p_nospace = p.replace(/\s/g, ''); //Tolgo gli eventuali spazi dal campo modifica 28.2.2019 1310 var queryS = 'mot=' + p_nospace + '&importo=' + i + '&iamount=' + r + '&ident=' + c_nospace; 1311 1312 if (proceed == true) { 1313 var addParamUrl = $('#hidAddParamPrev').val(); 1314 if (addParamUrl == null) addParamUrl =""; 1315 /* Problema campo vuoto addParamUrl, quindi sostituiso la seguente... 1316 window.open('/Pagine/Utility/Preventivatore/preventivatore.aspx?' + queryS + '&' + addParamUrl , '_blank'); 1317 con... 1318 */ 1319 /*Modifica per risolvere il problema del campo vuoto nella variabile "AddParamUrlCrediper in HP" */ 1320 var addParamUrl_nospace = addParamUrl.replace(/\s/g, ''); 1321 window.open('/Pagine/Utility/Preventivatore/preventivatore.aspx?' + queryS + '&' + addParamUrl_nospace , '_blank'); 1322 } 1323 } 1324 1325 1326 1327 function checkIt(fieldTocheck) { 1328 if (fieldTocheck.val() == '') { 1329 return 1330 } else if (fieldTocheck.val() > 30000 && fieldTocheck.is('[data-importo]')) { 1331 var maxValue = 30000; 1332 rewriteNum(maxValue, fieldTocheck); 1333 var errore = '<div class=\"errore-preventivo\">Importo massimo finanziabile €30.000</div>'; 1334 fieldTocheck.after(errore); 1335 $('.errore-preventivo').hide().fadeIn().delay(2000).fadeOut(400, function () { 1336 $('.errore-preventivo').remove() 1337 }) 1338 fieldTocheck.addClass('isOk'); 1339 1340 } else if (fieldTocheck.val() < 1500 && fieldTocheck.is('[data-importo]')) { 1341 var minValue = 1500; 1342 var errore = '<div class=\"errore-preventivo\">Importo minimo finanziabile €1.500</div>'; 1343 fieldTocheck.after(errore); 1344 $('.errore-preventivo').hide().fadeIn().delay(2000).fadeOut(400, function () { 1345 $('.errore-preventivo').remove() 1346 }) 1347 rewriteNum(minValue, fieldTocheck); 1348 1349 1350 fieldTocheck.addClass('isOk'); 1351 } 1352 1353 var valoreIm = fieldTocheck.val(); 1354 var patternN = /^(?:\d+(?:,\d{3})*(?:\.\d{2})?|\d+(?:\.\d{3})*(?:,\d{2})?)$/ 1355 var checkN = patternN.test(valoreIm); 1356 if (checkN == true) { 1357 rewriteNum(valoreIm, fieldTocheck) 1358 fieldTocheck.addClass('isOk'); 1359 1360 } else { 1361 var dataId = fieldTocheck.attr('id'); 1362 1363 if (dataId == undefined) { 1364 dataId = fieldTocheck.attr('class'); 1365 if (dataId.indexOf('importo-i') > -1) { 1366 dataId = 'importo'; 1367 } 1368 if (dataId.indexOf('rata-i') > -1) { 1369 dataId = 'rata'; 1370 1371 } 1372 if (dataId.indexOf('promo-i') > -1) { 1373 dataId = 'promo'; 1374 1375 } 1376 1377 } 1378 1379 //console.log('da fieldtoCheck dataID' + dataId) 1380 var dataAttr = 'data-' + dataId; 1381 //console.log('da fieldtoCheck' + dataAttr) 1382 1383 if (dataAttr != '') { 1384 var oldValue = fieldTocheck.attr(dataAttr) 1385 fieldTocheck.val(oldValue) 1386 rewriteNum(oldValue, fieldTocheck); 1387 fieldTocheck.addClass('isOk') 1388 } 1389 1390 1391 } 1392 } 1393 1394 function rewriteNum(fieldToConvert, fieldTocheck) { 1395 //console.log('arriva > ' + fieldToConvert); 1396 var rewriteN = fieldToConvert; 1397 1398 var newCurrency = ("\u20AC " + rewriteN + ",00").replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1."); 1399 fieldTocheck.val(newCurrency); 1400 fieldTocheck.attr('placeholder', rewriteN); 1401 //console.log(fieldTocheck) 1402 var dataId = fieldTocheck.attr('id'); 1403 1404 if (dataId == undefined) { 1405 dataId = fieldTocheck.attr('class'); 1406 if (dataId.indexOf('importo-i') > -1) { 1407 dataId = 'importo'; 1408 } 1409 if (dataId.indexOf('rata-i') > -1) { 1410 dataId = 'rata'; 1411 1412 } 1413 if (dataId.indexOf('promo-i') > -1) { 1414 dataId = 'promo'; 1415 1416 } 1417 1418 } 1419 1420 1421 //console.log('id---- '+ dataId) 1422 var dataAttr = 'data-' + dataId; 1423 //console.log('dataAttr---- '+ dataAttr) 1424 1425 fieldTocheck.attr(dataAttr, rewriteN) 1426 1427 } 1428 1429 1430 1431 //CREDIPER <---------------// 1432 1433 /*mega menu*/ 1434 1435 var triggerLink = $('#mega-menu-toggles>li>a:not(.btn-area-riservata)'); 1436 var triggerArea = $('#mega-menu-toggles'); 1437 var escapeBtn = $(' .btn-area-riservata ') 1438 var backDropMenu = '<div class="back-mega"></div>' 1439 var containerFake = $('.sub-mega'); 1440 1441 // var larghezza = $('#s4-workspace').width()-1200; 1442 //containerFake.css({ 1443 //'padding-left': larghezza/2, 1444 // 'padding-right': larghezza/2 1445 //}) 1446 triggerLink.on('mouseenter', function () { 1447 $('body, #s4-workspace').removeClass('no-scrolling'); 1448 $mainMenu.attr('data-open', 'false').removeClass('in'); 1449 closeMainMenu(); 1450 1451 $('.back-mega').remove() 1452 $('#s4-workspace').append(backDropMenu); 1453 1454 1455 }) 1456 triggerArea.on('mouseleave', function () { 1457 $('.back-mega').fadeOut(function () { 1458 $(this).remove() 1459 }); 1460 }) 1461 escapeBtn.on('mouseenter', function () { 1462 $('.back-mega').fadeOut(function () { 1463 $(this).remove() 1464 }); 1465 }) 1466 1467 $('#txtIndirizzo').keypress(function (e) { 1468 if (e.which == 13) { 1469 Cerca(); 1470 event.preventDefault(); 1471 } 1472 }); 1473 1474 1475var triggerBtnChild = $('.child-menu'); 1476 triggerBtnChild.on('click', function () { 1477 $(this).toggleClass('aperto'); 1478 //var leftPos = $('.t-breadcrumb-selected.child-menu').position().left; 1479 //var tabExtension = $('.t-breadcrumb-selected.child-menu').outerWidth(); 1480 //console.log('fired'); 1481$(this).find('.t-breadcrumb-sub').fadeToggle() 1482 1483 }); 1484 1485 1486}); //-- chiusura ready 1487/*jsocial*/ 1488/*! jssocials - v1.4.0 - 2016-10-10 1489 * http://js-socials.com
vendor: 10,452 bytes, lines 1490-1888
1490 * Copyright (c) 2016 Artem Tabalin; Licensed MIT */ 1491(function (window, jQuery, undefined) { 1492 1493 var JSSOCIALS = "JSSocials", 1494 JSSOCIALS_DATA_KEY = JSSOCIALS; 1495 1496 var getOrApply = function (value, context) { 1497 if (jQuery.isFunction(value)) { 1498 return value.apply(context, jQuery.makeArray(arguments).slice(2)); 1499 } 1500 return value; 1501 }; 1502 1503 var IMG_SRC_REGEX = /(\.(jpeg|png|gif|bmp|svg)jQuery|^data:image\/(jpeg|png|gif|bmp|svg\+xml);base64)/i; 1504 var URL_PARAMS_REGEX = /(&?[a-zA-Z0-9]+=)?\{([a-zA-Z0-9]+)\}/g; 1505 1506 var MEASURES = { 1507 "G": 1000000000, 1508 "M": 1000000, 1509 "K": 1000 1510 }; 1511 1512 var shares = {}; 1513 1514 function Socials(element, config) { 1515 var jQueryelement = jQuery(element); 1516 1517 jQueryelement.data(JSSOCIALS_DATA_KEY, this); 1518 1519 this._jQueryelement = jQueryelement; 1520 1521 this.shares = []; 1522 1523 this._init(config); 1524 this._render(); 1525 } 1526 1527 Socials.prototype = { 1528 url: "", 1529 text: "", 1530 shareIn: "blank", 1531 1532 showLabel: function (screenWidth) { 1533 return (this.showCount === false) ? 1534 (screenWidth > this.smallScreenWidth) : 1535 (screenWidth >= this.largeScreenWidth); 1536 }, 1537 1538 showCount: function (screenWidth) { 1539 return (screenWidth <= this.smallScreenWidth) ? "inside" : true; 1540 }, 1541 1542 smallScreenWidth: 640, 1543 largeScreenWidth: 1024, 1544 1545 resizeTimeout: 200, 1546 1547 elementClass: "jssocials", 1548 sharesClass: "jssocials-shares", 1549 shareClass: "jssocials-share", 1550 shareButtonClass: "jssocials-share-button", 1551 shareLinkClass: "jssocials-share-link", 1552 shareLogoClass: "jssocials-share-logo", 1553 shareLabelClass: "jssocials-share-label", 1554 shareLinkCountClass: "jssocials-share-link-count", 1555 shareCountBoxClass: "jssocials-share-count-box", 1556 shareCountClass: "jssocials-share-count", 1557 shareZeroCountClass: "jssocials-share-no-count", 1558 1559 _init: function (config) { 1560 this._initDefaults(); 1561 jQuery.extend(this, config); 1562 this._initShares(); 1563 this._attachWindowResizeCallback(); 1564 }, 1565 1566 _initDefaults: function () { 1567 this.url = encodeURIComponent(window.location.href.replace('&isOverlay=1','')); 1568 this.text = jQuery.trim(jQuery("meta[name=description]").attr("content") || jQuery('meta[property="og:description"]').attr('content') || jQuery("title").text()); 1569 }, 1570 1571 _initShares: function () { 1572 this.shares = jQuery.map(this.shares, jQuery.proxy(function (shareConfig) { 1573 if (typeof shareConfig === "string") { 1574 shareConfig = { 1575 share: shareConfig 1576 }; 1577 } 1578 1579 var share = (shareConfig.share && shares[shareConfig.share]); 1580 1581 if (!share && !shareConfig.renderer) { 1582 throw Error("Share '" + shareConfig.share + "' is not found"); 1583 } 1584 1585 return jQuery.extend({ 1586 url: this.url, 1587 text: this.text 1588 }, share, shareConfig); 1589 }, this)); 1590 }, 1591 1592 _attachWindowResizeCallback: function () { 1593 jQuery(window).on("resize", jQuery.proxy(this._windowResizeHandler, this)); 1594 }, 1595 1596 _detachWindowResizeCallback: function () { 1597 jQuery(window).off("resize", this._windowResizeHandler); 1598 }, 1599 1600 _windowResizeHandler: function () { 1601 if (jQuery.isFunction(this.showLabel) || jQuery.isFunction(this.showCount)) { 1602 window.clearTimeout(this._resizeTimer); 1603 this._resizeTimer = setTimeout(jQuery.proxy(this.refresh, this), this.resizeTimeout); 1604 } 1605 }, 1606 1607 _render: function () { 1608 this._clear(); 1609 1610 this._defineOptionsByScreen(); 1611 1612 this._jQueryelement.addClass(this.elementClass); 1613 1614 this._jQueryshares = jQuery("<div>").addClass(this.sharesClass) 1615 .appendTo(this._jQueryelement); 1616 1617 this._renderShares(); 1618 }, 1619 1620 _defineOptionsByScreen: function () { 1621 this._screenWidth = jQuery(window).width(); 1622 this._showLabel = getOrApply(this.showLabel, this, this._screenWidth); 1623 this._showCount = getOrApply(this.showCount, this, this._screenWidth); 1624 }, 1625 1626 _renderShares: function () { 1627 jQuery.each(this.shares, jQuery.proxy(function (_, share) { 1628 this._renderShare(share); 1629 }, this)); 1630 }, 1631 1632 _renderShare: function (share) { 1633 var jQueryshare; 1634 1635 if (jQuery.isFunction(share.renderer)) { 1636 jQueryshare = jQuery(share.renderer()); 1637 } else { 1638 jQueryshare = this._createShare(share); 1639 } 1640 1641 jQueryshare.addClass(this.shareClass) 1642 .addClass(share.share ? "jssocials-share-" + share.share : "") 1643 .addClass(share.css) 1644 .appendTo(this._jQueryshares); 1645 }, 1646 1647 _createShare: function (share) { 1648 var jQueryresult = jQuery("<div>"); 1649 var jQueryshareLink = this._createShareLink(share).appendTo(jQueryresult); 1650 1651 if (this._showCount) { 1652 var isInsideCount = (this._showCount === "inside"); 1653 var jQuerycountContainer = isInsideCount ? jQueryshareLink : jQuery("<div>").addClass(this.shareCountBoxClass).appendTo(jQueryresult); 1654 jQuerycountContainer.addClass(isInsideCount ? this.shareLinkCountClass : this.shareCountBoxClass); 1655 this._renderShareCount(share, jQuerycountContainer); 1656 } 1657 1658 return jQueryresult; 1659 }, 1660 1661 _createShareLink: function (share) { 1662 var shareStrategy = this._getShareStrategy(share); 1663 1664 var jQueryresult = shareStrategy.call(share, { 1665 shareUrl: this._getShareUrl(share) 1666 }); 1667 1668 jQueryresult.addClass(this.shareLinkClass) 1669 .append(this._createShareLogo(share)); 1670 1671 if (this._showLabel) { 1672 jQueryresult.append(this._createShareLabel(share)); 1673 } 1674 1675 jQuery.each(this.on || {}, function (event, handler) { 1676 if (jQuery.isFunction(handler)) { 1677 jQueryresult.on(event, jQuery.proxy(handler, share)); 1678 } 1679 }); 1680 1681 return jQueryresult; 1682 }, 1683 1684 _getShareStrategy: function (share) { 1685 var result = shareStrategies[share.shareIn || this.shareIn]; 1686 1687 if (!result) 1688 throw Error("Share strategy '" + this.shareIn + "' not found"); 1689 1690 return result; 1691 }, 1692 1693 _getShareUrl: function (share) { 1694 var shareUrl = getOrApply(share.shareUrl, share); 1695 return this._formatShareUrl(shareUrl, share); 1696 }, 1697 1698 _createShareLogo: function (share) { 1699 var logo = share.logo; 1700 1701 var jQueryresult = IMG_SRC_REGEX.test(logo) ? 1702 jQuery("<img>").attr("src", share.logo) : 1703 jQuery("<i>").addClass(logo); 1704 1705 jQueryresult.addClass(this.shareLogoClass); 1706 1707 return jQueryresult; 1708 }, 1709 1710 _createShareLabel: function (share) { 1711 return jQuery("<span>").addClass(this.shareLabelClass) 1712 .text(share.label); 1713 }, 1714 1715 _renderShareCount: function (share, jQuerycontainer) { 1716 var jQuerycount = jQuery("<span>").addClass(this.shareCountClass); 1717 1718 jQuerycontainer.addClass(this.shareZeroCountClass) 1719 .append(jQuerycount); 1720 1721 this._loadCount(share).done(jQuery.proxy(function (count) { 1722 if (count) { 1723 1724 jQuerycontainer.removeClass(this.shareZeroCountClass); 1725 jQuerycount.text(count); 1726 } 1727 }, this)); 1728 }, 1729 1730 _loadCount: function (share) { 1731 var deferred = jQuery.Deferred(); 1732 var countUrl = this._getCountUrl(share); 1733 1734 if (!countUrl) { 1735 return deferred.resolve(0).promise(); 1736 } 1737 1738 var handleSuccess = jQuery.proxy(function (response) { 1739 deferred.resolve(this._getCountValue(response, share)); 1740 }, this); 1741 1742 jQuery.getJSON(countUrl).done(handleSuccess) 1743 .fail(function () { 1744 jQuery.get(countUrl).done(handleSuccess) 1745 .fail(function () { 1746 deferred.resolve(0); 1747 }); 1748 }); 1749 1750 return deferred.promise(); 1751 }, 1752 1753 _getCountUrl: function (share) { 1754 var countUrl = getOrApply(share.countUrl, share); 1755 return this._formatShareUrl(countUrl, share); 1756 }, 1757 1758 _getCountValue: function (response, share) { 1759 var count = (jQuery.isFunction(share.getCount) ? share.getCount(response) : response) || 0; 1760 return (typeof count === "string") ? count : this._formatNumber(count); 1761 }, 1762 1763 _formatNumber: function (number) { 1764 jQuery.each(MEASURES, function (letter, value) { 1765 if (number >= value) { 1766 number = parseFloat((number / value).toFixed(2)) + letter; 1767 return false; 1768 } 1769 }); 1770 1771 return number; 1772 }, 1773 1774 _formatShareUrl: function (url, share) { 1775 return url.replace(URL_PARAMS_REGEX, function (match, key, field) { 1776 var value = share[field] || ""; 1777 return value ? (key || "") + window.encodeURIComponent(value) : ""; 1778 }); 1779 }, 1780 1781 _clear: function () { 1782 window.clearTimeout(this._resizeTimer); 1783 this._jQueryelement.empty(); 1784 }, 1785 1786 _passOptionToShares: function (key, value) { 1787 var shares = this.shares; 1788 1789 jQuery.each(["url", "text"], function (_, optionName) { 1790 if (optionName !== key) 1791 return; 1792 1793 jQuery.each(shares, function (_, share) { 1794 share[key] = value; 1795 }); 1796 }); 1797 }, 1798 1799 _normalizeShare: function (share) { 1800 if (jQuery.isNumeric(share)) { 1801 return this.shares[share]; 1802 } 1803 1804 if (typeof share === "string") { 1805 return jQuery.grep(this.shares, function (s) { 1806 return s.share === share; 1807 })[0]; 1808 } 1809 1810 return share; 1811 }, 1812 1813 refresh: function () { 1814 this._render(); 1815 }, 1816 1817 destroy: function () { 1818 this._clear(); 1819 this._detachWindowResizeCallback(); 1820 1821 this._jQueryelement 1822 .removeClass(this.elementClass) 1823 .removeData(JSSOCIALS_DATA_KEY); 1824 }, 1825 1826 option: function (key, value) { 1827 if (arguments.length === 1) { 1828 return this[key]; 1829 } 1830 1831 this[key] = value; 1832 1833 this._passOptionToShares(key, value); 1834 1835 this.refresh(); 1836 }, 1837 1838 shareOption: function (share, key, value) { 1839 share = this._normalizeShare(share); 1840 1841 if (arguments.length === 2) { 1842 return share[key]; 1843 } 1844 1845 share[key] = value; 1846 this.refresh(); 1847 } 1848 }; 1849 1850 1851 jQuery.fn.jsSocials = function (config) { 1852 var args = jQuery.makeArray(arguments), 1853 methodArgs = args.slice(1), 1854 result = this; 1855 1856 this.each(function () { 1857 var jQueryelement = jQuery(this), 1858 instance = jQueryelement.data(JSSOCIALS_DATA_KEY), 1859 methodResult; 1860 1861 if (instance) { 1862 if (typeof config === "string") { 1863 methodResult = instance[config].apply(instance, methodArgs); 1864 if (methodResult !== undefined && methodResult !== instance) { 1865 result = methodResult; 1866 return false; 1867 } 1868 } else { 1869 instance._detachWindowResizeCallback(); 1870 instance._init(config); 1871 instance._render(); 1872 } 1873 } else { 1874 new Socials(jQueryelement, config); 1875 } 1876 }); 1877 1878 return result; 1879 1880 }; 1881 1882 var setDefaults = function (config) { 1883 var component; 1884 1885 if (jQuery.isPlainObject(config)) { 1886 component = Socials.prototype; 1887 } else { 1888 component = shares[config];
1889 config = arguments[1] || {}; 1890 1891 } 1892 1893 jQuery.extend(component, config); 1894 }; 1895 1896 var shareStrategies = { 1897 popup: function (args) { 1898 args.shareUrl=decodeURIComponent(args.shareUrl);// CP: Inserisco per eliminare url strani 1899 1900 return jQuery("<a>").attr("href", "#") 1901 .on("click", function () { 1902 window.open(args.shareUrl, null, "width=600, height=400, location=0, menubar=0, resizeable=0, scrollbars=0, status=0, titlebar=0, toolbar=0"); 1903 return false; 1904 }); 1905 }, 1906 1907 blank: function (args) { 1908 return jQuery("<a>").attr({ 1909 target: "_blank", 1910 href: args.shareUrl 1911 }); 1912 }, 1913 1914 self: function (args) { 1915 args.shareUrl=decodeURIComponent(args.shareUrl);// CP: Inserisco per eliminare url strani 1916 return jQuery("<a>").attr({ 1917 target: "_self", 1918 //href: Indirizzo //CP: Inserisco per eliminare url strani 1919 1920 href: args.shareUrl //Originals 1921 }); 1922 } 1923 }; 1924 1925 window.jsSocials = { 1926 Socials: Socials, 1927 shares: shares, 1928 shareStrategies: shareStrategies, 1929 setDefaults: setDefaults 1930 }; 1931 1932}(window, jQuery)); 1933 1934 1935(function (window, jQuery, jsSocials, undefined) { 1936 1937 jQuery.extend(jsSocials.shares, { 1938 1939 email: { 1940 label: "E-mail", 1941 logo: "fa fa-at", 1942 shareUrl: "mailto:{to}?subject={text}&body={url}", 1943 //shareUrl: "mailto:?subject={text}&body={url}", 1944 countUrl: "", 1945 shareIn: "self" 1946 }, 1947 1948 twitter: { 1949 label: "Tweet", 1950 logo: "fa fa-twitter", 1951 shareUrl: "https://twitter.com/share?url={url}&text={text}&via={via}&hashtags={hashtags}", 1952 countUrl: "" 1953 }, 1954 1955 facebook: { 1956 label: "Like", 1957 logo: "fa fa-facebook", 1958 shareUrl: "https://facebook.com/sharer/sharer.php?u={url}", 1959 countUrl: "https://graph.facebook.com/?id={url}", 1960 getCount: function (data) { 1961 return data.share && data.share.share_count || 0; 1962 } 1963 }, 1964 1965 vkontakte: { 1966 label: "Like", 1967 logo: "fa fa-vk", 1968 shareUrl: "https://vk.com/share.php?url={url}&title={title}&description={text}", 1969 countUrl: "https://vk.com/share.php?act=count&index=1&url={url}", 1970 getCount: function (data) { 1971 return parseInt(data.slice(15, -2).split(', ')[1]); 1972 } 1973 }, 1974 1975 googleplus: { 1976 label: "+1", 1977 logo: "fa fa-google", 1978 shareUrl: "https://plus.google.com/share?url={url}", 1979 countUrl: "" 1980 }, 1981 1982 linkedin: { 1983 label: "Share", 1984 logo: "fa fa-linkedin", 1985 shareUrl: "https://www.linkedin.com/shareArticle?mini=true&text={text}&url={url}%3D17",
1986 countUrl: "https://www.linkedin.com/countserv/count/share?format=jsonp&url={url}&callback=?", 1987 getCount: function (data) { 1988 return data.count; 1989 } 1990 }, 1991 1992 pinterest: { 1993 label: "Pin it", 1994 logo: "fa fa-pinterest", 1995 shareUrl: "https://pinterest.com/pin/create/bookmarklet/?media={media}&url={url}&description={text}", 1996 countUrl: "https://api.pinterest.com/v1/urls/count.json?&url={url}&callback=?", 1997 getCount: function (data) { 1998 return data.count; 1999 } 2000 }, 2001 2002 stumbleupon: { 2003 label: "Share", 2004 logo: "fa fa-stumbleupon", 2005 shareUrl: "http://www.stumbleupon.com/submit?url={url}&title={title}", 2006 countUrl: "https://cors-anywhere.herokuapp.com/https://www.stumbleupon.com/services/1.01/badge.getinfo?url={url}", 2007 getCount: function (data) { 2008 return data.result.views; 2009 } 2010 }, 2011 2012 telegram: { 2013 label: "Telegram", 2014 logo: "fa fa-paper-plane", 2015 shareUrl: "tg://msg?text={url} {text}", 2016 countUrl: "", 2017 shareIn: "self" 2018 }, 2019 2020 whatsapp: { 2021 label: "WhatsApp", 2022 logo: "fa fa-whatsapp", 2023 shareUrl: "whatsapp://send?text={url} {text}", 2024 countUrl: "", 2025 shareIn: "self" 2026 }, 2027 2028 line: { 2029 label: "LINE", 2030 logo: "fa fa-comment", 2031 shareUrl: "http://line.me/R/msg/text/?{text} {url}", 2032 countUrl: "" 2033 }, 2034 2035 viber: { 2036 label: "Viber", 2037 logo: "fa fa-volume-control-phone", 2038 shareUrl: "viber://forward?text={url} {text}", 2039 countUrl: "", 2040 shareIn: "self" 2041 }, 2042 2043 pocket: { 2044 label: "Pocket", 2045 logo: "fa fa-get-pocket", 2046 shareUrl: "https://getpocket.com/save?url={url}&title={title}", 2047 countUrl: "" 2048 }, 2049 2050 messenger: { 2051 label: "Share", 2052 logo: "fa fa-commenting", 2053 shareUrl: "fb-messenger://share?link={url}", 2054 countUrl: "", 2055 shareIn: "self" 2056 }, 2057 2058 link: { 2059 label: "Link", 2060 logo: "fa fa-link", 2061 2062 shareUrl: function(){ 2063 2064 var url_senza_overlay = ""; 2065 2066 //Se nell'url è presente la funzionalità di Overlay 2067 if(this.url.indexOf("&isOverlay") > -1){ 2068 url_senza_overlay = this.url.replace("&isOverlay=1",""); // La rimuovo 2069 return decodeURIComponent(url_senza_overlay); 2070 } 2071 else{ //Se non sono in Overlay 2072 return decodeURIComponent(this.url); 2073 } 2074 }, 2075 //shareUrl: "{url}", 2076 countUrl: "", 2077 shareIn: "blank" 2078 /*,*/ 2079 /*Tolgo la seguente in quanto non mi interessa il contatore. 2080 Se mi interessasse devo inserire anche "showCount:true" */ 2081 /* 2082 getCount: function(data) { 2083 return data.count; 2084 } 2085 */ 2086 } 2087 2088 2089 2090 2091 }); 2092 2093}(window, jQuery, window.jsSocials)); 2094 2095 2096/* end jsocial*/ 2097 2098 2099 2100 2101/*BREADCRUMB PROVVISORIA*/ 2102 2103var menuChild = function () { 2104 var newBread = $('#new-bread'); 2105 newBread.remove(); 2106 $('.theme-breadcrumb').html(newBread); 2107 2108 if ($('#new-bread .t-breadcrumb-main .t-breadcrumb-selected').next().length) { 2109 //console.log('nodo vuoto'); 2110 $('#new-bread .t-breadcrumb-main .t-breadcrumb-selected').next().remove() 2111 }; 2112 $('.t-breadcrumb-main').contents().filter(function () { 2113 return this.nodeType === 3; 2114 }).remove(); 2115 2116 if ($(window).width() <= 480) { 2117 console.log('<=480'); 2118 var noBreadMobileIf = $(' #new-bread .t-breadcrumb-sub'); 2119 $('.theme-breadcrumb').addClass('mobile-bread'); 2120 $('.theme-breadribbon').hide(); 2121 if (noBreadMobileIf.length) { 2122 $('.l-container-sm-padding').append('<span class="toggle-bread-mobile" onclick="$(\'.theme-breadribbon \').slideToggle();$(this).find(\'b\').toggle()"><b class="piu-bread">+</b><b class="meno-bread" style="display:none; font-size: 29px; line-height:1">-</b></span>') 2123 } 2124 } 2125 2126 2127 var childMenu = $(' #new-bread .t-breadcrumb-sub'); 2128 var childMenuSelected = $('.t-breadcrumb-sub>.t-breadcrumb-selected'); 2129 2130 if (childMenu.length > 0) { 2131 //console.log('length not zero'); 2132 $('#new-bread .t-breadcrumb-main li.t-breadcrumb-selected').addClass('child-menu'); 2133 if (childMenuSelected.length > 0) { 2134 //console.log('has sub selected'); 2135 var staiQui = $('.t-breadcrumb-sub>.t-breadcrumb-selected'); 2136 staiQui.addClass('sub-selected'); 2137 $('.t-breadcrumb-main ').append(staiQui); 2138 $('.t-breadcrumb-sub').remove(); 2139 var noBreadMobileIf = $(' #new-bread .t-breadcrumb-sub'); 2140 if ($(window).width() <= 480) { 2141 //console.log('<=480 no toggle'); 2142 $('.theme-breadcrumb').hide(); 2143 $('.toggle-bread-mobile').hide(); 2144 } 2145 2146 2147 } 2148 2149 } else { 2150 $('#new-bread .t-breadcrumb-main li.t-breadcrumb-selected').addClass('no-child-menu').off('click') 2151 //console.log('length zero') 2152 } 2153 2154 2155} 2156 2157/******Rimuove dalla master page l'evento onload di body che invoca menuChild 2158 2159 2160/*END BREAD CRUMB PROVVISORIA*/ 2161function validate(evt) { 2162 var theEvent = evt || window.event; 2163 var key = theEvent.keyCode || theEvent.which; 2164 key = String.fromCharCode(key); 2165 var regex = /[0-9]|\./; 2166 if (!regex.test(key)) { 2167 theEvent.returnValue = false; 2168 if (theEvent.preventDefault) theEvent.preventDefault(); 2169 } 2170} 2171 2172/*toggle */ 2173var EspandiBanca = function (el) { 2174 2175 if ($('.singolaBanca').has('.meno')) { 2176 $('.etichettaEsplodi').removeAttr('onclick').attr('onclick', 'EspandiBanca(this)')
2177 $('.divAccordion').slideUp(); 2178 var toggleBtn = $('.singolaBanca').find('.meno') 2179 toggleBtn.toggleClass('meno'); 2180 2181 2182 } 2183 var panel = $(el).siblings('.divAccordion'); 2184 panel.slideToggle(); 2185 $(el).toggleClass('meno').removeAttr('onclick').attr('onclick', 'chiudiThis(this)') 2186 2187 2188} 2189var chiudiThis = function (el) { 2190 var panel = $(el).siblings('.divAccordion'); 2191 $('.etichettaEsplodi').removeAttr('onclick').attr('onclick', 'EspandiBanca(this)'); 2192 $(el).removeClass('meno'); 2193 panel.slideUp(); 2194} 2195var pda_decodeSPField = function (str) { 2196 return str.replace(/'/g, "'").replace(/"/g, '"').replace(/>/g, '>').replace(/</g, '<').replace(/&/g, '&'); 2197} 2198 2199/* 2200function getCORS(url, success) { 2201 var xhr = new XMLHttpRequest(); 2202 if (!('withCredentials' in xhr)) xhr = new XDomainRequest(); // fix IE8/9 2203 xhr.open('GET', url); 2204 xhr.onload = success; 2205 xhr.send(); 2206 return xhr; 2207} 2208 2209// example request 2210getCORS('http://preventivatore.crediper.collaudo.sharepoint.iccrea.bcc.it/', function(request){ 2211 var response = request.currentTarget.response || request.target.responseText; 2212 //console.log('response = ' + response); 2213 alert() 2214}); 2215 2216*/ 2217function ShowOverlay(options) { 2218 var settings = { 2219 url: "", 2220 contenuto: "", 2221 useIframe: 0 2222 }; 2223 if (options) $.extend(true, settings, options); 2224 2225 if ($('#overlay_container:visible').length > 0) { 2226 //console.log ("Modal presente in pagina"); 2227 } else { 2228 //console.log ("Pagine modali non trovate"); 2229 var overlayObject = ""; 2230 overlayObject += '<div id="overlay_container" class="l-modal modal fade" role="dialog" style="display:none;">'; 2231 overlayObject += ' <div class="modal-header" id="theme-modal-navbar" data-dismiss="modal">'; 2232 overlayObject += ' <img id="logo-gruppo-iccrea" alt="logo Gruppo ICCREA" src="/Style%20Library/DigitalIdentity/images/svg/logo-gruppo-bancario-iccrea.svg"> '; 2233 overlayObject += ' <button type="button" class="l-close" data-dismiss="modal">Ã</button>'; 2234 overlayObject += ' </div>'; 2235 overlayObject += ' <div class="modal-dialog modal-lg">'; 2236 overlayObject += ' <div class="l-modal-content ">'; 2237 overlayObject += ' <button type="button" class="l-close-desktop x-chiusura" data-dismiss="modal">Ã</button>'; 2238 overlayObject += ' <div class="l-modal-body">'; 2239 overlayObject += ' </div>'; 2240 overlayObject += ' </div>'; 2241 overlayObject += ' </div>'; 2242 overlayObject += '</div>'; 2243 $("BODY").append(overlayObject); 2244 } 2245 2246 if (settings.url != "") { 2247 2248 if (settings.useIframe == 0) { 2249 //html = "<div id='pp' class='container'><div class='col-md-12'><img src='_layouts/images/gears_anv4.gif'></div></div>"; 2250 html = "<div id='pp' class='container'><div class='col-md-12'><div class='spinner'><div class='rect1'> </div>"; 2251 html += "<div class='rect2'> </div><div class='rect3'> </div><div class='rect4'> </div><div class='rect5'> </div>"; 2252 html += " <br></div>"; 2253 $('#overlay_container div.l-modal-body').html(html); 2254 2255 2256 $.post(settings.url, function (e) { 2257 var cnt = $(e).find('[data-name="ContentPlaceHolderMain"]').html(); 2258 $('#overlay_container div.l-modal-body').html(cnt); 2259 }); 2260 } else if (settings.useIframe == 2) { 2261 2262 var $iframe = $("<iframe id='modal-iframe' src='" + settings.url + "' scrolling='no' style='visibility:hidden;width:100%;transition:width .3s, height .3s;'></iframe>").on('load', function () { 2263 var clientDoc = $('#modal-iframe')[0].contentDocument; 2264 $('#overlay_container div.l-modal-body').find('#pp').remove(); 2265 $(clientDoc).find('#s4-workspace').css('overflow-y', 'hidden'); 2266 var newH = $(clientDoc).find('#s4-bodyContainer').height(); 2267 $(this).css('height', newH + 'px'); 2268 $(this).css('visibility', ''); 2269 }); 2270 //html = "<div id='pp' class='container'><div class='col-md-12 t-risultati-ricerca-waiting'><img src='_layouts/images/gears_anv4.gif'></div></div>"; 2271 html = "<div id='pp' class='container'><div class='col-md-12'><div class='spinner'><div class='rect1'> </div>"; 2272 html += "<div class='rect2'> </div><div class='rect3'> </div><div class='rect4'> </div><div class='rect5'> </div>"; 2273 html += " <br></div>"; 2274 $('#overlay_container div.l-modal-body').html(html); 2275 $('#overlay_container div.l-modal-body').append($iframe); 2276 } else { 2277 var $iframe = $("<iframe id='modal-iframe' src='" + settings.url + "' style='visibility:hidden; transition:width .3s, height .3s;'></iframe>").on('load', function () {
2278 var clientDoc = $('#modal-iframe')[0].contentDocument; 2279 $('#overlay_container div.l-modal-body').find('#pp').remove(); 2280 var cnt = ""; 2281 $(clientDoc).find('.t-overlay-content').each(function () { 2282 cnt += $(this).html() 2283 }); 2284 $('#overlay_container div.l-modal-body').html(cnt); 2285 }); 2286 //html = "<div id='pp' class='container'><div class='col-md-12 t-risultati-ricerca-waiting'><img src='_layouts/images/gears_anv4.gif'></div></div>"; 2287 html = "<div id='pp' class='container'><div class='col-md-12'><div class='spinner'><div class='rect1'> </div>"; 2288 html += "<div class='rect2'> </div><div class='rect3'> </div><div class='rect4'> </div><div class='rect5'> </div>"; 2289 html += " <br></div>"; 2290 $('#overlay_container div.l-modal-body').html(html); 2291 $('#overlay_container div.l-modal-body').append($iframe); 2292 } 2293 } else if (settings.contenuto != "") { 2294 $('#overlay_container div.l-modal-body').html(settings.contenuto); 2295 } 2296 2297 if ($('#overlay_container:visible').length == 0) { 2298 if (settings.modalType) $('#overlay_container').addClass('overlay-' + settings.modalType); 2299 $('#overlay_container').on('hidden.bs.modal', function (e) { 2300 $('BODY').find('#overlay_container').remove(); 2301 }) 2302 $('#overlay_container').modal('show'); 2303 if (settings.modalType) { 2304 if (settings.modalType == 'person') { 2305 $('DIV.modal-backdrop').css('background-color', '#264d7a').css('opacity', '1'); 2306 } 2307 } 2308 } else { 2309 var oo = getUrlParams(); 2310 if (oo["isOverlay"]) HideOverlay(); 2311 } 2312} 2313 2314function HideOverlay() { 2315 $('#overlay_container').modal('hide'); 2316} 2317 2318function ShowModalPopup(options) { 2319 var settings = { 2320 contenuto: "" 2321 }; 2322 if (options) $.extend(true, settings, options); 2323 2324 if ($('#overlay_container:visible').length > 0) { 2325 //console.log ("Modal presente in pagina"); 2326 } else { 2327 //console.log ("Pagine modali non trovate"); 2328 var overlayObject = ""; 2329 overlayObject += '<div id="overlay_container" class="l-modal modal fade" role="dialog" style="display:none;">'; 2330 overlayObject += ' <div class="modal-dialog t-modal-center">'; 2331 overlayObject += ' <div class="l-modal-content center-block">'; 2332 overlayObject += ' <div class="l-modal-body t-modal-feedback">'; 2333 overlayObject += ' </div>'; 2334 overlayObject += ' </div>'; 2335 overlayObject += ' </div>'; 2336 overlayObject += '</div>'; 2337 $("BODY").append(overlayObject); 2338 } 2339 if (settings.contenuto != "") { 2340 $('#overlay_container div.l-modal-body').html(settings.contenuto); 2341 } 2342 2343 if ($('#overlay_container:visible').length == 0) { 2344 if (settings.modalType) $('#overlay_container').addClass('overlay-' + settings.modalType); 2345 $('#overlay_container').on('hidden.bs.modal', function (e) { 2346 $('BODY').find('#overlay_container').remove(); 2347 }) 2348 $('#overlay_container').modal({ 2349 backdrop: 'static', 2350 keyboard: false 2351 }); 2352 } 2353} 2354 2355function getUrlParams() { 2356 var vars = [], 2357 hash; 2358 var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); 2359 for (var i = 0; i < hashes.length; i++) { 2360 hash = hashes[i].split('='); 2361 vars.push(hash[0]); 2362 vars[hash[0]] = hash[1]; 2363 } 2364 return vars; 2365} 2366 2367/* --- fine gestione overlay --- */ 2368function apriOverlayLocalizzami() 2369{ 2370 $.getScript( "https://maps.googleapis.com/maps/api/js?key=AIzaSyAyqLS4cgQfsSRGhfFeBNprkF74SvDrv3c&v=3.exp&sensor=false&libraries=places", function( data, textStatus, jqxhr ) { 2371 console.log( data ); // Data returned 2372 console.log( textStatus ); // Success 2373 console.log( jqxhr.status ); // 200 2374 console.log( "Load was performed." ); 2375 2376 localizzamiClick = true; 2377 infoWindow = new google.maps.InfoWindow; 2378 2379 2380 if (navigator.geolocation) { 2381 navigator.geolocation.getCurrentPosition(function(position) { 2382 var pos = { 2383 lat: position.coords.latitude, 2384 lng: position.coords.longitude 2385 }; 2386 geoLat = position.coords.latitude; 2387 geoLng = position.coords.longitude 2388 center = pos; 2389 2390 infoWindow.setPosition(pos); 2391 //infoWindow.setContent('Ti tovi qui. Lat:' + geoLat + ' - Long:' + geoLng); 2392 //infoWindow.setContent('Ti tovi qui.' ); 2393 2394 //infoWindow.open(map); 2395 2396 2397 var geocoder = new google.maps.Geocoder(); 2398 //var localizza = address.value; 2399 2400 //var latlng = {lat: parseFloat(41.83368300893637), lng: parseFloat(12.578589688953944)}; 2401 var latlng = {lat: parseFloat(geoLat), lng: parseFloat(geoLng)}; 2402 2403 2404 geocoder.geocode({'location': latlng }, function(results, status) { 2405 if (status === 'OK') { 2406 if (results[0]) { 2407 2408 2409 var options = { 2410 url: '/Pagine/Utility/CercaFiliale/cerca-filiale.aspx?isOverlay=1&sch=' + results[0].formatted_address, 2411 width: 1200, 2412 height: 780, 2413 allowMaximize: false, 2414 showClose: true 2415 }; 2416 2417 SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options); 2418 2419 } else { 2420 //window.alert('No results found'); 2421 window.alert('Geolocalizzazione fallita: impossibile risalire ad un indirizzo valido.'); 2422 } 2423 } else { 2424 //window.alert('Geocoder failed due to: ' + status); 2425 window.alert('Geolocalizzazione fallita: possibile che il servizio non sia al momento raggiungibile. Riprovare piu tardi.'); 2426 2427 } 2428 }); 2429 2430 2431 2432 2433 }, function() { 2434 handleLocationError(true, infoWindow, map.getCenter()); 2435 }); 2436 } else { 2437 // Browser doesn't support Geolocation 2438 handleLocationError(false, infoWindow, map.getCenter()); 2439 } 2440 2441 }); 2442 2443 2444 2445 2446 /*var options = { 2447 url: '/Pagine/Utility/CercaFiliale/cerca-filiale.aspx?local=1&isOverlay=1&sch=1', 2448 width: 1200, 2449 height: 780, 2450 allowMaximize: false, 2451 showClose: true 2452 }; 2453 2454 SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);*/ 2455 2456} 2457 2458function apriOverlay(ee, btn) { 2459 2460 if (ee != "") { 2461 var options = { 2462 url: '/Pagine/Utility/CercaFiliale/cerca-filiale.aspx?isOverlay=1&sch=' + ee, 2463 width: 1200, 2464 height: 780, 2465 allowMaximize: false, 2466 showClose: true 2467 }; 2468 2469 SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options); 2470 } else { 2471 /*var errore= $('#error-msg'); 2472 errore.text("Occorre indicare un indirizzo o località .").fadeIn(); 2473 setTimeout(function(){ 2474 errore.fadeOut(function(){ 2475 errore.text('')}) 2476 },5500);*/ 2477 if (btn == 'pagina') { 2478 //console.log('dalla pagina ' + ee)
2479 $('.widget-filiale').slideDown(); 2480 } 2481 if (btn == 'footer') { 2482 $('.footer-w').slideDown(); 2483 //console.log('dal footer ' + ee) 2484 } 2485 if (btn == 'mobile-footer') { 2486 var options = { 2487 url: '/Pagine/Utility/CercaFiliale/cerca-filiale.aspx?isOverlay=1&sch=' + ee, 2488 width: 1200, 2489 height: 780, 2490 allowMaximize: false, 2491 showClose: true 2492 }; 2493 2494 SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options); 2495 2496 } 2497 //alert("Occorre indicare un indirizzo o denominazione."); 2498 2499 } 2500 //SP.UI.ModalDialog.showModalDialog(options); 2501} 2502 2503function inviaRichiestaFuori(el) { 2504 console.log(el) 2505 var proceed = false; 2506 var checkInput = el.closest('.richiedi-input').find('input:not([type="checkbox"])'); 2507 var checkisOk = el.closest('.richiedi-input').find('input.isOk'); 2508 console.log('checkInput -- ' + checkInput.length); 2509 console.log('checkisOk -- ' + checkisOk.length); 2510 2511 if (checkisOk.length >= checkInput.length - 1) { 2512 proceed = true; 2513 } else { 2514 var campi = el.closest('.richiedi-input').find('input:not([type="checkbox"])');//.find('input:not([data-promo])'); 2515 campi.each(function () { 2516 if ($(this)[0].id != "promo" && $(this).attr("class").indexOf("promo-i")==-1) { 2517 if (!$(this).hasClass("isOk")) { 2518 $(this).addClass('to-fill'); 2519 2520 } 2521 } 2522 }) 2523 el.prev('.error-target').text("I campi evidenziati sono obbligatori.").slideDown() 2524 //alert("Il Progetto, l'importo e la rata massima sono campi obbligatori."); 2525 proceed = false 2526 } 2527 2528 2529 console.log(proceed) 2530 var ee = el.data('previnpagina'); 2531 2532 var p = progetto; 2533 var i = $('#importo').data('importo'); 2534 var r = $('#rata').data('rata'); 2535 var c = $('#promo').val(); 2536 2537 if (ee == 'paginaInterna') { 2538 p = progetto; 2539 if (p == "") { 2540 p = $('#hidMot').val(); 2541 } 2542 2543 i = $('.in-page .importo-i').data('importo'); 2544 r = $('.in-page .rata-i').data('rata'); 2545 c = $('.in-page .promo-i').val(); 2546 2547 } 2548 2549 if (ee == 'headerMenu') { 2550 p = progetto; 2551 i = $('.in-h-menu .importo-i').data('importo'); 2552 r = $('.in-h-menu .rata-i').data('rata'); 2553 c = $('.in-h-menu .promo-i').val(); 2554 2555 } 2556 2557 var c_nospace = c.replace(/ /g, ''); 2558 c_nospace = c_nospace.replace(/\s/g, ''); //La replace serve per risolvere il problema del campo vuoto nella variabile "queryS" 2559 2560 //La replace seguente su 'p' serve per risolvere il problema del campo vuoto nella variabile "queryS" 2561 //var queryS = 'mot=' + p + '&importo=' + i + '&iamount=' + r + '&ident=' + c_nospace; 2562 var p_nospace = p.replace(/\s/g, ''); //Tolgo gli eventuali spazi dal campo modifica 28.2.2019 2563 var queryS = 'mot=' + p_nospace + '&importo=' + i + '&iamount=' + r + '&ident=' + c_nospace; 2564 2565 if (proceed == true) { 2566 window.location.assign('/Pagine/Utility/Preventivatore/preventivatore.aspx?' + queryS); 2567 2568 } 2569}
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.