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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-cover-1.0.js

Код файла
Версия от 18.08.2026, 07:00:17 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
101		'video-noloop': '',102		'video-nomute': '',103		'video-nocover': '',104		'bg-base64': '',105		'use-image-for-mobile-cover': '',106	};107 108	// iterating keys from created object and append to it current values109	for (var key in coverParams) {110		var elAttribute = el.getAttribute('data-content-' + key);111		if (elAttribute || key === 'use-image-for-mobile-cover') coverParams[key] = elAttribute;112
История файла и сравнение версий
  • 18.08.2026, 07:00:17 · 56c3b845
}
113
114 var recordBG = record ? record.getAttribute('data-bg-color') : '';
115 if (recordBG) coverParams['parent-bg'] = recordBG;
116
117 var videoFormats = ['mp4', 'webm', 'youtube', 'vimeo', 'rutube', 'kinescope', 'vkvideo'];
118
119 // if element has parameter nocover - switch off video url
120 if (coverParams['video-nocover'] === 'yes') {
121 videoFormats.forEach(function (videoFormat) {
122 coverParams['video-url-' + videoFormat] = '';
123 });
124 } else {
125 // force mute, if video placed inside cover
126 coverParams['video-nomute'] = '';
127 }
128
129 // checking if one of the video-url params keys has URL as its value
130 var isContainsVideo = videoFormats.some(function (videoFormat) {
131 return !!coverParams['video-url-' + videoFormat];
132 });
133
134 if ((window.t_cover__isMobile || 'ontouchend' in document) && isContainsVideo && !isLazy) {
135 el.style.backgroundImage = 'url("' + coverParams['cover-bg'] + '")';
136 }
137
138 // fix content height,
139 // need setTimeout for correct calculate elements height
140 setTimeout(function () {
141 t_cover__recalcContentHeight(id, false, 0);
142 t_cover__fixBgFixedNode(id);
143 }, 300);
144
145 if (coverLogo) {
146 coverLogo.onload = function () {
147 t_cover__recalcContentHeight(id, false, 500);
148 };
149 }
150
151 if (window.t_cover__isMobile || 'ontouchend' in document) {
152 if (screen?.orientation) {
153 screen.orientation.addEventListener('change', function () {
154 // need setTimeout to change height, after device rotating,
155 // otherwise height will be calculated at time, which orientationchange be triggered
156 t_cover__recalcContentHeight(id, true, 200);
157 });
158 } else {
159 window.addEventListener('orientationchange', function () {
160 // need setTimeout to change height, after device rotating,
161 // otherwise height will be calculated at time, which orientationchange be triggered
162 t_cover__recalcContentHeight(id, true, 200);
163 });
164 }
165 } else {
166 window.addEventListener('resize', function () {
167 t_cover__recalcContentHeight(id, false, 0);
168 });
169 }
170
171 t_cover__setListenerToArrow(id);
172 t_cover__setCoverParams(el, coverParams, isContainsVideo);
173
174 el.addEventListener('displayChanged', function () {
175 t_cover__recalcContentHeight(id, false, 0);
176 });
177}
178
179/**
180 * recalc content height
181 *
182 * @param {string} id
183 * @param {Boolean} isOrientationChange
184 * @param {number} timeout
185 */
186function t_cover__recalcContentHeight(id, isOrientationChange, timeout) {
187 if (timeout) {
188 setTimeout(function () {
189 t_cover__fixBgFixedStyles(id);
190 t_cover__recalcCoverHeight(id, isOrientationChange);
191 }, timeout);
192 } else {
193 t_cover__fixBgFixedStyles(id);
194 t_cover__recalcCoverHeight(id, isOrientationChange);
195 }
196}
197
198/**
199 * append to current cover some styles/element,
200 * depending on type of parallax, contains video url etc.
Предыдущие 100 строкСледующие 100 строк