Каталог файловtilda-t136.js
1/* Блок GL06 */2 3/**4 * Инициализирует последовательный слайдер изображений и видео5 *6 * @param {string} recId - id rec блока7 * @param {string} isEdit - режим редактирования или нет8 * @returns {void}9 */10 11 12function t136_init(recId, isEdit) {13
История файла и сравнение версий
var rec = document.getElementById('rec' + recId);
17 var sequenceTxtBlocks = rec.querySelectorAll('.txt-holder'); 18 var sequenceBackgrounds = rec.querySelectorAll('.t136__background'); 20 Array.prototype.forEach.call(sequenceTxtBlocks, function(element) { 21 element.style.top = ''; 22 element.style.position = 'relative'; 25 Array.prototype.forEach.call(sequenceBackgrounds, function(element) { 26 element.style.height = window.sequenceController.itemHeight + 'px'; 29 if (window.isMobile === undefined) { 30 var startTime = Date.now(); 32 setTimeout(function checkFuncExist() { 33 var currentTime = Date.now(); 34 if (typeof window.isMobile === 'boolean') { 35 t136_init(recId, isEdit); 38 if (document.readyState === 'complete' && currentTime - startTime > 1000 && typeof window.isMobile !== 'boolean') { 41 setTimeout(checkFuncExist, 100); 45 var sequenceTxtBlocks = rec.querySelectorAll('.txt-holder'); 47 Array.prototype.forEach.call(sequenceTxtBlocks, function(element) { 48 element.style.backgroundColor = 'transparent'; 51 if (window.isMobile === false) { 52 window.sequenceController.registerNewBlock(rec); 56 if (!window.isMobile) { 57 var youtubeVideos = rec.querySelectorAll('div[data-content-video-url-youtube]'); 58 Array.prototype.forEach.call(youtubeVideos, function(video) { 59 t_onFuncLoad('processYoutubeVideo', function() { 60 var videoHeight = window.getComputedStyle(video).height; 62 processYoutubeVideo(video, videoHeight); 66 var backgroundsToSet = rec.querySelectorAll('[data-hook="item-background"]'); 67 var sequenceBackgroundBlocks = rec.querySelectorAll('[data-hook="sequence-item"]'); 69 Array.prototype.forEach.call(backgroundsToSet, function(element) { 70 element.style.backgroundImage = 'url(' + element.getAttribute('data-image-src') + ')'; 73 Array.prototype.forEach.call(sequenceBackgroundBlocks, function(element) { 74 element.querySelector("[data-hook='item-background']").style.height = window.sequenceController.itemHeight + 'px'; 75 element.querySelector('.txt-holder').style.position = 'relative'; 76 element.querySelector('.txt-holder').style.backgroundColor = '#000'; 77 element.style.backgroundColor = '#000'; 82window.processVideo = function (v) { 83 var mp4Src = $(v).attr('data-content-video-url-mp4'); 84 var webmSrc = $(v).attr('data-content-video-url-webm'); 85 $(v).css('background-color', 'transparent'); 86 $(v).css('background-image', ''); 98 /* Initializing the videos*/ 100 t_onFuncLoadVideo(function() {