-
Notifications
You must be signed in to change notification settings - Fork 643
/
index.html
376 lines (367 loc) · 12 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
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
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>Timepicker for jQuery – Demos and Documentation</title>
<meta name="description" content="A lightweight, customizable jQuery timepicker plugin inspired by Google Calendar. Add a user-friendly javascript timepicker dropdown to your app in minutes." />
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script type="text/javascript" src="jquery.timepicker.js"></script>
<link rel="stylesheet" type="text/css" href="jquery.timepicker.css" />
<script type="text/javascript" src="documentation-assets/bootstrap-datepicker.js"></script>
<link rel="stylesheet" type="text/css" href="documentation-assets/bootstrap-datepicker.css" />
<script type="text/javascript" src="documentation-assets/site.js"></script>
<link rel="stylesheet" type="text/css" href="documentation-assets/site.css" />
</head>
<body>
<header>
<h1><a href="https://github.com/jonthornton/jquery-timepicker">jquery.timepicker</a></h1>
<p class="body-text">
A lightweight, customizable javascript timepicker plugin for jQuery inspired by Google Calendar.
</p>
<ul id="header-links">
<li><a href="https://github.com/jonthornton/jquery-timepicker#timepicker-plugin-for-jquery">Documentation</a></li>
<li><a href="https://github.com/jonthornton/jquery-timepicker">Source code on GitHub</a></li>
<li><a href="https://github.com/jonthornton/jquery-timepicker/zipball/master">Download (zip)</a></li>
<li><a href="https://github.com/jonthornton/jquery-timepicker/issues?state=open">Help</a></li>
</ul>
</header>
<section>
<p class="body-text">Use this plugin to unobtrusively add a timepicker dropdown to your forms. It's lightweight (2.7kb minified and gzipped) and easy to customize.</p>
</section>
<section id="examples">
<article>
<div class="demo">
<h2>Basic Example</h2>
<p>
<input id="basicExample" type="text" class="time" />
</p>
</div>
<script>
$(function() {
$('#basicExample').timepicker();
});
</script>
<pre class="code" data-language="javascript">$('#basicExample').timepicker();</pre>
</article>
<article>
<div class="demo">
<h2>Scroll Default Example</h2>
<p>Set the scroll position to local time if no value selected.</p>
<p>
<input id="scrollDefaultExample" type="text" class="time" />
</p>
</div>
<script>
$(function() {
$('#scrollDefaultExample').timepicker({ 'scrollDefault': 'now' });
});
</script>
<pre class="code" data-language="javascript">$('#scrollDefaultExample').timepicker({ 'scrollDefault': 'now' });</pre>
</article>
<article>
<div class="demo">
<h2>Set Time Example</h2>
<p>Dynamically set the time using a Javascript Date object.</p>
<p>
<input id="setTimeExample" type="text" class="time" />
<button id="setTimeButton">Set current time</button>
</p>
</div>
<script>
$(function() {
$('#setTimeExample').timepicker();
$('#setTimeButton').on('click', function() {
$('#setTimeExample').timepicker('setTime', new Date());
});
});
</script>
<pre class="code" data-language="javascript">$('#setTimeExample').timepicker();
$('#setTimeButton').on('click', function (){
$('#setTimeExample').timepicker('setTime', new Date());
});</pre>
</article>
<article>
<div class="demo">
<h2>Duration Example</h2>
<p>Set a starting time and see duration from that starting time. You can optionally set an maxTime as well.</p>
<p>
<input id="durationExample" type="text" class="time" />
</p>
</div>
<script>
$(function() {
$('#durationExample').timepicker({
'minTime': '2:00pm',
'maxTime': '11:30pm',
'showDuration': true
});
});
</script>
<pre class="code" data-language="javascript">$('#durationExample').timepicker({
'minTime': '2:00pm',
'maxTime': '11:30pm',
'showDuration': true
});</pre>
</article>
<article>
<div class="demo">
<h2>Event Example</h2>
<p>Trigger an event after selecting a value. Fires before the input onchange event.</p>
<p>
<input id="onselectExample" type="text" class="time" />
<span id="onselectTarget" style="margin-left: 30px;"></span>
</p>
</div>
<script>
$(function() {
$('#onselectExample').timepicker();
$('#onselectExample').on('changeTime', function() {
$('#onselectTarget').text($(this).val());
});
});
</script>
<pre class="code" data-language="javascript">$('#onselectExample').timepicker();
$('#onselectExample').on('changeTime', function() {
$('#onselectTarget').text($(this).val());
});</pre>
</article>
<article>
<div class="demo">
<h2>DisableTimeRanges Example</h2>
<p>Prevent selection of certain time values.</p>
<p>
<input id="disableTimeRangesExample" type="text" class="time" />
</p>
</div>
<script>
$(function() {
$('#disableTimeRangesExample').timepicker({ 'disableTimeRanges': [
['1am', '2am'],
['3am', '4:01am']
] });
});
</script>
<pre class="code" data-language="javascript">$('#disableTimeRangesExample').timepicker({
'disableTimeRanges': [
['1am', '2am'],
['3am', '4:01am']
]
});</pre>
</article>
<article>
<div class="demo">
<h2>noneOption Example</h2>
<p>Custom options can be added to the dropdown menu.</p>
<p>
<input id="noneOptionExample" type="text" class="time" />
</p>
</div>
<script>
$(function() {
$('#noneOptionExample').timepicker({
'noneOption': [{
'label': 'Foobar',
'className': 'shibby',
'value': 'oh hai'
},
'Foobar2'
]
});
});
</script>
<pre class="code" data-language="javascript">
$('#noneOptionExample').timepicker({
'noneOption': [
{
'label': 'Foobar',
'className': 'shibby',
'value': 'oh hai'
},
'Foobar2'
]
});
</pre>
</article>
<article>
<div class="demo">
<h2>timeFormat Example</h2>
<p>timepicker.jquery uses the time portion of <a href="http://php.net/manual/en/function.date.php">PHP's date formatting commands</a>.</p>
<p>
<input id="timeformatExample1" type="text" class="time" />
<input id="timeformatExample2" type="text" class="time" />
</p>
</div>
<script>
$(function() {
$('#timeformatExample1').timepicker({ 'timeFormat': 'H:i:s' });
$('#timeformatExample2').timepicker({ 'timeFormat': 'h:i A' });
});
</script>
<pre class="code" data-language="javascript">$('#timeformatExample1').timepicker({ 'timeFormat': 'H:i:s' });
$('#timeformatExample2').timepicker({ 'timeFormat': 'h:i A' });</pre>
</article>
<article>
<div class="demo">
<h2>Step Example</h2>
<p>Generate drop-down options with varying levels of precision.</p>
<p>
<input id="stepExample1" type="text" class="time" />
<input id="stepExample2" type="text" class="time" />
</p>
</div>
<script>
$(function() {
$('#stepExample1').timepicker({ 'step': 15 });
$('#stepExample2').timepicker({
'step': function(i) {
return (i % 2) ? 15 : 45;
}
});
});
</script>
<pre class="code" data-language="javascript">$('#stepExample1').timepicker({ 'step': 15 });
$('#stepExample2').timepicker({
'step': function(i) {
return (i%2) ? 15 : 45;
}
});</pre>
</article>
<article>
<div class="demo">
<h2>forceRoundTime Example</h2>
<p>jquery-timepicker allows entering times via the keyboard. Setting forceRoundTime to true will round the entered time to the nearest option on the dropdown list.</p>
<p>
<input id="roundTimeExample" type="text" class="time" /> </p>
</div>
<script>
$(function() {
$('#roundTimeExample').timepicker({ 'forceRoundTime': true });
});
</script>
<pre class="code" data-language="javascript">$('#roundTimeExample').timepicker({ 'forceRoundTime': true });</pre>
</article>
<article>
<div class="demo">
<h2>Select Example</h2>
<p>jquery-timepicker can render itself as a select element too.</p>
<p>
<input id="selectExample" class="time" name="foo" />
<button id="selectButton">Toggle</button>
</p>
</div>
<script>
$(function() {
$('#selectExample').timepicker();
$('#selectButton').click(function(e) {
$('#selectExample').timepicker('option', { useSelect: true });
$(this).hide();
});
});
</script>
<pre class="code" data-language="javascript">$('#selectExample').timepicker();
$('#selectButton').click(function(e) {
$('#selectExample').timepicker('option', { useSelect: true });
$(this).hide();
});</pre>
</article>
<article>
<div class="demo">
<h2>Non-input Example</h2>
<p>jquery-timepicker can be bound to any visibile DOM element, such as spans or divs.</p>
<p><span id="spanExampleTarget" style="background:#f00; padding:0 10px; margin-right:100px;"></span>
<span id="spanExampleDisplay" style=""></span>
<button id="openSpanExample">Pick Time</button>
</p>
</div>
<script>
$(function() {
$('#spanExampleTarget').timepicker()
$('#spanExampleTarget').on('changeTime', function(e){
console.log($('#spanExampleTarget').timepicker('getTime'));
});
$('#openSpanExample').on('click', function() {
$('#spanExampleTarget').timepicker('show');
});
});
</script>
<pre class="code" data-language="javascript">$('#spanExampleTarget').timepicker()
$('#spanExampleTarget').on('changeTime', function(e){
console.log($('#spanExampleTarget').timepicker('getTime'));
});
$('#openSpanExample').on('click', function() {
$('#spanExampleTarget').timepicker('show');
});</pre>
</article>
<article>
<div class="demo">
<h2>Datepair Plugin Example</h2>
<p>jquery-timepicker is designed to work with the <a href="http://jonthornton.github.com/Datepair.js">jquery-datepair plugin</a>.
<p id="datepairExample">
<input type="text" class="date start" />
<input type="text" class="time start" /> to
<input type="text" class="time end" />
<input type="text" class="date end" />
</p>
</div>
<script src="https://jonthornton.github.io/Datepair.js/dist/datepair.js"></script>
<script src="https://jonthornton.github.io/Datepair.js/dist/jquery.datepair.js"></script>
<script>
$('#datepairExample .time').timepicker({
'showDuration': true,
'timeFormat': 'g:ia'
});
$('#datepairExample .date').datepicker({
'format': 'm/d/yyyy',
'autoclose': true
});
$('#datepairExample').datepair();
</script>
<pre class="code" data-language="javascript">
<p id="datepairExample">
<input type="text" class="date start" />
<input type="text" class="time start" /> to
<input type="text" class="time end" />
<input type="text" class="date end" />
</p>
<script type="text/javascript" src="datepair.js"></script>
<script type="text/javascript" src="jquery.datepair.js"></script>
<script>
// initialize input widgets first
$('#datepairExample .time').timepicker({
'showDuration': true,
'timeFormat': 'g:ia'
});
$('#datepairExample .date').datepicker({
'format': 'yyyy-m-d',
'autoclose': true
});
// initialize datepair
$('#datepairExample').datepair();
</script></pre>
</article>
</section>
<section>
<h2>Need Help?</h2>
<p>Check <a href="https://github.com/jonthornton/jquery-timepicker#timepicker-plugin-for-jquery">the documentation</a> or <a href="https://github.com/jonthornton/jquery-timepicker/issues?state=open">submit an issue</a> on GitHub.</p>
</section>
<footer>
<p>© 2014 <a href="http://jonthornton.com">Jon Thornton</a></p>
</footer>
<script>
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-15605525-4', 'auto');
ga('send', 'pageview');
</script>
</div>
</body>
</html>