-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathexample.html
112 lines (98 loc) · 2.82 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
112
<!DOCTYPE html>
<html>
<head>
<title>Calendar</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: 14px "Helvetica Neue", Helvetica, Arial;
padding: 80px;
color: #333;
}
.calendar.large {
float: left;
clear: both;
}
.calendar.large tbody td {
padding: 50px;
border: 1px solid #eee;
position: relative;
}
.calendar.large tbody a {
position: absolute;
top: 5px;
right: 5px;
}
.calendar.small th {
font-size: 10px;
}
.calendar.small td a {
font-size: 10px;
padding: 3px;
}
.calendar td a.invalid {
opacity: .2;
background-color: rgba(0, 0, 0, .2);
cursor: default;
}
#restricted {
clear: left;
}
#restricted .calendar {
float: left;
}
</style>
</head>
<body>
<h1>Calendar</h1>
<div id='standard'></div>
<div id='restricted'></div>
<script src="build/build.js"></script>
<script>
var Calendar = require('calendar');
var one = new Calendar().showMonthSelect().showYearSelect();
one.on('view change', function(date, action){
console.log('change %s', action);
var twoDate = new Date(date);
twoDate.setMonth(date.getMonth() + 1)
small.show(twoDate);
});
one.on('change', function(date){
console.log('selected: %s of %s %s',
date.getDate(),
date.getMonth(),
date.getFullYear());
var newDate = new Date(date);
newDate.setMonth(date.getMonth() + 1);
large.select(newDate);
});
var container = document.querySelector('#standard');
container.appendChild(one.el);
var small = new Calendar;
small.addClass('small');
container.appendChild(small.el);
small.next();
var frLocale = {
months : 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'),
weekdaysMin : 'Di_Lu_Ma_Me_Je_Ve_Sa'.split('_'),
};
var large = new Calendar;
large
.addClass('large')
.locale(frLocale);
container.appendChild(large.el);
container = document.querySelector('#restricted');
var restricted = new Calendar(new Date(2004, 6, 11))
.min(new Date(2004, 5, 12))
.max([2004, 7, 19])
.select(new Date(2004, 7, 19));
container.appendChild(restricted.el);
restricted = new Calendar(new Date(2004, 6, 11))
.max(new Date(2004, 5, 12))
.min([2004, 5, 18])
.show(new Date(2004, 5, 19));
container.appendChild(restricted.el);
</script>
</body>
</html>