-
Notifications
You must be signed in to change notification settings - Fork 31
/
index.html
364 lines (339 loc) · 9.15 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery Schedule v2.2.0 Demo</title>
<meta name="description" content="A schedule management with jQuery.">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" href="dist/jquery.schedule.css">
<link rel="stylesheet" href="dist/jquery.schedule-demo.css">
</head>
<body>
<header>
<nav class="navbar navbar-dark bg-dark mb-3">
<h1 class="navbar-brand mb-0">jQuery Schedule Demo v2.2.0</h1>
</nav>
</header>
<main>
<div class="container">
<div class="row">
<div class="col">
<h2>Basic</h2>
<pre class="p-2 mb-3">$('#schedule').jqs();</pre>
</div>
</div>
<div class="row">
<div class="col">
<div id="schedule" class="jqs-demo mb-3"></div>
</div>
</div>
<div class="row">
<div class="col">
<h2>Read mode</h2>
</div>
</div>
<div class="row">
<div class="col-lg-8">
<div id="schedule2" class="jqs-demo mb-3"></div>
</div>
<div class="col-lg-4">
<pre class="p-2 mb-3 large">
$('#schedule2').jqs({
mode: 'read',
data: [
{
day: 0,
periods: [
['20:00', '00:00'],
['20:00', '22:00'], // Invalid period, not displayed
['00:00', '02:00']
]
}, {
day: 3,
periods: [
['00:00', '08:30'],
['09:00', '12:00']
]
}
]
});
</pre>
</div>
</div>
<div class="row">
<div class="col">
<h2>Events & Methods</h2>
</div>
</div>
<div class="row">
<div class="col">
<div class="btn-group mb-3">
<button type="button" class="btn btn-primary" id="export">Export</button>
<button type="button" class="btn btn-primary" id="import">Import</button>
<button type="button" class="btn btn-warning" id="reset">Reset</button>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-8">
<div id="schedule3" class="jqs-demo mb-3"></div>
</div>
<div class="col-lg-4">
<pre class="p-2 mb-3 large">
$('#schedule3').jqs({
onInit: function () {
$('#logs').val('onInit fire !\n' + $('#logs').val());
},
onAddPeriod: function () {
$('#logs').val('onAddPeriod fire !\n' + $('#logs').val());
},
onRemovePeriod: function () {
$('#logs').val('onRemovePeriod fire !\n' + $('#logs').val());
},
onDuplicatePeriod: function () {
$('#logs').val('onDuplicatePeriod fire !\n' + $('#logs').val());
},
onClickPeriod: function () {
$('#logs').val('onClickPeriod fire !\n' + $('#logs').val());
}
});
$('#schedule3').jqs('export');
$('#schedule3').jqs('import', [
{
day: 1,
periods: [
['8:00', '10:00'] // Compact
]
}, {
day: 2,
periods: [
['20:00', '00:00'],
['20:00', '22:00'] // Invalid period, not displayed
]
}, {
day: 4,
periods: [
{ // Full
start: '10:00',
end: '12:00',
title: 'A black period',
backgroundColor: '#000',
borderColor: '#000',
textColor: '#fff'
}
]
}
]);
$('#schedule3').jqs('reset');
</pre>
</div>
</div>
<div class="row">
<div class="col-lg-6">
<label for="result">Result :</label>
<textarea id="result" class="mb-3"></textarea>
</div>
<div class="col-lg-6">
<label for="logs">Logs :</label>
<textarea id="logs" class="mb-3"></textarea>
</div>
</div>
<div class="row">
<div class="col">
<h2>Custom periods and days</h2>
</div>
</div>
<div class="row">
<div class="col-lg-8">
<div id="schedule4" class="jqs-demo mb-3"></div>
</div>
<div class="col-lg-4">
<pre class="p-2 mb-3 large">
$('#schedule4').jqs({
days: 5,
periodColors: [
['rgba(0, 0, 0, 0.5)', '#000', '#fff'],
['rgba(200, 0, 0, 0.5)', '#f00', '#000'],
['rgba(0, 200, 0, 0.5)', '#0f0', '#000'],
['rgba(0, 0, 200, 0.5)', '#00f', '#000']
],
periodTitle: 'No title',
periodBackgroundColor: 'rgba(0, 0, 0, 0.5)',
periodBorderColor: '#000',
periodTextColor: '#fff',
periodRemoveButton: 'Remove please !',
periodTitlePlaceholder: 'A custom title'
});
</pre>
</div>
</div>
<div class="row">
<div class="col">
<h2>Translation & 12-hour clock</h2>
</div>
</div>
<div class="row">
<div class="col-lg-8">
<div id="schedule5" class="jqs-demo mb-3"></div>
</div>
<div class="col-lg-4">
<pre class="p-2 mb-3 large">
$('#schedule5').jqs({
mode: 'edit',
daysList: ['Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi', 'Dimanche'],
hour: 12,
periodDuration: 15,
periodOptions: false,
data: [
{
day: 0,
periods: [
['2', '6'], // Compact 12 hour
['10pm', '12am'],
['12am', '2:30am'] // Invalid period, not displayed
]
}, {
day: 1,
periods: [
['1:45am', '5:15am']
]
}, {
day: 2,
periods: [
['2', '2p'] // Compact 12 hour
]
}
]
});
</pre>
</div>
</div>
</div>
</main>
<footer>
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<script src="dist/jquery.schedule.js"></script>
<script>
$(function () {
$('#schedule').jqs();
$('#schedule2').jqs({
mode: 'read',
data: [
{
day: 0,
periods: [
['20:00', '00:00'],
['20:00', '22:00'], // Invalid period, not displayed
['00:00', '02:00']
]
}, {
day: 3,
periods: [
['00:00', '08:30'],
['09:00', '12:00']
]
}]
});
$('#schedule3').jqs({
onInit: function () {
$('#logs').val('onInit fire !\n' + $('#logs').val());
},
onAddPeriod: function () {
$('#logs').val('onAddPeriod fire !\n' + $('#logs').val());
},
onRemovePeriod: function () {
$('#logs').val('onRemovePeriod fire !\n' + $('#logs').val());
},
onDuplicatePeriod: function () {
$('#logs').val('onDuplicatePeriod fire !\n' + $('#logs').val());
},
onClickPeriod: function () {
$('#logs').val('onClickPeriod fire !\n' + $('#logs').val());
}
});
$('#schedule4').jqs({
days: 5,
periodColors: [
['rgba(0, 0, 0, 0.5)', '#000', '#fff'],
['rgba(200, 0, 0, 0.5)', '#f00', '#000'],
['rgba(0, 200, 0, 0.5)', '#0f0', '#000'],
['rgba(0, 0, 200, 0.5)', '#00f', '#000']
],
periodTitle: 'No title',
periodBackgroundColor: 'rgba(0, 0, 0, 0.5)',
periodBorderColor: '#000',
periodTextColor: '#fff',
periodRemoveButton: 'Remove please !',
periodTitlePlaceholder: 'A custom title'
});
$('#schedule5').jqs({
mode: 'edit',
daysList: ['Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi', 'Dimanche'],
hour: 12,
periodDuration: 15,
periodOptions: false,
data: [
{
day: 0,
periods: [
['2', '6'], // Compact 12 hour
['10pm', '12am'],
['12am', '2:30am'] // Invalid period, not displayed
]
}, {
day: 1,
periods: [
['1:45am', '5:15am']
]
}, {
day: 2,
periods: [
['2', '2p'] // Compact 12 hour
]
}
]
});
$('#export').click(function () {
$('#result').val($('#schedule3').jqs('export'));
});
$('#import').click(function () {
var ret = $('#schedule3').jqs('import', [
{
day: 1,
periods: [
['8:00', '10:00'] // Compact
]
}, {
day: 2,
periods: [
['20:00', '00:00'],
['20:00', '22:00'] // Invalid period, not displayed
]
}, {
day: 4,
periods: [
{ // Full
start: '10:00',
end: '12:00',
title: 'A black period',
backgroundColor: '#000',
borderColor: '#000',
textColor: '#fff'
}
]
}
]);
$('#result').val(ret);
});
$('#reset').click(function () {
$('#schedule3').jqs('reset');
$('#result').val('');
});
});
</script>
</body>
</html>