-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
171 lines (148 loc) · 4.01 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
<!DOCTYPE html>
<html>
<head>
<title>
Lost Timer
</title>
<!-- global meta -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
<!-- lost timer js -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<!-- lost timer css -->
<link href="css/lost-timer.css" rel="stylesheet" type="text/css">
<style>
a {
color: #049cd8;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
body{
background: #181818;
margin: 0;
padding: 0;
font-family: 'Helvetica', sans-serif;
overflow-x: hidden;
}
.my-timer-container {
width: 692px;
margin: 0 auto;
background: #272727;
box-shadow: 0px 0px 10px rgba( 255, 255, 255, 0.5 );
border-radius: 10px;
padding: 20px;
margin-top: 20px;
margin-bottom: 40px;
}
@media only screen and (max-width: 700px) {
.my-timer-container {
width: 287px;
}
}
.console-container {
width: calc( 100% - 40px );
margin: 0 auto;
background: #000000;
box-shadow: 0px 0px 10px rgba( 255, 255, 255, 0.5 );
border-radius: 10px;
margin-top: 40px;
height: 250px;
padding-left: 15px;
padding-right: 15px;
padding-top: 5px;
padding-bottom: 15px;
box-sizing: border-box;
}
.console-prompt {
font-size: 40px;
display: inline-block;
color: #43b047;
}
.console-input {
width: calc( 100% - 50px );
display: inline-block;
margin-left: 5px;
}
.my-console {
outline: none;
border: none;
box-sizing: border-box;
font-size: 32px;
background: transparent;
color: #43b047;
width: 100%;
font-family: inherit;
}
.timer-modes {
text-align: center;
margin-top: 20px;
font-weight: bold;
font-size: 12px;
}
.timer-mode {
margin-bottom: 10px;
}
</style>
<!-- lost timer object -->
<script src="js/lost-timer.js"></script>
<script>
$( function() { // doc ready
// get url params
var urlParams = new URLSearchParams( window.location.search );
// get seconds from url
var seconds = urlParams.get( 'seconds' ) ? urlParams.get( 'seconds' ) : 60 * 108;
var timer = new lostTimer( { // create timer
initialSeconds: parseInt( seconds ), // initial seconds to begin the timer at
mode: urlParams.get( 'mode' ), // specify mode of dev|live
height: $( window ).width() > 700 ? 200 : 70, // specify the height of the timer
onTick: function() { // do things on each tick of the countdown
if ( timer.totalSeconds <= 240 && timer.totalSeconds > 0 ) { // enable numbers input and focus on input
$( '.my-console' ).prop( 'disabled', false );
$( '.my-console' ).focus();
} else { // disable the input
$( '.my-console' ).prop( 'disabled', true );
$( '.my-console' ).val( '' );
}
}
} );
$( '.my-console' ).on( 'keyup', function( e ) { // on keyup for console input
timer.playAudio( 'keypress' );
if ( e.keyCode == 13 && timer.theNumbersString == $( this ).val() ) { // enter key was pressed and numbers are correct
// clear, disable, and reset timer
$( '.my-console' ).val( '' );
$( '.my-console' ).prop( 'disabled', true );
timer.reset();
}
} );
} );
</script>
</head>
<body>
<div class="my-timer-container">
<div class="lost-timer">
</div>
</div>
<div class="console-container">
<div class="console-prompt">
>:
</div>
<div class="console-input">
<input type="text" class="my-console" />
</div>
</div>
<div class="timer-modes">
<div class="timer-mode">
<a href="?mode=dev">
Dev Mode
</a>
</div>
<div class="timer-mode">
<a href="?mode=live">
Live Mode
</a>
</div>
</div>
</body>
</html>