40 lines
1.3 KiB
JavaScript
40 lines
1.3 KiB
JavaScript
function loadVideo() {
|
|
|
|
fetch('/WebNew/Video/GetAll')
|
|
.then(res => res.json())
|
|
.then(data => {
|
|
|
|
let html = "";
|
|
|
|
data.forEach(item => {
|
|
html += `
|
|
<div class="col-md-4">
|
|
<div class="youtube-wrapper">
|
|
<iframe
|
|
src="https://www.youtube.com/embed/${item.youtube}"
|
|
title="${item.judul}"
|
|
frameborder="0"
|
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
|
allowfullscreen>
|
|
</iframe>
|
|
1 </div>
|
|
</div>
|
|
`;
|
|
});
|
|
|
|
document.getElementById("video-list").innerHTML = html;
|
|
|
|
});
|
|
}
|
|
|
|
function openVideo(url) {
|
|
document.getElementById("videoFrame").src = url;
|
|
document.getElementById("videoModal").style.display = "flex";
|
|
}
|
|
|
|
function closeVideo() {
|
|
document.getElementById("videoFrame").src = "";
|
|
document.getElementById("videoModal").style.display = "none";
|
|
}
|
|
|
|
document.addEventListener("DOMContentLoaded", loadVideo); |