diff options
author | Noah Loomans <noahloomans@gmail.com> | 2017-09-13 16:28:53 +0200 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2017-09-13 16:28:53 +0200 |
commit | 3fb86482404e11942cd83c3500a297a3991db0e4 (patch) | |
tree | c5e7261de72c2b7f871580784525d06d036a6219 /public/javascripts/main.js | |
parent | 5aac32f72eca8c66e879583ce653d07bb3c7370f (diff) |
Restructure project
Diffstat (limited to 'public/javascripts/main.js')
-rw-r--r-- | public/javascripts/main.js | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/public/javascripts/main.js b/public/javascripts/main.js deleted file mode 100644 index 0d125cb..0000000 --- a/public/javascripts/main.js +++ /dev/null @@ -1,71 +0,0 @@ -require('./featureDetect').check() -require('./zoom') - -const frontpage = require('./frontpage') -const search = require('./search') -const schedule = require('./schedule') -const weekSelector = require('./weekSelector') -const favorite = require('./favorite') -const scrollSnap = require('./scrollSnap') -const analytics = require('./analytics') -const url = require('./url') - -const state = {} - -window.state = state - -frontpage.show() -weekSelector.updateCurrentWeek() -scrollSnap.startListening() - -if (url.hasSelectedUser()) { - state.selectedUser = url.getSelectedUser() - - favorite.update(state.selectedUser) - url.update(state.selectedUser) - analytics.send.search(state.selectedUser) - - schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedUser) -} else if (favorite.get() != null) { - state.selectedUser = favorite.get() - - favorite.update(state.selectedUser) - url.push(state.selectedUser, false) - url.update(state.selectedUser) - analytics.send.search(state.selectedUser, true) - - schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedUser) -} else { - search.focus() -} - -search.on('search', function (selectedUser) { - state.selectedUser = selectedUser - - favorite.update(state.selectedUser) - url.push(state.selectedUser) - url.update(state.selectedUser) - analytics.send.search(state.selectedUser) - - schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedUser) -}) - -url.on('update', function (selectedUser) { - state.selectedUser = selectedUser - - favorite.update(state.selectedUser) - url.update(state.selectedUser) - - schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedUser) -}) - -weekSelector.on('weekChanged', function (newWeek) { - analytics.send.search(state.selectedUser) - schedule.viewItem(newWeek, state.selectedUser) -}) - -favorite.on('click', function () { - favorite.toggle(state.selectedUser) -}) - -document.body.style.opacity = 1 |