-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_1.html
executable file
·470 lines (365 loc) · 11.1 KB
/
index_1.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
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Cube Timer</title>
<link href="display.css" rel="stylesheet"/>
<link href="timer.css" rel="stylesheet"/>
<script src="keystrokes.js" type="text/javascript"></script>
<style type="text/css">
window,body{
margin 10px;
font-family:Arial, Helvetica, sans-serif;
}
#bg{
position:absolute;
top:0;
right:0;
bottom:0;
left:0;
z-index:0;
background: #2b519c;
background: -moz-linear-gradient(-45deg, #2b519c 0%, #6c95cb 30%, #2b358a 70%, #4b5eab 100%);
background: -webkit-gradient(linear, left top, right bottom, color-stop(0%,#2b519c), color-stop(30%,#6c95cb), color-stop(70%,#2b358a), color-stop(100%,#4b5eab));
background: -webkit-linear-gradient(-45deg, #2b519c 0%,#6c95cb 30%,#2b358a 70%,#4b5eab 100%);
background: -o-linear-gradient(-45deg, #2b519c 0%,#6c95cb 30%,#2b358a 70%,#4b5eab 100%);
background: -ms-linear-gradient(-45deg, #2b519c 0%,#6c95cb 30%,#2b358a 70%,#4b5eab 100%);
background: linear-gradient(135deg, #2b519c 0%,#6c95cb 30%,#2b358a 70%,#4b5eab 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2b519c', endColorstr='#4b5eab',GradientType=1 );
}
@font-face{
font-family: "DSDIGI";
src: url('http://fontsforweb.com/public/fonts/1091/DSDIGI.eot');
src: local("DS-Digital"), url('http://fontsforweb.com/public/fonts/1091/DSDIGI.ttf') format("truetype");
}
.fontsforweb_fontid_1091 {
font-family: "DSDIGI";
}
@font-face{
font-family: "LCD2U";
src: url('http://fontsforweb.com/public/fonts/525/LCD2U.eot');
src: local("LCD2 Ultra"), url('http://fontsforweb.com/public/fonts/525/LCD2U.ttf') format("truetype");
}
.fontsforweb_fontid_525 {
font-family: "LCD2U";
}
.a{
box-shadow:
0px -2px 0px rgba(255,255,255,0.25),
inset 0px 3px 2px rgba(0,0,0,0.25),
inset 0px -3px 2px rgba(0,0,0,1);
border:1px solid #86A0B1;
box-shadow: inset 0px -50px 100px rgba(0,0,0,0.25);
}
.flip-h {
-moz-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
-o-transform: scaleX(-1);
transform: scaleX(-1);
-ms-filter: fliph; /*IE*/
filter: fliph; /*IE*/
}
.flip-v {
-moz-transform: scaleY(-1);
-webkit-transform: scaleY(-1);
-o-transform: scaleY(-1);
transform: scaleY(-1);
-ms-filter: flipv; /*IE*/
filter: flipv; /*IE*/
}
.led{
width: 10px;
height: 10px;
border-radius: 12px;
border: 2px outset rgba(0,0,0,0.5);
box-shadow:
inset 0px -1px 3px rgba(0,0,0,0.5),
inset 0px 3px 3px rgba(255,255,255,0.0),
0px -1px 1px rgba(255,255,255,0.5),
0px 1px 1px rgba(0,0,0,0.5);
}
.led.red{
background-color:#400;
}
.led.red.on{
background-color:#F44;
}
.led.green{
background-color:#040;
}
.led.green.on{
background-color:#4F4;
}
.buttonbevel{
box-shadow: inset 0px 6px 2px rgba(255,255,255,0.2),/*top shadow*/
inset 0px -6px 8px rgba(0,0,0,0.5), /*bottom shadow*/
0px -2px 1px rgba(255,255,255,0.5),/*top shadow*/
0px 2px 1px rgba(0,0,0,0.5);
border-radius: 100%;
text-align:center;
color: #C1BFB4;
}
.hand path{
fill:#DFCF51;
}
.hand circle{
fill: none;
}
.a:hover .hand path, .a.hover .hand path{
fill: #DFCF51;
}
.a:hover .hand circle, .a.hover .hand circle{
fill: #FFF;
}
.a:active .hand path, .a.active .hand path{
fill: #000;
}
.a:active .hand circle, .a.active .hand circle{
fill: #FFF;
}
.a:active, .a.active{
box-shadow: inset 0 0 80px rgba(0,0,0,0.75);
}
svg{
display:inline-block;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<div id="bg"></div>
<div id="display">
<div id="displayBg">
<div id="displayShadow">8:88.888</div>
<div id="displayText">0.000</div>
</div>
</div>
<div id="timer">
<div id="leftPad" class="a">
<svg class="hand" version="1.1">
<circle cx="51" cy="51" r="48"/>
<path class="hand" d="M50,0C22.385,0,0,22.385,0,50c0,27.614,22.385,50,50,50c27.614,0,50-22.386,50-50C100,22.385,77.614,0,50,0z
M56.454,13.875c0-3.627,4.963-3.565,4.89-0.113l0.073,30.91c-1.825-0.51-3.362-0.64-4.963-0.75V13.875z M46.999,8.819
c0-3.627,4.962-3.566,4.89-0.114l0.072,35.326c-1.643-0.258-2.796-0.38-4.962-0.113V8.819z M37.753,11.237
c0-3.627,4.962-3.565,4.891-0.113l0.072,32.893c-1.896-0.011-2.899,0.194-4.962,0.898V11.237z M28.949,20.689
c0-3.627,4.963-3.565,4.891-0.113l0.072,25.522c-1.896-0.01-3.394,0.557-4.963,1.968V20.689z M40.234,71.014
c0,3.023,0,10.387,0,10.387c0,5.384-8.598,7.549-11.285-0.33c-2.173-6.375-1.896-8.05-2.064-10.881
c-0.761-12.83,0.854-19.784,13.604-21.623c2.323-0.335,13.412-0.5,16.528-0.5c5.95,0,8.371,1.79,5.829,7.944
c-1.802,4.366-5.521,2.735-6.392,2.748C42.208,58.978,40.234,67.344,40.234,71.014z M64.924,86.566
c-6.855,3.844-21.315,3.627-20.868-8.134c0.187-4.895,0.979-15.057,12.398-15.057c1.911,0,5.684,0.912,7.491,1.539
c3.275,1.137,4.347,3.408,7.717-1.539c2.258-3.314,8.451-10.695,12.39-10.111c4.456,0.659,2.141,4.672,1.548,5.781
C80.465,68.651,75.9,80.411,64.924,86.566z"/>
</svg>
</div>
<div id="rightPad" class="a">
<svg class="hand" version="1.1">
<circle cx="51" cy="51" r="48" fill="none"/>
<path class="hand" transform="translate(50,50) scale(-1,1) translate(-50,-50)" d="M50,0C22.385,0,0,22.385,0,50c0,27.614,22.385,50,50,50c27.614,0,50-22.386,50-50C100,22.385,77.614,0,50,0z
M56.454,13.875c0-3.627,4.963-3.565,4.89-0.113l0.073,30.91c-1.825-0.51-3.362-0.64-4.963-0.75V13.875z M46.999,8.819
c0-3.627,4.962-3.566,4.89-0.114l0.072,35.326c-1.643-0.258-2.796-0.38-4.962-0.113V8.819z M37.753,11.237
c0-3.627,4.962-3.565,4.891-0.113l0.072,32.893c-1.896-0.011-2.899,0.194-4.962,0.898V11.237z M28.949,20.689
c0-3.627,4.963-3.565,4.891-0.113l0.072,25.522c-1.896-0.01-3.394,0.557-4.963,1.968V20.689z M40.234,71.014
c0,3.023,0,10.387,0,10.387c0,5.384-8.598,7.549-11.285-0.33c-2.173-6.375-1.896-8.05-2.064-10.881
c-0.761-12.83,0.854-19.784,13.604-21.623c2.323-0.335,13.412-0.5,16.528-0.5c5.95,0,8.371,1.79,5.829,7.944
c-1.802,4.366-5.521,2.735-6.392,2.748C42.208,58.978,40.234,67.344,40.234,71.014z M64.924,86.566
c-6.855,3.844-21.315,3.627-20.868-8.134c0.187-4.895,0.979-15.057,12.398-15.057c1.911,0,5.684,0.912,7.491,1.539
c3.275,1.137,4.347,3.408,7.717-1.539c2.258-3.314,8.451-10.695,12.39-10.111c4.456,0.659,2.141,4.672,1.548,5.781
C80.465,68.651,75.9,80.411,64.924,86.566z"/>
</svg>
</div>
<div id="centerTimer">
<div class="lcd">
<div>
<div>8:88.888</div>
<div id="lcdText">0.000</div>
</div>
</div>
<div class="buttonbevel" id="power">P</div>
<div class="buttonbevel" id="reset">R</div>
<div class="buttonbevel" id="save">S</div>
<div id="redLed" class="led red"></div>
<div id="greenLed" class="led green"></div>
<div class="buttonbevel" id="down">\/</div>
</div>
</div>
<script type="text/javascript">
/* JAVASCRIPT GOES HERE */
window.onload=function(){
ready=false;
running=false;
justStopped=false;
repeat=false;
leftPad=document.getElementById('leftPad');
rightPad=document.getElementById('rightPad');
lcd=document.getElementById('lcdText');
display=document.getElementById('displayText');
redLed=document.getElementById('redLed');
greenLed=document.getElementById('greenLed');
addEvent(leftPad,"mousedown",timerPushDown);
addEvent(leftPad,"mouseup",timerPushUp);
addEvent(rightPad,"mousedown",timerPushDown);
addEvent(rightPad,"mouseup",timerPushUp);
addEvent(document.body,"keydown",timerPushDown);
addEvent(document.body,"keyup",timerPushUp);
};
function timerPushDown(){
if(repeat) return;
repeat=true;
redLed.classList.add('on');
leftPad.classList.add('active');
rightPad.classList.add('active');
if(running){
timerStop();
justStopped=true;
}else{
arming=setTimeout(function(){ ready=true; greenLed.classList.add('on'); timerReset(); },570);
}
}
function timerPushUp(){
repeat=false;
leftPad.classList.remove('active');
rightPad.classList.remove('active');
if(ready==true && running==false && justStopped==false)
timerStart();
else
justStopped=false;
clearTimeout(arming);
ready=false;
redLed.classList.remove('on');
}
function timerStart(){
tBegin=new Date().getTime();
running=true;
//tMax=setTimeout(timerStop,36000000); //10min max
tMax=setTimeout(timerStop,6000); //10min max
timer=setInterval(function(){assyncDisplay(tBegin);} ,33);
blinkLed=setInterval(function(){
redLed.classList.toggle('on');
greenLed.classList.toggle('on');
},66);
}
function timerStop(){
if(running){
tEnd=new Date().getTime();
running=false;
assyncDisplay(tBegin,tEnd);
redLed.classList.remove('on');
greenLed.classList.remove('on');
clearInterval(timer);
clearTimeout(tMax);
clearInterval(blinkLed);
}
}
function timerReset(){
timerStop();
lcd.innerHTML="0.000";
display.innerHTML="0.000";
}
function assyncDisplay(tStart,tEnd){
if(tEnd==undefined){ tEnd=new Date().getTime(); }
var x = msToTime(tEnd-tStart);
lcd.innerHTML=x;
display.innerHTML=x;
}
function msToTime(milliseconds){
function padDigits(digits,num){
num=num.toString();
while(num.length<digits){
num='0'+num;
}
return(num);
}
var x=milliseconds;
var ms = (x%1000/10)<<0;
var s = ((x/1000) %60)<<0;
var m = ((x/1000/60) %60)<<0;
var h = ((x/1000/60/60) %24)<<0;
ms = padDigits(3,ms);
s = (m>0)?(padDigits(m>0?2:0,s)+"."):(s+".");
m = (m>0)?(padDigits((h>0)?2:0,m)+":"):("");
h = (h>0)?(padDigits(0,h)+":"):("");
return(h+m+s+ms);
}
var ClassTimer = function(){
var o=this;
this.running=false;
this.timeStart=0;
this.timeStop=0;
this.start=function(){
if(!o.running){
o.timeStart=new Date().getTime();
o.running=true;
}
}
this.stop=function(){
if(o.running){
o.timeStop=new Date().getTime();
o.running=false;
}
}
this.reset=function(){
o.timeStart=0;
o.timeStop=0;
}
this.getTime=function(){
if(o.timeStart>0 && o.timeStop>0){
return o.timeStop-o.timeStart;
}
else if(o.timeStart>0){
return new Date().getTime()-o.timeStart;
}
else{
return 0;
}
}
}
var Stopwatch = function(){
this.max;
this.interval=33;
this.running=false;
var tUpdater;
var tMax;
var Timer = new ClassTimer();
var o=this;
this.start=function(){
Timer.start();
tUpdater=setInterval(o.update,o.interval);
if(max>0) tMax=setTimeout(o.reset,o.max);
}
this.stop=function(){
Timer.stop();
clearInterval(tUpdater);
clearTimeout(tMax);
o.update(Timer.getTime());
}
this.reset=function(){
Timer.reset();
clearInterval(tUpdater);
clearTimeout(tMax);
o.update(Timer.getTime());
}
this.update = new Function();
function msToTime(milliseconds){
function padDigits(digits,num){
num=num.toString();
while(num.length<digits){
num='0'+num;
}
return(num);
}
var x=milliseconds;
var ms = (x%1000/10)<<0;
var s = ((x/1000) %60)<<0;
var m = ((x/1000/60) %60)<<0;
var h = ((x/1000/60/60) %24)<<0;
ms = padDigits(3,ms);
s = (m>0)?(padDigits(m>0?2:0,s)+"."):(s+".");
m = (m>0)?(padDigits((h>0)?2:0,m)+":"):("");
h = (h>0)?(padDigits(0,h)+":"):("");
return(h+m+s+ms);
}
}
</script>
</body>
</html>