diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-06-22 15:36:18 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-06-22 15:36:34 (GMT) |
commit | fa44b1f132b05bcc22e7f1a2ba29d0ef36885c58 (patch) | |
tree | 7de1a64a6ae7fc68fda8af7521844e749d3b8bda /www/js | |
parent | d67ba4c202d23b27c07470d7527034e26026ca67 (diff) |
added buttons to scroll in rd week view
Diffstat (limited to 'www/js')
-rw-r--r-- | www/js/calendar.js | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/www/js/calendar.js b/www/js/calendar.js index 8bdf033..c6b4f61 100644 --- a/www/js/calendar.js +++ b/www/js/calendar.js @@ -21,6 +21,8 @@ 'use strict'; +var current_week_offset = -4; + function getLastMonday() { var d = new Date(); d.setHours(0, 0, 0, 0); @@ -55,13 +57,13 @@ function addWeekClass(row, week) { } } -function calendar_redraw() { +function calendar_redraw(weekstart) { var cal = $('#calendar'); cal.find("tr:gt(0)").remove(); var date = getLastMonday(); - date = addDeltaDays(date, -28); - for(var w = 0; w < 42; w++) { + date = addDeltaDays(date, weekstart * 7); + for(var w = 0; w < 20; w++) { var week = get_rd_week(date.valueOf()); var row = $('<tr>'); addWeekClass(row, week); @@ -82,5 +84,17 @@ function calendar_redraw() { } function calendar_init() { - calendar_redraw() + $('#btn-earlier').click(calendar_prev); + $('#btn-later').click(calendar_next); + calendar_redraw(current_week_offset) +} + +function calendar_prev() { + current_week_offset--; + calendar_redraw(current_week_offset) +} + +function calendar_next() { + current_week_offset++; + calendar_redraw(current_week_offset) } |