101'video-noloop': '',102'video-nomute': '',103'video-nocover': '',104'bg-base64': '',105'use-image-for-mobile-cover': '',106};107108// iterating keys from created object and append to it current values109for (var key in coverParams) {110var elAttribute = el.getAttribute('data-content-' + key);111if (elAttribute || key === 'use-image-for-mobile-cover') coverParams[key] = elAttribute;112
} var recordBG = record ? record.getAttribute('data-bg-color') : ''; if (recordBG) coverParams['parent-bg'] = recordBG; var videoFormats = ['mp4', 'webm', 'youtube', 'vimeo', 'rutube', 'kinescope', 'vkvideo']; // if element has parameter nocover - switch off video url if (coverParams['video-nocover'] === 'yes') { videoFormats.forEach(function (videoFormat) { coverParams['video-url-' + videoFormat] = ''; }); } else { // force mute, if video placed inside cover coverParams['video-nomute'] = ''; } // checking if one of the video-url params keys has URL as its value var isContainsVideo = videoFormats.some(function (videoFormat) { return !!coverParams['video-url-' + videoFormat]; }); if ((window.t_cover__isMobile || 'ontouchend' in document) && isContainsVideo && !isLazy) { el.style.backgroundImage = 'url("' + coverParams['cover-bg'] + '")'; } // fix content height, // need setTimeout for correct calculate elements height setTimeout(function () { t_cover__recalcContentHeight(id, false, 0); t_cover__fixBgFixedNode(id); }, 300); if (coverLogo) { coverLogo.onload = function () { t_cover__recalcContentHeight(id, false, 500); }; } if (window.t_cover__isMobile || 'ontouchend' in document) { if (screen?.orientation) { screen.orientation.addEventListener('change', function () { // need setTimeout to change height, after device rotating, // otherwise height will be calculated at time, which orientationchange be triggered t_cover__recalcContentHeight(id, true, 200); }); } else { window.addEventListener('orientationchange', function () { // need setTimeout to change height, after device rotating, // otherwise height will be calculated at time, which orientationchange be triggered t_cover__recalcContentHeight(id, true, 200); }); } } else { window.addEventListener('resize', function () { t_cover__recalcContentHeight(id, false, 0); }); } t_cover__setListenerToArrow(id); t_cover__setCoverParams(el, coverParams, isContainsVideo); el.addEventListener('displayChanged', function () { t_cover__recalcContentHeight(id, false, 0); });}/** * recalc content height * * @param {string} id * @param {Boolean} isOrientationChange * @param {number} timeout */function t_cover__recalcContentHeight(id, isOrientationChange, timeout) { if (timeout) { setTimeout(function () { t_cover__fixBgFixedStyles(id); t_cover__recalcCoverHeight(id, isOrientationChange); }, timeout); } else { t_cover__fixBgFixedStyles(id); t_cover__recalcCoverHeight(id, isOrientationChange); }}/** * append to current cover some styles/element, * depending on type of parallax, contains video url etc.