New video player and changed Zakarya banner

This commit is contained in:
2024-12-31 20:22:38 -08:00
parent af5c2b6b56
commit 05ff4ecc5d
8 changed files with 247 additions and 4 deletions

100
video/css/style.css Normal file
View File

@ -0,0 +1,100 @@
div.videocontainer {
display: flex;
color: var(--text-color);
width: 90%;
margin: 16px auto 16px auto;
border: solid 1px #00000033;
border-radius: 8px;
box-shadow: 1px 1px 8px #00000033;
padding: 16px;
}
div.videocontainer video#videoplayer {
flex-grow: 1;
border-radius: 12px;
height: auto;
max-width: 55%;
}
div.videocontainer div.videoobjects {
display: grid;
padding: 24px;
}
div.videocontainer div.videodetails h1#videotitle {
padding: 0 12px;
}
div.dropdown-container {
display: flex;
flex-direction: column-reverse;
}
div.videocontainer div.download-dropdown {
position: relative;
display: inline-block;
padding: 12px;
width: 25px;
height: 25px;
background-color: #21afff;
box-shadow: 1px 1px 8px #00000033;
border-radius: 50px;
transition-duration: 0.35s;
}
div.videocontainer div.download-dropdown:hover {
box-shadow: 1px 1px 8px #00000088;
}
div.videocontainer div.download-dropdown img {
width: 25px;
height: 25px;
}
div.videocontainer div.download-dropdown div.dropdown-content {
display: none;
position: absolute;
font-size: 80%;
min-width: 135px;
background-color: #edeeee;
box-shadow: 1px 1px 8px #00000033;
border-radius: 8px;
text-align: center;
}
div.videocontainer div.download-dropdown:hover div.dropdown-content {
display: block;
}
div.videocontainer div.download-dropdown div.dropdown-content ul {
list-style-type: none;
padding-left: 0;
}
div.videocontainer div.download-dropdown div.dropdown-content ul li {
padding: 4px;
}
div.videocontainer div.download-dropdown div.dropdown-content ul li:hover {
background-color: #dcdfdf;
}
div.videocontainer div.download-dropdown div.dropdown-content ul li a {
text-decoration: none;
color: var(--text-color);
}
@media screen and (max-width: 800px) {
div.videocontainer {
display: block;
}
div.videocontainer video#videoplayer {
width: 100%;
}
div.videocontainer div.download-dropdown {
display: block;
margin-left: auto;
margin-right: auto;
margin-top: 12px;
}
}

50
video/index.html Normal file
View File

@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/svg" href="/img/colormatic_logo.svg">
<link rel="stylesheet" href="/css/style.css">
<link rel="stylesheet" href="/video/css/style.css">
<script src="/js/jquery.js"></script>
<title>Video Player</title>
<script>
$(document).ready(function(){
$("#navbar").load("/component/navbar.html")
})
$(document).ready(function(){
$("#footer").load("/component/footer.html")
})
</script>
</head>
<body>
<header class="container" id="navbar"></header>
<div class="videocontainer">
<video id="videoplayer" controls></video>
<div class="videoobjects">
<div class="videodetails">
<h1 id="videotitle"></h1>
<p id="videodescription" class="justify"></p>
</div>
<div class="dropdown-container">
<div class="download-dropdown">
<img src="https://icons.getbootstrap.com/assets/icons/download.svg" alt="Download">
<div class="dropdown-content">
<ul>
<li><a id="videodownload">Downolad Video</a></li>
<li><a id="sourcedownload">Download Source</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<footer id="footer"></footer>
<script src="/video/js/main.js"></script>
</body>
</html>

48
video/js/main.js Normal file
View File

@ -0,0 +1,48 @@
const BASEURL = "https://files.colormatic.org/"
var videoplayer = document.getElementById("videoplayer");
var videotitle = document.getElementById("videotitle");
var videodescription = document.getElementById("videodescription");
var videodownload = document.getElementById("videodownload");
var sourcedownload = document.getElementById("sourcedownload");
var params = new URLSearchParams(window.location.search);
function getParam(paramName) {
return params.get(paramName);
}
async function getJSON(url) {
const response = await fetch(url);
if(!response.ok)
throw new Error(response.statusText);
const data = response.json();
return data;
}
function getVideo(cname, vname) {
getJSON(BASEURL + cname + "/videos/data/" + vname + ".json").then((data) => {
videoURL = BASEURL + cname + "/videos/raw/" + data.video_file + "." + data.video_format;
var videosource = document.createElement("source");
videosource.setAttribute("src", videoURL);
videosource.setAttribute("type", "video/" + data.video_format);
videoplayer.appendChild(videosource);
document.title = data.title;
videotitle.appendChild(document.createTextNode(data.title));
data.description.forEach((iter) => { // TODO: Detect if one of these lines contains a link and if so, make it a link
videodescription.appendChild(document.createTextNode(iter));
videodescription.appendChild(document.createElement("br"));
});
videodownload.setAttribute("href", BASEURL + cname + "/videos/raw/" + data.video_file + "." + data.video_format);
videodownload.setAttribute("download", data.video_file + "." + data.video_format);
sourcedownload.setAttribute("href", BASEURL + cname + "/videos/source/" + data.source_file + "." + data.source_format);
sourcedownload.setAttribute("download", data.source_file + "." + data.source_format);
}).catch((error) => {
console.error(error);
});
}
getVideo(getParam("c"), getParam("v"));