aboutsummaryrefslogtreecommitdiff
path: root/public/javascripts/featureDetect.js
diff options
context:
space:
mode:
authorBuildTools <Noah Loomans>2017-01-07 22:37:16 +0100
committerBuildTools <Noah Loomans>2017-01-07 22:37:16 +0100
commit549364fb691f7f092223e186033a8138c3ead2fd (patch)
treebec1b0bbc972a08ff69464853190044780eb667d /public/javascripts/featureDetect.js
parent4e8da42863406764a659a7337e774ad216d356c9 (diff)
parenta5238353ab86923bb3911e0bf2886ebcb53dfbd2 (diff)
Merge branch 'beta'
Diffstat (limited to 'public/javascripts/featureDetect.js')
-rw-r--r--public/javascripts/featureDetect.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/public/javascripts/featureDetect.js b/public/javascripts/featureDetect.js
new file mode 100644
index 0000000..3a072a1
--- /dev/null
+++ b/public/javascripts/featureDetect.js
@@ -0,0 +1,29 @@
+/* global FLAGS */
+
+const self = {}
+
+self._nodes = {
+ input: document.querySelector('input[type="search"]'),
+ overflowButton: document.querySelector('#overflow-button')
+}
+
+self._shouldCheck = function () {
+ return FLAGS.indexOf('NO_FEATURE_DETECT') === -1
+}
+
+self._redirect = function () {
+ window.location.href = 'http://www.meetingpointmco.nl/Roosters-AL/doc/'
+}
+
+self.check = function () {
+ if (!self._shouldCheck()) return
+
+ window.onerror = self._redirect
+
+ if (self._nodes.input.getClientRects()[0].top !==
+ self._nodes.overflowButton.getClientRects()[0].top) {
+ self._redirect()
+ }
+}
+
+module.exports = self