function liveblogNewBlockDump()

in ArticleTemplates/assets/js/bootstraps/liveblog.js [73:111]


function liveblogNewBlockDump() {
    const articleBody = document.getElementsByClassName('article__body')[0];
    const images = [];
    let blocks;
    let counter = 0;
    const insertAfterElem = document.getElementsByClassName('article__body--liveblog__pinned')[0];
    let newBlockElems;
    let i;

    if (newBlockHtml) {
        newBlockElems = getElemsFromHTML(newBlockHtml);

        for (i = newBlockElems.length; i > 0; i--) {
            addNewBlockToBlog(insertAfterElem, newBlockElems[i - 1]);
        }

        blocks = articleBody.getElementsByClassName('block');

        while (counter !== newBlockElems.length) {
            images.push(...blocks[counter].getElementsByTagName('img'));
            counter++;
        }

        formatImages(images);
        loadEmbeds();
        loadInteractives();

        // Move mpu ads
        if (window.updateLiveblogAdPlaceholders) {
            window.updateLiveblogAdPlaceholders(true);
        }

        window.liveblogTime();

        checkInjectedComponents(true);

        newBlockHtml = '';
    }
}