adding on to my midnight thought

This commit is contained in:
Unknown 2024-05-09 16:37:06 -07:00
parent e91ef45b29
commit 37430d7d9b
3 changed files with 51 additions and 41 deletions

View file

@ -23,15 +23,20 @@
});
});
</script>
<meta charset="UTF-8" />
<title>Showcase Page</title>
</head>
<body>
<!--Navigation Bar-->
<div id="navbar"></div>
<h1></h1>
<h1>Shuffled Photos and Videos</h1>
<div id="mediaContainer"></div>
<script src="/Pages/showcase.js"></script>
</body>
<h1></h1>
<h1></h1>
<!-- Footer -->
<div id="socials"></div>
</html>

View file

@ -1,7 +1,7 @@
async function fetchMedia() {
const response = await fetch("/media");
const media = await response.json();
shuffle(media); // Assuming you have a shuffle function
shuffle(media);
const mediaContainer = document.getElementById("mediaContainer");
media.forEach((item) => {
const element = document.createElement("img"); // For images
@ -11,8 +11,11 @@ async function fetchMedia() {
});
}
fetchMedia();
function shuffle(array) {
// Implementation of shuffle function
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
}
fetchMedia();

View file

@ -1,39 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link
rel="icon"
type="image/x-icon"
href="/Resources/Favicons/favicon.png"
/>
<link rel="stylesheet" href="/Pages/style.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<html lang="en"></html>
<head>
<link
rel="icon"
type="image/x-icon"
href="/Resources/Favicons/favicon.png"
/>
<link rel="stylesheet" href="/Pages/style.css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script>
window.addEventListener("DOMContentLoaded", (event) => {
fetch("/Pages/navbar.html")
.then((response) => response.text())
.then((data) => {
document.getElementById("navbar").innerHTML = data;
});
fetch("/Pages/socials.html")
.then((response) => response.text())
.then((data) => {
document.getElementById("socials").innerHTML = data;
});
});
</script>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Upload Page</title>
</head>
<body>
<h1>Upload Photos and Videos</h1>
<form id="uploadForm" enctype="multipart/form-data">
<input type="file" name="file" id="fileInput" multiple />
<button type="submit">Upload</button>
</form>
<script>
window.addEventListener("DOMContentLoaded", (event) => {
fetch("/Pages/navbar.html")
.then((response) => response.text())
.then((data) => {
document.getElementById("navbar").innerHTML = data;
});
fetch("/Pages/socials.html")
.then((response) => response.text())
.then((data) => {
document.getElementById("socials").innerHTML = data;
});
});
</script>
</head>
<body>
<!--Navigation Bar-->
<div id="navbar"></div>
<h1></h1>
<h1></h1>
<h1>Upload Photos and Videos</h1>
<form id="uploadForm" enctype="multipart/form-data">
<input type="file" name="file" id="fileInput" multiple />
<button type="submit">Upload</button>
</form>
<script src="/Pages/upload.js"></script>
</body>
</html>
<script src="/Pages/upload.js"></script>
<!-- Footer -->
<div id="socials"></div>
</body>