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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-feed-1.0.js

Код файла
Версия от 24.08.2026, 07:03:11 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
4101 4102	var feedLinks = document.querySelectorAll('.t-feed__link');4103	if (!feedLinks) return;4104 4105	/* check if event focus from mouse or from keyboard */4106	var handlerType = null;4107	document.addEventListener('keydown', function () {4108		handlerType = 'keyboard';4109	});4110	document.addEventListener('mousedown', function () {4111		handlerType = 'mouse';4112
История файла и сравнение версий
  • 24.08.2026, 07:03:11 · 56c3b845
});
4113
4114 Array.prototype.forEach.call(feedLinks, function (link) {
4115 var post = link.closest('.t-feed__post');
4116
4117 link.addEventListener('focus', function () {
4118 if (handlerType === 'keyboard') {
4119 if (post) {
4120 post.classList.add('t-focusable');
4121 }
4122 handlerType = null;
4123 } else {
4124 return;
4125 }
4126 });
4127
4128 link.addEventListener('blur', function () {
4129 if (post) {
4130 post.classList.remove('t-focusable');
4131 }
4132 });
4133 });
4134}
4135
4136function t_feed_onFuncLoad(funcName, okFunc, time) {
4137 if (typeof window[funcName] === 'function') {
4138 okFunc();
4139 } else {
4140 setTimeout(function checkFuncExist() {
4141 if (typeof window[funcName] === 'function') {
4142 okFunc();
4143 return;
4144 }
4145 if (document.readyState === 'complete' && typeof window[funcName] !== 'function') {
4146 throw new Error(funcName + ' is undefined');
4147 }
4148 setTimeout(checkFuncExist, time || 100);
4149 });
4150 }
4151}
4152
4153function t_feed__trapFocus(popup) {
4154 var focusableEls = popup.querySelectorAll('a, button, input:not([type="hidden"]), select, textarea, video, iframe');
4155 var firstFocusableElement = focusableEls[0];
4156 var lastFocusableElement = focusableEls[focusableEls.length - 1];
4157
4158 document.addEventListener('keydown', function (event) {
4159 var isTabPressed = event.key === 'Tab' || event.keyCode === 9;
4160 if (!isTabPressed) {
4161 return;
4162 }
4163
4164 if (event.shiftKey) {
4165 // if tab+shift and we moving back
4166 if (document.activeElement === firstFocusableElement) {
4167 lastFocusableElement.focus();
4168 event.preventDefault();
4169 }
4170 } else if (document.activeElement === lastFocusableElement) {
4171 firstFocusableElement.focus();
4172 event.preventDefault();
4173 }
4174 });
4175}
4176
4177function t_feed__getRootZone() {
4178 const allrecords = document.getElementById('allrecords');
4179 const rootZone = allrecords && allrecords.getAttribute('data-tilda-root-zone');
4180 return rootZone || 'com';
4181}
4182
4183// Polyfill: Element.matches
4184if (!Element.prototype.matches) {
4185 Element.prototype.matches =
4186 Element.prototype.matchesSelector ||
4187 Element.prototype.msMatchesSelector ||
4188 Element.prototype.mozMatchesSelector ||
4189 Element.prototype.webkitMatchesSelector ||
4190 Element.prototype.oMatchesSelector;
4191}
4192
4193// Polyfill: Element.closest
4194if (!Element.prototype.closest) {
4195 Element.prototype.closest = function (s) {
4196 var el = this;
4197 while (el && el.nodeType === 1) {
4198 if (Element.prototype.matches.call(el, s)) {
4199 return el;
4200 }
Предыдущие 100 строкСледующие 100 строк