-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
80 lines (74 loc) · 2.13 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<head>
<title>Prof Ciaraldi Jokes</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-beta/css/materialize.min.css"
/>
</head>
<body>
<br />
<div id="vid-wrapper" class="center"></div>
<br />
<div class="center">
<button class="waves-effect waves-light btn blue" onclick="getRandom()">
Gimme a Joke!
</button>
<br /><br />
Created by Binam Kayastha
</div>
<script>
var filenames = [
"good.mp4",
"applase.mp4",
"movement.mp4",
"travel.mp4",
"weed.mp4",
"medal.mp4",
"revolution.mp4",
"pain.mp4",
"grey.mp4",
"odds.mp4",
"private.mp4",
"paws.mp4",
"sprouts.mp4",
"mass.mp4",
"blunder.mp4",
"contained.mp4",
"blurry.mp4",
];
function getFilename() {
if (filenames.length == 0) {
return undefined;
}
// Bug get's 1 less video than available
randomIndex = Math.floor(Math.random() * filenames.length);
finalString = "final_videos/" + filenames[randomIndex];
filenames.splice(randomIndex, 1);
return finalString;
}
var video_string =
`<video id="video" width="640px" height="350px" autoplay="autoplay" controls="controls">
<source src="` +
getFilename() +
`" type="video/mp4">
Your browser does not support the video tag.
</video>`;
window.onload = function loader() {
document.getElementById("vid-wrapper").innerHTML = video_string;
};
function getRandom() {
filename = getFilename();
if (filename == undefined) {
document.getElementById("vid-wrapper").innerHTML =
"LoL no more videos :(<br>Send a Prof Ciaraldi video clip to bkayastha AT wpi DOT edu to fill the empty void you're feeling!";
return;
}
document.getElementById("vid-wrapper").innerHTML =
`<video id="video" width="640px" height="350px" autoplay="autoplay" controls="controls">
<source src="` +
filename +
`" type="video/mp4">
Your browser does not support the video tag.`;
}
</script>
</body>