1// JavaScript Document 2 3(function($) { 4 5 "use strict"; 6 7 var fullHeight = function() { 8 9 $('.js-fullheight').css('height', $(window).height()); 10 $(window).resize(function(){ 11 $('.js-fullheight').css('height', $(window).height()); 12 }); 13 14 }; 15 fullHeight(); 16 17 var carousel = function() { 18 var $owl = $('.featured-carousel'); 19 20 // Create a reusable function for numbering 21 var numberDots = function(el) { 22 $(el).find('.owl-dot span').each(function(index) { 23 $(this).addClass('visually-hidden'); 24 $(this).text(index + 1); 25 }); 26 }; 27 28 // 1. Listen for the event (for future refreshes/initializations) 29 $owl.on('initialized.owl.carousel refreshed.owl.carousel', function(e) { 30 numberDots(this); 31 }); 32 33 // 2. Initialize Owl Carousel 34 $owl.owlCarousel({ 35 loop: true, 36 autoplay: false, 37 margin: 30, 38 animateOut: 'fadeOut', 39 animateIn: 'fadeIn', 40 nav: true, 41 dots: true, 42 items: 1, 43 navText: ["<p><small>Prev</small><span class='ion-ios-arrow-round-back'></span></p>", "<p><small>Next</small><span class='ion-ios-arrow-round-forward'></span></p>"], 44 responsive: { 45 0: { items: 1 }, 46 600: { items: 1 }, 47 1000: { items: 1 } 48 } 49 }); 50 51 // Pause all media whenever the slide changes 52 $owl.on('change.owl.carousel', function() { 53 pauseAllMedia($owl); 54 }); 55 56 numberDots($owl); 57 }; 58 59 60 carousel(); 61 62})(jQuery); 63 64 65document.addEventListener('click', function (e) { 66 var btn = e.target.closest('.video-play-btn, .video-poster'); 67 if (btn) { 68 var wrapper = btn.closest('.featured-media-wrap--video'); 69 if (!wrapper) return; 70 var video = wrapper.querySelector('.featured-video'); 71 if (!video) return; 72 73 video.play().then(function () { 74 wrapper.classList.add('is-playing'); 75 }).catch(function (err) { 76 wrapper.classList.add('is-playing'); 77 console.warn('Video play error:', err); 78 }); 79 return; 80 } 81 82 var video = e.target.closest('.featured-video'); 83 if (video) { 84 var wrapper = video.closest('.featured-media-wrap--video'); 85 if (!wrapper || !wrapper.classList.contains('is-playing')) return; 86 87 video.pause(); 88 wrapper.classList.remove('is-playing'); 89 } 90}); 91 92// Helper: pause everything currently playing in the carousel 93function pauseAllMedia($owl) { 94 $owl[0].querySelectorAll('.featured-media-wrap--video').forEach(function(wrapper) { 95 96 // Local video 97 var video = wrapper.querySelector('video.featured-video'); 98 if (video) { 99 video.pause(); 100 wrapper.classList.remove('is-playing'); 101 } 102 103 // YouTube iframe 104 var iframe = wrapper.querySelector('iframe.featured-video'); 105 if (iframe) { 106 iframe.contentWindow.postMessage( 107 JSON.stringify({ event: 'command', func: 'pauseVideo', args: [] }), 108 '*' 109 ); 110 } 111 }); 112} 113
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.