-
Notifications
You must be signed in to change notification settings - Fork 285
/
index.html
248 lines (208 loc) · 5.8 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
<!DOCTYPE HTML>
<html lang="ru-RU">
<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="build/kalendae.css" type="text/css" charset="utf-8">
<!-- <script src="src/moment.js" type="text/javascript" charset="utf-8"></script>
<script src="build/kalendae.js" type="text/javascript" charset="utf-8"></script> -->
<script src="build/kalendae.standalone.js" type="text/javascript" charset="utf-8"></script>
<style type="text/css" media="screen">
.kalendae .k-days span.closed {
background:red;
}
</style>
</head>
<body>
<h1>Kalendae</h1>
<p>Single Select</p>
<script type="text/javascript" charset="utf-8">
new Kalendae(document.body, {
months:1,
mode:'single',
selected:Kalendae.moment().subtract({M:1})
});
new Kalendae({
attachTo:document.body,
months:2,
mode:'single',
selected:Kalendae.moment().subtract({M:1})
});
new Kalendae({
attachTo:document.body,
months:3,
mode:'single',
selected:Kalendae.moment().subtract({M:1})
});
</script>
<p>Range Select</p>
<script type="text/javascript" charset="utf-8">
new Kalendae(document.body, {
months:1,
mode:'range',
selected:[Kalendae.moment().subtract({M:1}), Kalendae.moment().add({M:1})]
});
new Kalendae({
attachTo:document.body,
months:2,
mode:'range',
selected:[Kalendae.moment().subtract({M:1}), Kalendae.moment().add({M:1})]
});
new Kalendae({
attachTo:document.body,
months:3,
mode:'range',
selected:[Kalendae.moment().subtract({M:1}), Kalendae.moment().add({M:1})]
});
</script>
<p>Multi-Select</p>
<script type="text/javascript" charset="utf-8">
new Kalendae(document.body, {
months:1,
mode:'multiple',
selected:[Kalendae.moment().subtract({M:1}), Kalendae.moment().add({M:1})]
});
new Kalendae({
attachTo:document.body,
months:2,
mode:'multiple',
selected:[Kalendae.moment().subtract({M:1}), Kalendae.moment().add({M:1})]
});
new Kalendae({
attachTo:document.body,
months:3,
mode:'multiple',
selected:[Kalendae.moment().subtract({M:1}), Kalendae.moment().add({M:1})]
});
</script>
<p>Month header day select (Multi-select)</p>
<script type="text/javascript" charset="utf-8">
var firstDay = Kalendae.moment().startOf('month').weekday(2),
secondDay = Kalendae.moment().startOf('month').weekday(4),
endMonth = Kalendae.moment().endOf('month');
selected = [];
while(firstDay <= endMonth) {
if (firstDay >= Kalendae.moment().startOf('month')) {
selected.push(firstDay.clone());
selected.push(secondDay.clone());
}
firstDay.add(7, 'd');
secondDay.add(7, 'd');
}
new Kalendae({
attachTo:document.body,
months:3,
mode:'multiple',
dayHeaderClickable: true,
selected: selected
});
</script>
<p>Week Select</p>
<script type="text/javascript" charset="utf-8">
new Kalendae(document.body, {
months:1,
mode:'week',
selected:Kalendae.moment().subtract({M:1})
});
new Kalendae({
attachTo:document.body,
months:2,
mode:'week',
selected:Kalendae.moment().subtract({M:1})
});
new Kalendae({
attachTo:document.body,
months:3,
mode:'week',
selected:Kalendae.moment().subtract({M:1})
});
</script>
<hr>
<p>Blackout and Direction Tests</p>
<script type="text/javascript" charset="utf-8">
//direction
new Kalendae(document.body, {
months:3,
direction:'future'
});
//direction
new Kalendae(document.body, {
months:3,
direction:'past'
});
//blackout
new Kalendae(document.body, {
blackout: function (date) {
return Kalendae.moment(date).date() % 2; //blackout every other day
}
});
//blackout AND direction
new Kalendae(document.body, {
direction:'future',
blackout: function (date) {
return [1,0,0,0,0,0,1][Kalendae.moment(date).day()]; //blackout weekends
}
});
</script>
<hr>
<p>End Date - Direction: future - Single Select</p>
<script type="text/javascript">
new Kalendae(document.body, {
months: 3,
direction: 'future',
endDate: Kalendae.moment().startOf('month').add(75, 'days')
});
</script>
<hr>
<p>Class Map Test</p>
<script type="text/javascript" charset="utf-8">
//direction
var classMap = [];
classMap[ Kalendae.moment().add({d:5}).format('YYYY-MM-DD') ] = 'closed';
new Kalendae(document.body, {
dateClassMap: classMap
});
</script>
<hr>
Click this input element: <input type="text" value="2/16/2012" id="input1">
<script type="text/javascript" charset="utf-8">
var k4 = new Kalendae.Input('input1', {
months:2
});
</script>
<hr>
Click this input element (Auto closes after selection): <input type="text" value="2/16/2012" id="input2">
<script type="text/javascript" charset="utf-8">
var k4 = new Kalendae.Input('input2', {
months:1,
closeOnSelection: true
});
</script>
<hr>
This calendar is auto-created.
<div class="auto-kal"></div>
<hr>
So is the one on this input.
<input type="text" class="auto-kal">
<hr>
<div style="width: 300px;height: 300px;overflow:scroll;border:1px solid black;">
Scroll down and left to find an input.
<div style="height:300px;"></div>
<div style="text-align: right;width: 600px;">
<input type="text" class="auto-kal">
</div>
</div>
<hr>
This calendar is auto-created with months: 3 and direction: 'future'.
<div class="auto-kal" data-kal="months: 3, direction: 'future'"></div>
<hr>
This calander on this input is auto-created with direction: 'future'.
<input type="text" class="auto-kal" data-kal="direction: 'future'">
<hr>
This calendar allows clicks outside of the focused month (dayOutOfMonthClickable: true):
<div class="auto-kal" data-kal="months: 1, dayOutOfMonthClickable: true"></div>
<hr>
This calendar has no year navigation (useYearNav: false).
<div class="auto-kal" data-kal="useYearNav: false"></div>
</body>
</html>