diff options
author | Noah Loomans <noahloomans@gmail.com> | 2016-12-06 15:29:43 +0100 |
---|---|---|
committer | Noah Loomans <noahloomans@gmail.com> | 2016-12-06 15:29:43 +0100 |
commit | 54b9362d9548c8137d242fe5d30b3b0bbea72189 (patch) | |
tree | 6390767aea5c1ce9349c90733fe913bad0b51f70 /public/javascripts/main.js | |
parent | 863d43f5038cd3b660c2f5160cd56124fa09427b (diff) | |
parent | 9d94ae11c13d8bcff23eac725c2d7bae2a7872a9 (diff) |
Merge branch 'beta' of https://github.com/nloomans/rooster-mml into beta
Diffstat (limited to 'public/javascripts/main.js')
-rw-r--r-- | public/javascripts/main.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/public/javascripts/main.js b/public/javascripts/main.js index 016a8ee..31645e8 100644 --- a/public/javascripts/main.js +++ b/public/javascripts/main.js @@ -1,4 +1,4 @@ -/* global ga */ +/* global ga FLAGS */ require('flexibility') @@ -7,6 +7,7 @@ const fuzzy = require('fuzzy') 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="text"]') @@ -17,8 +18,7 @@ const nextButton = document.querySelectorAll('input[type="button"]')[1] const currentWeekNode = document.querySelector('.current') const favNode = document.querySelector('.fav') -if (!(window.location.href.split('?')[1] && - window.location.href.split('?')[1].indexOf('nfd') >= 0)) { // nfd = no feature detection +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/' @@ -107,6 +107,7 @@ searchNode.addEventListener('keydown', function (e) { }) searchNode.addEventListener('input', function (e) { + searchNode.className = '' autocompleteNode.innerHTML = '' if (inputNode.value.trim() === '') return @@ -233,4 +234,11 @@ if (currentFav) { ga(function () { ga('send', { hitType: 'event', eventCategory: 'search fav', eventAction, eventLabel }) }) +} else if (inputNode.value === '') { + searchNode.className = 'no-input' + inputNode.focus() } + +document.body.style = '' + +window.easterEggs = easterEggs |