1var language = document.documentElement.lang, 2 3 webSite = $(".title").html(); 4$(document).ready(function () { 5 6 Main.init(); 7 8}); 9$(document).ajaxComplete(function () { 10 Main.programsSizer(); 11 12 Main.ticketsListener(); 13 if ($(".programsSearchList li").length == 0 && $(".newsSearchList li").length == 0 && $(".contentSearchList li").length == 0) { 14 15 $("#search .bottomBox").hide(); 16 17 } 18}); 19$(window).on("load", function () { 20 // setTimeout(function () { 21 22 // Main.cookie(); 23 24 // }, 5000); 25 Main.scrollUp(); 26 if ($(".tabWrapper").length == 0) { 27 28 Main.programsCaro(); 29 30 Main.programsSizer(); 31 32 Main.newsCaro(); 33 34 } 35 else { 36 37 Main.tabListener(); 38 39 } 40 Main.galleriesCaro(); 41 42 Main.lightGallery(); 43}); 44$(window).on("resize", function () { 45 if (!$("body").is(".touch")) { 46 Main.programsCaro(); 47 48 Main.programsSizer(); 49 50 Main.newsCaro(); 51 52 Main.galleriesCaro(); 53 } 54}); 55var Main = function (window, document, $) { 56 var init = function () { 57 touchListener(); 58 59 browserListener(); 60 61 languagesListener(); 62 63 menuListener(); 64 65 searchListener(); 66 67 quickSearchListener(); 68 69 enter(); 70 71 backgroundListener(); 72 73 logosCaro(); 74 75 gallery(); 76 77 video(); 78 79 modalListener(); 80 81 mainTextBoxListener(); 82 } 83 var touchListener = function () { 84 if (Modernizr.touch) { 85 86 $("body").addClass("touch"); 87 88 } 89 } 90 var browserListener = function () { 91 var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0, 92 93 isFirefox = typeof InstallTrigger !== 'undefined', 94 95 isEdge = navigator.userAgent.indexOf('Edge') >= 0, 96 97 isChrome = !!window.chrome && !isOpera && !isEdge, 98 99 isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0 || !isChrome && !isOpera && window.webkitAudioContext !== undefined; 100 101 isIE = /*@cc_on!@*/false || !!document.documentMode; 102 if (isOpera) { $("body").addClass("opera"); } 103 104 if (isFirefox) { $("body").addClass("firefox"); } 105 106 if (isEdge) { $("body").addClass("edge"); } 107 108 if (isChrome) { $("body").addClass("chrome"); } 109 110 if (isSafari) { $("body").addClass("safari"); } 111 112 if (isIE) { $("body").addClass("explorer"); } 113 } 114 var cookie = function () { 115 116 var cookieMessage = $("#cookieMessage").html(), 117 118 cookieDismiss = $("#cookieDismiss").html(), 119 120 cookieLink = $("#cookieLink").html(), 121 122 cookieHref = $("#cookieLink").attr("href"); 123 124 window.cookieconsent.initialise({ 125 126 "theme": "classic", 127 128 "position": "bottom-right", 129 130 "content": { 131 132 "message": cookieMessage, 133 134 "dismiss": cookieDismiss, 135 136 "link": cookieLink, 137 138 "href": cookieHref 139 140 }, 141 "onPopupOpen": function () { 142 var cookieWindow = this.element; 143 var a = cookieWindow.querySelector(".cc-btn"); 144 var aLink = cookieWindow.querySelector(".cc-link"); 145 146 if (!a || !aLink || !cookieWindow) return; 147 148 cookieWindow.setAttribute("aria-label", "Cookie hozzájárulási párbeszédpanel"); 149 aLink.setAttribute("aria-label", "Adatkezelési szabályzat megtekintése"); 150 a.setAttribute("aria-label", "Adatkezelési szabályzat elfogadása"); 151 152 var messageElement = cookieWindow.querySelector(".cc-message"); 153 if (messageElement) { 154 messageElement.setAttribute("aria-label", messageElement.textContent.trim()); 155 messageElement.setAttribute("tabindex", "0"); 156 setTimeout(function () { messageElement.focus(); }, 100); 157 // Fókusz stÃlus hozzáadása és eltávolÃtása 158 messageElement.addEventListener('focus', function () { 159 this.style.outline = '2px solid rgb(16,16,16)'; // Fekete keret fókusz esetén 160 this.style.outlineOffset = '2px'; 161 }); 162 messageElement.addEventListener('blur', function () { this.style.outline = 'none'; }); // Keret eltávolÃtása, ha elmegy a fókusz 163 } 164 165 var focusableContent = cookieWindow.querySelectorAll('.cc-message, a[href], button, .cc-btn'); 166 var firstFocusableElement = focusableContent[0]; 167 var lastFocusableElement = focusableContent[focusableContent.length - 1]; 168 169 cookieWindow.addEventListener('keydown', function (e) { 170 var isTabPressed = e.key === 'Tab' || e.keyCode === 9; 171 var isEscPressed = e.key === 'Escape' || e.keyCode === 27; 172 173 if (isEscPressed) { 174 e.preventDefault(); 175 a.click(); 176 } 177 178 if (!isTabPressed) { return; } 179 180 if (e.shiftKey) { 181 if (document.activeElement === firstFocusableElement) { 182 lastFocusableElement.focus(); 183 e.preventDefault(); 184 } 185 } else { 186 if (document.activeElement === lastFocusableElement) { 187 firstFocusableElement.focus(); 188 e.preventDefault(); 189 } 190 } 191 }); 192 193 a.addEventListener("keypress", function (event) { 194 if (event.key === "Enter") { 195 event.preventDefault(); 196 this.click(); 197 } 198 }); 199 200 a.addEventListener("click", function () { 201 var body = document.querySelector("body"); 202 body.setAttribute("tabindex", "-1"); 203 body.focus(); 204 }); 205 } 206 }); 207 } 208 var scrollUp = function () { 209 $("html, body").animate({ scrollTop: 0 }, 100); 210 } 211 var languagesListener = function () { 212 if (!$("body").is(".touch")) { 213 $(".languagesBox").hover( 214 function () { 215 216 $(this).addClass("opened"); 217 218 $(this).children(".languagesMenu").stop(true).fadeIn(300); 219 220 }, 221 function () { 222 223 $(this).children(".languagesMenu").stop(true).fadeOut(300);
224 225 $(this).removeClass("opened"); 226 227 } 228 ); 229 } 230 else { 231 $(".languagesBox").on("click", function () { 232 if ($(this).hasClass("opened")) { 233 234 $(this).children(".languagesMenu").stop(true).slideUp(300); 235 236 $(this).removeClass("opened"); 237 238 } 239 else { 240 241 $(this).children(".languagesMenu").stop(true).slideDown(300); 242 243 $(this).addClass("opened"); 244 245 } 246 }); 247 } 248 249 250 251 } 252 var menuListener = function () { 253 $(".menuOpen").on("click", function () { 254 if (!$(this).hasClass("close")) { 255 $(".searchOpen").css("z-index", "auto"); 256 $("#subHeader, .menuOpen div, .menuClose").stop(true).fadeIn(300); 257 if ($(window).width() > 1199) { 258 setTimeout(function () { 259 260 menuSizer(); 261 262 }, 300); 263 } 264 else { 265 266 mobileMenuListener(); 267 268 } 269 if ($(window).width() < 400) { 270 271 $(".title").stop(true).delay(150).fadeIn(300); 272 273 titlePositioning(); 274 275 } 276 if ($("#mainCaro").length > 0) { 277 278 $("#mainCaro").trigger("stop.owl.autoplay"); 279 280 } 281 $("body").addClass("faded"); 282 283 $(this).addClass("close"); 284 } 285 else { 286 $("#subHeader, .menuOpen div, .menuClose").stop(true).fadeOut(300); 287 if ($(window).width() < 400) { 288 289 $(".title").stop(true).fadeOut(300); 290 291 } 292 if ($("#mainCaro").length > 0) { 293 294 $("#mainCaro").trigger("play.owl.autoplay"); 295 296 } 297 $("body").removeClass("faded"); 298 299 $(this).removeClass("close"); 300 setTimeout(function () { 301 302 $(".searchOpen").css("z-index", "1"); 303 304 }, 300); 305 if ($(window).width() < 1200) { 306 307 $(".mobile .menu").css("right", "0"); 308 309 $(".mobile .menu").css("min-height", "0"); 310 311 $(".subMenuBox, .subMenuBox2").fadeOut(300); 312 313 } 314 } 315 }); 316 $(".menuClose").on("click", function () { 317 $("#subHeader, .menuOpen div, .menuClose").stop(true).fadeOut(300); 318 if ($(window).width() < 400) { 319 320 $(".title").stop(true).fadeOut(300); 321 322 } 323 if ($("#mainCaro").length > 0) { 324 325 $("#mainCaro").trigger("play.owl.autoplay"); 326 327 } 328 $("body").removeClass("faded"); 329 330 $(".menuOpen").removeClass("close"); 331 setTimeout(function () { 332 333 $(".searchOpen").css("z-index", "1"); 334 335 }, 300); 336 if ($(window).width() < 1200) { 337 338 $(".mobile .menu").css("right", "0"); 339 340 $(".mobile .menu").css("min-height", "0"); 341 342 $(".subMenuBox, .subMenuBox2").fadeOut(300); 343 344 } 345 }); 346 if (!$("body").is(".touch")) { 347 $(document).keyup(function (e) { 348 if (e.keyCode === 27) { 349 $("#subHeader, .menuOpen div, .menuClose").stop(true).fadeOut(300); 350 if ($("#mainCaro").length > 0) { 351 352 $("#mainCaro").trigger("play.owl.autoplay"); 353 354 } 355 $("body").removeClass("faded"); 356 357 $(".menuOpen").removeClass("close"); 358 setTimeout(function () { 359 360 $(".searchOpen").css("z-index", "1"); 361 362 }, 300); 363 } 364 }); 365 } 366 } 367 var menuSizer = function () { 368 var i = 0, 369 370 number = 5, 371 372 maxHeight = 0; 373 $(".subHeaderNav .menu > li:not(.main)").css("height", "auto"); 374 375 376 377 if ($(window).width() > 1199) { 378 $(".subHeaderNav .menu > li:not(.main)").each(function () { 379 380 381 382 maxHeight = 0; 383 $(".subHeaderNav .menu > li:not(.main)").slice(i, i + number).each(function () { 384 385 386 387 var height = $(this).innerHeight(); 388 if (height >= maxHeight) { 389 390 maxHeight = height; 391 392 } 393 }); 394 $(".subHeaderNav .menu > li:not(.main)").slice(i, i + number).css("height", maxHeight + "px"); 395 396 397 398 i += number; 399 400 401 402 }); 403 } 404 } 405 var mobileMenuListener = function () { 406 var height = $(".additionsBox").innerHeight(); 407 $(".subHeaderNav").css("height", "calc(100% - " + height + "px)"); 408 $(".hasSubMenu > a").on("click", function () { 409 var height = $(this).siblings().height(); 410 411 412 413 if ($(this).siblings().is(".subMenuBox")) { 414 415 $(".mobile .menu").css("right", "100%"); 416 417 } 418 else { 419 420 $(".mobile .menu").css("right", "200%"); 421 422 } 423 $(this).siblings().fadeIn(300); 424 425 $(".mobile .menu").css("min-height", height + "px"); 426 }); 427 $(".backLevel").on("click", function () { 428 var height; 429 430 431 432 if ($(this).parent().is(".subMenuBox")) { 433 434 $(".mobile .menu").css("right", "0"); 435 436 height = 0; 437 438 } 439 else { 440 441 $(".mobile .menu").css("right", "100%"); 442 443 height = $(this).parents(".subMenuBox").height(); 444 445 } 446 $(this).parent().fadeOut(300);
447 448 $(".mobile .menu").css("min-height", height + "px"); 449 450 451 452 }); 453 } 454 var searchListener = function () { 455 $(".searchOpen").on("click", function () { 456 if (!$(this).hasClass("close")) { 457 $(".menuOpen").css("z-index", "auto"); 458 $("#search, .searchOpen div, .menuClose").stop(true).fadeIn(300); 459 if ($(window).width() < 400) { 460 461 $(".title").stop(true).delay(150).fadeIn(300); 462 463 titlePositioning(); 464 465 } 466 if ($("#mainCaro").length > 0) { 467 468 $("#mainCaro").trigger("stop.owl.autoplay"); 469 470 } 471 $("body").addClass("faded"); 472 473 $(this).addClass("close"); 474 $("#search input").focus(); 475 $("#searchForm").on("submit", function (event) { 476 477 event.preventDefault(); 478 479 event.stopPropagation(); 480 481 }); 482 } 483 else { 484 $("#search, .searchOpen div, .menuClose").stop(true).fadeOut(300); 485 if ($(window).width() < 400) { 486 487 $(".title").stop(true).fadeOut(300); 488 489 } 490 if ($("#mainCaro").length > 0) { 491 492 $("#mainCaro").trigger("play.owl.autoplay"); 493 494 } 495 $("body").removeClass("faded"); 496 497 $(this).removeClass("close"); 498 setTimeout(function () { 499 500 $(".menuOpen").css("z-index", "1"); 501 502 }, 300); 503 $(".programsSearchList li, .newsSearchList li, .contentSearchList li").remove(); 504 505 $("#search .bottomBox, .programsSearchBox, .newsSearchBox, .contentSearchBox").hide(); 506 507 $("#search input").val(""); 508 } 509 }); 510 $(".menuClose").on("click", function () { 511 $("#search, .searchOpen div, .menuClose").stop(true).fadeOut(300); 512 if ($(window).width() < 400) { 513 514 $(".title").stop(true).fadeOut(300); 515 516 } 517 if ($("#mainCaro").length > 0) { 518 519 $("#mainCaro").trigger("play.owl.autoplay"); 520 521 } 522 $("body").removeClass("faded"); 523 524 $(".searchOpen").removeClass("close"); 525 setTimeout(function () { 526 527 $(".menuOpen").css("z-index", "1"); 528 529 }, 300); 530 $(".programsSearchList li, .newsSearchList li, .contentSearchList li").remove(); 531 532 $("#search .bottomBox, .programsSearchBox, .newsSearchBox, .contentSearchBox").hide(); 533 534 $("#search input").val(""); 535 }); 536 if (!$("body").is(".touch")) { 537 $(document).keyup(function (e) { 538 if (e.keyCode === 27) { 539 540 541 542 $("#search, .searchOpen div, .menuClose").stop(true).fadeOut(300); 543 if ($("#mainCaro").length > 0) { 544 545 $("#mainCaro").trigger("play.owl.autoplay"); 546 547 } 548 $("body").removeClass("faded"); 549 550 $(".searchOpen").removeClass("close"); 551 setTimeout(function () { 552 553 $(".menuOpen").css("z-index", "1"); 554 555 }, 300); 556 $(".programsSearchList li, .newsSearchList li, .contentSearchList li").remove(); 557 558 $("#search .bottomBox, .programsSearchBox, .newsSearchBox, .contentSearchBox").hide(); 559 560 $("#search input").val(""); 561 } 562 }); 563 } 564 } 565 var titlePositioning = function () { 566 var width = $(".pattern").innerWidth(), 567 568 padding = 15, 569 570 left = width + padding; 571 $(".title").css("left", left + "px"); 572 } 573 var quickSearchListener = function () { 574 var expression = "", 575 576 length = 0, 577 578 href = $(".detailedSearch").data("href"); 579 580 581 582 $("body").on("input", "#search input", function (e) { 583 expression = $(this).val(); 584 585 length = expression.length; 586 587 $("#gyorskereso").keydown(function (e) { 588 if (e.keyCode == 13) { 589 window.location.replace(href + "#list#expression#" + expression); 590 } 591 }); 592 593 594 if (length > 2) { 595 programsSearchList(expression); 596 597 newsSearchList(expression); 598 599 contentSearchList(expression); 600 601 $(".detailedSearch").on("click", function () { 602 $(this).attr("href", href + "#list#expression#" + expression); 603 604 }); 605 606 } 607 else { 608 $(".programsSearchList li, .newsSearchList li, .contentSearchList li").remove(); 609 610 $("#search .bottomBox, .programsSearchBox, .newsSearchBox, .contentSearchBox").hide(); 611 $(".detailedSearch").on("click", function () { 612 613 $(this).attr("href", href); 614 615 }); 616 } 617 e.preventDefault(); 618 }); 619 $(".detailedSearch").on("click", function () { 620 621 $(this).attr("href", href); 622 623 }); 624 } 625 var programsSearchList = function (expression) { 626 627 628 629 $(".programsSearchList li").remove(); 630 631 632 633 $.ajax({
634 635 636 637 type: "POST", 638 639 url: "/programs_url", 640 641 dataType: "json", 642 643 data: { lang: language, name: expression, type: 8 }, 644 645 success: function (data) { 646 647 648 649 var name; 650 651 652 653 $.each(data.response, function (i, val) { 654 655 656 657 $.each(this, function (i2, val2) { 658 659 660 661 var item = 662 663 '<li'; 664 665 if (val2.webSite != webSite) { 666 667 item += ' class="hasHoverInfo"'; 668 669 } 670 671 item += '>' + 672 673 '<a class="clearfix" href="' + val2.url + '"'; 674 675 if (val2.webSite != webSite) { 676 677 item += ' target="_blank"'; 678 679 } 680 681 item += '>' + 682 683 '<figure class="imgBox">' + 684 685 '<img src="' + val2.main_src + '" alt="' + val2.alt + '">' + 686 687 '<img class="hoverImage" src="' + val2.webSiteImage + '" alt="' + val2.webSite + '">' + 688 689 '</figure>' + 690 691 '<div class="descriptionBox">' + 692 693 '<div class="cell">' + 694 695 '<h3>' + val2.name + '</h3>'; 696 697 name = val2.name; 698 699 if (val2.date_string != "") { 700 701 item += '<time datetime="' + val2.date + ' ' + val2.time + '">' + val2.date_string + '</time>'; 702 703 } 704 705 item += '</div>' + 706 707 '</div>' + 708 709 '</a>' + 710 711 '</li>'; 712 713 714 715 if ($(".programsSearchList li").length == 0) { 716 717 $(".programsSearchList").append(item); 718 719 } 720 721 722 723 else { 724 725 726 727 var titlesArray = []; 728 729 730 731 $(".programsSearchList li").each(function () { 732 733 734 735 var title = $(this).find("h3").html(); 736 737 738 739 titlesArray.push(title); 740 741 742 743 }); 744 745 746 747 if (jQuery.inArray(name, titlesArray) == -1) { 748 749 $(".programsSearchList").append(item); 750 751 } 752 753 754 755 } 756 757 758 759 }); 760 761 762 763 }); 764 765 766 767 if ($(".programsSearchList li").length > 0) { 768 769 $("#search .bottomBox, .programsSearchBox").fadeIn(300); 770 771 } 772 773 774 775 else { 776 777 $(".programsSearchBox").hide(); 778 779 } 780 781 782 783 } 784 785 786 787 }); 788 789 790 791 } 792 // var programsSearchList = function(expression) { 793 // $(".programsSearchList li").remove(); 794 // $.ajax({
795 // type: "POST", 796 797 // url: "/programs_url2", 798 799 // dataType: "json", 800 801 // data: { lang : language, name : expression, type : 8 }, 802 803 // success: function(data) { 804 // var name; 805 806 807 808 // $.each(data.response, function(i, val) { 809 // $.each(this, function(i2, val2) { 810 // var item = 811 812 // '<li'; 813 814 // if (val2.webSite != webSite) { 815 816 // item += ' class="hasHoverInfo"'; 817 818 // } 819 820 // item += '>' + 821 822 // '<a class="clearfix" href="' + val2.url + '"'; 823 824 // if (val2.webSite != webSite) { 825 826 // item += ' target="_blank"'; 827 828 // } 829 830 // item += '>' + 831 832 // '<figure class="imgBox">' + 833 834 // '<img src="' + val2.main_src + '" alt="' + val2.alt + '">' + 835 836 // '<img class="hoverImage" src="' + val2.webSiteImage + '" alt="' + val2.webSite + '">' + 837 838 // '</figure>' + 839 840 // '<div class="descriptionBox">' + 841 842 // '<div class="cell">' + 843 844 // '<h3>' + val2.name + '</h3>'; 845 846 // name = val2.name; 847 848 // if (val2.date_string != "") { 849 850 // item += '<time datetime="' + val2.date + ' ' + val2.time + '">' + val2.date_string + '</time>'; 851 852 // } 853 854 // item += '</div>' + 855 856 // '</div>' + 857 858 // '</a>' + 859 860 // '</li>'; 861 // if ($(".programsSearchList li").length == 0) { 862 863 // $(".programsSearchList").append(item); 864 865 // } 866 // else { 867 // var titlesArray = []; 868 // $(".programsSearchList li").each(function() { 869 // var title = $(this).find("h3").html(); 870 871 872 873 // titlesArray.push(title); 874 875 876 877 // }); 878 // if (jQuery.inArray(name,titlesArray) == -1) { 879 880 // $(".programsSearchList").append(item); 881 882 // } 883 // } 884 // }); 885 886 887 888 // }); 889 // if ($(".programsSearchList li").length > 0) { 890 891 // $("#search .bottomBox, .programsSearchBox").fadeIn(300); 892 893 // } 894 // else { 895 896 // $(".programsSearchBox").hide(); 897 898 // } 899 // } 900 // }); 901 // } 902 var newsSearchList = function (expression) { 903 $(".newsSearchList li").remove(); 904 $.ajax({
905 type: "POST", 906 907 url: "/news_url", 908 909 dataType: "json", 910 911 data: { lang: language, name: expression }, 912 913 success: function (data) { 914 915 document.getElementById('newsQuickSearcher').innerHTML = ''; 916 917 $.each(data.response, function (i, val) { 918 var item = '<li><a class="clearfix" href="' + val.url + '">' + val.name + '</a></li>'; 919 $(".newsSearchList").append(item); 920 }); 921 if ($(".newsSearchList li").length > 0) { 922 923 $("#search .bottomBox, .newsSearchBox").fadeIn(300); 924 925 } 926 927 else { 928 929 $(".newsSearchBox").hide(); 930 931 } 932 } 933 }); 934 } 935 var contentSearchList = function (expression) { 936 $(".contentSearchList li").remove(); 937 $.ajax({ 938 type: "POST", 939 940 url: "/contents_url", // Eredeti fájlban /contents_url volt 941 942 dataType: "json", 943 944 data: { lang: language, name: expression }, 945 946 success: function (data) { 947 948 949 950 $.each(data.response, function (i, val) { 951 var item = '<li><a class="clearfix" href="' + val.url + '">' + val.name + '</a></li>'; 952 $(".contentSearchList").append(item); 953 954 955 956 }); 957 if ($(".contentSearchList li").length > 0) { 958 959 $("#search .bottomBox, .contentSearchBox").fadeIn(300); 960 961 } 962 else { 963 964 $(".contentSearchBox").hide(); 965 966 } 967 } 968 }); 969 } 970 var enter = function () { 971 if ($(".quickSearch").length > 0) { 972 $("body").on("keypress", "#quickSearchForm input", function (e) { 973 if (e.which == 13) { 974 975 976 977 var expression = $("#quickSearchForm input").val(), 978 979 length; 980 $(".searchOpen").trigger("click"); 981 982 $("#search input").val(expression); 983 // expression = $(this).val(); // Ez már megvan fentebb 984 length = expression.length; 985 if (length > 2) { 986 987 programsSearchList(expression); 988 989 newsSearchList(expression); 990 991 contentSearchList(expression); 992 993 } 994 e.preventDefault(); 995 996 997 998 } 999 }); 1000 } 1001 } 1002 var backgroundListener = function () { 1003 $(".hasBackgroundImage").each(function () { 1004 var backgroundImage = $(this).data("background-image"), 1005 1006 backgroundImageColor = $(this).data("background-image-color"), 1007 1008 backgroundImageMobile; 1009 $(this).prepend("<figure class='backgroundImage'></figure>"); 1010 1011 1012 1013 if ($(this).is(".mainItem") && $(window).width() < 768) { 1014 1015 backgroundImageMobile = $(this).data("background-image-mobile"); 1016 1017 $(this).find(".backgroundImage").css("background-image", "url('" + backgroundImageMobile + "')"); 1018 1019 } 1020 1021 1022 1023 else { 1024 1025 $(this).find(".backgroundImage").css("background-image", "url('" + backgroundImage + "')"); 1026 1027 } 1028 $(this).find(".backgroundImage").css("background-color", backgroundImageColor); 1029 }); 1030 $(".hasBackgroundColor").each(function () { 1031 var backgroundColor = $(this).data("background-color"); 1032 1033 1034 1035 $(this).css("background-color", backgroundColor); 1036 }); 1037 } 1038 1039 var programsCaro = function (calendarYear, calendarMonth, calendarDay) { // Ãj paraméterek naptár nézethez 1040 $(".programsSection:visible, .programsSection.archive").each(function () { 1041 var section = $(this), 1042 owl = section.find(".programsCaro"), 1043 pager = section.find(".caroPager"), 1044 listener = false,
1045 // contentID = section.data("content-id"), // Ezt a getProgramAjaxBaseParams már kezeli 1046 // isSearch = section.data("search"), // Ezt a getProgramAjaxBaseParams már kezeli 1047 // tab = section.data("tab"), // Ezt a getProgramAjaxBaseParams már kezeli 1048 data, 1049 stageWidth; 1050 1051 // Lazy load állapot inicializálása minden section-höz 1052 section.data('currentProgramPage', 1); 1053 section.data('isLoadingMorePrograms', false); 1054 section.data('hasMoreProgramsToLoad', true); 1055 1056 if (section.find(".programsCaro").hasClass("center") || $(window).width() < 768) { 1057 listener = true; 1058 } 1059 1060 data = Main.getProgramAjaxBaseParams(section, calendarYear, calendarMonth, calendarDay); // Paraméterek továbbadása 1061 1062 // Lapozási paraméterek hozzáadása a kezdeti hÃváshoz 1063 data.lang = language; // BiztosÃtjuk, hogy a lang mindig benne legyen 1064 data.program_page = section.data('currentProgramPage'); // Kezdetben 1 1065 data.programs_limit = 10; // Oldalankénti elemszám, igény szerint módosÃtható 1066 1067 if (owl.data('owl.carousel') && owl.data('scrollEventBound')) { 1068 owl.off('translated.owl.carousel'); 1069 owl.data('scrollEventBound', false); 1070 } 1071 1072 section.find(".programsCaro").owlCarousel("destroy"); 1073 section.find(".programsItem").remove(); 1074 owl.owlCarousel({ center: listener, autoWidth: true, smartSpeed: 1000, dots: false, lazyLoad: true }); 1075 1076 $.ajax({
1077 type: "POST", 1078 url: "/programs_url", 1079 dataType: "json", 1080 data: data, 1081 success: function (data) { 1082 if (data.response && data.response.length > 0) { 1083 $.each(data.response, function (idx, programData) { 1084 var itemHtml = Main.createProgramHtml(programData, section, webSite, language); 1085 if (itemHtml) { 1086 owl.trigger("add.owl.carousel", [jQuery(itemHtml)]); 1087 } 1088 }); 1089 } 1090 owl.trigger("refresh.owl.carousel"); 1091 1092 if (data.program_pagination) { 1093 section.data('hasMoreProgramsToLoad', data.program_pagination.has_more_programs); 1094 section.data('currentProgramPage', data.program_pagination.current_program_page + 1); 1095 } else { 1096 section.data('hasMoreProgramsToLoad', false); 1097 } 1098 section.data('isLoadingMorePrograms', false); 1099 1100 if (!owl.data('scrollEventBound')) { 1101 owl.on('translated.owl.carousel', function (event) { 1102 var currentSection = $(this).closest('.programsSection'); 1103 if (!currentSection.data('isLoadingMorePrograms') && currentSection.data('hasMoreProgramsToLoad')) { 1104 var itemsPerPage = event.page.size; 1105 var totalItems = event.item.count; 1106 var currentIndex = event.item.index; 1107 if (totalItems > 0 && (currentIndex + itemsPerPage >= totalItems - (itemsPerPage * 0.5))) { 1108 Main.loadMoreProgramsForSection(currentSection, calendarYear, calendarMonth, calendarDay); // Paraméterek továbbadása 1109 } 1110 } 1111 }); 1112 owl.data('scrollEventBound', true); 1113 } 1114 1115 stageWidth = section.find(".owl-stage").innerWidth(); 1116 if ((listener == false && stageWidth > $(window).width()) || (listener == true && stageWidth > $(window).width() / 2)) { 1117 pager.show(); 1118 var $prevPager = section.find(".caroPager.prev"); 1119 var $nextPager = section.find(".caroPager.next"); 1120 1121 $prevPager.attr("tabindex", "0").attr("role", "button") 1122 .attr("aria-label", "ElÅzÅ programok") 1123 .off("click keydown") 1124 .on("click", function () { 1125 owl.trigger("prev.owl.carousel"); 1126 }) 1127 .on("keydown", function (e) { 1128 if (e.key === "Enter" || e.key === " ") { 1129 e.preventDefault(); 1130 owl.trigger("prev.owl.carousel"); 1131 } 1132 }); 1133 1134 $nextPager.attr("tabindex", "0").attr("role", "button") 1135 .attr("aria-label", "KövetkezÅ programok") 1136 .off("click keydown") 1137 .on("click", function () { 1138 owl.trigger("next.owl.carousel"); 1139 }) 1140 .on("keydown", function (e) { 1141 if (e.key === "Enter" || e.key === " ") { 1142 e.preventDefault(); 1143 owl.trigger("next.owl.carousel"); 1144 } 1145 }); 1146 } 1147 else { 1148 pager.hide(); 1149 } 1150 1151 var currentIsSearch = section.data("search"); 1152 if (currentIsSearch == 1) { 1153 if (!section.is(".archive")) { 1154 if (section.find(".programsItem").length == 0) { 1155 section.addClass("withoutPrograms"); 1156 pager.hide(); 1157 } 1158 else { 1159 section.removeClass("withoutPrograms"); 1160 } 1161 } 1162 else { 1163 if (section.find(".programsItem").length > 0) { 1164 section.show(); 1165 if ((listener == false && stageWidth > $(window).width()) || (listener == true && stageWidth > $(window).width() / 2)) { 1166 var $prevPagerArchive = section.find(".caroPager.prev"); 1167 var $nextPagerArchive = section.find(".caroPager.next"); 1168 pager.show(); 1169 $prevPagerArchive.attr("tabindex", "0").attr("role", "button").attr("aria-label", "ElÅzÅ programok") 1170 .off("click keydown").on("click", function () { owl.trigger("prev.owl.carousel"); })
1171 .on("keydown", function (e) { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); owl.trigger("prev.owl.carousel"); } }); 1172 1173 $nextPagerArchive.attr("tabindex", "0").attr("role", "button").attr("aria-label", "KövetkezÅ programok") 1174 .off("click keydown").on("click", function () { owl.trigger("next.owl.carousel"); }) 1175 .on("keydown", function (e) { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); owl.trigger("next.owl.carousel"); } }); 1176 1177 } else { 1178 pager.hide(); 1179 } 1180 } else { 1181 section.hide(); 1182 pager.hide(); 1183 } 1184 } 1185 } 1186 }, 1187 error: function () { 1188 section.data('isLoadingMorePrograms', false); 1189 } 1190 }); 1191 }); 1192 } 1193 1194 var loadMoreProgramsForSection = function (sectionElement, calendarYear, calendarMonth, calendarDay) { // Ãj paraméterek 1195 var section = $(sectionElement); 1196 var owl = section.find(".programsCaro"); 1197 1198 if (section.data('isLoadingMorePrograms') || !section.data('hasMoreProgramsToLoad')) { 1199 return; 1200 } 1201 1202 section.data('isLoadingMorePrograms', true); 1203 1204 var ajaxDataForLoadMore = Main.getProgramAjaxBaseParams(section, calendarYear, calendarMonth, calendarDay); // Paraméterek továbbadása 1205 1206 ajaxDataForLoadMore.lang = language; 1207 ajaxDataForLoadMore.program_page = section.data('currentProgramPage'); 1208 ajaxDataForLoadMore.programs_limit = 10; 1209 1210 $.ajax({
1211 type: "POST", 1212 url: "/programs_url", 1213 dataType: "json", 1214 data: ajaxDataForLoadMore, 1215 success: function (data) { 1216 if (data.response && data.response.length > 0) { 1217 $.each(data.response, function (idx, programData) { 1218 var itemHtml = Main.createProgramHtml(programData, section, webSite, language); 1219 if (itemHtml) { 1220 owl.trigger("add.owl.carousel", [jQuery(itemHtml)]); 1221 } 1222 }); 1223 owl.trigger("refresh.owl.carousel"); 1224 Main.programsSizer(); 1225 } 1226 1227 if (data.program_pagination) { 1228 section.data('hasMoreProgramsToLoad', data.program_pagination.has_more_programs); 1229 section.data('currentProgramPage', data.program_pagination.current_program_page + 1); 1230 } else { 1231 section.data('hasMoreProgramsToLoad', false); 1232 } 1233 section.data('isLoadingMorePrograms', false); 1234 }, 1235 error: function () { 1236 section.data('isLoadingMorePrograms', false); 1237 } 1238 }); 1239 } 1240 1241 var createProgramHtml = function (val2, section, currentWebSite, currentLanguage) { 1242 var item = '<div class="programsItem ' + (val2.class || '') + ' '; 1243 if (val2.webSite != currentWebSite) { 1244 item += 'hasHoverInfo'; 1245 } 1246 item += '">'; 1247 1248 if (val2.tags && val2.tags.length > 0) { 1249 item += '<ul class="tagsList clearfix">'; 1250 $.each(val2.tags, function (i3, val3) { 1251 item += '<li><a href="' + (val2.tags_url || '#') + '#list#tag#' + (val3.url || '') + '">' + (val3.name || '') + '</a></li>'; 1252 }); 1253 item += '</ul>'; 1254 } 1255 1256 item += '<a href="' + (val2.url || '#') + '" tabindex="0"'; 1257 if (val2.webSite != currentWebSite) { 1258 item += ' target="_blank"'; 1259 } 1260 item += '>' + 1261 '<figure class="imgBox">' + 1262 '<img src="'; 1263 if ($(window).width() > 767) { 1264 item += val2.src || '/static/images/common/placeholder.jpg'; 1265 } else { 1266 item += val2.normal_src || '/static/images/common/placeholder.jpg'; 1267 } 1268 item += '" alt="' + (val2.alt || val2.name || '') + '">' + 1269 '<img class="hoverImage" src="' + (val2.webSiteImage || '') + '" alt="' + (val2.webSite || '') + '">' + 1270 '</figure>' + 1271 '<div class="descriptionBox">'; 1272 1273 if (val2.flag && val2.flag.name != "") { 1274 item += '<div class="badge ' + (val2.flag.class || '') + '"><span>' + val2.flag.name + '</span></div>'; 1275 } 1276 item += '<span class="hoverText">' + (val2.webSite || '') + '</span>'; 1277 if (val2.date_string != "") { 1278 item += '<time datetime="' + (val2.date || '') + ' ' + (val2.time || '') + '">' + val2.date_string + '</time>'; 1279 } 1280 item += '<h3>' + (val2.name || '') + '</h3>' + 1281 '<p>' + (val2.heading_short || '') + '</p>' + 1282 '</div>' + 1283 '</a>'; 1284 1285 if (!section.is(".archive")) { 1286 item += '<a class="btn ticketsListener" href="#ticketsModal" data-toggle="modal" data-url="' + (val2.modal_url || '') + '" data-program="' + (val2.id || '') + '" data-lang="' + currentLanguage + '" data-day="' + (val2.date || '') + '" data-date-print="' + (val2.date_string || '') + '">' + (val2.ticket_button || 'Jegyvásárlás') + '</a>' + // Added ticketsListener class and data attributes 1287 '<div class="hide">' + 1288 '<ul class="colorsList">' + 1289 '<li>' + (val2.colors ? (val2.colors.head || '') : '') + '</li>' + 1290 '<li>' + (val2.colors ? (val2.colors.body || '') : '') + '</li>' + 1291 '<li>' + (val2.colors ? (val2.colors.footer || '') : '') + '</li>' + 1292 '</ul>' + 1293 '<h6 class="date">' + (val2.date || '') + '</h6>' + 1294 '<h6 class="time">' + (val2.time || '') + '</h6>' + 1295 '<h6 class="dateString">' + (val2.date_string || '') + '</h6>' + 1296 '<h5>' + (val2.webSite || '');
1297 if (val2.place != "") { item += ' | ' + val2.place; } 1298 item += '</h5>'; 1299 if (val2.subtitle != "") { item += '<h4>' + val2.subtitle + '</h4>'; } 1300 item += '<p>' + (val2.heading || '') + '</p>'; 1301 if (val2.ticket_types && val2.ticket_types.length > 0) { 1302 item += '<div class="ticketsBox ' + (val2.ticket_content ? '' : 'withoutTextBox') + '"><ul class="ticketsList">'; 1303 $.each(val2.ticket_types, function (i, t) { item += '<li><strong>' + (t.name || '') + '</strong><p>' + (t.price || '') + '</p><span>' + (t.text || '') + '</span></li>'; }); 1304 item += '</ul>'; 1305 if (val2.ticket_content) item += '<article class="mainTextBox">' + val2.ticket_content + '</article>'; 1306 item += '</div>'; 1307 } else if (val2.ticket_content) { 1308 item += '<div class="ticketsBox withoutList"><article class="mainTextBox">' + val2.ticket_content + '</article></div>'; 1309 } else { item += '<div class="ticketsBox withoutList withoutTextBox"></div>'; } 1310 1311 item += '<span>' + (val2.ticket_url || '') + '</span>' + 1312 '</div>'; 1313 } 1314 item += '</div>'; 1315 return item; 1316 } 1317 1318 var getProgramAjaxBaseParams = function (section, calendarYear, calendarMonth, calendarDay) { // Ãj paraméterek 1319 var contentID = section.data("content-id"); 1320 var isSearch = section.data("search"); 1321 var tab = section.data("tab"); 1322 var baseParams = {}; 1323 1324 if (isSearch == 1) { 1325 if (tab == "list") { 1326 var expression = $("#filtersForm").data("expression") || ""; 1327 var filters = $("#filtersForm").data("filters") || ""; 1328 var dateType = $("#filtersForm").data("date-type") || ""; 1329 var dateStart = $("#filtersForm").data("date-start") || ""; 1330 var dateEnd = $("#filtersForm").data("date-end") || ""; 1331 1332 if (dateType === "" || section.is(".archive")) { 1333 baseParams = { content_id: contentID, name: expression, tags: filters }; 1334 } else { 1335 var date = new Date(); 1336 var currentDayFormatted = $.datepicker.formatDate("yy-mm-dd", date); // Dátumformátum javÃtva yy-mm-dd-re 1337 var daysInMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(); 1338 1339 if (dateType == "1") { baseParams = { content_id: contentID, name: expression, tags: filters, day_number: 1, date_start: currentDayFormatted }; } 1340 else if (dateType == "2") { baseParams = { content_id: contentID, name: expression, tags: filters, day_number: 7, date_start: currentDayFormatted }; } // Heti nézet 1341 else if (dateType == "3") { 1342 baseParams = { content_id: contentID, name: expression, tags: filters, day_number: daysInMonth, date_start: currentDayFormatted }; 1343 } 1344 else if (dateType == "4") { baseParams = { content_id: contentID, name: expression, tags: filters, date_start: dateStart, date_end: dateEnd }; } 1345 } 1346 } else { 1347 // Naptár nézet (nem "list" tab) 1348 var searchDate; 1349 var numDaysToFetch; 1350 1351 if (calendarYear && calendarMonth) { // Ãv és hónap mindenképp kell 1352 var formattedMonth = calendarMonth < 10 ? '0' + calendarMonth : calendarMonth; 1353 if (calendarDay) { // Konkrét napra kértünk programokat 1354 var formattedDay = calendarDay < 10 ? '0' + calendarDay : calendarDay; 1355 searchDate = calendarYear + "-" + formattedMonth + "-" + formattedDay; 1356 numDaysToFetch = 1; 1357 } else { // Egész hónapra kértünk programokat (calendarDay null vagy undefined) 1358 searchDate = calendarYear + "-" + formattedMonth + "-01"; // Hónap elsÅ napja 1359 numDaysToFetch = new Date(calendarYear, calendarMonth, 0).getDate(); // Napok száma az adott hónapban 1360 } 1361 } else { 1362 // Fallback, ha valamiért nem kapnánk meg (de elvileg meg kellene) 1363 // Ez a rész valószÃnűleg már nem szükséges, ha a hÃvások mindig adják a calendarYear/Month-ot 1364 // De biztonsági tartaléknak maradhat, bár a numDaysToFetch itt nem lenne helyes. 1365 // Ideális esetben a hÃvó oldalak (monthsCaro, daysCaro click) mindig adják a szükséges paramétereket. 1366 searchDate = $.datepicker.formatDate("yy-mm-dd", new Date()); 1367 numDaysToFetch = 1; // Alapértelmezettként egy napot kérünk 1368 } 1369 baseParams = { content_id: contentID, day_number: numDaysToFetch, date_start: searchDate }; 1370 } 1371 } else { 1372 var endDate = section.data("end-date") === '0000-00-00' ? null : section.data("end-date"); 1373 var startDate = section.data("start-date") === '0000-00-00' ? null : section.data("start-date"); 1374 baseParams = { content_id: contentID, date_start: startDate, date_end: endDate }; 1375 } 1376 if (typeof section.data('type') !== 'undefined') { 1377 baseParams.type = section.data('type'); 1378 } 1379 // console.log("getProgramAjaxBaseParams: Returning baseParams:", JSON.stringify(baseParams)); 1380 1381 return baseParams; 1382 } 1383 1384 var programsSizer = function () { 1385 $(".programsSection").each(function () { 1386 var maxHeight = 0; 1387 $(this).find(".programsItem .descriptionBox").css("height", "auto"); 1388 $(this).find(".programsItem").each(function () { 1389 var height = $(this).find(".descriptionBox").innerHeight(); 1390 if (height >= maxHeight) { 1391 1392 maxHeight = height; 1393 1394 } 1395 }); 1396 $(this).find(".programsItem .descriptionBox").css("height", maxHeight + "px"); 1397 }); 1398 } 1399 1400 var newsCaro = function () { 1401 $(".newsSection:visible").each(function () { 1402 var section = $(this), 1403 owl = section.find(".newsCaro"), 1404 pager = section.find(".caroPager"), 1405 listener = false, 1406 stageWidth; 1407 1408 section.data('currentNewsPage', 1); 1409 section.data('isLoadingMoreNews', false); 1410 section.data('hasMoreNewsToLoad', true); 1411 1412 if (section.find(".newsCaro").hasClass("center") || $(window).width() < 768) { 1413 listener = true; 1414 } 1415 1416 var ajaxData = Main.getNewsAjaxBaseParams(section); 1417 ajaxData.lang = language; 1418 ajaxData.news_page = section.data('currentNewsPage'); 1419 ajaxData.news_limit = 10; 1420 1421 if (owl.data('owl.carousel') && owl.data('scrollEventBoundNews')) { 1422 owl.off('translated.owl.carousel'); 1423 owl.data('scrollEventBoundNews', false); 1424 } 1425 1426 section.find(".newsCaro").owlCarousel("destroy"); 1427 section.find(".newsItem").remove(); 1428 owl.owlCarousel({ center: listener, autoWidth: true, smartSpeed: 1000, dots: false, lazyLoad: true });
1429 1430 $.ajax({ 1431 type: "POST", 1432 url: "/news_url", 1433 dataType: "json", 1434 data: ajaxData, 1435 success: function (data) { 1436 if (data.response && data.response.length > 0) { 1437 $.each(data.response, function (i, newsData) { 1438 var itemHtml = Main.createNewsHtml(newsData, section, webSite); 1439 if (itemHtml) { 1440 owl.trigger("add.owl.carousel", [jQuery(itemHtml)]); 1441 } 1442 }); 1443 } 1444 owl.trigger("refresh.owl.carousel"); 1445 1446 if (data.news_pagination) { 1447 section.data('hasMoreNewsToLoad', data.news_pagination.has_more_news); 1448 section.data('currentNewsPage', data.news_pagination.current_news_page + 1); 1449 } else { 1450 section.data('hasMoreNewsToLoad', false); 1451 } 1452 section.data('isLoadingMoreNews', false); 1453 1454 if (!owl.data('scrollEventBoundNews')) { 1455 owl.on('translated.owl.carousel', function (event) { 1456 var currentSection = $(this).closest('.newsSection'); 1457 if (!currentSection.data('isLoadingMoreNews') && currentSection.data('hasMoreNewsToLoad')) { 1458 var itemsPerPage = event.page.size; 1459 var totalItems = event.item.count; 1460 var currentIndex = event.item.index; 1461 if (totalItems > 0 && (currentIndex + itemsPerPage >= totalItems - (itemsPerPage * 0.5))) { 1462 Main.loadMoreNewsForSection(currentSection); 1463 } 1464 } 1465 }); 1466 owl.data('scrollEventBoundNews', true); 1467 } 1468 1469 stageWidth = section.find(".owl-stage").innerWidth(); 1470 if ((listener == false && stageWidth > $(window).width()) || (listener == true && stageWidth > $(window).width() / 2)) { 1471 pager.show(); 1472 var $prevPager = section.find(".caroPager.prev"); 1473 var $nextPager = section.find(".caroPager.next"); 1474 $prevPager.attr("tabindex", "0").attr("role", "button").attr("aria-label", "ElÅzÅ hÃrek") 1475 .off("click keydown").on("click", function () { owl.trigger("prev.owl.carousel"); }) 1476 .on("keydown", function (e) { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); owl.trigger("prev.owl.carousel"); } }); 1477 $nextPager.attr("tabindex", "0").attr("role", "button").attr("aria-label", "KövetkezÅ hÃrek") 1478 .off("click keydown").on("click", function () { owl.trigger("next.owl.carousel"); }) 1479 .on("keydown", function (e) { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); owl.trigger("next.owl.carousel"); } }); 1480 } else { 1481 pager.hide(); 1482 } 1483 1484 if (section.data("search") == 1) { 1485 if (section.find(".newsItem").length == 0) { 1486 section.hide(); 1487 } else { 1488 section.show(); 1489 } 1490 } 1491 }, 1492 error: function () { 1493 section.data('isLoadingMoreNews', false); 1494 } 1495 }); 1496 }); 1497 } 1498 1499 var loadMoreNewsForSection = function (sectionElement) { 1500 var section = $(sectionElement); 1501 var owl = section.find(".newsCaro"); 1502 1503 if (section.data('isLoadingMoreNews') || !section.data('hasMoreNewsToLoad')) { 1504 return; 1505 } 1506 section.data('isLoadingMoreNews', true); 1507 1508 var ajaxDataForLoadMore = Main.getNewsAjaxBaseParams(section); 1509 ajaxDataForLoadMore.lang = language; 1510 ajaxDataForLoadMore.news_page = section.data('currentNewsPage'); 1511 ajaxDataForLoadMore.news_limit = 10; 1512 1513 $.ajax({
1514 type: "POST", 1515 url: "/news_url", 1516 dataType: "json", 1517 data: ajaxDataForLoadMore, 1518 success: function (data) { 1519 if (data.response && data.response.length > 0) { 1520 $.each(data.response, function (idx, newsData) { 1521 var itemHtml = Main.createNewsHtml(newsData, section, webSite); 1522 if (itemHtml) { 1523 owl.trigger("add.owl.carousel", [jQuery(itemHtml)]); 1524 } 1525 }); 1526 owl.trigger("refresh.owl.carousel"); 1527 } 1528 1529 if (data.news_pagination) { 1530 section.data('hasMoreNewsToLoad', data.news_pagination.has_more_news); 1531 section.data('currentNewsPage', data.news_pagination.current_news_page + 1); 1532 } else { 1533 section.data('hasMoreNewsToLoad', false); 1534 } 1535 section.data('isLoadingMoreNews', false); 1536 }, 1537 error: function () { 1538 section.data('isLoadingMoreNews', false); 1539 } 1540 }); 1541 } 1542 1543 var createNewsHtml = function (val, section, currentWebSite) { 1544 var item = '<div class="newsItem ' + (val.class || '') + '">'; 1545 if (val.tags && val.tags.length > 0) { 1546 item += '<ul class="tagsList clearfix">'; 1547 $.each(val.tags, function (i2, val2) { 1548 if (i2 < 2) 1549 item += '<li><a href="' + (val.tags_url || '#') + '#' + (val2.url || '') + '">' + (val2.name || '') + '</a></li>'; 1550 }); 1551 item += '</ul>'; 1552 } 1553 1554 var linkClass = (val.class != "" && $(window).width() > 767) ? 'clearfix' : ''; 1555 item += '<a class="' + linkClass + '" href="' + (val.url || '#') + '" tabindex="0">'; 1556 1557 if (val.class != "" && $(window).width() > 767) { 1558 item += '<div class="contentLeft">' + 1559 '<div class="topBox clearfix">' + 1560 '<figure class="imgBox">' + 1561 '<img src="' + (val.author && val.author.src || '/static/images/common/placeholder.jpg') + '" alt="' + (val.author && val.author.alt || '') + '">' + 1562 '</figure>' + 1563 '<div class="detailsBox">' + 1564 '<p>' + (val.author && val.author.cim || '') + '</p>' + 1565 '<time datetime="' + (val.date || '') + ' ' + (val.time || '') + '"><strong>' + (val.date || '') + '</strong> ' + (val.time || '') + '</time>' + 1566 '</div>' + 1567 '</div>' + 1568 '<div class="descriptionBox">' + 1569 '<h3>' + (val.name || '') + '</h3>' + 1570 '</div>' + 1571 '</div>' + 1572 '<div class="contentRight">' + 1573 '<figure class="imgBox">' + 1574 '<img src="' + (val.src || '/static/images/common/placeholder.jpg') + '" alt="' + (val.alt || val.name || '') + '">' + 1575 '</figure>' + 1576 '<div class="hoverBox">' + 1577 '<p>' + (val.heading || '') + '</p>' + 1578 '</div>' + 1579 '</div>'; 1580 } else { 1581 item += '<div class="topBox clearfix">' + 1582 '<figure class="imgBox">' + 1583 '<img src="' + (val.author && val.author.src || '/static/images/common/placeholder.jpg') + '" alt="' + (val.author && val.author.alt || '') + '">' + 1584 '</figure>' + 1585 '<div class="detailsBox">' + 1586 '<p>' + (val.author && val.author.cim || '') + '</p>' + 1587 '<time datetime="' + (val.date || '') + ' ' + (val.time || '') + '"><strong>' + (val.date || '') + '</strong> ' + (val.time || '') + '</time>' + 1588 '</div>' + 1589 '</div>'; 1590 1591 item += '<div class="descriptionBox">' + 1592 '<h3>' + (val.name || '') + '</h3>' + 1593 '</div>'; 1594 1595 item += '<figure class="imgBox newsMainImage">' + 1596 '<img src="' + (val.src || '/static/images/common/placeholder.jpg') + '" alt="' + (val.alt || val.name || '') + '">' + 1597 '</figure>'; 1598
1599 item += '<div class="hoverBox">' + 1600 '<p>' + (val.heading || '') + '</p>' + 1601 '</div>'; 1602 } 1603 item += '</a></div>'; 1604 return item; 1605 } 1606 1607 var getNewsAjaxBaseParams = function (section) { 1608 var contentID = section.data("content-id"); 1609 var isSearch = section.data("search"); 1610 var baseParams = {}; 1611 1612 if (isSearch == 1) { 1613 var expression = $("#filtersForm").data("expression") || ""; 1614 var filters = $("#filtersForm").data("filters") || ""; 1615 var dateType = $("#filtersForm").data("date-type") || ""; 1616 1617 if (dateType == "") { 1618 baseParams = { content_id: contentID, name: expression, tags: filters }; 1619 } else { 1620 var day = $.datepicker.formatDate("yy-mm-dd", new Date()); // Dátumformátum javÃtva 1621 if (dateType == "1" || dateType == "2" || dateType == "3") { 1622 baseParams = { content_id: contentID, name: expression, tags: filters, day_number: 1, date_start: day }; 1623 } 1624 } 1625 } else { 1626 var endDate = section.data("end-date") === '0000-00-00' ? null : section.data("end-date"); 1627 var startDate = section.data("start-date") === '0000-00-00' ? null : section.data("start-date"); 1628 baseParams = { content_id: contentID, date_start: startDate, date_end: endDate }; 1629 } 1630 if (typeof section.data('type') !== 'undefined') { 1631 baseParams.type = section.data('type'); 1632 } 1633 return baseParams; 1634 } 1635 1636 1637 var galleriesCaro = function () { 1638 $(".galleriesSection").each(function () { 1639 var section = $(this), 1640 owl = section.find(".galleriesCaro"), 1641 pager = section.find(".caroPager"), 1642 listener = false, 1643 stageWidth; 1644 1645 section.data('currentGalleryPage', 1); 1646 section.data('isLoadingMoreGalleries', false); 1647 section.data('hasMoreGalleriesToLoad', true); 1648 1649 if (section.find(".galleriesCaro").hasClass("center") || $(window).width() < 768) { 1650 listener = true; 1651 } 1652 1653 var ajaxData = Main.getGalleriesAjaxBaseParams(section); 1654 ajaxData.lang = language; 1655 ajaxData.gallery_page = section.data('currentGalleryPage'); 1656 ajaxData.galleries_limit = 10; 1657 1658 if (owl.data('owl.carousel') && owl.data('scrollEventBoundGalleries')) { 1659 owl.off('translated.owl.carousel'); 1660 owl.data('scrollEventBoundGalleries', false); 1661 } 1662 1663 section.find(".galleriesCaro").owlCarousel("destroy"); 1664 section.find(".galleriesItem").remove(); 1665 owl.owlCarousel({ center: listener, autoWidth: true, smartSpeed: 1000, dots: false, lazyLoad: true }); 1666 1667 $.ajax({
1668 type: "POST", 1669 url: "/galleries_url", 1670 dataType: "json", 1671 data: ajaxData, 1672 success: function (data) { 1673 if (data.response && data.response.length > 0) { 1674 $.each(data.response, function (i, galleryData) { 1675 var itemHtml = Main.createGalleryHtml(galleryData, section, webSite); 1676 if (itemHtml) { 1677 owl.trigger("add.owl.carousel", [jQuery(itemHtml)]); 1678 } 1679 }); 1680 } 1681 owl.trigger("refresh.owl.carousel"); 1682 1683 if (data.gallery_pagination) { 1684 section.data('hasMoreGalleriesToLoad', data.gallery_pagination.has_more_galleries); 1685 section.data('currentGalleryPage', data.gallery_pagination.current_gallery_page + 1); 1686 } else { 1687 section.data('hasMoreGalleriesToLoad', false); 1688 } 1689 section.data('isLoadingMoreGalleries', false); 1690 1691 if (!owl.data('scrollEventBoundGalleries')) { 1692 owl.on('translated.owl.carousel', function (event) { 1693 var currentSection = $(this).closest('.galleriesSection'); 1694 if (!currentSection.data('isLoadingMoreGalleries') && currentSection.data('hasMoreGalleriesToLoad')) { 1695 var itemsPerPage = event.page.size; 1696 var totalItems = event.item.count; 1697 var currentIndex = event.item.index; 1698 if (totalItems > 0 && (currentIndex + itemsPerPage >= totalItems - (itemsPerPage * 0.5))) { 1699 Main.loadMoreGalleriesForSection(currentSection); 1700 } 1701 } 1702 }); 1703 owl.data('scrollEventBoundGalleries', true); 1704 } 1705 1706 stageWidth = section.find(".owl-stage").innerWidth(); 1707 if ((listener == false && stageWidth > $(window).width()) || (listener == true && stageWidth > $(window).width() / 2)) { 1708 pager.show(); 1709 var $prevPager = section.find(".caroPager.prev"); 1710 var $nextPager = section.find(".caroPager.next"); 1711 $prevPager.attr("tabindex", "0").attr("role", "button").attr("aria-label", "ElÅzÅ galériák") 1712 .off("click keydown").on("click", function () { owl.trigger("prev.owl.carousel"); }) 1713 .on("keydown", function (e) { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); owl.trigger("prev.owl.carousel"); } }); 1714 $nextPager.attr("tabindex", "0").attr("role", "button").attr("aria-label", "KövetkezÅ galériák") 1715 .off("click keydown").on("click", function () { owl.trigger("next.owl.carousel"); }) 1716 .on("keydown", function (e) { if (e.key === "Enter" || e.key === " ") { e.preventDefault(); owl.trigger("next.owl.carousel"); } }); 1717 } else { 1718 pager.hide(); 1719 } 1720 }, 1721 error: function () { 1722 section.data('isLoadingMoreGalleries', false); 1723 } 1724 }); 1725 }); 1726 } 1727 1728 var loadMoreGalleriesForSection = function (sectionElement) { 1729 var section = $(sectionElement); 1730 var owl = section.find(".galleriesCaro"); 1731 1732 if (section.data('isLoadingMoreGalleries') || !section.data('hasMoreGalleriesToLoad')) { 1733 return; 1734 } 1735 section.data('isLoadingMoreGalleries', true); 1736 1737 var ajaxDataForLoadMore = Main.getGalleriesAjaxBaseParams(section); 1738 ajaxDataForLoadMore.lang = language; 1739 ajaxDataForLoadMore.gallery_page = section.data('currentGalleryPage'); 1740 ajaxDataForLoadMore.galleries_limit = 10; 1741 1742 $.ajax({
1743 type: "POST", 1744 url: "/galleries_url", 1745 dataType: "json", 1746 data: ajaxDataForLoadMore, 1747 success: function (data) { 1748 if (data.response && data.response.length > 0) { 1749 $.each(data.response, function (idx, galleryData) { 1750 var itemHtml = Main.createGalleryHtml(galleryData, section, webSite); 1751 if (itemHtml) { 1752 owl.trigger("add.owl.carousel", [jQuery(itemHtml)]); 1753 } 1754 }); 1755 owl.trigger("refresh.owl.carousel"); 1756 } 1757 1758 if (data.gallery_pagination) { 1759 section.data('hasMoreGalleriesToLoad', data.gallery_pagination.has_more_galleries); 1760 section.data('currentGalleryPage', data.gallery_pagination.current_gallery_page + 1); 1761 } else { 1762 section.data('hasMoreGalleriesToLoad', false); 1763 } 1764 section.data('isLoadingMoreGalleries', false); 1765 }, 1766 error: function () { 1767 section.data('isLoadingMoreGalleries', false); 1768 } 1769 }); 1770 } 1771 1772 var createGalleryHtml = function (val, section, currentWebSite) { 1773 var item = '<div class="galleriesItem ' + (val.class || '') + '">' + 1774 '<a href="' + (val.url || '#') + '" tabindex="0">' + 1775 '<figure class="imgBox">' + 1776 '<img src="'; 1777 if ($(window).width() > 767) { 1778 item += val.src || '/static/images/common/placeholder.jpg'; 1779 } else { 1780 item += val.mobil_src || val.src || '/static/images/common/placeholder.jpg'; 1781 } 1782 item += '" alt="' + (val.alt || val.name || '') + '">' + 1783 '</figure>' + 1784 '<div class="descriptionBox">' + 1785 '<p>'; 1786 if (val.webSite != currentWebSite) { 1787 item += (val.webSite || ''); 1788 if (val.place != "") { item += ' | '; } 1789 } 1790 item += (val.place || '') + '</p>' + 1791 '<br>'; 1792 if (val.date && val.date != "0000.00.00") { 1793 item += '<time datetime="' + val.date + '">' + val.date + '</time><br>'; 1794 } 1795 item += '<h3>' + (val.name || '') + '</h3>' + 1796 '</div>' + 1797 '</a>' + 1798 '</div>'; 1799 return item; 1800 } 1801 1802 var getGalleriesAjaxBaseParams = function (section) { 1803 var contentID = section.data("content-id"); 1804 var baseParams = {}; 1805 var endDate = section.data("end-date") === '0000-00-00' ? null : section.data("end-date"); 1806 var startDate = section.data("start-date") === '0000-00-00' ? null : section.data("start-date"); 1807 baseParams = { content_id: contentID, date_start: startDate, date_end: endDate }; 1808 1809 if (typeof section.data('type') !== 'undefined') { 1810 baseParams.type = section.data('type'); 1811 } 1812 return baseParams; 1813 } 1814 1815 var contentList = function (expression) { // Ez az eredeti fájlban lévŠcontentList függvény 1816 $(".contentList li").remove(); 1817 $.ajax({
1818 type: "POST", 1819 1820 url: "/contents_url", // Eredeti fájlban /contents_url volt 1821 1822 dataType: "json", 1823 1824 data: { lang: language, name: expression }, 1825 1826 success: function (data) { 1827 1828 1829 1830 $.each(data.response, function (i, val) { 1831 var item = 1832 1833 '<li>' + 1834 1835 '<a class="clearfix" href="' + val.url + '">' + 1836 1837 '<h3>' + val.name + '</h3>'; 1838 1839 if (val.subtitle != "") { 1840 1841 item += '<h5>' + val.subtitle + '</h5>'; 1842 1843 } 1844 1845 if (val.heading != "") { 1846 1847 item += '<p class="lead">' + val.heading + '</p>'; 1848 1849 } 1850 1851 item += '</a>' + // Hiányzó lezáró tag pótolva 1852 1853 '</li>'; 1854 $(".contentList").append(item); 1855 if ($(".contentList li").length > 0) { 1856 1857 $("#contentListSection").show(); 1858 1859 } 1860 1861 1862 1863 }); 1864 } 1865 }); 1866 } 1867 var logosCaro = function () { 1868 $(".logosBox").each(function () { 1869 var owl = $(this).find(".logosCaro"), 1870 1871 count = $(this).find(".logosItem").length, 1872 1873 pager = $(this).find(".caroPager"), 1874 1875 listener = false; 1876 if ((count > 7 && $(window).width() > 1499) || (count > 6 && $(window).width() < 1500 && $(window).width() > 1399) || (count > 5 && $(window).width() < 1400 && $(window).width() > 1199) || (count > 4 && $(window).width() < 1200 && $(window).width() > 999) || (count > 3 && $(window).width() < 1000 && $(window).width() > 767)) { 1877 1878 listener = true; 1879 1880 pager.show(); 1881 1882 $("#logosSection").addClass("hasPager"); 1883 1884 } 1885 owl.owlCarousel({ responsive: { 0: { items: 2 }, 400: { items: 3 }, 1000: { items: 4 }, 1200: { items: 5 }, 1400: { items: 6 }, 1500: { items: 7 } }, autoplay: listener, autoplayHoverPause: true, loop: listener, mouseDrag: listener, smartSpeed: 1000, dots: false }); 1886 $(this).find(".caroPager.prev").on("click", function () { 1887 1888 owl.trigger("prev.owl.carousel"); 1889 1890 }); 1891 1892 1893 1894 $(this).find(".caroPager.next").on("click", function () { 1895 1896 owl.trigger("next.owl.carousel"); 1897 1898 }); 1899 }); 1900 } 1901 var tabListener = function () { 1902 var url = document.URL, 1903 1904 splited = url.split("#"), 1905 1906 hash = splited[1], 1907 1908 index, link, dataURL; 1909 tabColorize(); 1910 if (typeof hash !== "undefined") { 1911 link = $(".tabLink[data-url='" + hash + "']"); 1912 1913 index = link.parent().index() + 1; 1914 $(".tabLink").parent().removeClass("active"); 1915 1916 link.parent().addClass("active"); 1917 $(".tabBox").stop(true).fadeOut(300).removeClass("active"); 1918 1919 $(".tabBox:nth-child(" + index + ")").fadeIn(300).addClass("active"); 1920 $("section.hasSearch").each(function () { 1921 var section = $(this); 1922 if (section.data("tab") == hash && !section.is(".newsSection") && !section.is("#contentListSection") && !section.is(".archive")) { 1923 1924 section.fadeIn(300); 1925 1926 } 1927 else { 1928 1929 section.fadeOut(300); 1930 1931 } 1932 }); 1933 setTimeout(function () { 1934 if (hash == "list") { 1935 1936 formListener(); 1937 1938 programsCaro(); 1939 1940 newsCaro(); 1941 1942 } 1943 else { 1944 1945 monthsCaro(); 1946 1947 } 1948 }, 300); 1949 if (hash == "list") { 1950 var hashType = splited[2]; 1951 if (typeof hashType !== "undefined") { 1952 var hashParameter = splited[3]; 1953 if (hashType == "expression") { 1954 1955 $("#filtersForm .expression").val(decodeURIComponent(hashParameter)); 1956 1957 $("#filtersForm").data("expression", decodeURIComponent(hashParameter)); 1958 1959 $(".submit, .clearSearch").removeClass("inactive"); 1960 1961 $(".submit:not(.inactive)").trigger("click"); 1962 1963 } 1964 else { 1965 1966 1967 1968 var value; 1969 $(".filtersSelect option").each(function () { 1970 var dataURL = $(this).data("url"); 1971 if (dataURL == hashParameter) { 1972 1973 value = $(this).val(); 1974 1975 } 1976 }); 1977 $(".filtersSelect").val(value).trigger("change"); 1978 1979 $("#filtersForm").data("filters", value); 1980 1981 $(".submit, .clearSearch").removeClass("inactive"); 1982 1983 $(".submit:not(.inactive)").trigger("click"); 1984 1985 1986 1987 } 1988 } 1989 } 1990 1991 1992 1993 } 1994 else { 1995 $(".tabMenu li:first-child").addClass("active"); 1996 1997 $(".tabBox:first-child").css("display", "block").addClass("active"); 1998 $("section.hasSearch").each(function () { 1999 var section = $(this); 2000 dataURL = $(".tabMenu .active .tabLink").data("url"); 2001 if (section.data("tab") == dataURL && !section.is(".newsSection") && !section.is("#contentListSection") && !section.is(".archive")) { 2002 2003 section.fadeIn(300); 2004 2005 } 2006 }); 2007 setTimeout(function () { 2008 2009 formListener(); 2010 2011 programsCaro(); 2012 2013 newsCaro(); 2014 2015 }, 300); 2016 } 2017 $(".tabLink").on("click", function () { 2018 if (!$(this).parent().is(".active")) { 2019 link = $(this); 2020 2021 dataURL = link.data("url"); 2022 2023 index = link.parent().index() + 1; 2024 2025 2026 2027 $(".tabLink").parent().removeClass("active"); 2028 2029 link.parent().addClass("active"); 2030 2031 2032 2033 $(".tabBox").stop(true).fadeOut(300).removeClass("active"); 2034 2035 $(".tabBox:nth-child(" + index + ")").fadeIn(300).addClass("active"); 2036 $("section.hasSearch").each(function () { 2037 var section = $(this); 2038 if (section.data("tab") == dataURL && !section.is(".newsSection") && !section.is("#contentListSection") && !section.is(".archive")) { 2039 2040 section.fadeIn(300); 2041 2042 } 2043 else { 2044 2045 section.fadeOut(300);
2046 2047 } 2048 }); 2049 setTimeout(function () { 2050 if (dataURL == "list") { 2051 $("#monthsCaro, #daysCaro").find(".owl-item.current, .owl-item.selected").removeClass("current selected"); 2052 formListener(); 2053 2054 programsCaro(); 2055 2056 newsCaro(); 2057 } 2058 else { 2059 $("#filtersForm .expression").val(""); 2060 2061 // $(".chbInput").prop("checked", false); 2062 2063 $(".filtersSelect, .datesSelect").val("").trigger("change"); 2064 2065 $(".selectDelete").fadeOut(300); 2066 2067 $(".selectDelete").siblings(".icon-arrowDown").fadeIn(300); 2068 2069 $(".dateBox").slideUp(300); 2070 2071 2072 2073 $("#filtersForm").data("expression", ""); 2074 2075 $("#filtersForm").data("tags", ""); 2076 2077 $("#filtersForm").data("date-type", ""); 2078 2079 $("#filtersForm").data("date-start", ""); 2080 2081 $("#filtersForm").data("date-end", ""); 2082 2083 2084 2085 $(".submit, .clearSearch").addClass("inactive"); 2086 monthsCaro(); 2087 2088 2089 2090 } 2091 }, 300); 2092 // url = dataURL; // Eredeti sor, de a következÅ sor felülÃrja 2093 url = splited[0] + "#" + dataURL; // JavÃtva, hogy a base URL megmaradjon 2094 2095 window.history.replaceState(null, null, url); 2096 } 2097 }); 2098 } 2099 var tabColorize = function () { 2100 var monthsBackgroundColor = $(".tabWrapper").data("months-background-color"), 2101 2102 monthsBackgroundColorHover = $(".tabWrapper").data("months-background-color-hover"), 2103 2104 daysBackgroundColor = $(".tabWrapper").data("days-background-color"), 2105 2106 daysBackgroundColorHover = $(".tabWrapper").data("days-background-color-hover"); 2107 $(".monthsItem").css("background-color", monthsBackgroundColor); 2108 2109 $("#daysCaro, .daysItem, .calendarPager").css("background-color", daysBackgroundColor); 2110 $(".monthsItem").hover( 2111 2112 function () { 2113 2114 $(this).css("background-color", monthsBackgroundColorHover); 2115 2116 }, function () { 2117 2118 $(this).css("background-color", monthsBackgroundColor); 2119 2120 } 2121 2122 ); 2123 $(".daysItem, .calendarPager").hover( 2124 2125 function () { 2126 2127 $(this).css("background-color", daysBackgroundColorHover); 2128 2129 }, function () { 2130 2131 $(this).css("background-color", daysBackgroundColor); 2132 2133 } 2134 2135 ); 2136 $(".tabMenu a").hover( 2137 2138 function () { 2139 2140 $(this).css("background-color", monthsBackgroundColor); 2141 2142 }, function () { 2143 2144 $(this).css("background-color", "#EEECDF"); 2145 2146 } 2147 2148 ); 2149 } 2150 var select2 = function () { 2151 if ($("select").length > 0) { 2152 var filtersArray = [], 2153 2154 filtersString = ""; 2155 $("select").each(function () { 2156 var search = $(this).data("search"), 2157 2158 minimumResultsForSearch, 2159 2160 placeholder = $(this).data("placeholder"), 2161 2162 language = $(this).data("language"); // language változó itt lokális, nem a globális 2163 if (search == true) { 2164 2165 minimumResultsForSearch = 1; 2166 2167 } 2168 2169 else { 2170 2171 minimumResultsForSearch = "Infinity"; 2172 2173 } 2174 $(this).select2({ 2175 2176 minimumResultsForSearch: minimumResultsForSearch, 2177 2178 placeholder: placeholder, 2179 2180 language: language // select2 nyelvi beállÃtása 2181 2182 }); 2183 var width = $(this).parent().width(); 2184 // $(this).siblings(".select2-container").css("width", "auto"); // Ezt a sort kivettem, mert a következÅ felülÃrja 2185 $(this).siblings(".select2-container").css("width", width + "px"); 2186 if (!!$(this).val()) { 2187 2188 $(this).siblings(".icon-arrowDown").fadeOut(300);
2189 2190 $(this).siblings(".selectDelete").fadeIn(300); 2191 2192 } 2193 else { 2194 2195 $(this).siblings(".selectDelete").fadeOut(300); 2196 2197 $(this).siblings(".icon-arrowDown").fadeIn(300); 2198 2199 } 2200 $(this).on("select2:select", function () { 2201 if (!!$(this).val()) { 2202 $(this).siblings(".icon-arrowDown").fadeOut(300); 2203 2204 $(this).siblings(".selectDelete").fadeIn(300); 2205 if ($(this).is(".filtersSelect")) { 2206 // filtersArray.push($(this).val()); // Eredeti logika, de a select2 tömböt ad vissza multi-select esetén 2207 // filtersString = filtersArray.join(","); 2208 filtersString = $(this).val() ? ($(this).val().join ? $(this).val().join(',') : $(this).val()) : ""; // Kezeli a single és multi selectet 2209 $("#filtersForm").data("filters", filtersString); 2210 $(".submit, .clearSearch").removeClass("inactive"); 2211 } 2212 if ($(this).is(".datesSelect")) { 2213 $("#filtersForm").data("date-type", $(this).val()); 2214 if ($(this).val() == "4") { 2215 2216 $(".dateBox").slideDown(300); 2217 2218 } 2219 2220 2221 2222 else { 2223 if ($(".dateBox").is(":visible")) { 2224 2225 $(".dateBox").slideUp(300); 2226 2227 } 2228 2229 2230 2231 $(".submit, .clearSearch").removeClass("inactive"); 2232 2233 2234 2235 } 2236 } 2237 } 2238 2239 2240 2241 }); 2242 $(this).on("select2:unselect", function () { // Ez fÅleg multi-select esetén releváns 2243 filtersString = $(this).val() ? ($(this).val().join ? $(this).val().join(',') : $(this).val()) : ""; 2244 $("#filtersForm").data("filters", filtersString); 2245 if (!filtersString && !$("#filtersForm").data("expression") && !$("#filtersForm").data("date-type")) { 2246 $(".submit, .clearSearch").addClass("inactive"); 2247 } 2248 if (!$(this).val() || $(this).val().length === 0) { // Ha minden ki van törölve 2249 $(this).siblings(".selectDelete").fadeOut(300); 2250 $(this).siblings(".icon-arrowDown").fadeIn(300); 2251 } 2252 }); 2253 }); 2254 $(".selectDelete").on("click", function () { 2255 2256 2257 2258 $(this).siblings("select").val(null).trigger("change"); // null-ra állÃtás a placeholder megjelenÃtéséhez 2259 2260 $(this).fadeOut(300); 2261 2262 $(this).siblings(".icon-arrowDown").fadeIn(300); 2263 2264 2265 2266 if ($(this).siblings().is(".filtersSelect")) { 2267 // filtersArray = []; // Már nem használjuk Ãgy 2268 filtersString = ""; 2269 $("#filtersForm").data("filters", ""); // JavÃtva: filters, nem date-type 2270 if (!$("#filtersForm").data("expression") && !$("#filtersForm").data("date-type")) { 2271 $(".submit, .clearSearch").addClass("inactive"); 2272 } 2273 } 2274 if ($(this).siblings().is(".datesSelect")) { 2275 if ($(".dateBox").is(":visible")) { 2276 2277 $(".dateBox").slideUp(300); 2278 2279 } 2280 $("#filtersForm").data("date-type", ""); 2281 if ($("#filtersForm").data("expression") == "" && $("#filtersForm").data("filters") == "") { 2282 2283 $(".submit, .clearSearch").addClass("inactive"); 2284 2285 } 2286 } 2287 }); 2288 $(".selectBox .icon-arrowDown").on("click", function () { 2289 2290 $(this).siblings("select").select2("open"); 2291 2292 }); 2293 } 2294 } 2295 var datepicker = function () { 2296 $(".dateBox").each(function () { 2297 var currentLanguage = $(this).children(".datepicker").data("language"); // Ãtnevezve, hogy ne ütközzön a globális language-dzsel 2298 $.datepicker.setDefaults($.datepicker.regional[currentLanguage]); 2299 $(this).children(".datepicker").datepicker({ 2300 2301 dateFormat: "yy-mm-dd", 2302 2303 minDate: 0, 2304 2305 showOtherMonths: true, 2306 2307 onSelect: function () { 2308 2309 2310 2311 var date = $(this).val(); 2312 if ($(this).parent().is(".start")) { 2313 2314 $("#filtersForm").data("date-start", date); 2315 // EllenÅrizzük, hogy a végdátum korábbi-e, és ha igen, töröljük 2316 var endDate = $("#filtersForm").data("date-end"); 2317 if (endDate && new Date(date) > new Date(endDate)) { 2318 $("#filtersForm").data("date-end", ""); 2319 $(".dateBox.end .datepicker").val(""); 2320 } 2321 // A végdátum minDate beállÃtása 2322 $(".dateBox.end .datepicker").datepicker("option", "minDate", date); 2323 2324 2325 } 2326 else { // .end 2327 2328 $("#filtersForm").data("date-end", date); 2329 // A kezdÅdátum maxDate beállÃtása 2330 $(".dateBox.start .datepicker").datepicker("option", "maxDate", date); 2331 2332 } 2333 if ($("#filtersForm").data("date-start") != "" && $("#filtersForm").data("date-end") != "") { 2334 2335 $(".submit, .clearSearch").removeClass("inactive"); 2336 2337 } else { 2338 // Ha valamelyik dátum hiányzik, a gomb inaktÃv (kivéve, ha más filter aktÃv) 2339 if (!$("#filtersForm").data("expression") && !$("#filtersForm").data("filters")) { 2340 // $(".submit, .clearSearch").addClass("inactive"); // Ezt a feltételt finomÃtani kellhet 2341 } 2342 } 2343 } 2344 2345 }); 2346 }); 2347 $(".icon-date").on("click", function () { 2348 2349 $(this).siblings("input").trigger("focus"); 2350 2351 }); 2352 } 2353 var formListener = function () { 2354 select2(); 2355 2356 datepicker(); 2357 var expression = "", // Ezt a változót lokálisan használjuk az input eseménykezelÅben 2358 2359 length = 0; 2360 2361 $("body").on("input", "#filtersForm .expression", function (e) { 2362 2363 2364 2365 expression = $(this).val(); // Lokális expression frissÃtése 2366 2367 length = expression.length; 2368 if (length > 2) { 2369 2370 $("#filtersForm").data("expression", expression); 2371 2372 $(".submit, .clearSearch").removeClass("inactive"); 2373 2374 } 2375 else { 2376 $("#filtersForm").data("expression", ""); 2377 2378 2379 2380 if ($("#filtersForm").data("filters") == "" && $("#filtersForm").data("date-type") == "") { 2381 2382 $(".submit, .clearSearch").addClass("inactive"); 2383 2384 } 2385 } 2386 e.preventDefault(); 2387 }); 2388 $("body").on("keypress", "#filtersForm .expression", function (e) { 2389 if (e.which == 13) { 2390 $(".submit:not(.inactive)").trigger("click"); 2391 e.preventDefault(); 2392 } 2393 }); 2394 2395 $(".submit").on("click", function () { 2396 if ($(this).hasClass("inactive")) return; // Ne csináljon semmit, ha inaktÃv 2397 2398 programsCaro(); 2399 2400 newsCaro(); 2401 2402 2403 // Az expressiont a data attribútumból olvassuk ki, ne a lokális változóból, ami csak az input eseményben frissül 2404 var currentExpression = $("#filtersForm").data("expression"); 2405 if (currentExpression && currentExpression.length > 0) { // Csak akkor hÃvjuk, ha van expression 2406 contentList(currentExpression); 2407 } else { 2408 $("#contentListSection").hide(); // Ha nincs expression, rejtsük el a content listát 2409 } 2410 }); 2411 $(".clearSearch").on("click", function () { 2412 if ($(this).hasClass("inactive")) return; 2413 2414 $("#filtersForm .expression").val(""); 2415 $(".filtersSelect, .datesSelect").val(null).trigger("change"); // null a placeholderhez 2416 $(".selectDelete").fadeOut(300);
2417 $(".selectDelete").siblings(".icon-arrowDown").fadeIn(300); 2418 $(".dateBox").slideUp(300); 2419 $(".dateBox .datepicker").val(""); // Dátum inputok ürÃtése 2420 $("#filtersForm").data("expression", ""); 2421 $("#filtersForm").data("filters", ""); // JavÃtva: filters 2422 $("#filtersForm").data("date-type", ""); 2423 $("#filtersForm").data("date-start", ""); 2424 $("#filtersForm").data("date-end", ""); 2425 2426 // Dátumválasztók korlátozásainak resetelése 2427 $(".dateBox.start .datepicker").datepicker("option", "maxDate", null); 2428 $(".dateBox.end .datepicker").datepicker("option", "minDate", 0); 2429 2430 2431 programsCaro(); 2432 newsCaro(); 2433 $("#contentListSection").hide(); 2434 2435 2436 2437 $(".submit, .clearSearch").addClass("inactive"); 2438 }); 2439 } 2440 var monthsCaro = function () { 2441 var owl = $("#monthsCaro"), 2442 2443 listener = false, 2444 2445 date = new Date(), 2446 2447 year = date.getFullYear(), 2448 2449 month, 2450 2451 days, 2452 2453 daysNumber, 2454 2455 day, 2456 2457 dayClass = "current", 2458 2459 url = document.URL, 2460 2461 splited = url.split("#"), 2462 2463 hashMonth = splited[2], 2464 2465 hashDay = splited[3]; 2466 if ($(window).width() < 1200) { 2467 $(".monthsBox").addClass("hasPager"); 2468 listener = true; 2469 } 2470 if (typeof hashMonth !== "undefined" && parseInt(hashMonth) > 0 && parseInt(hashMonth) <= 12) { // Hónap validálása 2471 2472 month = parseInt(hashMonth); 2473 if (typeof hashDay !== "undefined" && parseInt(hashDay) > 0) { // Nap validálása 2474 day = parseInt(hashDay); 2475 } else { 2476 day = 1; // Alapértelmezett nap, ha nincs megadva vagy érvénytelen 2477 } 2478 2479 2480 } 2481 else { 2482 2483 month = date.getMonth() + 1; 2484 2485 day = date.getDate(); 2486 2487 } 2488 days = new Date(year, month, 0), 2489 2490 daysNumber = days.getDate(), 2491 // Nap validálása a hónap napjainak számához képest 2492 day = (day > daysNumber) ? daysNumber : day; 2493 2494 owl.owlCarousel({ responsive: { 0: { items: 2 }, 400: { items: 4 }, 768: { items: 6 }, 1000: { items: 8 }, 1200: { items: 12 } }, mouseDrag: listener, smartSpeed: 1000, dots: false, startPosition: month - 1 }); 2495 owl.find(".owl-item:nth-child(" + month + ")").addClass("current"); 2496 if ($(window).width() < 1200) { 2497 $(".monthsBox .calendarPager.prev").off("click").on("click", function () { // off("click") a duplikált eseménykezelÅk elkerülésére 2498 2499 owl.trigger("prev.owl.carousel"); 2500 2501 }); 2502 2503 2504 2505 $(".monthsBox .calendarPager.next").off("click").on("click", function () { 2506 2507 owl.trigger("next.owl.carousel"); 2508 2509 }); 2510 } 2511 daysCaro(year, month, daysNumber, day, dayClass);
2512 // Kezdeti betöltés: az egész aktuális (vagy URL hash alapján meghatározott) hónap programjai 2513 // A 'null' jelzi a programsCaro-nak (getProgramAjaxBaseParams-on keresztül), hogy egész hónapot kérünk 2514 programsCaro(year, month, null); 2515 2516 $(".monthsItem").off("click").on("click", function () { // off("click") 2517 2518 2519 2520 owl.find(".owl-item.current, .owl-item.selected").removeClass("current selected"); 2521 2522 $(this).parent().addClass("selected"); 2523 2524 owl.trigger("to.owl.carousel", [$(this).parent().index(), 500, true]); 2525 // console.log("Clicked month data-month:", $(this).data("month")); 2526 // month = $(this).data("month"); // Ezt cseréljük le a parseInt-re 2527 month = parseInt($(this).data("month"), 10); // BiztosÃtjuk, hogy szám legyen 2528 // console.log("monthsCaro click: Parsed month from data-month:", month, "Current year in scope:", year); 2529 2530 if (isNaN(month) || month < 1 || month > 12) { 2531 console.error("Invalid data-month attribute on clicked month item:", $(this).data("month"), ". Parsed as:", month); 2532 return; // Megakadályozzuk a további végrehajtást, ha a hónap érvénytelen 2533 } 2534 2535 days = new Date(year, month, 0); 2536 2537 daysNumber = days.getDate(); 2538 2539 var currentSelectedDayElement = $("#daysCaro .owl-item.selected .daysItem"); 2540 if (currentSelectedDayElement.length > 0) { 2541 day = parseInt(currentSelectedDayElement.html()); 2542 dayClass = "selected"; 2543 // BiztosÃtjuk, hogy a nap ne legyen nagyobb, mint az új hónap napjainak száma 2544 if (day > daysNumber) { 2545 day = daysNumber; 2546 } 2547 } 2548 else { // Ha nincs kiválasztott nap, az aktuális hónap aktuális napja, vagy az 1. nap 2549 var today = new Date(); 2550 if (year === today.getFullYear() && month === (today.getMonth() + 1)) { 2551 day = today.getDate(); 2552 } else { 2553 day = 1; 2554 } 2555 dayClass = "current"; 2556 if (day > daysNumber) { // Ez nem valószÃnű, de biztonsági ellenÅrzés 2557 day = daysNumber; 2558 } 2559 } 2560 2561 // Amikor új hónapra váltunk, az alapértelmezett aktÃv nap az új hónap elsÅ napja, 2562 // vagy a mai nap, ha az az aktuális hónap. A jelölés mindig "current" lesz, nem "selected". 2563 var todayForMonthSwitch = new Date(); 2564 if (year === todayForMonthSwitch.getFullYear() && month === (todayForMonthSwitch.getMonth() + 1)) { 2565 day = todayForMonthSwitch.getDate(); 2566 } else { 2567 day = 1; 2568 } 2569 // BiztosÃtjuk, hogy a nap ne legyen nagyobb, mint az új hónap napjainak száma 2570 if (day > daysNumber) { 2571 day = daysNumber; 2572 } 2573 dayClass = "current"; // Hónapváltáskor mindig "current" az alapértelmezett jelölés 2574 2575 // A daysCaro függvény felelÅs a carousel ürÃtéséért és újraépÃtéséért. 2576 // A korábbi selected osztályt a daysCaro-n belüli owl.html('') és az új osztályok beállÃtása kezeli. 2577 daysCaro(year, month, daysNumber, day, dayClass); 2578 2579 // Hónapváltáskor az egész új hónap programjait töltjük be 2580 programsCaro(year, month, null); // A 'null' jelzi, hogy egész hónapot kérünk 2581 2582 var currentUrl = window.location.href.split('#')[0]; 2583 url = currentUrl + "#calendar"; // Csak a #calendar-t adjuk hozzá, hónap/nap nélkül 2584 window.history.replaceState(null, null, url); 2585 2586 2587 }); 2588 } 2589 var daysCaro = function (year, month, daysNumber, day, dayClass) { 2590 var owl = $("#daysCaro"), 2591 listener = false, 2592 url = document.URL; // Ezt a változót itt nem használjuk fel közvetlenül URL módosÃtásra 2593 2594 if ($(window).width() < 1200) { 2595 listener = true; 2596 } 2597 // console.log("daysCaro called with: year=", year, "month=", month, "daysNumber=", daysNumber, "day=", day, "dayClass=", dayClass); 2598 2599 // Ensure the carousel is initialized or re-initialized 2600 if (owl.data('owl.carousel')) { 2601 owl.trigger('destroy.owl.carousel'); // Destroy if already initialized 2602 } 2603 owl.html(''); // Clear existing items before re-populating 2604 2605 owl.owlCarousel({ 2606 responsive: { 0: { items: 6 }, 400: { items: 10 }, 1000: { items: 15 }, 1200: { items: daysNumber } }, 2607 mouseDrag: listener, 2608 smartSpeed: 1000, // Or 0 for faster interaction if preferred 2609 dots: false 2610 }); 2611 2612 for (var i = 1; i <= daysNumber; i++) { 2613 var item; 2614 var formattedMonth = month < 10 ? '0' + month : month; 2615 var formattedDay = i < 10 ? '0' + i : i; 2616 2617 item = '<time class="daysItem" datetime="' + year + '-' + formattedMonth + '-' + formattedDay + '">' + i + '</time>'; 2618 // console.log("daysCaro: Adding item with datetime:", year + '-' + formattedMonth + '-' + formattedDay); // Lehet túl sok logot generálna 2619 2620 owl.trigger("add.owl.carousel", [jQuery(item)]).trigger("refresh.owl.carousel"); // Add and refresh 2621 } 2622 // owl.trigger("refresh.owl.carousel"); // Refresh after all items are added 2623 2624 owl.trigger("to.owl.carousel", [day - 1, 0]); // Go to item, 0ms speed for immediate 2625 2626 // Ensure all items are clean of our custom classes first 2627 owl.find(".owl-item").removeClass("current selected"); 2628 2629 // Get the target .owl-item and apply the class 2630 var targetOwlItem = owl.find(".owl-item:nth-child(" + day + ")"); 2631 if (targetOwlItem.length) { 2632 targetOwlItem.addClass(dayClass); 2633 // console.log("daysCaro: Applied class '" + dayClass + "' to .owl-item:nth-child(" + day + "). It now has classes: '" + targetOwlItem.attr('class') + "'. Its .daysItem datetime: '" + targetOwlItem.find('.daysItem').attr('datetime') + "'"); 2634 } else { 2635 console.error("daysCaro: Could not find .owl-item:nth-child(" + day + ") to apply class: " + dayClass); 2636 } 2637 2638 if ($(window).width() < 1200) { 2639 $(".daysBox").addClass("hasPager"); 2640 $(".daysBox .calendarPager.prev").off("click").on("click", function () { 2641 2642 owl.trigger("prev.owl.carousel"); 2643 2644 }); 2645 2646 2647 2648 $(".daysBox .calendarPager.next").off("click").on("click", function () { 2649 2650 owl.trigger("next.owl.carousel"); 2651 2652 }); 2653 } 2654 tabColorize(); 2655 // console.log("daysCaro: About to call programsCaro. Querying DOM for .current day datetime: '", $("#daysCaro .owl-item.current .daysItem").attr("datetime"), "'. Querying for .selected day datetime: '", $("#daysCaro .owl-item.selected .daysItem").attr("datetime") + "'"); 2656 2657 // ELTÃVOLÃTVA: A daysCaro kezdeti futásakor már nem töltünk be programokat egy konkrét napra. 2658 // Ezt a feladatot a monthsCaro veszi át, ami az egész hónapot tölti be. 2659 // programsCaro(year, month, day); 2660 $(".daysItem").off("click").on("click", function () { 2661 owl.find(".owl-item.current, .owl-item.selected").removeClass("current selected"); 2662 2663 $(this).parent().addClass("selected"); 2664 2665 owl.trigger("to.owl.carousel", [$(this).parent().index(), 500, true]); 2666 // console.log("daysItem click: Selected day - datetime:", $(this).attr("datetime"));
2667 2668 // Kiolvassuk az aktuális évet és hónapot a daysCaro scope-jából, a napot pedig a kattintott elembÅl 2669 var clickedDay = parseInt($(this).html()); 2670 // A year és month változók a daysCaro külsÅ scope-jából (monthsCaro-ból) érkeznek és itt elérhetÅek. 2671 // Ha a daysCaro-t más kontextusból is hÃvnánk, akkor a year, month-ot is paraméterként kellene kapnia. 2672 programsCaro(year, month, clickedDay); // Programok újratöltése a kiválasztott napra 2673 2674 // URL frissÃtése a kiválasztott hónappal és nappal 2675 var selectedMonth = $("#monthsCaro .owl-item.selected .monthsItem, #monthsCaro .owl-item.current .monthsItem").data("month"); 2676 var selectedDay = $(this).html(); 2677 var currentBaseUrl = window.location.href.split('#')[0]; 2678 var newUrl = currentBaseUrl + "#calendar#" + selectedMonth + "#" + selectedDay; 2679 window.history.replaceState(null, null, newUrl); 2680 }); 2681 } 2682 var lightGallery = function () { // Ez az eredeti fájlban lévÅ lightGallery 2683 if ($(".btGalleryBox .mainImgContainer").length > 0) { 2684 $(".btGalleryBox .mainImgContainer").lightGallery({ 2685 2686 mode: "lg-fade", 2687 2688 selector: ".btGalleryBox .mainImgContainer img", // Hibás selector, img-nek kell lennie, nem a[href]-nek 2689 2690 thumbnail: false, 2691 2692 download: false 2693 2694 }); 2695 } 2696 // Ãltalánosabb lightGallery minden .lightGallery osztályú elemre 2697 $(".lightGallery:not(.btGalleryBox .mainImgContainer)").each(function () { 2698 $(this).lightGallery({ 2699 download: false, 2700 selector: 'this' // Ha a .lightGallery maga a link 2701 }); 2702 }); 2703 } 2704 var gallery = function () { 2705 2706 2707 2708 if ($(".galleryBox").length > 0) { 2709 $(".galleryBox").each(function () { 2710 $(this).parent().addClass("hasGallery"); 2711 $(this).btGallery({ 2712 2713 itemsCustom: [[0, 2], [768, 3]], 2714 2715 margin: 5, 2716 2717 prevInnerHtml: "<i class='icon-arrowLeft'></i>", 2718 2719 nextInnerHtml: "<i class='icon-arrowRight'></i>", 2720 2721 navInThumb: false, 2722 2723 navInMain: true, 2724 2725 swipe: true 2726 2727 }); 2728 }); 2729 2730 2731 2732 } 2733 } 2734 var video = function () { 2735 if ($(".mainTextBox iframe").length > 0) { 2736 2737 2738 2739 $(".mainTextBox iframe").each(function () { 2740 2741 if ($(this).attr("src") && ($(this).attr("src").match("youtube") || $(this).attr("src").match("vimeo") || $(this).attr("src").match("dailymotion") || $(this).attr("src").match("facebook"))) { 2742 2743 $(this).wrap("<div class='videoWrapper'></div>"); 2744 2745 } 2746 2747 }); 2748 } 2749 } 2750 var modalListener = function () { 2751 $("#ticketsModal, #mobileTicketsModal").on("show.bs.modal", function () { 2752 2753 $("body").addClass("faded3"); 2754 2755 }); 2756 $("#ticketsModal, #mobileTicketsModal").on("hidden.bs.modal", function () { 2757 2758 $("body").removeClass("faded3"); 2759 // URL tisztÃtása a modal bezárásakor 2760 var currentUrl = window.location.href.split('#')[0]; 2761 if (window.location.hash.includes("ticketsModal") || window.location.hash.includes("mobileTicketsModal")) { 2762 window.history.replaceState(null, null, currentUrl); 2763 } 2764 2765 2766 }); 2767 ticketsListener2(); // Ez a mobil modalhoz tartozik, itt marad 2768 2769 2770 2771 } 2772 var ticketsListener = function () { // Ez a desktop modalhoz tartozik 2773 var url = document.URL, 2774 2775 splited = url.split("#"), 2776 2777 // hash = splited[1], // Ezt nem használjuk közvetlenül itt 2778 dataURL, // Ezt a modal triggerelÅ gomb data-url attribútumából vesszük 2779 2780 backgroundColor01, backgroundColor02, backgroundColor03, date, time, dateString, websiteAndPlace, title, subtitle, badge, badgeClasses, ticketsBoxClasses, ticketsList, text, link, lead; 2781 2782 // Az eseménykezelÅt delegáljuk a body-ra, hogy dinamikusan hozzáadott elemeken is működjön 2783 $("body").on("click", "a[href='#ticketsModal']", function () { 2784 2785 2786 2787 var item = $(this).siblings("a"), // Feltételezve, hogy a link a programkártya fÅ linkje 2788 2789 hide = $(this).siblings(".hide"); // A rejtett adatok konténere 2790 dataURL = $(this).data("url"); // A modal URL-je (pl. program-neve-jegyek) 2791 2792 2793 2794 backgroundColor01 = hide.children(".colorsList").find("li:first-child").html(); // Biztonságosabb DOM keresés 2795 backgroundColor02 = hide.children(".colorsList").find("li:nth-child(2)").html(); 2796 backgroundColor03 = hide.children(".colorsList").find("li:last-child").html(); 2797 2798 2799 2800 date = hide.children(".date").html(); 2801 time = hide.children(".time").html(); 2802 dateString = hide.children(".dateString").html(); 2803 websiteAndPlace = hide.children("h5").html(); 2804 title = item.find("h3").html(); 2805 subtitle = hide.children("h4").html(); 2806 badge = item.find(".badge span").html(); // A badge szövege a span-ban van 2807 badgeClasses = item.find(".badge").attr("class"); 2808 ticketsBoxClasses = hide.find(".ticketsBox").attr("class"); 2809 2810 if (hide.find(".ticketsList li").length > 0) { 2811 ticketsList = hide.find(".ticketsList").html(); 2812 } 2813 else { 2814 ticketsList = ""; 2815 } 2816 text = hide.find(".ticketsBox .mainTextBox").html(); // Pontosabb selector 2817 link = hide.children("span").html(); // Ez a jegyvásárlási link 2818 lead = hide.children("p").html(); // Ez a program leÃrása (heading) 2819 2820 // Modal feltöltése az adatokkal 2821 var modal = $("#ticketsModal"); 2822 modal.find(".topBoxInner").css("background-color", backgroundColor01 || ""); 2823 modal.find(".middleBoxInner").css("background-color", backgroundColor02 || ""); 2824 modal.find(".bottomBoxInner").css("background-color", backgroundColor03 || ""); 2825 2826 if (time != "") { 2827 modal.find("time").attr("datetime", (date || "") + " " + (time || "")); 2828 } else { 2829 modal.find("time").attr("datetime", date || ""); 2830 } 2831 modal.find("time").html(dateString || ""); 2832 modal.find(".topBoxInner h5").html(websiteAndPlace || ""); 2833 modal.find(".topBoxInner h3").html(title || ""); 2834 modal.find(".topBoxInner h4").html(subtitle || ""); 2835 2836 modal.find(".badge").removeClass().addClass("badge " + (badgeClasses || "")).html(badge ? '<span>' + badge + '</span>' : ''); // Osztályok resetelése és span hozzáadása 2837 if (!badge) modal.find(".badge").hide(); else modal.find(".badge").show(); 2838 2839 2840 modal.find(".ticketsBox").removeClass().addClass("ticketsBox " + (ticketsBoxClasses || "")); 2841 modal.find(".ticketsList").html(ticketsList || ""); 2842 modal.find(".ticketsBox .mainTextBox").html(text || ""); // Pontosabb selector 2843 2844 if (modal.find(".ticketsBox").is(".withoutList.withoutTextBox") || (!ticketsList && !text)) { 2845 modal.find(".middleBoxInner").hide(); 2846 } else { 2847 modal.find(".middleBoxInner").show(); 2848 } 2849 2850 if (link && link.trim() !== "") { 2851 modal.find(".btn").show().attr("href", link); 2852 } else { 2853 modal.find(".btn").hide(); 2854 } 2855 modal.find(".lead").html(lead || ""); 2856 2857 // URL frissÃtése a dataURL alapján (ha van) 2858 if (dataURL) { 2859 var currentBaseUrl = window.location.href.split('#')[0]; 2860 var newModalUrl = currentBaseUrl + "#" + dataURL;
2861 window.history.replaceState(null, null, newModalUrl); 2862 } 2863 }); 2864 2865 // Modal bezárásakor az adatok törlése (show.bs.modal helyett hidden.bs.modal-ban jobb helyen van) 2866 $("#ticketsModal").on("hidden.bs.modal", function () { 2867 var modal = $(this); 2868 modal.find(".topBoxInner, .middleBoxInner, .bottomBoxInner").css("background-color", ""); 2869 modal.find("time").attr("datetime", "").html(""); 2870 modal.find(".topBoxInner h5, .topBoxInner h3, .topBoxInner h4").html(""); 2871 modal.find(".badge").removeClass().addClass("badge").html("").hide(); // Alaphelyzetbe állÃtás 2872 modal.find(".middleBoxInner").show(); 2873 modal.find(".ticketsBox").removeClass().addClass("ticketsBox"); 2874 modal.find(".ticketsList, .ticketsBox .mainTextBox").html(""); 2875 modal.find(".btn").attr("href", "").hide(); 2876 modal.find(".lead").html(""); 2877 2878 // URL visszaállÃtása, ha a modal miatt változott 2879 var currentUrl = window.location.href.split('#')[0]; 2880 if (window.location.hash && window.location.hash !== "#" && window.location.hash !== "#calendar") { // Csak akkor, ha nem a fÅoldal vagy naptár hash 2881 // Ha a hash tartalmazza a dataURL-t (amit a modal nyitásakor állÃtottunk be) 2882 // Ezt a részt finomÃtani kell, hogy pontosan tudjuk, melyik hash-t kell törölni. 2883 // EgyelÅre egyszerűsÃtve: ha van hash, és nem #calendar, akkor töröljük. 2884 // Ideálisabb lenne a dataURL-t tárolni és azt összevetni. 2885 // window.history.replaceState(null,null,currentUrl); // Ezt már a modalListener-ben kezeljük 2886 } 2887 }); 2888 } 2889 var ticketsListener22 = function () { 2890 2891 2892 2893 if ($("a[href='#mobileTicketsModal']").length > 0 && $(window).width() < 1000) { 2894 2895 2896 2897 var program = $("#programsInnerSection").data("program"); 2898 2899 2900 2901 $.ajax({
2902 2903 2904 2905 type: "POST", 2906 2907 url: "/programs_url", 2908 2909 dataType: "json", 2910 2911 data: { lang: language, program: program }, 2912 2913 success: function (data) { 2914 2915 2916 2917 var ticketsBoxClass, 2918 2919 ticketsList = "", 2920 2921 text = data.response.ticket_content, 2922 2923 link = data.response.ticket_url; 2924 2925 2926 2927 $.each(data.response.ticket_types, function (i, val) { 2928 2929 ticketsList += '<li class="clearfix">' + 2930 2931 '<strong>' + val.name + '</strong>' + 2932 2933 '<p>' + val.price + '</p>' + 2934 2935 '<span>' + val.text + '</span>' + 2936 2937 '</li>'; 2938 2939 }); 2940 2941 2942 2943 if (ticketsList == "") { 2944 2945 ticketsBoxClass = "withoutList"; 2946 2947 } 2948 2949 2950 2951 if (text == "") { 2952 2953 ticketsBoxClass = "withoutTextBox"; 2954 2955 } 2956 2957 2958 2959 $("#mobileTicketsModal .ticketsBox").addClass(ticketsBoxClass); 2960 2961 $("#mobileTicketsModal .ticketsList").html(ticketsList); 2962 2963 $("#mobileTicketsModal .mainTextBox").html(text); 2964 2965 $("#mobileTicketsModal .btn").attr("href", link); 2966 2967 2968 2969 2970 2971 } 2972 2973 2974 2975 }); 2976 2977 2978 2979 } 2980 2981 2982 2983 } 2984 var ticketsListener2 = function () { // Mobil modalhoz 2985 // Az eseménykezelÅt a body-ra delegáljuk, hogy a dinamikusan betöltött elemeken is működjön 2986 $("body").on("click", "a[href='#mobileTicketsModal']", function () { 2987 var programId = $(this).data("program"); // Program ID a gomb data attribútumából 2988 if (!programId) { // Ha a gomb nem tartalmazza, megpróbáljuk a section-bÅl 2989 programId = $("#programsInnerSection").data("program"); 2990 } 2991 2992 if (programId) { 2993 $.ajax({
2994 type: "POST", 2995 url: "/programs_url", 2996 dataType: "json", 2997 data: { lang: language, program_id: programId, single_program: true }, 2998 success: function (data) { 2999 if (data.response) { 3000 var programDetails = data.response; 3001 var modal = $("#mobileTicketsModal"); 3002 3003 // SzÃnek alkalmazása a topBoxInner, middleBoxInner, bottomBoxInner elemekre 3004 if (programDetails.colors) { 3005 modal.find(".topBoxInner").css("background-color", programDetails.colors.head || ""); 3006 modal.find(".middleBoxInner").css("background-color", programDetails.colors.body || ""); 3007 modal.find(".bottomBoxInner").css("background-color", programDetails.colors.footer || ""); 3008 } 3009 3010 // TopBoxInner elemek feltöltése 3011 modal.find(".modalTitle").html(programDetails.name || ""); 3012 modal.find(".modalSubTitle").html(programDetails.subtitle || ""); 3013 3014 var locationAndWebsite = programDetails.webSite || ""; 3015 if (programDetails.location) { 3016 if (locationAndWebsite) { locationAndWebsite += " | "; } 3017 locationAndWebsite += programDetails.location; 3018 } 3019 modal.find(".modalLocation").html(locationAndWebsite); 3020 3021 var modalDateElement = modal.find(".modalDate"); 3022 modalDateElement.html(programDetails.date_string || ""); 3023 if (programDetails.date) { 3024 modalDateElement.attr("datetime", programDetails.date + " " + (programDetails.time || "")); 3025 } 3026 3027 // Badge/Flag megjelenÃtése 3028 var modalBadge = modal.find(".modalBadge"); 3029 if (programDetails.flag && programDetails.flag.name) { 3030 modalBadge.html('<span>' + programDetails.flag.name + '</span>').removeClass().addClass("badge modalBadge " + (programDetails.flag.class || "")).show(); 3031 } else { 3032 modalBadge.html("").hide(); 3033 } 3034 3035 // MiddleBoxInner elemek feltöltése (tagek, jegyek, tartalom) 3036 var tagsHtml = ""; 3037 if (programDetails.tags && programDetails.tags.length > 0) { 3038 $.each(programDetails.tags, function (i, val) { 3039 tagsHtml += '<li><a href="' + (programDetails.tags_url || '#') + '#list#tag#' + (val.url || '') + '">' + (val.name || '') + '</a></li>'; 3040 }); 3041 } 3042 modal.find(".modalTags").html(tagsHtml); 3043 3044 var ticketsListHtml = ""; 3045 if (programDetails.ticket_types && programDetails.ticket_types.length > 0) { 3046 $.each(programDetails.ticket_types, function (i, val) { 3047 ticketsListHtml += '<li class="clearfix">' + 3048 '<strong>' + (val.name || "") + '</strong>' + 3049 '<p>' + (val.price || "") + '</p>' + 3050 '<span>' + (val.text || "") + '</span>' + 3051 '</li>'; 3052 }); 3053 } 3054 modal.find(".ticketsList").html(ticketsListHtml); 3055 modal.find(".mainTextBox").html(programDetails.ticket_content || ""); 3056 3057 if (ticketsListHtml === "" && !programDetails.ticket_content) { 3058 modal.find(".ticketsBox").hide(); 3059 } else { 3060 modal.find(".ticketsBox").show(); 3061 } 3062 3063 // BottomBoxInner elemek feltöltése (leÃrás/heading) 3064 modal.find(".modalHeading").html(programDetails.heading || ""); 3065 3066 // Gomb feltöltése 3067 var ticketUrl = programDetails.ticket_url || ""; 3068 if (ticketUrl && ticketUrl.trim() !== "") { 3069 modal.find(".btn").show().attr("href", ticketUrl).html(programDetails.ticket_button || "Jegyvásárlás"); 3070 } else { 3071 modal.find(".btn").hide(); 3072 } 3073 3074 modal.modal('show'); 3075 } 3076 }, 3077 error: function () { 3078 console.error("Hiba a programadatok lekérése közben a mobil modalhoz."); 3079 } 3080 }); 3081 } 3082 }); 3083 }; 3084 3085 var mainTextBoxListener = function () { 3086 if ($(".mainTextBox").length > 0) { 3087 $(".mainTextBox").each(function () { 3088 if ($(this).find("mark").length > 0) { 3089 3090 $(this).addClass("reverse"); 3091 3092 } 3093 }); 3094 $(".ticketsBox .mainTextBox, .locationBox .mainTextBox").addClass("small"); 3095 } 3096 } 3097 return { 3098 3099 init: init, 3100 3101 cookie: cookie, 3102 3103 scrollUp: scrollUp, 3104 3105 programsCaro: programsCaro, 3106 3107 programsSizer: programsSizer, 3108 3109 newsCaro: newsCaro, // FrissÃtett newsCaro 3110 3111 galleriesCaro: galleriesCaro, // FrissÃtett galleriesCaro 3112 3113 tabListener: tabListener, 3114 3115 lightGallery: lightGallery, 3116 3117 ticketsListener: ticketsListener, // Desktop modal listener 3118 // Programokhoz tartozó segédfüggvények
3119 loadMoreProgramsForSection: loadMoreProgramsForSection, 3120 createProgramHtml: createProgramHtml, 3121 getProgramAjaxBaseParams: getProgramAjaxBaseParams, 3122 // HÃrekhez tartozó segédfüggvények 3123 loadMoreNewsForSection: loadMoreNewsForSection, 3124 createNewsHtml: createNewsHtml, 3125 getNewsAjaxBaseParams: getNewsAjaxBaseParams, 3126 // Galériákhoz tartozó segédfüggvények 3127 loadMoreGalleriesForSection: loadMoreGalleriesForSection, 3128 createGalleryHtml: createGalleryHtml, 3129 getGalleriesAjaxBaseParams: getGalleriesAjaxBaseParams, 3130 // Egyéb, ha szükséges (pl. contentList, ha exportálni kellene) 3131 contentList: contentList // Az eredeti fájlban lévÅ contentList exportálása 3132 3133 } 3134}(window, document, $);
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.