aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md9
-rw-r--r--package.json8
-rw-r--r--public/apple-touch-icon.pngbin0 -> 6447 bytes
-rw-r--r--public/browserconfig.xml9
-rw-r--r--public/favicon-16x16.pngbin0 -> 1293 bytes
-rw-r--r--public/favicon-32x32.pngbin0 -> 2103 bytes
-rw-r--r--public/favicon.icobin0 -> 15086 bytes
-rw-r--r--public/javascripts/autocomplete.js46
-rw-r--r--public/javascripts/bundle.js1569
-rw-r--r--public/javascripts/favorite.js2
-rw-r--r--public/javascripts/main.bak.js244
-rw-r--r--public/javascripts/main.js52
-rw-r--r--public/javascripts/schedule.js28
-rw-r--r--public/javascripts/scrollSnap.js14
-rw-r--r--public/javascripts/search.js27
-rw-r--r--public/javascripts/url.js59
-rw-r--r--public/mstile-150x150.pngbin0 -> 3995 bytes
-rw-r--r--public/safari-pinned-tab.svg34
-rw-r--r--routes/index.js2
-rw-r--r--views/layout.jade4
20 files changed, 1791 insertions, 316 deletions
diff --git a/README.md b/README.md
index cf6bd4a..65a104e 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,7 @@
-<img src="public/icons/res/mipmap-xhdpi/ic_launcher.png" alt="" align="right" height="70px">
-
-# Metis Rooster - [rooster.hetmml.nl](http://rooster.hetmml.nl/)
-The search engine of the MML Schedule page
+<p align="center">
+ <img src="public/icons/res/mipmap-xxxhdpi/ic_launcher.png" alt="" width="192px" height="192px">
+</p>
+<h1 align="center">Metis Rooster - <a href="http://rooster.hetmml.nl/">rooster.hetmml.nl</a></h1>
+<blockquote align="center">The search engine of the MML Schedule page</blockquote>
![Screenshot of page](https://noahloomans.com/assets/projects/rooster.hetmml.nl.png/)
diff --git a/package.json b/package.json
index b1e56db..8238526 100644
--- a/package.json
+++ b/package.json
@@ -12,12 +12,12 @@
},
"dependencies": {
"bluebird": "^3.4.6",
- "body-parser": "~1.15.1",
+ "body-parser": "^1.16.0",
"browser-request": "^0.3.3",
"cheerio": "^0.22.0",
"compression": "^1.6.2",
"cookie-parser": "~1.4.3",
- "debug": "~2.2.0",
+ "debug": "^2.6.0",
"diacritics": "^1.2.3",
"encoding": "^0.1.12",
"express": "^4.13.4",
@@ -33,10 +33,10 @@
"then-yield": "0.0.1"
},
"devDependencies": {
- "babel-preset-es2016": "^6.16.0",
+ "babel-preset-es2015": "^6.22.0",
"babelify": "^7.3.0",
"bower": "^1.7.9",
- "browserify": "^13.1.0",
+ "browserify": "^14.0.0",
"gulp": "^3.9.1",
"watchify": "^3.7.0"
},
diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png
new file mode 100644
index 0000000..5adfc69
--- /dev/null
+++ b/public/apple-touch-icon.png
Binary files differ
diff --git a/public/browserconfig.xml b/public/browserconfig.xml
new file mode 100644
index 0000000..b3930d0
--- /dev/null
+++ b/public/browserconfig.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<browserconfig>
+ <msapplication>
+ <tile>
+ <square150x150logo src="/mstile-150x150.png"/>
+ <TileColor>#da532c</TileColor>
+ </tile>
+ </msapplication>
+</browserconfig>
diff --git a/public/favicon-16x16.png b/public/favicon-16x16.png
new file mode 100644
index 0000000..1df47d3
--- /dev/null
+++ b/public/favicon-16x16.png
Binary files differ
diff --git a/public/favicon-32x32.png b/public/favicon-32x32.png
new file mode 100644
index 0000000..36cd5da
--- /dev/null
+++ b/public/favicon-32x32.png
Binary files differ
diff --git a/public/favicon.ico b/public/favicon.ico
new file mode 100644
index 0000000..c201043
--- /dev/null
+++ b/public/favicon.ico
Binary files differ
diff --git a/public/javascripts/autocomplete.js b/public/javascripts/autocomplete.js
index 71fb17d..61f400a 100644
--- a/public/javascripts/autocomplete.js
+++ b/public/javascripts/autocomplete.js
@@ -2,8 +2,8 @@ const EventEmitter = require('events')
const self = new EventEmitter()
-self._items = []
-self._selectedItemIndex = -1
+self._users = []
+self._selectedUserIndex = -1
self._nodes = {
search: document.querySelector('#search'),
@@ -11,63 +11,63 @@ self._nodes = {
autocomplete: document.querySelector('.autocomplete')
}
-self.getSelectedItem = function () {
+self.getSelectedUser = function () {
if (self.getItems() === []) return
- if (self.getSelectedItemIndex() === -1) {
+ if (self.getSelectedUserIndex() === -1) {
return self.getItems()[0]
} else {
- return self.getItems()[self.getSelectedItemIndex()]
+ return self.getItems()[self.getSelectedUserIndex()]
}
}
-self.getSelectedItemIndex = function () {
- return self._selectedItemIndex
+self.getSelectedUserIndex = function () {
+ return self._selectedUserIndex
}
self.getItems = function () {
- return self._items
+ return self._users
}
self.removeAllItems = function () {
while (self._nodes.autocomplete.firstChild) {
self._nodes.autocomplete.removeChild(self._nodes.autocomplete.firstChild)
}
- self._items = []
- self._selectedItemIndex = -1
+ self._users = []
+ self._selectedUserIndex = -1
}
-self.addItem = function (item) {
+self.addItem = function (user) {
const listItem = document.createElement('li')
- listItem.textContent = item.value
+ listItem.textContent = user.value
self._nodes.autocomplete.appendChild(listItem)
- self._items.push(item)
+ self._users.push(user)
}
self._moveSelected = function (shift) {
- if (self._selectedItemIndex + shift >= self.getItems().length) {
- self._selectedItemIndex = -1
- } else if (self._selectedItemIndex + shift < -1) {
- self._selectedItemIndex = self.getItems().length - 1
+ if (self._selectedUserIndex + shift >= self.getItems().length) {
+ self._selectedUserIndex = -1
+ } else if (self._selectedUserIndex + shift < -1) {
+ self._selectedUserIndex = self.getItems().length - 1
} else {
- self._selectedItemIndex += shift
+ self._selectedUserIndex += shift
}
for (let i = 0; i < self.getItems().length; i++) {
self._nodes.autocomplete.children[i].classList.remove('selected')
}
- if (self._selectedItemIndex >= 0) {
+ if (self._selectedUserIndex >= 0) {
self._nodes.autocomplete
- .children[self._selectedItemIndex].classList.add('selected')
+ .children[self._selectedUserIndex].classList.add('selected')
}
}
self._handleItemClick = function (event) {
if (!self._nodes.autocomplete.contains(event.target)) return
- const itemIndex = Array.prototype.indexOf
+ const userIndex = Array.prototype.indexOf
.call(self._nodes.autocomplete.children, event.target)
- self._selectedItemIndex = itemIndex
- self.emit('select', self.getSelectedItem())
+ self._selectedUserIndex = userIndex
+ self.emit('select', self.getSelectedUser())
}
self._handleKeydown = function (event) {
diff --git a/public/javascripts/bundle.js b/public/javascripts/bundle.js
index a4f7681..8a9e5df 100644
--- a/public/javascripts/bundle.js
+++ b/public/javascripts/bundle.js
@@ -1 +1,1568 @@
-!function e(t,n,o){function r(i,l){if(!n[i]){if(!t[i]){var c="function"==typeof require&&require;if(!l&&c)return c(i,!0);if(s)return s(i,!0);var u=new Error("Cannot find module '"+i+"'");throw u.code="MODULE_NOT_FOUND",u}var a=n[i]={exports:{}};t[i][0].call(a.exports,function(e){var n=t[i][1][e];return r(n?n:e)},a,a.exports,e,t,n,o)}return n[i].exports}for(var s="function"==typeof require&&require,i=0;i<o.length;i++)r(o[i]);return r}({1:[function(e,t,n){function o(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function s(e){return"number"==typeof e}function i(e){return"object"==typeof e&&null!==e}function l(e){return void 0===e}t.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._maxListeners=void 0,o.defaultMaxListeners=10,o.prototype.setMaxListeners=function(e){if(!s(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},o.prototype.emit=function(e){var t,n,o,s,c,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var a=new Error('Uncaught, unspecified "error" event. ('+t+")");throw a.context=t,a}if(n=this._events[e],l(n))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(i(n))for(s=Array.prototype.slice.call(arguments,1),u=n.slice(),o=u.length,c=0;c<o;c++)u[c].apply(this,s);return!0},o.prototype.addListener=function(e,t){var n;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?i(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,i(this._events[e])&&!this._events[e].warned&&(n=l(this._maxListeners)?o.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},o.prototype.on=o.prototype.addListener,o.prototype.once=function(e,t){function n(){this.removeListener(e,n),o||(o=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var o=!1;return n.listener=t,this.on(e,n),this},o.prototype.removeListener=function(e,t){var n,o,s,l;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],s=n.length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(l=s;l-- >0;)if(n[l]===t||n[l].listener&&n[l].listener===t){o=l;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},o.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},o.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},o.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},o.listenerCount=function(e,t){return e.listenerCount(t)}},{}],2:[function(e,t,n){!function(){var e=this,o={};"undefined"!=typeof n?t.exports=o:e.fuzzy=o,o.simpleFilter=function(e,t){return t.filter(function(t){return o.test(e,t)})},o.test=function(e,t){return null!==o.match(e,t)},o.match=function(e,t,n){n=n||{};var o,r=0,s=[],i=t.length,l=0,c=0,u=n.pre||"",a=n.post||"",d=n.caseSensitive&&t||t.toLowerCase();e=n.caseSensitive&&e||e.toLowerCase();for(var f=0;f<i;f++)o=t[f],d[f]===e[r]?(o=u+o+a,r+=1,c+=1+c):c=0,l+=c,s[s.length]=o;return r===e.length?{rendered:s.join(""),score:l}:null},o.filter=function(e,t,n){return n=n||{},t.reduce(function(t,r,s,i){var l=r;n.extract&&(l=n.extract(r));var c=o.match(e,l,n);return null!=c&&(t[t.length]={string:c.rendered,score:c.score,index:s,original:r}),t},[]).sort(function(e,t){var n=t.score-e.score;return n?n:e.index-t.index})}}()},{}],3:[function(e,t,n){"use strict";function o(e,t,n){if(e+="",t-=e.length,t<=0)return e;if(n||0===n||(n=" "),n+=""," "===n&&t<10)return r[t]+e;for(var o="";;){if(1&t&&(o+=n),t>>=1,!t)break;n+=n}return o+e}t.exports=o;var r=[""," "," "," "," "," "," "," "," "," "]},{}],4:[function(e,t,n){!function(e,o,r){"use strict";function s(){function t(e,t){this.scrollLeft=e,this.scrollTop=t}function n(e){return.5*(1-Math.cos(Math.PI*e))}function s(e){if("object"!=typeof e||null===e||e.behavior===r||"auto"===e.behavior||"instant"===e.behavior)return!0;if("object"==typeof e&&"smooth"===e.behavior)return!1;throw new TypeError("behavior not valid")}function i(t){var n,r,s;do t=t.parentNode,n=t===o.body,r=t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth,s="visible"===e.getComputedStyle(t,null).overflow;while(!n&&(!r||s));return n=r=s=null,t}function l(t){t.frame=e.requestAnimationFrame(l.bind(e,t));var o,r,s,i=f(),c=(i-t.startTime)/a;if(c=c>1?1:c,o=n(c),r=t.startX+(t.x-t.startX)*o,s=t.startY+(t.y-t.startY)*o,t.method.call(t.scrollable,r,s),r===t.x&&s===t.y)return void e.cancelAnimationFrame(t.frame)}function c(n,r,s){var i,c,u,a,h,v=f();n===o.body?(i=e,c=e.scrollX||e.pageXOffset,u=e.scrollY||e.pageYOffset,a=d.scroll):(i=n,c=n.scrollLeft,u=n.scrollTop,a=t),h&&e.cancelAnimationFrame(h),l({scrollable:i,method:a,startTime:v,startX:c,startY:u,x:r,y:s,frame:h})}if(!("scrollBehavior"in o.documentElement.style)){var u=e.HTMLElement||e.Element,a=468,d={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,scrollIntoView:u.prototype.scrollIntoView},f=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now;e.scroll=e.scrollTo=function(){return s(arguments[0])?void d.scroll.call(e,arguments[0].left||arguments[0],arguments[0].top||arguments[1]):void c.call(e,o.body,~~arguments[0].left,~~arguments[0].top)},e.scrollBy=function(){return s(arguments[0])?void d.scrollBy.call(e,arguments[0].left||arguments[0],arguments[0].top||arguments[1]):void c.call(e,o.body,~~arguments[0].left+(e.scrollX||e.pageXOffset),~~arguments[0].top+(e.scrollY||e.pageYOffset))},u.prototype.scrollIntoView=function(){if(s(arguments[0]))return void d.scrollIntoView.call(this,arguments[0]||!0);var t=i(this),n=t.getBoundingClientRect(),r=this.getBoundingClientRect();t!==o.body?(c.call(this,t,t.scrollLeft+r.left-n.left,t.scrollTop+r.top-n.top),e.scrollBy({left:n.left,top:n.top,behavior:"smooth"})):e.scrollBy({left:r.left,top:r.top,behavior:"smooth"})}}}"object"==typeof n?t.exports={polyfill:s}:s()}(window,document)},{}],5:[function(e,t,n){"use strict";var o={};o.send={},o.send.search=function(e,t){var n="event",o=t?"search fav":"search",r=void 0;switch(e.type){case"c":r="Class";break;case"t":r="Teacher";break;case"r":r="Room";break;case"s":r="Student"}var s=e.value;ga(function(){ga("send",{hitType:n,eventCategory:o,eventAction:r,eventLabel:s})})},t.exports=o},{}],6:[function(e,t,n){"use strict";var o=e("events"),r=new o;r._items=[],r._selectedItemIndex=-1,r._nodes={search:document.querySelector("#search"),input:document.querySelector('input[type="search"]'),autocomplete:document.querySelector(".autocomplete")},r.getSelectedItem=function(){if(r.getItems()!==[])return r.getSelectedItemIndex()===-1?r.getItems()[0]:r.getItems()[r.getSelectedItemIndex()]},r.getSelectedItemIndex=function(){return r._selectedItemIndex},r.getItems=function(){return r._items},r.removeAllItems=function(){for(;r._nodes.autocomplete.firstChild;)r._nodes.autocomplete.removeChild(r._nodes.autocomplete.firstChild);r._items=[],r._selectedItemIndex=-1},r.addItem=function(e){var t=document.createElement("li");t.textContent=e.value,r._nodes.autocomplete.appendChild(t),r._items.push(e)},r._moveSelected=function(e){r._selectedItemIndex+e>=r.getItems().length?r._selectedItemIndex=-1:r._selectedItemIndex+e<-1?r._selectedItemIndex=r.getItems().length-1:r._selectedItemIndex+=e;for(var t=0;t<r.getItems().length;t++)r._nodes.autocomplete.children[t].classList.remove("selected");r._selectedItemIndex>=0&&r._nodes.autocomplete.children[r._selectedItemIndex].classList.add("selected")},r._handleItemClick=function(e){if(r._nodes.autocomplete.contains(e.target)){var t=Array.prototype.indexOf.call(r._nodes.autocomplete.children,e.target);r._selectedItemIndex=t,r.emit("select",r.getSelectedItem())}},r._handleKeydown=function(e){"ArrowDown"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),"ArrowDown"===e.key?r._moveSelected(1):"ArrowUp"===e.key&&r._moveSelected(-1))},r._nodes.autocomplete.addEventListener("click",r._handleItemClick),r._nodes.input.addEventListener("keydown",r._handleKeydown),t.exports=r},{events:1}],7:[function(e,t,n){"use strict";var o={};o.isIE=navigator.userAgent.indexOf("MSIE")!==-1||navigator.appVersion.indexOf("Trident/")>0,o.isIE?o.inputEvent="textinput":o.inputEvent="input",t.exports=o},{}],8:[function(e,t,n){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},r=e("events"),s=new r;s._nodes={toggle:document.querySelector(".fav")},s.get=function(){try{var e=function(){var e=JSON.parse(window.localStorage.getItem("fav"));if(null==e)return{v:void 0};var t=USERS.filter(function(t){return t.type===e.type&&t.value===e.value})[0];return{v:t}}();if("object"===("undefined"==typeof e?"undefined":o(e)))return e.v}catch(e){return void s.delete()}},s.set=function(e){window.localStorage.setItem("fav",JSON.stringify(e)),s._nodes.innerHTML="&#xE838;"},s.delete=function(){window.localStorage.removeItem("fav")},s.updateDom=function(e){e?s._nodes.toggle.innerHTML="&#xE838;":s._nodes.toggle.innerHTML="&#xE83A"},s.update=function(e){var t=s.get();if(null==t)return void s.updateDom(!1);var n=t.type===e.type&&t.index===e.index;s.updateDom(n)},s.toggle=function(e){var t=s.get(),n=null!=t&&t.type===e.type&&t.index===e.index;n?(s.delete(),s.updateDom(!1)):(s.set(e),s.updateDom(!0))},s._handleClick=function(){s.emit("click")},s._nodes.toggle.addEventListener("click",s._handleClick),t.exports=s},{events:1}],9:[function(e,t,n){"use strict";var o={};o._nodes={input:document.querySelector('input[type="search"]'),overflowButton:document.querySelector("#overflow-button")},o._shouldCheck=function(){return FLAGS.indexOf("NO_FEATURE_DETECT")===-1},o._redirect=function(){window.location.href="http://www.meetingpointmco.nl/Roosters-AL/doc/"},o.check=function(){o._shouldCheck()&&(window.onerror=o._redirect,o._nodes.input.getClientRects()[0].top!==o._nodes.overflowButton.getClientRects()[0].top&&o._redirect())},t.exports=o},{}],10:[function(e,t,n){"use strict";var o=e("./browserFixToolkit"),r={};r._nodes={input:document.querySelector('input[type="search"]')},r.isShown=!1,r.show=function(){document.body.classList.add("no-input"),r.isShown=!0},r.hide=function(){document.body.classList.remove("no-input"),r.isShown=!1},r._nodes.input.addEventListener(o.inputEvent,r.hide),t.exports=r},{"./browserFixToolkit":7}],11:[function(e,t,n){"use strict";e("./featureDetect").check();var o=e("./frontpage"),r=e("./search"),s=e("./schedule"),i=e("./weekSelector"),l=e("./favorite"),c=e("./scrollSnap"),u=e("./analytics"),a={};window.state=a,window.require=e,o.show(),i.updateCurrentWeek(),c.startListening(),null!=l.get()?(a.selectedItem=l.get(),l.update(a.selectedItem),u.send.search(a.selectedItem,!0),s.viewItem(i.getSelectedWeek(),a.selectedItem)):r.focus(),r.on("search",function(e){a.selectedItem=e,l.update(a.selectedItem),u.send.search(a.selectedItem),s.viewItem(i.getSelectedWeek(),a.selectedItem)}),i.on("weekChanged",function(e){u.send.search(a.selectedItem),s.viewItem(e,a.selectedItem)}),l.on("click",function(){l.toggle(a.selectedItem)}),document.body.style.opacity=1},{"./analytics":5,"./favorite":8,"./featureDetect":9,"./frontpage":10,"./schedule":12,"./scrollSnap":13,"./search":14,"./weekSelector":15}],12:[function(e,t,n){"use strict";var o=e("events"),r=e("left-pad"),s=e("./search"),i=new o;i._nodes={schedule:document.querySelector("#schedule")},i._parseMeetingpointHTML=function(e){var t=document.createElement("html");t.innerHTML=e;var n=t.querySelector("center");return n},i._handleLoad=function(e){var t=e.target;if(t.status<200||t.status>=400)return void i._handleError(e);var n=i._parseMeetingpointHTML(t.response);i._removeChilds(),i._nodes.schedule.appendChild(n),i._nodes.schedule.classList.remove("error"),i.emit("load")},i._handleError=function(e){var t=e.target,n=void 0;n=404===t.status?"Sorry, er is (nog) geen rooster voor deze week.":"Sorry, er is iets mis gegaan tijdens het laden van deze week.",i._removeChilds(),i._nodes.schedule.textContent=n,i._nodes.schedule.classList.add("error"),i.emit("load")},i._getURLOfUsers=function(e,t,n){var o=n+1;return"//"+window.location.host+"/meetingpointProxy/Roosters-AL%2Fdoc%2Fdagroosters%2F"+r(e,2,"0")+"%2F"+t+"%2F"+t+r(o,5,"0")+".htm"},i._removeChilds=function(){for(;i._nodes.schedule.firstChild;)i._nodes.schedule.removeChild(i._nodes.schedule.firstChild)},i.viewItem=function(e,t){var n=i._getURLOfUsers(e,t.type,t.index);i._removeChilds();var o=new window.XMLHttpRequest;o.addEventListener("load",i._handleLoad),o.addEventListener("error",i._handleError),o.open("GET",n,!0),o.send(),s.updateDom(t)},t.exports=i},{"./search":14,events:1,"left-pad":3}],13:[function(e,t,n){"use strict";e("smoothscroll-polyfill").polyfill();var o={},r=e("./schedule");o._nodes={search:document.querySelector("#search"),weekSelector:document.querySelector("#week-selector")},o._timeoutID=null,o._getScrollPosition=function(){return document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop},o._handleDoneScrolling=function(){var e=o._getScrollPosition(),t=o._nodes.weekSelector.clientHeight-o._nodes.search.clientHeight;e<t&&e>0&&window.scroll({top:t,left:0,behavior:"smooth"})},o._handleScroll=function(){null!=o._timeoutID&&window.clearTimeout(o._timeoutID),o._timeoutID=window.setTimeout(o._handleDoneScrolling,500);var e=o._getScrollPosition(),t=o._nodes.weekSelector.clientHeight-o._nodes.search.clientHeight;e>=t?document.body.classList.add("week-selector-not-visible"):document.body.classList.remove("week-selector-not-visible")},o._handleWindowResize=function(){var e=o._nodes.weekSelector.clientHeight-o._nodes.search.clientHeight,t=e-(document.body.clientHeight-window.innerHeight);t>0?document.body.style.marginBottom=t+"px":document.body.style.marginBottom=null},o.startListening=function(){window.addEventListener("scroll",o._handleScroll)},r.on("load",o._handleWindowResize),window.addEventListener("resize",o._handleWindowResize),t.exports=o},{"./schedule":12,"smoothscroll-polyfill":4}],14:[function(e,t,n){"use strict";var o=e("events"),r=e("fuzzy"),s=e("./autocomplete"),i=e("./browserFixToolkit"),l=new o;l._nodes={search:document.querySelector("#search"),input:document.querySelector('input[type="search"]')},l.submit=function(){var e=s.getSelectedItem();null!=e&&(console.log(e),l._nodes.input.blur(),document.body.classList.remove("week-selector-not-visible"),l.emit("search",e))},l.updateDom=function(e){l._nodes.input.value=e.value,s.removeAllItems(),document.body.classList.remove("no-input"),document.body.classList.add("searched")},l.focus=function(){l._nodes.input.focus()},l._handleSubmit=function(e){e.preventDefault(),l.submit()},l._calculate=function(e){var t=r.filter(e,USERS,{extract:function(e){return e.value}}),n=t.slice(0,7),o=n.map(function(e){return e.original});return o},l._handleTextUpdate=function(){var e=l._calculate(l._nodes.input.value);s.removeAllItems();for(var t=0;t<e.length;t++)s.addItem(e[t])},l._handleFocus=function(){l._nodes.input.select()},l._handleBlur=function(){var e=l._nodes.value;l._nodes.value="",l._nodes.value=e,document.activeElement.blur()},s.on("select",l.submit),l._nodes.search.addEventListener("submit",l._handleSubmit),l._nodes.input.addEventListener("focus",l._handleFocus),l._nodes.input.addEventListener("blur",l._handleBlur),l._nodes.input.addEventListener(i.inputEvent,l._handleTextUpdate),t.exports=l},{"./autocomplete":6,"./browserFixToolkit":7,events:1,fuzzy:2}],15:[function(e,t,n){"use strict";var o=e("events"),r=new o;r._nodes={prevButton:document.querySelectorAll("#week-selector button")[0],nextButton:document.querySelectorAll("#week-selector button")[1],currentWeekNode:document.querySelector("#week-selector .current"),currentWeekNormalText:document.querySelector("#week-selector .current .no-print"),currentWeekPrintText:document.querySelector("#week-selector .current .print")},r._weekOffset=0,r.getCurrentWeek=function(e){var t=(e.getDay()+6)%7;e.setDate(e.getDate()-t+3);var n=e.valueOf();return e.setMonth(0,1),4!==e.getDay()&&e.setMonth(0,1+(4-e.getDay()+7)%7),1+Math.ceil((n-e)/6048e5)},r.getSelectedWeek=function(){var e=new Date,t=new Date(e.getTime()+604800*r._weekOffset*1e3+864e5);return r.getCurrentWeek(t)},r.updateCurrentWeek=function(){var e=r.getSelectedWeek();r.getCurrentWeek(new Date)!==e?r._nodes.currentWeekNode.classList.add("changed"):r._nodes.currentWeekNode.classList.remove("changed"),r.updateDom(),r.emit("weekChanged",e)},r.updateDom=function(){var e=r.getSelectedWeek(),t=0===(new Date).getDay(),n=null;if(t)switch(r._weekOffset){case 0:n="Aanstaande week";break;case 1:n="Volgende week";break;case-1:n="Afgelopen week"}else switch(r._weekOffset){case 0:n="Huidige week";break;case 1:n="Volgende week";break;case-1:n="Vorige week"}null!=n?(r._nodes.currentWeekNormalText.textContent=n+" • "+e,r._nodes.currentWeekPrintText.textContent="Week "+e):(r._nodes.currentWeekNormalText.textContent="Week "+e,r._nodes.currentWeekPrintText.textContent="Week "+e)},r._handlePrevButtonClick=function(){r._weekOffset-=1,r.updateCurrentWeek()},r._handleNextButtonClick=function(){r._weekOffset+=1,r.updateCurrentWeek()},r._nodes.prevButton.addEventListener("click",r._handlePrevButtonClick),r._nodes.nextButton.addEventListener("click",r._handleNextButtonClick),t.exports=r},{events:1}]},{},[11]);
+(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+function EventEmitter() {
+ this._events = this._events || {};
+ this._maxListeners = this._maxListeners || undefined;
+}
+module.exports = EventEmitter;
+
+// Backwards-compat with node 0.10.x
+EventEmitter.EventEmitter = EventEmitter;
+
+EventEmitter.prototype._events = undefined;
+EventEmitter.prototype._maxListeners = undefined;
+
+// By default EventEmitters will print a warning if more than 10 listeners are
+// added to it. This is a useful default which helps finding memory leaks.
+EventEmitter.defaultMaxListeners = 10;
+
+// Obviously not all Emitters should be limited to 10. This function allows
+// that to be increased. Set to zero for unlimited.
+EventEmitter.prototype.setMaxListeners = function(n) {
+ if (!isNumber(n) || n < 0 || isNaN(n))
+ throw TypeError('n must be a positive number');
+ this._maxListeners = n;
+ return this;
+};
+
+EventEmitter.prototype.emit = function(type) {
+ var er, handler, len, args, i, listeners;
+
+ if (!this._events)
+ this._events = {};
+
+ // If there is no 'error' event listener then throw.
+ if (type === 'error') {
+ if (!this._events.error ||
+ (isObject(this._events.error) && !this._events.error.length)) {
+ er = arguments[1];
+ if (er instanceof Error) {
+ throw er; // Unhandled 'error' event
+ } else {
+ // At least give some kind of context to the user
+ var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
+ err.context = er;
+ throw err;
+ }
+ }
+ }
+
+ handler = this._events[type];
+
+ if (isUndefined(handler))
+ return false;
+
+ if (isFunction(handler)) {
+ switch (arguments.length) {
+ // fast cases
+ case 1:
+ handler.call(this);
+ break;
+ case 2:
+ handler.call(this, arguments[1]);
+ break;
+ case 3:
+ handler.call(this, arguments[1], arguments[2]);
+ break;
+ // slower
+ default:
+ args = Array.prototype.slice.call(arguments, 1);
+ handler.apply(this, args);
+ }
+ } else if (isObject(handler)) {
+ args = Array.prototype.slice.call(arguments, 1);
+ listeners = handler.slice();
+ len = listeners.length;
+ for (i = 0; i < len; i++)
+ listeners[i].apply(this, args);
+ }
+
+ return true;
+};
+
+EventEmitter.prototype.addListener = function(type, listener) {
+ var m;
+
+ if (!isFunction(listener))
+ throw TypeError('listener must be a function');
+
+ if (!this._events)
+ this._events = {};
+
+ // To avoid recursion in the case that type === "newListener"! Before
+ // adding it to the listeners, first emit "newListener".
+ if (this._events.newListener)
+ this.emit('newListener', type,
+ isFunction(listener.listener) ?
+ listener.listener : listener);
+
+ if (!this._events[type])
+ // Optimize the case of one listener. Don't need the extra array object.
+ this._events[type] = listener;
+ else if (isObject(this._events[type]))
+ // If we've already got an array, just append.
+ this._events[type].push(listener);
+ else
+ // Adding the second element, need to change to array.
+ this._events[type] = [this._events[type], listener];
+
+ // Check for listener leak
+ if (isObject(this._events[type]) && !this._events[type].warned) {
+ if (!isUndefined(this._maxListeners)) {
+ m = this._maxListeners;
+ } else {
+ m = EventEmitter.defaultMaxListeners;
+ }
+
+ if (m && m > 0 && this._events[type].length > m) {
+ this._events[type].warned = true;
+ console.error('(node) warning: possible EventEmitter memory ' +
+ 'leak detected. %d listeners added. ' +
+ 'Use emitter.setMaxListeners() to increase limit.',
+ this._events[type].length);
+ if (typeof console.trace === 'function') {
+ // not supported in IE 10
+ console.trace();
+ }
+ }
+ }
+
+ return this;
+};
+
+EventEmitter.prototype.on = EventEmitter.prototype.addListener;
+
+EventEmitter.prototype.once = function(type, listener) {
+ if (!isFunction(listener))
+ throw TypeError('listener must be a function');
+
+ var fired = false;
+
+ function g() {
+ this.removeListener(type, g);
+
+ if (!fired) {
+ fired = true;
+ listener.apply(this, arguments);
+ }
+ }
+
+ g.listener = listener;
+ this.on(type, g);
+
+ return this;
+};
+
+// emits a 'removeListener' event iff the listener was removed
+EventEmitter.prototype.removeListener = function(type, listener) {
+ var list, position, length, i;
+
+ if (!isFunction(listener))
+ throw TypeError('listener must be a function');
+
+ if (!this._events || !this._events[type])
+ return this;
+
+ list = this._events[type];
+ length = list.length;
+ position = -1;
+
+ if (list === listener ||
+ (isFunction(list.listener) && list.listener === listener)) {
+ delete this._events[type];
+ if (this._events.removeListener)
+ this.emit('removeListener', type, listener);
+
+ } else if (isObject(list)) {
+ for (i = length; i-- > 0;) {
+ if (list[i] === listener ||
+ (list[i].listener && list[i].listener === listener)) {
+ position = i;
+ break;
+ }
+ }
+
+ if (position < 0)
+ return this;
+
+ if (list.length === 1) {
+ list.length = 0;
+ delete this._events[type];
+ } else {
+ list.splice(position, 1);
+ }
+
+ if (this._events.removeListener)
+ this.emit('removeListener', type, listener);
+ }
+
+ return this;
+};
+
+EventEmitter.prototype.removeAllListeners = function(type) {
+ var key, listeners;
+
+ if (!this._events)
+ return this;
+
+ // not listening for removeListener, no need to emit
+ if (!this._events.removeListener) {
+ if (arguments.length === 0)
+ this._events = {};
+ else if (this._events[type])
+ delete this._events[type];
+ return this;
+ }
+
+ // emit removeListener for all listeners on all events
+ if (arguments.length === 0) {
+ for (key in this._events) {
+ if (key === 'removeListener') continue;
+ this.removeAllListeners(key);
+ }
+ this.removeAllListeners('removeListener');
+ this._events = {};
+ return this;
+ }
+
+ listeners = this._events[type];
+
+ if (isFunction(listeners)) {
+ this.removeListener(type, listeners);
+ } else if (listeners) {
+ // LIFO order
+ while (listeners.length)
+ this.removeListener(type, listeners[listeners.length - 1]);
+ }
+ delete this._events[type];
+
+ return this;
+};
+
+EventEmitter.prototype.listeners = function(type) {
+ var ret;
+ if (!this._events || !this._events[type])
+ ret = [];
+ else if (isFunction(this._events[type]))
+ ret = [this._events[type]];
+ else
+ ret = this._events[type].slice();
+ return ret;
+};
+
+EventEmitter.prototype.listenerCount = function(type) {
+ if (this._events) {
+ var evlistener = this._events[type];
+
+ if (isFunction(evlistener))
+ return 1;
+ else if (evlistener)
+ return evlistener.length;
+ }
+ return 0;
+};
+
+EventEmitter.listenerCount = function(emitter, type) {
+ return emitter.listenerCount(type);
+};
+
+function isFunction(arg) {
+ return typeof arg === 'function';
+}
+
+function isNumber(arg) {
+ return typeof arg === 'number';
+}
+
+function isObject(arg) {
+ return typeof arg === 'object' && arg !== null;
+}
+
+function isUndefined(arg) {
+ return arg === void 0;
+}
+
+},{}],2:[function(require,module,exports){
+/*
+ * Fuzzy
+ * https://github.com/myork/fuzzy
+ *
+ * Copyright (c) 2012 Matt York
+ * Licensed under the MIT license.
+ */
+
+(function() {
+
+var root = this;
+
+var fuzzy = {};
+
+// Use in node or in browser
+if (typeof exports !== 'undefined') {
+ module.exports = fuzzy;
+} else {
+ root.fuzzy = fuzzy;
+}
+
+// Return all elements of `array` that have a fuzzy
+// match against `pattern`.
+fuzzy.simpleFilter = function(pattern, array) {
+ return array.filter(function(str) {
+ return fuzzy.test(pattern, str);
+ });
+};
+
+// Does `pattern` fuzzy match `str`?
+fuzzy.test = function(pattern, str) {
+ return fuzzy.match(pattern, str) !== null;
+};
+
+// If `pattern` matches `str`, wrap each matching character
+// in `opts.pre` and `opts.post`. If no match, return null
+fuzzy.match = function(pattern, str, opts) {
+ opts = opts || {};
+ var patternIdx = 0
+ , result = []
+ , len = str.length
+ , totalScore = 0
+ , currScore = 0
+ // prefix
+ , pre = opts.pre || ''
+ // suffix
+ , post = opts.post || ''
+ // String to compare against. This might be a lowercase version of the
+ // raw string
+ , compareString = opts.caseSensitive && str || str.toLowerCase()
+ , ch;
+
+ pattern = opts.caseSensitive && pattern || pattern.toLowerCase();
+
+ // For each character in the string, either add it to the result
+ // or wrap in template if it's the next string in the pattern
+ for(var idx = 0; idx < len; idx++) {
+ ch = str[idx];
+ if(compareString[idx] === pattern[patternIdx]) {
+ ch = pre + ch + post;
+ patternIdx += 1;
+
+ // consecutive characters should increase the score more than linearly
+ currScore += 1 + currScore;
+ } else {
+ currScore = 0;
+ }
+ totalScore += currScore;
+ result[result.length] = ch;
+ }
+
+ // return rendered string if we have a match for every char
+ if(patternIdx === pattern.length) {
+ // if the string is an exact match with pattern, totalScore should be maxed
+ totalScore = (compareString === pattern) ? Infinity : totalScore;
+ return {rendered: result.join(''), score: totalScore};
+ }
+
+ return null;
+};
+
+// The normal entry point. Filters `arr` for matches against `pattern`.
+// It returns an array with matching values of the type:
+//
+// [{
+// string: '<b>lah' // The rendered string
+// , index: 2 // The index of the element in `arr`
+// , original: 'blah' // The original element in `arr`
+// }]
+//
+// `opts` is an optional argument bag. Details:
+//
+// opts = {
+// // string to put before a matching character
+// pre: '<b>'
+//
+// // string to put after matching character
+// , post: '</b>'
+//
+// // Optional function. Input is an entry in the given arr`,
+// // output should be the string to test `pattern` against.
+// // In this example, if `arr = [{crying: 'koala'}]` we would return
+// // 'koala'.
+// , extract: function(arg) { return arg.crying; }
+// }
+fuzzy.filter = function(pattern, arr, opts) {
+ if(!arr || arr.length === 0) {
+ return [];
+ }
+ if (typeof pattern !== 'string') {
+ return arr;
+ }
+ opts = opts || {};
+ return arr
+ .reduce(function(prev, element, idx, arr) {
+ var str = element;
+ if(opts.extract) {
+ str = opts.extract(element);
+ }
+ var rendered = fuzzy.match(pattern, str, opts);
+ if(rendered != null) {
+ prev[prev.length] = {
+ string: rendered.rendered
+ , score: rendered.score
+ , index: idx
+ , original: element
+ };
+ }
+ return prev;
+ }, [])
+
+ // Sort by score. Browsers are inconsistent wrt stable/unstable
+ // sorting, so force stable by using the index in the case of tie.
+ // See http://ofb.net/~sethml/is-sort-stable.html
+ .sort(function(a,b) {
+ var compare = b.score - a.score;
+ if(compare) return compare;
+ return a.index - b.index;
+ });
+};
+
+
+}());
+
+
+},{}],3:[function(require,module,exports){
+/* This program is free software. It comes without any warranty, to
+ * the extent permitted by applicable law. You can redistribute it
+ * and/or modify it under the terms of the Do What The Fuck You Want
+ * To Public License, Version 2, as published by Sam Hocevar. See
+ * http://www.wtfpl.net/ for more details. */
+'use strict';
+module.exports = leftPad;
+
+var cache = [
+ '',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' ',
+ ' '
+];
+
+function leftPad (str, len, ch) {
+ // convert `str` to `string`
+ str = str + '';
+ // `len` is the `pad`'s length now
+ len = len - str.length;
+ // doesn't need to pad
+ if (len <= 0) return str;
+ // `ch` defaults to `' '`
+ if (!ch && ch !== 0) ch = ' ';
+ // convert `ch` to `string`
+ ch = ch + '';
+ // cache common use cases
+ if (ch === ' ' && len < 10) return cache[len] + str;
+ // `pad` starts with an empty string
+ var pad = '';
+ // loop
+ while (true) {
+ // add `ch` to `pad` if `len` is odd
+ if (len & 1) pad += ch;
+ // divide `len` by 2, ditch the remainder
+ len >>= 1;
+ // "double" the `ch` so this operation count grows logarithmically on `len`
+ // each time `ch` is "doubled", the `len` would need to be "doubled" too
+ // similar to finding a value in binary search tree, hence O(log(n))
+ if (len) ch += ch;
+ // `len` is 0, exit the loop
+ else break;
+ }
+ // pad `str`!
+ return pad + str;
+}
+
+},{}],4:[function(require,module,exports){
+/*
+ * smoothscroll polyfill - v0.3.4
+ * https://iamdustan.github.io/smoothscroll
+ * 2016 (c) Dustan Kasten, Jeremias Menichelli - MIT License
+ */
+
+(function(w, d, undefined) {
+ 'use strict';
+
+ /*
+ * aliases
+ * w: window global object
+ * d: document
+ * undefined: undefined
+ */
+
+ // polyfill
+ function polyfill() {
+ // return when scrollBehavior interface is supported
+ if ('scrollBehavior' in d.documentElement.style) {
+ return;
+ }
+
+ /*
+ * globals
+ */
+ var Element = w.HTMLElement || w.Element;
+ var SCROLL_TIME = 468;
+
+ /*
+ * object gathering original scroll methods
+ */
+ var original = {
+ scroll: w.scroll || w.scrollTo,
+ scrollBy: w.scrollBy,
+ scrollIntoView: Element.prototype.scrollIntoView
+ };
+
+ /*
+ * define timing method
+ */
+ var now = w.performance && w.performance.now
+ ? w.performance.now.bind(w.performance) : Date.now;
+
+ /**
+ * changes scroll position inside an element
+ * @method scrollElement
+ * @param {Number} x
+ * @param {Number} y
+ */
+ function scrollElement(x, y) {
+ this.scrollLeft = x;
+ this.scrollTop = y;
+ }
+
+ /**
+ * returns result of applying ease math function to a number
+ * @method ease
+ * @param {Number} k
+ * @returns {Number}
+ */
+ function ease(k) {
+ return 0.5 * (1 - Math.cos(Math.PI * k));
+ }
+
+ /**
+ * indicates if a smooth behavior should be applied
+ * @method shouldBailOut
+ * @param {Number|Object} x
+ * @returns {Boolean}
+ */
+ function shouldBailOut(x) {
+ if (typeof x !== 'object'
+ || x === null
+ || x.behavior === undefined
+ || x.behavior === 'auto'
+ || x.behavior === 'instant') {
+ // first arg not an object/null
+ // or behavior is auto, instant or undefined
+ return true;
+ }
+
+ if (typeof x === 'object'
+ && x.behavior === 'smooth') {
+ // first argument is an object and behavior is smooth
+ return false;
+ }
+
+ // throw error when behavior is not supported
+ throw new TypeError('behavior not valid');
+ }
+
+ /**
+ * finds scrollable parent of an element
+ * @method findScrollableParent
+ * @param {Node} el
+ * @returns {Node} el
+ */
+ function findScrollableParent(el) {
+ var isBody;
+ var hasScrollableSpace;
+ var hasVisibleOverflow;
+
+ do {
+ el = el.parentNode;
+
+ // set condition variables
+ isBody = el === d.body;
+ hasScrollableSpace =
+ el.clientHeight < el.scrollHeight ||
+ el.clientWidth < el.scrollWidth;
+ hasVisibleOverflow =
+ w.getComputedStyle(el, null).overflow === 'visible';
+ } while (!isBody && !(hasScrollableSpace && !hasVisibleOverflow));
+
+ isBody = hasScrollableSpace = hasVisibleOverflow = null;
+
+ return el;
+ }
+
+ /**
+ * self invoked function that, given a context, steps through scrolling
+ * @method step
+ * @param {Object} context
+ */
+ function step(context) {
+ // call method again on next available frame
+ context.frame = w.requestAnimationFrame(step.bind(w, context));
+
+ var time = now();
+ var value;
+ var currentX;
+ var currentY;
+ var elapsed = (time - context.startTime) / SCROLL_TIME;
+
+ // avoid elapsed times higher than one
+ elapsed = elapsed > 1 ? 1 : elapsed;
+
+ // apply easing to elapsed time
+ value = ease(elapsed);
+
+ currentX = context.startX + (context.x - context.startX) * value;
+ currentY = context.startY + (context.y - context.startY) * value;
+
+ context.method.call(context.scrollable, currentX, currentY);
+
+ // return when end points have been reached
+ if (currentX === context.x && currentY === context.y) {
+ w.cancelAnimationFrame(context.frame);
+ return;
+ }
+ }
+
+ /**
+ * scrolls window with a smooth behavior
+ * @method smoothScroll
+ * @param {Object|Node} el
+ * @param {Number} x
+ * @param {Number} y
+ */
+ function smoothScroll(el, x, y) {
+ var scrollable;
+ var startX;
+ var startY;
+ var method;
+ var startTime = now();
+ var frame;
+
+ // define scroll context
+ if (el === d.body) {
+ scrollable = w;
+ startX = w.scrollX || w.pageXOffset;
+ startY = w.scrollY || w.pageYOffset;
+ method = original.scroll;
+ } else {
+ scrollable = el;
+ startX = el.scrollLeft;
+ startY = el.scrollTop;
+ method = scrollElement;
+ }
+
+ // cancel frame when a scroll event's happening
+ if (frame) {
+ w.cancelAnimationFrame(frame);
+ }
+
+ // scroll looping over a frame
+ step({
+ scrollable: scrollable,
+ method: method,
+ startTime: startTime,
+ startX: startX,
+ startY: startY,
+ x: x,
+ y: y,
+ frame: frame
+ });
+ }
+
+ /*
+ * ORIGINAL METHODS OVERRIDES
+ */
+
+ // w.scroll and w.scrollTo
+ w.scroll = w.scrollTo = function() {
+ // avoid smooth behavior if not required
+ if (shouldBailOut(arguments[0])) {
+ original.scroll.call(
+ w,
+ arguments[0].left || arguments[0],
+ arguments[0].top || arguments[1]
+ );
+ return;
+ }
+
+ // LET THE SMOOTHNESS BEGIN!
+ smoothScroll.call(
+ w,
+ d.body,
+ ~~arguments[0].left,
+ ~~arguments[0].top
+ );
+ };
+
+ // w.scrollBy
+ w.scrollBy = function() {
+ // avoid smooth behavior if not required
+ if (shouldBailOut(arguments[0])) {
+ original.scrollBy.call(
+ w,
+ arguments[0].left || arguments[0],
+ arguments[0].top || arguments[1]
+ );
+ return;
+ }
+
+ // LET THE SMOOTHNESS BEGIN!
+ smoothScroll.call(
+ w,
+ d.body,
+ ~~arguments[0].left + (w.scrollX || w.pageXOffset),
+ ~~arguments[0].top + (w.scrollY || w.pageYOffset)
+ );
+ };
+
+ // Element.prototype.scrollIntoView
+ Element.prototype.scrollIntoView = function() {
+ // avoid smooth behavior if not required
+ if (shouldBailOut(arguments[0])) {
+ original.scrollIntoView.call(this, arguments[0] || true);
+ return;
+ }
+
+ // LET THE SMOOTHNESS BEGIN!
+ var scrollableParent = findScrollableParent(this);
+ var parentRects = scrollableParent.getBoundingClientRect();
+ var clientRects = this.getBoundingClientRect();
+
+ if (scrollableParent !== d.body) {
+ // reveal element inside parent
+ smoothScroll.call(
+ this,
+ scrollableParent,
+ scrollableParent.scrollLeft + clientRects.left - parentRects.left,
+ scrollableParent.scrollTop + clientRects.top - parentRects.top
+ );
+ // reveal parent in viewport
+ w.scrollBy({
+ left: parentRects.left,
+ top: parentRects.top,
+ behavior: 'smooth'
+ });
+ } else {
+ // reveal element in viewport
+ w.scrollBy({
+ left: clientRects.left,
+ top: clientRects.top,
+ behavior: 'smooth'
+ });
+ }
+ };
+ }
+
+ if (typeof exports === 'object') {
+ // commonjs
+ module.exports = { polyfill: polyfill };
+ } else {
+ // global
+ polyfill();
+ }
+})(window, document);
+
+},{}],5:[function(require,module,exports){
+'use strict';
+
+/* global ga */
+
+var self = {};
+
+self.send = {};
+
+self.send.search = function (selectedUser, favorite) {
+ var hitType = 'event';
+
+ var eventCategory = favorite ? 'search fav' : 'search';
+
+ var eventAction = void 0;
+ switch (selectedUser.type) {
+ case 'c':
+ eventAction = 'Class';
+ break;
+ case 't':
+ eventAction = 'Teacher';
+ break;
+ case 'r':
+ eventAction = 'Room';
+ break;
+ case 's':
+ eventAction = 'Student';
+ break;
+ }
+
+ var eventLabel = selectedUser.value;
+
+ ga(function () {
+ ga('send', { hitType: hitType, eventCategory: eventCategory, eventAction: eventAction, eventLabel: eventLabel });
+ });
+};
+
+module.exports = self;
+
+},{}],6:[function(require,module,exports){
+'use strict';
+
+var EventEmitter = require('events');
+
+var self = new EventEmitter();
+
+self._users = [];
+self._selectedUserIndex = -1;
+
+self._nodes = {
+ search: document.querySelector('#search'),
+ input: document.querySelector('input[type="search"]'),
+ autocomplete: document.querySelector('.autocomplete')
+};
+
+self.getSelectedUser = function () {
+ if (self.getItems() === []) return;
+
+ if (self.getSelectedUserIndex() === -1) {
+ return self.getItems()[0];
+ } else {
+ return self.getItems()[self.getSelectedUserIndex()];
+ }
+};
+
+self.getSelectedUserIndex = function () {
+ return self._selectedUserIndex;
+};
+
+self.getItems = function () {
+ return self._users;
+};
+
+self.removeAllItems = function () {
+ while (self._nodes.autocomplete.firstChild) {
+ self._nodes.autocomplete.removeChild(self._nodes.autocomplete.firstChild);
+ }
+ self._users = [];
+ self._selectedUserIndex = -1;
+};
+
+self.addItem = function (user) {
+ var listItem = document.createElement('li');
+ listItem.textContent = user.value;
+ self._nodes.autocomplete.appendChild(listItem);
+ self._users.push(user);
+};
+
+self._moveSelected = function (shift) {
+ if (self._selectedUserIndex + shift >= self.getItems().length) {
+ self._selectedUserIndex = -1;
+ } else if (self._selectedUserIndex + shift < -1) {
+ self._selectedUserIndex = self.getItems().length - 1;
+ } else {
+ self._selectedUserIndex += shift;
+ }
+
+ for (var i = 0; i < self.getItems().length; i++) {
+ self._nodes.autocomplete.children[i].classList.remove('selected');
+ }
+ if (self._selectedUserIndex >= 0) {
+ self._nodes.autocomplete.children[self._selectedUserIndex].classList.add('selected');
+ }
+};
+
+self._handleItemClick = function (event) {
+ if (!self._nodes.autocomplete.contains(event.target)) return;
+ var userIndex = Array.prototype.indexOf.call(self._nodes.autocomplete.children, event.target);
+ self._selectedUserIndex = userIndex;
+ self.emit('select', self.getSelectedUser());
+};
+
+self._handleKeydown = function (event) {
+ if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
+ event.preventDefault();
+ if (event.key === 'ArrowDown') {
+ self._moveSelected(1);
+ } else if (event.key === 'ArrowUp') {
+ self._moveSelected(-1);
+ }
+ }
+};
+
+self._nodes.autocomplete.addEventListener('click', self._handleItemClick);
+self._nodes.input.addEventListener('keydown', self._handleKeydown);
+
+module.exports = self;
+
+},{"events":1}],7:[function(require,module,exports){
+'use strict';
+
+var self = {};
+
+self.isIE = navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0;
+
+if (self.isIE) {
+ self.inputEvent = 'textinput';
+} else {
+ self.inputEvent = 'input';
+}
+
+module.exports = self;
+
+},{}],8:[function(require,module,exports){
+'use strict';
+
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
+
+/* global USERS */
+
+var EventEmitter = require('events');
+
+var self = new EventEmitter();
+
+self._nodes = {
+ toggle: document.querySelector('.fav')
+};
+
+self.get = function () {
+ try {
+ var _ret = function () {
+ var localStorageUser = JSON.parse(window.localStorage.getItem('fav'));
+ if (localStorageUser == null) return {
+ v: void 0
+ };
+
+ var correctedUser = USERS.filter(function (user) {
+ return user.type === localStorageUser.type && user.value === localStorageUser.value;
+ })[0];
+ return {
+ v: correctedUser
+ };
+ }();
+
+ if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
+ } catch (e) {
+ self.delete();
+ return;
+ }
+};
+
+self.set = function (user) {
+ window.localStorage.setItem('fav', JSON.stringify(user));
+ self._nodes.innerHTML = '&#xE838;';
+};
+
+self.delete = function () {
+ window.localStorage.removeItem('fav');
+};
+
+self.updateDom = function (isFavorite) {
+ if (isFavorite) {
+ self._nodes.toggle.innerHTML = '&#xE838;';
+ } else {
+ self._nodes.toggle.innerHTML = '&#xE83A';
+ }
+};
+
+self.update = function (selectedUser) {
+ var currentUser = self.get();
+
+ if (currentUser == null || selectedUser == null) {
+ self.updateDom(false);
+ return;
+ }
+
+ var isEqual = currentUser.type === selectedUser.type && currentUser.index === selectedUser.index;
+
+ self.updateDom(isEqual);
+};
+
+self.toggle = function (selectedUser) {
+ var currentUser = self.get();
+ var isEqual = currentUser != null && currentUser.type === selectedUser.type && currentUser.index === selectedUser.index;
+
+ if (isEqual) {
+ self.delete();
+ self.updateDom(false);
+ } else {
+ self.set(selectedUser);
+ self.updateDom(true);
+ }
+};
+
+self._handleClick = function () {
+ self.emit('click');
+};
+
+self._nodes.toggle.addEventListener('click', self._handleClick);
+
+module.exports = self;
+
+},{"events":1}],9:[function(require,module,exports){
+'use strict';
+
+/* global FLAGS */
+
+var self = {};
+
+self._nodes = {
+ input: document.querySelector('input[type="search"]'),
+ overflowButton: document.querySelector('#overflow-button')
+};
+
+self._shouldCheck = function () {
+ return FLAGS.indexOf('NO_FEATURE_DETECT') === -1;
+};
+
+self._redirect = function () {
+ window.location.href = 'http://www.meetingpointmco.nl/Roosters-AL/doc/';
+};
+
+self.check = function () {
+ if (!self._shouldCheck()) return;
+
+ window.onerror = self._redirect;
+
+ if (self._nodes.input.getClientRects()[0].top !== self._nodes.overflowButton.getClientRects()[0].top) {
+ self._redirect();
+ }
+};
+
+module.exports = self;
+
+},{}],10:[function(require,module,exports){
+'use strict';
+
+var browserFixToolkit = require('./browserFixToolkit');
+
+var self = {};
+
+self._nodes = {
+ input: document.querySelector('input[type="search"]')
+};
+
+self.isShown = false;
+
+self.show = function () {
+ document.body.classList.add('no-input');
+ self.isShown = true;
+};
+
+self.hide = function () {
+ document.body.classList.remove('no-input');
+ self.isShown = false;
+};
+
+self._nodes.input.addEventListener(browserFixToolkit.inputEvent, self.hide);
+
+module.exports = self;
+
+},{"./browserFixToolkit":7}],11:[function(require,module,exports){
+'use strict';
+
+require('./featureDetect').check();
+
+var frontpage = require('./frontpage');
+var search = require('./search');
+var schedule = require('./schedule');
+var weekSelector = require('./weekSelector');
+var favorite = require('./favorite');
+var scrollSnap = require('./scrollSnap');
+var analytics = require('./analytics');
+var url = require('./url');
+
+var state = {};
+
+window.state = state;
+window.require = require;
+
+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;
+
+},{"./analytics":5,"./favorite":8,"./featureDetect":9,"./frontpage":10,"./schedule":12,"./scrollSnap":13,"./search":14,"./url":15,"./weekSelector":16}],12:[function(require,module,exports){
+'use strict';
+
+var EventEmitter = require('events');
+var leftPad = require('left-pad');
+var search = require('./search');
+
+var self = new EventEmitter();
+
+self._nodes = {
+ schedule: document.querySelector('#schedule')
+};
+
+self._parseMeetingpointHTML = function (htmlStr) {
+ var html = document.createElement('html');
+ html.innerHTML = htmlStr;
+ var centerNode = html.querySelector('center');
+ return centerNode;
+};
+
+self._handleLoad = function (event) {
+ var request = event.target;
+ if (request.status < 200 || request.status >= 400) {
+ self._handleError(event);
+ return;
+ }
+ var document = self._parseMeetingpointHTML(request.response);
+ self._removeChilds();
+ self._nodes.schedule.appendChild(document);
+ self._nodes.schedule.classList.remove('error');
+ self.emit('load');
+};
+
+self._handleError = function (event) {
+ var request = event.target;
+ var error = void 0;
+ if (request.status === 404) {
+ error = 'Sorry, er is (nog) geen rooster voor deze week.';
+ } else {
+ error = 'Sorry, er is iets mis gegaan tijdens het laden van deze week.';
+ }
+ self._removeChilds();
+ self._nodes.schedule.textContent = error;
+ self._nodes.schedule.classList.add('error');
+ self.emit('load');
+};
+
+self._getURLOfUsers = function (week, type, index) {
+ var id = index + 1;
+ var meetingpointURL = 'Roosters-AL/doc/dagroosters/' + leftPad(week, 2, '0') + '/' + type + '/' + ('' + type + leftPad(id, 5, '0') + '.htm');
+ return '/meetingpointProxy/' + window.encodeURIComponent(meetingpointURL);
+};
+
+self._removeChilds = function () {
+ while (self._nodes.schedule.firstChild) {
+ self._nodes.schedule.removeChild(self._nodes.schedule.firstChild);
+ }
+};
+
+self.viewItem = function (week, selectedUser) {
+ if (selectedUser == null) {
+ self._removeChilds();
+ search.updateDom(selectedUser);
+ } else {
+ var url = self._getURLOfUsers(week, selectedUser.type, selectedUser.index);
+
+ self._removeChilds();
+
+ var request = new window.XMLHttpRequest();
+ request.addEventListener('load', self._handleLoad);
+ request.addEventListener('error', self._handleError);
+ request.open('GET', url, true);
+ request.send();
+
+ search.updateDom(selectedUser);
+ }
+};
+
+module.exports = self;
+
+},{"./search":14,"events":1,"left-pad":3}],13:[function(require,module,exports){
+'use strict';
+
+require('smoothscroll-polyfill').polyfill();
+
+var self = {};
+var schedule = require('./schedule');
+
+self._nodes = {
+ search: document.querySelector('#search'),
+ weekSelector: document.querySelector('#week-selector')
+};
+
+self._timeoutID = null;
+
+self._getScrollPosition = function () {
+ return document.documentElement && document.documentElement.scrollTop || document.body.scrollTop;
+};
+
+self._handleDoneScrolling = function () {
+ var scrollPosition = self._getScrollPosition();
+ var weekSelectorHeight = self._nodes.weekSelector.clientHeight - self._nodes.search.clientHeight;
+ if (scrollPosition < weekSelectorHeight && scrollPosition > 0) {
+ window.scroll({ top: weekSelectorHeight, left: 0, behavior: 'smooth' });
+ }
+};
+
+self._handleScroll = function () {
+ if (self._timeoutID != null) window.clearTimeout(self._timeoutID);
+ self._timeoutID = window.setTimeout(self._handleDoneScrolling, 500);
+
+ var scrollPosition = self._getScrollPosition();
+ var weekSelectorHeight = self._nodes.weekSelector.clientHeight - self._nodes.search.clientHeight;
+ if (scrollPosition >= weekSelectorHeight) {
+ document.body.classList.add('week-selector-not-visible');
+ } else {
+ document.body.classList.remove('week-selector-not-visible');
+ }
+};
+
+self._handleWindowResize = function () {
+ var weekSelectorHeight = self._nodes.weekSelector.clientHeight - self._nodes.search.clientHeight;
+ var extraPixelsNeeded = weekSelectorHeight - (document.body.clientHeight - window.innerHeight);
+ if (extraPixelsNeeded > 0) {
+ document.body.style.marginBottom = extraPixelsNeeded + 'px';
+ } else {
+ document.body.style.marginBottom = null;
+ }
+};
+
+self.startListening = function () {
+ window.addEventListener('scroll', self._handleScroll);
+};
+
+schedule.on('load', self._handleWindowResize);
+window.addEventListener('resize', self._handleWindowResize);
+module.exports = self;
+
+},{"./schedule":12,"smoothscroll-polyfill":4}],14:[function(require,module,exports){
+'use strict';
+
+/* global USERS */
+
+var EventEmitter = require('events');
+var fuzzy = require('fuzzy');
+var autocomplete = require('./autocomplete');
+var browserFixToolkit = require('./browserFixToolkit');
+
+var self = new EventEmitter();
+
+self._nodes = {
+ search: document.querySelector('#search'),
+ input: document.querySelector('input[type="search"]')
+};
+
+self.submit = function () {
+ var selectedUser = autocomplete.getSelectedUser();
+ if (selectedUser == null) return;
+
+ console.log(selectedUser);
+
+ self._nodes.input.blur();
+ document.body.classList.remove('week-selector-not-visible'); // Safari bug
+
+ self.emit('search', selectedUser);
+};
+
+self.updateDom = function (selectedUser) {
+ if (selectedUser == null) {
+ self._nodes.input.value = '';
+ autocomplete.removeAllItems();
+ document.body.classList.add('no-input');
+ document.body.classList.remove('searched');
+ } else {
+ self._nodes.input.value = selectedUser.value;
+ autocomplete.removeAllItems();
+ document.body.classList.remove('no-input');
+ document.body.classList.add('searched');
+ }
+};
+
+self.focus = function () {
+ self._nodes.input.focus();
+};
+
+self._handleSubmit = function (event) {
+ event.preventDefault();
+ self.submit();
+};
+
+self._calculate = function (searchTerm) {
+ var allResults = fuzzy.filter(searchTerm, USERS, {
+ extract: function extract(user) {
+ return user.value;
+ }
+ });
+ var firstResults = allResults.slice(0, 7);
+
+ var originalResults = firstResults.map(function (result) {
+ return result.original;
+ });
+
+ return originalResults;
+};
+
+self._handleTextUpdate = function () {
+ var results = self._calculate(self._nodes.input.value);
+
+ autocomplete.removeAllItems();
+ for (var i = 0; i < results.length; i++) {
+ autocomplete.addItem(results[i]);
+ }
+};
+
+self._handleFocus = function () {
+ self._nodes.input.select();
+};
+
+self._handleBlur = function () {
+ // this will removed the selection without drawing focus on it (safari)
+ // this will removed selection even when focusing an iframe (chrome)
+ var oldValue = self._nodes.value;
+ self._nodes.value = '';
+ self._nodes.value = oldValue;
+
+ // this will hide the keyboard (iOS safari)
+ document.activeElement.blur();
+};
+
+autocomplete.on('select', self.submit);
+
+self._nodes.search.addEventListener('submit', self._handleSubmit);
+self._nodes.input.addEventListener('focus', self._handleFocus);
+self._nodes.input.addEventListener('blur', self._handleBlur);
+self._nodes.input.addEventListener(browserFixToolkit.inputEvent, self._handleTextUpdate);
+
+module.exports = self;
+
+},{"./autocomplete":6,"./browserFixToolkit":7,"events":1,"fuzzy":2}],15:[function(require,module,exports){
+'use strict';
+
+/* global USERS */
+
+var EventEmitter = require('events');
+
+var self = new EventEmitter();
+
+self._getPageTitle = function (selectedUser) {
+ if (selectedUser == null) {
+ return 'Metis Rooster';
+ } else {
+ return 'Metis Rooster - ' + selectedUser.value;
+ }
+};
+
+self._getPageURL = function (selectedUser) {
+ return '/' + selectedUser.type + '/' + selectedUser.value;
+};
+
+self.push = function (selectedUser, push) {
+ if (push == null) push = true;
+ var pageTitle = self._getPageTitle(selectedUser);
+ var pageURL = self._getPageURL(selectedUser);
+ if (push) {
+ window.history.pushState(selectedUser, pageTitle, pageURL);
+ } else {
+ window.history.replaceState(selectedUser, pageTitle, pageURL);
+ }
+};
+
+self.update = function (selectedUser) {
+ document.title = self._getPageTitle(selectedUser);
+};
+
+self.hasSelectedUser = function () {
+ var pageUrl = window.location.pathname;
+ return (/^\/s\/|^\/t\/|^\/r\/|^\/c\//.test(pageUrl)
+ );
+};
+
+self.getSelectedUser = function () {
+ var pageUrl = window.location.pathname;
+ var pageUrlData = pageUrl.split('/');
+ var type = pageUrlData[1];
+ var value = pageUrlData[2];
+
+ var user = USERS.filter(function (user) {
+ return user.type === type && user.value === value;
+ })[0];
+
+ return user;
+};
+
+self._handleUpdate = function (event) {
+ self.emit('update', event.state);
+};
+
+window.addEventListener('popstate', self._handleUpdate);
+
+module.exports = self;
+
+},{"events":1}],16:[function(require,module,exports){
+'use strict';
+
+var EventEmitter = require('events');
+
+var self = new EventEmitter();
+
+self._nodes = {
+ prevButton: document.querySelectorAll('#week-selector button')[0],
+ nextButton: document.querySelectorAll('#week-selector button')[1],
+ currentWeekNode: document.querySelector('#week-selector .current'),
+ currentWeekNormalText: document.querySelector('#week-selector .current .no-print'),
+ currentWeekPrintText: document.querySelector('#week-selector .current .print')
+};
+
+self._weekOffset = 0;
+
+// copied from http://www.meetingpointmco.nl/Roosters-AL/doc/dagroosters/untisscripts.js,
+// were using the same code as they do to be sure that we always get the same
+// week number.
+self.getCurrentWeek = function (target) {
+ var dayNr = (target.getDay() + 6) % 7;
+ target.setDate(target.getDate() - dayNr + 3);
+ var firstThursday = target.valueOf();
+ target.setMonth(0, 1);
+ if (target.getDay() !== 4) {
+ target.setMonth(0, 1 + (4 - target.getDay() + 7) % 7);
+ }
+
+ return 1 + Math.ceil((firstThursday - target) / 604800000);
+};
+
+self.getSelectedWeek = function () {
+ var now = new Date();
+ var targetDate = new Date(now.getTime() + self._weekOffset * 604800 * 1000 + 86400 * 1000);
+ return self.getCurrentWeek(targetDate);
+};
+
+self.updateCurrentWeek = function () {
+ var selectedWeekNumber = self.getSelectedWeek();
+ if (self.getCurrentWeek(new Date()) !== selectedWeekNumber) {
+ self._nodes.currentWeekNode.classList.add('changed');
+ } else {
+ self._nodes.currentWeekNode.classList.remove('changed');
+ }
+ self.updateDom();
+ self.emit('weekChanged', selectedWeekNumber);
+};
+
+self.updateDom = function () {
+ var selectedWeekNumber = self.getSelectedWeek();
+ var isSunday = new Date().getDay() === 0;
+ var humanReadableWeek = null;
+ if (isSunday) {
+ switch (self._weekOffset) {
+ case 0:
+ humanReadableWeek = 'Aanstaande week';
+ break;
+ case 1:
+ humanReadableWeek = 'Volgende week';
+ break;
+ case -1:
+ humanReadableWeek = 'Afgelopen week';
+ break;
+ }
+ } else {
+ switch (self._weekOffset) {
+ case 0:
+ humanReadableWeek = 'Huidige week';
+ break;
+ case 1:
+ humanReadableWeek = 'Volgende week';
+ break;
+ case -1:
+ humanReadableWeek = 'Vorige week';
+ break;
+ }
+ }
+ if (humanReadableWeek != null) {
+ self._nodes.currentWeekNormalText.textContent = humanReadableWeek + ' • ' + selectedWeekNumber;
+ self._nodes.currentWeekPrintText.textContent = 'Week ' + selectedWeekNumber;
+ } else {
+ self._nodes.currentWeekNormalText.textContent = 'Week ' + selectedWeekNumber;
+ self._nodes.currentWeekPrintText.textContent = 'Week ' + selectedWeekNumber;
+ }
+};
+
+self._handlePrevButtonClick = function () {
+ self._weekOffset -= 1;
+ self.updateCurrentWeek();
+};
+
+self._handleNextButtonClick = function () {
+ self._weekOffset += 1;
+ self.updateCurrentWeek();
+};
+
+self._nodes.prevButton.addEventListener('click', self._handlePrevButtonClick);
+self._nodes.nextButton.addEventListener('click', self._handleNextButtonClick);
+
+module.exports = self;
+
+},{"events":1}]},{},[11])
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZXZlbnRzL2V2ZW50cy5qcyIsIm5vZGVfbW9kdWxlcy9mdXp6eS9saWIvZnV6enkuanMiLCJub2RlX21vZHVsZXMvbGVmdC1wYWQvaW5kZXguanMiLCJub2RlX21vZHVsZXMvc21vb3Roc2Nyb2xsLXBvbHlmaWxsL2Rpc3Qvc21vb3Roc2Nyb2xsLmpzIiwicHVibGljL2phdmFzY3JpcHRzL2FuYWx5dGljcy5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9hdXRvY29tcGxldGUuanMiLCJ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--git a/public/javascripts/favorite.js b/public/javascripts/favorite.js
index 9edc248..92c87f7 100644
--- a/public/javascripts/favorite.js
+++ b/public/javascripts/favorite.js
@@ -44,7 +44,7 @@ self.updateDom = function (isFavorite) {
self.update = function (selectedUser) {
const currentUser = self.get()
- if (currentUser == null) {
+ if (currentUser == null || selectedUser == null) {
self.updateDom(false)
return
}
diff --git a/public/javascripts/main.bak.js b/public/javascripts/main.bak.js
deleted file mode 100644
index 895dd3f..0000000
--- a/public/javascripts/main.bak.js
+++ /dev/null
@@ -1,244 +0,0 @@
-/* global ga FLAGS USERS */
-
-require('flexibility')
-
-const fuzzy = require('fuzzy')
-// const getUsers = require('./getUsers')
-const getURLOfUser = require('./getURLOfUser')
-const removeDiacritics = require('diacritics').remove
-const getWeek = require('./getWeek')
-const easterEggs = require('./easterEggs')
-
-const searchNode = document.querySelector('#search')
-const inputNode = searchNode.querySelector('input[type="search"]')
-const autocompleteNode = document.querySelector('.autocomplete')
-const scheduleIframe = document.querySelector('#schedule')
-const prevButton = document.querySelectorAll('#week-selector button')[0]
-const nextButton = document.querySelectorAll('#week-selector button')[1]
-const currentWeekNode = document.querySelector('.current')
-const favNode = document.querySelector('.fav')
-
-if (FLAGS.indexOf('NO_FEATURE_DETECT') === -1) {
- if (document.querySelector('#schedule').getClientRects()[0].bottom !==
- document.body.getClientRects()[0].bottom) {
- window.location = 'http://www.meetingpointmco.nl/Roosters-AL/doc/'
- } else {
- window.onerror = function () {
- window.location = 'http://www.meetingpointmco.nl/Roosters-AL/doc/'
- }
- }
-} else {
- console.log('feature detection is OFF')
-}
-
-let selectedResult = -1
-let selectedUser
-let results = []
-let offset = 0
-
-function getCurrentFav () {
- if (!window.localStorage.getItem('fav')) return
- const favCode = window.localStorage.getItem('fav').split(':')
- const fav = USERS.filter(user => user.type === favCode[0] && user.index === Number(favCode[1]))
- return fav[0]
-}
-
-function changeFav (isFav) {
- if (!selectedUser) return
- if (isFav) {
- window.localStorage.setItem('fav', selectedUser.type + ':' + selectedUser.index)
- } else {
- window.localStorage.removeItem('fav')
- }
- updateFavNode()
-}
-
-function usersEqual (user1, user2) {
- if (user1 == null || user2 == null) return false
- return user1.type === user2.type && user1.index === user2.index
-}
-
-function updateFavNode () {
- if (usersEqual(getCurrentFav(), selectedUser)) {
- favNode.innerHTML = '&#xE838;'
- } else {
- favNode.innerHTML = '&#xE83A'
- }
-}
-
-function updateWeekText () {
- if (offset === 0) currentWeekNode.innerHTML = `Week ${getWeek() + offset}`
- else currentWeekNode.innerHTML = `<strong>Week ${getWeek() + offset}</strong>`
-}
-
-updateWeekText()
-
-searchNode.addEventListener('keydown', function (e) {
- if ((results.length !== 0) && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) {
- e.preventDefault()
-
- if (document.querySelector('.selected')) document.querySelector('.selected').classList.remove('selected')
-
- const change = e.key === 'ArrowDown' ? 1 : -1
- selectedResult += change
- if (selectedResult < -1) selectedResult = results.length - 1
- else if (selectedResult > results.length - 1) selectedResult = -1
-
- if (selectedResult !== -1) autocompleteNode.children[selectedResult].classList.add('selected')
- }
-})
-
-let inputEventStr
-if (navigator.userAgent.indexOf('MSIE') !== -1 ||
- navigator.appVersion.indexOf('Trident/') > 0) {
- inputEventStr = 'textinput' // IE 6-11
-} else {
- inputEventStr = 'input' // normal browsers
-}
-
-searchNode.addEventListener(inputEventStr, function (e) {
- document.body.classList.remove('no-input')
- autocompleteNode.innerHTML = ''
- if (inputNode.value.trim() === '') return
-
- selectedResult = -1
- results = fuzzy.filter(removeDiacritics(inputNode.value), USERS, {
- extract: function (el) { return removeDiacritics(el.value) }
- }).slice(0, 7)
-
- results.forEach(function (result) {
- const resultNode = document.createElement('li')
- resultNode.innerHTML = `${result.original.value}`
- autocompleteNode.appendChild(resultNode)
- })
-})
-
-searchNode.addEventListener('submit', submitForm)
-
-function submitForm (e) {
- if (e) e.preventDefault()
- if (results.length !== 0) {
- const indexInResult = selectedResult === -1 ? 0 : selectedResult
- selectedUser = USERS[results[indexInResult].index]
- }
- if (selectedUser == null) return
-
- document.body.classList.add('searched')
-
- updateFavNode()
-
- inputNode.value = selectedUser.value
- autocompleteNode.innerHTML = ''
-
- inputNode.blur()
-
- scheduleIframe.src = getURLOfUser(offset, selectedUser.type, selectedUser.index + 1)
-
- let eventAction
- switch (selectedUser.type) {
- case 'c':
- eventAction = 'Class'
- break
- case 't':
- eventAction = 'Teacher'
- break
- case 'r':
- eventAction = 'Room'
- break
- case 's':
- eventAction = 'Student'
- break
- }
- const eventLabel = selectedUser.value
-
- ga(function () {
- ga('send', { hitType: 'event', eventCategory: 'search', eventAction, eventLabel })
- })
-}
-
-autocompleteNode.addEventListener('click', function (e) {
- if (autocompleteNode.contains(e.target)) {
- selectedResult = Array.prototype.indexOf.call(e.target.parentElement.childNodes, e.target)
- submitForm()
- }
-})
-
-prevButton.addEventListener('click', function () {
- offset--
- updateWeekText()
- submitForm()
-})
-
-nextButton.addEventListener('click', function () {
- offset++
- updateWeekText()
- submitForm()
-})
-
-inputNode.addEventListener('click', function () {
- inputNode.select()
-})
-
-window.addEventListener('blur', function () {
- // this will removed the selection without drawing focus on it (safari)
- // this will removed selection even when focusing an iframe (chrome)
- const oldValue = inputNode.value
- inputNode.value = ''
- inputNode.value = oldValue
-
- // this will hide the keyboard (iOS safari)
- document.activeElement.blur()
-})
-
-searchNode.addEventListener('blur', function (e) {
- autocompleteNode.innerHTML = ''
-})
-
-favNode.addEventListener('click', function () {
- if (usersEqual(getCurrentFav(), selectedUser)) {
- changeFav(false)
- } else {
- changeFav(true)
- }
-})
-
-const currentFav = getCurrentFav()
-
-if (currentFav) {
- selectedUser = currentFav
- inputNode.value = selectedUser.value
- scheduleIframe.src = getURLOfUser(offset, selectedUser.type, selectedUser.index + 1)
- updateFavNode()
-
- let eventAction
- switch (selectedUser.type) {
- case 'c':
- eventAction = 'Class'
- break
- case 't':
- eventAction = 'Teacher'
- break
- case 'r':
- eventAction = 'Room'
- break
- case 's':
- eventAction = 'Student'
- break
- }
- const eventLabel = selectedUser.value
-
- ga(function () {
- ga('send', { hitType: 'event', eventCategory: 'search fav', eventAction, eventLabel })
- })
-} else if (inputNode.value === '') {
- document.body.classList.add('no-input')
- inputNode.focus()
-}
-
-if (scheduleIframe.src !== '') {
- document.body.classList.add('searched')
-}
-
-document.body.style.opacity = '1'
-
-window.easterEggs = easterEggs
diff --git a/public/javascripts/main.js b/public/javascripts/main.js
index 6f99621..67e1567 100644
--- a/public/javascripts/main.js
+++ b/public/javascripts/main.js
@@ -7,6 +7,7 @@ const weekSelector = require('./weekSelector')
const favorite = require('./favorite')
const scrollSnap = require('./scrollSnap')
const analytics = require('./analytics')
+const url = require('./url')
const state = {}
@@ -17,29 +18,54 @@ frontpage.show()
weekSelector.updateCurrentWeek()
scrollSnap.startListening()
-if (favorite.get() != null) {
- state.selectedItem = favorite.get()
- favorite.update(state.selectedItem)
- analytics.send.search(state.selectedItem, true)
- schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem)
+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 (selectedItem) {
- state.selectedItem = selectedItem
- favorite.update(state.selectedItem)
- analytics.send.search(state.selectedItem)
- schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem)
+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.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
diff --git a/public/javascripts/schedule.js b/public/javascripts/schedule.js
index a1ca647..fa2c1b5 100644
--- a/public/javascripts/schedule.js
+++ b/public/javascripts/schedule.js
@@ -44,8 +44,10 @@ self._handleError = function (event) {
self._getURLOfUsers = function (week, type, index) {
const id = index + 1
- return '//' + window.location.host + '/meetingpointProxy/Roosters-AL%2Fdoc%2Fdagroosters%2F' +
- leftPad(week, 2, '0') + '%2F' + type + '%2F' + type + leftPad(id, 5, '0') + '.htm'
+ const meetingpointURL =
+ `Roosters-AL/doc/dagroosters/${leftPad(week, 2, '0')}/${type}/` +
+ `${type}${leftPad(id, 5, '0')}.htm`
+ return `/meetingpointProxy/${window.encodeURIComponent(meetingpointURL)}`
}
self._removeChilds = function () {
@@ -55,17 +57,23 @@ self._removeChilds = function () {
}
self.viewItem = function (week, selectedUser) {
- const url = self._getURLOfUsers(week, selectedUser.type, selectedUser.index)
+ if (selectedUser == null) {
+ self._removeChilds()
+ search.updateDom(selectedUser)
+ } else {
+ const url = self._getURLOfUsers(week, selectedUser.type,
+ selectedUser.index)
- self._removeChilds()
+ self._removeChilds()
- const request = new window.XMLHttpRequest()
- request.addEventListener('load', self._handleLoad)
- request.addEventListener('error', self._handleError)
- request.open('GET', url, true)
- request.send()
+ const request = new window.XMLHttpRequest()
+ request.addEventListener('load', self._handleLoad)
+ request.addEventListener('error', self._handleError)
+ request.open('GET', url, true)
+ request.send()
- search.updateDom(selectedUser)
+ search.updateDom(selectedUser)
+ }
}
module.exports = self
diff --git a/public/javascripts/scrollSnap.js b/public/javascripts/scrollSnap.js
index 167f0c1..afee979 100644
--- a/public/javascripts/scrollSnap.js
+++ b/public/javascripts/scrollSnap.js
@@ -12,12 +12,13 @@ self._timeoutID = null
self._getScrollPosition = function () {
return (document.documentElement && document.documentElement.scrollTop) ||
- document.body.scrollTop
+ document.body.scrollTop
}
self._handleDoneScrolling = function () {
const scrollPosition = self._getScrollPosition()
- const weekSelectorHeight = self._nodes.weekSelector.clientHeight - self._nodes.search.clientHeight
+ const weekSelectorHeight =
+ self._nodes.weekSelector.clientHeight - self._nodes.search.clientHeight
if (scrollPosition < weekSelectorHeight && scrollPosition > 0) {
window.scroll({ top: weekSelectorHeight, left: 0, behavior: 'smooth' })
}
@@ -28,7 +29,8 @@ self._handleScroll = function () {
self._timeoutID = window.setTimeout(self._handleDoneScrolling, 500)
const scrollPosition = self._getScrollPosition()
- const weekSelectorHeight = self._nodes.weekSelector.clientHeight - self._nodes.search.clientHeight
+ const weekSelectorHeight =
+ self._nodes.weekSelector.clientHeight - self._nodes.search.clientHeight
if (scrollPosition >= weekSelectorHeight) {
document.body.classList.add('week-selector-not-visible')
} else {
@@ -37,8 +39,10 @@ self._handleScroll = function () {
}
self._handleWindowResize = function () {
- const weekSelectorHeight = self._nodes.weekSelector.clientHeight - self._nodes.search.clientHeight
- const extraPixelsNeeded = weekSelectorHeight - (document.body.clientHeight - window.innerHeight)
+ const weekSelectorHeight =
+ self._nodes.weekSelector.clientHeight - self._nodes.search.clientHeight
+ const extraPixelsNeeded =
+ weekSelectorHeight - (document.body.clientHeight - window.innerHeight)
if (extraPixelsNeeded > 0) {
document.body.style.marginBottom = extraPixelsNeeded + 'px'
} else {
diff --git a/public/javascripts/search.js b/public/javascripts/search.js
index a07d6dd..96413b0 100644
--- a/public/javascripts/search.js
+++ b/public/javascripts/search.js
@@ -13,22 +13,29 @@ self._nodes = {
}
self.submit = function () {
- const selectedItem = autocomplete.getSelectedItem()
- if (selectedItem == null) return
+ const selectedUser = autocomplete.getSelectedUser()
+ if (selectedUser == null) return
- console.log(selectedItem)
+ console.log(selectedUser)
self._nodes.input.blur()
document.body.classList.remove('week-selector-not-visible') // Safari bug
- self.emit('search', selectedItem)
+ self.emit('search', selectedUser)
}
-self.updateDom = function (selectedItem) {
- self._nodes.input.value = selectedItem.value
- autocomplete.removeAllItems()
- document.body.classList.remove('no-input')
- document.body.classList.add('searched')
+self.updateDom = function (selectedUser) {
+ if (selectedUser == null) {
+ self._nodes.input.value = ''
+ autocomplete.removeAllItems()
+ document.body.classList.add('no-input')
+ document.body.classList.remove('searched')
+ } else {
+ self._nodes.input.value = selectedUser.value
+ autocomplete.removeAllItems()
+ document.body.classList.remove('no-input')
+ document.body.classList.add('searched')
+ }
}
self.focus = function () {
@@ -42,7 +49,7 @@ self._handleSubmit = function (event) {
self._calculate = function (searchTerm) {
const allResults = fuzzy.filter(searchTerm, USERS, {
- extract: function (item) { return item.value }
+ extract: function (user) { return user.value }
})
const firstResults = allResults.slice(0, 7)
diff --git a/public/javascripts/url.js b/public/javascripts/url.js
new file mode 100644
index 0000000..63e6081
--- /dev/null
+++ b/public/javascripts/url.js
@@ -0,0 +1,59 @@
+/* global USERS */
+
+const EventEmitter = require('events')
+
+const self = new EventEmitter()
+
+self._getPageTitle = function (selectedUser) {
+ if (selectedUser == null) {
+ return `Metis Rooster`
+ } else {
+ return `Metis Rooster - ${selectedUser.value}`
+ }
+}
+
+self._getPageURL = function (selectedUser) {
+ return `/${selectedUser.type}/${selectedUser.value}`
+}
+
+self.push = function (selectedUser, push) {
+ if (push == null) push = true
+ const pageTitle = self._getPageTitle(selectedUser)
+ const pageURL = self._getPageURL(selectedUser)
+ if (push) {
+ window.history.pushState(selectedUser, pageTitle, pageURL)
+ } else {
+ window.history.replaceState(selectedUser, pageTitle, pageURL)
+ }
+}
+
+self.update = function (selectedUser) {
+ document.title = self._getPageTitle(selectedUser)
+}
+
+self.hasSelectedUser = function () {
+ const pageUrl = window.location.pathname
+ return /^\/s\/|^\/t\/|^\/r\/|^\/c\//.test(pageUrl)
+}
+
+self.getSelectedUser = function () {
+ const pageUrl = window.location.pathname
+ const pageUrlData = pageUrl.split('/')
+ const type = pageUrlData[1]
+ const value = pageUrlData[2]
+
+ const user = USERS.filter(function (user) {
+ return user.type === type &&
+ user.value === value
+ })[0]
+
+ return user
+}
+
+self._handleUpdate = function (event) {
+ self.emit('update', event.state)
+}
+
+window.addEventListener('popstate', self._handleUpdate)
+
+module.exports = self
diff --git a/public/mstile-150x150.png b/public/mstile-150x150.png
new file mode 100644
index 0000000..5e381e6
--- /dev/null
+++ b/public/mstile-150x150.png
Binary files differ
diff --git a/public/safari-pinned-tab.svg b/public/safari-pinned-tab.svg
new file mode 100644
index 0000000..97ce8bf
--- /dev/null
+++ b/public/safari-pinned-tab.svg
@@ -0,0 +1,34 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
+ "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
+ width="16.000000pt" height="16.000000pt" viewBox="0 0 16.000000 16.000000"
+ preserveAspectRatio="xMidYMid meet">
+<metadata>
+Created by potrace 1.11, written by Peter Selinger 2001-2013
+</metadata>
+<g transform="translate(0.000000,16.000000) scale(0.012030,-0.012030)"
+fill="#000000" stroke="none">
+<path d="M498 1233 c-10 -20 -1 -650 11 -690 18 -64 84 -154 141 -192 82 -55
+144 -66 385 -66 l209 0 1 478 c0 262 0 477 0 477 -1 0 -20 -18 -44 -40 -24
+-22 -64 -52 -89 -67 -44 -26 -49 -27 -231 -28 -102 -1 -202 3 -221 8 -47 12
+-107 54 -135 95 -13 18 -25 30 -27 25z"/>
+<path d="M405 917 c-95 -24 -193 -97 -250 -187 -77 -122 -83 -287 -14 -421 30
+-60 113 -142 173 -173 171 -86 353 -62 489 64 48 45 50 49 27 50 -14 0 -41
+-13 -59 -30 -33 -27 -131 -86 -131 -77 0 2 14 32 30 66 17 35 30 64 28 65 -42
+30 -86 48 -120 49 -42 2 -42 2 -43 42 -1 31 -27 95 -39 95 -1 0 -2 -30 -1 -67
+l0 -68 -73 -3 c-84 -3 -84 -2 -97 105 l-7 62 77 -1 c42 0 78 2 81 5 2 2 2 11
+-2 20 -4 12 -18 16 -48 16 -22 -1 -56 -1 -74 0 l-34 1 6 53 c4 28 10 66 14 82
+8 29 11 30 62 30 43 0 54 3 56 18 2 14 -6 17 -41 17 -24 0 -46 3 -48 8 -7 10
+39 102 65 129 22 24 32 50 20 56 -4 2 -25 -1 -47 -6z m-58 -119 l-32 -68 -52
+0 c-29 0 -53 4 -53 8 0 15 74 80 120 106 24 14 45 24 46 23 1 -1 -12 -32 -29
+-69z m-52 -153 c-4 -27 -8 -62 -10 -76 -1 -15 -5 -31 -8 -35 -5 -9 -133 -11
+-142 -2 -7 7 15 108 30 138 12 23 19 25 75 25 l62 1 -7 -51z m-14 -168 c0 -7
+2 -19 3 -27 2 -8 6 -41 10 -72 l7 -58 -61 0 -61 0 -19 43 c-10 23 -21 61 -25
+84 l-6 41 76 1 c52 0 75 -3 76 -12z m65 -257 c18 -35 32 -65 31 -67 -14 -13
+-167 102 -167 126 0 4 23 7 52 7 l51 -1 33 -65z m145 58 c3 -5 5 -41 4 -81 -1
+-70 -2 -72 -26 -69 -13 1 -32 13 -42 25 -14 19 -67 119 -67 129 0 7 126 3 131
+-4z m164 0 c8 -7 -35 -94 -61 -125 -11 -12 -28 -23 -39 -25 -18 -3 -20 3 -20
+72 -1 41 0 77 1 80 4 8 111 6 119 -2z"/>
+</g>
+</svg>
diff --git a/routes/index.js b/routes/index.js
index 1ab2ba3..d1f7765 100644
--- a/routes/index.js
+++ b/routes/index.js
@@ -5,7 +5,7 @@ const router = express.Router()
const users = require('../lib/getUserIndex')
/* GET home page. */
-router.get('/', function (req, res, next) {
+router.get(['/', '/s/*', '/t/*', '/r/*', '/c/*'], function (req, res, next) {
let flags = []
if (req.query.nfd != null) {
flags.push('NO_FEATURE_DETECT')
diff --git a/views/layout.jade b/views/layout.jade
index a7b9d93..045b2f8 100644
--- a/views/layout.jade
+++ b/views/layout.jade
@@ -7,6 +7,10 @@ html
meta(name='viewport', content='width=device-width, initial-scale=1')
link(href='https://fonts.googleapis.com/css?family=Roboto', rel='stylesheet')
link(rel='manifest', href='/manifest.webmanifest')
+ link(rel="apple-touch-icon", sizes="120x120", href="/apple-touch-icon.png")
+ link(rel="icon", type="image/png", href="/favicon-32x32.png", sizes="32x32")
+ link(rel="icon", type="image/png", href="/favicon-16x16.png", sizes="16x16")
+ link(rel="mask-icon", href="/safari-pinned-tab.svg", color="#f44336")
block head
body(style='opacity: 0;')
block content