const blogpostsUrl = "/blog/posts.json"; function bindImageView (id, url) { document.getElementById(id).onclick = () => { const imageModal = new bootstrap.Modal(document.getElementById('imageModal'), {}); imageModal.show(); document.getElementById('image-viewer-url').src = url; }; } function testBlock () { return; // uncomment this at realese bindImageView('blog-img-0:0', 'https://warhammerart.com/wp-content/uploads/2021/08/Adeptus-Mechanicus.jpg'); bindImageView('blog-img-0:1', 'https://warzonestudio.com/image/catalog/blog/Admech-review/Admech-codex-review-02.jpg'); bindImageView('blog-img-0:2', 'https://i.pinimg.com/originals/7a/5c/0a/7a5c0a3a91db6011a49781c4016124a2.jpg'); } function dateFormater (value, isMonth = false) { if (isMonth) { return [ "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" ][+value]; } value = value.toString(); if (value.length === 1) value = '0' + value; return value; } function imagesDisplay (item, index) { const items = item.attachments.images.map((imageUrl, imageId) => { setTimeout(() => bindImageView(`blog-img-${index}:${imageId}`, imageUrl), 0); return `
${item.data.replace(/\n/g, "
")}
Во время работы произошла ошибка, повторите запрос позже