diff options
author | Noah Loomans <noahloomans@gmail.com> | 2016-12-09 23:02:52 +0100 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2016-12-09 23:02:52 +0100 |
commit | cc60c30509e5b084f2b0c01ba22a6e43a446887f (patch) | |
tree | 0752308ba9835d9f84d694201f3c4088e91fa5b3 /public/javascripts/schedule.js | |
parent | 907e8c138ae890208b03b23a420b32290fc2ef88 (diff) |
add week selector
Diffstat (limited to 'public/javascripts/schedule.js')
-rw-r--r-- | public/javascripts/schedule.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/public/javascripts/schedule.js b/public/javascripts/schedule.js index 4e5cbf4..10ba520 100644 --- a/public/javascripts/schedule.js +++ b/public/javascripts/schedule.js @@ -1,4 +1,4 @@ -const getURLOfUser = require('./getURLOfUser') +const leftPad = require('left-pad') const self = {} @@ -28,8 +28,15 @@ self._handleError = function (event) { console.error(request) } -self.viewItem = function (offset, selectedUser) { - const url = getURLOfUser(offset, selectedUser.type, selectedUser.index + 1) +self._getURLOfUsers = function (week, type, index) { + const id = index + 1 + return `//${window.location.host}/meetingpointProxy/Roosters-AL%2Fdoc%2Fdagroosters%2F` + + `${(week)}%2F${type}%2F${type}${leftPad(id, 5, '0')}.htm` +} + +self.viewItem = function (week, selectedUser) { + console.log(selectedUser) + const url = self._getURLOfUsers(week, selectedUser.type, selectedUser.index) while (self._nodes.schedule.firstChild) { self._nodes.schedule.removeChild(self._nodes.schedule.firstChild) |