From c6aee6e370fe88909d462a2e10e45b72d20196f7 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Wed, 7 Dec 2016 22:56:09 +0100 Subject: starting refactor --- package.json | 6 +- public/javascripts/autocomplete.js | 15 + public/javascripts/bundle.js | 886 +------------------------------------ public/javascripts/frontpage.js | 22 + public/javascripts/main.bak.js | 244 ++++++++++ public/javascripts/main.js | 245 +--------- 6 files changed, 307 insertions(+), 1111 deletions(-) create mode 100644 public/javascripts/autocomplete.js create mode 100644 public/javascripts/frontpage.js create mode 100644 public/javascripts/main.bak.js diff --git a/package.json b/package.json index 7ad833f..3bcd7ea 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "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", + "build": "browserify -t [ babelify --presets [ es2016 ] ] -e ./public/javascripts/main.js | uglifyjs -cm > ./public/javascripts/bundle.js" }, "dependencies": { "bluebird": "^3.4.6", @@ -29,7 +29,7 @@ "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", diff --git a/public/javascripts/autocomplete.js b/public/javascripts/autocomplete.js new file mode 100644 index 0000000..7a56e16 --- /dev/null +++ b/public/javascripts/autocomplete.js @@ -0,0 +1,15 @@ +const autocomplete = {} +const self = autocomplete + +self._nodes = { + input: document.querySelector('input[type="search"]'), + autocomplete: document.querySelector('.autocomplete') +} + +self._textUpdate = function () { + self._nodes.autocomplete +} + +self._nodes.input.addEventListener('input', self.hide) + +module.exports = autocomplete diff --git a/public/javascripts/bundle.js b/public/javascripts/bundle.js index 117733d..1f12e86 100644 --- a/public/javascripts/bundle.js +++ b/public/javascripts/bundle.js @@ -1,880 +1,34 @@ (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;o1&&"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;++nlah' // The rendered string -// , index: 2 // The index of the element in `arr` -// , original: 'blah' // The original element in `arr` -// }] -// -// `opts` is an optional argument bag. Details: -// -// opts = { -// // string to put before a matching character -// pre: '' -// -// // string to put after matching character -// , post: '' -// -// // Optional function. Input is an entry in the given arr`, -// // output should be the string to test `pattern` against. -// // In this example, if `arr = [{crying: 'koala'}]` we would return -// // 'koala'. -// , extract: function(arg) { return arg.crying; } -// } -fuzzy.filter = function(pattern, arr, opts) { - if(!arr || arr.length === 0) { - return []; - } - if (typeof pattern !== 'string') { - return arr; - } - opts = opts || {}; - return arr - .reduce(function(prev, element, idx, arr) { - var str = element; - if(opts.extract) { - str = opts.extract(element); - } - var rendered = fuzzy.match(pattern, str, opts); - if(rendered != null) { - prev[prev.length] = { - string: rendered.rendered - , score: rendered.score - , index: idx - , original: element - }; - } - return prev; - }, []) - - // Sort by score. Browsers are inconsistent wrt stable/unstable - // sorting, so force stable by using the index in the case of tie. - // See http://ofb.net/~sethml/is-sort-stable.html - .sort(function(a,b) { - var compare = b.score - a.score; - if(compare) return compare; - return a.index - b.index; - }); -}; - - -}()); +self.isShown = false; - -},{}],4:[function(require,module,exports){ -/* This program is free software. It comes without any warranty, to - * the extent permitted by applicable law. You can redistribute it - * and/or modify it under the terms of the Do What The Fuck You Want - * To Public License, Version 2, as published by Sam Hocevar. See - * http://www.wtfpl.net/ for more details. */ -'use strict'; -module.exports = leftPad; - -var cache = [ - '', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ', - ' ' -]; - -function leftPad (str, len, ch) { - // convert `str` to `string` - str = str + ''; - // `len` is the `pad`'s length now - len = len - str.length; - // doesn't need to pad - if (len <= 0) return str; - // `ch` defaults to `' '` - if (!ch && ch !== 0) ch = ' '; - // convert `ch` to `string` - ch = ch + ''; - // cache common use cases - if (ch === ' ' && len < 10) return cache[len] + str; - // `pad` starts with an empty string - var pad = ''; - // loop - while (true) { - // add `ch` to `pad` if `len` is odd - if (len & 1) pad += ch; - // divide `len` by 2, ditch the remainder - len >>= 1; - // "double" the `ch` so this operation count grows logarithmically on `len` - // each time `ch` is "doubled", the `len` would need to be "doubled" too - // similar to finding a value in binary search tree, hence O(log(n)) - if (len) ch += ch; - // `len` is 0, exit the loop - else break; - } - // pad `str`! - return pad + str; -} - -},{}],5:[function(require,module,exports){ -'use strict'; - -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); - } - }); - }); - - inputNode.addEventListener('focus', function () { - if (!autocomplete) return; - - autocompleteNode.innerHTML = ''; - - var autocompleteLyrics = ['\'t Is een vreemd\'ling zeker,', 'die verdwaalt is zeker.', '\'k Zal eens even vragen naar zijn naam:']; - - autocompleteLyrics.forEach(function (row) { - var 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'; - } - }); +self.show = function () { + document.body.classList.add('no-input'); + self.isShown = true; }; -module.exports = { sinterklaas: sinterklaas }; - -},{}],6:[function(require,module,exports){ -'use strict'; - -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; - -},{"./getWeek":7,"left-pad":4}],7:[function(require,module,exports){ -"use strict"; - -// 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(); - - // ISO week date weeks start on monday - // so correct the day number - var 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 - var 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; - -},{}],8:[function(require,module,exports){ -'use strict'; - -/* 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'); -} - -var selectedResult = -1; -var selectedUser = void 0; -var results = []; -var offset = 0; - -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]; -} - -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 = ''; - } else { - favNode.innerHTML = ''; - } -} - -function updateWeekText() { - if (offset === 0) currentWeekNode.innerHTML = 'Week ' + (getWeek() + offset);else currentWeekNode.innerHTML = 'Week ' + (getWeek() + offset) + ''; -} - -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'); - - var 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'); - } -}); - -var inputEventStr = void 0; -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) { +self.hide = function () { document.body.classList.remove('no-input'); - autocompleteNode.innerHTML = ''; - if (inputNode.value.trim() === '') return; - - selectedResult = -1; - results = fuzzy.filter(removeDiacritics(inputNode.value), USERS, { - extract: function extract(el) { - return removeDiacritics(el.value); - } - }).slice(0, 7); - - results.forEach(function (result) { - var 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) { - var 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); - - var eventAction = void 0; - switch (selectedUser.type) { - case 'c': - eventAction = 'Class'; - break; - case 't': - eventAction = 'Teacher'; - break; - case 'r': - eventAction = 'Room'; - break; - case 's': - eventAction = 'Student'; - break; - } - var eventLabel = selectedUser.value; - - ga(function () { - ga('send', { hitType: 'event', eventCategory: 'search', eventAction: eventAction, eventLabel: 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) - var 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); - } -}); - -var currentFav = getCurrentFav(); + self.isShown = false; +}; -if (currentFav) { - (function () { - selectedUser = currentFav; - inputNode.value = selectedUser.value; - scheduleIframe.src = getURLOfUser(offset, selectedUser.type, selectedUser.index + 1); - updateFavNode(); +self._nodes.input.addEventListener('input', self.hide); - 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; +module.exports = frontpage; - 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(); -} - -if (scheduleIframe.src !== '') { - document.body.classList.add('searched'); -} +},{}],2:[function(require,module,exports){ +const frontpage = require('./frontpage'); -document.body.style.opacity = '1'; +frontpage.show(); -window.easterEggs = easterEggs; +document.body.style.opacity = 1; -},{"./easterEggs":5,"./getURLOfUser":6,"./getWeek":7,"diacritics":1,"flexibility":2,"fuzzy":3}]},{},[8]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZGlhY3JpdGljcy9pbmRleC5qcyIsIm5vZGVfbW9kdWxlcy9mbGV4aWJpbGl0eS9mbGV4aWJ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WxmID0gZnJvbnRwYWdlXG5cbnNlbGYuX25vZGVzID0ge1xuICBzZWFyY2g6IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJyNzZWFyY2gnKSxcbiAgaW5wdXQ6IGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoJ2lucHV0W3R5cGU9XCJzZWFyY2hcIl0nKVxufVxuXG5zZWxmLmlzU2hvd24gPSBmYWxzZVxuXG5zZWxmLnNob3cgPSBmdW5jdGlvbiAoKSB7XG4gIGRvY3VtZW50LmJvZHkuY2xhc3NMaXN0LmFkZCgnbm8taW5wdXQnKVxuICBzZWxmLmlzU2hvd24gPSB0cnVlXG59XG5cbnNlbGYuaGlkZSA9IGZ1bmN0aW9uICgpIHtcbiAgZG9jdW1lbnQuYm9keS5jbGFzc0xpc3QucmVtb3ZlKCduby1pbnB1dCcpXG4gIHNlbGYuaXNTaG93biA9IGZhbHNlXG59XG5cbnNlbGYuX25vZGVzLmlucHV0LmFkZEV2ZW50TGlzdGVuZXIoJ2lucHV0Jywgc2VsZi5oaWRlKVxuXG5tb2R1bGUuZXhwb3J0cyA9IGZyb250cGFnZVxuIiwiY29uc3QgZnJvbnRwYWdlID0gcmVxdWlyZSgnLi9mcm9udHBhZ2UnKVxuXG5mcm9udHBhZ2Uuc2hvdygpXG5cbmRvY3VtZW50LmJvZHkuc3R5bGUub3BhY2l0eSA9IDFcbiJdfQ== diff --git a/public/javascripts/frontpage.js b/public/javascripts/frontpage.js new file mode 100644 index 0000000..3c9093e --- /dev/null +++ b/public/javascripts/frontpage.js @@ -0,0 +1,22 @@ +const frontpage = {} +const self = frontpage + +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('input', self.hide) + +module.exports = frontpage 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 = '' + } else { + favNode.innerHTML = '' + } +} + +function updateWeekText () { + if (offset === 0) currentWeekNode.innerHTML = `Week ${getWeek() + offset}` + else currentWeekNode.innerHTML = `Week ${getWeek() + offset}` +} + +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 895dd3f..549427e 100644 --- a/public/javascripts/main.js +++ b/public/javascripts/main.js @@ -1,244 +1,5 @@ -/* global ga FLAGS USERS */ +const frontpage = require('./frontpage') -require('flexibility') +frontpage.show() -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 = '' - } else { - favNode.innerHTML = '' - } -} - -function updateWeekText () { - if (offset === 0) currentWeekNode.innerHTML = `Week ${getWeek() + offset}` - else currentWeekNode.innerHTML = `Week ${getWeek() + offset}` -} - -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 +document.body.style.opacity = 1 -- cgit v1.1 From 3a9bdee97f9d05cbdb10f7530d4e94cf28d99602 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Thu, 8 Dec 2016 21:23:19 +0100 Subject: did some more work --- public/javascripts/autocomplete.js | 121 ++++++++++- public/javascripts/bundle.js | 415 ++++++++++++++++++++++++++++++++++++- public/javascripts/frontpage.js | 5 +- public/javascripts/iframe.js | 14 ++ public/javascripts/main.js | 1 + public/javascripts/search.js | 28 +++ 6 files changed, 568 insertions(+), 16 deletions(-) create mode 100644 public/javascripts/iframe.js create mode 100644 public/javascripts/search.js diff --git a/public/javascripts/autocomplete.js b/public/javascripts/autocomplete.js index 7a56e16..7e7fcbe 100644 --- a/public/javascripts/autocomplete.js +++ b/public/javascripts/autocomplete.js @@ -1,15 +1,124 @@ -const autocomplete = {} -const self = autocomplete +/* global USERS */ + +const fuzzy = require('fuzzy') +const search = require('./search') + +const self = {} + +self._items = [] +self._selectedItemIndex = -1 self._nodes = { + form: document.querySelector('#search'), input: document.querySelector('input[type="search"]'), autocomplete: document.querySelector('.autocomplete') } -self._textUpdate = function () { - self._nodes.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 + listItem.addEventListener('click', self._handleItemClick) + 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._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._handleItemClick = function (event) { + const itemIndex = Array.prototype.indexOf + .call(self._nodes.autocomplete.children, event.target) + console.log(itemIndex) + self._selectedItemIndex = itemIndex + console.log(search) + search.submit() +} + +self._handleFocus = function () { + self._nodes.autocomplete.style.display = 'block' +} + +self._handleBlur = function (event) { + // console.log(document.querySelector(':focus')) + // if (event.target.parentNode === self._nodes.autocomplete) return + // self._nodes.autocomplete.style.display = 'none' +} + +self._handleTextUpdate = function () { + const results = self._calculate(self._nodes.input.value) + + self._removeAllItems() + for (let i = 0; i < results.length; i++) { + self._addItem(results[i]) + } +} + +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.input.addEventListener('input', self.hide) +self._nodes.input.addEventListener('focus', self._handleFocus) +self._nodes.input.addEventListener('blur', self._handleBlur) +self._nodes.input.addEventListener('input', self._handleTextUpdate) +self._nodes.input.addEventListener('keydown', self._handleKeydown) -module.exports = autocomplete +module.exports = self diff --git a/public/javascripts/bundle.js b/public/javascripts/bundle.js index 1f12e86..76516d9 100644 --- a/public/javascripts/bundle.js +++ b/public/javascripts/bundle.js @@ -1,9 +1,318 @@ (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;olah' // The rendered string +// , index: 2 // The index of the element in `arr` +// , original: 'blah' // The original element in `arr` +// }] +// +// `opts` is an optional argument bag. Details: +// +// opts = { +// // string to put before a matching character +// pre: '' +// +// // string to put after matching character +// , post: '' +// +// // Optional function. Input is an entry in the given arr`, +// // output should be the string to test `pattern` against. +// // In this example, if `arr = [{crying: 'koala'}]` we would return +// // 'koala'. +// , extract: function(arg) { return arg.crying; } +// } +fuzzy.filter = function(pattern, arr, opts) { + opts = opts || {}; + return arr + .reduce(function(prev, element, idx, arr) { + var str = element; + if(opts.extract) { + str = opts.extract(element); + } + var rendered = fuzzy.match(pattern, str, opts); + if(rendered != null) { + prev[prev.length] = { + string: rendered.rendered + , score: rendered.score + , index: idx + , original: element + }; + } + return prev; + }, []) + + // Sort by score. Browsers are inconsistent wrt stable/unstable + // sorting, so force stable by using the index in the case of tie. + // See http://ofb.net/~sethml/is-sort-stable.html + .sort(function(a,b) { + var compare = b.score - a.score; + if(compare) return compare; + return a.index - b.index; + }); +}; + + +}()); + + +},{}],2:[function(require,module,exports){ +'use strict'; +module.exports = leftPad; + +var cache = [ + '', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ', + ' ' +]; + +function leftPad (str, len, ch) { + // convert `str` to `string` + str = str + ''; + // `len` is the `pad`'s length now + len = len - str.length; + // doesn't need to pad + if (len <= 0) return str; + // `ch` defaults to `' '` + if (!ch && ch !== 0) ch = ' '; + // convert `ch` to `string` + ch = ch + ''; + // cache common use cases + if (ch === ' ' && len < 10) return cache[len] + str; + // `pad` starts with an empty string + var pad = ''; + // loop + while (true) { + // add `ch` to `pad` if `len` is odd + if (len & 1) pad += ch; + // devide `len` by 2, ditch the fraction + len >>= 1; + // "double" the `ch` so this operation count grows logarithmically on `len` + // each time `ch` is "doubled", the `len` would need to be "doubled" too + // similar to finding a value in binary search tree, hence O(log(n)) + if (len) ch += ch; + // `len` is 0, exit the loop + else break; + } + // pad `str`! + return pad + str; +} + +},{}],3:[function(require,module,exports){ +/* global USERS */ + +const fuzzy = require('fuzzy'); +const search = require('./search'); + +const self = {}; + +self._items = []; +self._selectedItemIndex = -1; + +self._nodes = { + form: 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; + listItem.addEventListener('click', self._handleItemClick); + 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._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._handleItemClick = function (event) { + const itemIndex = Array.prototype.indexOf.call(self._nodes.autocomplete.children, event.target); + console.log(itemIndex); + self._selectedItemIndex = itemIndex; + console.log(search); + search.submit(); +}; + +self._handleFocus = function () { + self._nodes.autocomplete.style.display = 'block'; +}; + +self._handleBlur = function (event) { + // console.log(document.querySelector(':focus')) + // if (event.target.parentNode === self._nodes.autocomplete) return + // self._nodes.autocomplete.style.display = 'none' +}; + +self._handleTextUpdate = function () { + const results = self._calculate(self._nodes.input.value); + + self._removeAllItems(); + for (let i = 0; i < results.length; i++) { + self._addItem(results[i]); + } +}; + +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.input.addEventListener('focus', self._handleFocus); +self._nodes.input.addEventListener('blur', self._handleBlur); +self._nodes.input.addEventListener('input', self._handleTextUpdate); +self._nodes.input.addEventListener('keydown', self._handleKeydown); + +module.exports = self; + +},{"./search":9,"fuzzy":1}],4:[function(require,module,exports){ +const self = {}; self._nodes = { - search: document.querySelector('#search'), input: document.querySelector('input[type="search"]') }; @@ -21,14 +330,106 @@ self.hide = function () { self._nodes.input.addEventListener('input', self.hide); -module.exports = frontpage; +module.exports = self; -},{}],2:[function(require,module,exports){ +},{}],5:[function(require,module,exports){ +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; + +},{"./getWeek":6,"left-pad":2}],6:[function(require,module,exports){ +// 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; + +},{}],7:[function(require,module,exports){ +const getURLOfUser = require('./getURLOfUser'); + +const self = {}; + +self._nodes = { + iframe: document.querySelector('iframe') +}; + +self.viewItem = function (offset, selectedUser) { + const url = getURLOfUser(offset, selectedUser.type, selectedUser.index + 1); + self._nodes.iframe.src = url; +}; + +module.exports = self; + +},{"./getURLOfUser":5}],8:[function(require,module,exports){ const frontpage = require('./frontpage'); +require('./search'); frontpage.show(); document.body.style.opacity = 1; -},{"./frontpage":1}]},{},[2]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uI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pXG4gIHNlbGYuaXNTaG93biA9IGZhbHNlXG59XG5cbnNlbGYuX25vZGVzLmlucHV0LmFkZEV2ZW50TGlzdGVuZXIoJ2lucHV0Jywgc2VsZi5oaWRlKVxuXG5tb2R1bGUuZXhwb3J0cyA9IGZyb250cGFnZVxuIiwiY29uc3QgZnJvbnRwYWdlID0gcmVxdWlyZSgnLi9mcm9udHBhZ2UnKVxuXG5mcm9udHBhZ2Uuc2hvdygpXG5cbmRvY3VtZW50LmJvZHkuc3R5bGUub3BhY2l0eSA9IDFcbiJdfQ== +},{"./frontpage":4,"./search":9}],9:[function(require,module,exports){ +const autocomplete = require('./autocomplete'); +const iframe = require('./iframe'); + +const self = {}; + +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); + iframe.viewItem(0, selectedItem); +}; + +self._handleSubmit = function (event) { + event.preventDefault(); + self.submit(); +}; + +self._nodes.search.addEventListener('submit', self._handleSubmit); + +console.log(self); + +module.exports = self; + +},{"./autocomplete":3,"./iframe":7}]},{},[8]) +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZnV6enkvbGliL2Z1enp5LmpzIiwibm9kZV9tb2R1bGVzL2xlZnQtcGFkL2luZGV4LmpzIiwicHVibGljL2phdmFzY3JpcHRzL2F1dG9jb21wbGV0ZS5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9mcm9udHBhZ2UuanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvZ2V0VVJMT2ZVc2VyLmpzIiwicHVibGljL2phdmFzY3JpcHRzL2dldFdlZWsuanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvaWZyYW1lLmpzIiwicHVibGljL2phdmFzY3JpcHR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hbWUudmlld0l0ZW0oMCwgc2VsZWN0ZWRJdGVtKVxufVxuXG5zZWxmLl9oYW5kbGVTdWJtaXQgPSBmdW5jdGlvbiAoZXZlbnQpIHtcbiAgZXZlbnQucHJldmVudERlZmF1bHQoKVxuICBzZWxmLnN1Ym1pdCgpXG59XG5cbnNlbGYuX25vZGVzLnNlYXJjaC5hZGRFdmVudExpc3RlbmVyKCdzdWJtaXQnLCBzZWxmLl9oYW5kbGVTdWJtaXQpXG5cbmNvbnNvbGUubG9nKHNlbGYpXG5cbm1vZHVsZS5leHBvcnRzID0gc2VsZlxuIl19 diff --git a/public/javascripts/frontpage.js b/public/javascripts/frontpage.js index 3c9093e..d789045 100644 --- a/public/javascripts/frontpage.js +++ b/public/javascripts/frontpage.js @@ -1,5 +1,4 @@ -const frontpage = {} -const self = frontpage +const self = {} self._nodes = { input: document.querySelector('input[type="search"]') @@ -19,4 +18,4 @@ self.hide = function () { self._nodes.input.addEventListener('input', self.hide) -module.exports = frontpage +module.exports = self diff --git a/public/javascripts/iframe.js b/public/javascripts/iframe.js new file mode 100644 index 0000000..e3296be --- /dev/null +++ b/public/javascripts/iframe.js @@ -0,0 +1,14 @@ +const getURLOfUser = require('./getURLOfUser') + +const self = {} + +self._nodes = { + iframe: document.querySelector('iframe') +} + +self.viewItem = function (offset, selectedUser) { + const url = getURLOfUser(offset, selectedUser.type, selectedUser.index + 1) + self._nodes.iframe.src = url +} + +module.exports = self diff --git a/public/javascripts/main.js b/public/javascripts/main.js index 549427e..d242ce2 100644 --- a/public/javascripts/main.js +++ b/public/javascripts/main.js @@ -1,4 +1,5 @@ const frontpage = require('./frontpage') +require('./search') frontpage.show() diff --git a/public/javascripts/search.js b/public/javascripts/search.js new file mode 100644 index 0000000..8887ab2 --- /dev/null +++ b/public/javascripts/search.js @@ -0,0 +1,28 @@ +const autocomplete = require('./autocomplete') +const iframe = require('./iframe') + +const self = {} + +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) + iframe.viewItem(0, selectedItem) +} + +self._handleSubmit = function (event) { + event.preventDefault() + self.submit() +} + +self._nodes.search.addEventListener('submit', self._handleSubmit) + +console.log(self) + +module.exports = self -- cgit v1.1 From c547e6910ea7ad077771343ae75a4204223a118a Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 8 Dec 2016 22:40:08 +0100 Subject: use events and fix focus issues --- public/javascripts/autocomplete.js | 35 +-- public/javascripts/bundle.js | 584 ++++++++++++++++++++++++++++++++++--- public/javascripts/search.js | 6 +- 3 files changed, 562 insertions(+), 63 deletions(-) diff --git a/public/javascripts/autocomplete.js b/public/javascripts/autocomplete.js index 7e7fcbe..681dba8 100644 --- a/public/javascripts/autocomplete.js +++ b/public/javascripts/autocomplete.js @@ -1,15 +1,17 @@ /* global USERS */ const fuzzy = require('fuzzy') -const search = require('./search') - +const EventEmitter = require('events') +const process = require('process') const self = {} self._items = [] self._selectedItemIndex = -1 +self.events = new EventEmitter() + self._nodes = { - form: document.querySelector('#search'), + search: document.querySelector('#search'), input: document.querySelector('input[type="search"]'), autocomplete: document.querySelector('.autocomplete') } @@ -32,6 +34,14 @@ self.getItems = function () { return self._items } +self.show = function () { + self._nodes.autocomplete.style.display = 'block' +} + +self.hide = function () { + self._nodes.autocomplete.style.display = 'none' +} + self._removeAllItems = function () { while (self._nodes.autocomplete.firstChild) { self._nodes.autocomplete.removeChild(self._nodes.autocomplete.firstChild) @@ -43,7 +53,6 @@ self._removeAllItems = function () { self._addItem = function (item) { const listItem = document.createElement('li') listItem.textContent = item.value - listItem.addEventListener('click', self._handleItemClick) self._nodes.autocomplete.appendChild(listItem) self._items.push(item) } @@ -78,22 +87,11 @@ self._calculate = function (searchTerm) { } self._handleItemClick = function (event) { + if (!self._nodes.autocomplete.contains(event.target)) return const itemIndex = Array.prototype.indexOf .call(self._nodes.autocomplete.children, event.target) - console.log(itemIndex) self._selectedItemIndex = itemIndex - console.log(search) - search.submit() -} - -self._handleFocus = function () { - self._nodes.autocomplete.style.display = 'block' -} - -self._handleBlur = function (event) { - // console.log(document.querySelector(':focus')) - // if (event.target.parentNode === self._nodes.autocomplete) return - // self._nodes.autocomplete.style.display = 'none' + self.events.emit('select', self.getSelectedItem()) } self._handleTextUpdate = function () { @@ -116,8 +114,7 @@ self._handleKeydown = function (event) { } } -self._nodes.input.addEventListener('focus', self._handleFocus) -self._nodes.input.addEventListener('blur', self._handleBlur) +self._nodes.autocomplete.addEventListener('click', self._handleItemClick) self._nodes.input.addEventListener('input', self._handleTextUpdate) self._nodes.input.addEventListener('keydown', self._handleKeydown) diff --git a/public/javascripts/bundle.js b/public/javascripts/bundle.js index 76516d9..c1d1eaf 100644 --- a/public/javascripts/bundle.js +++ b/public/javascripts/bundle.js @@ -1,4 +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 0 && this._events[type].length > m) { + this._events[type].warned = true; + console.error('(node) warning: possible EventEmitter memory ' + + 'leak detected. %d listeners added. ' + + 'Use emitter.setMaxListeners() to increase limit.', + this._events[type].length); + if (typeof console.trace === 'function') { + // not supported in IE 10 + console.trace(); + } + } + } + + return this; +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.once = function(type, listener) { + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + var fired = false; + + function g() { + this.removeListener(type, g); + + if (!fired) { + fired = true; + listener.apply(this, arguments); + } + } + + g.listener = listener; + this.on(type, g); + + return this; +}; + +// emits a 'removeListener' event iff the listener was removed +EventEmitter.prototype.removeListener = function(type, listener) { + var list, position, length, i; + + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + if (!this._events || !this._events[type]) + return this; + + list = this._events[type]; + length = list.length; + position = -1; + + if (list === listener || + (isFunction(list.listener) && list.listener === listener)) { + delete this._events[type]; + if (this._events.removeListener) + this.emit('removeListener', type, listener); + + } else if (isObject(list)) { + for (i = length; i-- > 0;) { + if (list[i] === listener || + (list[i].listener && list[i].listener === listener)) { + position = i; + break; + } + } + + if (position < 0) + return this; + + if (list.length === 1) { + list.length = 0; + delete this._events[type]; + } else { + list.splice(position, 1); + } + + if (this._events.removeListener) + this.emit('removeListener', type, listener); + } + + return this; +}; + +EventEmitter.prototype.removeAllListeners = function(type) { + var key, listeners; + + if (!this._events) + return this; + + // not listening for removeListener, no need to emit + if (!this._events.removeListener) { + if (arguments.length === 0) + this._events = {}; + else if (this._events[type]) + delete this._events[type]; + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + for (key in this._events) { + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = {}; + return this; + } + + listeners = this._events[type]; + + if (isFunction(listeners)) { + this.removeListener(type, listeners); + } else if (listeners) { + // LIFO order + while (listeners.length) + this.removeListener(type, listeners[listeners.length - 1]); + } + delete this._events[type]; + + return this; +}; + +EventEmitter.prototype.listeners = function(type) { + var ret; + if (!this._events || !this._events[type]) + ret = []; + else if (isFunction(this._events[type])) + ret = [this._events[type]]; + else + ret = this._events[type].slice(); + return ret; +}; + +EventEmitter.prototype.listenerCount = function(type) { + if (this._events) { + var evlistener = this._events[type]; + + if (isFunction(evlistener)) + return 1; + else if (evlistener) + return evlistener.length; + } + return 0; +}; + +EventEmitter.listenerCount = function(emitter, type) { + return emitter.listenerCount(type); +}; + +function isFunction(arg) { + return typeof arg === 'function'; +} + +function isNumber(arg) { + return typeof arg === 'number'; +} + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} + +function isUndefined(arg) { + return arg === void 0; +} + +},{}],2:[function(require,module,exports){ /* * Fuzzy * https://github.com/myork/fuzzy @@ -23,23 +327,23 @@ if (typeof exports !== 'undefined') { // Return all elements of `array` that have a fuzzy // match against `pattern`. fuzzy.simpleFilter = function(pattern, array) { - return array.filter(function(string) { - return fuzzy.test(pattern, string); + return array.filter(function(str) { + return fuzzy.test(pattern, str); }); }; -// Does `pattern` fuzzy match `string`? -fuzzy.test = function(pattern, string) { - return fuzzy.match(pattern, string) !== null; +// Does `pattern` fuzzy match `str`? +fuzzy.test = function(pattern, str) { + return fuzzy.match(pattern, str) !== null; }; -// If `pattern` matches `string`, wrap each matching character +// If `pattern` matches `str`, wrap each matching character // in `opts.pre` and `opts.post`. If no match, return null -fuzzy.match = function(pattern, string, opts) { +fuzzy.match = function(pattern, str, opts) { opts = opts || {}; var patternIdx = 0 , result = [] - , len = string.length + , len = str.length , totalScore = 0 , currScore = 0 // prefix @@ -48,15 +352,15 @@ fuzzy.match = function(pattern, string, opts) { , post = opts.post || '' // String to compare against. This might be a lowercase version of the // raw string - , compareString = opts.caseSensitive && string || string.toLowerCase() - , ch, compareChar; + , compareString = opts.caseSensitive && str || str.toLowerCase() + , ch; pattern = opts.caseSensitive && pattern || pattern.toLowerCase(); // For each character in the string, either add it to the result // or wrap in template if it's the next string in the pattern for(var idx = 0; idx < len; idx++) { - ch = string[idx]; + ch = str[idx]; if(compareString[idx] === pattern[patternIdx]) { ch = pre + ch + post; patternIdx += 1; @@ -72,6 +376,8 @@ fuzzy.match = function(pattern, string, opts) { // return rendered string if we have a match for every char if(patternIdx === pattern.length) { + // if the string is an exact match with pattern, totalScore should be maxed + totalScore = (compareString === pattern) ? Infinity : totalScore; return {rendered: result.join(''), score: totalScore}; } @@ -103,6 +409,12 @@ fuzzy.match = function(pattern, string, opts) { // , extract: function(arg) { return arg.crying; } // } fuzzy.filter = function(pattern, arr, opts) { + if(!arr || arr.length === 0) { + return []; + } + if (typeof pattern !== 'string') { + return arr; + } opts = opts || {}; return arr .reduce(function(prev, element, idx, arr) { @@ -136,7 +448,12 @@ fuzzy.filter = function(pattern, arr, opts) { }()); -},{}],2:[function(require,module,exports){ +},{}],3:[function(require,module,exports){ +/* This program is free software. It comes without any warranty, to + * the extent permitted by applicable law. You can redistribute it + * and/or modify it under the terms of the Do What The Fuck You Want + * To Public License, Version 2, as published by Sam Hocevar. See + * http://www.wtfpl.net/ for more details. */ 'use strict'; module.exports = leftPad; @@ -172,7 +489,7 @@ function leftPad (str, len, ch) { while (true) { // add `ch` to `pad` if `len` is odd if (len & 1) pad += ch; - // devide `len` by 2, ditch the fraction + // divide `len` by 2, ditch the remainder len >>= 1; // "double" the `ch` so this operation count grows logarithmically on `len` // each time `ch` is "doubled", the `len` would need to be "doubled" too @@ -185,19 +502,203 @@ function leftPad (str, len, ch) { return pad + str; } -},{}],3:[function(require,module,exports){ +},{}],4:[function(require,module,exports){ +// shim for using process in browser +var process = module.exports = {}; + +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } + + +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } + + + +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; + +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; + +},{}],5:[function(require,module,exports){ /* global USERS */ const fuzzy = require('fuzzy'); -const search = require('./search'); - +const EventEmitter = require('events'); +const process = require('process'); const self = {}; self._items = []; self._selectedItemIndex = -1; +self.events = new EventEmitter(); + self._nodes = { - form: document.querySelector('#search'), + search: document.querySelector('#search'), input: document.querySelector('input[type="search"]'), autocomplete: document.querySelector('.autocomplete') }; @@ -220,6 +721,14 @@ self.getItems = function () { return self._items; }; +self.show = function () { + self._nodes.autocomplete.style.display = 'block'; +}; + +self.hide = function () { + self._nodes.autocomplete.style.display = 'none'; +}; + self._removeAllItems = function () { while (self._nodes.autocomplete.firstChild) { self._nodes.autocomplete.removeChild(self._nodes.autocomplete.firstChild); @@ -231,7 +740,6 @@ self._removeAllItems = function () { self._addItem = function (item) { const listItem = document.createElement('li'); listItem.textContent = item.value; - listItem.addEventListener('click', self._handleItemClick); self._nodes.autocomplete.appendChild(listItem); self._items.push(item); }; @@ -265,21 +773,10 @@ self._calculate = function (searchTerm) { }; self._handleItemClick = function (event) { + if (!self._nodes.autocomplete.contains(event.target)) return; const itemIndex = Array.prototype.indexOf.call(self._nodes.autocomplete.children, event.target); - console.log(itemIndex); self._selectedItemIndex = itemIndex; - console.log(search); - search.submit(); -}; - -self._handleFocus = function () { - self._nodes.autocomplete.style.display = 'block'; -}; - -self._handleBlur = function (event) { - // console.log(document.querySelector(':focus')) - // if (event.target.parentNode === self._nodes.autocomplete) return - // self._nodes.autocomplete.style.display = 'none' + self.events.emit('select', self.getSelectedItem()); }; self._handleTextUpdate = function () { @@ -302,14 +799,13 @@ self._handleKeydown = function (event) { } }; -self._nodes.input.addEventListener('focus', self._handleFocus); -self._nodes.input.addEventListener('blur', self._handleBlur); +self._nodes.autocomplete.addEventListener('click', self._handleItemClick); self._nodes.input.addEventListener('input', self._handleTextUpdate); self._nodes.input.addEventListener('keydown', self._handleKeydown); module.exports = self; -},{"./search":9,"fuzzy":1}],4:[function(require,module,exports){ +},{"events":1,"fuzzy":2,"process":4}],6:[function(require,module,exports){ const self = {}; self._nodes = { @@ -332,7 +828,7 @@ self._nodes.input.addEventListener('input', self.hide); module.exports = self; -},{}],5:[function(require,module,exports){ +},{}],7:[function(require,module,exports){ var leftPad = require('left-pad'); var getWeek = require('./getWeek'); @@ -342,7 +838,7 @@ function getURLOfUsers(weekOffset, type, id) { module.exports = getURLOfUsers; -},{"./getWeek":6,"left-pad":2}],6:[function(require,module,exports){ +},{"./getWeek":8,"left-pad":3}],8:[function(require,module,exports){ // 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. @@ -377,7 +873,7 @@ function getWeek() { module.exports = getWeek; -},{}],7:[function(require,module,exports){ +},{}],9:[function(require,module,exports){ const getURLOfUser = require('./getURLOfUser'); const self = {}; @@ -393,7 +889,7 @@ self.viewItem = function (offset, selectedUser) { module.exports = self; -},{"./getURLOfUser":5}],8:[function(require,module,exports){ +},{"./getURLOfUser":7}],10:[function(require,module,exports){ const frontpage = require('./frontpage'); require('./search'); @@ -401,7 +897,7 @@ frontpage.show(); document.body.style.opacity = 1; -},{"./frontpage":4,"./search":9}],9:[function(require,module,exports){ +},{"./frontpage":6,"./search":11}],11:[function(require,module,exports){ const autocomplete = require('./autocomplete'); const iframe = require('./iframe'); @@ -425,11 +921,13 @@ self._handleSubmit = function (event) { self.submit(); }; -self._nodes.search.addEventListener('submit', self._handleSubmit); +autocomplete.events.on('select', self.submit); -console.log(self); +self._nodes.search.addEventListener('submit', self._handleSubmit); +self._nodes.input.addEventListener('focus', autocomplete.show); +// self._nodes.input.addEventListener('blur', autocomplete.hide) module.exports = self; -},{"./autocomplete":3,"./iframe":7}]},{},[8]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZnV6enkvbGliL2Z1enp5LmpzIiwibm9kZV9tb2R1bGVzL2xlZnQtcGFkL2luZGV4LmpzIiwicHVibGljL2phdmFzY3JpcHRzL2F1dG9jb21wbGV0ZS5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9mcm9udHBhZ2UuanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvZ2V0VVJMT2ZVc2VyLmpzIiwicHVibGljL2phdmFzY3JpcHRzL2dldFdlZWsuanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvaWZyYW1lLmpzIiwicHVibGljL2phdmFzY3JpcHRzL21haW4uanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvc2VhcmNoLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0FDQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFD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yb250cGFnZScpXG5yZXF1aXJlKCcuL3NlYXJjaCcpXG5cbmZyb250cGFnZS5zaG93KClcblxuZG9jdW1lbnQuYm9keS5zdHlsZS5vcGFjaXR5ID0gMVxuIiwiY29uc3QgYXV0b2NvbXBsZXRlID0gcmVxdWlyZSgnLi9hdXRvY29tcGxldGUnKVxuY29uc3QgaWZyYW1lID0gcmVxdWlyZSgnLi9pZnJhbWUnKVxuXG5jb25zdCBzZWxmID0ge31cblxuc2VsZi5fbm9kZXMgPSB7XG4gIHNlYXJjaDogZG9jdW1lbnQucXVlcnlTZWxlY3RvcignI3NlYXJjaCcpLFxuICBpbnB1dDogZG9jdW1lbnQucXVlcnlTZWxlY3RvcignaW5wdXRbdHlwZT1cInNlYXJjaFwiXScpXG59XG5cbnNlbGYuc3VibWl0ID0gZnVuY3Rpb24gKCkge1xuICBzZWxmLl9ub2Rlcy5pbnB1dC5ibHVyKClcblxuICBjb25zdCBzZWxlY3RlZEl0ZW0gPSBhdXRvY29tcGxldGUuZ2V0U2VsZWN0ZWRJdGVtKClcbiAgY29uc29sZS5sb2coc2VsZWN0ZWRJdGVtKVxuICBpZnJhbWUudmlld0l0ZW0oMCwgc2VsZWN0ZWRJdGVtKVxufVxuXG5zZWxmLl9oYW5kbGVTdWJtaXQgPSBmdW5jdGlvbiAoZXZlbnQpIHtcbiAgZXZlbnQucHJldmVudERlZmF1bHQoKVxuICBzZWxmLnN1Ym1pdCgpXG59XG5cbnNlbGYuX25vZGVzLnNlYXJjaC5hZGRFdmVudExpc3RlbmVyKCdzdWJtaXQnLCBzZWxmLl9oYW5kbGVTdWJtaXQpXG5cbmNvbnNvbGUubG9nKHNlbGYpXG5cbm1vZHVsZS5leHBvcnRzID0gc2VsZlxuIl19 +},{"./autocomplete":5,"./iframe":9}]},{},[10]) +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3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bnQpIHtcbiAgZXZlbnQucHJldmVudERlZmF1bHQoKVxuICBzZWxmLnN1Ym1pdCgpXG59XG5cbmF1dG9jb21wbGV0ZS5ldmVudHMub24oJ3NlbGVjdCcsIHNlbGYuc3VibWl0KVxuXG5zZWxmLl9ub2Rlcy5zZWFyY2guYWRkRXZlbnRMaXN0ZW5lcignc3VibWl0Jywgc2VsZi5faGFuZGxlU3VibWl0KVxuc2VsZi5fbm9kZXMuaW5wdXQuYWRkRXZlbnRMaXN0ZW5lcignZm9jdXMnLCBhdXRvY29tcGxldGUuc2hvdylcbi8vIHNlbGYuX25vZGVzLmlucHV0LmFkZEV2ZW50TGlzdGVuZXIoJ2JsdXInLCBhdXRvY29tcGxldGUuaGlkZSlcblxubW9kdWxlLmV4cG9ydHMgPSBzZWxmXG4iXX0= diff --git a/public/javascripts/search.js b/public/javascripts/search.js index 8887ab2..fb40f78 100644 --- a/public/javascripts/search.js +++ b/public/javascripts/search.js @@ -21,8 +21,12 @@ self._handleSubmit = function (event) { self.submit() } +autocomplete.events.on('select', self.submit) + self._nodes.search.addEventListener('submit', self._handleSubmit) +self._nodes.input.addEventListener('focus', autocomplete.show) -console.log(self) +// TODO: hide on escape key press +// self._nodes.input.addEventListener('blur', autocomplete.hide) module.exports = self -- cgit v1.1 From 5c7fed6eda250d91d4babd14da73166425fab85b Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 8 Dec 2016 22:43:21 +0100 Subject: moved function from autocomplete to search --- public/javascripts/autocomplete.js | 29 +---- public/javascripts/bundle.js | 253 ++++++------------------------------- public/javascripts/search.js | 24 ++++ 3 files changed, 62 insertions(+), 244 deletions(-) diff --git a/public/javascripts/autocomplete.js b/public/javascripts/autocomplete.js index 681dba8..f7bd046 100644 --- a/public/javascripts/autocomplete.js +++ b/public/javascripts/autocomplete.js @@ -1,8 +1,4 @@ -/* global USERS */ - -const fuzzy = require('fuzzy') const EventEmitter = require('events') -const process = require('process') const self = {} self._items = [] @@ -42,7 +38,7 @@ self.hide = function () { self._nodes.autocomplete.style.display = 'none' } -self._removeAllItems = function () { +self.removeAllItems = function () { while (self._nodes.autocomplete.firstChild) { self._nodes.autocomplete.removeChild(self._nodes.autocomplete.firstChild) } @@ -50,7 +46,7 @@ self._removeAllItems = function () { self._selectedItemIndex = -1 } -self._addItem = function (item) { +self.addItem = function (item) { const listItem = document.createElement('li') listItem.textContent = item.value self._nodes.autocomplete.appendChild(listItem) @@ -75,17 +71,6 @@ self._moveSelected = function (shift) { } } -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._handleItemClick = function (event) { if (!self._nodes.autocomplete.contains(event.target)) return const itemIndex = Array.prototype.indexOf @@ -94,15 +79,6 @@ self._handleItemClick = function (event) { self.events.emit('select', self.getSelectedItem()) } -self._handleTextUpdate = function () { - const results = self._calculate(self._nodes.input.value) - - self._removeAllItems() - for (let i = 0; i < results.length; i++) { - self._addItem(results[i]) - } -} - self._handleKeydown = function (event) { if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { event.preventDefault() @@ -115,7 +91,6 @@ self._handleKeydown = function (event) { } self._nodes.autocomplete.addEventListener('click', self._handleItemClick) -self._nodes.input.addEventListener('input', self._handleTextUpdate) self._nodes.input.addEventListener('keydown', self._handleKeydown) module.exports = self diff --git a/public/javascripts/bundle.js b/public/javascripts/bundle.js index c1d1eaf..0e26f24 100644 --- a/public/javascripts/bundle.js +++ b/public/javascripts/bundle.js @@ -503,193 +503,7 @@ function leftPad (str, len, ch) { } },{}],4:[function(require,module,exports){ -// shim for using process in browser -var process = module.exports = {}; - -// cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. - -var cachedSetTimeout; -var cachedClearTimeout; - -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} -function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); -} -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -} ()) -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } - - -} -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } - - - -} -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; - - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} - -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; - -// v8 likes predictible objects -function Item(fun, array) { - this.fun = fun; - this.array = array; -} -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues -process.versions = {}; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; -process.umask = function() { return 0; }; - -},{}],5:[function(require,module,exports){ -/* global USERS */ - -const fuzzy = require('fuzzy'); const EventEmitter = require('events'); -const process = require('process'); const self = {}; self._items = []; @@ -729,7 +543,7 @@ self.hide = function () { self._nodes.autocomplete.style.display = 'none'; }; -self._removeAllItems = function () { +self.removeAllItems = function () { while (self._nodes.autocomplete.firstChild) { self._nodes.autocomplete.removeChild(self._nodes.autocomplete.firstChild); } @@ -737,7 +551,7 @@ self._removeAllItems = function () { self._selectedItemIndex = -1; }; -self._addItem = function (item) { +self.addItem = function (item) { const listItem = document.createElement('li'); listItem.textContent = item.value; self._nodes.autocomplete.appendChild(listItem); @@ -761,17 +575,6 @@ self._moveSelected = function (shift) { } }; -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._handleItemClick = function (event) { if (!self._nodes.autocomplete.contains(event.target)) return; const itemIndex = Array.prototype.indexOf.call(self._nodes.autocomplete.children, event.target); @@ -779,15 +582,6 @@ self._handleItemClick = function (event) { self.events.emit('select', self.getSelectedItem()); }; -self._handleTextUpdate = function () { - const results = self._calculate(self._nodes.input.value); - - self._removeAllItems(); - for (let i = 0; i < results.length; i++) { - self._addItem(results[i]); - } -}; - self._handleKeydown = function (event) { if (event.key === 'ArrowDown' || event.key === 'ArrowUp') { event.preventDefault(); @@ -800,12 +594,11 @@ self._handleKeydown = function (event) { }; self._nodes.autocomplete.addEventListener('click', self._handleItemClick); -self._nodes.input.addEventListener('input', self._handleTextUpdate); self._nodes.input.addEventListener('keydown', self._handleKeydown); module.exports = self; -},{"events":1,"fuzzy":2,"process":4}],6:[function(require,module,exports){ +},{"events":1}],5:[function(require,module,exports){ const self = {}; self._nodes = { @@ -828,7 +621,7 @@ self._nodes.input.addEventListener('input', self.hide); module.exports = self; -},{}],7:[function(require,module,exports){ +},{}],6:[function(require,module,exports){ var leftPad = require('left-pad'); var getWeek = require('./getWeek'); @@ -838,7 +631,7 @@ function getURLOfUsers(weekOffset, type, id) { module.exports = getURLOfUsers; -},{"./getWeek":8,"left-pad":3}],8:[function(require,module,exports){ +},{"./getWeek":7,"left-pad":3}],7:[function(require,module,exports){ // 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. @@ -873,7 +666,7 @@ function getWeek() { module.exports = getWeek; -},{}],9:[function(require,module,exports){ +},{}],8:[function(require,module,exports){ const getURLOfUser = require('./getURLOfUser'); const self = {}; @@ -889,7 +682,7 @@ self.viewItem = function (offset, selectedUser) { module.exports = self; -},{"./getURLOfUser":7}],10:[function(require,module,exports){ +},{"./getURLOfUser":6}],9:[function(require,module,exports){ const frontpage = require('./frontpage'); require('./search'); @@ -897,7 +690,10 @@ frontpage.show(); document.body.style.opacity = 1; -},{"./frontpage":6,"./search":11}],11:[function(require,module,exports){ +},{"./frontpage":5,"./search":10}],10:[function(require,module,exports){ +/* global USERS */ + +const fuzzy = require('fuzzy'); const autocomplete = require('./autocomplete'); const iframe = require('./iframe'); @@ -921,13 +717,36 @@ self._handleSubmit = function (event) { 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]); + } +}; + autocomplete.events.on('select', self.submit); self._nodes.search.addEventListener('submit', self._handleSubmit); +self._nodes.input.addEventListener('input', self._handleTextUpdate); self._nodes.input.addEventListener('focus', autocomplete.show); + +// TODO: hide on escape key press // self._nodes.input.addEventListener('blur', autocomplete.hide) module.exports = self; -},{"./autocomplete":5,"./iframe":9}]},{},[10]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZXZlbnRzL2V2ZW50cy5qcyIsIm5vZGVfbW9kdWxlcy9mdXp6eS9saWIvZnV6enkuanMiLCJub2RlX21vZHVsZXMvbGVmdC1wYWQvaW5kZXguanMiLCJub2RlX21vZHVsZXMvcHJvY2Vzcy9icm93c2VyLmpzIiwicHVibGljL2phdmFzY3JpcHRzL2F1dG9jb21wbGV0ZS5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9mcm9udHBhZ2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mRsZVRleHRVcGRhdGUgPSBmdW5jdGlvbiAoKSB7XG4gIGNvbnN0IHJlc3VsdHMgPSBzZWxmLl9jYWxjdWxhdGUoc2VsZi5fbm9kZXMuaW5wdXQudmFsdWUpXG5cbiAgYXV0b2NvbXBsZXRlLnJlbW92ZUFsbEl0ZW1zKClcbiAgZm9yIChsZXQgaSA9IDA7IGkgPCByZXN1bHRzLmxlbmd0aDsgaSsrKSB7XG4gICAgYXV0b2NvbXBsZXRlLmFkZEl0ZW0ocmVzdWx0c1tpXSlcbiAgfVxufVxuXG5hdXRvY29tcGxldGUuZXZlbnRzLm9uKCdzZWxlY3QnLCBzZWxmLnN1Ym1pdClcblxuc2VsZi5fbm9kZXMuc2VhcmNoLmFkZEV2ZW50TGlzdGVuZXIoJ3N1Ym1pdCcsIHNlbGYuX2hhbmRsZVN1Ym1pdClcbnNlbGYuX25vZGVzLmlucHV0LmFkZEV2ZW50TGlzdGVuZXIoJ2lucHV0Jywgc2VsZi5faGFuZGxlVGV4dFVwZGF0ZSlcbnNlbGYuX25vZGVzLmlucHV0LmFkZEV2ZW50TGlzdGVuZXIoJ2ZvY3VzJywgYXV0b2NvbXBsZXRlLnNob3cpXG5cbi8vIFRPRE86IGhpZGUgb24gZXNjYXBlIGtleSBwcmVzc1xuLy8gc2VsZi5fbm9kZXMuaW5wdXQuYWRkRXZlbnRMaXN0ZW5lcignYmx1cicsIGF1dG9jb21wbGV0ZS5oaWRlKVxuXG5tb2R1bGUuZXhwb3J0cyA9IHNlbGZcbiJdfQ== diff --git a/public/javascripts/search.js b/public/javascripts/search.js index fb40f78..673afea 100644 --- a/public/javascripts/search.js +++ b/public/javascripts/search.js @@ -1,3 +1,6 @@ +/* global USERS */ + +const fuzzy = require('fuzzy') const autocomplete = require('./autocomplete') const iframe = require('./iframe') @@ -21,9 +24,30 @@ self._handleSubmit = function (event) { 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]) + } +} + autocomplete.events.on('select', self.submit) self._nodes.search.addEventListener('submit', self._handleSubmit) +self._nodes.input.addEventListener('input', self._handleTextUpdate) self._nodes.input.addEventListener('focus', autocomplete.show) // TODO: hide on escape key press -- cgit v1.1 From 1260c2788c56f8add0cad9ba758573e25b18b378 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Thu, 8 Dec 2016 22:45:52 +0100 Subject: hide autocomplete on submit --- public/javascripts/bundle.js | 4 +++- public/javascripts/search.js | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/public/javascripts/bundle.js b/public/javascripts/bundle.js index 0e26f24..6f132e6 100644 --- a/public/javascripts/bundle.js +++ b/public/javascripts/bundle.js @@ -710,6 +710,8 @@ self.submit = function () { const selectedItem = autocomplete.getSelectedItem(); console.log(selectedItem); iframe.viewItem(0, selectedItem); + + autocomplete.hide(); }; self._handleSubmit = function (event) { @@ -749,4 +751,4 @@ self._nodes.input.addEventListener('focus', autocomplete.show); module.exports = self; },{"./autocomplete":4,"./iframe":8,"fuzzy":2}]},{},[9]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZXZlbnRzL2V2ZW50cy5qcyIsIm5vZGVfbW9kdWxlcy9mdXp6eS9saWIvZnV6enkuanMiLCJub2RlX21vZHVsZXMvbGVmdC1wYWQvaW5kZXguanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvYXV0b2NvbXBsZXRlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL2Zyb250cGFnZS5qcyIsInB1YmxpYy9qYXZhc2NyaXB0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XN1bHRzID0gZmlyc3RSZXN1bHRzLm1hcChyZXN1bHQgPT4gcmVzdWx0Lm9yaWdpbmFsKVxuXG4gIHJldHVybiBvcmlnaW5hbFJlc3VsdHNcbn1cblxuc2VsZi5faGFuZGxlVGV4dFVwZGF0ZSA9IGZ1bmN0aW9uICgpIHtcbiAgY29uc3QgcmVzdWx0cyA9IHNlbGYuX2NhbGN1bGF0ZShzZWxmLl9ub2Rlcy5pbnB1dC52YWx1ZSlcblxuICBhdXRvY29tcGxldGUucmVtb3ZlQWxsSXRlbXMoKVxuICBmb3IgKGxldCBpID0gMDsgaSA8IHJlc3VsdHMubGVuZ3RoOyBpKyspIHtcbiAgICBhdXRvY29tcGxldGUuYWRkSXRlbShyZXN1bHRzW2ldKVxuICB9XG59XG5cbmF1dG9jb21wbGV0ZS5ldmVudHMub24oJ3NlbGVjdCcsIHNlbGYuc3VibWl0KVxuXG5zZWxmLl9ub2Rlcy5zZWFyY2guYWRkRXZlbnRMaXN0ZW5lcignc3VibWl0Jywgc2VsZi5faGFuZGxlU3VibWl0KVxuc2VsZi5fbm9kZXMuaW5wdXQuYWRkRXZlbnRMaXN0ZW5lcignaW5wdXQnLCBzZWxmLl9oYW5kbGVUZXh0VXBkYXRlKVxuc2VsZi5fbm9kZXMuaW5wdXQuYWRkRXZlbnRMaXN0ZW5lcignZm9jdXMnLCBhdXRvY29tcGxldGUuc2hvdylcblxuLy8gVE9ETzogaGlkZSBvbiBlc2NhcGUga2V5IHByZXNzXG4vLyBzZWxmLl9ub2Rlcy5pbnB1dC5hZGRFdmVudExpc3RlbmVyKCdibHVyJywgYXV0b2NvbXBsZXRlLmhpZGUpXG5cbm1vZHVsZS5leHBvcnRzID0gc2VsZlxuIl19 diff --git a/public/javascripts/search.js b/public/javascripts/search.js index 673afea..d98c4fb 100644 --- a/public/javascripts/search.js +++ b/public/javascripts/search.js @@ -17,6 +17,8 @@ self.submit = function () { const selectedItem = autocomplete.getSelectedItem() console.log(selectedItem) iframe.viewItem(0, selectedItem) + + autocomplete.hide() } self._handleSubmit = function (event) { -- cgit v1.1 From bd86bfa5de79b0d098a5ea7540b0717f195825ff Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Fri, 9 Dec 2016 13:50:58 +0100 Subject: removed autocomplete.show & hide function --- public/javascripts/autocomplete.js | 8 ------ public/javascripts/bundle.js | 55 +++++++++++--------------------------- public/javascripts/search.js | 8 ++---- 3 files changed, 17 insertions(+), 54 deletions(-) diff --git a/public/javascripts/autocomplete.js b/public/javascripts/autocomplete.js index f7bd046..9cd6689 100644 --- a/public/javascripts/autocomplete.js +++ b/public/javascripts/autocomplete.js @@ -30,14 +30,6 @@ self.getItems = function () { return self._items } -self.show = function () { - self._nodes.autocomplete.style.display = 'block' -} - -self.hide = function () { - self._nodes.autocomplete.style.display = 'none' -} - self.removeAllItems = function () { while (self._nodes.autocomplete.firstChild) { self._nodes.autocomplete.removeChild(self._nodes.autocomplete.firstChild) diff --git a/public/javascripts/bundle.js b/public/javascripts/bundle.js index 6f132e6..a50262b 100644 --- a/public/javascripts/bundle.js +++ b/public/javascripts/bundle.js @@ -327,23 +327,23 @@ if (typeof exports !== 'undefined') { // Return all elements of `array` that have a fuzzy // match against `pattern`. fuzzy.simpleFilter = function(pattern, array) { - return array.filter(function(str) { - return fuzzy.test(pattern, str); + return array.filter(function(string) { + return fuzzy.test(pattern, string); }); }; -// Does `pattern` fuzzy match `str`? -fuzzy.test = function(pattern, str) { - return fuzzy.match(pattern, str) !== null; +// Does `pattern` fuzzy match `string`? +fuzzy.test = function(pattern, string) { + return fuzzy.match(pattern, string) !== null; }; -// If `pattern` matches `str`, wrap each matching character +// If `pattern` matches `string`, wrap each matching character // in `opts.pre` and `opts.post`. If no match, return null -fuzzy.match = function(pattern, str, opts) { +fuzzy.match = function(pattern, string, opts) { opts = opts || {}; var patternIdx = 0 , result = [] - , len = str.length + , len = string.length , totalScore = 0 , currScore = 0 // prefix @@ -352,15 +352,15 @@ fuzzy.match = function(pattern, str, opts) { , post = opts.post || '' // String to compare against. This might be a lowercase version of the // raw string - , compareString = opts.caseSensitive && str || str.toLowerCase() - , ch; + , compareString = opts.caseSensitive && string || string.toLowerCase() + , ch, compareChar; pattern = opts.caseSensitive && pattern || pattern.toLowerCase(); // For each character in the string, either add it to the result // or wrap in template if it's the next string in the pattern for(var idx = 0; idx < len; idx++) { - ch = str[idx]; + ch = string[idx]; if(compareString[idx] === pattern[patternIdx]) { ch = pre + ch + post; patternIdx += 1; @@ -376,8 +376,6 @@ fuzzy.match = function(pattern, str, opts) { // return rendered string if we have a match for every char if(patternIdx === pattern.length) { - // if the string is an exact match with pattern, totalScore should be maxed - totalScore = (compareString === pattern) ? Infinity : totalScore; return {rendered: result.join(''), score: totalScore}; } @@ -409,12 +407,6 @@ fuzzy.match = function(pattern, str, opts) { // , extract: function(arg) { return arg.crying; } // } fuzzy.filter = function(pattern, arr, opts) { - if(!arr || arr.length === 0) { - return []; - } - if (typeof pattern !== 'string') { - return arr; - } opts = opts || {}; return arr .reduce(function(prev, element, idx, arr) { @@ -449,11 +441,6 @@ fuzzy.filter = function(pattern, arr, opts) { },{}],3:[function(require,module,exports){ -/* This program is free software. It comes without any warranty, to - * the extent permitted by applicable law. You can redistribute it - * and/or modify it under the terms of the Do What The Fuck You Want - * To Public License, Version 2, as published by Sam Hocevar. See - * http://www.wtfpl.net/ for more details. */ 'use strict'; module.exports = leftPad; @@ -489,7 +476,7 @@ function leftPad (str, len, ch) { while (true) { // add `ch` to `pad` if `len` is odd if (len & 1) pad += ch; - // divide `len` by 2, ditch the remainder + // devide `len` by 2, ditch the fraction len >>= 1; // "double" the `ch` so this operation count grows logarithmically on `len` // each time `ch` is "doubled", the `len` would need to be "doubled" too @@ -535,14 +522,6 @@ self.getItems = function () { return self._items; }; -self.show = function () { - self._nodes.autocomplete.style.display = 'block'; -}; - -self.hide = function () { - self._nodes.autocomplete.style.display = 'none'; -}; - self.removeAllItems = function () { while (self._nodes.autocomplete.firstChild) { self._nodes.autocomplete.removeChild(self._nodes.autocomplete.firstChild); @@ -708,10 +687,10 @@ self.submit = function () { self._nodes.input.blur(); const selectedItem = autocomplete.getSelectedItem(); - console.log(selectedItem); + self._nodes.input.value = selectedItem.value; iframe.viewItem(0, selectedItem); - autocomplete.hide(); + autocomplete.removeAllItems(); }; self._handleSubmit = function (event) { @@ -743,12 +722,8 @@ autocomplete.events.on('select', self.submit); self._nodes.search.addEventListener('submit', self._handleSubmit); self._nodes.input.addEventListener('input', self._handleTextUpdate); -self._nodes.input.addEventListener('focus', autocomplete.show); - -// TODO: hide on escape key press -// self._nodes.input.addEventListener('blur', autocomplete.hide) module.exports = self; },{"./autocomplete":4,"./iframe":8,"fuzzy":2}]},{},[9]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZXZlbnRzL2V2ZW50cy5qcyIsIm5vZGVfbW9kdWxlcy9mdXp6eS9saWIvZnV6enkuanMiLCJub2RlX21vZHVsZXMvbGVmdC1wYWQvaW5kZXguanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvYXV0b2NvbXBsZXRlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL2Zyb250cGFnZS5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9nZXRVUkxPZlVzZXIuanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvZ2V0V2Vlay5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9pZnJhbWUuanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvbWFpbi5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9zZWFyY2guanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUNBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QU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ClcbnNlbGYuX25vZGVzLmlucHV0LmFkZEV2ZW50TGlzdGVuZXIoJ2lucHV0Jywgc2VsZi5faGFuZGxlVGV4dFVwZGF0ZSlcblxubW9kdWxlLmV4cG9ydHMgPSBzZWxmXG4iXX0= diff --git a/public/javascripts/search.js b/public/javascripts/search.js index d98c4fb..dd22f11 100644 --- a/public/javascripts/search.js +++ b/public/javascripts/search.js @@ -15,10 +15,10 @@ self.submit = function () { self._nodes.input.blur() const selectedItem = autocomplete.getSelectedItem() - console.log(selectedItem) + self._nodes.input.value = selectedItem.value iframe.viewItem(0, selectedItem) - autocomplete.hide() + autocomplete.removeAllItems() } self._handleSubmit = function (event) { @@ -50,9 +50,5 @@ autocomplete.events.on('select', self.submit) self._nodes.search.addEventListener('submit', self._handleSubmit) self._nodes.input.addEventListener('input', self._handleTextUpdate) -self._nodes.input.addEventListener('focus', autocomplete.show) - -// TODO: hide on escape key press -// self._nodes.input.addEventListener('blur', autocomplete.hide) module.exports = self -- cgit v1.1 From c1a50798fbf547acd8466d02ce97811106cc622a Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Fri, 9 Dec 2016 13:56:18 +0100 Subject: add watch build method --- package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 3bcd7ea..4e98e6e 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "start": "node ./bin/www", "setup": "npm install && bower install", "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": { @@ -33,7 +34,8 @@ "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 ", "license": "MIT", -- cgit v1.1 From 998744084264dcf4fbbd2c52ab76cf392803fb05 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Fri, 9 Dec 2016 15:14:15 +0100 Subject: switched to non-iframe schedule viewer --- public/javascripts/bundle.js | 61 +++++++++++++++++++++++++++++++----------- public/javascripts/iframe.js | 14 ---------- public/javascripts/schedule.js | 45 +++++++++++++++++++++++++++++++ public/javascripts/search.js | 4 +-- public/stylesheets/style.css | 1 + views/index.jade | 2 +- 6 files changed, 95 insertions(+), 32 deletions(-) delete mode 100644 public/javascripts/iframe.js create mode 100644 public/javascripts/schedule.js diff --git a/public/javascripts/bundle.js b/public/javascripts/bundle.js index a50262b..6f05a17 100644 --- a/public/javascripts/bundle.js +++ b/public/javascripts/bundle.js @@ -646,35 +646,66 @@ function getWeek() { module.exports = getWeek; },{}],8:[function(require,module,exports){ +const frontpage = require('./frontpage'); +require('./search'); + +frontpage.show(); + +document.body.style.opacity = 1; + +},{"./frontpage":5,"./search":10}],9:[function(require,module,exports){ const getURLOfUser = require('./getURLOfUser'); const self = {}; self._nodes = { - iframe: document.querySelector('iframe') + schedule: document.querySelector('#schedule') }; -self.viewItem = function (offset, selectedUser) { - const url = getURLOfUser(offset, selectedUser.type, selectedUser.index + 1); - self._nodes.iframe.src = url; +self._parseMeetingpointHTML = function (htmlStr) { + const html = document.createElement('html'); + html.innerHTML = htmlStr; + const centerNode = html.querySelector('center'); + return centerNode; }; -module.exports = self; +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); +}; -},{"./getURLOfUser":6}],9:[function(require,module,exports){ -const frontpage = require('./frontpage'); -require('./search'); +self._handleError = function (event) { + const request = event.target; + console.error(request); +}; -frontpage.show(); +self.viewItem = function (offset, selectedUser) { + const url = getURLOfUser(offset, selectedUser.type, selectedUser.index + 1); -document.body.style.opacity = 1; + 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(); +}; + +module.exports = self; -},{"./frontpage":5,"./search":10}],10:[function(require,module,exports){ +},{"./getURLOfUser":6}],10:[function(require,module,exports){ /* global USERS */ const fuzzy = require('fuzzy'); const autocomplete = require('./autocomplete'); -const iframe = require('./iframe'); +const schedule = require('./schedule'); const self = {}; @@ -688,7 +719,7 @@ self.submit = function () { const selectedItem = autocomplete.getSelectedItem(); self._nodes.input.value = selectedItem.value; - iframe.viewItem(0, selectedItem); + schedule.viewItem(0, selectedItem); autocomplete.removeAllItems(); }; @@ -725,5 +756,5 @@ self._nodes.input.addEventListener('input', self._handleTextUpdate); module.exports = self; -},{"./autocomplete":4,"./iframe":8,"fuzzy":2}]},{},[9]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZXZlbnRzL2V2ZW50cy5qcyIsIm5vZGVfbW9kdWxlcy9mdXp6eS9saWIvZnV6enkuanMiLCJub2RlX21vZHVsZXMvbGVmdC1wYWQvaW5kZXguanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvYXV0b2NvbXBsZXRlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL2Zyb250cGFnZS5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9nZXRVUkxPZlVzZXIuanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvZ2V0V2Vlay5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9pZnJhbWUuanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvbWFpbi5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9zZWFyY2guanMiXSwibmFtZXMiOltd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ZhdWx0KClcbiAgc2VsZi5zdWJtaXQoKVxufVxuXG5zZWxmLl9jYWxjdWxhdGUgPSBmdW5jdGlvbiAoc2VhcmNoVGVybSkge1xuICBjb25zdCBhbGxSZXN1bHRzID0gZnV6enkuZmlsdGVyKHNlYXJjaFRlcm0sIFVTRVJTLCB7XG4gICAgZXh0cmFjdDogaXRlbSA9PiBpdGVtLnZhbHVlXG4gIH0pXG4gIGNvbnN0IGZpcnN0UmVzdWx0cyA9IGFsbFJlc3VsdHMuc2xpY2UoMCwgNylcblxuICBjb25zdCBvcmlnaW5hbFJlc3VsdHMgPSBmaXJzdFJlc3VsdHMubWFwKHJlc3VsdCA9PiByZXN1bHQub3JpZ2luYWwpXG5cbiAgcmV0dXJuIG9yaWdpbmFsUmVzdWx0c1xufVxuXG5zZWxmLl9oYW5kbGVUZXh0VXBkYXRlID0gZnVuY3Rpb24gKCkge1xuICBjb25zdCByZXN1bHRzID0gc2VsZi5fY2FsY3VsYXRlKHNlbGYuX25vZGVzLmlucHV0LnZhbHVlKVxuXG4gIGF1dG9jb21wbGV0ZS5yZW1vdmVBbGxJdGVtcygpXG4gIGZvciAobGV0IGkgPSAwOyBpIDwgcmVzdWx0cy5sZW5ndGg7IGkrKykge1xuICAgIGF1dG9jb21wbGV0ZS5hZGRJdGVtKHJlc3VsdHNbaV0pXG4gIH1cbn1cblxuYXV0b2NvbXBsZXRlLmV2ZW50cy5vbignc2VsZWN0Jywgc2VsZi5zdWJtaXQpXG5cbnNlbGYuX25vZGVzLnNlYXJjaC5hZGRFdmVudExpc3RlbmVyKCdzdWJtaXQnLCBzZWxmLl9oYW5kbGVTdWJtaXQpXG5zZWxmLl9ub2Rlcy5pbnB1dC5hZGRFdmVudExpc3RlbmVyKCdpbnB1dCcsIHNlbGYuX2hhbmRsZVRleHRVcGRhdGUpXG5cbm1vZHVsZS5leHBvcnRzID0gc2VsZlxuIl19 diff --git a/public/javascripts/iframe.js b/public/javascripts/iframe.js deleted file mode 100644 index e3296be..0000000 --- a/public/javascripts/iframe.js +++ /dev/null @@ -1,14 +0,0 @@ -const getURLOfUser = require('./getURLOfUser') - -const self = {} - -self._nodes = { - iframe: document.querySelector('iframe') -} - -self.viewItem = function (offset, selectedUser) { - const url = getURLOfUser(offset, selectedUser.type, selectedUser.index + 1) - self._nodes.iframe.src = url -} - -module.exports = self diff --git a/public/javascripts/schedule.js b/public/javascripts/schedule.js new file mode 100644 index 0000000..4e5cbf4 --- /dev/null +++ b/public/javascripts/schedule.js @@ -0,0 +1,45 @@ +const getURLOfUser = require('./getURLOfUser') + +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.viewItem = function (offset, selectedUser) { + const url = getURLOfUser(offset, selectedUser.type, selectedUser.index + 1) + + 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() +} + +module.exports = self diff --git a/public/javascripts/search.js b/public/javascripts/search.js index dd22f11..ae8118a 100644 --- a/public/javascripts/search.js +++ b/public/javascripts/search.js @@ -2,7 +2,7 @@ const fuzzy = require('fuzzy') const autocomplete = require('./autocomplete') -const iframe = require('./iframe') +const schedule = require('./schedule') const self = {} @@ -16,7 +16,7 @@ self.submit = function () { const selectedItem = autocomplete.getSelectedItem() self._nodes.input.value = selectedItem.value - iframe.viewItem(0, selectedItem) + schedule.viewItem(0, selectedItem) autocomplete.removeAllItems() } diff --git a/public/stylesheets/style.css b/public/stylesheets/style.css index 5c51bb4..616126e 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 { 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  - iframe(scrolling='no')#schedule + #schedule block scripts script. -- cgit v1.1 From e18bf78dd0a0ab8b4a70da6e370faa1a1132e211 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Fri, 9 Dec 2016 15:22:57 +0100 Subject: add searched class when searching --- public/javascripts/bundle.js | 3 ++- public/javascripts/search.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/public/javascripts/bundle.js b/public/javascripts/bundle.js index 6f05a17..fd73069 100644 --- a/public/javascripts/bundle.js +++ b/public/javascripts/bundle.js @@ -722,6 +722,7 @@ self.submit = function () { schedule.viewItem(0, selectedItem); autocomplete.removeAllItems(); + document.body.classList.add('searched'); }; self._handleSubmit = function (event) { @@ -757,4 +758,4 @@ self._nodes.input.addEventListener('input', self._handleTextUpdate); module.exports = self; },{"./autocomplete":4,"./schedule":9,"fuzzy":2}]},{},[8]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZXZlbnRzL2V2ZW50cy5qcyIsIm5vZGVfbW9kdWxlcy9mdXp6eS9saWIvZnV6enkuanMiLCJub2RlX21vZHVsZXMvbGVmdC1wYWQvaW5kZXguanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvYXV0b2NvbXBsZXRlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL2Zyb250cGFnZS5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9nZXRVUkxPZlVzZXIuanMiLCJwdWJsaWMvamF2YXNjcm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0aDsgaSsrKSB7XG4gICAgYXV0b2NvbXBsZXRlLmFkZEl0ZW0ocmVzdWx0c1tpXSlcbiAgfVxufVxuXG5hdXRvY29tcGxldGUuZXZlbnRzLm9uKCdzZWxlY3QnLCBzZWxmLnN1Ym1pdClcblxuc2VsZi5fbm9kZXMuc2VhcmNoLmFkZEV2ZW50TGlzdGVuZXIoJ3N1Ym1pdCcsIHNlbGYuX2hhbmRsZVN1Ym1pdClcbnNlbGYuX25vZGVzLmlucHV0LmFkZEV2ZW50TGlzdGVuZXIoJ2lucHV0Jywgc2VsZi5faGFuZGxlVGV4dFVwZGF0ZSlcblxubW9kdWxlLmV4cG9ydHMgPSBzZWxmXG4iXX0= diff --git a/public/javascripts/search.js b/public/javascripts/search.js index ae8118a..6d6fc3d 100644 --- a/public/javascripts/search.js +++ b/public/javascripts/search.js @@ -19,6 +19,7 @@ self.submit = function () { schedule.viewItem(0, selectedItem) autocomplete.removeAllItems() + document.body.classList.add('searched') } self._handleSubmit = function (event) { -- cgit v1.1 From 907e8c138ae890208b03b23a420b32290fc2ef88 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Fri, 9 Dec 2016 15:33:05 +0100 Subject: switch to search fireing search event instaid of calling schedule.viewItem himself --- public/javascripts/bundle.js | 20 ++++++++++++++------ public/javascripts/main.js | 7 ++++++- public/javascripts/search.js | 7 +++++-- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/public/javascripts/bundle.js b/public/javascripts/bundle.js index fd73069..d432439 100644 --- a/public/javascripts/bundle.js +++ b/public/javascripts/bundle.js @@ -647,13 +647,18 @@ module.exports = getWeek; },{}],8:[function(require,module,exports){ const frontpage = require('./frontpage'); -require('./search'); +const search = require('./search'); +const schedule = require('./schedule'); frontpage.show(); +search.events.on('search', function (selectedItem) { + schedule.viewItem(0, selectedItem); +}); + document.body.style.opacity = 1; -},{"./frontpage":5,"./search":10}],9:[function(require,module,exports){ +},{"./frontpage":5,"./schedule":9,"./search":10}],9:[function(require,module,exports){ const getURLOfUser = require('./getURLOfUser'); const self = {}; @@ -703,12 +708,14 @@ module.exports = self; },{"./getURLOfUser":6}],10:[function(require,module,exports){ /* global USERS */ +const EventEmitter = require('events'); const fuzzy = require('fuzzy'); const autocomplete = require('./autocomplete'); -const schedule = require('./schedule'); const self = {}; +self.events = new EventEmitter(); + self._nodes = { search: document.querySelector('#search'), input: document.querySelector('input[type="search"]') @@ -719,10 +726,11 @@ self.submit = function () { const selectedItem = autocomplete.getSelectedItem(); self._nodes.input.value = selectedItem.value; - schedule.viewItem(0, selectedItem); autocomplete.removeAllItems(); document.body.classList.add('searched'); + + self.events.emit('search', selectedItem); }; self._handleSubmit = function (event) { @@ -757,5 +765,5 @@ self._nodes.input.addEventListener('input', self._handleTextUpdate); module.exports = self; -},{"./autocomplete":4,"./schedule":9,"fuzzy":2}]},{},[8]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZXZlbnRzL2V2ZW50cy5qcyIsIm5vZGVfbW9kdWxlcy9mdXp6eS9saWIvZnV6enkuanMiLCJub2RlX21vZHVsZXMvbGVmdC1wYWQvaW5kZXguanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvYXV0b2NvbXBsZXRlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL2Zyb250cGFnZS5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9nZXRVUkxPZlVzZXIuanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvZ2V0V2Vlay5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9tYWluLmpzIiwicHVibGljL2phdmFzY3JpcHRzL3NjaGVkdWxlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL3NlYXJjaC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtBQ0FBO0FBQ0E7QUFDQ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0sIFVTRVJTLCB7XG4gICAgZXh0cmFjdDogaXRlbSA9PiBpdGVtLnZhbHVlXG4gIH0pXG4gIGNvbnN0IGZpcnN0UmVzdWx0cyA9IGFsbFJlc3VsdHMuc2xpY2UoMCwgNylcblxuICBjb25zdCBvcmlnaW5hbFJlc3VsdHMgPSBmaXJzdFJlc3VsdHMubWFwKHJlc3VsdCA9PiByZXN1bHQub3JpZ2luYWwpXG5cbiAgcmV0dXJuIG9yaWdpbmFsUmVzdWx0c1xufVxuXG5zZWxmLl9oYW5kbGVUZXh0VXBkYXRlID0gZnVuY3Rpb24gKCkge1xuICBjb25zdCByZXN1bHRzID0gc2VsZi5fY2FsY3VsYXRlKHNlbGYuX25vZGVzLmlucHV0LnZhbHVlKVxuXG4gIGF1dG9jb21wbGV0ZS5yZW1vdmVBbGxJdGVtcygpXG4gIGZvciAobGV0IGkgPSAwOyBpIDwgcmVzdWx0cy5sZW5ndGg7IGkrKykge1xuICAgIGF1dG9jb21wbGV0ZS5hZGRJdGVtKHJlc3VsdHNbaV0pXG4gIH1cbn1cblxuYXV0b2NvbXBsZXRlLmV2ZW50cy5vbignc2VsZWN0Jywgc2VsZi5zdWJtaXQpXG5cbnNlbGYuX25vZGVzLnNlYXJjaC5hZGRFdmVudExpc3RlbmVyKCdzdWJtaXQnLCBzZWxmLl9oYW5kbGVTdWJtaXQpXG5zZWxmLl9ub2Rlcy5pbnB1dC5hZGRFdmVudExpc3RlbmVyKCdpbnB1dCcsIHNlbGYuX2hhbmRsZVRleHRVcGRhdGUpXG5cbm1vZHVsZS5leHBvcnRzID0gc2VsZlxuIl19 diff --git a/public/javascripts/main.js b/public/javascripts/main.js index d242ce2..29f1d3e 100644 --- a/public/javascripts/main.js +++ b/public/javascripts/main.js @@ -1,6 +1,11 @@ const frontpage = require('./frontpage') -require('./search') +const search = require('./search') +const schedule = require('./schedule') frontpage.show() +search.events.on('search', function (selectedItem) { + schedule.viewItem(0, selectedItem) +}) + document.body.style.opacity = 1 diff --git a/public/javascripts/search.js b/public/javascripts/search.js index 6d6fc3d..0ee3a11 100644 --- a/public/javascripts/search.js +++ b/public/javascripts/search.js @@ -1,11 +1,13 @@ /* global USERS */ +const EventEmitter = require('events') const fuzzy = require('fuzzy') const autocomplete = require('./autocomplete') -const schedule = require('./schedule') const self = {} +self.events = new EventEmitter() + self._nodes = { search: document.querySelector('#search'), input: document.querySelector('input[type="search"]') @@ -16,10 +18,11 @@ self.submit = function () { const selectedItem = autocomplete.getSelectedItem() self._nodes.input.value = selectedItem.value - schedule.viewItem(0, selectedItem) autocomplete.removeAllItems() document.body.classList.add('searched') + + self.events.emit('search', selectedItem) } self._handleSubmit = function (event) { -- cgit v1.1 From cc60c30509e5b084f2b0c01ba22a6e43a446887f Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Fri, 9 Dec 2016 23:02:52 +0100 Subject: add week selector --- public/javascripts/bundle.js | 140 +++++++++++++++++++++++-------------- public/javascripts/main.js | 13 +++- public/javascripts/schedule.js | 13 +++- public/javascripts/weekSelector.js | 60 ++++++++++++++++ public/stylesheets/style.css | 4 ++ 5 files changed, 173 insertions(+), 57 deletions(-) create mode 100644 public/javascripts/weekSelector.js diff --git a/public/javascripts/bundle.js b/public/javascripts/bundle.js index d432439..1df9293 100644 --- a/public/javascripts/bundle.js +++ b/public/javascripts/bundle.js @@ -601,65 +601,31 @@ self._nodes.input.addEventListener('input', self.hide); module.exports = self; },{}],6:[function(require,module,exports){ -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; - -},{"./getWeek":7,"left-pad":3}],7:[function(require,module,exports){ -// 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; - -},{}],8:[function(require,module,exports){ const frontpage = require('./frontpage'); const search = require('./search'); const schedule = require('./schedule'); +const weekSelector = require('./weekSelector'); + +const state = {}; frontpage.show(); +weekSelector.updateCurrentWeek(); search.events.on('search', function (selectedItem) { - schedule.viewItem(0, selectedItem); + state.selectedItem = selectedItem; + schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem); +}); + +weekSelector.events.on('weekChanged', function (newWeek) { + schedule.viewItem(newWeek, state.selectedItem); }); +window.weekSelector = weekSelector; + document.body.style.opacity = 1; -},{"./frontpage":5,"./schedule":9,"./search":10}],9:[function(require,module,exports){ -const getURLOfUser = require('./getURLOfUser'); +},{"./frontpage":5,"./schedule":7,"./search":8,"./weekSelector":9}],7:[function(require,module,exports){ +const leftPad = require('left-pad'); const self = {}; @@ -689,8 +655,14 @@ self._handleError = function (event) { console.error(request); }; -self.viewItem = function (offset, selectedUser) { - const url = getURLOfUser(offset, selectedUser.type, selectedUser.index + 1); +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) { + console.log(selectedUser); + const url = self._getURLOfUsers(week, selectedUser.type, selectedUser.index); while (self._nodes.schedule.firstChild) { self._nodes.schedule.removeChild(self._nodes.schedule.firstChild); @@ -705,7 +677,7 @@ self.viewItem = function (offset, selectedUser) { module.exports = self; -},{"./getURLOfUser":6}],10:[function(require,module,exports){ +},{"left-pad":3}],8:[function(require,module,exports){ /* global USERS */ const EventEmitter = require('events'); @@ -765,5 +737,67 @@ self._nodes.input.addEventListener('input', self._handleTextUpdate); module.exports = self; -},{"./autocomplete":4,"events":1,"fuzzy":2}]},{},[8]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZXZlbnRzL2V2ZW50cy5qcyIsIm5vZGVfbW9kdWxlcy9mdXp6eS9saWIvZnV6enkuanMiLCJub2RlX21vZHVsZXMvbGVmdC1wYWQvaW5kZXguanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvYXV0b2NvbXBsZXRlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL2Zyb250cGFnZS5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9nZXRVUkxPZlVzZXIuanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvZ2V0V2Vlay5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9tYWluLmpzIiwicHVibGljL2phdmFzY3JpcHRzL3NjaGVkdWxlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL3NlYXJjaC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTtBQ0FBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFD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nNlbGYuX25vZGVzLnNlYXJjaC5hZGRFdmVudExpc3RlbmVyKCdzdWJtaXQnLCBzZWxmLl9oYW5kbGVTdWJtaXQpXG5zZWxmLl9ub2Rlcy5pbnB1dC5hZGRFdmVudExpc3RlbmVyKCdpbnB1dCcsIHNlbGYuX2hhbmRsZVRleHRVcGRhdGUpXG5cbm1vZHVsZS5leHBvcnRzID0gc2VsZlxuIl19 +},{"./autocomplete":4,"events":1,"fuzzy":2}],9:[function(require,module,exports){ +const EventEmitter = require('events'); + +const self = {}; + +self.events = 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.events.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; + +},{"events":1}]},{},[6]) +//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZXZlbnRzL2V2ZW50cy5qcyIsIm5vZGVfbW9kdWxlcy9mdXp6eS9saWIvZnV6enkuanMiLCJub2RlX21vZHVsZXMvbGVmdC1wYWQvaW5kZXguanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvYXV0b2NvbXBsZXRlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL2Zyb250cGFnZS5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9tYWluLmpzIiwicHVibGljL2phdmFzY3JpcHRzL3NjaGVkdWxlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL3NlYXJjaC5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy93ZWVrU2VsZWN0b3IuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUNBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0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XcgRGF0ZSgpKSAhPT0gc2VsZWN0ZWRXZWVrTnVtYmVyKSB7XG4gICAgc2VsZi5fbm9kZXMuY3VycmVudFdlZWtUZXh0LmNsYXNzTGlzdC5hZGQoJ2NoYW5nZWQnKVxuICB9IGVsc2Uge1xuICAgIHNlbGYuX25vZGVzLmN1cnJlbnRXZWVrVGV4dC5jbGFzc0xpc3QucmVtb3ZlKCdjaGFuZ2VkJylcbiAgfVxuICBzZWxmLmV2ZW50cy5lbWl0KCd3ZWVrQ2hhbmdlZCcsIHNlbGVjdGVkV2Vla051bWJlcilcbn1cblxuc2VsZi5faGFuZGxlUHJldkJ1dHRvbkNsaWNrID0gZnVuY3Rpb24gKCkge1xuICBzZWxmLl93ZWVrT2Zmc2V0IC09IDFcbiAgc2VsZi51cGRhdGVDdXJyZW50V2VlaygpXG59XG5cbnNlbGYuX2hhbmRsZU5leHRCdXR0b25DbGljayA9IGZ1bmN0aW9uICgpIHtcbiAgc2VsZi5fd2Vla09mZnNldCArPSAxXG4gIHNlbGYudXBkYXRlQ3VycmVudFdlZWsoKVxufVxuXG5zZWxmLl9ub2Rlcy5wcmV2QnV0dG9uLmFkZEV2ZW50TGlzdGVuZXIoJ2NsaWNrJywgc2VsZi5faGFuZGxlUHJldkJ1dHRvbkNsaWNrKVxuc2VsZi5fbm9kZXMubmV4dEJ1dHRvbi5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsIHNlbGYuX2hhbmRsZU5leHRCdXR0b25DbGljaylcblxubW9kdWxlLmV4cG9ydHMgPSBzZWxmXG4iXX0= diff --git a/public/javascripts/main.js b/public/javascripts/main.js index 29f1d3e..bd28475 100644 --- a/public/javascripts/main.js +++ b/public/javascripts/main.js @@ -1,11 +1,22 @@ const frontpage = require('./frontpage') const search = require('./search') const schedule = require('./schedule') +const weekSelector = require('./weekSelector') + +const state = {} frontpage.show() +weekSelector.updateCurrentWeek() search.events.on('search', function (selectedItem) { - schedule.viewItem(0, selectedItem) + state.selectedItem = selectedItem + schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem) +}) + +weekSelector.events.on('weekChanged', function (newWeek) { + schedule.viewItem(newWeek, state.selectedItem) }) +window.weekSelector = weekSelector + document.body.style.opacity = 1 diff --git a/public/javascripts/schedule.js b/public/javascripts/schedule.js index 4e5cbf4..10ba520 100644 --- a/public/javascripts/schedule.js +++ b/public/javascripts/schedule.js @@ -1,4 +1,4 @@ -const getURLOfUser = require('./getURLOfUser') +const leftPad = require('left-pad') const self = {} @@ -28,8 +28,15 @@ self._handleError = function (event) { console.error(request) } -self.viewItem = function (offset, selectedUser) { - const url = getURLOfUser(offset, selectedUser.type, selectedUser.index + 1) +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) { + console.log(selectedUser) + const url = self._getURLOfUsers(week, selectedUser.type, selectedUser.index) while (self._nodes.schedule.firstChild) { self._nodes.schedule.removeChild(self._nodes.schedule.firstChild) diff --git a/public/javascripts/weekSelector.js b/public/javascripts/weekSelector.js new file mode 100644 index 0000000..7ce0d68 --- /dev/null +++ b/public/javascripts/weekSelector.js @@ -0,0 +1,60 @@ +const EventEmitter = require('events') + +const self = {} + +self.events = 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.events.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 616126e..86f232e 100644 --- a/public/stylesheets/style.css +++ b/public/stylesheets/style.css @@ -177,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; -- cgit v1.1 From 670976458b5375d27dc525f66b8faa3dc78e799b Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Wed, 14 Dec 2016 11:07:04 +0100 Subject: extend EventEmitter instaid of property --- public/javascripts/autocomplete.js | 7 +++---- public/javascripts/bundle.js | 27 +++++++++++---------------- public/javascripts/main.js | 4 ++-- public/javascripts/search.js | 8 +++----- public/javascripts/weekSelector.js | 6 ++---- 5 files changed, 21 insertions(+), 31 deletions(-) diff --git a/public/javascripts/autocomplete.js b/public/javascripts/autocomplete.js index 9cd6689..71fb17d 100644 --- a/public/javascripts/autocomplete.js +++ b/public/javascripts/autocomplete.js @@ -1,11 +1,10 @@ const EventEmitter = require('events') -const self = {} + +const self = new EventEmitter() self._items = [] self._selectedItemIndex = -1 -self.events = new EventEmitter() - self._nodes = { search: document.querySelector('#search'), input: document.querySelector('input[type="search"]'), @@ -68,7 +67,7 @@ self._handleItemClick = function (event) { const itemIndex = Array.prototype.indexOf .call(self._nodes.autocomplete.children, event.target) self._selectedItemIndex = itemIndex - self.events.emit('select', self.getSelectedItem()) + self.emit('select', self.getSelectedItem()) } self._handleKeydown = function (event) { diff --git a/public/javascripts/bundle.js b/public/javascripts/bundle.js index 1df9293..505a002 100644 --- a/public/javascripts/bundle.js +++ b/public/javascripts/bundle.js @@ -491,13 +491,12 @@ function leftPad (str, len, ch) { },{}],4:[function(require,module,exports){ const EventEmitter = require('events'); -const self = {}; + +const self = new EventEmitter(); self._items = []; self._selectedItemIndex = -1; -self.events = new EventEmitter(); - self._nodes = { search: document.querySelector('#search'), input: document.querySelector('input[type="search"]'), @@ -558,7 +557,7 @@ 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.events.emit('select', self.getSelectedItem()); + self.emit('select', self.getSelectedItem()); }; self._handleKeydown = function (event) { @@ -611,12 +610,12 @@ const state = {}; frontpage.show(); weekSelector.updateCurrentWeek(); -search.events.on('search', function (selectedItem) { +search.on('search', function (selectedItem) { state.selectedItem = selectedItem; schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem); }); -weekSelector.events.on('weekChanged', function (newWeek) { +weekSelector.on('weekChanged', function (newWeek) { schedule.viewItem(newWeek, state.selectedItem); }); @@ -684,9 +683,7 @@ const EventEmitter = require('events'); const fuzzy = require('fuzzy'); const autocomplete = require('./autocomplete'); -const self = {}; - -self.events = new EventEmitter(); +const self = new EventEmitter(); self._nodes = { search: document.querySelector('#search'), @@ -702,7 +699,7 @@ self.submit = function () { autocomplete.removeAllItems(); document.body.classList.add('searched'); - self.events.emit('search', selectedItem); + self.emit('search', selectedItem); }; self._handleSubmit = function (event) { @@ -730,7 +727,7 @@ self._handleTextUpdate = function () { } }; -autocomplete.events.on('select', self.submit); +autocomplete.on('select', self.submit); self._nodes.search.addEventListener('submit', self._handleSubmit); self._nodes.input.addEventListener('input', self._handleTextUpdate); @@ -740,9 +737,7 @@ module.exports = self; },{"./autocomplete":4,"events":1,"fuzzy":2}],9:[function(require,module,exports){ const EventEmitter = require('events'); -const self = {}; - -self.events = new EventEmitter(); +const self = new EventEmitter(); self._nodes = { prevButton: document.querySelectorAll('#week-selector button')[0], @@ -781,7 +776,7 @@ self.updateCurrentWeek = function () { } else { self._nodes.currentWeekText.classList.remove('changed'); } - self.events.emit('weekChanged', selectedWeekNumber); + self.emit('weekChanged', selectedWeekNumber); }; self._handlePrevButtonClick = function () { @@ -800,4 +795,4 @@ self._nodes.nextButton.addEventListener('click', self._handleNextButtonClick); module.exports = self; },{"events":1}]},{},[6]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZXZlbnRzL2V2ZW50cy5qcyIsIm5vZGVfbW9kdWxlcy9mdXp6eS9saWIvZnV6enkuanMiLCJub2RlX21vZHVsZXMvbGVmdC1wYWQvaW5kZXguanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvYXV0b2NvbXBsZXRlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL2Zyb250cGFnZS5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9tYWluLmpzIiwicHVibGljL2phdmFzY3JpcHRzL3NjaGVkdWxlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL3NlYXJjaC5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy93ZWVrU2VsZWN0b3IuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUNBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtB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sZi5faGFuZGxlUHJldkJ1dHRvbkNsaWNrID0gZnVuY3Rpb24gKCkge1xuICBzZWxmLl93ZWVrT2Zmc2V0IC09IDFcbiAgc2VsZi51cGRhdGVDdXJyZW50V2VlaygpXG59XG5cbnNlbGYuX2hhbmRsZU5leHRCdXR0b25DbGljayA9IGZ1bmN0aW9uICgpIHtcbiAgc2VsZi5fd2Vla09mZnNldCArPSAxXG4gIHNlbGYudXBkYXRlQ3VycmVudFdlZWsoKVxufVxuXG5zZWxmLl9ub2Rlcy5wcmV2QnV0dG9uLmFkZEV2ZW50TGlzdGVuZXIoJ2NsaWNrJywgc2VsZi5faGFuZGxlUHJldkJ1dHRvbkNsaWNrKVxuc2VsZi5fbm9kZXMubmV4dEJ1dHRvbi5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsIHNlbGYuX2hhbmRsZU5leHRCdXR0b25DbGljaylcblxubW9kdWxlLmV4cG9ydHMgPSBzZWxmXG4iXX0= diff --git a/public/javascripts/main.js b/public/javascripts/main.js index bd28475..6e0796c 100644 --- a/public/javascripts/main.js +++ b/public/javascripts/main.js @@ -8,12 +8,12 @@ const state = {} frontpage.show() weekSelector.updateCurrentWeek() -search.events.on('search', function (selectedItem) { +search.on('search', function (selectedItem) { state.selectedItem = selectedItem schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem) }) -weekSelector.events.on('weekChanged', function (newWeek) { +weekSelector.on('weekChanged', function (newWeek) { schedule.viewItem(newWeek, state.selectedItem) }) diff --git a/public/javascripts/search.js b/public/javascripts/search.js index 0ee3a11..c1e6158 100644 --- a/public/javascripts/search.js +++ b/public/javascripts/search.js @@ -4,9 +4,7 @@ const EventEmitter = require('events') const fuzzy = require('fuzzy') const autocomplete = require('./autocomplete') -const self = {} - -self.events = new EventEmitter() +const self = new EventEmitter() self._nodes = { search: document.querySelector('#search'), @@ -22,7 +20,7 @@ self.submit = function () { autocomplete.removeAllItems() document.body.classList.add('searched') - self.events.emit('search', selectedItem) + self.emit('search', selectedItem) } self._handleSubmit = function (event) { @@ -50,7 +48,7 @@ self._handleTextUpdate = function () { } } -autocomplete.events.on('select', self.submit) +autocomplete.on('select', self.submit) self._nodes.search.addEventListener('submit', self._handleSubmit) self._nodes.input.addEventListener('input', self._handleTextUpdate) diff --git a/public/javascripts/weekSelector.js b/public/javascripts/weekSelector.js index 7ce0d68..2a8bb62 100644 --- a/public/javascripts/weekSelector.js +++ b/public/javascripts/weekSelector.js @@ -1,8 +1,6 @@ const EventEmitter = require('events') -const self = {} - -self.events = new EventEmitter() +const self = new EventEmitter() self._nodes = { prevButton: document.querySelectorAll('#week-selector button')[0], @@ -41,7 +39,7 @@ self.updateCurrentWeek = function () { } else { self._nodes.currentWeekText.classList.remove('changed') } - self.events.emit('weekChanged', selectedWeekNumber) + self.emit('weekChanged', selectedWeekNumber) } self._handlePrevButtonClick = function () { -- cgit v1.1 From aa3206fb3e828e8ba3ee182e5770cfb4ddc21dfe Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Wed, 14 Dec 2016 11:07:39 +0100 Subject: removed `console.log` --- public/javascripts/bundle.js | 3 +-- public/javascripts/schedule.js | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/public/javascripts/bundle.js b/public/javascripts/bundle.js index 505a002..b1a16a7 100644 --- a/public/javascripts/bundle.js +++ b/public/javascripts/bundle.js @@ -660,7 +660,6 @@ self._getURLOfUsers = function (week, type, index) { }; self.viewItem = function (week, selectedUser) { - console.log(selectedUser); const url = self._getURLOfUsers(week, selectedUser.type, selectedUser.index); while (self._nodes.schedule.firstChild) { @@ -795,4 +794,4 @@ self._nodes.nextButton.addEventListener('click', self._handleNextButtonClick); module.exports = self; },{"events":1}]},{},[6]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZXZlbnRzL2V2ZW50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Jlcilcbn1cblxuc2VsZi5faGFuZGxlUHJldkJ1dHRvbkNsaWNrID0gZnVuY3Rpb24gKCkge1xuICBzZWxmLl93ZWVrT2Zmc2V0IC09IDFcbiAgc2VsZi51cGRhdGVDdXJyZW50V2VlaygpXG59XG5cbnNlbGYuX2hhbmRsZU5leHRCdXR0b25DbGljayA9IGZ1bmN0aW9uICgpIHtcbiAgc2VsZi5fd2Vla09mZnNldCArPSAxXG4gIHNlbGYudXBkYXRlQ3VycmVudFdlZWsoKVxufVxuXG5zZWxmLl9ub2Rlcy5wcmV2QnV0dG9uLmFkZEV2ZW50TGlzdGVuZXIoJ2NsaWNrJywgc2VsZi5faGFuZGxlUHJldkJ1dHRvbkNsaWNrKVxuc2VsZi5fbm9kZXMubmV4dEJ1dHRvbi5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsIHNlbGYuX2hhbmRsZU5leHRCdXR0b25DbGljaylcblxubW9kdWxlLmV4cG9ydHMgPSBzZWxmXG4iXX0= diff --git a/public/javascripts/schedule.js b/public/javascripts/schedule.js index 10ba520..e181e00 100644 --- a/public/javascripts/schedule.js +++ b/public/javascripts/schedule.js @@ -35,7 +35,6 @@ self._getURLOfUsers = function (week, type, index) { } self.viewItem = function (week, selectedUser) { - console.log(selectedUser) const url = self._getURLOfUsers(week, selectedUser.type, selectedUser.index) while (self._nodes.schedule.firstChild) { -- cgit v1.1 From 746abfd1827bf7d6d51c231b5509d5f609e71f07 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Wed, 14 Dec 2016 12:19:41 +0100 Subject: removed unused files --- public/javascripts/easterEggs.js | 91 -------------------------------------- public/javascripts/getURLOfUser.js | 9 ---- public/javascripts/getUsers.js | 7 --- public/javascripts/getWeek.js | 33 -------------- 4 files changed, 140 deletions(-) delete mode 100644 public/javascripts/easterEggs.js delete mode 100644 public/javascripts/getURLOfUser.js delete mode 100644 public/javascripts/getUsers.js delete mode 100644 public/javascripts/getWeek.js 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/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 -- cgit v1.1 From e3f1a6a2c3534c3133f412f1b86f7398f3b4f40c Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Wed, 14 Dec 2016 12:19:59 +0100 Subject: add favorite --- public/javascripts/bundle.js | 112 +++++++++++++++++++++++++++++++++++++---- public/javascripts/favorite.js | 73 +++++++++++++++++++++++++++ public/javascripts/main.js | 15 ++++++ public/javascripts/schedule.js | 4 ++ public/javascripts/search.js | 11 ++-- 5 files changed, 203 insertions(+), 12 deletions(-) create mode 100644 public/javascripts/favorite.js diff --git a/public/javascripts/bundle.js b/public/javascripts/bundle.js index b1a16a7..f0a8bf7 100644 --- a/public/javascripts/bundle.js +++ b/public/javascripts/bundle.js @@ -577,6 +577,76 @@ self._nodes.input.addEventListener('keydown', self._handleKeydown); module.exports = self; },{"events":1}],5:[function(require,module,exports){ +/* 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 = ''; +}; + +self.delete = function () { + window.localStorage.removeItem('fav'); +}; + +self.updateDom = function (isFavorite) { + if (isFavorite) { + self._nodes.toggle.innerHTML = ''; + } else { + self._nodes.toggle.innerHTML = ''; + } +}; + +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; + +},{"events":1}],6:[function(require,module,exports){ const self = {}; self._nodes = { @@ -599,19 +669,30 @@ self._nodes.input.addEventListener('input', self.hide); module.exports = self; -},{}],6:[function(require,module,exports){ +},{}],7:[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); +} + search.on('search', function (selectedItem) { state.selectedItem = selectedItem; + favorite.update(state.selectedItem); schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem); }); @@ -619,12 +700,18 @@ weekSelector.on('weekChanged', function (newWeek) { schedule.viewItem(newWeek, state.selectedItem); }); +favorite.on('click', function () { + favorite.toggle(state.selectedItem); +}); + window.weekSelector = weekSelector; document.body.style.opacity = 1; -},{"./frontpage":5,"./schedule":7,"./search":8,"./weekSelector":9}],7:[function(require,module,exports){ +},{"./favorite":5,"./frontpage":6,"./schedule":8,"./search":9,"./weekSelector":10}],8:[function(require,module,exports){ const leftPad = require('left-pad'); +const autocomplete = require('./autocomplete'); +const search = require('./search'); const self = {}; @@ -671,11 +758,13 @@ self.viewItem = function (week, selectedUser) { request.addEventListener('error', self._handleError); request.open('GET', url, true); request.send(); + + search.updateDom(selectedUser); }; module.exports = self; -},{"left-pad":3}],8:[function(require,module,exports){ +},{"./autocomplete":4,"./search":9,"left-pad":3}],9:[function(require,module,exports){ /* global USERS */ const EventEmitter = require('events'); @@ -693,14 +782,19 @@ self.submit = function () { self._nodes.input.blur(); const selectedItem = autocomplete.getSelectedItem(); - self._nodes.input.value = selectedItem.value; - autocomplete.removeAllItems(); - document.body.classList.add('searched'); + 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._handleSubmit = function (event) { event.preventDefault(); self.submit(); @@ -733,7 +827,7 @@ self._nodes.input.addEventListener('input', self._handleTextUpdate); module.exports = self; -},{"./autocomplete":4,"events":1,"fuzzy":2}],9:[function(require,module,exports){ +},{"./autocomplete":4,"events":1,"fuzzy":2}],10:[function(require,module,exports){ const EventEmitter = require('events'); const self = new EventEmitter(); @@ -793,5 +887,5 @@ self._nodes.nextButton.addEventListener('click', self._handleNextButtonClick); module.exports = self; -},{"events":1}]},{},[6]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZXZlbnRzL2V2ZW50cy5qcyIsIm5vZGVfbW9kdWxlcy9mdXp6eS9saWIvZnV6enkuanMiLCJub2RlX21vZHVsZXMvbGVmdC1wYWQvaW5kZXguanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvYXV0b2NvbXBsZXRlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL2Zyb250cGFnZS5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9tYWluLmpzIiwicHVibGljL2phdmFzY3JpcHRzL3NjaGVkdWxlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL3NlYXJjaC5qcyIsInB1Ym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IChzZWxmLmdldEN1cnJlbnRXZWVrKG5ldyBEYXRlKCkpICE9PSBzZWxlY3RlZFdlZWtOdW1iZXIpIHtcbiAgICBzZWxmLl9ub2Rlcy5jdXJyZW50V2Vla1RleHQuY2xhc3NMaXN0LmFkZCgnY2hhbmdlZCcpXG4gIH0gZWxzZSB7XG4gICAgc2VsZi5fbm9kZXMuY3VycmVudFdlZWtUZXh0LmNsYXNzTGlzdC5yZW1vdmUoJ2NoYW5nZWQnKVxuICB9XG4gIHNlbGYuZW1pdCgnd2Vla0NoYW5nZWQnLCBzZWxlY3RlZFdlZWtOdW1iZXIpXG59XG5cbnNlbGYuX2hhbmRsZVByZXZCdXR0b25DbGljayA9IGZ1bmN0aW9uICgpIHtcbiAgc2VsZi5fd2Vla09mZnNldCAtPSAxXG4gIHNlbGYudXBkYXRlQ3VycmVudFdlZWsoKVxufVxuXG5zZWxmLl9oYW5kbGVOZXh0QnV0dG9uQ2xpY2sgPSBmdW5jdGlvbiAoKSB7XG4gIHNlbGYuX3dlZWtPZmZzZXQgKz0gMVxuICBzZWxmLnVwZGF0ZUN1cnJlbnRXZWVrKClcbn1cblxuc2VsZi5fbm9kZXMucHJldkJ1dHRvbi5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsIHNlbGYuX2hhbmRsZVByZXZCdXR0b25DbGljaylcbnNlbGYuX25vZGVzLm5leHRCdXR0b24uYWRkRXZlbnRMaXN0ZW5lcignY2xpY2snLCBzZWxmLl9oYW5kbGVOZXh0QnV0dG9uQ2xpY2spXG5cbm1vZHVsZS5leHBvcnRzID0gc2VsZlxuIl19 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 = '' +} + +self.delete = function () { + window.localStorage.removeItem('fav') +} + +self.updateDom = function (isFavorite) { + if (isFavorite) { + self._nodes.toggle.innerHTML = '' + } else { + self._nodes.toggle.innerHTML = '' + } +} + +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/main.js b/public/javascripts/main.js index 6e0796c..9214d05 100644 --- a/public/javascripts/main.js +++ b/public/javascripts/main.js @@ -2,14 +2,25 @@ 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) +} + search.on('search', function (selectedItem) { state.selectedItem = selectedItem + favorite.update(state.selectedItem) schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem) }) @@ -17,6 +28,10 @@ weekSelector.on('weekChanged', function (newWeek) { schedule.viewItem(newWeek, state.selectedItem) }) +favorite.on('click', function () { + favorite.toggle(state.selectedItem) +}) + window.weekSelector = weekSelector document.body.style.opacity = 1 diff --git a/public/javascripts/schedule.js b/public/javascripts/schedule.js index e181e00..e3944f8 100644 --- a/public/javascripts/schedule.js +++ b/public/javascripts/schedule.js @@ -1,4 +1,6 @@ const leftPad = require('left-pad') +const autocomplete = require('./autocomplete') +const search = require('./search') const self = {} @@ -46,6 +48,8 @@ self.viewItem = function (week, selectedUser) { 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 index c1e6158..f0f905f 100644 --- a/public/javascripts/search.js +++ b/public/javascripts/search.js @@ -15,14 +15,19 @@ self.submit = function () { self._nodes.input.blur() const selectedItem = autocomplete.getSelectedItem() - self._nodes.input.value = selectedItem.value - autocomplete.removeAllItems() - document.body.classList.add('searched') + 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._handleSubmit = function (event) { event.preventDefault() self.submit() -- cgit v1.1 From 900366c6d623fde54223f93930d28a84264cbb46 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Wed, 14 Dec 2016 12:29:57 +0100 Subject: handle search focus --- public/javascripts/bundle.js | 19 ++++++++++++++++++- public/javascripts/search.js | 17 +++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/public/javascripts/bundle.js b/public/javascripts/bundle.js index f0a8bf7..24bcfb1 100644 --- a/public/javascripts/bundle.js +++ b/public/javascripts/bundle.js @@ -820,9 +820,26 @@ self._handleTextUpdate = function () { } }; +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('input', self._handleTextUpdate); module.exports = self; @@ -888,4 +905,4 @@ self._nodes.nextButton.addEventListener('click', self._handleNextButtonClick); module.exports = self; },{"events":1}]},{},[7]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZXZlbnRzL2V2ZW50cy5qcyIsIm5vZGVfbW9kdWxlcy9mdXp6eS9saWIvZnV6enkuanMiLCJub2RlX21vZHVsZXMvbGVmdC1wYWQvaW5kZXguanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvYXV0b2NvbXBsZXRlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL2Zhdm9yaXRlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL2Zyb250cGFnZS5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9tYWluLmpzIiwicHVibGljL2phdmFzY3JpcHRzL3NjaGVkdWxlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL3NlYXJjaC5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy93ZWVrU2VsZWN0b3IuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUNBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUN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ZmZzZXQgKz0gMVxuICBzZWxmLnVwZGF0ZUN1cnJlbnRXZWVrKClcbn1cblxuc2VsZi5fbm9kZXMucHJldkJ1dHRvbi5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsIHNlbGYuX2hhbmRsZVByZXZCdXR0b25DbGljaylcbnNlbGYuX25vZGVzLm5leHRCdXR0b24uYWRkRXZlbnRMaXN0ZW5lcignY2xpY2snLCBzZWxmLl9oYW5kbGVOZXh0QnV0dG9uQ2xpY2spXG5cbm1vZHVsZS5leHBvcnRzID0gc2VsZlxuIl19 diff --git a/public/javascripts/search.js b/public/javascripts/search.js index f0f905f..d1a49e2 100644 --- a/public/javascripts/search.js +++ b/public/javascripts/search.js @@ -53,9 +53,26 @@ self._handleTextUpdate = function () { } } +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('input', self._handleTextUpdate) module.exports = self -- cgit v1.1 From 819f3dd2088777c4d84a707b4bd62559382f36f5 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Wed, 14 Dec 2016 12:38:27 +0100 Subject: fix ie input event --- public/javascripts/browserFixToolkit.js | 12 ++++++++++++ public/javascripts/bundle.js | 34 ++++++++++++++++++++++++--------- public/javascripts/frontpage.js | 4 +++- public/javascripts/search.js | 4 +++- 4 files changed, 43 insertions(+), 11 deletions(-) create mode 100644 public/javascripts/browserFixToolkit.js 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 24bcfb1..f266af0 100644 --- a/public/javascripts/bundle.js +++ b/public/javascripts/bundle.js @@ -577,6 +577,19 @@ self._nodes.input.addEventListener('keydown', self._handleKeydown); module.exports = self; },{"events":1}],5:[function(require,module,exports){ +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; + +},{}],6:[function(require,module,exports){ /* global USERS */ const EventEmitter = require('events'); @@ -646,7 +659,9 @@ self._nodes.toggle.addEventListener('click', self._handleClick); module.exports = self; -},{"events":1}],6:[function(require,module,exports){ +},{"events":1}],7:[function(require,module,exports){ +const browserFixToolkit = require('./browserFixToolkit'); + const self = {}; self._nodes = { @@ -665,11 +680,11 @@ self.hide = function () { self.isShown = false; }; -self._nodes.input.addEventListener('input', self.hide); +self._nodes.input.addEventListener(browserFixToolkit.inputEvent, self.hide); module.exports = self; -},{}],7:[function(require,module,exports){ +},{"./browserFixToolkit":5}],8:[function(require,module,exports){ const frontpage = require('./frontpage'); const search = require('./search'); const schedule = require('./schedule'); @@ -708,7 +723,7 @@ window.weekSelector = weekSelector; document.body.style.opacity = 1; -},{"./favorite":5,"./frontpage":6,"./schedule":8,"./search":9,"./weekSelector":10}],8:[function(require,module,exports){ +},{"./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'); @@ -764,12 +779,13 @@ self.viewItem = function (week, selectedUser) { module.exports = self; -},{"./autocomplete":4,"./search":9,"left-pad":3}],9:[function(require,module,exports){ +},{"./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(); @@ -840,11 +856,11 @@ 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('input', self._handleTextUpdate); +self._nodes.input.addEventListener(browserFixToolkit.inputEvent, self._handleTextUpdate); module.exports = self; -},{"./autocomplete":4,"events":1,"fuzzy":2}],10:[function(require,module,exports){ +},{"./autocomplete":4,"./browserFixToolkit":5,"events":1,"fuzzy":2}],11:[function(require,module,exports){ const EventEmitter = require('events'); const self = new EventEmitter(); @@ -904,5 +920,5 @@ self._nodes.nextButton.addEventListener('click', self._handleNextButtonClick); module.exports = self; -},{"events":1}]},{},[7]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZXZlbnRzL2V2ZW50cy5qcyIsIm5vZGVfbW9kdWxlcy9mdXp6eS9saWIvZnV6enkuanMiLCJub2RlX21vZHVsZXMvbGVmdC1wYWQvaW5kZXguanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvYXV0b2NvbXBsZXRlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL2Zhdm9yaXRlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL2Zyb250cGFnZS5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9tYWluLmpzIiwicHVibGljL2phdmFzY3JpcHRzL3NjaGVkdWxlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL3NlYXJjaC5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy93ZWVrU2Vs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frontpage.js index d789045..17cb539 100644 --- a/public/javascripts/frontpage.js +++ b/public/javascripts/frontpage.js @@ -1,3 +1,5 @@ +const browserFixToolkit = require('./browserFixToolkit') + const self = {} self._nodes = { @@ -16,6 +18,6 @@ self.hide = function () { self.isShown = false } -self._nodes.input.addEventListener('input', self.hide) +self._nodes.input.addEventListener(browserFixToolkit.inputEvent, self.hide) module.exports = self diff --git a/public/javascripts/search.js b/public/javascripts/search.js index d1a49e2..8ae3043 100644 --- a/public/javascripts/search.js +++ b/public/javascripts/search.js @@ -3,6 +3,7 @@ const EventEmitter = require('events') const fuzzy = require('fuzzy') const autocomplete = require('./autocomplete') +const browserFixToolkit = require('./browserFixToolkit') const self = new EventEmitter() @@ -73,6 +74,7 @@ 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('input', self._handleTextUpdate) +self._nodes.input.addEventListener(browserFixToolkit.inputEvent, + self._handleTextUpdate) module.exports = self -- cgit v1.1 From 4d1c0fe2b6bbb180bf86c1195e1c80a4769d61e6 Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Wed, 14 Dec 2016 12:40:20 +0100 Subject: auto focus input on page load --- public/javascripts/bundle.js | 8 +++++++- public/javascripts/main.js | 2 ++ public/javascripts/search.js | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/public/javascripts/bundle.js b/public/javascripts/bundle.js index f266af0..a9e5964 100644 --- a/public/javascripts/bundle.js +++ b/public/javascripts/bundle.js @@ -703,6 +703,8 @@ if (favorite.get() != null) { state.selectedItem = favorite.get(); favorite.update(state.selectedItem); schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem); +} else { + search.focus(); } search.on('search', function (selectedItem) { @@ -811,6 +813,10 @@ self.updateDom = function (selectedItem) { document.body.classList.add('searched'); }; +self.focus = function () { + self._nodes.input.focus(); +}; + self._handleSubmit = function (event) { event.preventDefault(); self.submit(); @@ -921,4 +927,4 @@ self._nodes.nextButton.addEventListener('click', self._handleNextButtonClick); module.exports = self; },{"events":1}]},{},[8]) -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJub2RlX21vZHVsZXMvZXZlbnRzL2V2ZW50cy5qcyIsIm5vZGVfbW9kdWxlcy9mdXp6eS9saWIvZnV6enkuanMiLCJub2RlX21vZHVsZXMvbGVmdC1wYWQvaW5kZXguanMiLCJwdWJsaWMvamF2YXNjcmlwdHMvYXV0b2NvbXBsZXRlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL2Jyb3dzZXJGaXhUb29sa2l0LmpzIiwicHVibGljL2phdmFzY3JpcHRzL2Zhdm9yaXRlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL2Zyb250cGFnZS5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy9tYWluLmpzIiwicHVibGljL2phdmFzY3JpcHRzL3NjaGVkdWxlLmpzIiwicHVibGljL2phdmFzY3JpcHRzL3NlYXJjaC5qcyIsInB1YmxpYy9qYXZhc2NyaXB0cy93ZWVrU2VsZWN0b3IuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUNBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQT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WJlcn1gXG4gIGlmIChzZWxmLmdldEN1cnJlbnRXZWVrKG5ldyBEYXRlKCkpICE9PSBzZWxlY3RlZFdlZWtOdW1iZXIpIHtcbiAgICBzZWxmLl9ub2Rlcy5jdXJyZW50V2Vla1RleHQuY2xhc3NMaXN0LmFkZCgnY2hhbmdlZCcpXG4gIH0gZWxzZSB7XG4gICAgc2VsZi5fbm9kZXMuY3VycmVudFdlZWtUZXh0LmNsYXNzTGlzdC5yZW1vdmUoJ2NoYW5nZWQnKVxuICB9XG4gIHNlbGYuZW1pdCgnd2Vla0NoYW5nZWQnLCBzZWxlY3RlZFdlZWtOdW1iZXIpXG59XG5cbnNlbGYuX2hhbmRsZVByZXZCdXR0b25DbGljayA9IGZ1bmN0aW9uICgpIHtcbiAgc2VsZi5fd2Vla09mZnNldCAtPSAxXG4gIHNlbGYudXBkYXRlQ3VycmVudFdlZWsoKVxufVxuXG5zZWxmLl9oYW5kbGVOZXh0QnV0dG9uQ2xpY2sgPSBmdW5jdGlvbiAoKSB7XG4gIHNlbGYuX3dlZWtPZmZzZXQgKz0gMVxuICBzZWxmLnVwZGF0ZUN1cnJlbnRXZWVrKClcbn1cblxuc2VsZi5fbm9kZXMucHJldkJ1dHRvbi5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsIHNlbGYuX2hhbmRsZVByZXZCdXR0b25DbGljaylcbnNlbGYuX25vZGVzLm5leHRCdXR0b24uYWRkRXZlbnRMaXN0ZW5lcignY2xpY2snLCBzZWxmLl9oYW5kbGVOZXh0QnV0dG9uQ2xpY2spXG5cbm1vZHVsZS5leHBvcnRzID0gc2VsZlxuIl19 diff --git a/public/javascripts/main.js b/public/javascripts/main.js index 9214d05..de29a5d 100644 --- a/public/javascripts/main.js +++ b/public/javascripts/main.js @@ -16,6 +16,8 @@ if (favorite.get() != null) { state.selectedItem = favorite.get() favorite.update(state.selectedItem) schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem) +} else { + search.focus() } search.on('search', function (selectedItem) { diff --git a/public/javascripts/search.js b/public/javascripts/search.js index 8ae3043..7d80709 100644 --- a/public/javascripts/search.js +++ b/public/javascripts/search.js @@ -29,6 +29,10 @@ self.updateDom = function (selectedItem) { document.body.classList.add('searched') } +self.focus = function () { + self._nodes.input.focus() +} + self._handleSubmit = function (event) { event.preventDefault() self.submit() -- cgit v1.1