1import { $ } from "./jquery-6e7e3758.js"; 2import { P as Plyr } from "./plyr.min-fe23a1f4.js"; 3const slideshow = ($component) => { 4 const autoPlaySpeed = Math.round($component.data("slideshow-auto-play-speed") * 1e3); 5 const $slides = $(".slides", $component); 6 const $slides_mobile = $(".slides-mobile", $component); 7 const is_iOs = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform); 8 const is_small_iOs = !!navigator.platform && /iPhone|iPod/.test(navigator.platform); 9 const videoSlides = $slides.find(".slide [data-video-id]"); 10 let timeoutId = 0; 11 function init(ev, slick) { 12 if (slick.$dots) { 13 const $items = slick.$dots.find("li"); 14 if ($items.length > 0) { 15 $items.addClass("on-desktop"); 16 } 17 } 18 if ($(".slide", $component).length > 1) { 19 setTimeout(() => beforeChange(ev, slick, -1, 0), 100); 20 } 21 } 22 function beforeChange(ev, slick, curr, next) { 23 if (curr == next) 24 return; 25 const $curr = slick.$prev = $(slick.$slides[curr]); 26 const $next = $(slick.$slides[next]); 27 clearTimeout(timeoutId); 28 let $video = $curr.children("video").get(0); 29 if ($video) { 30 $video.pause(); 31 } 32 $video = $next.children("video").get(0); 33 if ($video) { 34 $video.play(); 35 } else 36 timeoutId = setTimeout(() => $slides.slick("next"), autoPlaySpeed); 37 } 38 function afterChange(ev, slick) { 39 const $video = slick.$prev ? slick.$prev.children("video").get(0) : null; 40 if ($video) { 41 $video.currentTime = 0; 42 } 43 } 44 if (videoSlides.length > 0) { 45 videoSlides.each((index, item) => { 46 const id = $(item).data("video-id"); 47 const $item = $(item); 48 const $slide = $item.parent(".slide"); 49 new Plyr("#video_" + id, { 50 autoplay: true, 51 muted: true, 52 hideControls: true 53 }); 54 let $video = $slide.find("video"); 55 $video.on("ended", function() { 56 $slides.slick("next"); 57 }); 58 if (is_iOs && !is_small_iOs) { 59 $("body").on("click touchstart", () => { 60 if (!item.playing) { 61 item.play(); 62 } 63 }); 64 } 65 }); 66 } 67 if (is_iOs) { 68 Object.defineProperty(HTMLMediaElement.prototype, "playing", { 69 get: function() { 70 return !!(this.currentTime > 0 && !this.paused && !this.ended && this.readyState > 2); 71 } 72 }); 73 } 74 const slickSettings = { 75 arrows: true, 76 autoplay: false, 77 autoplaySpeed: 0, 78 dots: false, 79 adaptiveHeight: false, 80 prevArrow: "", 81 nextArrow: "", 82 useCSS: false, 83 rows: 0 84 }; 85 if ($slides_mobile.length > 0) { 86 slickSettings.asNavFor = ".slides-mobile"; 87 } 88 $slides.on("init", init).on("beforeChange", beforeChange).on("afterChange", afterChange).slick(slickSettings).show(); 89 if ($slides_mobile.length > 0) { 90 $slides_mobile.slick({ 91 arrows: false, 92 dots: true, 93 autoplay: false, 94 autoplaySpeed: 0, 95 adaptiveHeight: false, 96 useCSS: false, 97 rows: 0, 98 asNavFor: ".slides", 99 focusOnSelect: true 100 }).show(); 101 } 102 const $navigation = $("ul.slick-dots", $component); 103 $navigation.append('<li class="on-desktop"><button aria-label="play - pause button" class="play playing" type="button"></button></li>'); 104 const $playBtn = $navigation.find("li button.play"); 105 $navigation.find("li button.play").on(`click`, () => { 106 if (timeoutId == -1) { 107 $slides.slick("next"); 108 $playBtn.removeClass("pause"); 109 $playBtn.addClass("playing"); 110 } else { 111 clearTimeout(timeoutId); 112 timeoutId = -1; 113 $playBtn.removeClass("playing"); 114 $playBtn.addClass("pause"); 115 } 116 }); 117 for (let el of document.getElementsByClassName("slideshow-btn-prev")) { 118 el.addEventListener("click", () => $slides.slick("prev")); 119 } 120 for (let el of document.getElementsByClassName("slideshow-btn-next")) { 121 el.addEventListener("click", () => $slides.slick("next")); 122 } 123}; 124export { 125 slideshow as default 126};
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.