1(function ($, Drupal) { 2 3 'use strict'; 4 5 Drupal.behaviors.usgs_tabs = { 6 attach: function (context) { 7 context.addEventListener('ed11yShowHidden', e => { 8 let ID = (e.detail.result); 9 let active = context.getElementById('ed11y-result-' + ID); 10 let activeTab = $(active).parents('.usgs-tabs-content').attr('id'); 11 if (activeTab.length && $('.related-content-tabs-desktop a[href="#' + activeTab + '"]').length) { 12 $('.related-content-tabs-desktop a[href="#' + activeTab + '"]').trigger('click'); 13 } 14 }); 15 16 $(once('usgs-tabs-wrapper', 'div.usgs-tabs-wrapper', context)).each(function() { 17 $(this).tabs({ 18 activate: function(event ,ui){ 19 Drupal.attachBehaviors(this); 20 window.history.pushState(null,null, '#'+ ui.newPanel.attr('id')); 21 } 22 }); 23 }); 24 25 $(once('usgs-accordion-wrapper', '.mobile-accordions .usa-accordion__button', context)).each(function () { 26 $(this).click(function(e) { 27 window.history.pushState(null,null, '#'+ $(this).attr('data-control')); 28 if ($('.masonry-layout-related-media-tabs').length && $(this).attr('aria-controls') === 'related-content-multimedia') { 29 setTimeout(function() { 30 $('.masonry-layout-related-media-tabs').masonry(); 31 }, 100); 32 } 33 34 if ($(e.target).hasClass('active')) { 35 $(this).removeClass('active'); 36 } else { 37 // Add class 38 $(this).addClass('active'); 39 } 40 $(".related-info.mobile-accordions .usa-accordion__button").not($(this)).removeClass('active'); 41 }); 42 }); 43 44 $(once('usgs-accordion-more', '.related-content-tabs-mobile .more-link a', context)).each(function () { 45 $(this).click(function(e) { 46 var hash = $(this).attr('href').split('#'); 47 if(hash.length >= 1) { 48 $('.mobile-accordions .usa-accordion__button[data-control="' + hash[1] + '"]').trigger('click'); 49 } 50 }); 51 }); 52 } 53 }; 54 55 // For Volcano VONAs accordion 56 $('.vona-toggle').click(function(event){ 57 event.preventDefault(); 58 $(this).siblings('.vona-details').slideToggle(); 59 }); 60 61 // Overview tab anchor links on desktop 62 window.addEventListener("popstate", function(e) { 63 64 // So we can trigger the hash link on Overview tab desktop 65 if ($('.usgs-tabs').length != 0) { 66 $('.related-content-tabs-desktop a[href="' + location.hash + '"]').trigger('click'); 67 } 68 });
69 // Trigger hash on mobile 70 if (window.location.hash.length > 0 && window.innerWidth < 1024) { 71 if ($('.related-content-tabs-mobile').length) { 72 let urlParam = window.location.hash.replace('#',''); 73 $('.mobile-accordions .usa-accordion__button[data-control="' + urlParam + '"]').attr("aria-expanded", "true").addClass('active'); 74 $('#' + urlParam).removeAttr("hidden"); 75 } 76 } 77 78})(jQuery, Drupal);
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.