1(function ($) { 2 $(function () { 3 var direction = ""; 4 var route = ""; 5 var $planYourTrip = $(".plan-your-trip"); 6 7 $("#train-direction").change(function () { 8 direction = $(this).val(); 9 10 $("#train-route-northbound, #train-route-southbound").val("select"); 11 $("#northbound-heading, #southbound-heading, .route-heading, .schedule-grid").hide(); 12 $("#train-route-northbound, #train-route-southbound, #pdf-schedule-link, #legend").hide(); 13 $("#train-route-" + direction).show(); 14 }); 15 16 $("#train-route-southbound").change(function () { 17 route = $(this).val(); 18 19 if ($planYourTrip.is(":visible")) { 20 $planYourTrip.slideToggle(); 21 } 22 23 $(".route-heading, .schedule-grid").hide(); 24 25 switch (route) { 26 case "select": 27 $("#southbound-heading, #pdf-schedule-link, #legend").hide(); 28 break; 29 30 case "all-routes": 31 $(".southbound.route-heading, #southbound-heading").show(); 32 $(".schedule-grid.southbound").css("display", "grid"); 33 break; 34 35 default: 36 $("#southbound-heading, #" + route + "-heading, #pdf-schedule-link, #legend").show(); 37 $("#" + route).css("display", "grid"); 38 } 39 40 $("#pdf-schedule-link, #legend").show(); 41 }); 42 43 $("#train-route-northbound").change(function () { 44 route = $(this).val(); 45 46 if ($planYourTrip.is(":visible")) { 47 $planYourTrip.slideToggle(); 48 } 49 50 $(".route-heading, .schedule-grid").hide(); 51 52 switch (route) { 53 case "select": 54 $("#northbound-heading, #pdf-schedule-link, #legend").hide(); 55 break; 56 57 case "all-routes": 58 $(".northbound.route-heading, #northbound-heading").show(); 59 $(".schedule-grid.northbound").css("display", "grid"); 60 break; 61 62 default: 63 $("#northbound-heading, #" + route + "-heading, #pdf-schedule-link, #legend").show(); 64 $("#" + route).css("display", "grid"); 65 } 66 67 $("#pdf-schedule-link, #legend").show(); 68 }); 69 70 function getSourceImages(gallery) { 71 return Array.from( 72 gallery.querySelectorAll(":scope > a > img") 73 ); 74 } 75 76 function getLightboxOuter(gallery) { 77 var galleryClass = gallery.getAttribute("data-lg-class"); 78 79 if (!galleryClass) { 80 return null; 81 } 82 83 var lightboxContainer = document.querySelector( 84 ".lg-container." + CSS.escape(galleryClass) 85 ); 86 87 if (!lightboxContainer) { 88 return null; 89 } 90 91 return lightboxContainer.querySelector(".lg-outer"); 92 } 93 94 function applyGalleryAltText(gallery) { 95 var sourceImages = getSourceImages(gallery); 96 var lightboxOuter = getLightboxOuter(gallery); 97 98 if (!sourceImages.length || !lightboxOuter) { 99 return; 100 } 101 102 lightboxOuter.querySelectorAll( 103 ".lg-object.lg-image[data-index]" 104 ).forEach(function (lightboxImage) { 105 var index = Number(lightboxImage.dataset.index); 106 var sourceImage = sourceImages[index]; 107 108 if (sourceImage) { 109 lightboxImage.setAttribute( 110 "alt", 111 sourceImage.getAttribute("alt") || "" 112 ); 113 } 114 }); 115 116 lightboxOuter.querySelectorAll( 117 ".lg-thumb-item img[data-lg-item-id]" 118 ).forEach(function (thumbnailImage) { 119 var index = Number(thumbnailImage.dataset.lgItemId); 120 var sourceImage = sourceImages[index]; 121 122 if (sourceImage) { 123 thumbnailImage.setAttribute( 124 "alt", 125 sourceImage.getAttribute("alt") || "" 126 ); 127 } else { 128 thumbnailImage.setAttribute("alt", ""); 129 } 130 }); 131 } 132 133 function applyGalleryAltTextSoon(gallery) { 134 window.setTimeout(function () { 135 applyGalleryAltText(gallery); 136 }, 25); 137 138 window.setTimeout(function () { 139 applyGalleryAltText(gallery); 140 }, 100); 141 142 window.setTimeout(function () { 143 applyGalleryAltText(gallery); 144 }, 250); 145 } 146 147 function observeGallery(gallery) { 148 var observer = new MutationObserver(function () { 149 applyGalleryAltTextSoon(gallery); 150 }); 151 152 observer.observe(gallery, { 153 childList: true, 154 subtree: true 155 }); 156 157 applyGalleryAltTextSoon(gallery); 158 } 159 160 document.querySelectorAll( 161 ".ml-gallery-container[data-ml-gallery='true']" 162 ).forEach(function (gallery) { 163 observeGallery(gallery); 164 }); 165 }); 166})(jQuery);
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.