diff options
-rw-r--r-- | src/client/javascript/analytics.js | 1 | ||||
-rw-r--r-- | src/client/javascript/schedule.js | 7 | ||||
-rw-r--r-- | src/client/views/index.jade | 3 | ||||
-rw-r--r-- | src/client/views/layout.jade | 2 | ||||
-rw-r--r-- | src/server/routes/getSchedule.js | 34 |
5 files changed, 43 insertions, 4 deletions
diff --git a/src/client/javascript/analytics.js b/src/client/javascript/analytics.js index a93c8a4..821aef8 100644 --- a/src/client/javascript/analytics.js +++ b/src/client/javascript/analytics.js @@ -9,6 +9,7 @@ self.send.search = function (selectedUser, favorite) { const eventCategory = favorite ? 'search fav' : 'search' + let eventAction switch (selectedUser.type) { case 'c': diff --git a/src/client/javascript/schedule.js b/src/client/javascript/schedule.js index 11a2aa8..6979526 100644 --- a/src/client/javascript/schedule.js +++ b/src/client/javascript/schedule.js @@ -9,11 +9,13 @@ self._nodes = { schedule: document.querySelector('#schedule') } + self._parseMeetingpointHTML = function (htmlStr) { const html = document.createElement('html') html.innerHTML = htmlStr const centerNode = html.querySelector('center') - return centerNode + return centerNode; + } self._handleLoad = function (event) { @@ -27,6 +29,9 @@ self._handleLoad = function (event) { self._nodes.schedule.appendChild(document) self._nodes.schedule.classList.remove('error') self.emit('load') + + + } self._handleError = function (event) { diff --git a/src/client/views/index.jade b/src/client/views/index.jade index 540fd42..0592766 100644 --- a/src/client/views/index.jade +++ b/src/client/views/index.jade @@ -10,6 +10,7 @@ block head link(rel='stylesheet', href='/components/material-design-lite/material.min.css') script(defer='', src='/components/material-design-lite/material.min.js') + block content form#search .top-bar @@ -17,7 +18,7 @@ block content .logo .text Rooster .input-wrapper - input(type='search', placeholder='Zoeken', autocomplete='off') + input(type='search', placeholder='Zoeken...', autocomplete='off') button.material-icons.fav(tabindex='0', type='button')  .tooltip span Voer hier een <strong>docentafkorting</strong>, <strong>klas</strong>, <strong>leerlingnummer</strong> of <strong>lokaalnummer</strong> in. diff --git a/src/client/views/layout.jade b/src/client/views/layout.jade index f7f9e1f..29066ab 100644 --- a/src/client/views/layout.jade +++ b/src/client/views/layout.jade @@ -8,7 +8,7 @@ html(lang='nl') if isBeta title BETA Metis Rooster else - title Metis Rooster + title Metis Roostert meta(name='theme-color',content='#F44336') meta(name='viewport', content='width=device-width, initial-scale=1') link(href='https://fonts.googleapis.com/css?family=Roboto', rel='stylesheet') diff --git a/src/server/routes/getSchedule.js b/src/server/routes/getSchedule.js index 7850918..f5da08c 100644 --- a/src/server/routes/getSchedule.js +++ b/src/server/routes/getSchedule.js @@ -22,6 +22,7 @@ function getWeekNumber (target) { return 1 + Math.ceil((firstThursday - target) / 604800000) } + router.get('/:type/:value.png', function (req, res, next) { port = process.env.PORT || 3000; const { type, value } = req.params @@ -49,6 +50,7 @@ router.get('/:type/:value', function (req, res, next) { const user = users.filter(user => user.type === type && user.value === value)[0] + if (!user) { next(new Error(`${type}${value} is not in the user index.`)) } @@ -67,7 +69,37 @@ router.get('/:type/:value', function (req, res, next) { return } - const utf8Body = iconv.decode(data.body, 'ISO-8859-1') + + + + let utf8Body = iconv.decode(data.body, 'ISO-8859-1') + + + users.forEach(function (user) { + let user_list = user.value; + //let user_lijst_twee = user; + let opties = { + "leraar": "t", + "klas": "c", + "leerling": "s", + "lokaal": "r" + }; + + + user_list = new RegExp(user_list, 'g') + + + let show_user_display = user_list.toString().replace(/[&\/\\#,+()$~%.'":g*?<>{}]/g,""); + + + utf8Body = utf8Body.replace(user_list, "<a href='/" + optie + user_list + "'>" + show_user_display + "</a>") + console.log(show_user_display); + + + }) + + + res.status(data.statusCode).end(utf8Body) }) }) |