-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_game.html
148 lines (124 loc) · 4.32 KB
/
index_game.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!doctype html>
<html>
<head>
<title>IETS NIEUWS</title>
<style>
</style>
<!-- Include the volume meter component -->
<script src="./volume-meter/volume-meter.js"></script>
<!-- Include the main app logic -->
<script src="./volume-meter/main.js"></script>
<script src="./videos.js"></script>
</head>
<body bgcolor="black" onload="startvid()">
<div align=center id="header" style="color:#FFFFFF">
<h1><font face="adventure"> IETS NIEUWS: <br/> Bent u de nieuwe Philip Bloemendal? </h1>
</div>
<div align=center id="main">
<video width="850px" id="player" src="http://www.openbeelden.nl/files/30/30701.30640.WEEKNUMMER501-HRE0000E80C.mp4#t=10" autoplay muted> </video>
<br/>
<span id="countdown" class="timer"></span><br/>
VOLUME: <canvas id="meter" width="500" height="50"></canvas>
<br/>
<button id=buttonNext1 style="width:150px;height:60px;background-color:#008000">Natuur</button>
<button id=buttonNext2 style="width:150px;height:60px;background-color:#FF0000">Kunst en Cultuur</button>
<button id=buttonNext3 style="width:150px;height:60px;background-color:#3399FF">Sport</button>
<button id=buttonNext4 style="width:150px;height:60px;background-color:#FFFF00">Stad en Transport</button>
</div>
</div>
<script>
// DIT IS DE COUNTER
var seconds = 30;
function secondPassed() {
var minutes = Math.round((seconds - 30)/60);
var remainingSeconds = seconds % 60;
if (remainingSeconds < 10) {
remainingSeconds = "0" + remainingSeconds;
}
document.getElementById('countdown').innerHTML = minutes + ":" + remainingSeconds;
if (seconds == 0) {
clearInterval(countdownTimer);
if (score < 1200){
window.location.href = "index_random.html";
}
else{
window.location.href = "index_philip.html";
}
}
else {
seconds--;
}
}
var countdownTimer = setInterval('secondPassed()', 1000);
</script>
</body>
<script>
var score = 0;
var readyForReload = 0;
/* use global variable for ease */
var v = document.getElementById('player');
/* button */
document.getElementById('buttonNext1').addEventListener('click',swapVideo1,true);
document.getElementById('buttonNext2').addEventListener('click',swapVideo2,true);
document.getElementById('buttonNext3').addEventListener('click',swapVideo3,true);
document.getElementById('buttonNext4').addEventListener('click',swapVideo4,true);
/* Key press listener*/
window.addEventListener("keydown", checkKeyPressed, false);
function checkKeyPressed(e) {
if(readyForReload == 1) {location.reload();}
if (e.keyCode == "81") {
//alert("The 'q' key is pressed.");
var nextVid = oiVids1[Math.floor(Math.random() * oiVids1.length)];
v.src = nextVid;
v.load();
document.getElementById( "timerarea" ).value = "29";
}
if (e.keyCode == "87") {
//alert("The 'w' key is pressed.");
var nextVid = oiVids2[Math.floor(Math.random() * oiVids2.length)];
v.src = nextVid;
v.load();
}
if (e.keyCode == "69") {
//alert("The 'e' key is pressed.");
var nextVid = oiVids3[Math.floor(Math.random() * oiVids3.length)];
v.src = nextVid;
v.load();
}
if (e.keyCode == "82") {
//alert("The 'r' key is pressed.");
var nextVid = oiVids4[Math.floor(Math.random() * oiVids4.length)];
v.src = nextVid;
v.load();
}
}
function startvid(){
/* change the video src attribute to a random selection */
var nextVid = oiVids1[Math.floor(Math.random() * oiVids1.length)];
v.src = nextVid;
v.load();
}
function swapVideo1(e) {
/* change the video src attribute to a random selection */
var nextVid = oiVids1[Math.floor(Math.random() * oiVids1.length)];
v.src = nextVid;
v.load();
}
function swapVideo2(e) {
/* change the video src attribute to a random selection */
var nextVid = oiVids2[Math.floor(Math.random() * oiVids2.length)];
v.src = nextVid;
v.load();
} function swapVideo3(e) {
/* change the video src attribute to a random selection */
var nextVid = oiVids3[Math.floor(Math.random() * oiVids3.length)];
v.src = nextVid;
v.load();
} function swapVideo4(e) {
/* change the video src attribute to a random selection */
var nextVid = oiVids4[Math.floor(Math.random() * oiVids4.length)];
v.src = nextVid;
v.load();
}
</script>
</html>