aboutsummaryrefslogtreecommitdiff
path: root/public/javascripts/main.js
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2016-12-09 23:02:52 +0100
committerNoah Loomans <noahloomans@gmail.com>2016-12-09 23:02:52 +0100
commitcc60c30509e5b084f2b0c01ba22a6e43a446887f (patch)
tree0752308ba9835d9f84d694201f3c4088e91fa5b3 /public/javascripts/main.js
parent907e8c138ae890208b03b23a420b32290fc2ef88 (diff)
add week selector
Diffstat (limited to 'public/javascripts/main.js')
-rw-r--r--public/javascripts/main.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/public/javascripts/main.js b/public/javascripts/main.js
index 29f1d3e..bd28475 100644
--- a/public/javascripts/main.js
+++ b/public/javascripts/main.js
@@ -1,11 +1,22 @@
const frontpage = require('./frontpage')
const search = require('./search')
const schedule = require('./schedule')
+const weekSelector = require('./weekSelector')
+
+const state = {}
frontpage.show()
+weekSelector.updateCurrentWeek()
search.events.on('search', function (selectedItem) {
- schedule.viewItem(0, selectedItem)
+ state.selectedItem = selectedItem
+ schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem)
+})
+
+weekSelector.events.on('weekChanged', function (newWeek) {
+ schedule.viewItem(newWeek, state.selectedItem)
})
+window.weekSelector = weekSelector
+
document.body.style.opacity = 1