/** * Generate layout for FD10* * @param {object} post – JSON with data for post * @param {object} opts – object with feed settings * @param {string} recid – recid of current block * @returns */function t_feed_drawRowType(post, opts, recid) { var rec = document.querySelector('#rec' + recid); var gridType = rec.querySelector('.js-feed').getAttribute('data-feed-grid-type'); var imageUrl = post.thumb ? post.thumb : post.image; var str = ''; if (gridType === 'side-panel') { str += '<div class="t-feed__row-grid__post-wrapper t-feed__row-grid__post-wrapper_panel">'; } else { var paddingClass = opts.separator.hideSeparator ? ' t-feed__row-grid__post-wrapper_padd-sm' : ''; str += '<div class="t-feed__row-grid__post-wrapper' + paddingClass + '">'; } if (post.mediatype === 'video' && post.image === '' && post.thumb === '') { imageUrl = 'https://static.tildacdn.' + t_feed__getRootZone() + '/ffb6456b-781b-40e8-9517-ffb5225e8bcd/imgfish.jpg'; } if ((post.thumb !== '' || post.image !== '' || post.mediatype === 'video') && opts.showImage) { var feedImageClass = 'js-feed-post-image t-feed__post-bgimg t-bgimg'; var isSquare = opts.imageHeight === opts.imageWidth; var imageHeightValue = opts.imageHeight; if (imageHeightValue && imageHeightValue.includes('vh') && rec.classList.contains('t-record_scaled')) { imageHeightValue = `calc(${imageHeightValue} / var(--t-zoom, 1))`; } var altText = ''; if (post.thumb !== '' && post.thumbalt !== '') { altText = post.thumbalt; } else if (post.thumb === '' && post.image !== '' && post.imagealt !== '') { altText = post.imagealt; } var alt = altText ? `role="img" aria-label="${altText}"` : ''; if (isSquare) feedImageClass += ' t-feed__post-bgimg_square'; str += ` <div class="t-feed__post-imgwrapper"> <div class="${feedImageClass}" data-original="${imageUrl}" ${alt} style="background-image:url(${t_feed_getLazyUrl(opts, imageUrl)}); width:${opts.imageWidth}; height:${imageHeightValue}" >${post.thumb ? `<meta itemprop="image" content="${imageUrl}"></meta>` : ''}${post.thumbalt ? `<meta itemprop="caption" content="${altText}"></meta>` : ''}</div> </div>`; } str += '<div class="t-feed__textwrapper">'; if ( (opts.showDate && opts.datePosPs == 'beforetitle') || (opts.showParts && post.postparts.length > 0 && opts.partsPosPs == 'beforetitle') ) { str += '' + t_feed_drawDateAndParts(opts, post, 'beforetitle', 'row', recid); } str += '' + t_feed_drawTitle(recid, opts, post, 'small', false); if ( (opts.showDate && opts.datePosPs == 'aftertitle') || (opts.showParts && post.postparts.length > 0 && opts.partsPosPs == 'aftertitle') ) { str += '' + t_feed_drawDateAndParts(opts, post, 'aftertitle', 'row', recid); } if (opts.showShortDescr) { str += '' + t_feed_drawDescr(opts, post, 'small'); } if ( (opts.showDate && opts.datePosPs == 'afterdescr') || (opts.showParts && post.postparts.length > 0 && opts.partsPosPs == 'afterdescr') ) { str += '' + t_feed_drawDateAndParts(opts, post, 'afterdescr', 'row', recid); } str += '</div>' + '</div>' + '</div>';