-
Notifications
You must be signed in to change notification settings - Fork 61
/
index.html
114 lines (97 loc) · 4.69 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
<!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>DEV - html-duration-picker.js</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1"><!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.css"
crossorigin="anonymous">
<script>
const fakeSubmit = form => {
const formData = new FormData(document.querySelector('form'))
for (var pair of formData.entries()) {
console.log(pair[0] + ': ' + pair[1]);
}
return false;
}
</script>
<body style="padding:20px">
<h2>Development Live Preview MODE</h2>
<form onsubmit="return fakeSubmit(this)">
<hr>
Regular Input box <br><code><input type="text"></code><br>
<input type="text" name="input1">
<br><br>
Duration Input box
<br><code><input type="text" class="html-duration-picker" ></code><br>
<input type="text" id="first_picker" name="picker1" class="html-duration-picker">
<br> <br><button type="submit">Test Submit</button>
</form>
<br>
Duration Input box with constraints. Max 200:00:00<br>
<br><code><input type="text" class="html-duration-picker" data-duration-max="200:00:00" ></code>
<br> <input type="text" class="html-duration-picker" data-duration-max="200:00:00">
<br>
<br>
Duration Input box with constraints. Max 00:31:05, min 00:30:00<br>
<br><code><input type="text" class="html-duration-picker" data-duration="00:29:50" data-duration-min="00:30:10" data-duration-max="00:31:05" ></code>
<br>
<input type="text" class="html-duration-picker" data-duration="00:29:50" data-duration-min="00:30:10"
data-duration-max="00:31:05">
<br>
<br>
<div class="row">
<div class="col-12">
Bootstrap Input box
<br><code><input type="text" class="form-control"></code><br>
</div>
<div class="col-md-2">
<input type="text" class="form-control"><br>
</div>
<div class="col-12">
Bootstrap Duration Input box
<br><code><input type="text" class="form-control html-duration-picker" ></code><br>
</div>
<div class="col-md-2">
<input type="text" class="form-control html-duration-picker">
<br><br>
</div>
</div>
<br>
Sized Input box <br><code><input type="text" size="12" ></code><br>
<input type="text" size="12"><br>
Sized Duration Input box
<br><code><input type="text" size="12" html-duration-picker></code><br>
<input type="text" class="html-duration-picker" size="12">
<br>
Sized Duration Input box
<br><code><input type="text" data-hide-seconds size="12" html-duration-picker></code><br>
<input type="text" class="html-duration-picker" data-hide-seconds size="12">
<br>
<br><br>
Duration Input with Invalid Value
<br><code><input type="text" value="abcd" class="html-duration-picker" ></code><br>
<input type="text" value="abcd" class="html-duration-picker">
<br><br>
Duration Input with valid Value
<br><code><input type="text" value="00:12:34" class="html-duration-picker" ></code><br>
<input type="text" value="00:12:34" class="html-duration-picker">
<br><br>
Duration Input with valid Value and data duration
<br><code><input type="text" data-duration="56:43:21" value="00:12:34" class="html-duration-picker" ></code><br>
<input type="text" value="00:12:34" data-duration="56:43:21" class="html-duration-picker">
<script>
const demoBox = document.getElementById('first_picker');
demoBox.addEventListener('change', e => console.log('changed', e))
demoBox.addEventListener('input', e => console.log('input', e))
</script>
<script src="html-duration-picker.js"></script>
</body>
</html>