1/* Source and licensing information for the line(s) below can be found at https://www.fus.edu/themes/custom/fus/js/main.js. */ 2var pathArray = window.location.pathname.split('/'); 3//var resolution="desktop"; 4/* 5======================= 6DEBUG 7*/ 8var debug_attivo = false; //false 9console.todo = function (msg) { 10 if (debug_attivo) { 11 console.log('%c ' + msg + '', 'background: #ffcccc; color: #000; padding:5px'); 12 } 13} 14 15console.important = function (msg) { 16 if (debug_attivo) { 17 console.log('%c ' + msg + '', 'background: #cc0000; color: #fff; padding:5px'); 18 } 19} 20 21console.normal = function (msg) { 22 if (debug_attivo) { 23 console.log('%c ' + msg + '', 'background: #cccccc; color: #333333; padding:5px'); 24 } 25} 26 27 28// JavaScript Document 29var checkReadyState = setInterval(() => { 30 if (document.readyState === "complete") { 31 clearInterval(checkReadyState); 32 //console.normal('Page is loaded.'); 33 34 (function ($) { 35 $("body").removeClass("body_preload"); 36 37 38 //inizio JS 39 40 /* scroll reveal */ 41 /*var slideDown = { 42 distance: '150%', 43 origin: 'top', 44 opacity: null 45 }; 46 ScrollReveal().reveal('.fus_header_menu',slideDown); 47 */ 48 //show/hide menu 49 var scrollTimer, lastScrollFireTime = 0; 50 var prevScrollpos = window.pageYOffset; 51 var tab1 = $(".fus_tab_wrapperone").position(); 52 if(tab1) { 53 var tab1Position = tab1.top; 54 } 55 56 $(window).on('scroll', function() { 57 58 var minScrollTime = 100; 59 var now = new Date().getTime(); 60 61 function processScroll() { 62 //qui metto tutte le funzioni che mi servono 63 var currentScrollPos = window.pageYOffset; 64 if (prevScrollpos > currentScrollPos) { 65 $("body").removeClass("menu_nascondi"); 66 } else { 67 if(currentScrollPos>100){ 68 $("body").addClass("menu_nascondi"); 69 } 70 } 71 var headerMenu = $(".fus_header_menu").height(); 72 var headerMenuDiff = tab1Position-headerMenu; 73 if (currentScrollPos > headerMenuDiff) { 74 $("body").addClass("tab1_fisso"); 75 } else { 76 $("body").removeClass("tab1_fisso"); 77 } 78 79 //landing 2021 80 if($("body").hasClass("node-type-landing_page_2021")) { 81 var altezza1 = $(".lp_header").outerHeight(); 82 var altezza2 = $(".lp_first_block").outerHeight(); 83 var altezza3 = altezza1 + altezza2; 84 if (currentScrollPos > altezza3) { 85 $("body").addClass("lp_button_show"); 86 } else { 87 $("body").removeClass("lp_button_show"); 88 } 89 } 90 91 //strategic planning 92 if ($(".strategic_planner").length > 0) { 93 94 if ($(window).scrollTop() > $(window).height()) { 95 $('body').addClass('strategic_planner_back_top'); 96 } else { 97 $('body').removeClass('strategic_planner_back_top'); 98 } 99 100 var windowHeight = $(window).height(); // Altezza della finestra di visualizzazionef 101 var scrollPosition = $(window).scrollTop(); // Posizione attuale dello scroll 102 var elementPosition = $('.strategic_planner').offset().top; // Posizione dell'elemento rispetto al top del documento 103 var elementHeight = $('.strategic_planner').outerHeight(); // Altezza dell'elemento 104 105 var risu_ltato = (elementPosition + elementHeight - windowHeight + elementPosition); 106 // Verifica se l'elemento è sparito dalla visualizzazione 107 if (scrollPosition > risu_ltato) { 108 // L'elemento non è visibile: assegna una classe al body 109 $('body').addClass('strategic_planner_menu'); 110 } else { 111 // L'elemento è visibile: rimuovi la classe dal body (se presente) 112 $('body').removeClass('strategic_planner_menu'); 113 } 114 //console.log("qui > " + windowHeight + " - " + scrollPosition + "/"+ risu_ltato+" + " + elementPosition + " / " + elementHeight); 115 } 116 117 prevScrollpos = currentScrollPos; 118 //console.log(new Date().getTime().toString()); 119 /*if(window.innerWidth <= 768){ 120 resolution="mobile"; 121 } else { 122 resolution="desktop"; 123 }*/ 124 } 125 126 127 // Verifica se lo scroll non è stato innescato programmaticamente 128 if (!isProgrammaticScroll) { 129 if (!scrollTimer) { 130 if (now - lastScrollFireTime > (3 * minScrollTime)) { 131 processScroll(); // esegue immediatamente al primo scroll
132 lastScrollFireTime = now; 133 } 134 scrollTimer = setTimeout(function() { 135 scrollTimer = null; 136 lastScrollFireTime = new Date().getTime(); 137 processScroll(); 138 }, minScrollTime); 139 } 140 } 141 }); 142 if ($.fn.slick) { 143 //slider HP SOTTO 144 $(".hp_research_publication_publication_slide").slick({ 145 /*infinite: true, 146 arrows: true,*/ 147 dots: true, 148 autoplay: true, 149 speed: 1500, 150 autoplaySpeed:6000, 151 /*slidesToShow: 1, 152 slidesToScroll: 1,*/ 153 appendDots: $(".hp_research_publication_publication"), 154 swipeToSlide: true, 155 /*adaptiveHeight: true,*/ 156 }); 157 158 //slider PARAGRAFI SLIDER 159 $(".fus_para_slider").slick({ 160 /*infinite: true,*/ 161 arrows: false, 162 dots: true, 163 autoplay: true, 164 speed: 1500, 165 autoplaySpeed:6000, 166 /*slidesToShow: 1, 167 slidesToScroll: 1,*/ 168 //appendDots: $(".hp_research_publication_publication"), 169 swipeToSlide: true, 170 adaptiveHeight: true, 171 172 }); 173 //LANDING 2021 174 $(".lp_alumni_para, .lp_alumni_paraold").slick({ 175 infinite: true, 176 arrows: true, 177 dots: true, 178 autoplay: true, 179 fade:false, 180 speed: 1500, 181 slidesToShow: 2, 182 slidesToScroll: 1, 183 swipeToSlide: true, 184 //appendDots: $(".hp_research_publication_publication"), 185 responsive: [ 186 { 187 breakpoint: 1024, 188 settings: { 189 slidesToShow: 2 190 } 191 }, 192 { 193 breakpoint: 768, 194 settings: { 195 slidesToShow: 1 196 } 197 } 198 ] 199 }); 200 201 //slider GALLERY ACADEMIC TRAVEL 202 $(".fus_gallery_slide").slick({ 203 infinite: true, 204 arrows: true, 205 dots: false, 206 autoplay: true, 207 variableWidth: true, 208 fade:false, 209 speed: 1500, 210 slidesToShow: 2, 211 slidesToScroll: 1, 212 swipeToSlide: true, 213 responsive: [ 214 { 215 breakpoint: 1024, 216 settings: { 217 slidesToShow: 2 218 } 219 }, 220 { 221 breakpoint: 768, 222 settings: { 223 slidesToShow: 1 224 } 225 } 226 ] 227 }); 228 //slider HP ACADEMIC TRAVEL 229 $(".fus-at-hp-gallery").slick({ 230 infinite: true, 231 arrows: true, 232 dots: false, 233 autoplay: true, 234 fade:false, 235 speed: 1500, 236 slidesToShow: 2, 237 slidesToScroll: 1, 238 swipeToSlide: true, 239 responsive: [ 240 { 241 breakpoint: 1024, 242 settings: { 243 slidesToShow: 2 244 } 245 }, 246 { 247 breakpoint: 768, 248 settings: { 249 slidesToShow: 1 250 } 251 } 252 ] 253 }); 254 //slider HP ALUMNI 255 $(".hp_alumni_slider .hpalumni_image").slick({ 256 infinite: true, 257 arrows: false, 258 dots: false, 259 autoplay: true, 260 fade:true, 261 speed: 1500, 262 slidesToShow: 1, 263 slidesToScroll: 1, 264 swipeToSlide: true, 265 }); 266 } 267 268 /* stile alle immagini */ 269 $("img.align-right").each(function() { 270 $(this).wrapAll("<div class=\"img_border align-right\">").removeClass("align-right"); 271 }) 272 $("img.align-left").each(function() { 273 $(this).wrapAll("<div class=\"img_border align-left\">").removeClass("align-left"); 274 }) 275 276 277 278 279 280 /* menu responsive */ 281 $(".fus_menu_responsive").on("click", function() { 282 $("body").toggleClass("fus_resp_aperto"); 283 }); 284 285 $(".fus_responsive_menu li.fus_expanded span, .fus_responsive_menu .fus_resp_service_menu li.fus_expanded > a").on("click", function(e) { 286 e.preventDefault(); 287 if($(this).parent().hasClass("fus_in_active_trail")) {//se è già a perto 288 $(this).parent().children("ul:first").slideToggle(200); 289 } else {//se non è ancora aperto... 290 $(this).parent().toggleClass("fus_responsive_menu_li_open"); 291 $(this).parent().children("ul:first").slideToggle(200); 292 } 293 }); 294 //search responsive menu 295 $(".fus_responsive_menu .fus_menu_search").parent().addClass("fus_menu_search_resp_li") 296 297 //tab responsive 298 if($(".fus_menu_responsive").is(":visible")) { 299 /* fix tab undergraduate*/ 300 $(".node-type-graduate .fus_tabs a.is-active").parent().addClass("fus_in_active_trail"); 301 $(".node-type-division .fus_tabs a.is-active").parent().addClass("fus_in_active_trail"); 302 303 $(".fus_tabs ul li.fus_in_active_trail").parent().prepend($(".fus_tabs ul li.fus_in_active_trail")); 304 $(".fus_tab_level2 ul li.fus_in_active_trail").parent().prepend($(".fus_tab_level2 ul li.fus_in_active_trail")); 305 $(".fus_tabs .fus_in_active_trail").on("click", function(event) { 306 event.preventDefault(); 307 $(".fus_tabs").toggleClass("fus_tabs_open"); 308 }); 309 $(".fus_tab_level2 .fus_in_active_trail").on("click", function(event) { 310 event.preventDefault(); 311 $(".fus_tab_level2").toggleClass("fus_tab_level2_open"); 312 }); 313 } 314 315 316 var id_cliccato=""; 317 /* MEGAMENU */ 318 $(".menu_generale").on("click", function() { 319 //recupero id cliccato 320 id_cliccato = $(this).attr("id"); 321 //console.normal("abbiamo cliccato su > "+id_cliccato); 322 //controllo se il megamenu è aperto, in caso positivo controllo cosa sia aperto, se è uguale lo chiudo, altrimenti cambiamo! 323 $("body").removeClass("fus_class_menu_1 fus_class_menu_2 fus_class_menu_3 fus_class_menu_4 fus_class_menu_5 fus_class_menu_6 fus_class_menu_7 fus_class_menu_8 fus_class_menu_9 fus_class_menu_10"); 324 $(".fus_class_intro_interno_muovi").removeClass("fus_class_intro_interno_muovi");//resetto major 325 $(".fus_mm_2_spostato").removeClass("fus_mm_2_spostato");//resetto major 326 $(".fus_class_menu_major").removeClass("fus_class_menu_major");//resetto major 327 if($("body").hasClass("body_"+id_cliccato)) { 328 //qui devo chiudere il megamenu rimuovendo le varie classi! 329 $("body").removeClass("megamenu_aperto body_"+id_cliccato); 330 $(this).removeClass("menu_generale_attivo"); 331 } else { 332 //aggiungo classe al bottone clcicato e priam tolgo tutte le altre 333 $(".menu_generale_attivo").removeClass("menu_generale_attivo"); 334 $(this).addClass("menu_generale_attivo"); 335 $("body").addClass("fus_class_menu_1"); 336 //qui apro quello cliccato o cambio! 337 if($("body").hasClass("megamenu_aperto")) { 338 //qui il megamenu è aperto, quindi dobbiamo cambiare il pannello mostrato 339 $("body").removeClass("body_menu_about_us body_menu_academics body_menu_admission body_menu_campus body_menu_services"); 340 $("body").addClass("body_"+id_cliccato); 341 } else { 342 //qui dobbiamo aprire tutto megamenu! 343 $("body").removeClass("body_menu_about_us body_menu_academics body_menu_admission bodymenu__campus bodymenu__services"); 344 //setto menu aperto 345 $("body").addClass("megamenu_aperto body_"+id_cliccato); 346 } 347 } 348 }); 349 350 $(".megamenu_internal").on("click", function() {//major 351 $(this).parent().parent().addClass("fus_class_intro_interno_muovi"); 352 $(".fus_mm_2").addClass("fus_mm_2_spostato"); 353 $(".fus_class_menu").addClass("fus_class_menu_major") 354 return false;
355 }); 356 357 $(".fus_class_second_1").on("click", function() { 358 $(".fus_class_intro_interno_muovi").removeClass("fus_class_intro_interno_muovi");//resetto major 359 $(".fus_mm_2_spostato").removeClass("fus_mm_2_spostato");//resetto major 360 $(".fus_class_menu_major").removeClass("fus_class_menu_major");//resetto major 361 }); 362 363 //funzioni per aprire i sottomenu! 364 $(".fus_class_menu div").on("click", function() { 365 $(".fus_class_intro_interno_muovi").removeClass("fus_class_intro_interno_muovi");//resetto major 366 $(".fus_mm_2_spostato").removeClass("fus_mm_2_spostato");//resetto major 367 $(".fus_class_menu_major").removeClass("fus_class_menu_major");//resetto major 368 $("body").removeClass("fus_class_menu_1 fus_class_menu_2 fus_class_menu_3 fus_class_menu_4 fus_class_menu_5 fus_class_menu_6 fus_class_menu_7 fus_class_menu_8 fus_class_menu_9 fus_class_menu_10").addClass($(this).attr("class")); 369 }); 370 371 372 //division 373 //dobbiamo controllare se nell'url c'è l'hashtag e mandarlo alla pagina corrispondente... 374 375 if($("body").hasClass("node-type-division") || $("body").hasClass("node-type-graduate")) { 376 if(window.location.hash) { 377 var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character 378 //console.log(hash); 379 setTimeout(function() {document.getElementById("id_"+hash).click();}, 500) 380 } 381 } 382 383 // ACCORDION HP 384 if($('.hp_academics_accordion').css('display') == 'none') { 385 $('.hp_academics_single_title').on("click",function(){ 386 var questo = $(this); 387 var accordion = questo.next('.hp_academics_accordion'); 388 389 if (accordion.is(':visible')) { 390 accordion.slideUp(); 391 } else { 392 $('.hp_academics_accordion:visible').slideUp(); 393 accordion.slideDown(); 394 } 395 }); 396 } 397 398 399 //gallery 400 /*if ($('.paragraph--type--gallery .fus_gallery').length) { 401 if ($('.paragraph--type--gallery .fus_gallery_title').length) { 402 //console.log("qui para"); 403 $('.fus_gallery_title').each(function() { 404 var galleryTitle = $(this).text(); 405 //console.log("qui para trovo"+galleryTitle); 406 $(this).next('.fus_gallery').find('h2').text(galleryTitle); 407 }); 408 } else { 409 $('.fus_gallery').find('h2').text(""); 410 } 411 }*/ 412 413 414 //BLOG 415 416 if($("body").hasClass("path-blog")) { 417 //console.log("sono qui") 418 var d = new Date(); 419 var i; 420 var anno_year = d.getFullYear() 421 var ciclo_anni = ""; 422 for (i = anno_year; i >= 2020; i--){ 423 ciclo_anni += "<option value='"+i+"'>"+i+"</option>"; 424 } 425 426 setTimeout(function() { 427 jQuery("#edit-field-date-value").replaceWith('<select id="edit-field-date-value" name="field_date_value"><option value="">YEAR</option>' +ciclo_anni + '</select>')},500); 428 } 429 430 //VISTA BLOG 431 if($("body").hasClass("path-blog") || $("body").hasClass("node-type-blog_post")) { 432 $(".fus_blog_single_readmore a").each(function(e) { 433 var link_blog = $(this).attr("href"); 434 $(this).parent().parent().find(".fus_blog_single_image").wrap("<a href='"+link_blog+"' class='fus_blog_link_image'></a>"); 435 }) 436 } 437 438 //close submenu 439 $(".fus_header_megamenu_close").on("click", function() { 440 $("body").removeClass("megamenu_aperto body_"+id_cliccato); 441 $(".menu_generale_attivo").removeClass("menu_generale_attivo"); 442 }); 443 444 $(document).on('click', function(event) { 445 if (!$(event.target).closest('.fus_header_fixed').length) { 446 $("body").removeClass("megamenu_aperto body_"+id_cliccato); 447 $(".menu_generale_attivo").removeClass("menu_generale_attivo"); 448 } 449 }); 450 451 //majors 452 $(".open_majors").on("click", function() { 453 $(this).parent().toggleClass("fus_major_elenco_aperto"); 454 }) 455 456 /*espansione accordion HP*/ 457 $(".hp_we_are_fus_text > div > div:first-child").on("click", function() { 458 $(this).next().slideToggle(); 459 $(this).parent().toggleClass("hp_we_are_fus_text_open"); 460 }) 461 462 //academic travel more 463 $(".fus_at_block_text div:first-child").on("click", function() { 464 $(this).next().slideToggle(); 465 $(this).parent().toggleClass("fus_at_block_text_open"); 466 }); 467 468 //graduate more 469 $(".fus_graduate_flex_block_dx div:first-child").on("click", function() { 470 $(this).next().slideToggle(); 471 $(this).parent().toggleClass("fus_at_block_text_open"); 472 }); 473 474 //tab graduate 475 $(".fus_tab_graduate_link").on("click", function() { 476 var tabId=$(this).attr("rel"); 477 console.normal("tab > "+tabId); 478 $(".is-active").removeClass("is-active"); 479 $(".tab_selected").removeClass("tab_selected"); 480 $(this).addClass("is-active"); 481 $(".fus_graduate_"+tabId).addClass("tab_selected"); 482 //tab responsive 483 if($(".fus_menu_responsive").is(":visible")) { 484 $(".fus_tabs_open").removeClass("fus_tabs_open"); 485 $(".fus_in_active_trail").removeClass("fus_in_active_trail"); 486 $(this).parent().addClass("fus_in_active_trail"); 487 $(".fus_tabs ul li.fus_in_active_trail").parent().prepend($(".fus_tabs ul li.fus_in_active_trail")); 488 /*$(".fus_tabs .fus_in_active_trail").on("click", function(event) { 489 event.preventDefault(); 490 $(".fus_tabs").toggleClass("fus_tabs_open"); 491 });*/ 492 } 493 setTimeout(function() {goToByScroll(".fus_submenu")},400); 494 //qui facciamo partire le slide 495 if(tabId=="tab_highlights") { 496 //slider DIVISION - Highlights 497 $(".fus_slider_highlights").slick({ 498 /*infinite: true, 499 arrows: true,*/ 500 dots: true, 501 arrows:false, 502 autoplay: true, 503 speed: 1500, 504 autoplaySpeed:6000, 505 slidesToShow: 1, 506 slidesToScroll: 1, 507 appendDots: $(".fus_div_bullet_highlights"), 508 swipeToSlide: true, 509 //adaptiveHeight: true, 510 }); 511 } 512 if(tabId=="tab_publications") { 513 //slider DIVISION - Publications 514 $(".fus_slider_publications").slick({ 515 /*infinite: true, 516 arrows: true,*/ 517 dots: true, 518 arrows:false, 519 autoplay: true, 520 speed: 1500, 521 autoplaySpeed:6000, 522 slidesToShow: 1, 523 slidesToScroll: 1, 524 appendDots: $(".fus_div_bullet_publications"), 525 swipeToSlide: true, 526 //adaptiveHeight: true, 527 }); 528 } 529 }); 530 531 //para accordion 532 $(".fus_para_accordion_title").on("click", function() { 533 if($(this).parent().parent().hasClass("fus_para_accordion_selected")) {//sono all'interno di un accordion già aperto! Attenzione!! 534 if($(this).hasClass("fus_para_accordion_title_open")) { 535 $(this).removeClass("fus_para_accordion_title_open"); 536 $(this).next().slideUp(300).removeClass("fus_para_accordion_selected"); 537 } else {
538 //$(".fus_para_accordion_selected").slideUp(300).removeClass("fus_para_accordion_selected"); 539 //$(".fus_para_accordion_title_open").removeClass("fus_para_accordion_title_open"); 540 $(this).addClass("fus_para_accordion_title_open"); 541 $(this).next().slideDown(300).addClass("fus_para_accordion_selected"); 542 var className = '.'+$(this).attr('class').split(' ').join('.') 543 setTimeout(function() {goToByScroll(className)},400); 544 } 545 } else {//accordion singolo! 546 if($(this).hasClass("fus_para_accordion_title_open")) { 547 $(".fus_para_accordion_selected").slideUp(300).removeClass("fus_para_accordion_selected"); 548 $(".fus_para_accordion_title_open").removeClass("fus_para_accordion_title_open"); 549 } else { 550 $(".fus_para_accordion_selected").slideUp(300).removeClass("fus_para_accordion_selected"); 551 $(".fus_para_accordion_title_open").removeClass("fus_para_accordion_title_open"); 552 $(this).addClass("fus_para_accordion_title_open"); 553 $(this).next().slideDown(300).addClass("fus_para_accordion_selected"); 554 var className = '.'+$(this).attr('class').split(' ').join('.'); 555 //console.log("classname" + className); 556 setTimeout(function() {goToByScroll(className)},400); 557 } 558 } 559 560 }); 561 562 //accordion interni 563 564 $(".accordion").each(function() { 565 $(this).parent().next().hide(); 566 }) 567 $(".accordion").on("click", function(event) { 568 event.preventDefault(); 569 $(this).parent().next().slideToggle(); 570 $(this).toggleClass("accordion_open"); 571 }); 572 $(".accordion_courses").on("click", function(event) { 573 event.preventDefault(); 574 $(this).parent().parent().next().slideToggle(); 575 $(this).toggleClass("accordion_courses_open"); 576 }); 577 $(".fus_threecredit").on("click", function() { 578 goToByScroll("#fus_threecredit"); 579 }); 580 $(".fus_onecredit").on("click", function() { 581 goToByScroll("#fus_onecredit"); 582 }); 583 584 //accordion blog 585 586 //graduate more 587 $(".accordion_blog").on("click", function() { 588 $(this).next().slideToggle().toggleClass("accordion_blog_open"); 589 }); 590 591 // Flag per indicare se lo scroll è stato innescato programmaticamente 592 var isProgrammaticScroll = false; 593 594 function goToByScroll(id) { 595 if ($(".fus_tab_wrapperone").length) { 596 var altezza_maggiorata_tab = $(".fus_tab_wrapperone").innerHeight(); 597 } else { 598 var altezza_maggiorata_tab = $(".blog_header_blu").innerHeight(); 599 } 600 var altezza_maggiorata = $(".fus_header_fixed").innerHeight(); 601 602 // Imposta il flag a true per indicare uno scroll programmatico 603 isProgrammaticScroll = true; 604 if(id==".strategic_planner") { 605 $("body").removeClass("strategic_planner_menu"); 606 } 607 $('html,body').animate({ 608 scrollTop: $(id).offset().top - altezza_maggiorata - altezza_maggiorata_tab 609 }, 500, function() { 610 // Dopo che l'animazione è completata, reimposta il flag a false 611 isProgrammaticScroll = false; 612 }); 613 } 614 615 616 //search 617 $(".fus_menu_search").on("click", function(event) { 618 event.preventDefault(); 619 $("body").addClass("search_open"); 620 }); 621 $(".fus_search_close span").on("click", function() { 622 $("body").removeClass("search_open"); 623 }); 624 $(".fus_search .form-search").attr("placeholder", "What are you searching for?"); 625 626 627 //graduate add div to footer buttons 628 $(".fus_graduate_foo_buttons > div > div:nth-child(1)").after("<div></div>"); 629 $(".fus_graduate_foo_buttons > div > div:nth-child(3)").after("<div></div>"); 630 631 //payments 632 633 var destination = ""; 634 var label = ""; 635 var amount = ""; 636 637 $(".fus-payment-link-chf").on("click", function() { 638 //recupero i dati 639 destination = "FIK"; 640 label = $(this).find("span").attr("rel"); 641 amount = $(this).find("span").text(); 642 $("body").append("<div class=\"fus_payment_confirmation_bk\"><div class=\"fus_payment_confirmation\"><strong>You are now leaving the Franklin Switzerland website</strong><br><br>You are now leaving the Franklin Switzerland website, and are being connected to a third-party website. Please note that Franklin Switzerland is not responsible for the information, content, or product(s) found on third-party websites.<br><br>By accessing the noted link you will be leaving our website and entering a website hosted by another party. Please be advised that you will no longer be subject to, or under the protection of, our privacy and security policies. We encourage you to read and evaluate the privacy and security policies of the site you are entering, which may be different from ours.<br><br><a class=\"fus-payment-link-continue fus-payment-link-continue-chf\">Continue</a> <a class=\"fus-payment-link-cancel\">Cancel</a></div></div>"); 643 $(".fus-payment-link-cancel").on("click", function() { 644 $(".fus_payment_confirmation_bk").fadeOut(); 645 }); 646 647 $(".fus-payment-link-continue-chf").on("click", function() { 648 $(".fus_payment_confirmation_bk").hide(); 649 $("body").addClass("fus_payment_open"); 650 $(".fus_payment_open .fus_overlay_messages .contenitore_width").before("<div class=\"fus_payment_close\"><div class=\"contenitore_width\"><div class=\"fus_payment_close_ico\"></div></div></div>"); 651 $(".fus_payment_close_ico").on("click", function() { 652 location.reload(); 653 }) 654 // Render the payment form into #flywire-payex 655 window. flywire.Payment.render ({ 656 // Set your environment 657 // demo, production 658 env : "production" , 659 // Set your preferred locale 660 // en, es-ES, zh-CN, ko, fr-FR, ja, pt-PT, ar, id 661 locale : "en" , 662 // Set your institution unique Code 663 destination : ""+destination+"" , 664 amount: ""+amount+"00", 665 purpose: ""+label+"", 666 student_id: "WEBSITEPAYMENT", 667 theme : { 668 brandColor : "#252b4a", // Any CSS color 669 chat : false, // true, false 670 footer : false // true, false 671 } 672 }, "#flywire-payex" ); 673 }); 674 }); 675 676 677 $(".fus-payment-link-usd").on("click", function() { 678 //recupero i dati 679 //destination = "FJK"; 680 label = $(this).find("span").attr("rel"); 681 amount = $(this).find("span").text(); 682 $("body").append("<div class=\"fus_payment_confirmation_bk\"><div class=\"fus_payment_confirmation\"><strong>You are now leaving the Franklin Switzerland website</strong><br><br>You are now leaving the Franklin Switzerland website, and are being connected to a third-party website. Please note that Franklin Switzerland is not responsible for the information, content, or product(s) found on third-party websites.<br><br>By accessing the noted link you will be leaving our website and entering a website hosted by another party. Please be advised that you will no longer be subject to, or under the protection of, our privacy and security policies. We encourage you to read and evaluate the privacy and security policies of the site you are entering, which may be different from ours.<br><br><a class=\"fus-payment-link-continue fus-payment-link-continue-usd-out\">Continue (payment from outside the US)</a> <a class=\"fus-payment-link-continue fus-payment-link-continue-usd\">Continue (payment from the US)</a><br><br><a class=\"fus-payment-link-cancel\">Cancel</a></div></div>"); 683 $(".fus-payment-link-cancel").on("click", function() { 684 $(".fus_payment_confirmation_bk").fadeOut(); 685 }); 686 687 $(".fus-payment-link-continue-usd").on("click", function() { 688 $(".fus_payment_confirmation_bk").hide(); 689 $("body").addClass("fus_payment_open"); 690 $(".fus_payment_open .fus_overlay_messages .contenitore_width").before("<div class=\"fus_payment_close\"><div class=\"contenitore_width\"><div class=\"fus_payment_close_ico\"></div></div></div>"); 691 $(".fus_payment_close_ico").on("click", function() { 692 location.reload(); 693 }) 694 // Render the payment form into #flywire-payex 695 window. flywire.Payment.render ({ 696 // Set your environment 697 // demo, production 698 env : "production" , 699 // Set your preferred locale 700 // en, es-ES, zh-CN, ko, fr-FR, ja, pt-PT, ar, id 701 locale : "en" , 702 // Set your institution unique Code 703 destination : "FTD" , 704 amount: ""+amount+"00", 705 purpose: ""+label+"", 706 student_id: "WEBSITEPAYMENT", 707 theme : { 708 brandColor : "#252b4a", // Any CSS color 709 chat : false, // true, false 710 footer : false // true, false 711 } 712 }, "#flywire-payex" ); 713 }); 714 715 $(".fus-payment-link-continue-usd-out").on("click", function() { 716 $(".fus_payment_confirmation_bk").hide(); 717 $("body").addClass("fus_payment_open"); 718 $(".fus_payment_open .fus_overlay_messages .contenitore_width").before("<div class=\"fus_payment_close\"><div class=\"contenitore_width\"><div class=\"fus_payment_close_ico\"></div></div></div>"); 719 $(".fus_payment_close_ico").on("click", function() { 720 location.reload(); 721 }) 722 // Render the payment form into #flywire-payex 723 window. flywire.Payment.render ({ 724 // Set your environment 725 // demo, production 726 env : "production" , 727 // Set your preferred locale 728 // en, es-ES, zh-CN, ko, fr-FR, ja, pt-PT, ar, id 729 locale : "en" , 730 // Set your institution unique Code 731 destination : "FJK" , 732 amount: ""+amount+"00", 733 purpose: ""+label+"", 734 student_id: "WEBSITEPAYMENT", 735 theme : { 736 brandColor : "#252b4a", // Any CSS color 737 chat : false, // true, false 738 footer : false // true, false 739 } 740 }, "#flywire-payex" ); 741 }); 742 }); 743 744 /* SLIDER HP */ 745 746 747 //slider HP ALTO 748 /*$(".fus_slider_wrapper").slick({ 749 infinite: true,
750 arrows: false, 751 dots: false, 752 autoplay: true, 753 fade:true, 754 speed: 1500, 755 slidesToShow: 1, 756 slidesToScroll: 1, 757 swipeToSlide: true, 758 }); 759 760 761 */ 762 763 764 765 766 767 if ($.fn.slick) { 768 $(".fus_slider_wrapper").slick({ 769 infinite: true, 770 arrows: false, 771 dots: false, 772 autoplay: false, 773 fade: true, 774 speed: 1500, 775 slidesToShow: 1, 776 slidesToScroll: 1, 777 swipeToSlide: true, 778 }).on('afterChange', function (event, slick, currentSlide, nextSlide) { 779 var attuale = currentSlide + 1 780 /*var classes = $(this).find("div.slick-track > div:nth-child(" + attuale + ")").attr('class'); 781 var res = classes.split(" "); 782 $(".sliderContainer").removeClass("colore_testo_slide_nero colore_testo_slide_bianco") 783 $(this).parent().addClass(res[0]);*/ 784 }).on('init', function () { 785 //$("body").addClass("slider_loaded"); 786 //document.body.classList.add("slider_loaded"); 787 /*var classes = $(this).find("div.slick-track > div:nth-child(1)").attr('class'); 788 var res = classes.split(" "); 789 $(this).parent().addClass(res[0]);*/ 790 }); 791 } 792 793 //ticking machine 794 var percentTime; 795 var tick; 796 var time = 5; //questo modifica la velocita della barretta 797 var progressBarIndex = 0; 798 var conteggio = 0; 799 800 $('.sliderContainer .progressBarContainer .progressBar').each(function (index) { 801 var progress = "<div class='inProgress inProgress" + index + "'></div>"; 802 $(this).html(progress); 803 conteggio = conteggio + 1; 804 }); 805 806 function startProgressbar() { 807 resetProgressbar(); 808 percentTime = 0; 809 tick = setInterval(interval, 10); 810 } 811 812 function interval() { 813 if ($.fn.slick) { 814 if (($('.sliderContainer .slick-track div[data-slick-index="' + progressBarIndex + '"]').attr("aria-hidden")) === "true") { 815 progressBarIndex = $('.sliderContainer .slick-track div[aria-hidden="false"]').data("slickIndex"); 816 startProgressbar(); 817 } else { 818 percentTime += 1 / time; 819 $('.sliderContainer .inProgress' + progressBarIndex).css({ 820 width: percentTime + "%" 821 }).parent().parent().addClass("progress_attuale"); 822 if (percentTime >= 100) { 823 $('.sliderContainer .single-item').slick('slickNext'); 824 progressBarIndex++; 825 if (progressBarIndex > conteggio - 1) { 826 progressBarIndex = 0; 827 } 828 startProgressbar(); 829 } 830 } 831 } 832 } 833 834 function resetProgressbar() { 835 $('.sliderContainer .inProgress').css({ 836 width: 0 + '%' 837 }).parent().parent().removeClass("progress_attuale"); 838 clearInterval(tick); 839 } 840 startProgressbar(); 841 // End ticking machine 842 843 $('.fus_slider_title_hp_single').click(function () { 844 if ($.fn.slick) { 845 clearInterval(tick); 846 var goToThisIndex = $(this).find("span").data("slickIndex"); 847 $('.sliderContainer .single-item').slick('slickGoTo', goToThisIndex, false); 848 startProgressbar(); 849 } 850 }); 851 852 $(".fus_slider_video_icon").on("click", function() { 853 if ($.fn.slick) { 854 clearInterval(tick) 855 $(".fus_slider_wrapper").slick('slickPause'); 856 var video = $(this).attr("rel"); 857 $( ".fus_slider_video_icon" ).clone().appendTo( "body").addClass("fus_slider_video_icon_body"); 858 $(".fus_slider_video_icon_body").append("<div class=\"fus_video_hp\"><div class=\"video_close\"></div><iframe width=\"358\" height=\"200\" src=\"https://www.youtube.com/embed/"+video+"?autoplay=1\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe></div>"); 859 setTimeout(function() { 860 $(".fus_slider_video_icon_body").addClass("video_aperto"); 861 $(".video_close").on("click", function() { 862 $(".fus_slider_video_icon_body").removeClass("video_aperto"); 863 setTimeout(function() { 864 $(".fus_slider_video_icon_body").remove(); 865 $('.slider').slick('slickPlay'); 866 tick = setInterval(interval, 10); 867 },400); 868 }); 869 },200); 870 } 871 }); 872 873 874 //requirements 875 $(".fus_major_acco_requirements").on("click", function() { 876 //$(".node--smartcatalog-requirements").slideToggle(); 877 $(this).toggleClass("fus_major_acco_requirements_open"); 878 $(this).next(".node--smartcatalog-requirements").slideToggle(); 879 /*$(".smartcatalog-accordion dt").on("click", function() { 880 $(this).next().slideToggle(); 881 $(this).toggleClass("dt_open"); 882 });*/ 883 }); 884 885 $(".smartcatalog-accordion dt").on("click", function() { 886 $(this).next().slideToggle(); 887 $(this).toggleClass("dt_open"); 888 }); 889 890 //qui nascondiamo i megamenu vuoti 891 $(".fus_class_intro_interno_flex_2").each(function() { 892 var valore = $(this).find("p").text(); 893 console.normal("mega > " + valore); 894 if(valore=="empty") { 895 $(this).html(""); 896 } 897 }) 898 899 /*tasto back*/ 900 $(".fus_back p").on("click", function() { 901 window.history.back(); 902 }); 903 904 /*footer accordion*/ 905 $(".fus_footer_container h2").on("click", function() { 906 $(this).next().slideToggle(); 907 }); 908 909 //find your counselor 910 $(".form-item-field-country-target-id").hide(); 911 $("select[name=\"field_program_target_id\"]").on('change', function() { 912 if(this.value=="364") { 913 $(".form-item-field-country-target-id").show(); 914 } else { 915 $(".form-item-field-country-target-id").hide(); 916 } 917 918 }); 919 920 //courses 921 if($("body").hasClass("node-1283")) {//sono all'interno di corsi, controllo link in page 922 var hash = $(location).attr('hash'); 923 if(hash) { 924 $(hash).parent().next().slideDown(); 925 goToByScroll(hash); 926 setTimeout(function() {goToByScroll(hash)},500); 927 } 928 } 929 930 931 $(document).ajaxComplete(function (event, request, settings) { 932 if($("select[name=\"field_program_target_id\"]").val()=="364"){ 933 $(".form-item-field-country-target-id").show(); 934 } else { 935 $(".form-item-field-country-target-id").hide(); 936 $("select[name=\"field_program_target_id\"]").val("All"); 937 } 938 939 $("select[name=\"field_program_target_id\"]").on('change', function() { 940 if(this.value=="364") { 941 $(".form-item-field-country-target-id").show(); 942 } else { 943 $(".form-item-field-country-target-id").hide(); 944 //$(this).val("All"); 945 } 946 947 }); 948 }); 949 950 //aggiungo target blank a pdf 951 $(".file--application-pdf a").attr("target","_blank"); 952 953 954 955 956 957 /* 958 959 if($("body").hasClass("node-type-landing_page_2021")) { 960 961 window.setTimeout(function(){ 962 //aspettiamo che venga caricato il form e duplichiamo bottone 963 //qui solo landing 964 const id_form = $(".lp_form").attr("id"); 965 const queryString = window.location.search;
966 const urlParams = new URLSearchParams(queryString); 967 const utm_source = urlParams.get('utm_source'); 968 const utm_medium = urlParams.get('utm_medium'); 969 const utm_campaign = urlParams.get('utm_campaign'); 970 const slate_tag = urlParams.get('slate_tag'); 971 972 973 if(!document.forms[0].elements[id_form]) { 974 alert("INPUT TYPE HIDDEN IS MISSING"); 975 } else { 976 if (urlParams.has('utm_source')) { 977 document.forms[0].elements[id_form].value = utm_source; 978 979 } 980 else if (urlParams.has('utm_medium')) { 981 document.forms[0].elements[id_form].value = utm_medium; 982 983 } 984 else if (urlParams.has('utm_campaign')) { 985 document.forms[0].elements[id_form].value = utm_campaign; 986 987 } 988 else if (urlParams.has('slate_tag')) { 989 document.forms[0].elements[id_form].value = slate_tag; 990 991 } else { 992 document.forms[0].elements[id_form].value = $(".lp_title_one h1 span").text(); 993 994 } 995 } 996 997 998 function duplicaBottone() { 999 var label_bottone = $(".lp_form button").text(); 1000 1001 $(".lp_btn_duplicate").text(label_bottone); 1002 $(".lp_btn_duplicate").on("click", function() { 1003 $('html,body').animate({scrollTop: $(".fus_content_blocco").offset().top},800); 1004 }) 1005 } 1006 setTimeout(function() { duplicaBottone() },100); 1007 1008 //qui controlliamo se c'è il bottone download, altriemnti mettiamo 4 highlights per riga 1009 if ($(".fus_graduate_flex_dx").length){ 1010 } else { 1011 // Do something if class does not exist 1012 $(".fus_graduate_flex_sx").addClass("fus_graduate_flex_sx_more"); 1013 } 1014 }, 4000); 1015 } 1016 */ 1017 1018 1019 1020 1021 1022 /* 1023 1024 */ 1025 1026 1027 1028 1029 if($("body").hasClass("node-6559")) { 1030 $(".fus_class_menu_generale > ul > li > span").on("click",function() { 1031 $(".fus_class_menu_generale > ul > li > span").removeClass("fus_m24_on").next().fadeOut(); 1032 $(this).addClass("fus_m24_on").next().fadeIn(); 1033 }); 1034 $(".fus_class_menu_generale > ul > li > ul > li.fus_expanded > a").on("click",function() { 1035 $(".fus_class_menu_generale > ul > li > ul > li.fus_expanded > a").removeClass("fus_m24_on").next().fadeOut(); 1036 $(this).addClass("fus_m24_on").next().fadeIn(); 1037 return false; 1038 }) 1039 } 1040 if($("body").hasClass("node-type-landing_page_2021") || $("body").hasClass("node-type-landing_page_2024") || $("body").hasClass("node-type-landing_page_2026") ) { 1041 1042 debug_attivo = true; 1043 console.normal("landing"); 1044 window.setTimeout(function(){ 1045 var src = $('.iframe-loader'); 1046 var targ = src.prev('.lp_form').attr('id'); 1047 // src.removeAttr('async').attr('src', src.data('src')); 1048 var tag = document.createElement("script"); 1049 tag.src = src.data('src'); 1050 document.getElementsByTagName("head")[0].appendChild(tag); 1051 1052 1053 document.getElementById( targ ).addEventListener( 'DOMNodeInserted', function ( event ) { 1054 1055 if( event.target.parentNode.id === targ && !$(targ).hasClass('loaded')) { 1056 1057 $(targ).addClass('loaded'); 1058 //aspettiamo che venga caricato il form e duplichiamo bottone 1059 if ($('.paragraph--type--lp-form').length) { 1060 $(".lp_btn_duplicate").hide(); 1061 } 1062 else { 1063 window.setTimeout(function(){ 1064 var label_bottone = $(".lp_form button").text(); 1065 //console.log("bottone " +label_bottone); 1066 $(".lp_btn_duplicate").text(label_bottone); 1067 $(".lp_btn_duplicate").on("click", function() { 1068 $('html,body').animate({scrollTop: $(".fus_content_blocco").offset().top},800); 1069 }); 1070 }, 1000); 1071 } 1072 //qui solo landing 1073 const id_form = $(".lp_form").attr("id"); 1074 const queryString = window.location.search;
1075 const urlParams = new URLSearchParams(queryString); 1076 const utm_source = urlParams.get('utm_source'); 1077 const utm_medium = urlParams.get('utm_medium'); 1078 const utm_campaign = urlParams.get('utm_campaign'); 1079 const slate_tag = urlParams.get('slate_tag'); 1080 console.normal("urlParams " + urlParams + " ID >" +id_form); 1081 var tracking_form = $(".lp_form").find('[data-export="source_code"]'); 1082 window.setTimeout(function () { 1083 1084 $(".lp_form form").data('reference', $(".lp_form form").attr('submit')); 1085 $(".lp_form form").removeAttr('submit'); 1086 $(".lp_form form .btn-cta").on('click', function() { 1087 let shax = $(".lp_form form input[type='email']").val(); 1088 const hash = sha256(shax); 1089 var dataFb = {page_type: "landing_page", page_action: 'submitted', form_data: parseFormA($(".lp_form form"))}; 1090 //if (typeof fbq === 'function') { 1091 fbq('track', 'CompleteRegistration', dataFb); 1092 1093 //} 1094 document.cookie = "slate_lp21=" + hash + "; path=/; max-age=30"; 1095 const sleep = ms => new Promise(r => setTimeout(r, ms)); 1096 return false; 1097 }); 1098 }, 5000); 1099 /*if(!document.forms[0].elements[id_form]) { 1100 //alert("INPUT TYPE HIDDEN IS MISSING"); 1101 console.important("INPUT TYPE HIDDEN IS MISSING") 1102 } else {*/ 1103 if (urlParams.has('utm_source')) { 1104 //document.forms[0].elements[id_form].value = utm_source; 1105 $(tracking_form).find("input").val(utm_source); 1106 console.normal("utm_source > " + utm_source) 1107 } 1108 else if (urlParams.has('utm_medium')) { 1109 //document.forms[0].elements[id_form].value = utm_medium; 1110 $(tracking_form).find("input").val(utm_medium); 1111 console.normal("utm_medium > " + utm_medium) 1112 } 1113 else if (urlParams.has('utm_campaign')) { 1114 //document.forms[0].elements[id_form].value = utm_campaign; 1115 $(tracking_form).find("input").val(utm_campaign); 1116 console.normal("utm_campaign > " + utm_campaign) 1117 } 1118 else if (urlParams.has('slate_tag')) { 1119 //document.forms[0].elements[id_form].value = slate_tag; 1120 $(tracking_form).find("input").val(slate_tag); 1121 console.normal("slate_tag > " + slate_tag) 1122 } 1123 else { 1124 //document.forms[0].elements[id_form].value = $(".lp_title_one h1 span").text(); 1125 $(tracking_form).find("input").val($(".lp_title_one h1 span").text()); 1126 console.normal("none > " + $(".lp_title_one h1 span").text()) 1127 } 1128 //} 1129 } 1130 }, false ); 1131 },3000); 1132 1133 function duplicaBottone() { 1134 if ($('.paragraph--type--lp-form').length) { 1135 $(".lp_btn_duplicate").hide(); 1136 } else { 1137 var label_bottone = $(".lp_form button").text(); 1138 console.log("bottone " +label_bottone); 1139 $(".lp_btn_duplicate").text(label_bottone); 1140 $(".lp_btn_duplicate").on("click", function() { 1141 $('html,body').animate({scrollTop: $(".fus_content_blocco").offset().top},800); 1142 }) 1143 } 1144 } 1145 // setTimeout(function() { duplicaBottone() },100); 1146 1147 //qui controlliamo se c'è il bottone download, altriemnti mettiamo 4 highlights per riga 1148 if ($(".fus_graduate_flex_dx").length){ 1149 } else { 1150 // Do something if class does not exist 1151 $(".fus_graduate_flex_sx").addClass("fus_graduate_flex_sx_more"); 1152 } 1153 } 1154 1155 1156 1157 $(".friskop_flex").on("click", function() { 1158 if($(this).hasClass("friskop_open")) { 1159 $(this).removeClass("friskop_open"); 1160 $(this).next().slideUp(400); 1161 } else { 1162 $(".friskop_open").removeClass("friskop_open").next().slideUp(400); 1163 $(this).next().slideDown(400); 1164 $(this).addClass("friskop_open"); 1165 } 1166 1167 }) 1168 1169 1170 1171 $(".internal_link").on("click", function(e) { 1172 //console.log("sono qui") 1173 var link_interno = $(this).attr("href"); 1174 e.preventDefault(); 1175 //console.log(link_interno); 1176 goToByScroll(link_interno); 1177 }); 1178 1179 var blog_page = document.getElementsByClassName('blog-hp'); 1180 if (blog_page.length > 0) { 1181 $('.views-exposed-form select[name="field_tags_target_id"] option[value="All"]').text('TAGS'); 1182 $( ".fus_blog_single_data time" ).each(function( index ) { 1183 //console.log( index + ": " + $( this ).text() ); 1184 var str = $( this ).text(); 1185 var strFirstTwo = str.slice(0, 2); 1186 var strOthers = str.slice(2, 7); 1187 $(this).html("<span>"+ strFirstTwo +"</span>" +strOthers); 1188 }); 1189 $(".blog-hp form").appendTo(".blog_header_blu .contenitore_width").addClass("form_visibile"); 1190 } 1191 1192 1193 //oscuro menu di secondo livello 1194 if($('.fus_tab_level2 ul li').length < 1 ) { 1195 $(".fus_submenu2").hide(); 1196 } 1197 1198 1199 if ($(".strategic_planner").length > 0) { 1200 1201 $('.fus_flex_content').prependTo('.fus_content > .contenitore_width').addClass("fus_content_blocco"); 1202 1203 var gallery_value_sel = 70; 1204 var gallery_value = "5rem"; 1205 //var lastHovered; 1206 var lastClicked; 1207 1208 /*$('.strategic_planner > div > div').hover( 1209 function() { 1210 var $this = $(this); // Memorizza il riferimento all'elemento corrente 1211 var currentTime = new Date().getTime(); // Ottieni il timestamp corrente 1212 1213 // Controlla se l'ultimo hover è stato fatto sullo stesso elemento e calcola la differenza di tempo 1214 if (lastHovered && lastHovered.elem.is($this) && currentTime - lastHovered.time < 300) { 1215 // Se l'hover precedente è stato sullo stesso elemento e meno di 300ms fa, ignora questo hover 1216 return; 1217 } 1218 1219 // Aggiorna l'ultimo elemento e il timestamp di hover 1220 lastHovered = { elem: $this, time: currentTime }; 1221 1222 // Logica di espansione 1223 $this.addClass('expanded').siblings().addClass('small'); 1224 }, 1225 function() { 1226 var $this = $(this); 1227 1228 // Logica di contrazione 1229 $this.removeClass('expanded').siblings().removeClass('small'); 1230 1231 // Non è necessario aggiornare lastHovered qui perché l'hover out non resetta il timer 1232 } 1233 );*/ 1234 1235 1236 $('.strategic_planner > div > div').click(function() { 1237 // Memorizza l'elemento cliccato in $this 1238 var $this = $(this); 1239 1240 // Rimuove le classi 'expanded' e 'small' dai fratelli dell'elemento cliccato 1241 $this.siblings().removeClass('expanded').addClass('small'); 1242 1243 // Assicurati di rimuovere la classe 'small' dall'elemento cliccato se presente 1244 // e aggiunge la classe 'expanded' all'elemento cliccato 1245 $this.removeClass('small').addClass('expanded'); 1246 }); 1247 1248 1249 $('.paragraph--type--strategic-planner-paragraph').each(function() { 1250 //console.log("Inizio duplicazione..."); 1251 var $clone = $(this).clone(); 1252 1253 // Trova l'ID di destinazione dal link interno PRIMA di rimuovere gli elementi 1254 var targetId = $clone.find('.sp_link .internal_link').attr('href'); 1255 //console.log("ID finale:", targetId); 1256 1257 // Ora puoi rimuovere i div sp_intro e sp_link dal clone 1258 $clone.find('.sp_intro, .sp_link').remove(); 1259 1260 // Cambia la classe del clone 1261 $clone.removeClass('paragraph--type--strategic-planner-paragraph').addClass('paragraph--type--strategic-planner-paragraph_copia'); 1262 1263 if (targetId) { 1264 // Cerca il contenitore di destinazione e inserisci il clone 1265 // Utilizza $(document).find per essere sicuri di cercare dall'intero documento 1266 var $target = $(document).find(targetId + ' .contenitore_width'); 1267 if ($target.length > 0) { 1268 $target.prepend($clone); 1269 } else { 1270 //console.log("Contenitore di destinazione non trovato per:", targetId); 1271 } 1272 } else { 1273 //console.log("L'elemento .internal_link non ha un attributo href valido o non è stato trovato."); 1274 } 1275 }); 1276 1277 1278 1279 1280 1281 // Rimuove la classe al click sul link con classe "sp_close" 1282 $('.sp_close').click(function() { 1283 setTimeout(function() { 1284 // Seleziona tutti i div e rimuove le classi 'expanded' e 'small' 1285 $('.strategic_planner > div > div').removeClass('expanded small'); 1286 }, 300); // 300ms di ritardo 1287 }); 1288 1289 $('.paragraph--type--strategic-planner-paragraph').each(function() { 1290 // Recupera lo stile di background del div corrente 1291 var backgroundColor = $(this).css('background-color'); 1292 1293 // Trova l'elemento <a> con classe 'internal_link' all'interno del div e ne recupera l'attributo href 1294 var internalLinkId = $(this).find('.sp_link a.internal_link').attr('href'); 1295 1296 // Verifica se l'ID è valido (non vuoto e inizia con '#') 1297 if(internalLinkId && internalLinkId.startsWith('#')) { 1298 // Trova l'elemento in pagina corrispondente all'ID e gli assegna lo stile di background recuperato 1299 $(internalLinkId).css({ 1300 'background-color': backgroundColor, 1301 'color': 'white' // Imposta il colore del testo a bianco 1302 }); 1303 1304 } 1305 }); 1306 1307 1308 //creo sottomenu 1309 // Crea l'elemento nav e ul
1310 var $wrapperOne = $('<div>').addClass('fus_tab_wrapperone'); 1311 var $subMenu = $('<div>').addClass('fus_submenu'); 1312 var $nav = $('<nav>').addClass('fus_tabs fus_sp'); 1313 var $ul = $('<ul>'); 1314 1315 // Itera attraverso ciascun div .paragraph all'interno di .strategic_planner 1316 $('.strategic_planner .paragraph').each(function() { 1317 var $this = $(this); 1318 1319 // Estrae le informazioni necessarie 1320 var bgColor = $this.attr('style').match(/background-color:([^;]+)/)[1]; // Estrae il colore di sfondo 1321 var title = $this.find('.sp_title').text(); // Estrae il titolo 1322 var linkHref = $this.find('.sp_link a').attr('href'); // Estrae l'href 1323 1324 // Crea l'elemento li e aggiunge le informazioni estratte 1325 var $li = $('<li>').css('background-color', bgColor); 1326 var $a = $('<a class="internal_link">').attr('href', linkHref).text(title); 1327 $li.append($a); 1328 1329 // Aggiunge l'elemento li a ul 1330 $ul.append($li); 1331 }); 1332 1333 // Aggiunge ul a nav 1334 $nav.append($ul); // Aggiunge ul a nav 1335 $subMenu.append($nav); // Aggiunge nav a fus_submenu 1336 $wrapperOne.append($subMenu); // Aggiunge fus_submenu a fus_tab_wrapperone 1337 1338 // Inserisce il nav subito dopo il div con classe fus_briciole 1339 $('.fus_submenu').append($wrapperOne); 1340 1341 1342 1343 $(".internal_link").on("click", function(e) { 1344 //console.log("sono qui") 1345 var link_interno = $(this).attr("href"); 1346 e.preventDefault(); 1347 //console.log(link_interno); 1348 goToByScroll(link_interno); 1349 }); 1350 } 1351 1352 //nuovo megamenu 1353 $('.fus_class_menu_generale > ul').each(function() { 1354 var $thisUl = $(this); // Il 'ul' corrente nel ciclo 1355 1356 // Seleziona solo i figli diretti 'li' che non hanno la classe 'fus_expanded' 1357 var noClassItems = $thisUl.children('li:not(.fus_expanded)').detach(); 1358 1359 // Se non ci sono elementi senza classe dopo la rimozione, non fare nulla 1360 if (noClassItems.length === 0) return; 1361 1362 // Crea un nuovo 'ul' da aggiungere dentro il primo 'li' senza classe 'fus_expanded' 1363 var newUl = $('<ul class="fus_ricreato"></ul>').append(noClassItems); 1364 1365 // Trova il primo 'li' senza classe 'fus_expanded' e inserisci il nuovo 'ul' al suo interno 1366 var firstNoClassLi = $thisUl.children('li:not(.fus_expanded):first'); 1367 1368 // Assicurati che il 'li' trovato sia effettivamente senza la classe e non sia stato rimosso 1369 if (firstNoClassLi.length) { 1370 firstNoClassLi.append(newUl); 1371 } else { 1372 // Se per qualche ragione il 'li' non esiste più, inserisci il 'ul' alla fine dell'elenco principale 1373 $thisUl.append(newUl); 1374 } 1375 }); 1376 1377 1378 /* 1379 $('.strategic_planner > div > div').hover( 1380 function() { 1381 // Al rollover, espandi l'elemento corrente e rimpicciolisci gli altri 1382 $(this).addClass('expanded').siblings().addClass('small'); 1383 }, 1384 function() { 1385 // Al roll-out, rimuovi le classi per tornare allo stato iniziale 1386 $(this).removeClass('expanded').siblings().removeClass('small'); 1387 } 1388 );*/ 1389 1390 //fine JS 1391 })(jQuery); 1392 } 1393}, 100); 1394 1395/* Source and licensing information for the above line(s) can be found at https://www.fus.edu/themes/custom/fus/js/main.js. */; 1396/* Source and licensing information for the line(s) below can be found at https://www.fus.edu/themes/custom/fus/js/slateToolsFus.js. */ 1397/** 1398 * Wait for element to exist in DOM. 1399 * 1400 * @param selector 1401 * @param callback 1402 */ 1403var waitForEl = function(selector, callback) { 1404 if (jQuery(selector).length) { 1405 callback(); 1406 } else { 1407 setTimeout(function() { 1408 waitForEl(selector, callback); 1409 }, 100); 1410 } 1411}; 1412 1413/** 1414 * Eval SHA256. 1415 * 1416 * @param ascii 1417 * @returns {string} 1418 */ 1419var sha256 = function sha256(ascii) { 1420 function rightRotate(value, amount) { 1421 return (value>>>amount) | (value<<(32 - amount)); 1422 } 1423 1424 var mathPow = Math.pow; 1425 var maxWord = mathPow(2, 32); 1426 var lengthProperty = 'length' 1427 var i, j; // Used as a counter across the whole file 1428 var result = '' 1429 1430 var words = []; 1431 var asciiBitLength = ascii[lengthProperty]*8; 1432 1433 //* caching results is optional - remove/add slash from front of this line to toggle 1434 // Initial hash value: first 32 bits of the fractional parts of the square roots of the first 8 primes 1435 // (we actually calculate the first 64, but extra values are just ignored) 1436 var hash = sha256.h = sha256.h || []; 1437 // Round constants: first 32 bits of the fractional parts of the cube roots of the first 64 primes 1438 var k = sha256.k = sha256.k || []; 1439 var primeCounter = k[lengthProperty]; 1440 /*/ 1441 var hash = [], k = []; 1442 var primeCounter = 0; 1443 //*/ 1444 1445 var isComposite = {}; 1446 for (var candidate = 2; primeCounter < 64;
1446 candidate++) { 1447 if (!isComposite[candidate]) { 1448 for (i = 0; i < 313; i += candidate) { 1449 isComposite[i] = candidate; 1450 } 1451 hash[primeCounter] = (mathPow(candidate, .5)*maxWord)|0; 1452 k[primeCounter++] = (mathPow(candidate, 1/3)*maxWord)|0; 1453 } 1454 } 1455 1456 ascii += '\x80' // Append Æ' bit (plus zero padding) 1457 while (ascii[lengthProperty]%64 - 56) ascii += '\x00' // More zero padding 1458 for (i = 0; i < ascii[lengthProperty]; i++) { 1459 j = ascii.charCodeAt(i); 1460 if (j>>8) return; // ASCII check: only accept characters in range 0-255 1461 words[i>>2] |= j << ((3 - i)%4)*8; 1462 } 1463 words[words[lengthProperty]] = ((asciiBitLength/maxWord)|0); 1464 words[words[lengthProperty]] = (asciiBitLength) 1465 1466 // process each chunk 1467 for (j = 0; j < words[lengthProperty];) { 1468 var w = words.slice(j, j += 16); // The message is expanded into 64 words as part of the iteration 1469 var oldHash = hash; 1470 // This is now the undefinedworking hash", often labelled as variables a...g 1471 // (we have to truncate as well, otherwise extra entries at the end accumulate 1472 hash = hash.slice(0, 8); 1473 1474 for (i = 0; i < 64; i++) { 1475 var i2 = i + j; 1476 // Expand the message into 64 words 1477 // Used below if 1478 var w15 = w[i - 15], w2 = w[i - 2]; 1479 1480 // Iterate 1481 var a = hash[0], e = hash[4]; 1482 var temp1 = hash[7] 1483 + (rightRotate(e, 6) ^ rightRotate(e, 11) ^ rightRotate(e, 25)) // S1 1484 + ((e&hash[5])^((~e)&hash[6])) // ch 1485 + k[i] 1486 // Expand the message schedule if needed 1487 + (w[i] = (i < 16) ? w[i] : ( 1488 w[i - 16] 1489 + (rightRotate(w15, 7) ^ rightRotate(w15, 18) ^ (w15>>>3)) // s0 1490 + w[i - 7] 1491 + (rightRotate(w2, 17) ^ rightRotate(w2, 19) ^ (w2>>>10)) // s1 1492 )|0 1493 ); 1494 // This is only used once, so *could* be moved below, but it only saves 4 bytes and makes things unreadble 1495 var temp2 = (rightRotate(a, 2) ^ rightRotate(a, 13) ^ rightRotate(a, 22)) // S0 1496 + ((a&hash[1])^(a&hash[2])^(hash[1]&hash[2])); // maj 1497 1498 hash = [(temp1 + temp2)|0].concat(hash); // We don't bother trimming off the extra ones, they're harmless as long as we're truncating when we do the slice() 1499 hash[4] = (hash[4] + temp1)|0; 1500 } 1501 1502 for (i = 0; i < 8; i++) { 1503 hash[i] = (hash[i] + oldHash[i])|0; 1504 } 1505 } 1506 1507 for (i = 0; i < 8; i++) { 1508 for (j = 3; j + 1; j--) { 1509 var b = (hash[i]>>(j*8))&255; 1510 result += ((b < 16) ? 0 : '') + b.toString(16); 1511 } 1512 } 1513 return result; 1514}; 1515 1516/** 1517 * Parse form and return object data. 1518 * 1519 * @param form 1520 * @returns {*} 1521 */ 1522function parseFormA(form) { 1523 var arr = form.serializeArray(); 1524 var out = []; 1525 out['parsed'] = {}; 1526 out['raw'] = {}; 1527 for (const key in arr) { 1528 let val = arr[key]; 1529 1530 if (jQuery('#' + val.name, form).is('select')) { 1531 out['raw'][val.name] = jQuery('#' + val.name + ' option[value="' + val.value + '"]', form).text(); 1532 } 1533 else { 1534 out['raw'][val.name] = val.value; 1535 } 1536 1537 if (val.name.indexOf('form_')>-1) { 1538 let label = jQuery('label[for="' + val.name + '"]', form).text().replace('*', ''); 1539 if (label.trim() === "") { 1540 label = "H1"; 1541 } 1542 if (out['raw'][val.name].trim() !== "") { 1543 out['parsed'][label] = out['raw'][val.name]; 1544 } 1545 } 1546 } 1547 1548 if (out['raw'].id) { 1549 out['parsed'].id = out['raw'].id; 1550 } 1551 1552 return out['parsed']; 1553} 1554 1555/** 1556 * Behaviour 1557 */ 1558var slateToolsInit = 0; 1559(function ($, Drupal) { 1560 Drupal.behaviors.fus = { 1561 attach: function (context, settings) { 1562 if (slateToolsInit === 0) { 1563 slateToolsInit++; 1564 let body = $("body"); 1565 if( 1566 body.hasClass("node-type-landing_page_2021") || 1567 body.hasClass("node-type-landing_page_2024") || 1568 body.hasClass("node-type-landing_page") 1569 ) { 1570 var src = $('.iframe-loader'); 1571 var lpForm = $(".lp_form"); 1572 1573 var targ = src.prev('.lp_form').attr('id'); 1574 // src.removeAttr('async').attr('src', src.data('src')); 1575 var tag = document.createElement("script"); 1576 tag.src = src.data('src'); 1577 document.getElementsByTagName("head")[0].appendChild(tag); 1578 console.normal('target', targ); 1579 1580 var selector = '.lp_form #' + targ.replace('div_', '') + ' form'; 1581 waitForEl(selector, function() { 1582 slateToolsInit++; 1583 1584 console.normal(selector); 1585 1586 $(targ).addClass('loaded'); 1587 1588 if ($('.paragraph--type--lp-form').length) { 1589 $(".lp_btn_duplicate").hide(); 1590 } 1591 else { 1592 window.setTimeout(function(){ 1593 var label_bottone = $("button", lpForm).text(); 1594 $(".lp_btn_duplicate").text(label_bottone); 1595 $(".lp_btn_duplicate").on("click", function() { 1596 $('html,body').animate({scrollTop: $(".fus_content_blocco").offset().top},800); 1597 }); 1598 }, 1000); 1599 } 1600 //qui solo landing 1601 const id_form = lpForm.attr("id"); 1602 const queryString = window.location.search;
1603 const urlParams = new URLSearchParams(queryString); 1604 const utm_source = urlParams.get('utm_source'); 1605 const utm_medium = urlParams.get('utm_medium'); 1606 const utm_campaign = urlParams.get('utm_campaign'); 1607 const slate_tag = urlParams.get('slate_tag'); 1608 1609 console.normal("urlParams " + urlParams + " ID >" +id_form); 1610 1611 var tracking_form = lpForm.find('[data-export="source_code"]'); 1612 1613 window.setTimeout(function () { 1614 var theForm = $('form', lpForm); 1615 1616 slateToolsInit++; 1617 1618 theForm.data('reference', theForm.attr('submit')); 1619 theForm.removeAttr('submit'); 1620 1621 $(".btn-cta", theForm).on('click', function() { 1622 let shax = $("input[type='email']", theForm).val(); 1623 const hash = sha256(shax); 1624 1625 let fbData = parseFormA(theForm); 1626 1627 console.normal('fbData', fbData); 1628 1629 let isFunction = window.fbq && fbq instanceof Function; 1630 1631 if (fbData.id && isFunction && Object.keys(fbData).length > 0) { 1632 fbq('track', 'CompleteRegistration', { 1633 page_type: "landing_page", 1634 page_action: 'submitted', 1635 form_data: fbData 1636 }); 1637 } 1638 1639 document.cookie = "slate_lp21=" + hash + "; path=/; max-age=30; SameSite=Lax"; 1640 1641 const sleep = ms => new Promise(r => setTimeout(r, ms)); 1642 return false; 1643 }); 1644 }, 5000); 1645 1646 if (urlParams.has('utm_source')) { 1647 //document.forms[0].elements[id_form].value = utm_source; 1648 $(tracking_form).find("input").val(utm_source); 1649 1650 console.normal("utm_source > " + utm_source) 1651 } 1652 else if (urlParams.has('utm_medium')) { 1653 //document.forms[0].elements[id_form].value = utm_medium; 1654 $(tracking_form).find("input").val(utm_medium); 1655 1656 console.normal("utm_medium > " + utm_medium) 1657 } 1658 else if (urlParams.has('utm_campaign')) { 1659 //document.forms[0].elements[id_form].value = utm_campaign; 1660 $(tracking_form).find("input").val(utm_campaign); 1661 1662 console.normal("utm_campaign > " + utm_campaign) 1663 } 1664 else if (urlParams.has('slate_tag')) { 1665 //document.forms[0].elements[id_form].value = slate_tag; 1666 $(tracking_form).find("input").val(slate_tag); 1667 1668 console.normal("slate_tag > " + slate_tag) 1669 } 1670 else { 1671 //document.forms[0].elements[id_form].value = $(".lp_title_one h1 span").text(); 1672 $(tracking_form).find("input").val($(".lp_title_one h1 span").text()); 1673 1674 console.normal("none > " + $(".lp_title_one h1 span").text()) 1675 } 1676 1677 slateToolsInit++; 1678 }); 1679 1680 /*document.getElementById( targ ).addEventListener( 'DOMNodeInserted', function ( event ) { 1681 if (slateToolsInit === 1) { 1682 alert(targ) 1683 1684 1685 1686 if( event.target.parentNode.id === targ && !$(targ).hasClass('loaded')) { 1687 1688 1689 1690 1691 } 1692 1693 slateToolsInit++; 1694 } 1695 }, false);*/ 1696 1697 function duplicaBottone() { 1698 if ($('.paragraph--type--lp-form').length) { 1699 $(".lp_btn_duplicate").hide(); 1700 } else { 1701 var label_bottone = $(".lp_form button").text(); 1702 1703 $(".lp_btn_duplicate").text(label_bottone); 1704 $(".lp_btn_duplicate").on("click", function() { 1705 $('html,body').animate({scrollTop: $(".fus_content_blocco").offset().top},800); 1706 }) 1707 } 1708 } 1709 // setTimeout(function() { duplicaBottone() },100); 1710 1711 //qui controlliamo se c'è il bottone download, altriemnti mettiamo 4 highlights per riga 1712 if ($(".fus_graduate_flex_dx").length){ 1713 } else { 1714 // Do something if class does not exist 1715 $(".fus_graduate_flex_sx").addClass("fus_graduate_flex_sx_more"); 1716 } 1717 1718 } 1719 1720 1721 slateToolsInit++; 1722 } 1723 } 1724 } 1725})(jQuery, Drupal); 1726 1727/* Source and licensing information for the above line(s) can be found at https://www.fus.edu/themes/custom/fus/js/slateToolsFus.js. */;
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.