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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-video-processor-1.0.js

Код файла
Версия от 09.10.2026, 07:01:06 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
801			!noloop &&802			message.type === 'player:changeState' &&803			['stopped', 'completed'].includes(message.data.state)804		) {805			t_videoprocessor__doRutubeCommand(iframe, 'play');806		}807	});808 809	el.style.backgroundImage = null;810	el.insertAdjacentElement('beforeend', iframe);811 812	t_onReady(function () {
История файла и сравнение версий
  • 09.10.2026, 07:01:06 · 56c3b845
813
var elHeight = window.getComputedStyle(el).height || 0;
814 t_videoprocessor__updateVideoHeight(el, elHeight, 'rutube');
815 });
816
817 el.addEventListener(
818 'coverHeightUpdated',
819 function () {
820 var elHeight = window.getComputedStyle(el).height || 0;
821 t_videoprocessor__updateVideoHeight(el, elHeight, 'rutube');
822 },
823 { once: true }
824 );
825
826 window.addEventListener(
827 'resize',
828 t_throttle(function () {
829 var elHeight = window.getComputedStyle(el).height || 0;
830 t_videoprocessor__updateVideoHeight(el, elHeight, 'rutube');
831 }, 100)
832 );
833
834 if ('IntersectionObserver' in window) {
835 var iframeVideoObserver = new IntersectionObserver(function (entries) {
836 entries.forEach(function (entry) {
837 var target = entry.target;
838 if (target === iframe) {
839 var command = entry.isIntersecting ? 'play' : 'pause';
840 t_videoprocessor__doRutubeCommand(iframe, command);
841 }
842 });
843 });
844 iframeVideoObserver.observe(iframe);
845 }
846}
847
848function t_videoprocessor__doRutubeCommand(iframe, command) {
849 iframe.contentWindow.postMessage(JSON.stringify({ type: 'player:' + command, data: {} }), '*');
850}
851
852/**
853 * Process Kinescope video
854 * @param {HTMLElement} el - Element containing Kinescope video
855 * @param {Object} params - Options for video processing
856 * @param {string} params ['cover-height'] - Video height
857 * @param {boolean} params['video-noloop'] - Flag indicating whether to loop the video
858 */
859function t_videoprocessor__processKinescopeVideo(el, params) {
860 var id = el.getAttribute('data-content-video-url-kinescope');
861
862 if (!id) {
863 el.style.backgroundImage = null;
864 return;
865 }
866
867 var noloop = params['video-noloop'];
868 var url = t_videoprocessor__getIframeVideoUrl('kinescope', id, null, noloop);
869
870 if (!url) {
871 el.style.backgroundImage = null;
872 return;
873 }
874
875 var videoWrapper = document.createElement('div');
876 videoWrapper.classList.add('t-cover__video__wrapper');
877 videoWrapper.style.height = params['cover-height'];
878
879 var iframe = t_videoprocessor__getIframeHtml(url);
880
881 videoWrapper.insertAdjacentElement('beforeend', iframe);
882 el.insertAdjacentElement('beforeend', videoWrapper);
883
884 t_onReady(function () {
885 var elHeight = window.getComputedStyle(el).height || 0;
886 t_videoprocessor__updateVideoHeight(videoWrapper, elHeight, 'kinescope');
887 });
888
889 el.addEventListener(
890 'coverHeightUpdated',
891 function () {
892 var elHeight = window.getComputedStyle(el).height || 0;
893 t_videoprocessor__updateVideoHeight(videoWrapper, elHeight, 'kinescope');
894 },
895 { once: true }
896 );
897
898 window.addEventListener(
899 'resize',
900 t_throttle(function () {
Предыдущие 100 строкСледующие 100 строк