Test-HTML / Ark ReCode /script.js
GilbertClaus's picture
Video
899d1e1
raw
history blame
1.2 kB
function playVideo(charName) {
const fileName = `Ark Re Code - ${charName}.mp4`;
const videoPath = `https://gilbertclaus.pythonanywhere.com/video/Ark ReCode/${fileName}`;
const encodedURL = encodeURI(videoPath);
const wrapper = document.getElementById("videoWrapper");
wrapper.innerHTML = "";
const video = document.createElement("video");
video.src = encodedURL;
video.width = 360;
video.controls = true;
video.autoplay = true;
video.volume = 0.1;
video.style.marginTop = "20px";
wrapper.appendChild(video);
}
function fetchData() {
const input = document.getElementById("charName").value.trim();
const charaBtn = document.getElementById("chara");
if (input === "") {
// Ambil status tombol pertama sebagai acuan
const isHidden = charaBtns[0].style.display === "none" || charaBtns[0].style.display === "";
// Toggle semua tombol
charaBtns.forEach(btn => {
btn.style.display = isHidden ? "inline-block" : "none";
});
} else {
const name = document.getElementById("charName").value;
alert(`Fungsi fetchData untuk karakter "${name}" belum diimplementasikan`);
}
}