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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-video-processor-1.0.js

Код файла
Версия от 09.10.2026, 07:01:06 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
701	iframe.setAttribute('webkitAllowFullScreen', '');702	iframe.setAttribute('mozallowfullscreen', '');703	iframe.setAttribute('allowFullScreen', '');704	iframe.innerHTML = "<p>Your browser don't support videos.</p>";705 706	return iframe;707}708 709function t_videoprocessor__processVimeoVideo(el, params) {710	var id = el.getAttribute('data-content-video-url-vimeo');711	if (!id) {712		el.style.backgroundImage = null;
История файла и сравнение версий
  • 09.10.2026, 07:01:06 · 56c3b845
713 return;
714 }
715
716 var noloop = params['video-noloop'];
717 var hash = el.getAttribute('data-content-video-hash-vimeo') || '';
718 var url = t_videoprocessor__getIframeVideoUrl('vimeo', id, hash, noloop);
719
720 var iframe = t_videoprocessor__getIframeHtml(url, params['cover-height']);
721 if (!url) {
722 el.style.backgroundImage = null;
723 return;
724 }
725
726 el.style.backgroundImage = null;
727 el.insertAdjacentElement('beforeend', iframe);
728
729 t_onReady(function () {
730 var elHeight = window.getComputedStyle(el).height || 0;
731 t_videoprocessor__updateVideoHeight(el, elHeight, 'vimeo');
732 });
733
734 el.addEventListener(
735 'coverHeightUpdated',
736 function () {
737 var elHeight = window.getComputedStyle(el).height || 0;
738 t_videoprocessor__updateVideoHeight(el, elHeight, 'vimeo');
739 },
740 { once: true }
741 );
742
743 window.addEventListener(
744 'resize',
745 t_throttle(function () {
746 var elHeight = window.getComputedStyle(el).height || 0;
747 t_videoprocessor__updateVideoHeight(el, elHeight, 'vimeo');
748 }, 100)
749 );
750}
751
752/**
753 * Process Rutube video
754 * @param {HTMLElement} el - Element containing Rutube video
755 * @param {Object} params - Options for video processing
756 * @param {string} params ['cover-height'] - Video height
757 * @param {boolean} params['video-noloop'] - Flag indicating whether to loop the video
758 */
759function t_videoprocessor__processRutubeVideo(el, params) {
760 var id = el.getAttribute('data-content-video-url-rutube');
761
762 if (!id) {
763 el.style.backgroundImage = null;
764 return;
765 }
766
767 var noloop = params['video-noloop'];
768 var hash = el.getAttribute('data-content-video-hash-rutube') || '';
769 var url = t_videoprocessor__getIframeVideoUrl('rutube', id, hash, noloop);
770
771 if (!url) {
772 el.style.backgroundImage = null;
773 return;
774 }
775
776 var iframe = t_videoprocessor__getIframeHtml(url, params['cover-height']);
777 var autoplayInitiated = false;
778
779 window.addEventListener('message', function (event) {
780 if (!event) return;
781
782 var message = '';
783 try {
784 // event.data is not always json
785 message = typeof event.data === 'string' ? JSON.parse(event.data) : event.data;
786 } catch (error) {
787 console.error(error);
788 }
789
790 if (!message.data) return;
791
792 // Событие message также возвращает player:ready для других инициализирующихся видео,
793 // добавляем проверку, что это конкретное видео, а не из другого блока
794 if (message.type === 'player:ready' && iframe.src.indexOf(message.data.videoId) !== -1) {
795 t_videoprocessor__doRutubeCommand(iframe, 'stop');
796 t_videoprocessor__doRutubeCommand(iframe, 'mute');
797 } else if (message.type === 'player:changeState' && message.data.state === 'buffering' && !autoplayInitiated) {
798 autoplayInitiated = true;
799 t_videoprocessor__doRutubeCommand(iframe, 'play');
800 } else if (
Предыдущие 100 строкСледующие 100 строк