1$(document).ready(function () { 2 $(".swiper-slide > p > iframe, .swiper-slide > p > iframe").wrap( 3 '<div class="player" />' 4 ); 5 6 $(document).bind("keyup", function (evt) { 7 if ($("input").is(":focus")) { 8 return false; 9 } 10 if (evt.keyCode == 191) { 11 $("#skip-to-content").focus(); 12 } 13 14 if (evt.keyCode == 82) { 15 $("#footer .social-networks li:first-child a").focus(); 16 } 17 18 if (evt.keyCode == 70) { 19 $("#footer").focus(); 20 } 21 22 if ($("#search-category").length) { 23 if (evt.keyCode == 67) { 24 if ($(document).scrollTop() > 100) { 25 $(".cloned-filters select#search-category").focus(); 26 } else { 27 $("select#search-category").focus(); 28 } 29 } 30 } 31 }); 32 33 if ($(".programme").length) { 34 var waypoints = $(".trigger-season-name").waypoint({ 35 handler: function (direction) { 36 $(".contextual-info .title").text($(this.element).attr("data-trigger")); 37 }, 38 }); 39 } 40 41 if ($(".has-read-more").length) { 42 $(".has-read-more").each(function () { 43 var container = $(this); 44 var hr = container.find("hr"); 45 46 if (hr.length) { 47 var elements_after = hr.nextAll(); 48 var extra_text = $("<div class='extra-text'></div>"); 49 elements_after.wrap(extra_text); 50 51 hr.remove(); 52 53 var read_more = $( 54 "<a href='#' class='read-more' title='' aria-expanded='false'>" + 55 saoluiz.read_more + 56 "</a>" 57 ); 58 container.append(read_more); 59 60 read_more.click(function () { 61 var elem = $(this); 62 63 if (elem.siblings(".extra-text").hasClass("expanded")) { 64 elem.siblings(".extra-text").removeClass("expanded"); 65 elem.attr("aria-expanded", "false"); 66 elem.empty().text(saoluiz.read_more); 67 } else { 68 elem.siblings(".extra-text").addClass("expanded"); 69 elem.attr("aria-expanded", "true"); 70 elem.empty().text(saoluiz.read_less); 71 } 72 73 return false; 74 }); 75 } 76 }); 77 } 78 79 var gallery = $(".show-image-in-lightbox").simpleLightbox({ 80 animationSlide: false, 81 animationSpeed: 0, 82 history: false, 83 }); 84 85 if ($("html").attr("lang") == "en-US") { 86 var prevSlideMessageLang = "Previous slide", 87 nextSlideMessageLang = "Next slide", 88 firstSlideMessageLang = "This is the first slide", 89 lastSlideMessageLang = "This is the last slide", 90 paginationBulletMessageLang = "Go to slide {{index}}", 91 currentSlideMessageLang = "(current slide)"; 92 } else if ($("html").attr("lang") == "fr-FR") { 93 var prevSlideMessageLang = "Diapositive précédente", 94 nextSlideMessageLang = "Diapositive suivante", 95 firstSlideMessageLang = "Ceci est la première diapositive", 96 lastSlideMessageLang = "Ceci est la dernière diapositive", 97 paginationBulletMessageLang = "Aller à la diapositive {{index}}", 98 currentSlideMessageLang = "(diapositive en cours)"; 99 } else { 100 var prevSlideMessageLang = "Slide anterior", 101 nextSlideMessageLang = "Próximo slide", 102 firstSlideMessageLang = "Este é o primeiro slide", 103 lastSlideMessageLang = "Esté é o último slide", 104 paginationBulletMessageLang = "Ir para o slide {{index}}", 105 currentSlideMessageLang = "(slide atual)"; 106 } 107 108 get_calendar(); 109 // console.log("Document ready, loading initial calendar"); 110 $("span.nav-item").on("keyup", function (e) { 111 if (e.keyCode === 13) { 112 // Trigger the button element with a click 113 $(this).trigger("click"); 114 } 115 e.preventDefault(); 116 }); 117 118 var dropdown_is_opened = false; 119 120 if ($(".homepage").length) { 121 var $header = $("#header"); 122 123 var scroll = $(window).scrollTop(); 124 if (scroll >= 200) { 125 $header.addClass("white-bg"); 126 } else { 127 $header.removeClass("white-bg"); 128 } 129 130 $(window).scroll(function () { 131 if (dropdown_is_opened == false) { 132 var scroll = $(window).scrollTop(); 133 if (scroll >= 200) { 134 $header.addClass("white-bg"); 135 } else { 136 $header.removeClass("white-bg"); 137 } 138 } 139 }); 140
141 $(".calendar-toggle").click(function () { 142 //$header.addClass("white-bg"); 143 var scroll = $(window).scrollTop(); 144 //console.log(dropdown_is_opened); 145 if ($("body").hasClass("calendar-is-visible") && scroll <= 200) { 146 $header.removeClass("white-bg"); 147 } else { 148 $header.addClass("white-bg"); 149 //console.log("b"); 150 } 151 }); 152 153 $(".dropdown").on("show.bs.dropdown", function () { 154 //console.log("a"); 155 $header.addClass("white-bg"); 156 dropdown_is_opened = true; 157 }); 158 159 $(".dropdown").on("hide.bs.dropdown", function () { 160 var scroll = $(window).scrollTop(); 161 //console.log("b"); 162 if (scroll <= 200 && !$("body").hasClass("calendar-is-visible")) { 163 $header.removeClass("white-bg"); 164 } 165 dropdown_is_opened = false; 166 }); 167 } 168 169 $(document).on("click", ".dropdown-menu", function (e) { 170 e.stopPropagation(); 171 }); 172 173 $(".dropdown-toggle").click(function () { 174 if ($("body").hasClass("calendar-is-visible")) { 175 $(".close-calendar").trigger("click"); 176 } 177 }); 178 179 $(".menu-toggle").click(function () { 180 $(this).toggleClass("opened"); 181 if ($(".homepage").length && !$("#header").hasClass("white-bg")) { 182 $("#header").toggleClass("white-bg"); 183 } 184 $("body").toggleClass("overflow"); 185 }); 186 187 if ($(".homepage").length) { 188 var num_slides = $(".swiper-hero .swiper-slide").length; 189 190 var loop_setting = true; 191 192 if (num_slides == 1) { 193 var loop_setting = false; 194 } 195 196 var swiper_hero = new Swiper(".swiper-hero", { 197 speed: 500, 198 effect: "slide", 199 lazy: { 200 loadPrevNext: true, 201 loadPrevNextAmount: num_slides, 202 }, 203 loop: loop_setting, 204 autoplay: false, 205 pagination: { 206 el: ".swiper-hero-pagination", 207 type: "bullets", 208 clickable: true, 209 }, 210 navigation: { 211 nextEl: ".hero-controls .swiper-button-next", 212 prevEl: ".hero-controls .swiper-button-prev", 213 }, 214 a11y: { 215 prevSlideMessage: prevSlideMessageLang, 216 nextSlideMessage: nextSlideMessageLang, 217 firstSlideMessage: firstSlideMessageLang, 218 lastSlideMessage: lastSlideMessageLang, 219 paginationBulletMessage: paginationBulletMessageLang, 220 }, 221 on: { 222 slideChangeTransitionEnd: function ($this) { 223 $(".swiper-hero-pagination .swiper-pagination-bullet").each( 224 function (index, elem) { 225 var bullet = $(elem); 226 var ariaLabel = bullet.attr("aria-label"); 227 228 if (bullet.hasClass("swiper-pagination-bullet-active")) { 229 bullet.attr( 230 "aria-label", 231 ariaLabel + " " + currentSlideMessageLang 232 ); 233 } else { 234 bullet.attr( 235 "aria-label", 236 ariaLabel.replace(currentSlideMessageLang, "") 237 ); 238 } 239 } 240 ); 241 }, 242 }, 243 }); 244 245 $(window).on("load", function () { 246 if (loop_setting == true) { 247 swiper_hero.params.autoplay.delay = 4000; 248 swiper_hero.autoplay.start(); 249 } 250 }); 251 } 252 253 var swiper = new Swiper(".swiper-news", { 254 slidesPerView: "auto", 255 navigation: { 256 nextEl: ".news-events .swiper-button-next", 257 prevEl: ".news-events .swiper-button-prev", 258 }, 259 pagination: { 260 el: ".swiper-pagination-news", 261 type: "bullets", 262 clickable: true, 263 }, 264 a11y: { 265 prevSlideMessage: prevSlideMessageLang, 266 nextSlideMessage: nextSlideMessageLang, 267 firstSlideMessage: firstSlideMessageLang, 268 lastSlideMessage: lastSlideMessageLang, 269 paginationBulletMessage: paginationBulletMessageLang, 270 }, 271 on: { 272 slideChangeTransitionEnd: function ($this) { 273 $(".swiper-pagination-news .swiper-pagination-bullet").each( 274 function (index, elem) { 275 var bullet = $(elem); 276 var ariaLabel = bullet.attr("aria-label"); 277 278 if (bullet.hasClass("swiper-pagination-bullet-active")) { 279 bullet.attr( 280 "aria-label", 281 ariaLabel + " " + currentSlideMessageLang 282 ); 283 } else { 284 bullet.attr( 285 "aria-label", 286 ariaLabel.replace(currentSlideMessageLang, "") 287 ); 288 } 289 } 290 ); 291 }, 292 }, 293 }); 294 295 var num_slides = $(".swiper-general .swiper-slide").length; 296 297 var swiper = new Swiper(".swiper-general", { 298 slidesPerView: "auto", 299 lazy: { 300 loadPrevNext: true, 301 loadPrevNextAmount: num_slides, 302 }, 303 navigation: { 304 nextEl: ".swiper-nav-general .swiper-button-next", 305 prevEl: ".swiper-nav-general .swiper-button-prev", 306 }, 307 pagination: { 308 el: ".swiper-pagination-general", 309 type: "bullets", 310 clickable: true, 311 }, 312 a11y: { 313 prevSlideMessage: prevSlideMessageLang, 314 nextSlideMessage: nextSlideMessageLang, 315 firstSlideMessage: firstSlideMessageLang, 316 lastSlideMessage: lastSlideMessageLang, 317 paginationBulletMessage: paginationBulletMessageLang, 318 }, 319 on: { 320 slideChangeTransitionEnd: function ($this) { 321 $(".swiper-pagination-general .swiper-pagination-bullet").each( 322 function (index, elem) { 323 var bullet = $(elem); 324 var ariaLabel = bullet.attr("aria-label"); 325 326 if (bullet.hasClass("swiper-pagination-bullet-active")) { 327 bullet.attr( 328 "aria-label", 329 ariaLabel + " " + currentSlideMessageLang 330 ); 331 } else { 332 bullet.attr( 333 "aria-label", 334 ariaLabel.replace(currentSlideMessageLang, "") 335 ); 336 } 337 } 338 ); 339 }, 340 }, 341 }); 342 343 var $result_container = $(".events-list"), 344 $search_season_form = $("#search-season-form"), 345 $search_category = $("#search-category"), 346 $search_season = $("#search-season"), 347 $search_keyword = $("#search-keyword"), 348 current_year_value = $search_category.attr("data-current-year"), 349 is_single_filter = false;
350 is_media = false; 351 352 if ($search_season_form.hasClass("single-filter")) { 353 is_single_filter = true; 354 } else if ( 355 $search_season_form.hasClass("media") || 356 $search_category.hasClass("media") || 357 $search_keyword.hasClass("media") 358 ) { 359 is_media = true; 360 } 361 362 if ($search_season_form.length) { 363 $search_season_form.on("submit", function (e) { 364 $result_container.addClass("is-loading"); 365 366 var season_value = $search_season.val(), 367 category_value = $search_category.val(), 368 searched_keyword_value = $search_keyword.val(); 369 370 $("html,body").scrollToGlobal("body"); 371 if (is_single_filter == true) { 372 get_events(current_year_value, category_value); 373 var new_url = "?categoria=" + category_value; 374 } else if (is_media == true) { 375 get_media_archive_events( 376 season_value, 377 category_value, 378 searched_keyword_value 379 ); 380 var new_url = 381 "?categoria=" + 382 category_value + 383 "&temp=" + 384 season_value + 385 "&search=" + 386 searched_keyword_value; 387 } else { 388 get_archive_events( 389 season_value, 390 category_value, 391 searched_keyword_value 392 ); 393 var new_url = 394 "?categoria=" + 395 category_value + 396 "&temp=" + 397 season_value + 398 "&search=" + 399 searched_keyword_value; 400 } 401 402 window.history.pushState(new_url, "", new_url); 403 e.preventDefault(); 404 }); 405 406 $(window).on("popstate", function () { 407 var category_param = get_url_param("categoria", ""), 408 season_param = get_url_param("temp", ""), 409 search_param = get_url_param("search", ""); 410 411 if (season_param == "") { 412 season_param = $("#search-season option:first").val(); 413 } 414 415 $search_category.val(category_param); 416 $search_season.val(season_param); 417 $search_keyword.val(search_param); 418 419 if (is_single_filter == true) { 420 get_events(current_year_value, category_param); 421 var new_url = "?categoria=" + category_value; 422 } else { 423 get_archive_events(season_param, category_param, search_param); 424 var new_url = 425 "?categoria=" + 426 category_param + 427 "&temp=" + 428 season_param + 429 "&search=" + 430 search_param; 431 } 432 }); 433 434 $(document).on("change", ".form-filter", function () { 435 ($filter_name = $(this).attr("name")), 436 $(".cloned-filters .form-filter[name='" + $filter_name + "']").val( 437 $(this).val() 438 ); 439 $search_season_form.submit(); 440 }); 441 } 442 443 $(".show-items-toggle").click(function (e) { 444 e.preventDefault(); 445 var $this = $(this); 446 $this.attr("aria-expanded", "true").hide(); 447 $this.parent().next(".card-deck").attr("aria-hidden", "false"); 448 $this.closest(".show-max-items").addClass("all-visible"); 449 }); 450 451 if ($(".show-max-items").length) { 452 check_show_max_items(); 453 454 $(window).on("resizeend", function (e) { 455 check_show_max_items(); 456 }); 457 } 458 459 if ($(".swiper-gallery").length) { 460 create_galleries(); 461 462 if (window.matchMedia("(max-width: 767px)").matches) { 463 current_resolution = "mobile"; 464 } else { 465 current_resolution = "desktop"; 466 } 467 468 $(window).on("resizeend load", function (e) { 469 // Mobile 470 if (window.matchMedia("(max-width: 767px)").matches) { 471 if (current_resolution == "desktop") { 472 for (var i = 0; i < gallery_slideshows.length; i++) { 473 gallery_slideshows[i].destroy(true, true); 474 } 475 476 create_galleries(); 477 } 478 current_resolution == "mobile"; 479 480 // Desktop 481 } else { 482 //console.log("b"); 483 if (current_resolution == "mobile") { 484 //console.log("b1"); 485 for (var i = 0; i < gallery_slideshows.length; i++) { 486 gallery_slideshows[i].destroy(true, true); 487 } 488 489 current_resolution == "desktop"; 490 create_galleries(); 491 } else { 492 var window_width = $(window).width(), 493 offset_before = window_width / 4 + 7.5; 494 495 for (var i = 0; i < gallery_slideshows.length; i++) { 496 var $last_slide = $(".swiper-gallery") 497 .eq(i) 498 .find(".swiper-slide:last-child"), 499 last_slide_width = $(".swiper-gallery") 500 .eq(i) 501 .find(".swiper-slide:last-child") 502 .width(), 503 offset_after = 504 (window_width / 4) * 2 - last_slide_width + offset_before - 30; 505 506 gallery_slideshows[i].params.slidesOffsetBefore = offset_before; 507 $last_slide.css("padding-right", offset_after + "px"); 508 gallery_slideshows[i].update(); 509 } 510 } 511 } 512 }); 513 } 514
515 $(".search-toggle").click(function () { 516 setTimeout(function () { 517 $("form.search input[name='s']").focus(); 518 }, 200); 519 }); 520 521 if ($(".alert-message").length) { 522 var alert_message_cookie = Cookies.get("closed-message"); 523 if (!alert_message_cookie) { 524 $(".alert-message").addClass("is-visible"); 525 $(".close-alert").click(function () { 526 $(".alert-message").removeClass("is-visible"); 527 Cookies.set("closed-message", "true", { expires: 7 }); 528 }); 529 } 530 } 531 532 var $main = $("#main"), 533 $contextual_info = $(".contextual-info"); 534 535 if ($contextual_info.length) { 536 var scroll = $(window).scrollTop(); 537 if (scroll >= 400) { 538 $contextual_info.addClass("is-visible"); 539 } else { 540 $contextual_info.removeClass("is-visible"); 541 } 542 $(window).scroll(function () { 543 var scroll = $(window).scrollTop(); 544 if (scroll >= 400) { 545 $contextual_info.addClass("is-visible"); 546 } else { 547 $contextual_info.removeClass("is-visible"); 548 } 549 }); 550 551 var $filters = $("#search-season-form").clone(); 552 $filters.attr("id", ""); 553 554 $filters.find("select").each(function () { 555 $(this).on("change", function () { 556 var $this = $(this), 557 $filter_name = $this.attr("name"), 558 $selected_value = $this.val(); 559 560 $(".root-filters .form-filter[name='" + $filter_name + "']").val( 561 $selected_value 562 ); 563 }); 564 }); 565 566 $filters.on("submit", function (e) { 567 var $written_term = $(".cloned-filters").find(".search-events").val(); 568 $(".root-filters .search-events").val($written_term); 569 $("#search-season-form").submit(); 570 e.preventDefault(); 571 }); 572 573 if ($main.hasClass("programme")) { 574 $(".cloned-filters").html($filters); 575 } 576 577 $(document).on("keyup", ".search-events", function () { 578 $(".search-events").not(this).val($(this).val()); 579 }); 580 } 581}); 582 583$(window).on("load", function () { 584 lazy_load_images(); 585 $(".lazy-srcset").each(function () { 586 var $t = $(this); 587 $t.attr({ 588 srcset: $t.attr("data-srcset"), 589 }).removeAttr("data-srcset"); 590 }); 591 592 $(".lazy-iframe").each(function () { 593 var $t = $(this); 594 $t.attr({ 595 src: $t.attr("data-src"), 596 }).removeAttr("data-src"); 597 }); 598}); 599 600function get_media_archive_events(temporada, categoria, pesquisa) { 601 $.ajax({ 602 type: "GET", 603 url: saoluiz.adminAjax, 604 data: { 605 action: "CCAjax", 606 request: "get_media", 607 temp: temporada, 608 categoria: categoria, 609 search: pesquisa, 610 }, 611 success: function (result) { 612 $("#response").html(result); 613 lazy_load_images(); 614 $(".events-list").removeClass("is-loading"); 615 setTimeout(function () { 616 $(".card-deck .event-item:first a").focus(); 617 }, 500); 618 619 galite("set", "page", location.pathname + location.search); 620 galite("send", "pageview"); 621 }, 622 }); 623} 624 625function get_archive_events(temporada, categoria, pesquisa) { 626 $.ajax({ 627 type: "GET", 628 url: saoluiz.adminAjax, 629 data: { 630 action: "CCAjax", 631 request: "get_espetaculos", 632 temp: temporada, 633 categoria: categoria, 634 search: pesquisa, 635 }, 636 success: function (result) { 637 $("#response").html(result); 638 lazy_load_images(); 639 $(".events-list").removeClass("is-loading"); 640 setTimeout(function () { 641 $(".card-deck .event-item:first a").focus(); 642 }, 500); 643 644 galite("set", "page", location.pathname + location.search); 645 galite("send", "pageview"); 646 }, 647 }); 648} 649 650function get_events(temporada, categoria) { 651 $.ajax({ 652 type: "GET", 653 url: saoluiz.adminAjax, 654 data: { 655 action: "CCAjax", 656 request: "get_programacao", 657 temporada: temporada, 658 categoria: categoria, 659 }, 660 success: function (result) { 661 $("#response").html(result); 662 lazy_load_images(); 663 $(".events-list").removeClass("is-loading"); 664 setTimeout(function () { 665 $(".card-deck .event-item:first a").focus(); 666 }, 500); 667 //gtag('config', 'UA-125543505-1', {'page_path': location.pathname+location.search}); 668 galite("set", "page", location.pathname + location.search); 669 galite("send", "pageview"); 670 }, 671 }); 672} 673 674function get_calendar(selectedSeason, selectedMonth) { 675 var temporada = selectedSeason || $("#calendar").attr("data-season");
676 var month = selectedMonth || new Date().toISOString().slice(0, 7); 677 var lang = $("#calendar").attr("data-season-lang"); 678 // console.log("Getting calendar for season:", temporada); 679 680 $.ajax({ 681 url: saoluiz.adminAjax, 682 data: { 683 action: "CCAjax", 684 request: "get_calendario", 685 temporada: temporada, 686 month: month, 687 lang: lang, 688 }, 689 success: function (result) { 690 // console.log("AJAX success"); 691 $("#calendar").html(result); 692 try { 693 // console.log("try AJAX success"); 694 } catch (e) { 695 console.error("Error parsing events data:", e); 696 return; 697 } 698 699 create_calendar(result, month); 700 701 $(".calendar-toggle").click(function (e) { 702 if ( 703 $(window).width() <= 574 && 704 $("body").hasClass("homepage") && 705 !$(".calendar-content").hasClass("expand") 706 ) { 707 $(".calendar-content").addClass("expand"); 708 } 709 if ($("body").hasClass("calendar-is-visible")) { 710 $(".close-calendar").trigger("click"); 711 } else { 712 $(".calendar-content").fadeIn(150); 713 $("body").addClass("overflow calendar-is-visible"); 714 // calendar_swiper.update(); 715 } 716 e.preventDefault(); 717 }); 718
719 $(".close-calendar").click(function () { 720 $(".calendar-content").fadeOut(150); 721 $("body").removeClass("overflow calendar-is-visible"); 722 }); 723 724 $(".select-season select").on("change", function () { 725 // console.log("Season selector changed"); 726 var selectedSeason = $(this).val(); 727 // console.log("Season changed to:", selectedSeason); 728 729 var currentMonth = $(".select-month select").val().split("-")[1]; 730 updateMonthSelector(selectedSeason); 731 732 var selectedMonth = `${selectedSeason.split("-")[1]}-${currentMonth}`; 733 if (currentMonth >= 8 && currentMonth <= 12) { 734 selectedMonth = `${selectedSeason.split("-")[0]}-${currentMonth}`; 735 } else { 736 selectedMonth = `${selectedSeason.split("-")[1]}-${currentMonth}`; 737 } 738 739 // console.log("Selected month:", selectedMonth); 740 741 $(".select-month select").val(selectedMonth); 742 get_calendar(selectedSeason, selectedMonth); 743 }); 744 745 $(".select-month select").on("change", function () { 746 var selectedMonth = $(this).val(); 747 // var selectedMonth = $(this).val(); 748 // console.log("Month changed to:", selectedMonth); 749 var selectedSeason = $(".select-season select").val(); 750 get_calendar(selectedSeason, selectedMonth); 751 }); 752 }, 753 error: function (jqXHR, textStatus, errorThrown) { 754 console.error("AJAX error:", textStatus, errorThrown); 755 }, 756 }); 757} 758 759function updateMonthSelector(selectedSeason) { 760 var currentYear = new Date().getFullYear(); 761 var currentMonth = new Date().getMonth() + 1; 762 var seasonStartYear = parseInt(selectedSeason.split("-")[0]); 763 var seasonEndYear = parseInt(selectedSeason.split("-")[1]); 764 765 var monthOptions = ['<option value="" selected="selected"></option>']; 766 if (currentMonth <= 12) { 767 for (var i = currentMonth; i <= 12; i++) { 768 var month = i < 10 ? "0" + i : i; 769 monthOptions.push( 770 `<option value="${seasonStartYear}-${month}"></option>` 771 ); 772 } 773 } 774 if (currentMonth > 1) { 775 for (var i = 1; i < currentMonth; i++) { 776 var month = i < 10 ? "0" + i : i; 777 monthOptions.push(`<option value="${seasonEndYear}-${month}"></option>`); 778 } 779 } 780 781 $(".select-month select").html(monthOptions.join("")); 782 $(".select-month select").val(""); 783} 784 785function create_calendar(events, newdate) { 786 var d = new Date(), 787 dia = d.getDate(), 788 mes = d.getMonth() + 1, 789 ano = d.getFullYear(); 790 791 dia = dia < 10 ? "0" + dia : dia; 792 mes = mes < 10 ? "0" + mes : mes; 793 794 var date = newdate || `${ano}-${mes}-${dia}`; 795 796 if ($(".daySlider").length === 0) { 797 console.error("daySlider element not found"); 798 return; 799 } 800 801 var [selectedYear, selectedMonth] = date.split("-"); 802 var daysInMonth = new Date(selectedYear, selectedMonth, 0).getDate(); 803 var daysList = ""; 804 var eventDays = $(".show-days") 805 .text() 806 .split(",") 807 .map((day) => day.trim()); 808 $(".show-days").remove(); 809 810 for (var i = 1; i <= daysInMonth; i++) { 811 var dayOfWeek = new Date(selectedYear, selectedMonth - 1, i).getDay(); 812 var isEventDay = eventDays.includes(i.toString()); 813 var eventClass = isEventDay ? "event" : ""; 814 daysList += `<div class="day ${eventClass} calendar-day-${i}-${selectedMonth}-${selectedYear} calendar-dow-${dayOfWeek}"><div class="day-contents"><small></small><span class="span-day">${i}</span> </div></div>`; 815 } 816 $(".daySlider").html(`${daysList}`); 817 818 $(".day.event").on("click", function () { 819 var classes = $(this).attr("class").split(/\s+/); 820 var targetClass = classes 821 .find((cls) => cls.startsWith("calendar-day-")) 822 .replace("calendar-day-", "filter-date-"); 823 var $target = $("." + targetClass); 824 825 if ($target.length) { 826 var offset = $(window).width() <= 991.98 ? 56 : 81; 827 $("#calendar").animate( 828 { 829 scrollTop: 830 $target.offset().top - 831 $("#calendar").offset().top + 832 $("#calendar").scrollTop() - 833 offset, 834 }, 835 500 836 ); 837 } 838 }); 839 840 var calendar_swiper = new Swiper(".swiper-container-calendar", { 841 freeMode: true, 842 slidesPerView: "auto", 843 spaceBetween: 0, 844 mousewheel: true, 845 speed: 50, 846 grabCursor: true, 847 }); 848 849 $(".calendar-toggle") 850 .off("click") 851 .on("click", function (e) { 852 if ( 853 $(window).width() <= 574 && 854 $("body").hasClass("homepage") && 855 !$(".calendar-content").hasClass("expand") 856 ) { 857 $(".calendar-content").addClass("expand"); 858 } 859 $(".calendar-content").fadeIn(150, function () {
860 calendar_swiper.update(); 861 }); 862 e.preventDefault(); 863 }); 864 865 $(".close-calendar") 866 .off("click") 867 .on("click", function () { 868 $(".calendar-content").fadeOut(150); 869 $("body").removeClass("overflow calendar-is-visible"); 870 }); 871 872 $(".select-month select") 873 .off("change") 874 .on("change", function () { 875 var selectedValue = $(this).val(); 876 $(".calendar-content").scrollTop(0); 877 var newdate = selectedValue; 878 $(".select-month select").val(newdate); 879 create_calendar(events, newdate); 880 }); 881} 882 883function create_galleries() { 884 if ($("html").attr("lang") == "en-US") { 885 var prevSlideMessageLang = "Previous slide", 886 nextSlideMessageLang = "Next slide", 887 firstSlideMessageLang = "This is the first slide", 888 lastSlideMessageLang = "This is the last slide", 889 paginationBulletMessageLang = "Go to slide {{index}}", 890 currentSlideMessageLang = "(current slide)"; 891 } else if ($("html").attr("lang") == "fr-FR") { 892 var prevSlideMessageLang = "Diapositive précédente", 893 nextSlideMessageLang = "Diapositive suivante", 894 firstSlideMessageLang = "Ceci est la première diapositive", 895 lastSlideMessageLang = "Ceci est la dernière diapositive", 896 paginationBulletMessageLang = "Aller à la diapositive {{index}}", 897 currentSlideMessageLang = "(diapositive en cours)"; 898 } else { 899 var prevSlideMessageLang = "Slide anterior", 900 nextSlideMessageLang = "Próximo slide", 901 firstSlideMessageLang = "Este é o primeiro slide", 902 lastSlideMessageLang = "Esté é o último slide", 903 paginationBulletMessageLang = "Ir para o slide {{index}}", 904 currentSlideMessageLang = "(slide atual)"; 905 } 906 907 gallery_slideshows = []; 908 909 var window_width = $(window).width(); 910 911 $(".swiper-gallery").each(function (index) { 912 var $this = $(this), 913 $next_btn = $(".swiper-button-next", $this), 914 $prev_btn = $(".swiper-button-prev", $this), 915 $pagination = $(".swiper-pagination-gallery", $this), 916 $current_slide_fraction = $(this).find(".current-slide"); 917 918 if (window.matchMedia("(max-width: 767px)").matches) { 919 var offset_before = 0, 920 offset_after = 0, 921 auto_height_setting = true; 922 } else { 923 var $last_slide = $(".swiper-slide:last-child", $this), 924 last_slide_width = $last_slide.width(), 925 offset_before = window_width / 4 + 7.5, 926 offset_after = 927 (window_width / 4) * 2 - last_slide_width + offset_before - 30, 928 auto_height_setting = false; 929 $last_slide.css("padding-right", offset_after + "px"); 930 } 931 932 var gallery_swiper = new Swiper($this, { 933 slidesPerView: "auto", 934 slidesOffsetBefore: offset_before, 935 slideToClickedSlide: true, 936 autoHeight: auto_height_setting, 937 pagination: { 938 el: ".swiper-pagination-gallery", 939 type: "bullets", 940 clickable: true, 941 }, 942 navigation: { 943 nextEl: $next_btn, 944 prevEl: $prev_btn, 945 }, 946 a11y: { 947 prevSlideMessage: prevSlideMessageLang, 948 nextSlideMessage: nextSlideMessageLang, 949 firstSlideMessage: firstSlideMessageLang, 950 lastSlideMessage: lastSlideMessageLang, 951 paginationBulletMessage: paginationBulletMessageLang, 952 }, 953 on: { 954 slideChange: function () { 955 $current_slide_fraction.text( 956 gallery_slideshows[index].activeIndex + 1 957 ); 958 }, 959 slideChangeTransitionEnd: function ($this) { 960 $(".swiper-pagination-gallery .swiper-pagination-bullet").each( 961 function (index, elem) { 962 var bullet = $(elem); 963 var ariaLabel = bullet.attr("aria-label"); 964 965 if (bullet.hasClass("swiper-pagination-bullet-active")) { 966 bullet.attr( 967 "aria-label", 968 ariaLabel + " " + currentSlideMessageLang 969 ); 970 } else { 971 bullet.attr( 972 "aria-label", 973 ariaLabel.replace(currentSlideMessageLang, "") 974 ); 975 } 976 } 977 ); 978 }, 979 }, 980 }); 981 gallery_slideshows.push(gallery_swiper); 982 console.log(gallery_slideshows); 983 }); 984} 985 986function check_show_max_items() { 987 $(".card-deck").each(function () { 988 var $this = $(this), 989 count_hidden_children = $(this).children(":hidden").length; 990 if (count_hidden_children == 0) { 991 $this.prev(".max-items-toggle-container").addClass("sr-only"); 992 } else { 993 $this.prev(".max-items-toggle-container").removeClass("sr-only"); 994 } 995 }); 996} 997 998function updateVisibleEvents() { 999 console.log("Updating visible events"); 1000 1001 // Debug: Log all select elements 1002 console.log("All select elements:", $("select").length); 1003 console.log("Visible select elements:", $("select:visible").length); 1004 1005 var $visibleSelect = $(".select-month select:visible"); 1006 var $hiddenSelect = $(".select-month select:hidden"); 1007 1008 console.log("Visible month select found:", $visibleSelect.length); 1009 console.log("Hidden month select found:", $hiddenSelect.length); 1010 1011 if ($visibleSelect.length === 0 && $hiddenSelect.length === 0) { 1012 console.error("No month select found at all"); 1013 // Attempt to find any select element as a fallback 1014 $visibleSelect = $("select:visible").first(); 1015 console.log("Fallback to any visible select:", $visibleSelect.length); 1016 } 1017 1018 var selected_value = $visibleSelect.val() || $hiddenSelect.val(); 1019 console.log("Selected month value:", selected_value); 1020 1021 if (selected_value) { 1022 if ($hiddenSelect.length > 0) { 1023 $hiddenSelect.val(selected_value); 1024 } 1025
1026 var current_month = selected_value.split("-"); 1027 console.log("Current month:", current_month); 1028 1029 $(".calendar-month-container").removeClass("is-visible"); 1030 var $visibleContainer = $( 1031 ".calendar-month-container.filter-date-" + 1032 current_month[1] + 1033 "-" + 1034 current_month[0] 1035 ); 1036 $visibleContainer.addClass("is-visible"); 1037 1038 console.log("Visible container found:", $visibleContainer.length); 1039 1040 var num_visible_events = $(".calendar-month-container.is-visible").length; 1041 console.log("Number of visible events:", num_visible_events); 1042 1043 $(".empty-message").toggleClass("is-visible", num_visible_events === 0); 1044 } else { 1045 console.error("No month selected"); 1046 // Show all events as a fallback 1047 $(".calendar-month-container").addClass("is-visible"); 1048 $(".empty-message").removeClass("is-visible"); 1049 } 1050} 1051 1052jQuery.fn.scrollTo = function (elem, speed) { 1053 $(this).animate( 1054 { 1055 scrollTop: 1056 $(this).scrollTop() - 1057 $(this).offset().top + 1058 $(elem).parent().parent().offset().top - 1059 $(".calendar-row-wrapper").height(), 1060 }, 1061 speed == undefined ? 300 : speed 1062 ); 1063 return this; 1064}; 1065 1066jQuery.fn.scrollToGlobal = function (elem, speed) { 1067 $("body,html").animate( 1068 { 1069 scrollTop: $(elem).position().top - 19, 1070 }, 1071 speed == undefined ? 300 : speed 1072 ); 1073 return this; 1074}; 1075 1076function lazy_load_images() { 1077 // $('.lazy').each(function(){ 1078 // $(this).attr("src",$(this).attr("data-src")); 1079 // }) 1080 $(".lazy").Lazy(); 1081} 1082 1083function get_url_vars() { 1084 var vars = {}; 1085 var parts = window.location.href.replace( 1086 /[?&]+([^=&]+)=([^&]*)/gi, 1087 function (m, key, value) { 1088 vars[key] = value; 1089 } 1090 ); 1091 return vars; 1092} 1093 1094function get_url_param(parameter, defaultvalue) { 1095 var urlparameter = defaultvalue; 1096 if (window.location.href.indexOf(parameter) > -1) { 1097 urlparameter = get_url_vars()[parameter]; 1098 } 1099 return urlparameter; 1100}
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.