aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package.json10
-rw-r--r--public/javascripts/autocomplete.js87
-rw-r--r--public/javascripts/browserFixToolkit.js12
-rw-r--r--public/javascripts/bundle.js1260
-rw-r--r--public/javascripts/easterEggs.js91
-rw-r--r--public/javascripts/favorite.js73
-rw-r--r--public/javascripts/frontpage.js23
-rw-r--r--public/javascripts/getURLOfUser.js9
-rw-r--r--public/javascripts/getUsers.js7
-rw-r--r--public/javascripts/getWeek.js33
-rw-r--r--public/javascripts/main.bak.js244
-rw-r--r--public/javascripts/main.js256
-rw-r--r--public/javascripts/schedule.js55
-rw-r--r--public/javascripts/search.js84
-rw-r--r--public/javascripts/weekSelector.js58
-rw-r--r--public/stylesheets/style.css5
-rw-r--r--views/index.jade2
17 files changed, 1332 insertions, 977 deletions
diff --git a/package.json b/package.json
index 7ad833f..4e98e6e 100644
--- a/package.json
+++ b/package.json
@@ -6,8 +6,9 @@
"scripts": {
"start": "node ./bin/www",
"setup": "npm install && bower install",
- "build-dev": "browserify -d -t [ babelify --presets [ es2015 ] ] -e ./public/javascripts/main.js > ./public/javascripts/bundle.js",
- "build": "browserify -t [ babelify --presets [ es2015 ] ] -e ./public/javascripts/main.js | uglifyjs -cm > ./public/javascripts/bundle.js"
+ "build-dev": "browserify -d -t [ babelify --presets [ es2016 ] ] -e ./public/javascripts/main.js > ./public/javascripts/bundle.js",
+ "watch": "watchify -v -d -t [ babelify --presets [ es2016 ] ] -e ./public/javascripts/main.js -o ./public/javascripts/bundle.js",
+ "build": "browserify -t [ babelify --presets [ es2016 ] ] -e ./public/javascripts/main.js | uglifyjs -cm > ./public/javascripts/bundle.js"
},
"dependencies": {
"bluebird": "^3.4.6",
@@ -29,11 +30,12 @@
"then-yield": "0.0.1"
},
"devDependencies": {
- "babel-preset-es2015": "^6.14.0",
+ "babel-preset-es2016": "^6.16.0",
"babelify": "^7.3.0",
"bower": "^1.7.9",
"browserify": "^13.1.0",
- "gulp": "^3.9.1"
+ "gulp": "^3.9.1",
+ "watchify": "^3.7.0"
},
"author": "Noah Loomans <noahloomans@gmail.com>",
"license": "MIT",
diff --git a/public/javascripts/autocomplete.js b/public/javascripts/autocomplete.js
new file mode 100644
index 0000000..71fb17d
--- /dev/null
+++ b/public/javascripts/autocomplete.js
@@ -0,0 +1,87 @@
+const EventEmitter = require('events')
+
+const self = new EventEmitter()
+
+self._items = []
+self._selectedItemIndex = -1
+
+self._nodes = {
+ search: document.querySelector('#search'),
+ input: document.querySelector('input[type="search"]'),
+ autocomplete: document.querySelector('.autocomplete')
+}
+
+self.getSelectedItem = function () {
+ if (self.getItems() === []) return
+
+ if (self.getSelectedItemIndex() === -1) {
+ return self.getItems()[0]
+ } else {
+ return self.getItems()[self.getSelectedItemIndex()]
+ }
+}
+
+self.getSelectedItemIndex = function () {
+ return self._selectedItemIndex
+}
+
+self.getItems = function () {
+ return self._items
+}
+
+self.removeAllItems = function () {
+ while (self._nodes.autocomplete.firstChild) {
+ self._nodes.autocomplete.removeChild(self._nodes.autocomplete.firstChild)
+ }
+ self._items = []
+ self._selectedItemIndex = -1
+}
+
+self.addItem = function (item) {
+ const listItem = document.createElement('li')
+ listItem.textContent = item.value
+ self._nodes.autocomplete.appendChild(listItem)
+ self._items.push(item)
+}
+
+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
+ } else {
+ self._selectedItemIndex += shift
+ }
+
+ for (let i = 0; i < self.getItems().length; i++) {
+ self._nodes.autocomplete.children[i].classList.remove('selected')
+ }
+ if (self._selectedItemIndex >= 0) {
+ self._nodes.autocomplete
+ .children[self._selectedItemIndex].classList.add('selected')
+ }
+}
+
+self._handleItemClick = function (event) {
+ if (!self._nodes.autocomplete.contains(event.target)) return
+ const itemIndex = Array.prototype.indexOf
+ .call(self._nodes.autocomplete.children, event.target)
+ self._selectedItemIndex = itemIndex
+ self.emit('select', self.getSelectedItem())
+}
+
+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
diff --git a/public/javascripts/browserFixToolkit.js b/public/javascripts/browserFixToolkit.js
new file mode 100644
index 0000000..fbeab74
--- /dev/null
+++ b/public/javascripts/browserFixToolkit.js
@@ -0,0 +1,12 @@
+const 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
diff --git a/public/javascripts/bundle.js b/public/javascripts/bundle.js
index 55ef8c7..433b74e 100644
--- a/public/javascripts/bundle.js
+++ b/public/javascripts/bundle.js
@@ -1,324 +1,308 @@
(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){
-exports.remove = removeDiacritics;
-
-var replacementList = [
- {
- base: ' ',
- chars: "\u00A0",
- }, {
- base: '0',
- chars: "\u07C0",
- }, {
- base: 'A',
- chars: "\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F",
- }, {
- base: 'AA',
- chars: "\uA732",
- }, {
- base: 'AE',
- chars: "\u00C6\u01FC\u01E2",
- }, {
- base: 'AO',
- chars: "\uA734",
- }, {
- base: 'AU',
- chars: "\uA736",
- }, {
- base: 'AV',
- chars: "\uA738\uA73A",
- }, {
- base: 'AY',
- chars: "\uA73C",
- }, {
- base: 'B',
- chars: "\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0181",
- }, {
- base: 'C',
- chars: "\u24b8\uff23\uA73E\u1E08\u0106\u0043\u0108\u010A\u010C\u00C7\u0187\u023B",
- }, {
- base: 'D',
- chars: "\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018A\u0189\u1D05\uA779",
- }, {
- base: 'Dh',
- chars: "\u00D0",
- }, {
- base: 'DZ',
- chars: "\u01F1\u01C4",
- }, {
- base: 'Dz',
- chars: "\u01F2\u01C5",
- }, {
- base: 'E',
- chars: "\u025B\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E\u1D07",
- }, {
- base: 'F',
- chars: "\uA77C\u24BB\uFF26\u1E1E\u0191\uA77B",
- }, {
- base: 'G',
- chars: "\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E\u0262",
- }, {
- base: 'H',
- chars: "\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D",
- }, {
- base: 'I',
- chars: "\u24BE\uFF29\xCC\xCD\xCE\u0128\u012A\u012C\u0130\xCF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197",
- }, {
- base: 'J',
- chars: "\u24BF\uFF2A\u0134\u0248\u0237",
- }, {
- base: 'K',
- chars: "\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2",
- }, {
- base: 'L',
- chars: "\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780",
- }, {
- base: 'LJ',
- chars: "\u01C7",
- }, {
- base: 'Lj',
- chars: "\u01C8",
- }, {
- base: 'M',
- chars: "\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C\u03FB",
- }, {
- base: 'N',
- chars: "\uA7A4\u0220\u24C3\uFF2E\u01F8\u0143\xD1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u019D\uA790\u1D0E",
- }, {
- base: 'NJ',
- chars: "\u01CA",
- }, {
- base: 'Nj',
- chars: "\u01CB",
- }, {
- base: 'O',
- chars: "\u24C4\uFF2F\xD2\xD3\xD4\u1ED2\u1ED0\u1ED6\u1ED4\xD5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\xD6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\xD8\u01FE\u0186\u019F\uA74A\uA74C",
- }, {
- base: 'OE',
- chars: "\u0152",
- }, {
- base: 'OI',
- chars: "\u01A2",
- }, {
- base: 'OO',
- chars: "\uA74E",
- }, {
- base: 'OU',
- chars: "\u0222",
- }, {
- base: 'P',
- chars: "\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754",
- }, {
- base: 'Q',
- chars: "\u24C6\uFF31\uA756\uA758\u024A",
- }, {
- base: 'R',
- chars: "\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782",
- }, {
- base: 'S',
- chars: "\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784",
- }, {
- base: 'T',
- chars: "\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786",
- }, {
- base: 'Th',
- chars: "\u00DE",
- }, {
- base: 'TZ',
- chars: "\uA728",
- }, {
- base: 'U',
- chars: "\u24CA\uFF35\xD9\xDA\xDB\u0168\u1E78\u016A\u1E7A\u016C\xDC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244",
- }, {
- base: 'V',
- chars: "\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245",
- }, {
- base: 'VY',
- chars: "\uA760",
- }, {
- base: 'W',
- chars: "\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72",
- }, {
- base: 'X',
- chars: "\u24CD\uFF38\u1E8A\u1E8C",
- }, {
- base: 'Y',
- chars: "\u24CE\uFF39\u1EF2\xDD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE",
- }, {
- base: 'Z',
- chars: "\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762",
- }, {
- base: 'a',
- chars: "\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250\u0251",
- }, {
- base: 'aa',
- chars: "\uA733",
- }, {
- base: 'ae',
- chars: "\u00E6\u01FD\u01E3",
- }, {
- base: 'ao',
- chars: "\uA735",
- }, {
- base: 'au',
- chars: "\uA737",
- }, {
- base: 'av',
- chars: "\uA739\uA73B",
- }, {
- base: 'ay',
- chars: "\uA73D",
- }, {
- base: 'b',
- chars: "\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253\u0182",
- }, {
- base: 'c',
- chars: "\uFF43\u24D2\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184",
- }, {
- base: 'd',
- chars: "\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\u018B\u13E7\u0501\uA7AA",
- }, {
- base: 'dh',
- chars: "\u00F0",
- }, {
- base: 'dz',
- chars: "\u01F3\u01C6",
- }, {
- base: 'e',
- chars: "\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u01DD",
- }, {
- base: 'f',
- chars: "\u24D5\uFF46\u1E1F\u0192",
- }, {
- base: 'ff',
- chars: "\uFB00",
- }, {
- base: 'fi',
- chars: "\uFB01",
- }, {
- base: 'fl',
- chars: "\uFB02",
- }, {
- base: 'ffi',
- chars: "\uFB03",
- }, {
- base: 'ffl',
- chars: "\uFB04",
- }, {
- base: 'g',
- chars: "\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\uA77F\u1D79",
- }, {
- base: 'h',
- chars: "\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265",
- }, {
- base: 'hv',
- chars: "\u0195",
- }, {
- base: 'i',
- chars: "\u24D8\uFF49\xEC\xED\xEE\u0129\u012B\u012D\xEF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131",
- }, {
- base: 'j',
- chars: "\u24D9\uFF4A\u0135\u01F0\u0249",
- }, {
- base: 'k',
- chars: "\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3",
- }, {
- base: 'l',
- chars: "\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747\u026D",
- }, {
- base: 'lj',
- chars: "\u01C9",
- }, {
- base: 'm',
- chars: "\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F",
- }, {
- base: 'n',
- chars: "\u24DD\uFF4E\u01F9\u0144\xF1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5\u043B\u0509",
- }, {
- base: 'nj',
- chars: "\u01CC",
- }, {
- base: 'o',
- chars: "\u24DE\uFF4F\xF2\xF3\xF4\u1ED3\u1ED1\u1ED7\u1ED5\xF5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\xF6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\xF8\u01FF\uA74B\uA74D\u0275\u0254\u1D11",
- }, {
- base: 'oe',
- chars: "\u0153",
- }, {
- base: 'oi',
- chars: "\u01A3",
- }, {
- base: 'oo',
- chars: "\uA74F",
- }, {
- base: 'ou',
- chars: "\u0223",
- }, {
- base: 'p',
- chars: "\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755\u03C1",
- }, {
- base: 'q',
- chars: "\u24E0\uFF51\u024B\uA757\uA759",
- }, {
- base: 'r',
- chars: "\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783",
- }, {
- base: 's',
- chars: "\u24E2\uFF53\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B\u0282",
- }, {
- base: 'ss',
- chars: "\xDF",
- }, {
- base: 't',
- chars: "\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787",
- }, {
- base: 'th',
- chars: "\u00FE",
- }, {
- base: 'tz',
- chars: "\uA729",
- }, {
- base: 'u',
- chars: "\u24E4\uFF55\xF9\xFA\xFB\u0169\u1E79\u016B\u1E7B\u016D\xFC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289",
- }, {
- base: 'v',
- chars: "\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C",
- }, {
- base: 'vy',
- chars: "\uA761",
- }, {
- base: 'w',
- chars: "\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73",
- }, {
- base: 'x',
- chars: "\u24E7\uFF58\u1E8B\u1E8D",
- }, {
- base: 'y',
- chars: "\u24E8\uFF59\u1EF3\xFD\u0177\u1EF9\u0233\u1E8F\xFF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF",
- }, {
- base: 'z',
- chars: "\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763",
+// 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;
+ }
+ }
}
-];
-var diacriticsMap = {};
-for (var i = 0; i < replacementList.length; i += 1) {
- var chars = replacementList[i].chars;
- for (var j = 0; j < chars.length; j += 1) {
- diacriticsMap[chars[j]] = replacementList[i].base;
+ 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 removeDiacritics(str) {
- return str.replace(/[^\u0000-\u007e]/g, function(c) {
- return diacriticsMap[c] || c;
- });
+function isNumber(arg) {
+ return typeof arg === 'number';
}
-},{}],2:[function(require,module,exports){
-(function (global){
-!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.flexibility=e()}}(function(){return function e(t,r,l){function n(f,i){if(!r[f]){if(!t[f]){var s="function"==typeof require&&require;if(!i&&s)return s(f,!0);if(o)return o(f,!0);var a=new Error("Cannot find module '"+f+"'");throw a.code="MODULE_NOT_FOUND",a}var c=r[f]={exports:{}};t[f][0].call(c.exports,function(e){var r=t[f][1][e];return n(r?r:e)},c,c.exports,e,t,r,l)}return r[f].exports}for(var o="function"==typeof require&&require,f=0;f<l.length;f++)n(l[f]);return n}({1:[function(e,t,r){t.exports=function(e){var t,r,l,n=-1;if(e.lines.length>1&&"flex-start"===e.style.alignContent)for(t=0;l=e.lines[++n];)l.crossStart=t,t+=l.cross;else if(e.lines.length>1&&"flex-end"===e.style.alignContent)for(t=e.flexStyle.crossSpace;l=e.lines[++n];)l.crossStart=t,t+=l.cross;else if(e.lines.length>1&&"center"===e.style.alignContent)for(t=e.flexStyle.crossSpace/2;l=e.lines[++n];)l.crossStart=t,t+=l.cross;else if(e.lines.length>1&&"space-between"===e.style.alignContent)for(r=e.flexStyle.crossSpace/(e.lines.length-1),t=0;l=e.lines[++n];)l.crossStart=t,t+=l.cross+r;else if(e.lines.length>1&&"space-around"===e.style.alignContent)for(r=2*e.flexStyle.crossSpace/(2*e.lines.length),t=r/2;l=e.lines[++n];)l.crossStart=t,t+=l.cross+r;else for(r=e.flexStyle.crossSpace/e.lines.length,t=e.flexStyle.crossInnerBefore;l=e.lines[++n];)l.crossStart=t,l.cross+=r,t+=l.cross}},{}],2:[function(e,t,r){t.exports=function(e){for(var t,r=-1;line=e.lines[++r];)for(t=-1;child=line.children[++t];){var l=child.style.alignSelf;"auto"===l&&(l=e.style.alignItems),"flex-start"===l?child.flexStyle.crossStart=line.crossStart:"flex-end"===l?child.flexStyle.crossStart=line.crossStart+line.cross-child.flexStyle.crossOuter:"center"===l?child.flexStyle.crossStart=line.crossStart+(line.cross-child.flexStyle.crossOuter)/2:(child.flexStyle.crossStart=line.crossStart,child.flexStyle.crossOuter=line.cross,child.flexStyle.cross=child.flexStyle.crossOuter-child.flexStyle.crossBefore-child.flexStyle.crossAfter)}}},{}],3:[function(e,t,r){t.exports=function l(e,l){var t="row"===l||"row-reverse"===l,r=e.mainAxis;if(r){var n=t&&"inline"===r||!t&&"block"===r;n||(e.flexStyle={main:e.flexStyle.cross,cross:e.flexStyle.main,mainOffset:e.flexStyle.crossOffset,crossOffset:e.flexStyle.mainOffset,mainBefore:e.flexStyle.crossBefore,mainAfter:e.flexStyle.crossAfter,crossBefore:e.flexStyle.mainBefore,crossAfter:e.flexStyle.mainAfter,mainInnerBefore:e.flexStyle.crossInnerBefore,mainInnerAfter:e.flexStyle.crossInnerAfter,crossInnerBefore:e.flexStyle.mainInnerBefore,crossInnerAfter:e.flexStyle.mainInnerAfter,mainBorderBefore:e.flexStyle.crossBorderBefore,mainBorderAfter:e.flexStyle.crossBorderAfter,crossBorderBefore:e.flexStyle.mainBorderBefore,crossBorderAfter:e.flexStyle.mainBorderAfter})}else t?e.flexStyle={main:e.style.width,cross:e.style.height,mainOffset:e.style.offsetWidth,crossOffset:e.style.offsetHeight,mainBefore:e.style.marginLeft,mainAfter:e.style.marginRight,crossBefore:e.style.marginTop,crossAfter:e.style.marginBottom,mainInnerBefore:e.style.paddingLeft,mainInnerAfter:e.style.paddingRight,crossInnerBefore:e.style.paddingTop,crossInnerAfter:e.style.paddingBottom,mainBorderBefore:e.style.borderLeftWidth,mainBorderAfter:e.style.borderRightWidth,crossBorderBefore:e.style.borderTopWidth,crossBorderAfter:e.style.borderBottomWidth}:e.flexStyle={main:e.style.height,cross:e.style.width,mainOffset:e.style.offsetHeight,crossOffset:e.style.offsetWidth,mainBefore:e.style.marginTop,mainAfter:e.style.marginBottom,crossBefore:e.style.marginLeft,crossAfter:e.style.marginRight,mainInnerBefore:e.style.paddingTop,mainInnerAfter:e.style.paddingBottom,crossInnerBefore:e.style.paddingLeft,crossInnerAfter:e.style.paddingRight,mainBorderBefore:e.style.borderTopWidth,mainBorderAfter:e.style.borderBottomWidth,crossBorderBefore:e.style.borderLeftWidth,crossBorderAfter:e.style.borderRightWidth},"content-box"===e.style.boxSizing&&("number"==typeof e.flexStyle.main&&(e.flexStyle.main+=e.flexStyle.mainInnerBefore+e.flexStyle.mainInnerAfter+e.flexStyle.mainBorderBefore+e.flexStyle.mainBorderAfter),"number"==typeof e.flexStyle.cross&&(e.flexStyle.cross+=e.flexStyle.crossInnerBefore+e.flexStyle.crossInnerAfter+e.flexStyle.crossBorderBefore+e.flexStyle.crossBorderAfter));e.mainAxis=t?"inline":"block",e.crossAxis=t?"block":"inline","number"==typeof e.style.flexBasis&&(e.flexStyle.main=e.style.flexBasis+e.flexStyle.mainInnerBefore+e.flexStyle.mainInnerAfter+e.flexStyle.mainBorderBefore+e.flexStyle.mainBorderAfter),e.flexStyle.mainOuter=e.flexStyle.main,e.flexStyle.crossOuter=e.flexStyle.cross,"auto"===e.flexStyle.mainOuter&&(e.flexStyle.mainOuter=e.flexStyle.mainOffset),"auto"===e.flexStyle.crossOuter&&(e.flexStyle.crossOuter=e.flexStyle.crossOffset),"number"==typeof e.flexStyle.mainBefore&&(e.flexStyle.mainOuter+=e.flexStyle.mainBefore),"number"==typeof e.flexStyle.mainAfter&&(e.flexStyle.mainOuter+=e.flexStyle.mainAfter),"number"==typeof e.flexStyle.crossBefore&&(e.flexStyle.crossOuter+=e.flexStyle.crossBefore),"number"==typeof e.flexStyle.crossAfter&&(e.flexStyle.crossOuter+=e.flexStyle.crossAfter)}},{}],4:[function(e,t,r){var l=e("../reduce");t.exports=function(e){if(e.mainSpace>0){var t=l(e.children,function(e,t){return e+parseFloat(t.style.flexGrow)},0);t>0&&(e.main=l(e.children,function(r,l){return"auto"===l.flexStyle.main?l.flexStyle.main=l.flexStyle.mainOffset+parseFloat(l.style.flexGrow)/t*e.mainSpace:l.flexStyle.main+=parseFloat(l.style.flexGrow)/t*e.mainSpace,l.flexStyle.mainOuter=l.flexStyle.main+l.flexStyle.mainBefore+l.flexStyle.mainAfter,r+l.flexStyle.mainOuter},0),e.mainSpace=0)}}},{"../reduce":12}],5:[function(e,t,r){var l=e("../reduce");t.exports=function(e){if(e.mainSpace<0){var t=l(e.children,function(e,t){return e+parseFloat(t.style.flexShrink)},0);t>0&&(e.main=l(e.children,function(r,l){return l.flexStyle.main+=parseFloat(l.style.flexShrink)/t*e.mainSpace,l.flexStyle.mainOuter=l.flexStyle.main+l.flexStyle.mainBefore+l.flexStyle.mainAfter,r+l.flexStyle.mainOuter},0),e.mainSpace=0)}}},{"../reduce":12}],6:[function(e,t,r){var l=e("../reduce");t.exports=function(e){var t;e.lines=[t={main:0,cross:0,children:[]}];for(var r,n=-1;r=e.children[++n];)"nowrap"===e.style.flexWrap||0===t.children.length||"auto"===e.flexStyle.main||e.flexStyle.main-e.flexStyle.mainInnerBefore-e.flexStyle.mainInnerAfter-e.flexStyle.mainBorderBefore-e.flexStyle.mainBorderAfter>=t.main+r.flexStyle.mainOuter?(t.main+=r.flexStyle.mainOuter,t.cross=Math.max(t.cross,r.flexStyle.crossOuter)):e.lines.push(t={main:r.flexStyle.mainOuter,cross:r.flexStyle.crossOuter,children:[]}),t.children.push(r);e.flexStyle.mainLines=l(e.lines,function(e,t){return Math.max(e,t.main)},0),e.flexStyle.crossLines=l(e.lines,function(e,t){return e+t.cross},0),"auto"===e.flexStyle.main&&(e.flexStyle.main=Math.max(e.flexStyle.mainOffset,e.flexStyle.mainLines+e.flexStyle.mainInnerBefore+e.flexStyle.mainInnerAfter+e.flexStyle.mainBorderBefore+e.flexStyle.mainBorderAfter)),"auto"===e.flexStyle.cross&&(e.flexStyle.cross=Math.max(e.flexStyle.crossOffset,e.flexStyle.crossLines+e.flexStyle.crossInnerBefore+e.flexStyle.crossInnerAfter+e.flexStyle.crossBorderBefore+e.flexStyle.crossBorderAfter)),e.flexStyle.crossSpace=e.flexStyle.cross-e.flexStyle.crossInnerBefore-e.flexStyle.crossInnerAfter-e.flexStyle.crossBorderBefore-e.flexStyle.crossBorderAfter-e.flexStyle.crossLines,e.flexStyle.mainOuter=e.flexStyle.main+e.flexStyle.mainBefore+e.flexStyle.mainAfter,e.flexStyle.crossOuter=e.flexStyle.cross+e.flexStyle.crossBefore+e.flexStyle.crossAfter}},{"../reduce":12}],7:[function(e,t,r){function l(t){for(var r,l=-1;r=t.children[++l];)e("./flex-direction")(r,t.style.flexDirection);e("./flex-direction")(t,t.style.flexDirection),e("./order")(t),e("./flexbox-lines")(t),e("./align-content")(t),l=-1;for(var n;n=t.lines[++l];)n.mainSpace=t.flexStyle.main-t.flexStyle.mainInnerBefore-t.flexStyle.mainInnerAfter-t.flexStyle.mainBorderBefore-t.flexStyle.mainBorderAfter-n.main,e("./flex-grow")(n),e("./flex-shrink")(n),e("./margin-main")(n),e("./margin-cross")(n),e("./justify-content")(n,t.style.justifyContent,t);e("./align-items")(t)}t.exports=l},{"./align-content":1,"./align-items":2,"./flex-direction":3,"./flex-grow":4,"./flex-shrink":5,"./flexbox-lines":6,"./justify-content":8,"./margin-cross":9,"./margin-main":10,"./order":11}],8:[function(e,t,r){t.exports=function(e,t,r){var l,n,o,f=r.flexStyle.mainInnerBefore,i=-1;if("flex-end"===t)for(l=e.mainSpace,l+=f;o=e.children[++i];)o.flexStyle.mainStart=l,l+=o.flexStyle.mainOuter;else if("center"===t)for(l=e.mainSpace/2,l+=f;o=e.children[++i];)o.flexStyle.mainStart=l,l+=o.flexStyle.mainOuter;else if("space-between"===t)for(n=e.mainSpace/(e.children.length-1),l=0,l+=f;o=e.children[++i];)o.flexStyle.mainStart=l,l+=o.flexStyle.mainOuter+n;else if("space-around"===t)for(n=2*e.mainSpace/(2*e.children.length),l=n/2,l+=f;o=e.children[++i];)o.flexStyle.mainStart=l,l+=o.flexStyle.mainOuter+n;else for(l=0,l+=f;o=e.children[++i];)o.flexStyle.mainStart=l,l+=o.flexStyle.mainOuter}},{}],9:[function(e,t,r){t.exports=function(e){for(var t,r=-1;t=e.children[++r];){var l=0;"auto"===t.flexStyle.crossBefore&&++l,"auto"===t.flexStyle.crossAfter&&++l;var n=e.cross-t.flexStyle.crossOuter;"auto"===t.flexStyle.crossBefore&&(t.flexStyle.crossBefore=n/l),"auto"===t.flexStyle.crossAfter&&(t.flexStyle.crossAfter=n/l),"auto"===t.flexStyle.cross?t.flexStyle.crossOuter=t.flexStyle.crossOffset+t.flexStyle.crossBefore+t.flexStyle.crossAfter:t.flexStyle.crossOuter=t.flexStyle.cross+t.flexStyle.crossBefore+t.flexStyle.crossAfter}}},{}],10:[function(e,t,r){t.exports=function(e){for(var t,r=0,l=-1;t=e.children[++l];)"auto"===t.flexStyle.mainBefore&&++r,"auto"===t.flexStyle.mainAfter&&++r;if(r>0){for(l=-1;t=e.children[++l];)"auto"===t.flexStyle.mainBefore&&(t.flexStyle.mainBefore=e.mainSpace/r),"auto"===t.flexStyle.mainAfter&&(t.flexStyle.mainAfter=e.mainSpace/r),"auto"===t.flexStyle.main?t.flexStyle.mainOuter=t.flexStyle.mainOffset+t.flexStyle.mainBefore+t.flexStyle.mainAfter:t.flexStyle.mainOuter=t.flexStyle.main+t.flexStyle.mainBefore+t.flexStyle.mainAfter;e.mainSpace=0}}},{}],11:[function(e,t,r){var l=/^(column|row)-reverse$/;t.exports=function(e){e.children.sort(function(e,t){return e.style.order-t.style.order||e.index-t.index}),l.test(e.style.flexDirection)&&e.children.reverse()}},{}],12:[function(e,t,r){function l(e,t,r){for(var l=e.length,n=-1;++n<l;)n in e&&(r=t(r,e[n],n));return r}t.exports=l},{}],13:[function(e,t,r){function l(e){i(f(e))}var n=e("./read"),o=e("./write"),f=e("./readAll"),i=e("./writeAll");t.exports=l,t.exports.read=n,t.exports.write=o,t.exports.readAll=f,t.exports.writeAll=i},{"./read":15,"./readAll":16,"./write":17,"./writeAll":18}],14:[function(e,t,r){function l(e,t,r){var l=e[t],f=String(l).match(o);if(!f){var a=t.match(s);if(a){var c=e["border"+a[1]+"Style"];return"none"===c?0:i[l]||0}return l}var y=f[1],x=f[2];return"px"===x?1*y:"cm"===x?.3937*y*96:"in"===x?96*y:"mm"===x?.3937*y*96/10:"pc"===x?12*y*96/72:"pt"===x?96*y/72:"rem"===x?16*y:n(l,r)}function n(e,t){f.style.cssText="border:none!important;clip:rect(0 0 0 0)!important;display:block!important;font-size:1em!important;height:0!important;margin:0!important;padding:0!important;position:relative!important;width:"+e+"!important",t.parentNode.insertBefore(f,t.nextSibling);var r=f.offsetWidth;return t.parentNode.removeChild(f),r}t.exports=l;var o=/^([-+]?\d*\.?\d+)(%|[a-z]+)$/,f=document.createElement("div"),i={medium:4,none:0,thick:6,thin:2},s=/^border(Bottom|Left|Right|Top)Width$/},{}],15:[function(e,t,r){function l(e){var t={alignContent:"stretch",alignItems:"stretch",alignSelf:"auto",borderBottomStyle:"none",borderBottomWidth:0,borderLeftStyle:"none",borderLeftWidth:0,borderRightStyle:"none",borderRightWidth:0,borderTopStyle:"none",borderTopWidth:0,boxSizing:"content-box",display:"inline",flexBasis:"auto",flexDirection:"row",flexGrow:0,flexShrink:1,flexWrap:"nowrap",justifyContent:"flex-start",height:"auto",marginTop:0,marginRight:0,marginLeft:0,marginBottom:0,paddingTop:0,paddingRight:0,paddingLeft:0,paddingBottom:0,maxHeight:"none",maxWidth:"none",minHeight:0,minWidth:0,order:0,position:"static",width:"auto"},r=e instanceof Element;if(r){var l=e.hasAttribute("data-style"),i=l?e.getAttribute("data-style"):e.getAttribute("style")||"";l||e.setAttribute("data-style",i);var s=window.getComputedStyle&&getComputedStyle(e)||{};f(t,s);var c=e.currentStyle||{};n(t,c),o(t,i);for(var y in t)t[y]=a(t,y,e);var x=e.getBoundingClientRect();t.offsetHeight=x.height||e.offsetHeight,t.offsetWidth=x.width||e.offsetWidth}var S={element:e,style:t};return S}function n(e,t){for(var r in e){var l=r in t;if(l)e[r]=t[r];else{var n=r.replace(/[A-Z]/g,"-$&").toLowerCase(),o=n in t;o&&(e[r]=t[n])}}var f="-js-display"in t;f&&(e.display=t["-js-display"])}function o(e,t){for(var r;r=i.exec(t);){var l=r[1].toLowerCase().replace(/-[a-z]/g,function(e){return e.slice(1).toUpperCase()});e[l]=r[2]}}function f(e,t){for(var r in e){var l=r in t;l&&!s.test(r)&&(e[r]=t[r])}}t.exports=l;var i=/([^\s:;]+)\s*:\s*([^;]+?)\s*(;|$)/g,s=/^(alignSelf|height|width)$/,a=e("./getComputedLength")},{"./getComputedLength":14}],16:[function(e,t,r){function l(e){var t=[];return n(e,t),t}function n(e,t){for(var r,l=o(e),i=[],s=-1;r=e.childNodes[++s];){var a=3===r.nodeType&&!/^\s*$/.test(r.nodeValue);if(l&&a){var c=r;r=e.insertBefore(document.createElement("flex-item"),c),r.appendChild(c)}var y=r instanceof Element;if(y){var x=n(r,t);if(l){var S=r.style;S.display="inline-block",S.position="absolute",x.style=f(r).style,i.push(x)}}}var m={element:e,children:i};return l&&(m.style=f(e).style,t.push(m)),m}function o(e){var t=e instanceof Element,r=t&&e.getAttribute("data-style"),l=t&&e.currentStyle&&e.currentStyle["-js-display"],n=i.test(r)||s.test(l);return n}t.exports=l;var f=e("../read"),i=/(^|;)\s*display\s*:\s*(inline-)?flex\s*(;|$)/i,s=/^(inline-)?flex$/i},{"../read":15}],17:[function(e,t,r){function l(e){o(e);var t=e.element.style,r="inline"===e.mainAxis?["main","cross"]:["cross","main"];t.boxSizing="content-box",t.display="block",t.position="relative",t.width=n(e.flexStyle[r[0]]-e.flexStyle[r[0]+"InnerBefore"]-e.flexStyle[r[0]+"InnerAfter"]-e.flexStyle[r[0]+"BorderBefore"]-e.flexStyle[r[0]+"BorderAfter"]),t.height=n(e.flexStyle[r[1]]-e.flexStyle[r[1]+"InnerBefore"]-e.flexStyle[r[1]+"InnerAfter"]-e.flexStyle[r[1]+"BorderBefore"]-e.flexStyle[r[1]+"BorderAfter"]);for(var l,f=-1;l=e.children[++f];){var i=l.element.style,s="inline"===l.mainAxis?["main","cross"]:["cross","main"];i.boxSizing="content-box",i.display="block",i.position="absolute","auto"!==l.flexStyle[s[0]]&&(i.width=n(l.flexStyle[s[0]]-l.flexStyle[s[0]+"InnerBefore"]-l.flexStyle[s[0]+"InnerAfter"]-l.flexStyle[s[0]+"BorderBefore"]-l.flexStyle[s[0]+"BorderAfter"])),"auto"!==l.flexStyle[s[1]]&&(i.height=n(l.flexStyle[s[1]]-l.flexStyle[s[1]+"InnerBefore"]-l.flexStyle[s[1]+"InnerAfter"]-l.flexStyle[s[1]+"BorderBefore"]-l.flexStyle[s[1]+"BorderAfter"])),i.top=n(l.flexStyle[s[1]+"Start"]),i.left=n(l.flexStyle[s[0]+"Start"]),i.marginTop=n(l.flexStyle[s[1]+"Before"]),i.marginRight=n(l.flexStyle[s[0]+"After"]),i.marginBottom=n(l.flexStyle[s[1]+"After"]),i.marginLeft=n(l.flexStyle[s[0]+"Before"])}}function n(e){return"string"==typeof e?e:Math.max(e,0)+"px"}t.exports=l;var o=e("../flexbox")},{"../flexbox":7}],18:[function(e,t,r){function l(e){for(var t,r=-1;t=e[++r];)n(t)}t.exports=l;var n=e("../write")},{"../write":17}]},{},[13])(13)});
-}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
+function isObject(arg) {
+ return typeof arg === 'object' && arg !== null;
+}
-},{}],3:[function(require,module,exports){
+function isUndefined(arg) {
+ return arg === void 0;
+}
+
+},{}],2:[function(require,module,exports){
/*
* Fuzzy
* https://github.com/myork/fuzzy
@@ -456,7 +440,7 @@ fuzzy.filter = function(pattern, arr, opts) {
}());
-},{}],4:[function(require,module,exports){
+},{}],3:[function(require,module,exports){
'use strict';
module.exports = leftPad;
@@ -505,364 +489,440 @@ function leftPad (str, len, ch) {
return pad + str;
}
-},{}],5:[function(require,module,exports){
-'use strict';
+},{}],4:[function(require,module,exports){
+const EventEmitter = require('events');
-var sinterklaas = function sinterklaas() {
- console.log('sinterklaas easter egg activated');
- var searchNode = document.querySelector('#search');
- var inputNode = searchNode.querySelector('input[type="search"]');
- var autocompleteNode = document.querySelector('.autocomplete');
- var autocomplete = false;
- var lyrics = [[{ woord: 'Hoor ', time: 0 }, { woord: 'wie ', time: 0.3 }, { woord: 'klopt ', time: 0.6 }, { woord: 'daar ', time: 0.9 }, { woord: 'kind', time: 1.2 }, { woord: '\'ren', time: 1.5 }], [{ woord: 'Hoor ', time: 1.8 }, { woord: 'wie ', time: 2.1 }, { woord: 'klopt ', time: 2.5 }, { woord: 'daar ', time: 2.8 }, { woord: 'kind', time: 3.1 }, { woord: '\'ren', time: 3.4 }], [{ woord: 'Hoor ', time: 3.7 }, { woord: 'wie ', time: 4 }, { woord: 'tikt ', time: 4.3 }, { woord: 'daar ', time: 4.6 }, { woord: 'zacht', time: 4.8 }, { woord: 'jes ', time: 5.3 }, { woord: 'tegen ', time: 5.5 }, { woord: '\'t ', time: 6.1 }, { woord: 'raam ', time: 6.2 }]];
-
- var originalValue = inputNode.value;
-
- inputNode.value = '';
- inputNode.placeholder = '';
-
- lyrics.forEach(function (row, rowIndex) {
- row.forEach(function (word, wordIndex) {
- setTimeout(function () {
- if (wordIndex === 0) inputNode.placeholder = '';
- inputNode.placeholder += word.woord;
- }, word.time * 1000);
- if (lyrics.length === rowIndex + 1 && lyrics[rowIndex].length === wordIndex + 1) {
- setTimeout(function () {
- if (inputNode.value === '') {
- inputNode.value = originalValue;
- }
- inputNode.placeholder = 'Zoeken';
- autocomplete = true;
- }, word.time * 1000 + 1000);
- }
- });
- });
+const self = new EventEmitter();
- inputNode.addEventListener('focus', function () {
- if (!autocomplete) return;
+self._items = [];
+self._selectedItemIndex = -1;
- autocompleteNode.innerHTML = '';
+self._nodes = {
+ search: document.querySelector('#search'),
+ input: document.querySelector('input[type="search"]'),
+ autocomplete: document.querySelector('.autocomplete')
+};
- var autocompleteLyrics = ['\'t Is een vreemd\'ling zeker,', 'die verdwaalt is zeker.', '\'k Zal eens even vragen naar zijn naam:'];
+self.getSelectedItem = function () {
+ if (self.getItems() === []) return;
- autocompleteLyrics.forEach(function (row) {
- var resultNode = document.createElement('li');
- resultNode.innerHTML = row;
- autocompleteNode.appendChild(resultNode);
- });
- });
+ if (self.getSelectedItemIndex() === -1) {
+ return self.getItems()[0];
+ } else {
+ return self.getItems()[self.getSelectedItemIndex()];
+ }
+};
- inputNode.addEventListener('input', function () {
- if (!autocomplete) return;
- if (inputNode.value.toLowerCase() === 'sint nicolaas' || inputNode.value.toLowerCase() === 'sintnicolaas' || inputNode.value.toLowerCase() === 'sint nikolaas' || inputNode.value.toLowerCase() === 'sintnikolaas') {
- inputNode.value = '';
- window.location.href = 'https://www.youtube-nocookie.com/embed/jsOiKJ3kKXM?start=30';
- }
- });
+self.getSelectedItemIndex = function () {
+ return self._selectedItemIndex;
};
-module.exports = { sinterklaas: sinterklaas };
+self.getItems = function () {
+ return self._items;
+};
-},{}],6:[function(require,module,exports){
-'use strict';
+self.removeAllItems = function () {
+ while (self._nodes.autocomplete.firstChild) {
+ self._nodes.autocomplete.removeChild(self._nodes.autocomplete.firstChild);
+ }
+ self._items = [];
+ self._selectedItemIndex = -1;
+};
-var leftPad = require('left-pad');
-var getWeek = require('./getWeek');
+self.addItem = function (item) {
+ const listItem = document.createElement('li');
+ listItem.textContent = item.value;
+ self._nodes.autocomplete.appendChild(listItem);
+ self._items.push(item);
+};
-function getURLOfUsers(weekOffset, type, id) {
- return '//' + window.location.host + '/meetingpointProxy/Roosters-AL%2Fdoc%2Fdagroosters%2F' + (getWeek() + weekOffset + '%2F' + type + '%2F' + type + leftPad(id, 5, '0') + '.htm');
-}
+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;
+ } else {
+ self._selectedItemIndex += shift;
+ }
-module.exports = getURLOfUsers;
+ for (let i = 0; i < self.getItems().length; i++) {
+ self._nodes.autocomplete.children[i].classList.remove('selected');
+ }
+ if (self._selectedItemIndex >= 0) {
+ self._nodes.autocomplete.children[self._selectedItemIndex].classList.add('selected');
+ }
+};
-},{"./getWeek":7,"left-pad":4}],7:[function(require,module,exports){
-"use strict";
+self._handleItemClick = function (event) {
+ if (!self._nodes.autocomplete.contains(event.target)) return;
+ const itemIndex = Array.prototype.indexOf.call(self._nodes.autocomplete.children, event.target);
+ self._selectedItemIndex = itemIndex;
+ self.emit('select', self.getSelectedItem());
+};
-// 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.
-function getWeek() {
- // Create a copy of this date object
- var target = new Date();
+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);
+ }
+ }
+};
- // ISO week date weeks start on monday
- // so correct the day number
- var dayNr = (target.getDay() + 6) % 7;
+self._nodes.autocomplete.addEventListener('click', self._handleItemClick);
+self._nodes.input.addEventListener('keydown', self._handleKeydown);
- // ISO 8601 states that week 1 is the week
- // with the first thursday of that year.
- // Set the target date to the thursday in the target week
- target.setDate(target.getDate() - dayNr + 3);
+module.exports = self;
- // Store the millisecond value of the target date
- var firstThursday = target.valueOf();
+},{"events":1}],5:[function(require,module,exports){
+const self = {};
- // Set the target to the first thursday of the year
- // First set the target to january first
- target.setMonth(0, 1);
- // Not a thursday? Correct the date to the next thursday
- if (target.getDay() !== 4) {
- target.setMonth(0, 1 + (4 - target.getDay() + 7) % 7);
- }
+self.isIE = navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0;
- // The weeknumber is the number of weeks between the
- // first thursday of the year and the thursday in the target week
- return 1 + Math.ceil((firstThursday - target) / 604800000); // 604800000 = 7 * 24 * 3600 * 1000
+if (self.isIE) {
+ self.inputEvent = 'textinput';
+} else {
+ self.inputEvent = 'input';
}
-module.exports = getWeek;
+module.exports = self;
-},{}],8:[function(require,module,exports){
-'use strict';
+},{}],6:[function(require,module,exports){
+/* global USERS */
-/* global ga FLAGS USERS */
-
-require('flexibility');
-
-var fuzzy = require('fuzzy');
-// const getUsers = require('./getUsers')
-var getURLOfUser = require('./getURLOfUser');
-var removeDiacritics = require('diacritics').remove;
-var getWeek = require('./getWeek');
-var easterEggs = require('./easterEggs');
-
-var searchNode = document.querySelector('#search');
-var inputNode = searchNode.querySelector('input[type="search"]');
-var autocompleteNode = document.querySelector('.autocomplete');
-var scheduleIframe = document.querySelector('#schedule');
-var prevButton = document.querySelectorAll('#week-selector button')[0];
-var nextButton = document.querySelectorAll('#week-selector button')[1];
-var currentWeekNode = document.querySelector('.current');
-var 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');
-}
+const EventEmitter = require('events');
-var selectedResult = -1;
-var selectedUser = void 0;
-var results = [];
-var offset = 0;
+const self = new EventEmitter();
-function getCurrentFav() {
- if (!window.localStorage.getItem('fav')) return;
- var favCode = window.localStorage.getItem('fav').split(':');
- var fav = USERS.filter(function (user) {
- return user.type === favCode[0] && user.index === Number(favCode[1]);
- });
- return fav[0];
-}
+self._nodes = {
+ toggle: document.querySelector('.fav')
+};
+
+self.get = function () {
+ const localStorageUser = JSON.parse(window.localStorage.getItem('fav'));
+ if (localStorageUser == null) return;
+
+ const correctedUser = USERS.filter(user => user.type === localStorageUser.type && user.value === localStorageUser.value)[0];
+ return correctedUser;
+};
-function changeFav(isFav) {
- if (!selectedUser) return;
- if (isFav) {
- window.localStorage.setItem('fav', selectedUser.type + ':' + selectedUser.index);
+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 {
- window.localStorage.removeItem('fav');
+ self._nodes.toggle.innerHTML = '&#xE83A';
}
- updateFavNode();
-}
+};
-function usersEqual(user1, user2) {
- if (user1 == null || user2 == null) return false;
- return user1.type === user2.type && user1.index === user2.index;
-}
+self.update = function (selectedUser) {
+ const currentUser = self.get();
+
+ if (currentUser == null) {
+ self.updateDom(false);
+ return;
+ }
+
+ const isEqual = currentUser.type === selectedUser.type && currentUser.index === selectedUser.index;
+
+ self.updateDom(isEqual);
+};
-function updateFavNode() {
- if (usersEqual(getCurrentFav(), selectedUser)) {
- favNode.innerHTML = '&#xE838;';
+self.toggle = function (selectedUser) {
+ const currentUser = self.get();
+ const isEqual = currentUser != null && currentUser.type === selectedUser.type && currentUser.index === selectedUser.index;
+
+ if (isEqual) {
+ self.delete();
+ self.updateDom(false);
} else {
- favNode.innerHTML = '&#xE83A';
+ self.set(selectedUser);
+ self.updateDom(true);
}
-}
+};
-function updateWeekText() {
- if (offset === 0) currentWeekNode.innerHTML = 'Week ' + (getWeek() + offset);else currentWeekNode.innerHTML = '<strong>Week ' + (getWeek() + offset) + '</strong>';
-}
+self._handleClick = function () {
+ self.emit('click');
+};
-updateWeekText();
+self._nodes.toggle.addEventListener('click', self._handleClick);
-searchNode.addEventListener('keydown', function (e) {
- if (results.length !== 0 && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) {
- e.preventDefault();
+module.exports = self;
- if (document.querySelector('.selected')) document.querySelector('.selected').classList.remove('selected');
+},{"events":1}],7:[function(require,module,exports){
+const browserFixToolkit = require('./browserFixToolkit');
- var change = e.key === 'ArrowDown' ? 1 : -1;
- selectedResult += change;
- if (selectedResult < -1) selectedResult = results.length - 1;else if (selectedResult > results.length - 1) selectedResult = -1;
+const self = {};
- if (selectedResult !== -1) autocompleteNode.children[selectedResult].classList.add('selected');
- }
-});
+self._nodes = {
+ input: document.querySelector('input[type="search"]')
+};
+
+self.isShown = false;
+
+self.show = function () {
+ document.body.classList.add('no-input');
+ self.isShown = true;
+};
-var inputEventStr = void 0;
-if (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0) {
- inputEventStr = 'textinput'; // IE 6-11
+self.hide = function () {
+ document.body.classList.remove('no-input');
+ self.isShown = false;
+};
+
+self._nodes.input.addEventListener(browserFixToolkit.inputEvent, self.hide);
+
+module.exports = self;
+
+},{"./browserFixToolkit":5}],8:[function(require,module,exports){
+const frontpage = require('./frontpage');
+const search = require('./search');
+const schedule = require('./schedule');
+const weekSelector = require('./weekSelector');
+const favorite = require('./favorite');
+
+const state = {};
+
+window.state = state;
+window.require = require;
+
+frontpage.show();
+weekSelector.updateCurrentWeek();
+
+if (favorite.get() != null) {
+ state.selectedItem = favorite.get();
+ favorite.update(state.selectedItem);
+ schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem);
} else {
- inputEventStr = 'input'; // normal browsers
+ search.focus();
}
-searchNode.addEventListener(inputEventStr, function (e) {
- document.body.classList.remove('no-input');
- autocompleteNode.innerHTML = '';
- if (inputNode.value.trim() === '') return;
+search.on('search', function (selectedItem) {
+ state.selectedItem = selectedItem;
+ favorite.update(state.selectedItem);
+ schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem);
+});
- selectedResult = -1;
- results = fuzzy.filter(removeDiacritics(inputNode.value), USERS, {
- extract: function extract(el) {
- return removeDiacritics(el.value);
- }
- }).slice(0, 7);
+weekSelector.on('weekChanged', function (newWeek) {
+ schedule.viewItem(newWeek, state.selectedItem);
+});
- results.forEach(function (result) {
- var resultNode = document.createElement('li');
- resultNode.innerHTML = '' + result.original.value;
- autocompleteNode.appendChild(resultNode);
- });
+favorite.on('click', function () {
+ favorite.toggle(state.selectedItem);
});
-searchNode.addEventListener('submit', submitForm);
+document.body.style.opacity = 1;
+
+},{"./favorite":6,"./frontpage":7,"./schedule":9,"./search":10,"./weekSelector":11}],9:[function(require,module,exports){
+const leftPad = require('left-pad');
+const autocomplete = require('./autocomplete');
+const search = require('./search');
+
+const self = {};
-function submitForm(e) {
- if (e) e.preventDefault();
- if (results.length !== 0) {
- var indexInResult = selectedResult === -1 ? 0 : selectedResult;
- selectedUser = USERS[results[indexInResult].index];
+self._nodes = {
+ schedule: document.querySelector('#schedule')
+};
+
+self._parseMeetingpointHTML = function (htmlStr) {
+ const html = document.createElement('html');
+ html.innerHTML = htmlStr;
+ const centerNode = html.querySelector('center');
+ return centerNode;
+};
+
+self._handleLoad = function (event) {
+ const request = event.target;
+ if (request.status < 200 || request.status >= 400) {
+ self._handleError(event);
+ return;
}
- if (selectedUser == null) return;
+ const document = self._parseMeetingpointHTML(request.response);
+ self._nodes.schedule.appendChild(document);
+};
- document.body.classList.add('searched');
+self._handleError = function (event) {
+ const request = event.target;
+ console.error(request);
+};
+
+self._getURLOfUsers = function (week, type, index) {
+ const id = index + 1;
+ return `//${ window.location.host }/meetingpointProxy/Roosters-AL%2Fdoc%2Fdagroosters%2F` + `${ week }%2F${ type }%2F${ type }${ leftPad(id, 5, '0') }.htm`;
+};
+
+self.viewItem = function (week, selectedUser) {
+ const url = self._getURLOfUsers(week, selectedUser.type, selectedUser.index);
- updateFavNode();
-
- inputNode.value = selectedUser.value;
- autocompleteNode.innerHTML = '';
-
- inputNode.blur();
-
- scheduleIframe.src = getURLOfUser(offset, selectedUser.type, selectedUser.index + 1);
-
- 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;
+ while (self._nodes.schedule.firstChild) {
+ self._nodes.schedule.removeChild(self._nodes.schedule.firstChild);
}
- var eventLabel = selectedUser.value;
- ga(function () {
- ga('send', { hitType: 'event', eventCategory: 'search', eventAction: eventAction, eventLabel: eventLabel });
+ 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);
+};
+
+module.exports = self;
+
+},{"./autocomplete":4,"./search":10,"left-pad":3}],10:[function(require,module,exports){
+/* global USERS */
+
+const EventEmitter = require('events');
+const fuzzy = require('fuzzy');
+const autocomplete = require('./autocomplete');
+const browserFixToolkit = require('./browserFixToolkit');
+
+const self = new EventEmitter();
+
+self._nodes = {
+ search: document.querySelector('#search'),
+ input: document.querySelector('input[type="search"]')
+};
+
+self.submit = function () {
+ self._nodes.input.blur();
+
+ const selectedItem = autocomplete.getSelectedItem();
+
+ console.log(selectedItem);
+
+ self.emit('search', selectedItem);
+};
+
+self.updateDom = function (selectedItem) {
+ self._nodes.input.value = selectedItem.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) {
+ const allResults = fuzzy.filter(searchTerm, USERS, {
+ extract: item => item.value
});
-}
+ const firstResults = allResults.slice(0, 7);
-autocompleteNode.addEventListener('click', function (e) {
- if (autocompleteNode.contains(e.target)) {
- selectedResult = Array.prototype.indexOf.call(e.target.parentElement.childNodes, e.target);
- submitForm();
- }
-});
+ const originalResults = firstResults.map(result => result.original);
-prevButton.addEventListener('click', function () {
- offset--;
- updateWeekText();
- submitForm();
-});
+ return originalResults;
+};
-nextButton.addEventListener('click', function () {
- offset++;
- updateWeekText();
- submitForm();
-});
+self._handleTextUpdate = function () {
+ const results = self._calculate(self._nodes.input.value);
-inputNode.addEventListener('click', function () {
- inputNode.select();
-});
+ autocomplete.removeAllItems();
+ for (let i = 0; i < results.length; i++) {
+ autocomplete.addItem(results[i]);
+ }
+};
+
+self._handleFocus = function () {
+ self._nodes.input.select();
+};
-window.addEventListener('blur', function () {
+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 = inputNode.value;
- inputNode.value = '';
- inputNode.value = oldValue;
+ const oldValue = self._nodes.value;
+ self._nodes.value = '';
+ self._nodes.value = oldValue;
// this will hide the keyboard (iOS safari)
document.activeElement.blur();
-});
+};
-searchNode.addEventListener('blur', function (e) {
- autocompleteNode.innerHTML = '';
-});
+autocomplete.on('select', self.submit);
-favNode.addEventListener('click', function () {
- if (usersEqual(getCurrentFav(), selectedUser)) {
- changeFav(false);
- } else {
- changeFav(true);
+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":4,"./browserFixToolkit":5,"events":1,"fuzzy":2}],11:[function(require,module,exports){
+const EventEmitter = require('events');
+
+const self = new EventEmitter();
+
+self._nodes = {
+ prevButton: document.querySelectorAll('#week-selector button')[0],
+ nextButton: document.querySelectorAll('#week-selector button')[1],
+ currentWeekText: document.querySelector('#week-selector .current')
+};
+
+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) {
+ const dayNr = (target.getDay() + 6) % 7;
+ target.setDate(target.getDate() - dayNr + 3);
+ const firstThursday = target.valueOf();
+ target.setMonth(0, 1);
+ if (target.getDay() !== 4) {
+ target.setMonth(0, 1 + (4 - target.getDay() + 7) % 7);
}
-});
-var currentFav = getCurrentFav();
+ return 1 + Math.ceil((firstThursday - target) / 604800000);
+};
-if (currentFav) {
- (function () {
- selectedUser = currentFav;
- inputNode.value = selectedUser.value;
- scheduleIframe.src = getURLOfUser(offset, selectedUser.type, selectedUser.index + 1);
- updateFavNode();
+self.getSelectedWeek = function () {
+ const now = new Date();
+ const targetDate = new Date(now.getTime() + self._weekOffset * 604800 * 1000);
+ return self.getCurrentWeek(targetDate);
+};
- 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;
+self.updateCurrentWeek = function () {
+ const selectedWeekNumber = self.getSelectedWeek();
+ self._nodes.currentWeekText.textContent = `Week ${ selectedWeekNumber }`;
+ if (self.getCurrentWeek(new Date()) !== selectedWeekNumber) {
+ self._nodes.currentWeekText.classList.add('changed');
+ } else {
+ self._nodes.currentWeekText.classList.remove('changed');
+ }
+ self.emit('weekChanged', selectedWeekNumber);
+};
- ga(function () {
- ga('send', { hitType: 'event', eventCategory: 'search fav', eventAction: eventAction, eventLabel: eventLabel });
- });
- })();
-} else if (inputNode.value === '') {
- document.body.classList.add('no-input');
- inputNode.focus();
-}
+self._handlePrevButtonClick = function () {
+ self._weekOffset -= 1;
+ self.updateCurrentWeek();
+};
-if (inputNode.value !== '') {
- document.body.classList.remove('no-input');
- document.body.classList.add('searched');
-}
+self._handleNextButtonClick = function () {
+ self._weekOffset += 1;
+ self.updateCurrentWeek();
+};
-document.body.style.opacity = '1';
+self._nodes.prevButton.addEventListener('click', self._handlePrevButtonClick);
+self._nodes.nextButton.addEventListener('click', self._handleNextButtonClick);
-window.easterEggs = easterEggs;
+module.exports = self;
-},{"./easterEggs":5,"./getURLOfUser":6,"./getWeek":7,"diacritics":1,"flexibility":2,"fuzzy":3}]},{},[8])
-//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZGlhY3JpdGljcy9pbmRleC5qcyIsIm5vZGVfbW9kdWxlcy9mbGV4aWJpbGl0eS9mbGV4aWJpbGl0eS5qcyIsIm5vZGVfbW9kdWxlcy9mdXp6eS9saWIvZnV6enkuanMiLCJub2RlX21vZHVsZXMvbGVmdC1wYWQvaW5kZXguanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvZWFzdGVyRWdncy5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9nZXRVUkxPZlVzZXIuanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvZ2V0V2Vlay5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9tYWluLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0FDQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FB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YuZW1pdCgnd2Vla0NoYW5nZWQnLCBzZWxlY3RlZFdlZWtOdW1iZXIpXG59XG5cbnNlbGYuX2hhbmRsZVByZXZCdXR0b25DbGljayA9IGZ1bmN0aW9uICgpIHtcbiAgc2VsZi5fd2Vla09mZnNldCAtPSAxXG4gIHNlbGYudXBkYXRlQ3VycmVudFdlZWsoKVxufVxuXG5zZWxmLl9oYW5kbGVOZXh0QnV0dG9uQ2xpY2sgPSBmdW5jdGlvbiAoKSB7XG4gIHNlbGYuX3dlZWtPZmZzZXQgKz0gMVxuICBzZWxmLnVwZGF0ZUN1cnJlbnRXZWVrKClcbn1cblxuc2VsZi5fbm9kZXMucHJldkJ1dHRvbi5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsIHNlbGYuX2hhbmRsZVByZXZCdXR0b25DbGljaylcbnNlbGYuX25vZGVzLm5leHRCdXR0b24uYWRkRXZlbnRMaXN0ZW5lcignY2xpY2snLCBzZWxmLl9oYW5kbGVOZXh0QnV0dG9uQ2xpY2spXG5cbm1vZHVsZS5leHBvcnRzID0gc2VsZlxuIl19
diff --git a/public/javascripts/easterEggs.js b/public/javascripts/easterEggs.js
deleted file mode 100644
index 79fb6d9..0000000
--- a/public/javascripts/easterEggs.js
+++ /dev/null
@@ -1,91 +0,0 @@
-const sinterklaas = function () {
- console.log('sinterklaas easter egg activated')
- const searchNode = document.querySelector('#search')
- const inputNode = searchNode.querySelector('input[type="search"]')
- const autocompleteNode = document.querySelector('.autocomplete')
- let autocomplete = false
- const lyrics = [
- [
- {woord: 'Hoor ', time: 0},
- {woord: 'wie ', time: 0.3},
- {woord: 'klopt ', time: 0.6},
- {woord: 'daar ', time: 0.9},
- {woord: 'kind', time: 1.2},
- {woord: '\'ren', time: 1.5}
- ],
- [
- {woord: 'Hoor ', time: 1.8},
- {woord: 'wie ', time: 2.1},
- {woord: 'klopt ', time: 2.5},
- {woord: 'daar ', time: 2.8},
- {woord: 'kind', time: 3.1},
- {woord: '\'ren', time: 3.4}
- ],
- [
- {woord: 'Hoor ', time: 3.7},
- {woord: 'wie ', time: 4},
- {woord: 'tikt ', time: 4.3},
- {woord: 'daar ', time: 4.6},
- {woord: 'zacht', time: 4.8},
- {woord: 'jes ', time: 5.3},
- {woord: 'tegen ', time: 5.5},
- {woord: '\'t ', time: 6.1},
- {woord: 'raam ', time: 6.2}
- ]
- ]
-
- const originalValue = inputNode.value
-
- inputNode.value = ''
- inputNode.placeholder = ''
-
- lyrics.forEach((row, rowIndex) => {
- row.forEach((word, wordIndex) => {
- setTimeout(function () {
- if (wordIndex === 0) inputNode.placeholder = ''
- inputNode.placeholder += word.woord
- }, word.time * 1000)
- if (lyrics.length === rowIndex + 1 &&
- lyrics[rowIndex].length === wordIndex + 1) {
- setTimeout(function () {
- if (inputNode.value === '') {
- inputNode.value = originalValue
- }
- inputNode.placeholder = 'Zoeken'
- autocomplete = true
- }, word.time * 1000 + 1000)
- }
- })
- })
-
- inputNode.addEventListener('focus', function () {
- if (!autocomplete) return
-
- autocompleteNode.innerHTML = ''
-
- const autocompleteLyrics = [
- `'t Is een vreemd'ling zeker,`,
- `die verdwaalt is zeker.`,
- `'k Zal eens even vragen naar zijn naam:`
- ]
-
- autocompleteLyrics.forEach(row => {
- const resultNode = document.createElement('li')
- resultNode.innerHTML = row
- autocompleteNode.appendChild(resultNode)
- })
- })
-
- inputNode.addEventListener('input', function () {
- if (!autocomplete) return
- if (inputNode.value.toLowerCase() === 'sint nicolaas' ||
- inputNode.value.toLowerCase() === 'sintnicolaas' ||
- inputNode.value.toLowerCase() === 'sint nikolaas' ||
- inputNode.value.toLowerCase() === 'sintnikolaas') {
- inputNode.value = ''
- window.location.href = 'https://www.youtube-nocookie.com/embed/jsOiKJ3kKXM?start=30'
- }
- })
-}
-
-module.exports = { sinterklaas }
diff --git a/public/javascripts/favorite.js b/public/javascripts/favorite.js
new file mode 100644
index 0000000..f10d954
--- /dev/null
+++ b/public/javascripts/favorite.js
@@ -0,0 +1,73 @@
+/* global USERS */
+
+const EventEmitter = require('events')
+
+const self = new EventEmitter()
+
+self._nodes = {
+ toggle: document.querySelector('.fav')
+}
+
+self.get = function () {
+ const localStorageUser = JSON.parse(window.localStorage.getItem('fav'))
+ if (localStorageUser == null) return
+
+ const correctedUser = USERS.filter(user =>
+ user.type === localStorageUser.type &&
+ user.value === localStorageUser.value)[0]
+ return correctedUser
+}
+
+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) {
+ const currentUser = self.get()
+
+ if (currentUser == null) {
+ self.updateDom(false)
+ return
+ }
+
+ const isEqual = currentUser.type === selectedUser.type &&
+ currentUser.index === selectedUser.index
+
+ self.updateDom(isEqual)
+}
+
+self.toggle = function (selectedUser) {
+ const currentUser = self.get()
+ const 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
diff --git a/public/javascripts/frontpage.js b/public/javascripts/frontpage.js
new file mode 100644
index 0000000..17cb539
--- /dev/null
+++ b/public/javascripts/frontpage.js
@@ -0,0 +1,23 @@
+const browserFixToolkit = require('./browserFixToolkit')
+
+const 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
diff --git a/public/javascripts/getURLOfUser.js b/public/javascripts/getURLOfUser.js
deleted file mode 100644
index 1d27175..0000000
--- a/public/javascripts/getURLOfUser.js
+++ /dev/null
@@ -1,9 +0,0 @@
-var leftPad = require('left-pad')
-var getWeek = require('./getWeek')
-
-function getURLOfUsers (weekOffset, type, id) {
- return `//${window.location.host}/meetingpointProxy/Roosters-AL%2Fdoc%2Fdagroosters%2F` +
- `${(getWeek() + weekOffset)}%2F${type}%2F${type}${leftPad(id, 5, '0')}.htm`
-}
-
-module.exports = getURLOfUsers
diff --git a/public/javascripts/getUsers.js b/public/javascripts/getUsers.js
deleted file mode 100644
index 780ae49..0000000
--- a/public/javascripts/getUsers.js
+++ /dev/null
@@ -1,7 +0,0 @@
-var Promise = require('bluebird')
-var request = Promise.promisify(require('request'))
-
-module.exports = function () {
- return request(`http://${window.location.host}/getUserIndex`)
- .then(data => JSON.parse(data.body))
-}
diff --git a/public/javascripts/getWeek.js b/public/javascripts/getWeek.js
deleted file mode 100644
index 40b0bb4..0000000
--- a/public/javascripts/getWeek.js
+++ /dev/null
@@ -1,33 +0,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.
-function getWeek () {
- // Create a copy of this date object
- const target = new Date()
-
- // ISO week date weeks start on monday
- // so correct the day number
- const dayNr = (target.getDay() + 6) % 7
-
- // ISO 8601 states that week 1 is the week
- // with the first thursday of that year.
- // Set the target date to the thursday in the target week
- target.setDate(target.getDate() - dayNr + 3)
-
- // Store the millisecond value of the target date
- const firstThursday = target.valueOf()
-
- // Set the target to the first thursday of the year
- // First set the target to january first
- target.setMonth(0, 1)
- // Not a thursday? Correct the date to the next thursday
- if (target.getDay() !== 4) {
- target.setMonth(0, 1 + ((4 - target.getDay()) + 7) % 7)
- }
-
- // The weeknumber is the number of weeks between the
- // first thursday of the year and the thursday in the target week
- return 1 + Math.ceil((firstThursday - target) / 604800000) // 604800000 = 7 * 24 * 3600 * 1000
-}
-
-module.exports = getWeek
diff --git a/public/javascripts/main.bak.js b/public/javascripts/main.bak.js
new file mode 100644
index 0000000..895dd3f
--- /dev/null
+++ b/public/javascripts/main.bak.js
@@ -0,0 +1,244 @@
+/* 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 3e6d6a7..b6d4f09 100644
--- a/public/javascripts/main.js
+++ b/public/javascripts/main.js
@@ -1,245 +1,37 @@
-/* global ga FLAGS USERS */
+const frontpage = require('./frontpage')
+const search = require('./search')
+const schedule = require('./schedule')
+const weekSelector = require('./weekSelector')
+const favorite = require('./favorite')
-require('flexibility')
+const state = {}
-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')
+window.state = state
+window.require = require
-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')
+frontpage.show()
+weekSelector.updateCurrentWeek()
-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/'
- }
- }
+if (favorite.get() != null) {
+ state.selectedItem = favorite.get()
+ favorite.update(state.selectedItem)
+ schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem)
} else {
- console.log('feature detection is OFF')
+ search.focus()
}
-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')
- }
+search.on('search', function (selectedItem) {
+ state.selectedItem = selectedItem
+ favorite.update(state.selectedItem)
+ schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem)
})
-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)
- })
+weekSelector.on('weekChanged', function (newWeek) {
+ schedule.viewItem(newWeek, state.selectedItem)
})
-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()
+favorite.on('click', function () {
+ favorite.toggle(state.selectedItem)
})
-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 (inputNode.value !== '') {
- document.body.classList.remove('no-input')
- document.body.classList.add('searched')
-}
-
-document.body.style.opacity = '1'
-
-window.easterEggs = easterEggs
+document.body.style.opacity = 1
diff --git a/public/javascripts/schedule.js b/public/javascripts/schedule.js
new file mode 100644
index 0000000..e3944f8
--- /dev/null
+++ b/public/javascripts/schedule.js
@@ -0,0 +1,55 @@
+const leftPad = require('left-pad')
+const autocomplete = require('./autocomplete')
+const search = require('./search')
+
+const self = {}
+
+self._nodes = {
+ schedule: document.querySelector('#schedule')
+}
+
+self._parseMeetingpointHTML = function (htmlStr) {
+ const html = document.createElement('html')
+ html.innerHTML = htmlStr
+ const centerNode = html.querySelector('center')
+ return centerNode
+}
+
+self._handleLoad = function (event) {
+ const request = event.target
+ if (request.status < 200 || request.status >= 400) {
+ self._handleError(event)
+ return
+ }
+ const document = self._parseMeetingpointHTML(request.response)
+ self._nodes.schedule.appendChild(document)
+}
+
+self._handleError = function (event) {
+ const request = event.target
+ console.error(request)
+}
+
+self._getURLOfUsers = function (week, type, index) {
+ const id = index + 1
+ return `//${window.location.host}/meetingpointProxy/Roosters-AL%2Fdoc%2Fdagroosters%2F` +
+ `${(week)}%2F${type}%2F${type}${leftPad(id, 5, '0')}.htm`
+}
+
+self.viewItem = function (week, selectedUser) {
+ const url = self._getURLOfUsers(week, selectedUser.type, selectedUser.index)
+
+ while (self._nodes.schedule.firstChild) {
+ self._nodes.schedule.removeChild(self._nodes.schedule.firstChild)
+ }
+
+ 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)
+}
+
+module.exports = self
diff --git a/public/javascripts/search.js b/public/javascripts/search.js
new file mode 100644
index 0000000..7d80709
--- /dev/null
+++ b/public/javascripts/search.js
@@ -0,0 +1,84 @@
+/* global USERS */
+
+const EventEmitter = require('events')
+const fuzzy = require('fuzzy')
+const autocomplete = require('./autocomplete')
+const browserFixToolkit = require('./browserFixToolkit')
+
+const self = new EventEmitter()
+
+self._nodes = {
+ search: document.querySelector('#search'),
+ input: document.querySelector('input[type="search"]')
+}
+
+self.submit = function () {
+ self._nodes.input.blur()
+
+ const selectedItem = autocomplete.getSelectedItem()
+
+ console.log(selectedItem)
+
+ self.emit('search', selectedItem)
+}
+
+self.updateDom = function (selectedItem) {
+ self._nodes.input.value = selectedItem.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) {
+ const allResults = fuzzy.filter(searchTerm, USERS, {
+ extract: item => item.value
+ })
+ const firstResults = allResults.slice(0, 7)
+
+ const originalResults = firstResults.map(result => result.original)
+
+ return originalResults
+}
+
+self._handleTextUpdate = function () {
+ const results = self._calculate(self._nodes.input.value)
+
+ autocomplete.removeAllItems()
+ for (let 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)
+ const 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
diff --git a/public/javascripts/weekSelector.js b/public/javascripts/weekSelector.js
new file mode 100644
index 0000000..2a8bb62
--- /dev/null
+++ b/public/javascripts/weekSelector.js
@@ -0,0 +1,58 @@
+const EventEmitter = require('events')
+
+const self = new EventEmitter()
+
+self._nodes = {
+ prevButton: document.querySelectorAll('#week-selector button')[0],
+ nextButton: document.querySelectorAll('#week-selector button')[1],
+ currentWeekText: document.querySelector('#week-selector .current')
+}
+
+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) {
+ const dayNr = (target.getDay() + 6) % 7
+ target.setDate(target.getDate() - dayNr + 3)
+ const 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 () {
+ const now = new Date()
+ const targetDate = new Date(now.getTime() + self._weekOffset * 604800 * 1000)
+ return self.getCurrentWeek(targetDate)
+}
+
+self.updateCurrentWeek = function () {
+ const selectedWeekNumber = self.getSelectedWeek()
+ self._nodes.currentWeekText.textContent = `Week ${selectedWeekNumber}`
+ if (self.getCurrentWeek(new Date()) !== selectedWeekNumber) {
+ self._nodes.currentWeekText.classList.add('changed')
+ } else {
+ self._nodes.currentWeekText.classList.remove('changed')
+ }
+ self.emit('weekChanged', 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
diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css
index 1dbe1c7..7c39421 100644
--- a/public/stylesheets/style.css
+++ b/public/stylesheets/style.css
@@ -132,6 +132,7 @@ li:hover {
width: 100vw;
border: 0;
padding: 0;
+ overflow: auto;
}
body.searched #search-space-filler {
@@ -176,6 +177,10 @@ body.searched #search-space-filler {
justify-content: center;
}
+#week-selector .current.changed {
+ font-weight: bold;
+}
+
#week-selector button {
background: transparent;
color: white;
diff --git a/views/index.jade b/views/index.jade
index dff671e..372e3a6 100644
--- a/views/index.jade
+++ b/views/index.jade
@@ -36,7 +36,7 @@ block content
span.current Loading...
button(type='button').material-icons &#xE5C8;
- iframe(scrolling='no')#schedule
+ #schedule
block scripts
script.