PageSourceSearch

https://valentiaisland.ie/wp-content/themes/valentiaisland/js/custom.js?ver=2751

js valentiaisland.ie collected 2026-10-02 11:10:18 UTC 38,706 bytes, 1,324 lines download raw bytes

1// developer JS
2jQuery(document).ready(function($){   
3    
4  // Contact form area level add
5  $('form.wpcf7-form input.wpcf7-form-control').each(function(){ 
6    let inputPlaceholder = $(this).attr('placeholder')
7    let inputName = $(this).attr('name')
8    if(inputPlaceholder){
9      $(this).attr('aria-label', inputPlaceholder)        
10    }
11  })
12
13  // General
14  $('form.wpcf7-form date.wpcf7-form-control').each(function(){ 
15    let inputPlaceholder = $(this).attr('placeholder')
16    let inputName = $(this).attr('name')
17    // if(inputPlaceholder){
18    //   $(this).attr('aria-label', inputPlaceholder)        
19    // }
20    $(this).attr('aria-label', 'Date')
21  })
22
23  // Submit
24  $('input.wpcf7-form-control.wpcf7-submit').each(function(){ 
25    $(this).attr('aria-label', 'Submit')
26  })
27
28  // Teatarea
29  $('textarea.wpcf7-form-control.wpcf7-textarea').each(function() {
30    var placeholder = $(this).attr('placeholder');
31    if (placeholder) {
32      $(this).attr('aria-label', placeholder);
33    } else{
34      $(this).attr('aria-label', 'Message');
35    }
36  });
37
38      // Checkbox
39      $('input[type="checkbox"]').each(function() {
40        var name = $(this).attr('name');
41        if (name) {
42          $(this).attr('aria-label', name);
43        } else {
44          $(this).attr('aria-label', 'click to consent');
45        }
46      });
47
48    // $('input.wpcf7-form-control.wpcf7-submit').attr('aria-label', 'submit');
49
50    // $('a.fh-fixed--bottom.fh-icon--calendar-check').attr('aria-label', 'click to view');
51    $('a.fh-fixed--bottom.fh-icon--calendar-check').attr({
52      role: 'Button',
53      rel: 'noopener noreferrer',
54      'aria-label': 'Click to book now'
55    });
56    
57    
58    /*---------------------------------------------
59  WP form Error handling
60  --------------------------------------------- */        
61  // Select the target node (the div element)
62  var targetNodes = document.getElementsByClassName('wpcf7-response-output');
63
64  // Options for the observer (which mutations to observe)
65  var config = { childList: true, characterData: true, subtree: true };
66
67  // Callback function to execute when mutations are observed
68  var callback = function(mutationsList, observer) {  
69  for(var mutation of mutationsList) {
70  if (mutation.type === 'childList' || mutation.type === 'characterData') {
71      /* Form error alert */
72          $(mutation.target).attr({'aria-live': 'assertive', 'role': 'alert'})
73          $(mutation.target).parent().find('.wpcf7-not-valid-tip').each(function(index){
74              $(this).attr({'aria-live': 'assertive', 'role': 'alert'});
75              if(index === 0){
76                  $(this).siblings('input, textarea, select').focus()
77              }
78          })
79      /* Form error alert end */
80  }
81  }
82  };
83
84
85  // Create an observer instance linked to the callback function
86  var observer = new MutationObserver(callback);
87
88  // Start observing the target node for configured mutations
89  for (var i = 0; i < targetNodes.length; i++) {            
90  observer.observe(targetNodes[i], config);
91  }
92
93  /* Error handling start */
94  // Observe for the class "wpcf7-not-valid-tip" being added
95  const validTipobserver = new MutationObserver(function (mutationsList) {
96  mutationsList.forEach(function (mutation) {
97  if (mutation.addedNodes.length) {
98      $(mutation.addedNodes).each(function () {
99          if ($(this).hasClass("wpcf7-not-valid-tip")) {
100              // Add the aria-live attribute
101              $(this).attr({"aria-live":"assertive", "role":"alert"});
102          }
103      });
104  }
105  });
106  });
107
108  // Start observing the document body for child node changes
109  validTipobserver.observe(document.body, {
110      childList: true,
111      subtree: true
112  });
113
114
115  /*---------------------------------------------
116  constrained focus on window
117  --------------------------------------------- */
118  function trapFocus(event, modalId) {
119    const isTabPressed = event.key === 'Tab' || event.keyCode === 9;
120    if (!isTabPressed) return;
121
122    const focusableElements = 'button, [href], input, select, textarea, iframe, [tabindex]:not([tabindex="-1"])';
123    const modal = document.getElementById(modalId);
124    const focusableContent = Array.from(modal.querySelectorAll(focusableElements)).filter(element => element.offsetParent !== null); // Filter out hidden elements
125
126    const firstFocusableElement = focusableContent[0];
127    const lastFocusableElement = focusableContent[focusableContent.length - 1];
128
129    if (event.shiftKey) {
130        if (document.activeElement === firstFocusableElement) {
131            lastFocusableElement.focus();
132            event.preventDefault();
133        }
134    } else if (document.activeElement === lastFocusableElement) {
135        firstFocusableElement.focus();
136        event.preventDefault();
137    }
138  }
139
140  function handleTouchEvent(event, modalId) {
141    const focusableElements = 'button, [href], input, select, textarea, iframe, [tabindex]:not
141([tabindex="-1"])';
142    const modal = document.getElementById(modalId);
143    const focusableContent = Array.from(modal.querySelectorAll(focusableElements)).filter(element => element.offsetParent !== null);
144
145    const firstFocusableElement = focusableContent[0];
146    const lastFocusableElement = focusableContent[focusableContent.length - 1];
147
148    if (document.activeElement === firstFocusableElement) {
149        lastFocusableElement.focus();
150        // event.preventDefault();
151    } else if (document.activeElement === lastFocusableElement) {
152        firstFocusableElement.focus();
153        // event.preventDefault();
154    }
155
156    // Add ARIA live region for better screen reader support
157    const liveRegion = document.createElement('div');
158    liveRegion.setAttribute('role', 'alert');
159    liveRegion.setAttribute('aria-live', 'assertive');
160    liveRegion.style.position = 'absolute';
161    liveRegion.style.clip = 'rect(1px, 1px, 1px, 1px)';
162    modal.appendChild(liveRegion);
163    
164    setTimeout(() => {
165        modal.removeChild(liveRegion);
166    }, 1000); // Remove the live region after 1 second
167  }
168  
169  function initTrapFocus(modalId) {
170    const modal = document.getElementById(modalId);
171    modal.addEventListener('keydown', (event) => trapFocus(event, modalId));
172    modal.addEventListener('touchstart', (event) => handleTouchEvent(event, modalId), true);
173
174    // Ensure other elements are hidden for screen readers
175      const elementsToHide = document.querySelectorAll('main, header, .logo a, footer, .banner, .skip-to-main-content-link, .header_btns');
176      elementsToHide.forEach(element => {
177        element.setAttribute('aria-hidden', 'true');
178        element.setAttribute('tabindex', '-1');
179      });
180
181
182    // Set the modal as a dialog and modal
183    modal.setAttribute('role', 'dialog');
184    modal.setAttribute('aria-modal', 'true');
185  }
186  
187  function openModal(modalId) {
188  const modal = document.getElementById(modalId);
189  initTrapFocus(modalId);
190  
191  // Set initial focus to the modal
192  modal.setAttribute('tabindex', '-1');
193  modal.focus();
194  }
195  
196  function closeModal(modalId) {
197  const modal = document.getElementById(modalId);
198  modal.removeEventListener('keydown', (event) => trapFocus(event, modalId));
199  
200  // Restore hidden elements for screen readers
201      const elementsToHide = document.querySelectorAll('main, header, .logo a, footer, .banner, .skip-to-main-content-link, .header_btns a');
202      elementsToHide.forEach(element => {
203          element.removeAttribute('aria-hidden');
204          element.removeAttribute('tabindex');
205      });
206  
207  // Remove modal attributes
208  modal.removeAttribute('role');
209  modal.removeAttribute('tabindex');
210  modal.removeAttribute('aria-modal');
211  modal.blur();
212  }
213  
214  $('input[type="checkbox"][name="your-consent"]').on('change', function() {
215      if ($(this).is(':checked')) {
216        // Look inside the same form for the first blank field
217        var $blankField = $(this).closest('form').find('input[aria-required="true"], textarea[aria-required="true"]').filter(function() {
218          return !$(this).val().trim();
219        }).first();
220    
221        if ($blankField.length) {
222          $blankField.focus();
223        }
224      }
225    });
226    
227    // Previous page (left arrow)
228    // $('.pagination a.disabled').attr('title', 'Previous page');
229    // Next page (right arrow) - assuming it's always the last link
230    // $('.pagination li:last-child a').attr('title', 'Next page');
231    
232    // Pagination Accessibility
233    $(document).ready(function () {
234        $('ul.pagination').attr({
235            //"role": "navigation",
236            "aria-label": "Pagination"
237        });
238        // Add titles for next/previous icons
239        $('ul.pagination li a:has(.fa-chevron-right)').attr({
240            "title": "Next Page",
241            "aria-label": "Next Page"
242        });
243        $('ul.pagination li a:has(.fa-chevron-left)').attr({
244            "title": "Previous Page",
245            "aria-label": "Previous Page"
246        });
247    
248        // Loop through li items
249        $('ul.pagination li').each(function () {
250            var liText = $(this).text().trim();
251    
252            if ($.isNumeric(liText)) {
253                // Current page (no anchor)
254                if ($(this).hasClass("current_page")) {
255                    $(this).attr("aria-label", "Current page " + liText);
256                    $(this).attr("aria-current", "page");
257                } else {
258                    // Other pages with <a>
259                    $(this).find("a").attr("aria-label", "Go to page " + liText);
260                }
261            }
262        });
263    });
264    
265    // popup code
266    $(document).ready(function () { 
267      let crrelement;
268
269      $(".consent-modal-show").on("click", function () {
270          crrelement = $(this);
271          var youtubeVideoUrl = $(this).attr("id");        
272
273          // Show the modal
274          $(".modal_wrapper").fadeIn("slow").removeAttr("aria-hidden").attr({
275              "aria-modal": "true",
276              role: "dialog"
277          });
278          $("body").addClass("modal-open");
279        
280          // Clear previous buttons to avoid duplicates
281          $("#apend_btn").empty();
282
283          // Generate new buttons
284          var buttonHtml =
285              '<a href="javascript:void(0)" class="basic_btn modal-show" data-url="' + youtubeVideoUrl + '">Yes</a> ' +
286              '<a href="javascript:void(0)" class="basic_btn cancel-btn">Cancel</a>';
287          
288          // Append new buttons
289          $("#apend_btn").append(buttonHtml);
290
291          // Call function when modal opens (if needed)
292          openModal("feedback_modal");
293          $(".modal_chart_hdng").attr('tabindex', '-1').focus();
294      });
295
296      // Use event delegation to handle dynamically added elements
297      $(document).on("click", ".modal-show", function () {
298          var youtubeVideoUrl = $(this).data("url");
299          if (youtubeVideoUrl) {
300              // Open in a completely new window with specified size
301              window.open(youtubeVideoUrl, "_blank", "width=800,height=600,top=100,left=100,resizable=yes,noopener,noreferrer");
302          }
303          // Close the modal
304          $(".modal_wrapper").attr("aria-hidden", "true").removeAttr("role aria-modal").fadeOut("slow");
305          $("body").removeClass("modal-open");
306          $(".modal_chart_hdng").removeAttr('tabindex');
307          $(crrelement).focus();
308          closeModal("feedback_modal");
309      });
310
311      $(document).on("click", ".cancel-btn", function () {
312          $(".modal_wrapper").attr("aria-hidden", "true").removeAttr("role aria-modal").fadeOut("slow");
313          $("body").removeClass("modal-open");
314          $(".modal_chart_hdng").removeAttr('tabindex');
315          $(crrelement).focus();
316          closeModal("feedback_modal");
317      });  
318    });
319    
320
321});
322
323jQuery(document).ready(function($){
324toggle_menu();
325searchbar();
326home_slider();
327slidr_explore();
328slidr_active();
329slidr_bopators();
330if ($(window).width() < 1100) {
331    $(".sub-menu").slideUp();
332    $(".nav_arrowdown").click(function(){
333      $(".sub-menu").slideUp();
334      if($(this).parent().find(".sub-menu").css('display') == 'none') {
335        $(this).parent().find(".sub-menu").slideDown();
336      } else {
337          $(this).parent().find(".sub-menu").slideUp();
338      }
339    });
340  
341} else {
342    // return false;
343}
344
345
346
347    // Create the script element
348    var scriptElement = $('<script>', {
349      id: 'Cookiebot',
350      src: 'https://consent.cookiebot.com/uc.js',
351      'data-cbid': 'abf2e785-bfe9-45d2-8bb6-ce87ac51a97b',
352      'data-blockingmode': 'auto',
353      type: 'text/javascript'
354    });
355
356    
357
358    // Set a timeout of 5 seconds
359    setTimeout(function() {
360        // Append the script element to the body
361        $('body').append(scriptElement);
362      
363      console.log('Script executed after 5 seconds');
364    }, 5000);
365
366
367
368
369
370$('.tab_menu.accommodation_menu li').on('click', function(){
371    var category = $(this).attr('category')
372    
373    $('.tab_menu.accommodation_menu li').removeClass('tab_active')
374    $(this).addClass('tab_active')
375    if(category == 'all'){
376        $('.accom_stay_wrap .tab_blocks').attr('style','display:block;')
377    }else{
378        $('.accom_stay_wrap .tab_blocks').attr('style','display:none;')
379        $('.accom_stay_wrap .tab_blocks[category="'+category+'"]').attr('style','display:block;')
380    }
381})
382
383$('.tab_menu.accommodation_menu_eat li').on('click', function(){
384    var category = $(this).attr('category')
385    
386    $('.tab_menu.accommodation_menu_eat li').removeClass('tab_active')
387    $(this).addClass('tab_active')
388    if(category == 'all'){
389        $('.accom_eat_wrap .tab_blocks').attr('style','display:block;')
390    }else{
391        $('.accom_eat_wrap .tab_blocks').attr('style','display:none;')
392        $('.accom_eat_wrap .tab_blocks[category="'+category+'"]').attr('style','display:block;')
393    }
394})
395
396
397$(function () {
398    x=4;
399    $('.grt_env_outer .tab_blocks').slice(0, 4).show();
400    $('#load_more_bsns_items').on('click', function (e) {
401        e.preventDefault();
402        x = x+4;
403        $('.grt_env_outer .tab_blocks').slice(0, x).slideDown();
404        
405        if($('.grt_env_outer .tab_blocks:hidden').length === 0){
406            $('#load_more_bsns_items').hide()
407        }
408    });
409});
410
411
412});
413
414// fixed header 
415jQuery(window).scroll(function() {
416if (jQuery(this).scrollTop() > 10){  
417    jQuery('.site-header').addClass("fixed");
418}
419else{
420    jQuery('.site-header').removeClass("fixed");
421}
422}); 
423
424// //Submenu
425// if ($(window).width() < 1100) {
426//     $(".sub-menu").slideUp();
427//     $(".nav_arrowdown").click(function(){
428//       $(".sub-menu").slideUp();
429//       if($(this).parent().find(".sub-menu").css('display') == 'none') {
430//         $(this).parent().find(".sub-menu").slideDown();
431//       } else {
432//           $(this).parent().find(".sub-menu").slideUp();
433//       }
434//     });
435  
436// } else {
437//     return false;
438// }
439
440
441jQuery(function() {
442    AOS.init();
443//window.addEventListener('load', AOS.refresh);
444});
445let scrollRef = 0;
446
447window.addEventListener('scroll', function() {
448// increase value up to 10, then refresh AOS
449scrollRef <= 10 ? scrollRef++ : AOS.refresh();
450});
451    
452/* ---------------------------------------------
453Toggle Menu
454--------------------------------------------- */
455function toggle_menu() {
456var appendthis = ("<div class='modal-overlay js-modal-close'></div>");
457$('.navbar-toggler').on('click', function(){
458    $('.navbar-toggler').toggleClass('is-clicked');
459    $('body').append(appendthis);
460    $('#search-overlay').fadeOut();
461    $('html').toggleClass('menu-show');
462    if ( $('.main-navigation').hasClass('show') ) {
463    $('.main-navigation').removeClass('show');
464    $('.site-header').removeClass('menu-open');
465    $('.modal-overlay').remove();      
466    }
467    else {
468    $('.main-navigation').addClass('show');
469    $('.site-header').addClass('menu-open');
470    }
471});
472}
473
474/* ---------------------------------------------
475search bar
476--------------------------------------------- */
477function searchbar(){
478$('#close-btn').click(function() {
479    $('#search-overlay').fadeOut();
480    $('html').removeClass('search_open');
481});
482$('#search_icon').click(function() {
483    $('#search-overlay').fadeIn();
484    $('#search_icon').toggleClass('search-open');
485    $('.main-navigation').removeClass('show');
486    $('.modal-overlay').remove();
487    $('html').addClass('search_open');
488});
489}
490
491
492
493/* ---------------------------------------------
494Home Slider
495--------------------------------------------- */
496function home_slider(){
497$('#homeSlider').owlCarousel({
498    loop: true,
499    responsiveClass: true,
500    nav: true,
501    dots: false,
502    margin: 0,  
503    mouseDrag: false,
504        //pullDrag: false,
505        touchDrag: false,
506        items: 1, 
507        smartSpeed: 400,
508        navText: ["<i class='fas fa-chevron-left'></i>", "<i class='fas fa-chevron-right'></i>"],
509        animateOut: 'fadeOut',
510        animateIn: 'fadeIn',
511        autoplay: true,
512        autoplayHoverPause: true,
513        autoplayTimeout: 10000, 
514    });
515}
516
517/* ---------------------------------------------
518Explore History & Culture Sliders
519--------------------------------------------- */
520function slidr_explore(){
521$('#slidr_explore').owlCarousel({
522    loop: true,
523    responsiveClass: true,
524    nav: true,
525    dots: false,
526    margin: 0,
527    mouseDrag: false,
528    touchDrag: false,
529    items: 1, 
530    smartSpeed: 400,
531    navText: ["<i class='fas fa-chevron-left'></i>", "<i class='fas fa-chevron-right'></i>"],
532    responsive : {
533    768 : {
534        items: 2,
535        margin: 30
536    },
537    1200 : {
538        items: 3,
539        margin: 30
540    },
541    1600 : {
542        items: 3,
543        margin: 50
544    }
545    }
546});
547}
548
549function slidr_active(){
550$('#slidr_active').owlCarousel({
551    loop: true,
552    responsiveClass: true,
553    nav: true,
554    dots: false,
555    margin: 0,
556    mouseDrag: false,
557    touchDrag: false,
558    items: 1, 
559    smartSpeed: 400,
560    navText: ["<i class='fas fa-chevron-left'></i>", "<i class='fas fa-chevron-right'></i>"],
561    responsive : {
562    768 : {
563        items: 2,
564        margin: 30
565    },
566    1200 : {
567        items: 3,
568        margin: 30
569    },
570    1600 : {
571        items: 3,
572        margin: 50
573    }
574    }
575});
576}
577
578function slidr_bopators(){
579$('#slidr_bopators').owlCarousel({
580    loop: true,
581    responsiveClass: true,
582    nav: true,
583    dots: false,
584    margin: 0,
585    mouseDrag: false,
586    touchDrag: false,
587    items: 1, 
588    smartSpeed: 400,
589    navText: ["<i class='fas fa-chevron-left'></i>", "<i class='fas fa-chevron-right'></i>"],
590    responsive : {
591    768 : {
592        items: 2,
593        margin: 30
594    },
595    1200 : {
596        items: 3,
597        margin: 30
598    },
599    1600 : {
600        items: 3,
601        margin: 50
602    }
603    }
604});
605}
606
607/* ---------------------------------------------
608FAQ accordion
609--------------------------------------------- */
610jQuery(document).ready(function($){
611$('.accordion-list > li > .answer').hide();
612$('.accordion-list > li.active > .answer').show();
613
614$('.accordion-list > li h6').click(function() {
615    if ($(this).parent().hasClass("active")) {
616    $(this).parent().removeClass("active").find(".answer").slideUp();
617    } else {
618    $(".accordion-list > li.active .answer").slideUp();
619    $(".accordion-list > li.active").removeClass("active");
620    $(this).parent().addClass("active").find(".answer").slideDown();
621    }
622    return false;
623});
624
625$(document).on('click','#floatmap',function(){
626
627    jQuery.ajax({
628        url: object.ajax_url,
629        method:'post',
630        data: {
631        'action':'get_home_map',
632
633        },
634        beforeSend: function(){
635        $('#ballspin').show();
636        $('body').addClass('map-open');
637        }, 
638        success:function(data) {
639        $('#ballspin').hide();
640        $('#map_wrapper').show();
641        $('#irelandmaps').html(data.html);
642        }
643
644    });
645    
646});
647
648let currentPage = 1;
649jQuery('#load-posts').on('click', function() {
650    currentPage++; // Do currentPage + 1, because we want to load the next page
651    jQuery.ajax({
652    type: 'POST',
653    url: object.ajax_url,
654    dataType: 'json',
655    data: {
656        action: 'weichie_load_more',
657        paged: currentPage,
658        
659    },
660    beforeSend: function(){
661        $('#post-loads-img').css('display','block');
662    }, 
663    success: function (res) {
664        $('#post-loads-img').css('display','none');
665            console.log(res);
666            if(currentPage >= res.max) {
667        $('#load-posts').hide();
668        }
669        $('.tab_block_grp').append(res.html);
670    }
671    });
672});
673
674
675$(document).on('click','#map_wrapper .close',function(){
676    $('body').removeClass('map-open');
677    $('#map_wrapper').hide();
678    $('#irelandmaps').html('');  
679});
680
681});
682
683//Testimonial Slider
684$('.review_slider').owlCarousel({
685    loop: true,
686    responsiveClass: true,
687    nav: true,
688    dots: false,
689    margin: 0,
690    mouseDrag: true,
691    touchDrag: true,
692    autoHeight:true,
693    items: 1, 
694    smartSpeed: 400,
695    navText: ["<i class='fas fa-chevron-left'></i>", "<i class='fas fa-chevron-right'></i>"],
696    responsive : {
697        768 : {
698        items: 2,
699        margin: 30
700        },
701        1200 : {
702        items: 3,
703        margin: 30
704        },
705        1600 : {
706        items: 3,
707        margin: 50
708        }
709    }
710});
711
712
713
714//------ new javascript WCAG
715
716
717/*---------------------------------------------
718  constrained focus on window
719  --------------------------------------------- */
720  function trapFocus(event, modalId) {
721  const isTabPressed = event.key === 'Tab' || event.keyCode === 9;
722  if (!isTabPressed) return;
723  
724  const focusableElements = 'button, [href], input, select, textarea, iframe, [tabindex]:not([tabindex="-1"])';
725  const modal = document.getElementById(modalId);
726  const focusableContent = Array.from(modal.querySelectorAll(focusableElements)).filter(element => element.offsetParent !== null); // Filter out hidden elements
727  
728  const firstFocusableElement = focusableContent[0];
729  const lastFocusableElement = focusableContent[focusableContent.length - 1];
730  
731  if (event.shiftKey) {
732      if (document.activeElement === firstFocusableElement) {
733          lastFocusableElement.focus();
734          event.preventDefault();
735      }
736  } else if (document.activeElement === lastFocusableElement) {
737      firstFocusableElement.focus();
738      event.preventDefault();
739  }
740  }
741  
742  function handleTouchEvent(event, modalId) {
743  const focusableElements = 'button, [href], input, select, textarea, iframe, [tabindex]:not([tabindex="-1"])';
744  const modal = document.getElementById(modalId);
745  const focusableContent = Array.from(modal.querySelectorAll(focusableElements)).filter(element => element.offsetParent !== null);
746  
747  const firstFocusableElement = focusableContent[0];
748  const lastFocusableElement = focusableContent[focusableContent.length - 1];
749  
750  if (document.activeElement === firstFocusableElement) {
751      lastFocusableElement.focus();
752      // event.preventDefault();
753  } else if (document.activeElement === lastFocusableElement) {
754      firstFocusableElement.focus();
755      // event.preventDefault();
756  }
757  
758  // Add ARIA live region for better screen reader support
759  const liveRegion = document.createElement('div');
760  liveRegion.setAttribute('role', 'alert');
761  liveRegion.setAttribute('aria-live', 'assertive');
762  liveRegion.style.position = 'absolute';
763  liveRegion.style.clip = 'rect(1px, 1px, 1px, 1px)';
764  modal.appendChild(liveRegion);
765  
766  setTimeout(() => {
767      modal.removeChild(liveRegion);
768  }, 1000); // Remove the live region after 1 second
769  }
770  
771  function initTrapFocus(modalId) {
772  const modal = document.getElementById(modalId);
773  modal.addEventListener('keydown', (event) => trapFocus(event, modalId));
774  modal.addEventListener('touchstart', (event) => handleTouchEvent(event, modalId), true);
775  
776  // Ensure other elements are hidden for screen readers
777  const elementsToHide = document.querySelectorAll('main, header, .logo a, footer, .banner, .skip-to-main-content-link, .header_btns a');
778  elementsToHide.forEach(element => {
779      element.setAttribute('aria-hidden', 'true');
780      element.setAttribute('tabindex', '-1');
781  });
782  
783  
784  // Set the modal as a dialog and modal
785  modal.setAttribute('role', 'dialog');
786  modal.setAttribute('aria-modal', 'true');
787  }
788  
789  function openModal(modalId) {
790  const modal = document.getElementById(modalId);
791  initTrapFocus(modalId);
792  
793  // Set initial focus to the modal
794  modal.setAttribute('tabindex', '-1');
795  modal.focus();
796  }
797  
798  function closeModal(modalId) {
799  const modal = document.getElementById(modalId);
800  modal.removeEventListener('keydown', (event) => trapFocus(event, modalId));
801  
802  // Restore hidden elements for screen readers
803      const elementsToHide = document.querySelectorAll('main, header, .logo a, footer, .banner, .skip-to-main-content-link, .header_btns a');
804      elementsToHide.forEach(element => {
805          element.removeAttribute('aria-hidden');
806          element.removeAttribute('tabindex');
807      });
808  
809  // Remove modal attributes
810  modal.removeAttribute('role');
811  modal.removeAttribute('tabindex');
812  modal.removeAttribute('aria-modal');
813  modal.blur();
814  }
815
816
817
818/*----------------------------------------------
819Skip to main content
820--------------------------------------------- */
821$(".c").focus(function(){
822  $(this).addClass('focused');
823}); 
824
825$(".skip-to-main-content-link").focusout(function(){
826   $(this).removeClass('focused');
827});
828$(".skip-to-main-content-link").click(function() {
829  $('html,body').animate({
830      scrollTop: $("#main").offset().top},
831  'slow');
832});
833
834$('#wpadminbar .screen-reader-shortcut').attr('tabindex','-1');
835
836/*----------------------------------------------
837Accessibility Desktop Menu
838--------------------------------------------- */
839
840// Close all menus initially
841$(".sub-menu").slideUp();
842$(".nav_arrowdown").attr("aria-expanded", "false");
843 
844let touchHandled = false;
845 
846$(".nav_arrowdown").on("touchend", function () {
847  touchHandled = true;
848  handleMenuToggle($(this));
849});
850 
851$(".nav_arrowdown").on("click", function () {
852  if (touchHandled) {
853    touchHandled = false;
854    return;
855  }
856  handleMenuToggle($(this));
857});
858 
859function handleMenuToggle($arrow) {
860  const $submenu = $arrow.next(".sub-menu");
861  const $parentLi = $arrow.closest("li");
862  const isSubmenuVisible = $submenu.is(":visible");
863 
864  // Close only sibling submenus (same level)
865  $parentLi.siblings().each(function () {
866    $(this).find("> .sub-menu").slideUp().removeClass("active");
867    $(this).find("> .nav_arrowdown").attr("aria-expanded", "false");
868  });
869 
870  // Toggle current submenu
871  if (!isSubmenuVisible) {
872    $submenu.slideDown().addClass("active");
873    $arrow.attr("aria-expanded", "true");
874  } else {
875    $submenu.slideUp().removeClass("active");
876    $arrow.attr("aria-expanded", "false");
877  }
878}
879
880
881/*---------------------------------------------
882Accessible tab
883--------------------------------------------- 
884 *   This content is licensed according to the W3C Software License at
885 *   https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document
886 *   File:   tabs-automatic.js
887 *   Desc:   Tablist widget that implements ARIA Authoring Practices
888 */
889'use strict';
890class TabsAutomatic {
891  constructor(groupNode) {
892    this.tablistNode = groupNode;
893    this.tabs = [];
894    this.firstTab = null;
895    this.lastTab = null;
896
897    this.tabs = Array.from(this.tablistNode.querySelectorAll('[role=tab]'));
898    this.tabpanels = [];
899
900    for (var i = 0; i < this.tabs.length; i += 1) {
901      var tab = this.tabs[i];
902      var tabpanel = document.getElementById(tab.getAttribute('aria-controls'));
903
904      tab.tabIndex = -1;
905      tab.setAttribute('aria-selected', 'false');
906      this.tabpanels.push(tabpanel);
907
908      tab.addEventListener('keydown', this.onKeydown.bind(this));
909      tab.addEventListener('click', this.onClick.bind(this));
910
911      if (!this.firstTab) {
912        this.firstTab = tab;
913      }
914      this.lastTab = tab;
915    }
916
917    this.setSelectedTab(this.firstTab, false);
918  }
919  setSelectedTab(currentTab, setFocus) {
920    if (typeof setFocus !== 'boolean') {
921      setFocus = true;
922    }
923    for (var i = 0; i < this.tabs.length; i += 1) {
924      var tab = this.tabs[i];
925      if (currentTab === tab) {
926        tab.setAttribute('aria-selected', 'true');
927        tab.removeAttribute('tabindex');
928        this.tabpanels[i].classList.remove('is-hidden');
929        if (setFocus) {
930          tab.focus();
931        }
932      } else {
933        tab.setAttribute('aria-selected', 'false');
934        tab.tabIndex = -1;
935        this.tabpanels[i].classList.add('is-hidden');
936      }
937    }
938  }
939  setSelectedToPreviousTab(currentTab) {
940    var index;
941
942    if (currentTab === this.firstTab) {
943      this.setSelectedTab(this.lastTab);
944    } else {
945      index = this.tabs.indexOf(currentTab);
946      this.setSelectedTab(this.tabs[index - 1]);
947    }
948  }
949  setSelectedToNextTab(currentTab) {
950    var index;
951
952    if (currentTab === this.lastTab) {
953      this.setSelectedTab(this.firstTab);
954    } else {
955      index = this.tabs.indexOf(currentTab);
956      this.setSelectedTab(this.tabs[index + 1]);
957    }
958  }
959  /* EVENT HANDLERS */
960  onKeydown(event) {
961    var tgt = event.currentTarget,
962      flag = false;
963
964    switch (event.key) {
965      case 'ArrowLeft':
966        this.setSelectedToPreviousTab(tgt);
967        flag = true;
968        break;
969
970      case 'ArrowRight':
971        this.setSelectedToNextTab(tgt);
972        flag = true;
973        break;
974
975      case 'Home':
976        this.setSelectedTab(this.firstTab);
977        flag = true;
978        break;
979
980      case 'End':
981        this.setSelectedTab(this.lastTab);
982        flag = true;
983        break;
984
985      default:
986        break;
987    }
988
989    if (flag) {
990      event.stopPropagation();
991      event.preventDefault();
992    }
993  }
994  onClick(event) {
995    this.setSelectedTab(event.currentTarget);
996  }
997}
998// Initialize tablist
999window.addEventListener('load', function () {
1000  var tablists = document.querySelectorAll('[role=tablist].automatic');
1001  for (var i = 0; i < tablists.length; i++) {
1002    new TabsAutomatic(tablists[i]);
1003  }
1004});
1005
1006
1007// --- mobile search toggle
1008$(document).ready(function() {
1009    $('#search_icon').on('click', function(e) {
1010        e.stopPropagation(); // Prevent the click from bubbling up to the document
1011        $('.search-block .search-form').toggleClass('open-search');
1012        openModal('t-search');
1013    });
1014    $('.search-block .search-form').on('click', function(e) {
1015        e.stopPropagation(); // Prevent closing when clicking inside the search box
1016    });
1017    $("#close-btn").on('click', function() {
1018        $('.search-block .search-form').removeClass('open-search');
1019        closeModal('search-overlay');
1020        $("#search_icon").focus();
1021    });
1022});
1023
1024
1025//owl slider ITEM Focus 
1026
1027$(document).on("click", ".owl-next", function () {
1028  $(".owl-item.active").first().attr("tabindex", "-1").focus();
1029});
1030
1031$(document).on("click", ".owl-prev", function () {
1032  $(".owl-item.active").first().attr("tabindex", "-1").focus();
1033});
1034
1035//owl slider button accessible
1036
1037$(document).ready(function () {
1038  // Make owl navigation accessible
1039  $(".owl-prev")
1040    .attr({
1041      "aria-label": "Previous slide",
1042      "role": "button",
1043      "tabindex": "0"
1044    });
1045
1046  $(".owl-next")
1047    .attr({
1048      "aria-label": "Next slide",
1049      "role": "button",
1050      "tabindex": "0"
1051    });
1052
1053  // Add keyboard support (Enter / Space)
1054  $(document).on("keydown", ".owl-prev, .owl-next", function (e) {
1055    if (e.key === "Enter" || e.key === " " || e.keyCode === 13 || e.keyCode === 32) {
1056      e.preventDefault();
1057      $(this).trigger("click"); // simulate click
1058    }
1059  });
1060});
1061
1062
1063
1064/* ---------------------------------------------
1065    Custom Accessible Accordion
1066  --------------------------------------------- */
1067  $('.answer').hide();
1068  $('.accordion-list > li.active > .answer').show();
1069  
1070  $('.accord_trigger').click(function() {
1071    if ($(this).parent().hasClass("active")) {
1072      $(this).parent().removeClass("active").find(".answer").slideUp();
1073      $(this).attr('aria-expanded','false');
1074    } else {
1075      $(".accordion-list > li.active .answer").slideUp();
1076      $(".accordion-list > li.active").removeClass("active");
1077      $('.accord_trigger').attr('aria-expanded','false');
1078      $(this).parent().addClass("active").find(".answer").slideDown();
1079      $(this).attr('aria-expanded','true');
1080    }
1081    return false;
1082  });
1083
1084 
1085  $(document).ready(function () {
1086    // Main Accordion Toggle
1087    $('.main-toggle').on('click', function () {
1088      const content = $(this).next('.accordion-content');
1089      const isExpanded = $(this).attr('aria-expanded') === 'true';
1090  
1091      // Close other main accordions
1092      $('.main-toggle').attr('aria-expanded', 'false').removeClass('active');
1093      $('.main-toggle').next('.accordion-content').slideUp();
1094  
1095      if (!isExpanded) {
1096        content.slideDown();
1097        $(this).attr('aria-expanded', 'true').addClass('active');
1098      } else {
1099        $(this).removeClass('active');
1100      }
1101    });
1102  
1103    // Sub-Accordion Toggle
1104    $('.sub-toggle').on('click', function (e) {
1105      e.stopPropagation(); // Prevent event bubbling to parent accordions
1106  
1107      const content = $(this).next('.accordion-content');
1108      const isExpanded = $(this).attr('aria-expanded') === 'true';
1109  
1110      // Close other sub-accordions within the same parent
1111      $(this).closest('.sub-accordion')
1112        .find('.sub-toggle')
1113        .not(this)
1114        .attr('aria-expanded', 'false')
1115        .removeClass('active')
1116        .next('.accordion-content')
1117        .slideUp();
1118  
1119      if (!isExpanded) {
1120        content.slideDown();
1121        $(this).attr('aria-expanded', 'true').addClass('active');
1122      } else {
1123        content.slideUp();
1124        $(this).attr('aria-expanded', 'false').removeClass('active');
1125      }
1126    });
1127  });
1128
1129
1130
1131
1132$(document).on("click", ".accordion-toggle.main-toggle", function () {
1133    var $this = $(this);
1134    var $parent = $this.closest(".accordian_item");
1135
1136    // remove from siblings
1137    $parent.siblings(".accordian_item").removeClass("active-togg");
1138
1139    // toggle for the clicked one
1140    if ($this.hasClass("active")) {
1141        $parent.addClass("active-togg");
1142    } else {
1143        $parent.removeClass("active-togg");
1144    }
1145});
1146
1147$(".post_info").each(function () {
1148    var $this = $(this);
1149    var authorName = $this.find("strong").text().trim();
1150
1151    $this.find("img").attr("alt", "Our member " + authorName);
1152});
1153
1154//add aria-label
1155$('.social_blk a').each(function () {
1156  var linkTitle = $(this).attr('title'); // get <a> title
1157  if (linkTitle) {
1158    var label = linkTitle + ' profile'; // add "profile"
1159    $(this).find('img').attr({
1160      'aria-label': label,
1161      //'alt': label
1162    });
1163  }
1164});
1165
1166//captcha tabindex addClass
1167// Function to apply tabindex -1
1168function disableRecaptchaFocus() {
1169  document.querySelectorAll('.grecaptcha-badge').forEach(function(el) {
1170    el.setAttribute('tabindex', '-1');
1171  });
1172}
1173
1174// Run once on page load
1175disableRecaptchaFocus();
1176
1177// Observe DOM changes
1178const observer = new MutationObserver(() => {
1179  disableRecaptchaFocus();
1180});
1181
1182observer.observe(document.body, {
1183  childList: true,
1184  subtree: true
1185});
1186
1187//remove role
1188document.addEventListener("DOMContentLoaded", function() {
1189  document.querySelectorAll('ul.pagination').forEach(function(el) {
1190    el.removeAttribute('role');
1191  });
1192});
1193
1194
1195$(document).ready(function() {
1196  $('.sbi_follow_btn a').attr('aria-label', 'follow us on instagram');
1197});
1198
1199
1200
1201//----- video play - pause
1202
1203$('#video-play-toggle').click( function() {
1204    var ban_video = document.getElementById("ban_video");
1205    if ($(this).html() == 'Pause Video'){
1206      ban_video.pause();
1207      $(this).html('Play Video');
1208      $(this).addClass('play-bt').removeClass('pause-bt');
1209      // $(this).attr('aria-label', 'Play Video')
1210    } else {
1211      ban_video.play(); 
1212      $(this).html('Pause Video')
1213      $(this).removeClass('play-bt').addClass('pause-bt');
1214      // $(this).attr('aria-label', 'Pause Video')
1215    }
1216});
1217
1218// mute & unmute video
1219
1220$(document).ready(function () {
1221    $('#video-mute-toggle').on('click', function () {
1222        var video = $('#ban_video').get(0); // Change ID if needed
1223        $(this).toggleClass('active');
1224
1225        if ($(this).hasClass('active')) {
1226            video.muted = false; // Sound ON
1227            $(this).attr({
1228                'aria-pressed': 'true',
1229                'aria-label': 'Mute video sound'
1230            });
1231        } else {
1232            video.muted = true; // Sound OFF
1233            $(this).attr({
1234                'aria-pressed': 'false',
1235                'aria-label': 'Unmute video sound'
1236            });
1237        }
1238    });
1239});
1240
1241
1242
1243
1244
1245//Search modal accessable====
1246// jQuery('#search_icon a').on('click', function() {
1247//   //jQuery('.overlay').addClass('-is-shown');
1248//   //jQuery('.overlay-2').addClass('-is-shown');
1249//   jQuery('body').addClass('stop_overflow');
1250  
1251//   jQuery("#search-overlay").attr({
1252//       "aria-modal": "true",
1253//       role: "dialog"
1254//   });
1255//     openModal('search-overlay');
1256      
1257//   jQuery('.search-box_input input').focus()
1258  
1259// });
1260//   jQuery('#close-btn').on('click', function() { 
1261//   //jQuery('.overlay').removeClass('-is-shown');
1262//   //jQuery('.overlay-2').removeClass('-is-shown');
1263//   jQuery('body').removeClass('stop_overflow');
1264  
1265//   jQuery("#search-overlay").attr('aria-hidden', 'true');
1266//       jQuery("#search-overlay").removeAttr("role");
1267//       jQuery("#search-overlay").removeAttr("aria-modal");
1268//       jQuery("#search_icon a").focus();
1269//       closeModal('search-overlay');  
1270// });
1271
1272
1273/* ---------------------------------------------
1274Mobile Menu
1275--------------------------------------------- */
1276$(".menuTrigger").click(function(){
1277  $("body").toggleClass("menu_active");
1278});
1279
1280$(".overly").click(function(){
1281  $("body").removeClass("menu_active");
1282});
1283
1284
1285if ($(window).width() < 1199) {
1286
1287//Mobile Menu Toggle
1288$("#menu-main-menu, #menu-main-menu a, .toggle-close, .nav_arrowdown").attr({"tabindex":"-1", "aria-hidden": "true"});
1289
1290$(".toggle-open").click(function(){
1291$("#menu-main-menu").removeAttr("tabindex aria-hidden");
1292$("#menu-main-menu a").removeAttr("tabindex aria-hidden");
1293$(this).attr({"tabindex":"-1", "aria-hidden": "true"});
1294$(".toggle-close").removeAttr("tabindex aria-hidden");
1295$(".nav_arrowdown").removeAttr("tabindex aria-hidden");
1296// Call this function when the modal opens        
1297openModal('site-navigation');
1298$('.primary-menu li:first-child > a').focus();
1299});
1300$(".menuTrigger.toggle-close").click(function(){
1301$("#menu-main-menu").attr({"tabindex":"-1", "aria-hidden": "true"});
1302$("#menu-main-menu a").attr({"tabindex":"-1", "aria-hidden": "true"});
1303$(this).attr({"tabindex":"-1", "aria-hidden": "true"});
1304$(".nav_arrowdown").attr({"tabindex":"-1", "aria-hidden": "true"});
1305closeModal('site-navigation');
1306$(".toggle-open").removeAttr("tabindex aria-hidden").focus();
1307});
1308
1309} else {
1310false;
1311};
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324

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.