diff options
author | Noah Loomans <noahloomans@gmail.com> | 2017-01-29 15:09:26 +0100 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2017-01-29 15:09:26 +0100 |
commit | 16f431f3a839a499cfeee070c97eef189c06f49c (patch) | |
tree | 5cd19ca45ed83e0016d2e46f33f572e50641a11b /public/javascripts/weekSelector.js | |
parent | c3286dbef4648668979e04cc918e333dbdf1fb15 (diff) | |
parent | efcdf058485272102c9c0c75e3b7a4cec9f9e6db (diff) |
Merge branch 'beta'
Diffstat (limited to 'public/javascripts/weekSelector.js')
-rw-r--r-- | public/javascripts/weekSelector.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/public/javascripts/weekSelector.js b/public/javascripts/weekSelector.js index 6dbf2c8..d4e7f2a 100644 --- a/public/javascripts/weekSelector.js +++ b/public/javascripts/weekSelector.js @@ -5,7 +5,9 @@ const self = new EventEmitter() self._nodes = { prevButton: document.querySelectorAll('#week-selector button')[0], nextButton: document.querySelectorAll('#week-selector button')[1], - currentWeekText: document.querySelector('#week-selector .current') + currentWeekNode: document.querySelector('#week-selector .current'), + currentWeekNormalText: document.querySelector('#week-selector .current .no-print'), + currentWeekPrintText: document.querySelector('#week-selector .current .print') } self._weekOffset = 0 @@ -35,9 +37,9 @@ self.getSelectedWeek = function () { self.updateCurrentWeek = function () { const selectedWeekNumber = self.getSelectedWeek() if (self.getCurrentWeek(new Date()) !== selectedWeekNumber) { - self._nodes.currentWeekText.classList.add('changed') + self._nodes.currentWeekNode.classList.add('changed') } else { - self._nodes.currentWeekText.classList.remove('changed') + self._nodes.currentWeekNode.classList.remove('changed') } self.updateDom() self.emit('weekChanged', selectedWeekNumber) @@ -73,9 +75,11 @@ self.updateDom = function () { } } if (humanReadableWeek != null) { - self._nodes.currentWeekText.textContent = humanReadableWeek + ' • ' + selectedWeekNumber + self._nodes.currentWeekNormalText.textContent = humanReadableWeek + ' • ' + selectedWeekNumber + self._nodes.currentWeekPrintText.textContent = 'Week ' + selectedWeekNumber } else { - self._nodes.currentWeekText.textContent = 'Week ' + selectedWeekNumber + self._nodes.currentWeekNormalText.textContent = 'Week ' + selectedWeekNumber + self._nodes.currentWeekPrintText.textContent = 'Week ' + selectedWeekNumber } } |