Некодим© 2020-2026 Некодим
Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.
t_feed_workPostPopup(recid, obj, post, post.uid, opts);
114 } else if (body.classList.contains('t-body_popupshowed')) {115 t_feed_closePopup(recid, opts, window.location.href);121 * Show posts from the current part122 * @param {string} recid – recid of current block123 * @param {object} opts – object with feed settings124 * @param {number} slice – number of the current phase in pagination (before the "Show more" button)126 function t_feed_loadPartPosts(recid, opts, slice) {127 var rec = document.querySelector('#rec' + recid);128 var switchers = rec.querySelectorAll('.js-feed-parts-switcher');129 Array.prototype.forEach.call(switchers, function (switcher) {130 var hashArr = decodeURI(window.location.hash).split('/');131 var isPartTitle = switcher.getAttribute('data-feedpart-title') == hashArr[hashArr.length - 1];132 var isUid = switcher.closest('.js-feed').getAttribute('data-feed-uid') == hashArr[hashArr.length - 3];133 if (isPartTitle && isUid) {134 var feedpartuid = switcher.getAttribute('data-feedpart-uid');135 opts.feeduid = opts.feeduid.split('-')[0] + '-' + feedpartuid;136 rec.querySelector('.t-active').classList.remove('t-active');137 switcher.classList.add('t-active');141 window.tFeedPosts[recid]['switcher'] = true;142 window.tFeedPosts[recid]['count'] = 0;144 t_feed_loadPosts(recid, opts, slice, false);146 if (window.location.href.indexOf('#!/tfeeds') != -1) {147 var hashArr = decodeURI(window.location.hash).split('/');148 var uid = hashArr[hashArr.length - 3];149 var feeds = document.querySelector('.js-feed[data-feed-uid="' + uid + '"]');150 t_feed_scrollToFeed(feeds);155 * Scroll to the current feed on load or after closing the popup156 * @param {HTMLElement} feeds – current feed157 * @param {number} offsetTop – top coordinate of current feed159 function t_feed_scrollToFeed(feeds) {161 var offset = feeds.getBoundingClientRect();162 var offsetTop = offset.top + window.pageYOffset;164 var top = offsetTop ? offsetTop - 100 : 0;166 if ('scrollBehavior' in document.documentElement.style) {173 window.scrollTo(0, top);178 * Create a separate object for each news feed180 function t_feed_createObjWithPosts() {181 var feeds = document.querySelectorAll('.js-feed');182 Array.prototype.forEach.call(feeds, function (feed) {183 var id = feed.getAttribute('data-feed-recid');184 window.tFeedPosts[id] = {};185 if (typeof window.tFeedPosts[id] != 'undefined') {186 window.tFeedPosts[id]['count'] = 0;187 window.tFeedPosts[id]['switcher'] = false;193 * Load posts – all or from current part194 * @param {string} recid – recid of current feed195 * @param {object} opts – object with all settings196 * @param {number} slice – number of step in "pagination" after clickin on the "Show more" button197 * @param {boolean} showmore – boolean to understand that posts are loaded after clicking on the "Show more" button198 * @param {Function} callback – function for load posts from current part200 function t_feed_loadPosts(recid, opts, slice, showmore, callback) {