28 lines
1.1 KiB
JavaScript
28 lines
1.1 KiB
JavaScript
new URL(location.href).searchParams.get('video')
|
|
const params = new URL(location.href).searchParams;
|
|
const videoID = params.get('video');
|
|
|
|
//redirect to directory if no ${videoID} given
|
|
const urlContainParams = window.location.search.length === 0;
|
|
if (urlContainParams) window.location.href = 'dir.html';
|
|
|
|
|
|
console.log("Good Day!");
|
|
console.log("Attempting to load Content!");
|
|
console.log(`using video ID:"${videoID}"`);
|
|
|
|
//Set Thumbnail of Video based on ${videoID}
|
|
document.getElementById("media").setAttribute("poster", `vidSrc/Video/${videoID}/thumb.png`);
|
|
console.log("Setting Thumbnail");
|
|
|
|
|
|
//Fetch and populate the JSON data for ${videoID}
|
|
fetch(`vidSrc/${new URL(location.href).searchParams.get("video")}.json`)
|
|
.then(res => res.json())
|
|
.then (data => {
|
|
document.getElementById("media").setAttribute("src", `vidSrc/Video/${videoID}/${data.file}`),
|
|
document.getElementById("vidTitle").innerHTML = `${data.title}`,
|
|
document.getElementById("vidDesc").innerHTML = `${data.desc}`,
|
|
document.getElementById("vidCreator").innerHTML = `${data.creator}`,
|
|
document.getElementById("vidDate").innerHTML = `${data.date}`
|
|
}) |