1// window.addEventListener('beforeunload', (e) => { 2// e.preventDefault() 3// return (e.returnValue = 'Are you sure you want to close?') 4// }); 5 6var $ = jQuery.noConflict(); 7var docHeight = $(document).height(); 8var position = $(window).scrollTop(); 9var months = ['×× ××ר', 'פ×ר××ר', '×רץ', '×פר××', '×××', '××× ×', '××××', '××××ס×', 'ספ×××ר', '×××§×××ר', '× ××××ר', '×צ××ר']; 10var days = ['×', '×', '×', '×', '×', '×', 'ש']; 11var home_banner; 12// call iframe link if exists. 13$(document).on('click', '.iframe-link', function(e){ 14 e.preventDefault(); 15 var source = $(this).attr('href'); 16 17 if ( source && source != '#' ) { 18 19 $.magnificPopup.open({ 20 items: { 21 src: source, 22 }, 23 type: 'iframe', 24 iframe: { 25 patterns: { 26 yourcustomsource: { 27 index: '', 28 src: '%id%' 29 } 30 } 31 } 32 // other options 33 }); 34 } 35 36}); 37 38$(document).ready(function () { 39 40 // if( jQuery('body').hasClass('tax-event_cat') ) { 41 // var divList = $(".entry-activity.wide"); 42 // divList.sort(function(a, b){ 43 // console.log( jQuery(a).data("strtotime") ); 44 // console.log( jQuery(b).data("strtotime") ); 45 // return jQuery(a).data("strtotime")-jQuery(b).data("strtotime") 46 // }); 47 // jQuery(".tax-event_cat .row-posts.grid-1").html(divList); 48 // } 49 50 51 if( jQuery('body').hasClass('tax-event_cat') ) { 52 var divList = $(".entry-activity.wide"); 53 54 divList.sort(function(a, b){ 55 // Get the strtotime data for both elements 56 var aTime = jQuery(a).data("strtotime"); 57 var bTime = jQuery(b).data("strtotime"); 58 59 // If strtotime data is empty, set a high value to push it to the end 60 if (aTime === undefined || aTime === "") { 61 aTime = Infinity; // Assign a high value to push it to the end 62 } 63 if (bTime === undefined || bTime === "") { 64 bTime = Infinity; // Assign a high value to push it to the end 65 } 66 67 // Sort based on the strtotime data 68 return aTime - bTime; 69 }); 70 71 // Update the HTML with the sorted items 72 jQuery(".tax-event_cat .row-posts.grid-1").html(divList); 73 } 74 75 76 cf7_red_star(); 77 78 wrap_side_menu(); 79 80 moment.locale('he'); 81 82 $('.cart-menu-btn, .user-menu-btn').on('click', function(e){ 83 e.preventDefault(); 84 var source = $(this).attr('href'); 85 86 if ( source && source != '#' ) { 87 88 $.magnificPopup.open({ 89 items: { 90 src: source, 91 }, 92 type: 'iframe', 93 iframe: { 94 patterns: { 95 yourcustomsource: { 96 index: '', 97 src: '%id%' 98 } 99 } 100 } 101 // other options 102 }); 103 } 104 105 }); 106 107 float_contact(); 108 toggle_dark_mode(); 109 init_select(); 110 init_footer_logos_slider(); 111 init_homepage_functions(); 112 mobile_nav(); 113 mobile_footer_nav_init(); // Turn mobile footer navigation into accordion 114 a11y_menu(); // Accessibility for main menu 115 fancybox_init(); // fancyBox init 116 fast_contact_form(); // Fast contact form init 117 search_box_init(); // Toggle search box 118 btn_scroll_to(); // Scroll-to button 119 ajax_load_more(); // Ajax load more 120 side_menu(); 121 buy_now_form(); 122 // ajax_form(); 123 sticky_header_init(); 124 /* Blocks */ 125 init_activities_slider(); 126 init_block_hero_slider(); // Block hero slider 127 init_block_slider_with_thumbnails(); // Block slider with thumbnails 128 init_block_slider_testimonials(); // Block slider testimonials 129 init_block_slider_images(); // Block slider images 130 init_block_tabs(); // Block tabs 131 init_block_accordion(); // Block accordion 132 133 $('.activity-popup-inline').magnificPopup({ 134 type:'inline', 135 midClick: true // Allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source in href. 136 }); 137 138 if( jQuery('body').hasClass('page-template-tpl-about') ) { 139 if( jQuery(window).width() < 640 ) { 140 var gallery_block = jQuery('.block.block-galley-slider'); 141 var content_block = jQuery('.block.block-content-image'); 142 gallery_block.insertAfter( content_block.find('.container > .entry-content') ); 143 gallery_block.addClass('relocated'); 144 } 145 } 146 147}); 148 149$(window).load(function () {
150 fade_in_init(); // Fade-in init 151 mobile_instagram_slider(); 152}); 153 154function mobile_instagram_slider(){ 155 if( jQuery(window).width() < 640 ) { 156 if( jQuery('.ig-wrap').length ) { 157 setTimeout( function(){ 158 console.log('init instagram slider'); 159 jQuery('.ig-wrap .FeedGridLayout__grid').slick({ 160 rtl : true, 161 slidesToShow : 1, 162 slidesToScroll: 1, 163 arrows : false, 164 dots : true 165 }); 166 console.log('init instagram slider after'); 167 }, 1000); 168 } 169 } 170} 171 172function cf7_red_star(){ 173 jQuery('.wpcf7-validates-as-required').each( function(){ 174 var item = jQuery(this); 175 item.parents('.wpcf7-form-control-wrap').addClass('red-asterix'); 176 }); 177} 178 179function wrap_side_menu(){ 180 jQuery('.mobile-menu-wrap .menu-side-menu-container > ul.menu > li.menu-item-has-children').each( function(){ 181 jQuery(this).prepend('<button class="mobile-nav-arrow-btn"></button>'); 182 }); 183} 184 185function float_contact(){ 186 $('.float-contact').on( 'click', function(){ 187 $('.float-box').addClass('active'); 188 $('.overlay').fadeIn( 500 ); 189 190 }); 191 192 $('.float-box .btn-close').on( 'click', function(){ 193 $('.float-box').removeClass('active'); 194 $('.overlay').fadeOut( 500 ); 195 196 }); 197} 198 199 200function init_select(){ 201 202 $('select').not('.event-select, .hour-select, .buy-now-date-picker-a11y').each( function(){ 203 var select = $(this).selectize({ 204 create: false, 205 showEmptyOptionInDropdown: true, 206 closeAfterSelect: true, 207 onChange: function( data ){ 208 hide_mobile_keyboard(); 209 } 210 }); 211 212 }); 213} 214function hide_mobile_keyboard(){ 215 document.activeElement.blur(); 216 217} 218function toggle_dark_mode(){ 219 220 if ( Cookies.get('darkMode' ) ) { 221 $('body').addClass('dark-theme'); 222 } 223 224 $('.dark-mode-btn').on('click', function(){ 225 226 if ( $('body').hasClass('dark-theme') ) { 227 $('body').removeClass('dark-theme'); 228 Cookies.remove('darkMode'); 229 }else{ 230 $('body').addClass('dark-theme'); 231 Cookies.set('darkMode', true ); 232 } 233 234 235 }); 236} 237 238function is_home() { 239 if ($('body').hasClass('home')) { 240 return true; 241 } else { 242 return false; 243 } 244} 245 246function is_rtl() { 247 if ($('body').hasClass('rtl')) { 248 return true; 249 } else { 250 return false; 251 } 252} 253 254function is_mobile(width) { 255 if (!width) { 256 width = 576; 257 } 258 259 if ($(window).width() < width) { 260 return true; 261 } else { 262 return false; 263 } 264} 265 266function buy_now_form(){ 267 var buy_now_form = { 268 269 date_picker: $('.buy-now-date-picker'), 270 hours_select: $('select.hour-select'), 271 event_select: {}, 272 current_date: '', 273 selected_post_id: '', 274 current_form: '', 275 276 removeOptions: function() { 277 var form = buy_now_form.current_form; 278 form.parent().find('.buy-now-results').empty(); 279 form.find('.hour-select').remove(); 280 form.find('.hidden-fields').slideUp(); 281 282 }, 283 get_category_posts: function( cat_id ) { 284 285 var form = buy_now_form.current_form; 286 buy_now_form.removeOptions(); 287 288 form.append('<span class="ajax-loader black"></span>'); 289 290 buy_now_form.event_select[0].selectize.clearOptions(); 291 buy_now_form.event_select[0].selectize.disable(); 292 293 if ( typeof buy_now_form.date_picker_obj != 'undefined' ) { 294 form.find('.buy-now-date-picker').val(''); 295 buy_now_form.date_picker_obj.remove(); 296 buy_now_form.date_picker_obj = undefined; 297 } 298 299 $('.buy-now-date-picker').prop('disabled', true ); 300 301 302 $.ajax({ 303 type: 'POST', 304 dataType: 'json', 305 url: siteObject.ajaxurl, 306 data: { 307 'action' : 'ajax_get_category_posts', 308 'category' : cat_id, 309 }, 310 success: function (results) { 311 form.find('.ajax-loader').remove(); 312 313 if ( results.ok && results.posts ) { 314 $.each( results.posts, function( key, val ){ 315 var post_title = val.title.replace('"', '"').replace('"', '"').replace('–', '-'); 316 buy_now_form.event_select[0].selectize.addOption({ value: val.id, text: post_title }); 317 buy_now_form.event_select[0].selectize.enable(); 318 }); 319 } 320 321 jQuery('.purchase-term-description').html(results.term_message); 322 323 var chosen_post_id = jQuery('.event-details .buy-now-btn').attr('data-eventid'); 324 // set current event as selected 325 buy_now_form.event_select[0].selectize.setValue(chosen_post_id, false); 326 //buy_now_form.event_select[0].selectize.refreshOptions(); 327 console.log('set current event #'+chosen_post_id+' as selected'); 328 } 329 }); 330 331 }, 332 333 get_post_ajax: function ( post_id ) { 334 var form = buy_now_form.current_form; 335 buy_now_form.removeOptions(); 336 337 form.append('<span class="ajax-loader black"></span>'); 338 339 if (typeof buy_now_form.date_picker_obj != 'undefined' ) { 340 form.find('.buy-now-date-picker').val(''); 341 buy_now_form.date_picker_obj.remove(); 342 343 344 } 345 346 $.ajax({ 347 type: 'POST', 348 dataType: 'json', 349 url: siteObject.ajaxurl, 350 data: { 351 'action': 'ajax_get_post', 352 'post_id': post_id, 353 354 }, 355 356 success: function (results) { 357 form.find('.ajax-loader').remove(); 358 359 if ( results.ok && results.dates && results.html ) { 360 361 if( jQuery('body').hasClass('VA_keyboardNav') ) { 362 console.log('empty a11y select'); 363 $('select.buy-now-date-picker-a11y').html(''); 364 var dates_options = '<option value="">×××¨× ×ª×ר××</option>'; 365 $.each( results.dates, function(key, item){ 366 var i = new Date( item ); 367 var date = moment(i); 368 var new_val = date.format('ddd - D.M.YYYY'); 369 dates_options += '<option value="'+item+'">'+'××× ' + new_val+'</option>'; 370 }); 371 $('select.buy-now-date-picker-a11y').prop('disabled', false); 372 $('select.buy-now-date-picker-a11y').html(dates_options); 373 $('select.buy-now-date-picker-a11y').on('change', function(){ 374 console.log('on change a11y select'); 375 buy_now_form.ajax_get_date_hours( jQuery(this).val(), buy_now_form.selected_post_id ); 376 }); 377 console.log(dates_options); 378 } else { 379 380 switch( results.activity_type ){ 381 case '×§×רס': 382 form.find('.hidden-fields').slideDown(); 383 form.find('.hidden-fields').find(".btn").attr("href",results.main_link); 384 break; 385 default: 386 buy_now_form.html_append = results.html; 387 buy_now_form.show_date_picker( results.dates, form ); 388 break; 389 } 390 391 } 392 393 } 394 } 395 }); 396 397 }, 398 399 show_date_picker: function( dates, form, append ){ 400 var formatted_dates = []; 401 var parent_class = form.attr('class').replace(' ', '.'); 402 if ( Array.isArray( dates ) ) {
403 // dates.forEach( 404 // element => formatted_dates.push( new Date( element ) ) 405 // ); 406 dates.forEach( 407 function(element){ 408 // const date = element.replace('GMT','T') + "Z"; 409 // formatted_dates.push( new Date( date ) ) 410 411 const date = element.replace('GMT', 'T'); 412 formatted_dates.push(new Date(date)); 413 } 414 ); 415 }else{ 416 formatted_dates = [ new Date( dates ) ]; 417 } 418 419 // console.log( 'buy_now_form.date_picker_obj', buy_now_form.date_picker_obj ); 420 buy_now_form.date_picker_obj = datepicker('.' + parent_class + ' .buy-now-date-picker', { 421 showAllDates : true, 422 customDays : days, 423 customMonths : months, 424 customOverlayMonths: months, 425 startDate : formatted_dates[0], 426 minDate : formatted_dates[0], 427 // maxDate: formatted_dates[ formatted_dates.length - 1 ], 428 events: formatted_dates, 429 onShow: instance => { 430 hide_mobile_keyboard(); 431 }, 432 onSelect: (instance) => { 433 // This will display the date as `1/1/2019`. 434 if ( instance.dateSelected ) { 435 var i = new Date( instance.dateSelected ); 436 var date = moment(i); 437 var new_val = date.format('ddd - D.M.YYYY'); 438 form.find('.buy-now-date-picker').val( '××× ' + new_val ); 439 buy_now_form.ajax_get_date_hours( date.format('DD.MM.YYYY'), buy_now_form.selected_post_id ); 440 441 } 442 443 }, 444 445 }); 446 $('.buy-now-date-picker').prop('disabled', false ); 447 }, 448 449 ajax_get_date_hours: function( date, post_id ){ 450 451 var form = buy_now_form.current_form; 452 453 form.find('.btn').attr('href', '' ); 454 455 $.ajax({ 456 type: 'POST', 457 dataType: 'json', 458 url: siteObject.ajaxurl, 459 data: { 460 'action': 'ajax_get_post_date_hours', 461 'post_id': post_id, 462 'date': date, 463 }, 464 465 success: function (results) { 466 467 // console.log('-----',results); 468 469 $('.side-menu-wrap .ajax-loader').remove(); 470 471 if ( results.ok && results.hours ) { 472 473 if ( form.hasClass('single-buy-now-form') ) { 474 var html = ''; 475 $.each( results.hours, function( key, val ){ 476 html += '<option value="' + val.url + '">' + val.date + '</option>'; 477 }); 478 479 form.find('.hour-select').append( html ); 480 481 }else{ 482 483 form.find('.hour-select').remove(); 484 var html = '<select class="hour-select" name="">'; 485 html += '<option value="">×××רת שע×</option>'; 486 $.each( results.hours, function( key, val ){ 487 html += '<option value="' + val.url + '">' + val.date + '</option>'; 488 }); 489 490 html += '</select>'; 491 form.find('.date-picker-wrap').after( html ); 492 } 493 494 if ( results.main_link ) { 495 console.log(results.main_link); 496 form.find('a').attr('href', results.main_link ); 497 form.find('a').addClass('disabled'); 498 } 499 500 // append hours select after last selectbox 501 if( jQuery('body').hasClass('VA_keyboardNav') ) { 502 form.find('.a11y-date-picker-selector').after( html ); 503 } 504 505 $('.hour-select').selectize({ 506 create: false, 507 showEmptyOptionInDropdown: true, 508 closeAfterSelect: true, 509 onChange: function( data ){ 510 hide_mobile_keyboard(); 511 } 512 }); 513 514 if( jQuery('body').hasClass('VA_keyboardNav') ) { 515 var i = 0; 516 jQuery('.selectize-control.hour-select.single.rtl').each( function(){ 517 i++; 518 jQuery(this).addClass('element-' + i ); 519 }); 520 } 521 522 form.find('.hidden-fields').slideDown(); 523 524 form.parent().find('.buy-now-results').html( buy_now_form.html_append ); 525 } 526 527 } 528 }); 529 530 }, 531 532 init: (function () { 533 534 if( $('.event-select').length ) { 535 var select = $('.event-select').selectize({ 536 create: false, 537 showEmptyOptionInDropdown: true, 538 closeAfterSelect: true, 539 onChange: function( data ){ 540 hide_mobile_keyboard(); 541 } 542 }); 543 544 if(!$('.event-select option:selected').val()){ 545 select[0].selectize.disable(); 546 }else{ 547 setTimeout(function(){ 548 $(".event-select").trigger("change"); 549 },500); 550 } 551 } 552 553 554 $('body').on('change', 'select.categories-select', function() { 555 buy_now_form.current_form = $(this).parents('form'); 556 buy_now_form.event_select = select; 557 var cat_id = $(this).val(); 558 559 if ( cat_id ) { 560 buy_now_form.get_category_posts( cat_id ); 561 } 562 563 }); 564 565 $('.buy-form .btn, .buy-btn').on('click', function(e){ 566 e.preventDefault(); 567 if( jQuery(this).hasClass('disabled') ) { 568 console.log('disabled button - please choose hours'); 569 alert('×ש ××××ר שעת ×××ר××¢'); 570 return; 571 } 572 var source = $(this).attr('href'); 573 574 console.log('ytttttt'); 575 576 if ( source && source != '#' ) { 577 578 579 // collect event data for thank you page: 580 581 var parent_form = jQuery(this).parents('form'); 582 var event_title = parent_form.find('.event-select option:selected').text(); 583 var event_date = parent_form.find('.buy-now-date-picker').val(); 584 var event_image_url = jQuery(this).parents('.entry-body').find('.post-thumbnail img').attr('src'); 585 586 var event_hour_txt = parent_form.find('select.hour-select.selectized').val(); 587 var event_hours = event_hour_txt ? event_hour_txt.replace(/\D/g, '')
587: false; 588 589 590 // clear prev local storage data: 591 window.localStorage.removeItem('event-title'); 592 window.localStorage.removeItem('chosen-date'); 593 window.localStorage.removeItem('chosen-hours'); 594 window.localStorage.removeItem('thanks-image'); 595 596 if( event_hours ) { 597 event_hours = event_hours.slice(-4); 598 } 599 600 if( event_title ) { 601 window.localStorage.setItem('event-title', event_title); 602 } 603 if( event_date ) { 604 window.localStorage.setItem('chosen-date', event_date); 605 } 606 if( event_hours ) { 607 window.localStorage.setItem('chosen-hours', event_hours); 608 } 609 if( event_image_url ){ 610 window.localStorage.setItem('thanks-image', event_image_url); 611 } 612 613 console.log(event_title); 614 console.log(event_date); 615 console.log(event_hours); 616 console.log(event_image_url); 617 618 close_side_menu(); 619 $.magnificPopup.open({ 620 items: { 621 src: source, 622 }, 623 type: 'iframe', 624 iframe: { 625 patterns: { 626 yourcustomsource: { 627 index: '', 628 src: '%id%' 629 } 630 } 631 } 632 }); 633 } 634 635 }); 636 637 $('form.buy-now-form select.event-select').on('change', function() { 638 buy_now_form.current_form = $(this).parents('form'); 639 buy_now_form.selected_post_id = $(this).val(); 640 641 if ( buy_now_form.selected_post_id ) { 642 buy_now_form.get_post_ajax( buy_now_form.selected_post_id ); 643 } 644 645 }); 646 647 $('body').on('change', 'select.hour-select', function() { 648 console.log('select.hour-select change'); 649 var val = $(this).val(); 650 val = val.replace('https://tickets.kids-cinema.org.il/', 'https://tickets.mediatheque.org.il/'); 651 val = val.replace('https://tickets.main-library.org.il/', 'https://tickets.mediatheque.org.il/'); 652 val = val.replace('https://tickets.dmh.org.il/', 'https://tickets.mediatheque.org.il/'); 653 654 var parent = $(this).parents('form'); 655 if ( val ) { 656 var select_item = parent.find('.hour-select.selectized'); 657 var selected_hours = select_item.find('option:selected').text(); 658 659 if( selected_hours ) { 660 window.localStorage.setItem('chosen-hours', selected_hours ); 661 } 662 663 parent.find('.btn').attr( 'href', val ); 664 if( parent.find('.btn').hasClass('disabled') ) { 665 parent.find('.btn').removeClass('disabled'); 666 } 667 } 668 669 }); 670 671 }()), 672 } 673} 674 675function fade_in_init() { 676 $('.fade-in').css('opacity', 1); 677} 678 679function mobile_nav() { 680 mobileNav = { 681 triggerClick: function () { 682 $('.mobile-menu-btn').on( 'click' ,function () { 683 $('.mobile-menu-wrap').addClass( 'active' ); 684 $('.overlay').fadeIn( 500 ); 685 $('body').addClass('menu-open'); 686 }); 687 688 $('.mobile-menu-close-btn').on( 'click' ,function () { 689 $('.mobile-menu-wrap').removeClass('active'); 690 $('.overlay').fadeOut( 500 ); 691 $('body').removeClass('menu-open'); 692 693 }); 694 695 $('.overlay').on( 'click' ,function () { 696 $('.mobile-menu-wrap').removeClass('active'); 697 $('.float-box').removeClass('active'); 698 699 $('.overlay').fadeOut( 500 ); 700 $('body').removeClass('menu-open'); 701 702 }); 703 704 $('.mobile-menu-wrap .menu-item-has-children > .mobile-nav-arrow-btn').on( 'click' ,function (e) { 705 e.preventDefault(); 706 707 var parent = $(this).parent(); 708 parent.siblings().slideToggle(700); 709 parent.parents('div.menu-side-menu-container,ul').siblings().find('li').slideToggle(700); 710 parent.toggleClass('is-active'); 711 712 }); 713 }, 714 715 menuItemClick: function () { 716 $('.mn-menu ul > li.menu-item-has-children > .mobile-nav-arrow-btn, .toggle-sub-menu').click(function (e) { 717 e.preventDefault(); 718 $(this).parent().toggleClass('menu-item-open').find('> ul.sub-menu').slideToggle(); 719 }); 720 721 $('.mn-menu li:not(.menu-item-has-children) a').click(function () { 722 $('body').removeClass('mn-active'); 723 }); 724 }, 725 726 swipe: function () { 727 $(".mn-menu").on("swiperight", function () { 728 $('body').removeClass('mn-active'); 729 }); 730 }, 731 732 init: function () { 733 mobileNav.triggerClick(); 734 mobileNav.menuItemClick(); 735 mobileNav.swipe(); 736 } 737 } 738 739 mobileNav.init(); 740} 741 742 743 744function open_side_menu(){ 745 $('.side-menu-wrap').addClass('active'); 746 $('body').addClass('menu-open'); 747 $('.overlay').fadeIn( 500 ); 748 749} 750 751function close_side_menu(){ 752 $('.side-menu-wrap').removeClass('active'); 753 $('body').removeClass('menu-open'); 754 $('.overlay').fadeOut( 500 ); 755 756 757} 758 759 760function side_menu(){ 761 $('.buy-now-btn').on('click' ,function(e){ 762 e.preventDefault(); 763 764 var category_id = $(this).attr('data-category'); 765 var event_id = $(this).attr('data-eventid'); 766 open_side_menu(); 767 768 if( category_id && event_id ) { 769 setTimeout( function(){ 770 $('.buy-now-form select.categories-select')[0].selectize.setValue(category_id, false); 771 // $('.buy-now-form select.categories-select')[0].selectize.disable(); 772 }, 200); 773 774 setTimeout( function(){ 775 $('.buy-now-form select.event-select')[0].selectize.setValue(event_id, false); 776 // $('.buy-now-form select.event-select')[0].selectize.disable(); 777 }, 1200); 778 } 779 }); 780 781 $('.side-menu-close-btn').on('click' ,function(){ 782 close_side_menu(); 783 }); 784 785 786 $(document).mouseup(function(e) { 787 var container = $(".side-menu-wrap"); 788 789 if (!container.is(e.target) && container.has(e.target).length === 0){ 790 791 if ( container.hasClass('active') ) { 792 container.removeClass('active'); 793 $('body').removeClass('menu-open'); 794 795 } 796 } 797 }); 798} 799 800 801function sticky_header_init(){ 802 803 var sticky = $('header.site-header'), 804 sticky2 = $('.news-bar-wrap'), 805 body = $('body'); 806 807 var hide_from_top = 250; 808 var sticky_from_top = 150; 809 810 $(window).on('scroll', function () { 811 var scroll = $(window).scrollTop(); 812 if ( $(window).width() <= 576 ) { 813 hide_from_top = 0; 814 sticky_from_top = 120; 815 } 816 817 if(scroll > position) { 818 if (scroll > hide_from_top) { 819 sticky.addClass('is-hide'); 820 sticky2.addClass('is-hide'); 821 } 822 }else{ 823 if (scroll > sticky_from_top) { 824 sticky.addClass('is-sticky'); 825 sticky2.addClass('is-hide'); 826 body.addClass('is-sticky'); 827 sticky.removeClass('is-hide'); 828 sticky2.removeClass('is-hide'); 829 830 }else{ 831 sticky.removeClass('is-hide'); 832 sticky.removeClass('is-sticky'); 833 sticky2.removeClass('is-hide'); 834 sticky2.removeClass('is-sticky'); 835 body.removeClass('is-sticky'); 836 837 838 } 839 840 } 841 842 position = scroll; 843 844 }); 845} 846 847function init_homepage_functions(){ 848 849 home_banner = new Swiper('.main-slider', { 850 navigation: { 851 nextEl: ".main-slider .button-next", 852 prevEl: ".main-slider .button-prev", 853 }, 854 loop: true, 855 autoplay: { 856 delay: 6000, 857 disableOnInteraction : false, 858 pauseOnMouseEnter: false 859 }, 860 }); 861 862 if ( jQuery('body').hasClass('home') ) { 863 var news_bar = jQuery('.news-bar-ticker'); 864 865 if ( news_bar.length ) { 866 jQuery('.news-bar-ticker').AcmeTicker({ 867 autoplay: 10, 868 type:'marquee',/*horizontal/horizontal/Marquee/type*/ 869 direction: 'left',/*up/down/left/right*/ 870 pauseOnFocus: false, 871 pauseOnHover: true, 872 speed: 0.05,/*true/false/number*/ /*For vertical/horizontal 600*//*For marquee 0.05*//*For typewriter 50*/ 873 controls: { 874 toggle: jQuery('.acme-news-ticker-pause'),/*Can be used for horizontal/horizontal/typewriter*//*not work for marquee*/ 875 } 876 }); 877 878 jQuery('.acme-news-ticker-pause').on('click', function(){ 879 if( ! jQuery(this).hasClass('triggered') ) { 880 jQuery(this).addClass('triggered'); 881 jQuery(this).find('.pause-icon').addClass('hideme'); 882 jQuery(this).find('.play-icon').removeClass('hideme'); 883 jQuery(this).removeClass('play'); 884 } else { 885 jQuery(this).removeClass('triggered'); 886 jQuery(this).find('.pause-icon').removeClass('hideme'); 887 jQuery(this).find('.play-icon').addClass('hideme'); 888 jQuery(this).addClass('play'); 889 } 890 }); 891 } 892 893 if ( ! is_mobile() ) { 894 var activities_slider = new Swiper('.activities-slider', { 895 slidesPerView: 2, 896 spaceBetween: 12, 897 loop: true, 898 breakpoints: { 899 990: { 900 slidesPerView: 2, 901 spaceBetween: 5, 902 }, 903 1200: { 904 slidesPerView: 4, 905 spaceBetween: 15, 906 }, 907 1440: { 908 slidesPerView: 4, 909 spaceBetween: 25, 910 }, 911 1650: { 912 slidesPerView: 3, 913 spaceBetween: 25, 914 }, 915 2000: { 916 slidesPerView: 3, 917 spaceBetween: 35, 918 }, 919 }, 920 921 }); 922 } 923 924 } 925 926} 927 928function mobile_footer_nav_init() { 929 if ($(window).width() <= 990) { 930 $('.footer-col-menu .entry-title.mobile-title .toggle-mobile-footer-nav').click(function (e) { 931 e.preventDefault(); 932 933 if( jQuery(this).parents('.footer-col').hasClass('active') ) { 934 $(this).parents('.footer-col-menu').removeClass('active'); 935 $(this).parents('.footer-col').removeClass('active').find('.mobile-nav').slideUp(100); 936 937 jQuery('.site-footer .footer-col-menu').removeClass('active'); 938 jQuery('.site-footer .footer-col-menu .mobile-nav').hide(); 939 } else { 940 941 jQuery('.site-footer .footer-col-menu').removeClass('active'); 942 jQuery('.site-footer .footer-col-menu .mobile-nav').hide(); 943 944 $(this).parents('.footer-col').addClass('active').find('.mobile-nav').slideDown(100); 945 } 946 947 }); 948 949 $('.entry-activity.wide .entry-title-alt').click(function (e) { 950 e.preventDefault(); 951 $(this).parent().toggleClass('active').find('.entry-excerpt.hide-mobile').slideToggle(100); 952 }); 953 } 954} 955 956function a11y_menu() { 957 $('#main-navigation ul li.menu-item-has-children a').on('focusin', function (e) { 958 e.preventDefault(); 959 var this_el = $(this); 960 this_el.parent().addClass('hover'); 961 }); 962 963 $('body').on('focusout', '#main-navigation ul li.menu-item-has-children.hover ul li:last-child a', function (e) { 964 e.preventDefault(); 965 var this_el = $(this); 966 this_el.parent().parent().parent().removeClass('hover'); 967 }); 968} 969 970function fancybox_init() { 971 $('[data-fancybox]').fancybox({ 972 loop: true, 973 baseClass: 'fancybox-gallery', 974 }); 975} 976 977function fast_contact_form() { 978 $('.btn-hidden-form-toggle, .btn-close-hidden-form').click(function (e) { 979 e.preventDefault(); 980 $(this).toggleClass('active'); 981 $('.bottom-strip-hidden-form, .header-hidden-form').toggleClass('active'); 982 }); 983} 984 985function search_box_init() { 986 $('.search-btn').click(function () { 987 if( jQuery(window).width() < 640 ) { 988 $('.header-search').addClass('open-for-mobile'); 989 $('.site-header').addClass('open-for-mobile'); 990 } else { 991 $('.mobile-menu-wrap').removeClass('active'); 992 $('.overlay').fadeOut( 500 ); 993 $('body').removeClass('menu-open'); 994 $('.header-search').toggleClass('open'); 995 $('.header-search').find('.search-input').focus(); 996 } 997 }); 998 999 $('.search-close').click(function () { 1000 if( jQuery(window).width() < 640 ) { 1001 $('.header-search').removeClass('open-for-mobile'); 1002 $('.site-header').removeClass('open-for-mobile'); 1003 } else { 1004 $('.header-search').toggleClass('open'); 1005 } 1006 }); 1007 1008 $('.search').submit(function (e) { 1009 if (!$(this).find('.search-input').val()) { 1010 e.preventDefault(); 1011 } 1012 }); 1013 1014 $(document).mouseup(function(e) { 1015 var container = $(".header-search"); 1016 1017 if (!container.is(e.target) && container.has(e.target).length === 0){ 1018 1019 if ( container.hasClass('open') ) { 1020 container.removeClass('open'); 1021 1022 } 1023 } 1024 }); 1025} 1026 1027function btn_scroll_to() { 1028 $('body').on('click', '.btn-scroll-to', function (e) { 1029 e.preventDefault(); 1030 1031 target = $($(this).data('scrollto')); 1032 $('html, body').animate({ scrollTop: target.offset().top }, 700); 1033 return false;
1034 }); 1035 1036 $(window).scroll(function () { 1037 if ($(window).scrollTop() > 0) { 1038 $('.btn-scroll-to-top').fadeIn(300); 1039 } else { 1040 $('.btn-scroll-to-top').fadeOut(300); 1041 } 1042 }); 1043} 1044 1045function ajax_load_more() { 1046 $('.btn-load-more').click(function (e) { 1047 btn = $(this); 1048 append = $(this).data('append'); 1049 query = $(this).data('query'); 1050 load = $(this).data('load'); 1051 offset = $(this).data('offset'); 1052 template = $(this).data('template'); 1053 1054 e.preventDefault(); 1055 if (!$('.loader-wrap .loader').length) { 1056 $('.loader-wrap').append('<div class="loader"></div>'); 1057 } 1058 1059 $.ajax({ 1060 type: 'POST', 1061 dataType: 'json', 1062 url: siteObject.ajaxurl, 1063 data: { 1064 'action': 'ajax_load_more', 1065 'args': query, 1066 'offset': offset, 1067 'load': load, 1068 'template': template 1069 }, 1070 1071 success: function (results) { 1072 $(append).append(results.html); 1073 $('.loader-wrap .loader').remove(); 1074 if (!results.more) { 1075 $('.btn-load-more').remove(); 1076 } 1077 } 1078 }); 1079 1080 offset = $(this).data('offset') + load; 1081 btn.attr('data-offset', offset).data('offset', offset); 1082 }); 1083} 1084 1085 1086 1087function share_buttons() { 1088 $('a.btn-share').click(function (e) { 1089 e.preventDefault(); 1090 var popup_window; 1091 1092 var width = 555; 1093 var height = 500; 1094 var center_left = (screen.width / 2) - (width / 2); 1095 var center_top = (screen.height / 2) - (height / 2); 1096 var url = $(this).attr("href"); 1097 1098 popup_window = window.open(url, "Title", "scrollbars=1, width="
1098+ width + ", height=" + height + ", left=" + center_left + ", top=" + center_top); 1099 popup_window.focus(); 1100 }); 1101} 1102 1103function ajax_form() { 1104 $('.form-ajax').on('submit', function (e) { 1105 e.preventDefault(); 1106 1107 var $form = $(this); 1108 var $status = $form.find('.form-status'); 1109 var action = $form.attr('action'); 1110 1111 $status.html('<div class="loader"></div>'); 1112 1113 $.post({ 1114 dataType: 'json', 1115 url: siteObject.ajaxurl, 1116 data: { 1117 action: action, 1118 data: $(this).serialize(), 1119 nonce: siteObject.nonce 1120 }, 1121 1122 success: function (response) { 1123 $status.html('<div class="form-message form-message-' + response.status + '">' + response.message + '</div>'); 1124 1125 if ((action == 'ajax_login' || action == 'ajax_register') && response.status === 'success') { 1126 document.location.href = siteObject.homeurl; 1127 } 1128 } 1129 }); 1130 }); 1131} 1132 1133function init_block_hero_slider() { 1134 $('.slider-hero').each(function () { 1135 var swiper = new Swiper($(this)[0], { 1136 effect: 'fade', 1137 fadeEffect: { 1138 crossFade: true 1139 }, 1140 loop: true, 1141 autoplay: { 1142 delay: 5000, 1143 }, 1144 keyboard: { 1145 enabled: true, 1146 onlyInViewport: true 1147 }, 1148 a11y: { 1149 prevSlideMessage: siteObject.strings.prev_slide, 1150 nextSlideMessage: siteObject.strings.next_slide, 1151 }, 1152 navigation: { 1153 nextEl: '.swiper-button-next', 1154 prevEl: '.swiper-button-prev', 1155 }, 1156 }); 1157 }); 1158} 1159 1160function init_footer_logos_slider(){ 1161 var galleryThumbs = new Swiper('.footer-logos', { 1162 spaceBetween: 20, 1163 slidesPerView: 4, 1164 loop: true, 1165 autoplay: { 1166 delay: 3000, 1167 disableOnInteraction : false, 1168 pauseOnMouseEnter: false 1169 }, 1170 breakpoints: { 1171 640: { 1172 slidesPerView: 4, 1173 }, 1174 768: { 1175 slidesPerView: 6, 1176 }, 1177 1024: { 1178 slidesPerView: 6, 1179 }, 1180 1440: { 1181 slidesPerView: 9, 1182 }, 1183 }, 1184 1185 }); 1186} 1187 1188function init_block_slider_with_thumbnails() { 1189 var galleryThumbs = new Swiper('.gallery-thumbs', { 1190 spaceBetween: 10, 1191 slidesPerView: 5, 1192 loop: true, 1193 centeredSlides: true, 1194 keyboard: { 1195 enabled: true, 1196 onlyInViewport: true 1197 }, 1198 }); 1199 1200 var galleryTop = new Swiper('.gallery-top', { 1201 loop: true, 1202 thumbs: { 1203 swiper: galleryThumbs, 1204 }, 1205 keyboard: { 1206 enabled: true, 1207 onlyInViewport: true 1208 }, 1209 }); 1210} 1211 1212function init_block_slider_testimonials() { 1213 $('.slider-testimonials').each(function () { 1214 var swiper = new Swiper($(this)[0], { 1215 effect: 'fade', 1216 fadeEffect: { 1217 crossFade: true 1218 }, 1219 loop: true, 1220 autoplay: { 1221 delay: 5000, 1222 }, 1223 keyboard: { 1224 enabled: true, 1225 onlyInViewport: true 1226 }, 1227 }); 1228 }); 1229} 1230 1231function init_block_slider_images() { 1232
1233 if( jQuery(window).width() > 640 ) { 1234 1235 $('.images-slider').not('.event-gallery').each(function () { 1236 var galleryTop = new Swiper($(this)[0], { 1237 pagination: { 1238 el: $(this).find('.swiper-pagination')[0], 1239 clickable: true, 1240 }, 1241 }); 1242 }); 1243 1244 $('.event-gallery').each(function () { 1245 var _this = $(this)[0]; 1246 var swiper = new Swiper(_this, { 1247 slidesPerView: 1, 1248 spaceBetween: 20, 1249 // loop: true, 1250 navigation: { 1251 nextEl: $(this).parents('.slider-wrap').find('.button-next')[0], 1252 prevEl: $(this).parents('.slider-wrap').find('.button-prev')[0], 1253 }, 1254 breakpoints: { 1255 640: { 1256 slidesPerView: 1, 1257 spaceBetween: 20, 1258 1259 }, 1260 768: { 1261 slidesPerView: 2, 1262 spaceBetween: 20, 1263 }, 1264 1024: { 1265 slidesPerView: 3, 1266 spaceBetween: 70, 1267 1268 }, 1269 }, 1270 on: { 1271 1272 slideChange: function ( swiper ) { 1273 if ( swiper.isEnd ) { 1274 $(_this).parent().addClass('end'); 1275 1276 }else{ 1277 $(_this).parent().removeClass('end'); 1278 1279 } 1280 if ( swiper.activeIndex != '0' ) { 1281 $(_this).parent().addClass('moved'); 1282 }else{ 1283 $(_this).parent().removeClass('moved'); 1284 1285 } 1286 }, 1287 }, 1288 }); 1289 1290 }); 1291 } else { 1292 // gallery for mobile 1293 var slider = new Swiper ('.gallery-slider', { 1294 slidesPerView: 1, 1295 centeredSlides: true, 1296 loop: true, 1297 loopedSlides: 6, 1298 navigation: { 1299 nextEl: '.swiper-button-next', 1300 prevEl: '.swiper-button-prev', 1301 }, 1302 }); 1303 1304 var thumbs = new Swiper ('.gallery-thumbs', { 1305 slidesPerView: 'auto', 1306 spaceBetween: 10, 1307 centeredSlides: true, 1308 loop: true, 1309 slideToClickedSlide: true, 1310 }); 1311 1312 slider.controller.control = thumbs; 1313 thumbs.controller.control = slider; 1314 1315 jQuery('.event-gallery-section').insertAfter( jQuery('.event-details a.btn.alt.buy-now-btn')); 1316 1317 } 1318} 1319 1320function init_activities_slider() { 1321 1322 $('.posts-slider').each(function () { 1323 1324 var _this = $(this)[0]; 1325 var self = $(this); 1326 1327 // var swiper_wrapper = $(this).find('.swiper-wrapper'); 1328 // swiper_wrapper.find('.swiper-slide').each(function(){ 1329 // var divList = swiper_wrapper.find('.swiper-slide'); 1330 // console.log(divList); 1331 // divList.sort(function(a, b){ 1332 // return $(a).data("data-order")-$(b).data("data-order") 1333 // }); 1334 // 1335 // console.log(divList); 1336 // swiper_wrapper.html(divList); 1337 // }); 1338 var items_length = self.find('.swiper-slide').length; 1339 var cols = 4; 1340 var spaceBetween = 70; 1341 if ( self.hasClass( 'grid-5' ) ) { 1342 cols = 5; 1343 spaceBetween = 60; 1344 } 1345 1346 var swiper_events = new Swiper(_this, { 1347 slidesPerView: 1, 1348 spaceBetween: 20, 1349 loop: items_length == 1 ? false : true, 1350 // autoplay: { 1351 // disableOnInteraction: false, 1352 // pauseOnMouseEnter: true, 1353 // }, 1354 navigation: { 1355 nextEl: self.parents('.slider-wrap').find('.button-next')[0], 1356 prevEl: self.parents('.slider-wrap').find('.button-prev')[0], 1357 }, 1358 speed: 5000, 1359 delay : 1000, 1360 breakpoints: { 1361 768: { 1362 slidesPerView: (cols - 2), 1363 spaceBetween: 20, 1364 loop: items_length <= (cols - 2) ? false : true, 1365 }, 1366 992: { 1367 slidesPerView: (cols - 1), 1368 spaceBetween: 20, 1369 loop: items_length <= (cols - 1) ? false : true, 1370 }, 1371 1025: { 1372 slidesPerView: cols, 1373 spaceBetween: 20, 1374 loop: items_length <= cols ? false : true, 1375 }, 1376 1440: { 1377 slidesPerView: cols, 1378 spaceBetween: spaceBetween, 1379 loop: items_length <= cols ? false : true, 1380 }, 1381 }, 1382 // on: { 1383 // slideChange: function ( swiper ) { 1384 // if ( swiper.isEnd ) { 1385 // $(_this).parent().addClass('end'); 1386 // 1387 // }else{ 1388 // $(_this).parent().removeClass('end'); 1389 // 1390 // } 1391 // if ( swiper.activeIndex != '0' ) { 1392 // $(_this).parent().addClass('moved'); 1393 // }else{ 1394 // $(_this).parent().removeClass('moved'); 1395 // 1396 // } 1397 // }, 1398 // }, 1399 }); 1400 // _this.hover(function() { 1401 // swp.autoplay.stop(); 1402 // }, function() { 1403 // swp.autoplay.start(); 1404 // }); 1405 }); 1406} 1407 1408 1409function init_block_tabs() { 1410 $('.tabs-nav a').click(function (e) { 1411 e.preventDefault(); 1412 var tab = $(this).data('tab'); 1413 1414 $('.tabs-nav .tab-item').removeClass('tab-item-active'); 1415 $(this).parent().addClass('tab-item-active'); 1416 1417 $('[data-tabcontent]').removeClass('tab-content-active'); 1418 $('[data-tabcontent="' + tab + '"]').addClass('tab-content-active'); 1419 history.pushState({}, null, '#' + tab); 1420 }); 1421} 1422 1423function init_block_accordion() { 1424 var accordion = { 1425 closeItems: function ($siblings) { 1426 $siblings 1427 .removeClass('active') 1428 .attr('aria-expanded', false)
1429 .find('.entry-body').slideUp(500); 1430 }, 1431 1432 openItem: function ($item) { 1433 $item 1434 .addClass('active') 1435 .attr('aria-expanded', true) 1436 .find('.entry-body').slideDown(500) 1437 1438 }, 1439 1440 init: (function () { 1441 $('.qa-item .entry-header, .entry-job .entry-header').click( function () { 1442 var $this = $(this).parent(); 1443 var $siblings = $this.siblings(); 1444 1445 accordion.closeItems($siblings); 1446 1447 if (!$this.hasClass('active')) { 1448 accordion.openItem($this); 1449 } else { 1450 accordion.closeItems($this); 1451 } 1452 }); 1453 }()), 1454 } 1455} 1456 1457 1458function redirect_to_thankyou_page(){ 1459 if( typeof siteObject.thank_you_page !='undefined' ) { 1460 window.location.assign(siteObject.thank_you_page); 1461 } else { 1462 console.log('thank_you_page not configured'); 1463 } 1464} 1465 1466//adjust iframe height according to esro parameter 1467function receiveMessage(event) { 1468 if (event.data.DocumentHeight != undefined) { 1469 $("#myIframe").height(event.data.DocumentHeight); 1470 } 1471 console.log('event:', event ); 1472 console.log( 'EventData: ', event.data ); 1473 console.log( 'SCREEN: ', event.data.screen ); 1474 1475 if( event.data.screen === 'confirmation.aspx' || event.data.screen === 'opsconfirmation.aspx' ) { 1476 console.log('redirect to thank page!'); 1477 redirect_to_thankyou_page(); 1478 } else if ('errors.aspx' === event.data.screen ) { 1479 console.log('error'); 1480 console.log(event); 1481 } 1482 1483} 1484window.addEventListener("message", receiveMessage, false); 1485 1486//open calendar links 1487$('.js_openCalLinks').click(function(){ 1488 $('body').addClass('calLinksOpen'); 1489}); 1490// Close calendar links on blur 1491$(document).on('click','html',function(){ 1492 if( $('.js_openCalLinks').length ){ 1493 if(!$('.js_openCalLinks').is(':hover')){ 1494 $('body').removeClass('calLinksOpen'); 1495 } 1496 } 1497}); 1498 1499//Horizontal Smooth Scroll 1500if(document.querySelector(".horizontal-smooth-scroll-ltr")){ 1501 var hssParent = document.querySelector('.horizontal-smooth-scroll-ltr').parentNode; 1502 var resetLeft = document.querySelector('.horizontal-smooth-scroll-ltr').clientWidth * -1; 1503 1504 newshorizontalSmoothScroll_ltr( resetLeft ); 1505 1506 setTimeout(function(){ 1507 //Check the width again after font is loaded 1508 if( resetLeft !== (document.querySelector('.horizontal-smooth-scroll-ltr').clientWidth * -1) ) { 1509 resetLeft = document.querySelector('.horizontal-smooth-scroll-ltr').clientWidth * -1; 1510 } 1511 },5000); 1512 1513 //Left to Right 1514 function newshorizontalSmoothScroll_ltr( left ){ 1515 var self = document.querySelectorAll('.horizontal-smooth-scroll-ltr')[0]; 1516 window.news = setInterval(function(){ 1517 left++; 1518 for(var i = 0; i < document.querySelectorAll('.horizontal-smooth-scroll-ltr').length; i++){ 1519 document.querySelectorAll('.horizontal-smooth-scroll-ltr')[i].style.left = left+'px'; 1520 }; 1521 if( self.offsetLeft >= hssParent.clientWidth ) { 1522 hssParent.appendChild(self); 1523 for(var i = 0; i < document.querySelectorAll('.horizontal-smooth-scroll-ltr').length; i++){ 1524 document.querySelectorAll('.horizontal-smooth-scroll-ltr')[i].style.left = resetLeft; 1525 }; 1526 clearInterval(window.news); 1527 newshorizontalSmoothScroll_ltr( resetLeft ); 1528 } 1529 },20); 1530 }; 1531 //Stop news 1532 document.querySelector('.horizontal-smooth-scroll-pause-btn').addEventListener('click',function(){ 1533 this.classList.remove('active'); 1534 document.querySelector('.horizontal-smooth-scroll-play-btn').classList.add('active'); 1535 document.querySelector('.horizontal-smooth-scroll-play-btn').focus(); 1536 clearInterval(window.news); 1537 }); 1538 //Play news 1539 document.querySelector('.horizontal-smooth-scroll-play-btn').addEventListener('click',function(){ 1540 this.classList.remove('active'); 1541 document.querySelector('.horizontal-smooth-scroll-pause-btn').classList.add('active'); 1542 document.querySelector('.horizontal-smooth-scroll-pause-btn').focus(); 1543 var left = document.querySelectorAll('.horizontal-smooth-scroll-ltr')[0].style.left.replace('px',''); 1544 newshorizontalSmoothScroll_ltr(left); 1545 }); 1546 //Stop news on mouse over 1547 document.querySelector('.top-news-text-wrap').addEventListener('mouseover',function(){ 1548 clearInterval(window.news); 1549 }); 1550 //Play news on mouse out 1551 document.querySelector('.top-news-text-wrap').addEventListener('mouseout',function(){ 1552 if(!document.querySelector('.horizontal-smooth-scroll-play-btn.active')){ 1553 var left = document.querySelectorAll('.horizontal-smooth-scroll-ltr')[0].style.left.replace('px',''); 1554 newshorizontalSmoothScroll_ltr(left); 1555 } 1556 }); 1557} 1558 1559function show_calendar_mobile_loader(){ 1560 if( jQuery('.page-template-tpl-event-tours .results-wrap').length ) { 1561 jQuery('.page-template-tpl-event-tours .results-wrap').addClass('loading-section'); 1562 } 1563} 1564function hide_calendar_mobile_loader(){ 1565 if( jQuery('.page-template-tpl-event-tours .results-wrap').length ) { 1566 jQuery('.page-template-tpl-event-tours .results-wrap').removeClass('loading-section'); 1567 } 1568}
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.