1document.addEventListener("DOMContentLoaded", function () { 2 document.querySelectorAll(".video-slide__wrapper").forEach((wrapper) => { 3 const videoSrc = wrapper.dataset.video; 4 const timeElement = wrapper.querySelector(".video-slide__time"); 5 6 // ÐодгÑÑжаем длиÑелÑноÑÑÑ Ð²Ð¸Ð´ÐµÐ¾ 7 if (videoSrc && timeElement) { 8 const tempVideo = document.createElement("video"); 9 tempVideo.src = videoSrc; 10 tempVideo.preload = "metadata"; 11 12 tempVideo.addEventListener("loadedmetadata", function () { 13 const duration = tempVideo.duration; 14 const minutes = Math.floor(duration / 60); 15 const seconds = Math.floor(duration % 60); 16 timeElement.textContent = `${minutes}:${seconds 17 .toString() 18 .padStart(2, "0")}`; 19 }); 20 } 21 22 wrapper.addEventListener("click", function () { 23 // ÐÑли видео Ñже вÑÑавлено â ниÑего не делаем 24 if (wrapper.classList.contains("video-active")) return; 25 26 // ÐобавлÑем клаÑÑ 27 wrapper.classList.add("video-active"); 28 29 // Ð¡Ð¾Ñ ÑанÑем вÑÑоÑÑ/ÑиÑинÑ, еÑли нÑжно 30 const wrapperStyles = getComputedStyle(wrapper); 31 const height = wrapperStyles.height; 32 const width = wrapperStyles.width; 33 34 // ÐÑиÑаем 35 wrapper.innerHTML = ""; 36 37 // Создаем видео 38 const video = document.createElement("video"); 39 video.src = videoSrc; 40 video.controls = true; 41 video.autoplay = true; 42 video.style.width = width; 43 video.style.height = height; 44 45 wrapper.appendChild(video); 46 }); 47 }); 48});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.