in static/src/javascripts/projects/common/modules/video/video-container.js [69:135]
INIT: function init(previousState) {
const makeYouTubeNonPlayableAtSmallBreakpoint = state => {
if (
isBreakpoint({
max: 'desktop',
}) && !isVerticalVideo(state.container)
) {
const youTubeIframes = Array.from(
state.container.querySelectorAll(
'.youtube-media-atom iframe'
)
);
youTubeIframes.forEach(el => {
el.remove();
});
const overlayLinks = Array.from(
state.container.querySelectorAll(
'.video-container-overlay-link'
)
);
overlayLinks.forEach(el => {
el.classList.add('u-faux-block-link__overlay');
// make visible to screen readers / keyboard users
el.removeAttribute('tabindex');
el.removeAttribute('aria-hidden');
});
const atomWrapper = Array.from(
state.container.querySelectorAll('.youtube-media-atom')
);
atomWrapper.forEach(el => {
el.classList.add('no-player');
});
}
};
makeYouTubeNonPlayableAtSmallBreakpoint(previousState);
fastdom.measure(() => {
// Lazy load images on scroll for mobile
$('.js-video-playlist-image', previousState.container).each(el => {
const inview = elementInView(
el,
$('.js-video-playlist-inner', previousState.container).get(
0
),
{
// This loads 1 image in the future
left: 410,
}
);
inview.on('firstview', elem => {
fastdom.mutate(() => {
const dataSrc = elem.getAttribute('data-src');
const src = elem.getAttribute('src');
if (dataSrc && !src) {
fastdom.mutate(() => {
elem.setAttribute('src', dataSrc);
});
}
});
});
});
});
return previousState;
},