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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-feed-1.0.js

Код файла
Версия от 24.08.2026, 07:03:11 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
3001	var bulletWidth = isGallery ? opts.gallery.dotsWidth : '8px';3002	bulletWidth = parseInt(bulletWidth);3003	if (bulletWidth > 20) {3004		bulletWidth = 20;3005	}3006	var activeBulletClass = '';3007	var dotsActiveBg = isGallery ? opts.gallery.dotsActiveBg : '';3008	dotsActiveBg = dotsActiveBg !== '' ? dotsActiveBg : '#222222';3009	var dotsBg = isGallery ? opts.gallery.dotsBg : '';3010	var dotsBorderSize = isGallery ? opts.gallery.dotsBorderSize : '';3011	var dotsStyle = '';3012
История файла и сравнение версий
  • 24.08.2026, 07:03:11 · 56c3b845
3013 dotsStyle += bulletWidth !== '' && !isNaN(bulletWidth) ? 'width:' + bulletWidth + 'px;height:' + bulletWidth + 'px;' : '';
3014 dotsStyle += dotsBg !== '' ? 'background-color:' + dotsBg + ';' : '';
3015 dotsStyle += dotsBorderSize !== '' ? 'border:' + dotsBorderSize + ' solid ' + dotsActiveBg + ';' : '';
3016
3017 var str = '';
3018 str += '<ul class="t-slds__bullet_wrapper">';
3019 galleryItems.forEach(function (item, i) {
3020 if (item.length != 1) {
3021 activeBulletClass = i == 0 ? ' t-slds__bullet_active' : '';
3022 str +=
3023 '<li class="t-slds__bullet' +
3024 activeBulletClass +
3025 '" data-slide-bullet-for="' +
3026 (i + 1) +
3027 '">' +
3028 '<button type="button" class="t-slds__bullet_body" aria-label="' +
3029 t_feed_getDictionary('bulletlabel', recid) +
3030 ' ' +
3031 (i + 1) +
3032 '" style="' +
3033 dotsStyle +
3034 '"></button>' +
3035 '</li>';
3036 }
3037 });
3038 str += '</ul>';
3039 return str;
3040}
3041
3042function t_feed_setGalleryImageHeight(recid) {
3043 var rec = document.querySelector('#rec' + recid);
3044 var images = rec.querySelectorAll('.t-feed__post-popup__slider-separator');
3045 Array.prototype.forEach.call(images, function (image) {
3046 var width = image.getAttribute('data-slider-image-width');
3047 var height = image.getAttribute('data-slider-image-height');
3048 var ratio = height / width;
3049 var padding = ratio * 100;
3050 image.style.paddingBottom = padding + '%';
3051 });
3052}
3053
3054function t_feed_initCodeHightlight() {
3055 var post = document.querySelector('.js-feed-post-text');
3056 if (!post) return;
3057 var codeBlocks = post.querySelectorAll('.t-redactor__highlightcode code');
3058 if (!codeBlocks.length) return;
3059
3060 if (typeof window.hljs !== 'undefined') {
3061 t_feed_highlightCodeBlocks(codeBlocks);
3062 } else {
3063 t_feed_loadCodeHighlight(function () {
3064 t_feed_highlightCodeBlocks(codeBlocks);
3065 });
3066 }
3067}
3068
3069function t_feed_loadCodeHighlight(callback) {
3070 var script = document.createElement('script');
3071 var style = document.createElement('link');
3072
3073 style.href = 'https://static.tildacdn.' + t_feed__getRootZone() + '/css/highlight.min.css';
3074 script.src = 'https://static.tildacdn.' + t_feed__getRootZone() + '/js/highlight.min.js';
3075
3076 style.type = 'text/css';
3077 style.rel = 'stylesheet';
3078
3079 if (callback) {
3080 script.onload = callback;
3081 }
3082
3083 document.head.appendChild(script);
3084 document.head.appendChild(style);
3085}
3086
3087function t_feed_highlightCodeBlocks(codeBlocks) {
3088 Array.prototype.forEach.call(codeBlocks, function (codeBlock) {
3089 window.hljs.highlightBlock(codeBlock);
3090 });
3091}
3092
3093// TODO: add only for snippet
3094
3095function t_feed_PostInit() {
3096 window.onpopstate = function () {
3097 if (window.location.pathname.indexOf('/tpost/') > -1) return;
3098
3099 location.reload();
3100 };
Предыдущие 100 строкСледующие 100 строк