-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIndex.html
211 lines (188 loc) · 7.11 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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Beat the Chasers Timer</title>
<style>
body {
margin: 0;
font-family: Arial, sans-serif;
background-color: white; /* Set background color to white */
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
color: white;
}
.timer-container {
display: flex;
justify-content: space-evenly; /* Evenly distribute items */
align-items: center;
width: 100%; /* Take full screen width */
height: 100%; /* Full height */
}
.timer-box {
position: relative;
width: 20%; /* Timer width takes 20% of the screen */
height: 100%;
border: 8px solid;
border-radius: 10px;
overflow: hidden;
display: flex;
flex-direction: column;
align-items: center;
color: white;
font-weight: bold;
font-size: 50px;
box-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}
#player-timer {
border-color: #007FFF; /* Bright blue border */
}
#chasers-timer {
border-color: #FF0000; /* Bright red border */
}
.timer-content {
position: absolute;
bottom: 0;
width: 100%;
transition: height 1s linear;
background-color: inherit;
}
#player-content {
background-color: #007FFF; /* Bright blue countdown bar */
}
#chasers-content {
background-color: #FF0000; /* Bright red countdown bar */
}
.label {
position: absolute;
top: 10px;
width: 100%;
text-align: center;
font-size: 30px;
z-index: 2;
text-transform: uppercase;
color: #0074D9; /* Royal Blue for labels */
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}
.timer {
font-size: 80px;
z-index: 3;
position: absolute;
top: 50%;
transform: translateY(-50%);
color: white;
text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8); /* Strong shadow for clarity */
}
.center-image {
width: 15%; /* Adjust size as needed */
align-self: center;
}
</style>
</head>
<body>
<div class="timer-container">
<div id="player-timer" class="timer-box">
<div class="label" id="player-label">Shaun</div>
<div id="player-content" class="timer-content" style="height: 100%;"></div>
<div id="player-time" class="timer">60</div>
</div>
<!-- Center image -->
<img src="https://www.jotform.com/uploads/Edel_Kennedy/form_files/flying_fifteen_ireland.6731dc3385b2f5.21521112.png" alt="Flying Fifteen Ireland" class="center-image">
<div id="chasers-timer" class="timer-box">
<div class="label" id="chasers-label">Chasers</div>
<div id="chasers-content" class="timer-content" style="height: 75%;"></div>
<div id="chasers-time" class="timer">45</div>
</div>
</div>
<script>
// Configurable variables
const playerName = 'First';
const chasersName = 'Chasers';
const playerStartTime = 60; // Start time for player in seconds
const chasersStartTime = 45; // Start time for chasers in seconds
const keyStartPlayer = 's';
const keyStartChasers = 'c';
const keyToggleTimers = 't';
const keyResetTimers = 'r';
const keyStopAllTimers = 'p';
// Timer state variables
let playerTime = playerStartTime;
let chasersTime = chasersStartTime;
let activeTimer = null;
let currentTimer = 'player';
// Set initial names and times
document.getElementById('player-label').innerText = playerName;
document.getElementById('chasers-label').innerText = chasersName;
document.getElementById('player-time').innerText = playerTime;
document.getElementById('chasers-time').innerText = chasersTime;
document.getElementById('chasers-content').style.height = `${(chasersTime / playerStartTime) * 100}%`;
function updateContentHeight(timerId, timeRemaining, totalTime) {
const content = document.getElementById(timerId);
const heightPercentage = (timeRemaining / totalTime) * 100;
content.style.height = `${heightPercentage}%`;
}
function startPlayerTimer() {
stopTimers();
activeTimer = setInterval(() => {
if (playerTime > 0) {
playerTime--;
document.getElementById('player-time').innerText = playerTime;
updateContentHeight('player-content', playerTime, playerStartTime);
} else {
clearInterval(activeTimer);
}
}, 1000);
currentTimer = 'player';
}
function startChasersTimer() {
stopTimers();
activeTimer = setInterval(() => {
if (chasersTime > 0) {
chasersTime--;
document.getElementById('chasers-time').innerText = chasersTime;
updateContentHeight('chasers-content', chasersTime, playerStartTime);
} else {
clearInterval(activeTimer);
}
}, 1000);
currentTimer = 'chasers';
}
function stopTimers() {
clearInterval(activeTimer);
activeTimer = null;
}
function toggleTimers() {
if (currentTimer === 'player') {
startChasersTimer();
} else {
startPlayerTimer();
}
}
function resetTimers() {
stopTimers();
playerTime = playerStartTime;
chasersTime = chasersStartTime;
document.getElementById('player-time').innerText = playerTime;
document.getElementById('chasers-time').innerText = chasersTime;
updateContentHeight('player-content', playerTime, playerStartTime);
updateContentHeight('chasers-content', chasersTime, playerStartTime);
currentTimer = 'player';
}
function stopAllTimers() {
stopTimers();
console.log("All timers stopped");
}
// Event listeners for starting, stopping, toggling, and resetting timers
document.addEventListener('keypress', (e) => {
if (e.key === keyStartPlayer) startPlayerTimer();
if (e.key === keyStartChasers) startChasersTimer();
if (e.key === keyToggleTimers) toggleTimers();
if (e.key === keyResetTimers) resetTimers();
if (e.key === keyStopAllTimers) stopAllTimers();
});
</script>
</body>
</html>