-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
215 lines (194 loc) · 8.52 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
212
213
214
215
<html>
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>BigClock</title>
<meta name="description" content="Simple clock">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"> -->
<link rel="stylesheet" href="bootstrap.min.css">
<script type="text/javascript">
colonVisible = false;
styles = ["darkred", "gray", "purple", "lime", "navy", "#1c1c1c", "fuchsia", "white", "yellow", "orange"];
currentStyle = 0;
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) +
min; //The maximum is exclusive and the minimum is inclusive
}
function randomColor() {
return '#' + (Math.random() * 0xFFFFFF << 0).toString(16);
}
function pastelColor() {
var r = (Math.round(Math.random() * 127) + 127).toString(16);
var g = (Math.round(Math.random() * 127) + 127).toString(16);
var b = (Math.round(Math.random() * 127) + 127).toString(16);
return '#' + r + g + b;
}
function rainbowColor(numOfSteps, step) {
// This function generates vibrant, "evenly spaced" colours (i.e. no clustering). This is ideal for creating easily distinguishable vibrant markers in Google Maps and other apps.
// Adam Cole, 2011-Sept-14
// HSV to RBG adapted from: http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript
var r, g, b;
var h = step / numOfSteps;
var i = ~~(h * 6);
var f = h * 6 - i;
var q = 1 - f;
switch (i % 6) {
case 0:
r = 1;
g = f;
b = 0;
break;
case 1:
r = q;
g = 1;
b = 0;
break;
case 2:
r = 0;
g = 1;
b = f;
break;
case 3:
r = 0;
g = q;
b = 1;
break;
case 4:
r = f;
g = 0;
b = 1;
break;
case 5:
r = 1;
g = 0;
b = q;
break;
}
var c = "#" + ("00" + (~~(r * 255)).toString(16)).slice(-2) + ("00" + (~~(g * 255)).toString(16)).slice(
-2) + ("00" + (~~(b * 255)).toString(16)).slice(-2);
return (c);
}
window.onclick = function changeStyle() {
var next = currentStyle % styles.length;
// if (document.getElementById("preset").checked) {
// document.getElementById('time').style["color"] = styles[next];
// currentStyle++;
// console.log("preset");
// } else if (document.getElementById("random").checked) {
// document.getElementById('time').style["color"] = randomColor();
// console.log("random");
// } else if (document.getElementById("rainbow").checked) {
// document.getElementById('time').style["color"] = rainbowColor(16, getRandomInt(1, 16));
// console.log("rainbow");
// } else if (document.getElementById("pastel").checked) {
// document.getElementById('time').style["color"] = pastelColor();
// console.log("pastel");
// }
var colorSchemeSelector = document.getElementById("colorScheme");
switch (colorSchemeSelector.selectedIndex) {
case 0:
document.getElementById('time').style["color"] = styles[next];
currentStyle++;
console.log("preset");
break;
case 1:
document.getElementById('time').style["color"] = randomColor();
console.log("random");
break;
case 2:
document.getElementById('time').style["color"] = rainbowColor(16, getRandomInt(1, 16));
console.log("rainbow");
break;
case 3:
document.getElementById('time').style["color"] = pastelColor();
console.log("pastel");
break;
}
}
window.onload = function updateClock() {
var now = new Date(),
time = "";
if (now.getHours() < 10) {
time = time.concat("0");
}
time = time.concat(now.getHours());
time = time.concat(":");
if (now.getMinutes() < 10) {
time = time.concat("0");
}
time = time.concat(now.getMinutes());
document.getElementById('time').innerHTML = time;
document.title = time;
setTimeout(updateClock, 1000);
}
function toggleSettings() {
var x = document.getElementById("settings");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
</script>
</head>
<body id="background" class="container-fluid" style="background-color: black">
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<div class="row fixed-top">
<div id="background" style="font-size: 33vw; color: darkred; font-family: monospace; user-select: none;">
<p id="time" class="text-justify">HELLO</p>
</div>
</div>
<div class="tools fixed-bottom">
<button type="button" class="btn btn-outline-secondary m-3" onclick="toggleSettings()">Toggle Settings</button>
<div class="form-group p-3" id="settings">
<label for="colorScheme">Color scheme</label>
<select id="colorScheme" class="form-control">
<option>Preset</option>
<option>Random</option>
<option>Rainbow</option>
<option>Pastel</option>
</select>
</div>
</div>
<!--
<div class="fixed-bottom">
<form class="mx-auto p-3">
<div class="radio form-check form-check-inline">
<label><input type="radio" name="generator" id="preset" style="color: white" checked>preset (10)</label>
</div>
<div class="radio form-check form-check-inline">
<label><input type="radio" name="generator" id="random" style="color: white">random</label>
</div>
<div class="radio form-check form-check-inline">
<label><input type="radio" name="generator" id="rainbow" style="color: white">rainbow (16)</label>
</div>
<div class="radio form-check form-check-inline ">
<label><input type="radio" name="generator" id="pastel" style="color: white">pastel</label>
</div>
</form>
</div> -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"
integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous">
</script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"
integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous">
</script>
</body>
</html>
</html>