-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
executable file
·96 lines (72 loc) · 2.12 KB
/
test.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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="build/build.css" />
<style>
.calendar {
border-collapse: collapse;
border-spacing: 0;
border: 1px solid #999;
}
.calendar thead {
border-bottom: 1px solid #999;
}
.calendar thead th {
text-align: center;
font-size: 14px;
padding: 5px 0;
}
.calendar tbody td {
text-align: left;
width: 50px;
height: 50px;
vertical-align: top;
font-size: 12px;
border: 1px solid #CCC;
}
.calendar tbody td:first-child,
.calendar tbody td:last-child {
background: #F3F3F3;
}
.calendar .day {
display: inline-block;
}
#cMonth {
display: inline-block;
text-align: center;
width: 100px;
}
.calendar .selected {
background: lime !important;
}
</style>
</head>
<body>
<a id="pYear">Year -</a> |
<a id="pMonth">Month -</a> |
<span id="cMonth"></span> |
<a id="nMonth">Month +</a> |
<a id="nYear">Year +</a> ← Not part of the calendar, for testing only
<script src="build/build.js"></script>
<script>
var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
var Calendar = require('JayceTDE-calendar')
, calendarSelect = require('calendar-select')
, cal = new Calendar({ headLength: 3 })
, cMonth = document.querySelector('#cMonth')
;
calendarSelect.plugin(cal);
cal.render();
cal.el.className += ' calendar';
cal.on('change month', function (month) {
cMonth.innerHTML = months[month];
});
cal.initEmit();
document.body.appendChild(cal.el);
document.getElementById('pYear').onclick = cal.prevYear.bind(cal);
document.getElementById('pMonth').onclick = cal.prevMonth.bind(cal);
document.getElementById('nMonth').onclick = cal.nextMonth.bind(cal);
document.getElementById('nYear').onclick = cal.nextYear.bind(cal);
</script>
</body>
</html>