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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-t937-videoplaylist-1.0.js

Код файла
Версия от 18.08.2026, 07:00:16 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
201			playlistLink.insertAdjacentElement('beforeend', playlistNumber);202			playlistLink.insertAdjacentElement('beforeend', playlistTitle);203			playlistLink.insertAdjacentElement('beforeend', playlistTime);204			item.insertAdjacentElement('beforeend', playlistLink);205 206			item.addEventListener('mousemove', function (e) {207				var currentItem = e.target.closest('.t937__playlist-item');208				currentItem.style.backgroundColor = styles.linkBgColor.length ? styles.linkBgColor : '#F0F0F0';209			});210 211			item.addEventListener('mouseout', function (e) {
История файла и сравнение версий
  • 18.08.2026, 07:00:16 · 56c3b845
212
var currentItem = e.target.closest('.t937__playlist-item');
213 currentItem.style.backgroundColor = '';
214 });
215
216 videoCount++;
217 }
218 if (container) container.insertAdjacentElement('beforeend', item);
219 }
220}
221
222function t937_renderVideoFrame(data, activeVideoId, recid) {
223 var rec = document.getElementById('rec' + recid);
224 var frame;
225 var video;
226 var container = rec ? rec.querySelector('.t937__video') : null;
227 var height = container ? container.offsetWidth * 0.5625 : 0;
228 if (container) container.classList.remove('t937__video_empty');
229 var id;
230
231 /* check that data[activeVideoId] is video, not a section */
232 for (var i = activeVideoId - 1; i < data.length; i++) {
233 if (data[i].url) {
234 video = data[i];
235 t937_renderDescription(video, recid);
236 break;
237 }
238 }
239
240 var optionsIframe = {
241 height: height,
242 type: video ? video.type : '',
243 };
244
245 if (!data.length || !video || !video.type) {
246 if (container) container.classList.add('t937__video_empty');
247 frame = document.createElement('div');
248 frame.classList.add('t937__system-message');
249 frame.textContent = !data.length ? t937_translate('noData') : t937_translate('wrongFormat');
250 } else if (video.type === 'youtube') {
251 var regex = /youtu(?:.*\/v\/|.*v=|\.be\/)([A-Za-z0-9_-]{11})/;
252
253 id = video.url.match(regex);
254 if (id !== null) id = id[1];
255
256 optionsIframe.src = 'https://www.youtube.com/embed/' + id + '?rel=0&fmt=18&html5=1&enablejsapi=1';
257 frame = t937_createIframe(optionsIframe);
258 } else if (video.type === 'vimeo') {
259 var idMatch = /vimeo[^/]*\/(\d+)\/?(\w*)\/?/i.exec(video.url);
260 id = idMatch ? idMatch[1] : null;
261 var hash = idMatch ? '?h=' + idMatch[2] : null;
262 var timecodeMatch = /#t=(\d*h)?(\d*m)?\d*s$/i.exec(video.url);
263 var timecode = timecodeMatch ? '/' + timecodeMatch[0] : '';
264
265 if (!id) {
266 if (container) container.classList.add('t937__video_empty');
267 frame = document.createElement('div');
268 frame.classList.add('t937__system-message');
269 frame.textContent = t937_translate('wrongFormat');
270 } else {
271 optionsIframe.src = 'https://player.vimeo.com/video/' + id + hash + timecode;
272 frame = t937_createIframe(optionsIframe);
273 }
274 } else if (video.type === 'kinescope') {
275 var regExp = /kinescope\.io\/(?:embed\/|pl\/)?([a-zA-Z0-9-]+)/;
276 var match = video.url.match(regExp);
277 var videoId = match ? match[1] : false;
278
279 optionsIframe.src = 'https://kinescope.io/embed/' + videoId;
280 frame = t937_createIframe(optionsIframe);
281 } else if (video.type === 'rutube') {
282 var regExp = /(?:https?:\/\/)?(?:www\.)?(?:rutube\.ru\/(?:shorts|video|play\/embed|embed|video\/private)\/)([a-f0-9]{32})(?:\/\?p=([a-zA-Z0-9_-]+))?/;
283 var match = video.url.match(regExp);
284 var videoId = match ? match[1] : false;
285 var videoHash = match ? match[2] : false;
286
287 optionsIframe.src = 'https://rutube.ru/embed/' + videoId + (videoHash ? '?p=' + videoHash : '');
288 frame = t937_createIframe(optionsIframe);
289 } else if (video.type === 'vkvideo') {
290 var regExp = /(?:video|video_ext\.php\?oid=|clip=?|)(-?\d+)_(\d+)|oid=(-?\d+)&id=(\d+)(?:.*?hash=([a-f0-9]+))?/;
291 var match = video.url.match(regExp);
292 var oid = '';
293 var id = '';
294 var videoHash = '';
295
296 if (match) {
297 oid = match[1] || match[3];
298 id = match[2] || match[4];
299
300 if (!videoHash && match[5]) videoHash = match[5];
Предыдущие 100 строкСледующие 100 строк