1(function ($) { 2 "use strict"; 3 4 function initItineraryHighlights($root) { 5 var $btns = $root.find("[data-itinerary-day]"); 6 var $panels = $root.find("[data-itinerary-panel]"); 7 8 // Only init day switching when there are 2+ days (day selector is hidden when single day) 9 if (!$btns.length || $btns.length < 2 || !$panels.length) { 10 return; 11 } 12 13 $btns.on("click", function () { 14 var $btn = $(this); 15 var dayIndex = $btn.attr("data-itinerary-day"); 16 var dayTitleText = $btn.attr("data-day-title-text"); 17 18 $btns 19 .removeClass("is-active") 20 .attr("aria-selected", "false") 21 .attr("tabindex", "-1"); 22 $btn 23 .addClass("is-active") 24 .attr("aria-selected", "true") 25 .attr("tabindex", "0"); 26 27 // Update day title if it exists 28 var $dayTitle = $root.find(".itinerary-highlights__day-title"); 29 if ($dayTitle.length && dayTitleText) { 30 $dayTitle.text(dayTitleText); 31 $dayTitle.attr("data-day-title", dayIndex); 32 } 33 34 $panels.removeClass("is-active").attr("hidden", true); 35 $root 36 .find('[data-itinerary-panel="' + dayIndex + '"]') 37 .addClass("is-active") 38 .removeAttr("hidden"); 39 }); 40 } 41 42 $(function () { 43 $("[data-itinerary-highlights]").each(function () { 44 initItineraryHighlights($(this)); 45 }); 46 }); 47})(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.