Некодим логотипНекодим
МодификацииПубликацииНекодИИмЦены
Некодим логотипНекодим

© 2020-2026 Некодим

Готовые модификации для вашего сайта. Улучшайте функциональность и дизайн без программирования.

Компания

  • Контакты
  • Публичная оферта
  • Политика конфиденциальности
  • Согласие на обработку данных
  • Лицензионное соглашение
  • Реферальная программа

Полезное

  • Модификации
  • Публикации
  • Каталог блоков Tilda
  • MCP для агентов
  • Журнал изменений
  • Доска почёта

Личный кабинет

  • Вход
  • Регистрация
  • Цены
Журнал измененийИстория GitФайлыTilda MCP
Каталог файлов

tilda-feed-1.1.js

Код файла
Версия от 18.08.2026, 07:00:17 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
101			});102		}103	}104 105	window.onpopstate = function () {106		var body = document.body;107		body.classList.remove('t-zoomer__show');108		body.classList.remove('t-zoomer__show_fixed');109 110		if (window.history.state !== null) {111			var obj = window.history.state.obj;112			var post = window.history.state.post;
История файла и сравнение версий
  • 18.08.2026, 07:00:17 · 56c3b845
113
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);
116 }
117 };
118}
119
120/**
121 * Show posts from the current part
122 * @param {string} recid – recid of current block
123 * @param {object} opts – object with feed settings
124 * @param {number} slice – number of the current phase in pagination (before the "Show more" button)
125 */
126function 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');
138 }
139 });
140
141 window.tFeedPosts[recid]['switcher'] = true;
142 window.tFeedPosts[recid]['count'] = 0;
143
144 t_feed_loadPosts(recid, opts, slice, false);
145
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);
151 }
152}
153
154/**
155 * Scroll to the current feed on load or after closing the popup
156 * @param {HTMLElement} feeds – current feed
157 * @param {number} offsetTop – top coordinate of current feed
158 */
159function t_feed_scrollToFeed(feeds) {
160 if (!feeds) return;
161 var offset = feeds.getBoundingClientRect();
162 var offsetTop = offset.top + window.pageYOffset;
163
164 var top = offsetTop ? offsetTop - 100 : 0;
165
166 if ('scrollBehavior' in document.documentElement.style) {
167 window.scrollTo({
168 top: top,
169
170 behavior: 'smooth',
171 });
172 } else {
173 window.scrollTo(0, top);
174 }
175}
176
177/**
178 * Create a separate object for each news feed
179 */
180function 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;
188 }
189 });
190}
191
192/**
193 * Load posts – all or from current part
194 * @param {string} recid – recid of current feed
195 * @param {object} opts – object with all settings
196 * @param {number} slice – number of step in "pagination" after clickin on the "Show more" button
197 * @param {boolean} showmore – boolean to understand that posts are loaded after clicking on the "Show more" button
198 * @param {Function} callback – function for load posts from current part
199 */
200function t_feed_loadPosts(recid, opts, slice, showmore, callback) {
Предыдущие 100 строкСледующие 100 строк