1(function($) { 2 $(function() { 3 $('.element.testimonial-element .element__content').each(function() { 4 const self = $(this); 5 var pageTimer = null; 6 var restartTimer = null; 7 const pageDelay = parseInt(self.attr('data-autoplay-delay')) * 1000; 8 const restartDelay = parseInt(self.attr('data-resume-delay')) * 1000; 9 10 const showNextPage = function (e) { 11 e.preventDefault(); 12 13 clearTimeout(pageTimer); 14 clearTimeout(restartTimer); 15 16 const button = self.find('.testimonials .next'); 17 if (button.length == 0) { 18 return; 19 } 20 21 self.children('.testimonials').load( 22 button.attr('href'), 23 function(response, status) { 24 if (status == 'success') { 25 restartTimer = setTimeout(restartListener, restartDelay); 26 } 27 } 28 ); 29 } 30 31 const showPrevPage = function(e) { 32 e.preventDefault(); 33 34 clearTimeout(pageTimer); 35 clearTimeout(restartTimer); 36 37 const button = self.find('.testimonials .prev'); 38 if (button.length == 0) { 39 return; 40 } 41 42 self.children('.testimonials').load( 43 button.attr('href'), 44 function(response, status) { 45 if (status == 'success') { 46 restartTimer = setTimeout(restartListener, restartDelay); 47 } 48 } 49 ); 50 } 51 52 const pageListener = function () { 53 const nextButton = self.find('.testimonials .next'); 54 if (nextButton.length == 0) { 55 return; 56 } 57 58 self.children('.testimonials').load( 59 nextButton.attr('href'), 60 function(response, status) { 61 if (status == 'success') { 62 pageTimer = setTimeout(pageListener, pageDelay); 63 } 64 } 65 ); 66 }; 67 68 const restartListener = function () { 69 pageTimer = setTimeout(pageListener, pageDelay); 70 }; 71 72 restartListener(); 73 74 75 $(document) 76 .on('click', '.element.testimonial-element .testimonials .next', showNextPage) 77 .on('click', '.element.testimonial-element .testimonials .prev', showPrevPage); 78 }); 79 }); 80})(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.