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

© 2020-2026 Некодим

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

Компания

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

Полезное

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

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

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

tilda-video-processor-1.0.js

Код файла
Версия от 09.10.2026, 07:01:06 МСК
Оригинал на CDNСнимок 56c3b845Полный текст
901			var elHeight = window.getComputedStyle(el).height || 0;902			t_videoprocessor__updateVideoHeight(videoWrapper, elHeight, 'kinescope');903		}, 100)904	);905 906	el.style.backgroundImage = null;907}908 909/**910 * Process VK video911 * @param {HTMLElement} el - Element containing VK video912 * @param {Object} params - Options for video processing
История файла и сравнение версий
  • 09.10.2026, 07:01:06 · 56c3b845
913
* @param {string} params ['cover-height'] - Video height
914 * @param {boolean} params ['video-noloop'] - Flag indicating whether to loop the video
915 */
916function t_videoprocessor__processVkVideo(el, params) {
917 var url = el.getAttribute('data-content-video-url-vkvideo');
918 var noloop = params['video-noloop'];
919
920 if (!url) {
921 el.style.backgroundImage = null;
922 return;
923 }
924
925 url = url.replace(/https:\/\/(vk\.com|vk\.ru|vkvideo\.ru)\/video/, '');
926 var urlParts = url.split('_');
927 var hash = el.getAttribute('data-content-video-hash-vkvideo') || '';
928
929 var elHeight = 0;
930 var embedUrl =
931 'https://vkvideo.ru/video_ext.php?oid=' +
932 urlParts[0] +
933 '&id=' +
934 urlParts[1] +
935 '&hd=2' +
936 (hash ? '&hash=' + hash : '') +
937 '&js_api=1' +
938 (!noloop ? '&loop=1' : '');
939 var iframe = t_videoprocessor__getIframeHtml(embedUrl);
940 el.insertAdjacentElement('beforeend', iframe);
941
942 t_onFuncLoad('t_loadJsFile', () => {
943 t_loadJsFile('https://vkvideo.ru/js/api/videoplayer.js', () => {
944 t_onFuncLoad('VK', () => {
945 const player = VK.VideoPlayer(iframe);
946
947 player.on('inited', function () {
948 player.mute();
949 player.play();
950
951 elHeight = window.getComputedStyle(el).height || 0;
952 t_videoprocessor__updateVideoHeight(el, elHeight, 'vk');
953 });
954
955 if ('IntersectionObserver' in window) {
956 var iframeVideoObserver = new IntersectionObserver(function (entries) {
957 entries.forEach(function (entry) {
958 if (!player) return;
959 var target = entry.target;
960 if (target === iframe) {
961 var doCommand = entry.isIntersecting ? player.play : player.pause;
962 doCommand();
963 }
964 });
965 });
966 iframeVideoObserver.observe(iframe);
967 }
968 });
969 });
970 });
971
972 t_onReady(function () {
973 var elHeight = window.getComputedStyle(el).height || 0;
974 t_videoprocessor__updateVideoHeight(el, elHeight, 'vk');
975 });
976
977 el.addEventListener(
978 'coverHeightUpdated',
979 function () {
980 var elHeight = window.getComputedStyle(el).height || 0;
981 t_videoprocessor__updateVideoHeight(el, elHeight, 'vk');
982 },
983 { once: true }
984 );
985
986 window.addEventListener(
987 'resize',
988 t_throttle(function () {
989 var elHeight = window.getComputedStyle(el).height || 0;
990 t_videoprocessor__updateVideoHeight(el, elHeight, 'vk');
991 }, 100)
992 );
993 el.style.backgroundImage = null;
994}
995
996/**
997 * some analog of promise
998 * we cannot use here t_onFuncLoad, because after getting YT object, we need check is YT.Player is ready to use
999 *
1000 * @param {String} obj - if obj is object
Предыдущие 100 строкСледующие 100 строк