32013202function t_feed_highlightCodeBlocks(codeBlocks) {3203Array.prototype.forEach.call(codeBlocks, function (codeBlock) {3204window.hljs.highlightBlock(codeBlock);3205});3206}32073208// TODO: add only for snippet32093210function t_feed_PostInit() {3211window.onpopstate = function () {3212if (document.querySelector('.t-feed__post-popup')) return;
location.reload(); }; t_feed_initCodeHightlight();}function t_feed_drawPostPopupDate(opts, post, recid) { var style = opts.popup_opts.subtitleColor ? 'style="color:' + opts.popup_opts.subtitleColor + '"' : ''; var str = ''; if (typeof opts.popup_opts.showDate == 'undefined' || opts.popup_opts.showDate) { str += '<span class="t-feed__post-popup__date-wrapper">' + '<span class="js-feed-post-date t-feed__post-popup__date t-uptitle t-uptitle_sm" ' + style + '>' + t_feed_formateDate(post.date, opts, recid) + '</span>' + '</span>'; } return str;}function t_feed_drawPostPopupTitle(opts, post) { var style = opts.popup_opts.titleColor ? 'style="color:' + opts.popup_opts.titleColor + '"' : ''; var str = ''; if (post.title) { str += '<div class="t-feed__post-popup__title-wrapper">' + '<div class="js-feed-post-title t-feed__post-popup__title t-title t-title_xxs" ' + style + '>' + '' + post.title + '</div>' + '</div>'; } return str;}function t_feed_drawPostPopupText(opts, post, obj) { var style = opts.popup_opts.textColor ? 'style="color:' + opts.popup_opts.textColor + '"' : ''; var text = ''; if (post.text) { text = post.text; } else if (post.descr && typeof post.needGetPost == 'undefined') { text = post.descr; } else if (obj && obj.fields) { let textFields = []; const priorities = ['formated', 'ta', 'in']; priorities.forEach(type => { if (textFields.length) return; textFields = Object.keys(obj.fields).filter(fieldType => obj.fields[fieldType] === type && post[fieldType]); }); const fieldName = textFields[0]; if (fieldName) text = post[fieldName] || ''; } // Временно убираем var textFF = ''; // if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { // textFF = ' t-feed__post-popup__text_ff'; // } var str = ''; if (text || post.needGetPost) { str += '<div id="feed-text" class="t-feed__post-popup__text-wrapper" data-animationappear="off">' + '<div class="js-feed-post-text t-feed__post-popup__text t-text t-text_md' + textFF + '" ' + style + '>' + text + '</div>' + '</div>'; } return str;}/** * Draw author element if it is filled in admin panel * @param {object} opts – object with feed settings * @param {object} post – JSON with data for post * @returns */