aboutsummaryrefslogtreecommitdiff
path: root/public/javascripts/main.js
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2017-01-30 18:27:20 +0100
committerNoah Loomans <noahloomans@gmail.com>2017-01-30 18:27:20 +0100
commit6edf8919a7ea9718405d3ccd0fed2e93ce1e54cc (patch)
treec23422c676ce5d7f8017a4691c56e3467ca3adb6 /public/javascripts/main.js
parent344504782ac628b15229cafada34a9f32d595624 (diff)
Refactor item to user
While item is technically more correct, I still prefer user as i think it makes the code easier to understand.
Diffstat (limited to 'public/javascripts/main.js')
-rw-r--r--public/javascripts/main.js54
1 files changed, 27 insertions, 27 deletions
diff --git a/public/javascripts/main.js b/public/javascripts/main.js
index 561316d..67e1567 100644
--- a/public/javascripts/main.js
+++ b/public/javascripts/main.js
@@ -18,54 +18,54 @@ frontpage.show()
weekSelector.updateCurrentWeek()
scrollSnap.startListening()
-if (url.hasSelectedItem()) {
- state.selectedItem = url.getSelectedItem()
+if (url.hasSelectedUser()) {
+ state.selectedUser = url.getSelectedUser()
- favorite.update(state.selectedItem)
- url.update(state.selectedItem)
- analytics.send.search(state.selectedItem)
+ favorite.update(state.selectedUser)
+ url.update(state.selectedUser)
+ analytics.send.search(state.selectedUser)
- schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem)
+ schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedUser)
} else if (favorite.get() != null) {
- state.selectedItem = favorite.get()
+ state.selectedUser = favorite.get()
- favorite.update(state.selectedItem)
- url.push(state.selectedItem, false)
- url.update(state.selectedItem)
- analytics.send.search(state.selectedItem, true)
+ favorite.update(state.selectedUser)
+ url.push(state.selectedUser, false)
+ url.update(state.selectedUser)
+ analytics.send.search(state.selectedUser, true)
- schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem)
+ schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedUser)
} else {
search.focus()
}
-search.on('search', function (selectedItem) {
- state.selectedItem = selectedItem
+search.on('search', function (selectedUser) {
+ state.selectedUser = selectedUser
- favorite.update(state.selectedItem)
- url.push(state.selectedItem)
- url.update(state.selectedItem)
- analytics.send.search(state.selectedItem)
+ favorite.update(state.selectedUser)
+ url.push(state.selectedUser)
+ url.update(state.selectedUser)
+ analytics.send.search(state.selectedUser)
- schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem)
+ schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedUser)
})
-url.on('update', function (selectedItem) {
- state.selectedItem = selectedItem
+url.on('update', function (selectedUser) {
+ state.selectedUser = selectedUser
- favorite.update(state.selectedItem)
- url.update(state.selectedItem)
+ favorite.update(state.selectedUser)
+ url.update(state.selectedUser)
- schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem)
+ schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedUser)
})
weekSelector.on('weekChanged', function (newWeek) {
- analytics.send.search(state.selectedItem)
- schedule.viewItem(newWeek, state.selectedItem)
+ analytics.send.search(state.selectedUser)
+ schedule.viewItem(newWeek, state.selectedUser)
})
favorite.on('click', function () {
- favorite.toggle(state.selectedItem)
+ favorite.toggle(state.selectedUser)
})
document.body.style.opacity = 1