1(function ($) { 2 "use strict"; 3 Drupal.behaviors.carousel = { 4 attach: function (context, settings) { 5 let ncCarousels = $("[id^='nc-carousel-']"); 6 7 $(once("carouselload", ncCarousels)).each(function () { 8 let carouselid = "#" + $(this).attr("id"); 9 let ncCarousel = document.querySelector(carouselid); 10 let interval = 11 $(this).attr("id") != "alerts" 12 ? $(this).attr("data-bs-interval") 13 : "false"; 14 let carousel = new bootstrap.Carousel(ncCarousel); 15 carousel.cycle(); 16 17 // if autoplay is disabled, switch buttons 18 if (interval == "false") { 19 $(this).find(".carousel-play").show(); 20 $(this).find(".carousel-pause").hide(); 21 } 22 23 $(this).find(".carousel-play").on("keydown", (e) => { 24 if (e.key === "Enter" || e.key === " ") { 25 e.preventDefault(); 26 $(this).find(".carousel-play").trigger("click"); 27 setTimeout(() => { 28 $(this).find(".carousel-pause").focus(); 29 }, 0); 30 } 31 }); 32 33 $(this).find(".carousel-pause").on('keydown', (e) => { 34 if (e.key === "Enter" || e.key === " ") { 35 e.preventDefault(); 36 $(this).find(".carousel-pause").trigger("click"); 37 setTimeout(() => { 38 $(this).find(".carousel-play").focus(); 39 }, 0) 40 } 41 }) 42 43 // pause button 44 $(this) 45 .find(".carousel-pause") 46 .on("click", () => { 47 $(this).find(".carousel-play").show(); 48 $(this).find(".carousel-pause").hide(); 49 carousel.pause(); 50 }); 51 52 // play button 53 $(this) 54 .find(".carousel-play") 55 .on("click", () => { 56 $(this).find(".carousel-play").hide(); 57 $(this).find(".carousel-pause").show(); 58 // resets carousel to play if carousel autoplay was set to disabled 59 if (interval == "false") { 60 carousel = new bootstrap.Carousel(ncCarousel, { 61 ride: "carousel", 62 interval: 3000, 63 }); 64 } 65 carousel.cycle(); 66 }); 67 }); 68 }, 69 }; 70})(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.