utils/prepare_html/index.js
// wrap iframes in div.videoWrapper to control size/aspect ratio
wrap iframes in div.videoWrapper to control size/aspect ratio
wrap iframes in div . videoWrapper to control size / aspect ratio
function iframe(state, child) {
    const url = child.getAttribute('src');
    if (url) {
        const { images, links } = state;
        const yt = youTubeId(url);
        if (yt && images && links) {
            links.add(yt.url);
            images.add('https://img.youtube.com/vi/' + yt.id + '/0.jpg');
        }
    }
    const { mutate } = state;
    if (!mutate) return;
    const tag = child.parentNode.tagName
        ? child.parentNode.tagName.toLowerCase()
        : child.parentNode.tagName;
    if (
        tag == 'div' &&
        child.parentNode.getAttribute('class') == 'videoWrapper'
    )
        return;
    const html = XMLSerializer.serializeToString(child);
    child.parentNode.replaceChild(
        DOMParser.parseFromString(`<div class="videoWrapper">${html}</div>`),
        child
    );
}
function iframe ( state , child ) { const url = child . getAttribute ( 'src' ) ; if ( url ) { const { images , links } = state ; const yt = youTubeId ( url ) ; if ( yt && images && links ) { links . add ( yt . url ) ; images . add ( 'https://img.youtube.com/vi/' + yt . id + '/0.jpg' ) ; } } const { mutate } = state ; if ( ! mutate ) return ; const tag = child . parentNode . tagName ? child . parentNode . tagName . toLowerCase ( ) : child . parentNode . tagName ; if ( tag == 'div' && child . parentNode . getAttribute ( 'class' ) == 'videoWrapper' ) return ; const html = XMLSerializer . serializeToString ( child ) ; child . parentNode . replaceChild ( DOMParser . parseFromString ( ` ${ html } ` ) , child ) ; }
wrap iframes in div.videoWrapper to control size/aspect ratio
wrap iframes in div . videoWrapper to control size / aspect ratio