1
|
(function e(t,n,r){function o(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=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 o(n?n:e)},a,a.exports,e,t,n,r)}return n[i].exports}for(var s="function"==typeof require&&require,i=0;r.length>i;i++)o(r[i]);return o})({1:[function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function s(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}t.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,l,c,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var a=Error('Uncaught, unspecified "error" event. ('+t+")");throw a.context=t,a}if(n=this._events[e],i(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:l=Array.prototype.slice.call(arguments,1),n.apply(this,l)}else if(s(n))for(l=Array.prototype.slice.call(arguments,1),u=n.slice(),o=u.length,c=0;o>c;c++)u[c].apply(this,l);return!0},n.prototype.addListener=function(e,t){var o;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]?s(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,s(this._events[e])&&!this._events[e].warned&&(o=i(this._maxListeners)?n.defaultMaxListeners:this._maxListeners,o&&o>0&&this._events[e].length>o&&(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},n.prototype.on=n.prototype.addListener,n.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},n.prototype.removeListener=function(e,t){var n,o,i,l;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],i=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(s(n)){for(l=i;l-->0;)if(n[l]===t||n[l].listener&&n[l].listener===t){o=l;break}if(0>o)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},n.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},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},{}],2:[function(e,t,n){(function(){var e=this,r={};n!==void 0?t.exports=r:e.fuzzy=r,r.simpleFilter=function(e,t){return t.filter(function(t){return r.test(e,t)})},r.test=function(e,t){return null!==r.match(e,t)},r.match=function(e,t,n){n=n||{};var r,o=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 h=0;i>h;h++)r=t[h],d[h]===e[o]?(r=u+r+a,o+=1,c+=1+c):c=0,l+=c,s[s.length]=r;return o===e.length?(l=d===e?1/0:l,{rendered:s.join(""),score:l}):null},r.filter=function(e,t,n){return t&&0!==t.length?"string"!=typeof e?t:(n=n||{},t.reduce(function(t,o,s){var i=o;n.extract&&(i=n.extract(o));var l=r.match(e,i,n);return null!=l&&(t[t.length]={string:l.rendered,score:l.score,index:s,original:o}),t},[]).sort(function(e,t){var n=t.score-e.score;return n?n:e.index-t.index})):[]}})()},{}],3:[function(e,t){"use strict";function n(e,t,n){if(e+="",t-=e.length,0>=t)return e;if(n||0===n||(n=" "),n+=""," "===n&&10>t)return r[t]+e;for(var o="";;){if(1&t&&(o+=n),t>>=1,!t)break;n+=n}return o+e}t.exports=n;var r=[""," "," "," "," "," "," "," "," "," "]},{}],4:[function(e,t,n){(function(e,r,o){"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===o||"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,o,s;do t=t.parentNode,n=t===r.body,o=t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth,s="visible"===e.getComputedStyle(t,null).overflow;while(!n&&(!o||s));return n=o=s=null,t}function l(t){var r,o,s,i=h(),c=(i-t.startTime)/a;c=c>1?1:c,r=n(c),o=t.startX+(t.x-t.startX)*r,s=t.startY+(t.y-t.startY)*r,t.method.call(t.scrollable,o,s),(o!==t.x||s!==t.y)&&e.requestAnimationFrame(l.bind(e,t))}function c(n,o,s){var i,c,u,a,f=h();n===r.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),l({scrollable:i,method:a,startTime:f,startX:c,startY:u,x:o,y:s})}if(!("scrollBehavior"in r.documentElement.style)){var u=e.HTMLElement||e.Element,a=468,d={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,elScroll:u.prototype.scroll||t,scrollIntoView:u.prototype.scrollIntoView},h=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now;e.scroll=e.scrollTo=function(){return s(arguments[0])?(d.scroll.call(e,arguments[0].left||arguments[0],arguments[0].top||arguments[1]),o):(c.call(e,r.body,~~arguments[0].left,~~arguments[0].top),o)},e.scrollBy=function(){return s(arguments[0])?(d.scrollBy.call(e,arguments[0].left||arguments[0],arguments[0].top||arguments[1]),o):(c.call(e,r.body,~~arguments[0].left+(e.scrollX||e.pageXOffset),~~arguments[0].top+(e.scrollY||e.pageYOffset)),o)},u.prototype.scroll=u.prototype.scrollTo=function(){if(s(arguments[0]))return d.elScroll.call(this,arguments[0].left||arguments[0],arguments[0].top||arguments[1]),o;var e=arguments[0].left,t=arguments[0].top;c.call(this,this,"number"==typeof e?e:this.scrollLeft,"number"==typeof t?t:this.scrollTop)},u.prototype.scrollBy=function(){var e=arguments[0];"object"==typeof e?this.scroll({left:e.left+this.scrollLeft,top:e.top+this.scrollTop,behavior:e.behavior}):this.scroll(this.scrollLeft+e,this.scrollTop+arguments[1])},u.prototype.scrollIntoView=function(){if(s(arguments[0]))return d.scrollIntoView.call(this,arguments[0]===o?!0:arguments[0]),o;var t=i(this),n=t.getBoundingClientRect(),l=this.getBoundingClientRect();t!==r.body?(c.call(this,t,t.scrollLeft+l.left-n.left,t.scrollTop+l.top-n.top),e.scrollBy({left:n.left,top:n.top,behavior:"smooth"})):e.scrollBy({left:l.left,top:l.top,behavior:"smooth"})}}}"object"==typeof n?t.exports={polyfill:s}:s()})(window,document)},{}],5:[function(e,t){"use strict";var n={};n.send={},n.send.search=function(e,t){var n="event",r=t?"search fav":"search",o=void 0;switch(e.type){case"c":o="Class";break;case"t":o="Teacher";break;case"r":o="Room";break;case"s":o="Student"}var s=e.value;ga(function(){ga("send",{hitType:n,eventCategory:r,eventAction:o,eventLabel:s})})},t.exports=n},{}],6:[function(e,t){"use strict";var n=e("events"),r=new n;r._items=[],r._selectedItemIndex=-1,r._nodes={search:document.querySelector("#search"),input:document.querySelector('input[type="search"]'),autocomplete:document.querySelector(".autocomplete")},r.getSelectedItem=function(){return r.getItems()!==[]?-1===r.getSelectedItemIndex()?r.getItems()[0]:r.getItems()[r.getSelectedItemIndex()]:void 0},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:-1>r._selectedItemIndex+e?r._selectedItemIndex=r.getItems().length-1:r._selectedItemIndex+=e;for(var t=0;r.getItems().length>t;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){"use strict";var n={};n.isIE=-1!==navigator.userAgent.indexOf("MSIE")||navigator.appVersion.indexOf("Trident/")>0,n.inputEvent=n.isIE?"textinput":"input",t.exports=n},{}],8:[function(e,t){"use strict";var n=e("events"),r=new n;r._nodes={toggle:document.querySelector(".fav")},r.get=function(){try{var e=JSON.parse(window.localStorage.getItem("fav"));if(null==e)return;var t=USERS.filter(function(t){return t.type===e.type&&t.value===e.value})[0];return t}catch(n){return r.delete(),void 0}},r.set=function(e){window.localStorage.setItem("fav",JSON.stringify(e)),r._nodes.innerHTML=""},r.delete=function(){window.localStorage.removeItem("fav")},r.updateDom=function(e){r._nodes.toggle.innerHTML=e?"":""},r.update=function(e){var t=r.get();if(null==t)return r.updateDom(!1),void 0;var n=t.type===e.type&&t.index===e.index;r.updateDom(n)},r.toggle=function(e){var t=r.get(),n=null!=t&&t.type===e.type&&t.index===e.index;n?(r.delete(),r.updateDom(!1)):(r.set(e),r.updateDom(!0))},r._handleClick=function(){r.emit("click")},r._nodes.toggle.addEventListener("click",r._handleClick),t.exports=r},{events:1}],9:[function(e,t){"use strict";var n={};n._nodes={input:document.querySelector('input[type="search"]'),overflowButton:document.querySelector("#overflow-button")},n._shouldCheck=function(){return-1===FLAGS.indexOf("NO_FEATURE_DETECT")},n._redirect=function(){window.location.href="http://www.meetingpointmco.nl/Roosters-AL/doc/"},n.check=function(){n._shouldCheck()&&(window.onerror=n._redirect,n._nodes.input.getClientRects()[0].top!==n._nodes.overflowButton.getClientRects()[0].top&&n._redirect())},t.exports=n},{}],10:[function(e,t){"use strict";var n=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(n.inputEvent,r.hide),t.exports=r},{"./browserFixToolkit":7}],11:[function(e){"use strict";e("./featureDetect").check();var t=e("./frontpage"),n=e("./search"),r=e("./schedule"),o=e("./weekSelector"),s=e("./favorite"),i=e("./scrollSnap"),l=e("./analytics"),c={};window.state=c,window.require=e,t.show(),o.updateCurrentWeek(),i.startListening(),null!=s.get()?(c.selectedItem=s.get(),s.update(c.selectedItem),l.send.search(c.selectedItem,!0),r.viewItem(o.getSelectedWeek(),c.selectedItem)):n.focus(),n.on("search",function(e){c.selectedItem=e,s.update(c.selectedItem),l.send.search(c.selectedItem),r.viewItem(o.getSelectedWeek(),c.selectedItem)}),o.on("weekChanged",function(e){l.send.search(c.selectedItem),r.viewItem(e,c.selectedItem)}),s.on("click",function(){s.toggle(c.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){"use strict";var n=e("events"),r=e("left-pad"),o=e("./search"),s=new n;s._nodes={schedule:document.querySelector("#schedule")},s._parseMeetingpointHTML=function(e){var t=document.createElement("html");t.innerHTML=e;var n=t.querySelector("center");return n},s._handleLoad=function(e){var t=e.target;if(200>t.status||t.status>=400)return s._handleError(e),void 0;var n=s._parseMeetingpointHTML(t.response);s._removeChilds(),s._nodes.schedule.appendChild(n),s._nodes.schedule.classList.remove("error"),s.emit("load")},s._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.",s._removeChilds(),s._nodes.schedule.textContent=n,s._nodes.schedule.classList.add("error"),s.emit("load")},s._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"},s._removeChilds=function(){for(;s._nodes.schedule.firstChild;)s._nodes.schedule.removeChild(s._nodes.schedule.firstChild)},s.viewItem=function(e,t){if(o.updateDom(t),-1===VALID_WEEK_NUMBERS.indexOf(e))return s._handleError({target:{status:404}}),void 0;var n=s._getURLOfUsers(e,t.type,t.index);s._removeChilds();var r=new window.XMLHttpRequest;r.addEventListener("load",s._handleLoad),r.addEventListener("error",s._handleError),r.open("GET",n,!0),r.send()},t.exports=s},{"./search":14,events:1,"left-pad":3}],13:[function(e,t){"use strict";e("smoothscroll-polyfill").polyfill();var n={},r=e("./schedule");n._nodes={search:document.querySelector("#search"),weekSelector:document.querySelector("#week-selector")},n._timeoutID=null,n._getScrollPosition=function(){return document.documentElement&&document.documentElement.scrollTop||document.body.scrollTop},n._handleDoneScrolling=function(){var e=n._getScrollPosition(),t=n._nodes.weekSelector.clientHeight-n._nodes.search.clientHeight;t>e&&e>0&&window.scroll({top:t,left:0,behavior:"smooth"})},n._handleScroll=function(){null!=n._timeoutID&&window.clearTimeout(n._timeoutID),n._timeoutID=window.setTimeout(n._handleDoneScrolling,500);var e=n._getScrollPosition(),t=n._nodes.weekSelector.clientHeight-n._nodes.search.clientHeight;e>=t?document.body.classList.add("week-selector-not-visible"):document.body.classList.remove("week-selector-not-visible")},n._handleWindowResize=function(){var e=n._nodes.weekSelector.clientHeight-n._nodes.search.clientHeight,t=e-(document.body.clientHeight-window.innerHeight);document.body.style.marginBottom=t>0?t+"px":null},n.startListening=function(){window.addEventListener("scroll",n._handleScroll)},r.on("load",n._handleWindowResize),window.addEventListener("resize",n._handleWindowResize),t.exports=n},{"./schedule":12,"smoothscroll-polyfill":4}],14:[function(e,t){"use strict";var n=e("events"),r=e("fuzzy"),o=e("./autocomplete"),s=e("./browserFixToolkit"),i=new n;i._nodes={search:document.querySelector("#search"),input:document.querySelector('input[type="search"]')},i.submit=function(){var e=o.getSelectedItem();null!=e&&(console.log(e),i._nodes.input.blur(),document.body.classList.remove("week-selector-not-visible"),i.emit("search",e))},i.updateDom=function(e){i._nodes.input.value=e.value,o.removeAllItems(),document.body.classList.remove("no-input"),document.body.classList.add("searched")},i.focus=function(){i._nodes.input.focus()},i._handleSubmit=function(e){e.preventDefault(),i.submit()},i._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},i._handleTextUpdate=function(){var e=i._calculate(i._nodes.input.value);o.removeAllItems();for(var t=0;e.length>t;t++)o.addItem(e[t])},i._handleFocus=function(){i._nodes.input.select()},i._handleBlur=function(){var e=i._nodes.value;i._nodes.value="",i._nodes.value=e,document.activeElement.blur()},o.on("select",i.submit),i._nodes.search.addEventListener("submit",i._handleSubmit),i._nodes.input.addEventListener("focus",i._handleFocus),i._nodes.input.addEventListener("blur",i._handleBlur),i._nodes.input.addEventListener(s.inputEvent,i._handleTextUpdate),t.exports=i},{"./autocomplete":6,"./browserFixToolkit":7,events:1,fuzzy:2}],15:[function(e,t){"use strict";var n=e("events"),r=new n;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()+1e3*604800*r._weekOffset+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]);
|