PageSourceSearch

https://tedco.ai/cdn/shop/t/8/assets/ted-parent-testimonials-carousel.js?v=105918895169630336471787844262

js tedco.ai collected 2026-10-05 12:43:20 UTC 5,596 bytes, 2 lines download raw bytes

1(function(){"use strict";function getLocale(){var html=document.documentElement;return(html.lang||html.getAttribute("lang")||"en").slice(0,2).toLowerCase()}function escapeHtml(str){return String(str).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function childLabel(review,locale){return locale==="fr"?review.child+", "+review.age+" ans":review.child+", "+review.age+" years old"}function renderCard(review,locale){var comment=locale==="fr"?review.comment_fr:review.comment_en;return comment?'<div class="ted-parent-testimonials__card ted-parent-testimonials__card--featured"><blockquote class="ted-parent-testimonials__quote-wrap"><span class="ted-parent-testimonials__quote-mark" aria-hidden="true">\u201C</span><p class="ted-parent-testimonials__quote">'+escapeHtml(comment)+'</p></blockquote><footer class="ted-parent-testimonials__footer"><div class="ted-parent-testimonials__author"><p class="ted-parent-testimonials__name">'+escapeHtml(review.parent)+'</p><p class="ted-parent-testimonials__detail">'+escapeHtml(childLabel(review,locale))+"</p></div></footer></div>":""}function getViewport(track){return track.querySelector("[data-ted-testimonials-scroll]")}function getStep(track){var card=track.querySelector(".ted-parent-testimonials__card"),carousel=track.querySelector("[data-ted-testimonials-carousel]");if(!card)return 320;var cardStyle=getComputedStyle(card),margin=parseFloat(cardStyle.marginRight)||0,gap=carousel&&parseFloat(getComputedStyle(carousel).gap)||0;return card.offsetWidth+Math.max(margin,gap)}function getMaxScroll(viewport){return viewport?Math.max(0,viewport.scrollWidth-viewport.clientWidth):0}function updateButtons(track,viewport){var prevBtn=track.querySelector("[data-ted-testimonials-prev]"),nextBtn=track.querySelector("[data-ted-testimonials-next]"),maxScroll=getMaxScroll(viewport),offset=viewport?viewport.scrollLeft:0;prevBtn&&(prevBtn.disabled=offset<=1),nextBtn&&(nextBtn.disabled=offset>=maxScroll-1)}function prefersReducedMotion(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}function initAutoScroll(track,viewport){var carousel=track.querySelector("[data-ted-testimonials-carousel]");if(!carousel||prefersReducedMotion())return null;var originalHTML=carousel.innerHTML,loopWidth=0,speed=.35,scrollAccumulator=0,isHovered=!1,userInterrupted=!1,rafId=null,running=!1;function normalizeScrollPosition(){loopWidth<=0||viewport.scrollLeft>=loopWidth&&(viewport.scrollLeft-=loopWidth)}function tick(){if(running&&!userInterrupted&&!isHovered&&(scrollAccumulator+=speed,scrollAccumulator>=1)){var step=Math.floor(scrollAccumulator);scrollAccumulator-=step,normalizeScrollPosition(),viewport.scrollLeft+=step,normalizeScrollPosition(),updateButtons(track,viewport)}rafId=window.requestAnimationFrame(tick)}function start(){running||(running=!0,rafId||(rafId=window.requestAnimationFrame(tick)))}function prepareLoop(){return carousel.innerHTML=originalHTML+originalHTML,loopWidth=carousel.scrollWidth/2,getMaxScroll(viewport)>0&&loopWidth>0}function boot(){return prepareLoop()?(start(),!0):!1}track.addEventListener("mouseenter",function(){isHovered=!0}),track.addEventListener("mouseleave",function(){isHovered=!1});var touchStartX=0,touchStartY=0;return viewport.addEventListener("touchstart",function(event){event.touches.length&&(touchStartX=event.touches[0].clientX,touchStartY=event.touches[0].clientY)},{passive:!0}),viewport.addEventListener("touchmove",function(event){if(!(!event.touches.length||userInterrupted)){var deltaX=Math.abs(event.touches[0].clientX-touchStartX),deltaY=Math.abs(event.touches[0].clientY-touchStartY);deltaX>8&&deltaX>deltaY&&(userInterrupted=!0)}},{passive:!0}),viewport.addEventListener("scroll",function(){updateButtons(track,viewport)},{passive:!0}),window.addEventListener("resize",function(){loopWidth=carousel.scrollWidth/2,normalizeScrollPosition(),updateButtons(track,viewport)}),boot()||window.requestAnimationFrame(function(){window.requestAnimationFrame(function(){boot()})}),function(){running=!1,rafId&&window.cancelAnimationFrame(rafId)}}function initTrack(track){var viewport=getViewport(track),prevBtn=track.querySelector("[data-ted-testimonials-prev]"),nextBtn=track.querySelector("[data-ted-testimonials-next]");
1if(!(!viewport||!prevBtn||!nextBtn)){var scrollByStep=function(direction){viewport.scrollBy({left:getStep(track)*direction,behavior:"smooth"})};prevBtn.addEventListener("click",function(event){event.preventDefault(),scrollByStep(-1)}),nextBtn.addEventListener("click",function(event){event.preventDefault(),scrollByStep(1)}),window.addEventListener("resize",function(){updateButtons(track,viewport)}),updateButtons(track,viewport),initAutoScroll(track,viewport)}}function loadReviews(track){var carousel=track.querySelector("[data-ted-testimonials-carousel]"),dataEl=document.querySelector("[data-ted-reviews-data]");if(!(!carousel||!dataEl)){var url=dataEl.getAttribute("data-ted-reviews-data"),locale=getLocale();fetch(url).then(function(res){return res.json()}).then(function(data){var reviews=data.reviews||[];if(!reviews.length){carousel.innerHTML="";return}carousel.innerHTML=reviews.map(function(review){return renderCard(review,locale)}).join(""),initTrack(track)}).catch(function(){carousel.innerHTML=""})}}function init(){document.querySelectorAll("[data-ted-testimonials-track]").forEach(loadReviews)}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",init):init()})();
2//# sourceMappingURL=/cdn/shop/t/8/assets/ted-parent-testimonials-carousel.js.map?v=105918895169630336471787844262

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.