PageSourceSearch

https://www.clintonhealthaccess.org/wp-content/themes/chai/assets/js/accessibility.js?ver=1790270920

js clintonhealthaccess.org collected 2026-09-24 18:01:23 UTC 24,276 bytes, 767 lines download raw bytes

1jQuery(document).ready(function ($) {
2  // alert('teste');
3  console.trace = null;  //or window.console.trace=null;
4
5  /**
6   * Add appropriate aria attributes to Accordion & Toggle Divi modules
7   *
8   * @divi-module  Accordion, Toggle
9   */
10  $(".et_pb_toggle").each(function (index) {
11    var $toggle = $(this);
12    var $title = $toggle.find(".et_pb_toggle_title");
13    var $panel = $toggle.find(".et_pb_toggle_content");
14    var isAccordion = $toggle.hasClass("et_pb_accordion_item");
15
16    $title.attr("role", "button");
17    $title.attr("tabindex", 0);
18    $title.attr("aria-controls", "et_pb_toggle_content_" + index);
19    $panel.attr("id", "et_pb_toggle_content_" + index);
20
21    if ($toggle.hasClass("et_pb_toggle_open")) {
22      $title.attr("aria-expanded", true);
23
24      if (isAccordion) $title.attr("aria-disabled", true);
25    } else {
26      $title.attr("aria-expanded", false);
27
28      if (isAccordion) $title.removeAttr("aria-disabled");
29    }
30  });
31
32  /**
33   * Prevent spacebar from scolling page when toggle & accordion have focus.
34   *
35   * @divi-module  Accordion, Toggle
36   */
37  $(".et_pb_toggle_title").on("keydown", function (e) {
38    // Spacebar.
39    if (e.which === 32) {
40      e.preventDefault();
41    }
42  });
43
44  /**
45   * Expand Accordion & Toggle modules when enter or spacebar are pressed while focused.
46   *
47   * @divi-module  Accordion, Toggle
48   */
49  $(document).on("keyup", function (e) {
50    // Spacebar & Enter.
51    if (e.which === 13 || e.which === 32) {
52      $(".et_pb_toggle_title:focus").trigger("click");
53    }
54  });
55
56  /**
57   * Set aria attributes of Accordion & Toggle modules when one is clicked.
58   *
59   * @divi-module  Accordion, Toggle
60   */
61  $(".et_pb_toggle_title").on("click", function () {
62    var $clickedToggleTitle = $(this);
63    var $clickedToggle = $clickedToggleTitle.parent();
64    var isAccordion = $clickedToggle.hasClass("et_pb_accordion_item");
65
66    if (isAccordion) {
67      // Only change the aria attributes if an accordion toggle isn't already open
68      if (!$clickedToggle.hasClass("et_pb_toggle_open")) {
69        var $allSiblingToggles = $clickedToggleTitle
70          .closest(".et_pb_accordion")
71          .find(".et_pb_toggle");
72
73        // Reset the aria attributes on the open toggle
74        $allSiblingToggles.each(function () {
75          $toggle = $(this);
76          if ($toggle.hasClass("et_pb_toggle_open")) {
77            var $openToggleTitle = $toggle.find(".et_pb_toggle_title");
78
79            $openToggleTitle.attr("aria-expanded", false);
80            $openToggleTitle.removeAttr("aria-disabled");
81          }
82        });
83
84        // Set the aria attributes on the clicked toggle
85        setTimeout(function () {
86          $clickedToggleTitle.attr("aria-expanded", true);
87          $clickedToggleTitle.attr("aria-disabled", true);
88        }, 500);
89      }
90    } else {
91      // The toggle isn't part of an accordion so its aria attributes should be udpated
92      if ($clickedToggle.hasClass("et_pb_toggle_open")) {
93        $clickedToggleTitle.attr("aria-expanded", false);
94      } else {
95        $clickedToggleTitle.attr("aria-expanded", true);
96      }
97    }
98  });
99
100  /**
101   * Add unique ID to search module.
102   * Need to use data attribute because a regular ID somehow interferes with Divi.
103   *
104   * @divi-module  Search
105   */
106  $(".et-search-field").each(function (e) {
107    $(this).attr("data-a11y-id", "et_pb_search_module_" + e);
108    $(this).on("focus", function () {
109      var largeScreenUp = window.matchMedia("(min-width: 980px)");
110      if (largeScreenUp.matches) {
111        $('#et_top_search').click();
112      }
113    })
114  });
115  $('.et_close_search_field').attr('title', "Close search form")
116  /**
117   * Add role="tabList".
118   *
119   * @divi-module  Tab
120   */
121  $(".et_pb_tabs_controls").each(function () {
122    $(this).attr("role", "tablist");
123  });
124
125  /**
126   * Add role="presentation".
127   *
128   * @divi-module  Tab
129   */
130  $(".et_pb_tabs_controls li").each(function () {
131    $(this).attr("role", "presentation");
132  });
133
134  /**
135   * Add role="tab".
136   *
137   * @divi-module  Tab
138   */
139  $(".et_pb_tabs_controls a").each(function () {
140    $(this).attr({
141      role: "tab",
142    });
143  });
144
145  /**
146   * Add role="tabpanel".
147   *
148   * @divi-module  Tab
149   */
150  $(".et_pb_tab").each(function () {
151    $(this).attr("role", "tabpanel");
152  });
153
154  /**
155   * Add initial state:
156   *
157   * aria-selected="false"
158   * aria-expanded="false"
159   * tabindex=-1
160   *
161   * @divi-module  Tab
162   */
163  $(".et_pb_tabs_controls li:not(.et_pb_tab_active) a").each(function () {
164    $(this).attr({
165      "aria-selected": "false",
166      "aria-expanded": "false",
167      // tabindex: -1,
168    });
169  });
170
171  /**
172   * Add initial state:
173   *
174   * aria-selected="true"
175   * aria-expanded="true"
176   * tabindex=-1
177   *
178   * @divi-module  Tab
179   */
180  $(".et_pb_tabs_controls li.et_pb_tab_active a").each(function () {
181    $(this).attr({
182      "aria-selected": "true",
183      "aria-expanded": "true",
184      tabindex: 0,
185    });
186  });
187
188  //Add aria-haspopup="true" support to submenus only if have children
189  $("ul.sub-menu .menu-item a").each(function () {
190    if ($(this).siblings("ul").length) {
191      $(this).attr({
192        "aria-haspopup": "true",
193      });
194    }
195  });
196
197  // Add role="link" to all links
198  $(
199    "a:not(.et-social-icon a, .wp-block-button__link, figure a, .et_pb_button, .et_pb_video_play a, .et_pb_tabs_controls a)"
200  ).each(function () {
201    $(this).attr({
202      role: "link",
203    });
204  });
205
206  // Add role="button" to clickable elements
207  $(
208    "#et_search_icon, .et_close_search_field, #searchsubmit, .icon, .wp-block-button__link, .et_pb_button, .et_pb_video_play a"
209  ).each(function () {
210    $(this).attr({
211      role: "button",
212    });
213  });
214
215  //Add aria support to reCAPTCHA
216  $("#g-recaptcha-response").each(function () {
217    $(this).attr({
218      "aria-hidden": "true",
219      "aria-label": "do not use",
220      "aria-readonly": "true",
221    });
222  });
223
224  /**
225   * Add unique ID to tab controls.
226   * Add aria-controls="x".
227   *
228   * @divi-module  Tab
229   */
230  $(".et_pb_tabs_controls a").each(function (e) {
231    $(this).attr({
232      id: "et_pb_tab_control_" + e,
233      "aria-controls": "et_pb_tab_panel_" + e,
234    });
235  });
236
237  /**
238   * Add unique ID to tab panels.
239   * Add aria-labelledby="x".
240   *
241   * @divi-module  Tab
242   */
243  $(".et_pb_tab").each(function (e) {
244    $(this).attr({
245      id: "et_pb_tab_panel_" + e,
246      "aria-labelledby": "et_pb_tab_control_" + e,
247    });
248  });
249
250  /**
251   * Set initial inactive tab panels to aria-hidden="false".
252   *
253   * @divi-module  Tab
254   */
255  $(".et_pb_tab.et_pb_active_content").each(function () {
256    $(this).attr("aria-hidden", "false");
257  });
258
259  /**
260   * Set initial inactive tab panels to aria-hidden="true".
261   *
262   * @divi-module  Tab
263   */
264  $(".et_pb_tab:not(.et_pb_active_content)").each(function () {
265    $(this).attr("aria-hidden", "true");
266  });
267
268  /**
269   * Add unique ID to tab module.
270   * Need to use data attribute because a regular ID somehow interferes with Divi.
271   *
272   * @divi-module  Tab
273   */
274  $(".et_pb_tabs").each(function (e) {
275    $(this).attr("data-a11y-id", "et_pb_tab_module_" + e);
276  });
277
278  /**
279   * Update aria-selected attribute when tab is clicked or when hitting enter while focused.
280   *
281   * @divi-module  Tab
282   */
283  $(".et_pb_tabs_controls a").on("click", function () {
284    const id = $(this).attr("id");
285    const namespace = $(this).closest(".et_pb_tabs").attr("data-a11y-id"); // Used as a selector to scope changes to current module.
286    // Reset all tab controls to be aria-selected="false" & aria-expanded="false".
287    $('[data-a11y-id="' + namespace + '"] .et_pb_tabs_controls a').attr({
288      "aria-selected": "false",
289      "aria-expanded": "false",
290      tabindex: -1,
291    });
292    // Make active tab control aria-selected="true" & aria-expanded="true".
293    $(this).attr({
294      "aria-selected": "true",
295      "aria-expanded": "true",
296      tabindex: 0,
297    });
298    // Reset all tabs to be aria-hidden="true".
299    $("#" + namespace + " .et_pb_tab").attr("aria-hidden", "true");
300    // Label active tab panel as aria-hidden="false".
301    $('[aria-labelledby="' + id + '"]').attr("aria-hidden", "false");
302  });
303
304  // Arrow navigation for tab modules
305  $(".et_pb_tabs_controls a").keyup(function (e) {
306    const namespace = $(this).closest(".et_pb_tabs").attr("data-a11y-id");
307    const module = $('[data-a11y-id="' + namespace + '"]');
308    if (e.which === 39) {
309      // Right.
310      const next = module.find("li.et_pb_tab_active").next();
311      const current = module.find("li.et_pb_tab_active");
312      if (next.length > 0) {
313        next.find("a").trigger("click").focus();
314        current.blur();
315      } else {
316        module.find("li:first a").trigger("click").focus();
317        current.blur();
318      }
319    } else if (e.which === 37) {
320      // Left.
321      const next = module.find("li.et_pb_tab_active").prev();
322      const current = module.find("li.et_pb_tab_active");
323      if (next.length > 0) {
324        next.find("a").trigger("click").focus();
325        current.blur();
326      } else {
327        module.find("li:last a").trigger("click").focus();
328        current.blur();
329      }
330    }
331    $(".et_pb_tabs_controls a").removeClass("keyboard-outline");
332    module.find("li.et_pb_tab_active a").addClass("keyboard-outline");
333  });
334
335  //Remove focus on map (.nano-content) and arrow previous on home slider
336  setTimeout(() => {
337    $(
338      ".nano-content, .home-slide-content .slide-arrow-prev, .home-slide-content .post-link"
339    ).attr({
340      tabindex: "-1",
341      focusable: "false",
342    });
343
344
345
346  }, 1000);
347  $(".home-slide-content .post-link").each(function () {
348    $(this).removeAttr("role");
349  });
350
351  //Add focus to Search and Filter plugin
352  //add focusable to sf-field-category class elements
353  $(".sf-field-category").attr({
354    tabindex: 0,
355    "aria-label": "Category",
356  });
357
358  //add focusable to sf-field-taxonomy-programs class elements
359  $(".sf-field-taxonomy-programs").attr({
360    tabindex: 0,
361    "aria-label": "Filter by Programs",
362  });
363
364  // Modify h4 element to p
365  var textResourceType = $('.sf-field-category h4').text();
366  $('.sf-field-category h4').replaceWith("<p>" + textResourceType + "</p>");
367
368  var textProgramArea = $('.sf-field-taxonomy-programs h4').text();
369  $('.sf-field-taxonomy-programs h4').replaceWith("<p>" + textProgramArea + "</p>");
370
371  var textCountry = $('.sf-field-taxonomy-countries h4').text();
372  $('.sf-field-taxonomy-countries h4').replaceWith("<p>" + textCountry + "</p>");
373
374  // Add label in input email on newsletter
375  $('.et_bloom_popup_input.et_bloom_subscribe_email').prepend('<label for="email">E-mail:</label>');
376  $('.et_bloom_popup_input.et_bloom_subscribe_email input[placeholder="Email"]').attr('id', 'email');
377  $('.et_bloom_popup_input.et_bloom_subscribe_email input[placeholder="Email"]').attr('name', 'email');
378
379  //add focusable to sf-field-post-date class elements
380  $(".sf-field-post-date").attr({
381    tabindex: 0,
382    "aria-label": "Filter by Date",
383  });
384
385  //add focusable to sf-field-taxonomy-countries
386  $(".sf-field-taxonomy-countries").attr({
387    tabindex: 0,
388    "aria-label": "Filter by Countries",
389  });
390
391  //add focusable to filter-date filter-box class elements
392  $(".filter-date.filter-box").attr({
393    tabindex: 0,
394    "aria-label": "Filter by Date",
395  });
396
397  // Open Dropdown with enter key
398  $(".filter-date.filter-box, .filter-box.program-box, .filter-box.country-box").each(function () {
399    $(this).on("keypress", function (e) {
400      // Open dropdown
401      var enterKeyCode = 13;
402      var currentKeyPressCode = e.keyCode;
403      if (currentKeyPressCode === enterKeyCode) {
404        $(this).children('.active-filter').click();
405      }
406    })
407  })
408  $(".filter-date.filter-box, .filter-box.program-box, .filter-box.country-box").each(function () {
409    $(this).on("keydown", function (e) {
410      // Close dropdown after pressing esc
411      var escKeyCode = 27;
412      var currentKeyDownCode = e.keyCode;
413      if (currentKeyDownCode === escKeyCode && $(this).children('.active-filter').hasClass('active')) {
414        $(this).children('.active-filter').children('span.select-icon').click();
415      }
416    })
417  })
418  $('.list-filter-item').each(function () {
419    $(this).on("keypress", function (e) {
420      var activeFilter = $(this).parent().prev();
421      var currentTargetToClick = e.target;
422      var enterKeyCode = 13;
423      var currentKeyPressCode = e.keyCode;
424      if (currentKeyPressCode === enterKeyCode) {
425        currentTargetToClick.click();
426      }
427    })
428  })
429  $('.list-filter-item:last-child').each(function () {
430    $(this).on("focusout", function (event) {
431      var buttonCloseDropdown = $(this).parent().prev().children('span.select-icon');
432      buttonCloseDropdown.click();
433    })
434  })
435  $('.list-filter-item').attr({
436    tabindex: 0,
437  });
438
439  //add focusable to .filter-box.program-box class elements
440  $(".filter-box.program-box").attr({
441    tabindex: 0,
442    "aria-label": "Filter by Programs",
443  });
444
445  //add focusable to .filter-box.countries-box class elements
446  $(".filter-box.country-box").attr({
447    tabindex: 0,
448    "aria-label": "Filter by Countries",
449  });
450
451  $('.et-search-field').attr('id', 'search');
452  $('.et-search-form').prepend('<label class="accessibility-label-form" id="s" for="search">Search</label>');
453
454  // Accessibility Modal
455  $('.popmake').on("keydown", closeModalAfterPressEscKey)
456  $('.popmake-overlay').on("click", closeModalAfterClickInOverlay);
457
458  // Accessibility Time Line About Us
459  $('.about-slide').on('beforeChange', changeTimelineItemAfterChangeSlide);
460  $('.time-line-bar li[data-id]').each(function (e) {
461    $(this).attr("tabindex", 0);
462    $(this).on('keydown', navigateInTimeLineWithArrowLeftAndArrowRight);
463    $(this).on('keydown', modifyValueInTimeLineItemsAfterPressTabInLiItems);
464    $(this).on("focus", activeCurrentTimeLineAfterReceiveFocus)
465  });
466  // Accessibility Our Programs Dropdown
467  $('.drop-box').on("keydown", closeDropdownOurProgramsAfterPressEsc);
468  $('body').on("click", closeActivesDropdownsAfterClickInBodyElement);
469  $('.drop-item:last-child').on("focusout", function () {
470    $('.drop-down.active').each(function () {
471      $(this).children('.drop-icons').click();
472    })
473  })
474  if ($('.map-section').length) {
475    checkMapsSvgHasLoaded();
476  }
477  $('.et_pb_slider').on("keydown", addAccessibilityInEtPbSliderDiviBuilder);
478  $('#et_top_search').attr("name", "Search in website");
479  $('#et_top_search').attr("aria-label", "Search in website");
480
481  addTitleTextInSocialNetworkLinks();
482
483  $('#et_search_icon img').attr("alt", "Search Icon");
484
485  // Add tabindex in all childrens from dropdown
486  $('[data-sf-field-input-type="checkbox"] li, .sf-field-taxonomy-countries .select_all').attr("tabindex", 0);
487  // Remove default tabindex from inputs
488  $('[data-sf-field-input-type="checkbox"] li input').attr("tabindex", -1);
489  // Open dropdown with enter key
490  $('[data-sf-field-input-type="checkbox"]').on("keypress", openDropdownAfterPressEnterKey)
491  // Close dropdown with tab key
492  $('[data-sf-field-input-type="checkbox"]').on("keydown", closeDropdownAfterPressEscKey)
493  // Close dropdown after focusout last item
494  $('[data-sf-field-input-type="checkbox"] li:last-child').on("focusout", closeDropdownAfterFocusOutLastItem)
495  $('[data-sf-field-input-type="checkbox"] li, .select_all, .deselect_all')
496    .on("keypress", selectDropdownItemWithEnterKey)
497
498});
499function openDropdownAfterPressEnterKey(e) {
500  var enterKeyCode = 13;
501  var currentKeyCode = e.keyCode;
502  if (currentKeyCode === enterKeyCode) {
503    $('[data-sf-field-input-type="checkbox"].active').click();
504    $(this).click();
505  }
506}
507function closeDropdownAfterPressEscKey(e) {
508  var currentDropdownActive = $('[data-sf-field-input-type="checkbox"].active');
509  console.log(e);
510  var escKeyCode = 27;
511  var currentKeyCode = e.keyCode;
512  if (currentKeyCode === escKeyCode) {
513    currentDropdownActive.click();
514  }
515}
516function selectDropdownItemWithEnterKey(e) {
517  var enterKeyCode = 13;
518  var currentKeyCode = e.keyCode;
519  if (currentKeyCode === enterKeyCode) {
520    $(this).children('.sf-label-checkbox').click();
521    $(this).parent().parent().click();
522  }
523}
524function closeDropdownAfterFocusOutLastItem(e) {
525  var currentDropdownActive = $('[data-sf-field-input-type="checkbox"].active');
526  currentDropdownActive.click();
527}
528function addTitleTextInSocialNetworkLinks() {
529  $('a[href="https://facebook.com/clintonhealthaccess"]').attr("title", "Facebook");
530  $('a[href="https://www.youtube.com/user/ClintonHealth"]').attr("title", "Youtube");
531  $('a[href="https://linkedin.com/company/clinton-health-access-initiative"]').attr("title", "Linkedin");
532  $('a[href="https://twitter.com/CHAI_Health"]').attr("title", "Twitter");
533  $('a[href="https://www.instagram.com/chai_globalhealth/"]').attr("title", "Instagram");
534}
535function addAccessibilityInEtPbSliderDiviBuilder(e) {
536  var rightKeyCode = 39;
537  var leftKeyCode = 37;
538  var currentKeyCode = e.keyCode;
539  if (currentKeyCode === rightKeyCode) {
540    $('.et-pb-arrow-next').click();
541    $('.et-pb-active-slide').find('.et_pb_slide_title').find('a').focus();
542  }
543  if (currentKeyCode === leftKeyCode) {
544    $('.et-pb-arrow-prev').click();
545    $('.et-pb-active-slide').find('.et_pb_slide_title').find('a').focus();
546  }
547}
548function preventKeyBoardScroll(e) {
549  var keys = [32, 33, 34, 35, 37, 38, 39, 40];
550  if (keys.includes(e.keyCode)) {
551    e.preventDefault();
552    return false;
553  }
554}
555function closeModalAfterPressEscKey(e) {
556  var escKeyCode = 27;
557  var currentKeyDownCode = e.keyCode;
558  if (currentKeyDownCode === escKeyCode && $(this).hasClass('active')) {
559    $('.pum-close.popmake-close').click();
560  }
561}
562
563function closeModalAfterClickInOverlay(e) {
564  var currentTargetClicked = $(e.target);
565  var modalIsActive = $('.popmake').hasClass('active');
566  if (currentTargetClicked.hasClass('popmake-overlay')
567    && currentTargetClicked.hasClass('pum-active')
568    && modalIsActive) {
569    $('.pum-close.popmake-close').click();
570  }
571}
572
573function changeTimelineItemAfterChangeSlide(event, slick, currentSlide, nextSlide) {
574  addNegativeTabIndexValueInTimeLineItems();
575  $('.time-line-bar li[data-id="' + nextSlide + '"]').attr("tabindex", 0);
576  $('.time-line-bar li[data-id="' + nextSlide + '"]').click();
577}
578
579function navigateInTimeLineWithArrowLeftAndArrowRight(e) {
580  var quantitySlides = $('.time-line-bar li[data-id]').length;
581  var currentElement = $(e.target);
582  var currentId = currentElement.attr('data-id');
583  var keyCodeArrowRight = 39;
584  var keyCodeArrowLeft = 37;
585  var currentKeyCode = e.keyCode;
586  if (currentKeyCode === keyCodeArrowLeft) {
587    var previousDataId = Number(currentId) - 1;
588    if (previousDataId < 0) {
589      previousDataId = quantitySlides - 1;
590    }
591    var prevLiItem = $('[data-id="' + previousDataId + '"]');
592    prevLiItem.click();
593    prevLiItem.focus();
594  }
595  if (currentKeyCode === keyCodeArrowRight) {
596    var nextDataId = Number(currentId) + 1;
597    if (quantitySlides === nextDataId) {
598      nextDataId = 0;
599    }
600    var nextLiItem = $('[data-id="' + nextDataId + '"]');
601    nextLiItem.click();
602    nextLiItem.focus();
603  }
604}
605
606function addNegativeTabIndexValueInTimeLineItems() {
607  $('.time-line-bar li[data-id]').each(function () {
608    $(this).attr("tabindex", -1);
609  });
610}
611
612function addValueStandardInTabIndexValueOnTimeLineItems() {
613  $('.time-line-bar li[data-id]').each(function () {
614    $(this).attr("tabindex", 0);
615  });
616}
617
618function modifyValueInTimeLineItemsAfterPressTabInLiItems(e) {
619  var tabKeyCode = 9;
620  var currentKeyCode = e.keyCode;
621  if (currentKeyCode === tabKeyCode) {
622    addValueStandardInTabIndexValueOnTimeLineItems();
623  }
624}
625
626function activeCurrentTimeLineAfterReceiveFocus(e) {
627  var currentTarget = $(e.target);
628  if (!currentTarget.hasClass('active')) {
629    currentTarget.click();
630  }
631}
632
633function closeDropdownOurProgramsAfterPressEsc(e) {
634  var escKeyCode = 27;
635  var currentKeyDownCode = e.keyCode;
636  if (currentKeyDownCode === escKeyCode && $(this).find('.drop-down').hasClass('active')) {
637    $(this).find('.drop-down').find('.drop-icons').click();
638  }
639}
640
641function checkMapsSvgHasLoaded() {
642  var mapsSvgHasLoaded = false;
643  var intervalToCheckMapsSvgElementHasLoaded = setInterval(function () {
644    var mapsSvgCategoryItem = $('.mapsvg-category-item');
645    if (mapsSvgCategoryItem.length) {
646      mapsSvgHasLoaded = true;
647    }
648    if (mapsSvgHasLoaded) {
649      clearInterval(intervalToCheckMapsSvgElementHasLoaded);
650      $('.nano-content').removeAttr("tabindex")
651      $('.mapsvg-directory-item h5').each(function () {
652        $(this).replaceWith("<h2>" + $(this).html() + "</h2>");
653      })
654      $('[data-category-value]').each(function () {
655        $(this).attr("tabindex", 0);
656        $(this).on("keypress", function (e) {
657          var enterKeyCode = 13;
658          var currentKeyPressCode = e.keyCode;
659          if (currentKeyPressCode === enterKeyCode) {
660            $(this).click();
661            removeAllTabIndexFromMapSvgDirectoryItemDisabled();
662            addTabIndexFromMapSvgDirectoryItemEnabled();
663          }
664        })
665      });
666      addAccessibilityInMapSvgDirectoryItem();
667      return true;
668    }
669  }, 500);
670}
671
672
673function removeAllTabIndexFromMapSvgDirectoryItemDisabled() {
674  $('.mapsvg-category-block').each(function (e) {
675    $(this).children().each(function () {
676      $(this).attr("tabindex", -1);
677    })
678  });
679}
680
681function addTabIndexFromMapSvgDirectoryItemEnabled() {
682  $('.mapsvg-category-block').each(function (e) {
683    if ($(this).hasClass('active')) {
684      $(this).children().each(function () {
685        $(this).attr("tabindex", 0);
686      })
687    }
688  });
689}
690
691function addAccessibilityInMapSvgDirectoryItem() {
692  $('.mapsvg-directory-item').on("keypress", function (e) {
693    var enterKeyCode = 13;
694    var currentKeyPressCode = e.keyCode;
695    if (currentKeyPressCode === enterKeyCode) {
696      $(this).click();
697      $('.nano-content').attr("tabindex", -1);
698      removeTabIndexFromCategoryMapSvg();
699      removeAllTabIndexFromMapSvgDirectoryItemDisabled();
700      addTabIndexInAndAccessibilityPopoverClose();
701      addTabIndexInAndAccessibilityInButtonViewCountry();
702    }
703  })
704}
705
706function removeTabIndexFromCategoryMapSvg() {
707  $('[data-category-value]').each(function (e) {
708    $(this).attr("tabindex", -1);
709  })
710}
711
712function addTabIndexInAndAccessibilityPopoverClose() {
713  $('.mapsvg-popover-close.mapsvg-details-close').attr("tabindex", 0);
714  $('.mapsvg-popover-close.mapsvg-details-close').focus();
715  $('.mapsvg-popover-close.mapsvg-details-close').on("keypress", function (e) {
716    var enterKeyCode = 13;
717    var currentKeyPressCode = e.keyCode;
718    if (currentKeyPressCode === enterKeyCode) {
719      var currentCountrySelected = $('.mapsvg-directory-item.selected');
720      $(this).click();
721      currentCountrySelected.focus();
722      $('[data-category-value]').attr("tabindex", 0);
723      addTabIndexFromMapSvgDirectoryItemEnabled();
724    }
725  })
726  $('.mapsvg-popover-close.mapsvg-details-close').on("keydown", function (e) {
727    var escKeyCode = 27;
728    var currentKeyDownCode = e.keyCode;
729    if (currentKeyDownCode === escKeyCode) {
730      var currentCountrySelected = $('.mapsvg-directory-item.selected');
731      $(this).click();
732      currentCountrySelected.focus();
733      $('[data-category-value]').attr("tabindex", 0);
734      addTabIndexFromMapSvgDirectoryItemEnabled();
735    }
736  })
737}
738
739function addTabIndexInAndAccessibilityInButtonViewCountry() {
740  $('.button-download').attr("tabindex", 0);
741  $('.button-download').on("keypress", function (e) {
742    var enterKeyCode = 13;
743    var currentKeyPressCode = e.keyCode;
744    if (currentKeyPressCode === enterKeyCode) {
745      $(this).click();
746    }
747  })
748  $('.button-download').on("keydown", function (e) {
749    var escKeyCode = 27;
750    var currentKeyDownCode = e.keyCode;
751    if (currentKeyDownCode === escKeyCode) {
752      var currentCountrySelected = $('.mapsvg-directory-item.selected');
753      $('.mapsvg-popover-close.mapsvg-details-close').click();
754      currentCountrySelected.focus();
755      $('[data-category-value]').attr("tabindex", 0);
756      addTabIndexFromMapSvgDirectoryItemEnabled();
757    }
758  })
759}
760
761function closeActivesDropdownsAfterClickInBodyElement() {
762  $('.drop-down.active').each(function () {
763    if (document.activeElement.tagName === 'BODY') {
764      $(this).children('.drop-icons').click();
765    }
766  });
767}

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.