-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathexample.html
111 lines (106 loc) · 2.95 KB
/
example.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
<html>
<head>
<title>Clock</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="build/build.css" type="text/css">
<style>
body {
font: 13px sans-serif;
padding: 3em;
}
.clock {
padding: 5px;
margin: 5px;
border: 1px solid #eee;
border-bottom: 1px solid #ddd;
border-radius: 5px;
box-shadow: 0 1px 2px #eee
}
.hour caption,
.minute caption {
font-weight: bold
}
.clock a {
display: block;
padding: 5px;
text-decoration: none;
color: inherit;
border-radius: 3px
}
.clock a:hover {
background: #efefef
}
.clock a:active {
opacity: .75;
}
.clock .selected {
background: none
}
.clock .selected a {
background: linear-gradient(#76aaef, #0085CC);
color: white;
box-shadow: inset 0 1px #2b8dea
}
.clock .invalid {
opacity: .2;
background-color: rgba(0, 0, 0, .2);
cursor: default;
}
.clock a {
display: block;
}
input {
width: 10em;
margin-right: 1em;
font-size: 1.3em;
}
</style>
</head>
<body>
<h1>Clock</h1>
<div id='standard'>
<h2>Unconstrained clock</h2>
<input class='time' placeholder='click on the clock...' readonly/>
<input class='time-complete' readonly/>
</div>
<div id='restricted'>
<h2>Standard restriction</h2>
<input class='time' placeholder='click on the clock...' readonly/>
<input class='time-complete' readonly/>
</div>
<div id='reversed' data-hours="Godziny" data-minutes="Minuty">
<h2>Reverse restriction</h2>
<input class='time' placeholder='click on the clock...' readonly/>
<input class='time-complete' readonly/>
</div>
<script src="build/build.js"></script>
<script>
var clocks = {};
function updateInput(section, selector, value) {
var str = '' + value.hour + ':' + value.minute;
section.querySelector(selector).value = str;
}
['standard', 'restricted', 'reversed'].forEach(function(name) {
var section = document.querySelector('#' + name);
var captions = section.dataset;
clocks[name] = new Clock({ captions: captions })
.on('change', function(value, complete) {
updateInput(section, ' .time', value);
if (complete) {
updateInput(section, ' .time-complete', value);
}
});
section.appendChild(clocks[name].el);
});
clocks.standard
.select({ hour: 14, minute: 23 });
clocks.restricted
.type('12')
.min({ hour: 11, minute: 42 })
.max({ hour: 22, minute: 15 });
clocks.reversed
.min({ hour: 18, minute: 15 })
.max({ hour: 10, minute: 45 })
</script>
</body>
</html>