mirror of
https://github.com/DreamExposure/DisCal-Discord-Bot.git
synced 2026-04-25 19:08:33 -05:00
Implement month scrolling
This commit is contained in:
@@ -101,14 +101,14 @@
|
||||
<table id="calendar" style="border-color: #ef0813;" border="#ef0813" cellpadding="4"
|
||||
cellspacing="0">
|
||||
<tbody>
|
||||
<tr style="height: 30px;">
|
||||
<th class="nav"><</th>
|
||||
<tr style="height: 50px;">
|
||||
<th class="nav" onclick="previousMonth()"><</th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th id="month-display"></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th class="nav">></th>
|
||||
<th class="nav" onclick="nextMonth()">></th>
|
||||
</tr>
|
||||
<tr style="height: 40px;">
|
||||
<th>Sunday</th>
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
var calendar = {
|
||||
todaysDate: new Date(),
|
||||
selectedDate: new Date()
|
||||
};
|
||||
|
||||
|
||||
function getMonthName(index) {
|
||||
return ['January', 'February',
|
||||
'March', 'April',
|
||||
@@ -8,13 +14,22 @@ function getMonthName(index) {
|
||||
}
|
||||
|
||||
function init() {
|
||||
var today = new Date();
|
||||
|
||||
setMonth({date: today});
|
||||
setMonth({date: calendar.todaysDate});
|
||||
}
|
||||
|
||||
function setMonth(parameters) {
|
||||
var date = parameters.date;
|
||||
|
||||
document.getElementById("month-display").innerHTML = getMonthName(date.getMonth()) + ' ' + date.getFullYear();
|
||||
}
|
||||
|
||||
function previousMonth() {
|
||||
calendar.selectedDate.setMonth(calendar.selectedDate.getMonth() - 1);
|
||||
|
||||
setMonth({date: calendar.selectedDate});
|
||||
}
|
||||
|
||||
function nextMonth() {
|
||||
calendar.selectedDate.setMonth(calendar.selectedDate.getMonth() + 1);
|
||||
setMonth({date: calendar.selectedDate});
|
||||
}
|
||||
Reference in New Issue
Block a user