aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2017-01-30 17:56:25 +0100
committerNoah Loomans <noahloomans@gmail.com>2017-01-30 17:56:25 +0100
commit344504782ac628b15229cafada34a9f32d595624 (patch)
tree532293fef971164b21e3227955ff532668f850a1
parent29ea424009be3bd8561e74587b651c1c44bf2f7e (diff)
parent25fbba2084a23fb62ab0e7fdf2dd47eadc28a967 (diff)
Merge branch 'update-url' into beta
-rw-r--r--public/javascripts/bundle.js131
-rw-r--r--public/javascripts/main.js28
-rw-r--r--public/javascripts/schedule.js21
-rw-r--r--public/javascripts/search.js15
-rw-r--r--public/javascripts/url.js59
-rw-r--r--routes/index.js2
6 files changed, 227 insertions, 29 deletions
diff --git a/public/javascripts/bundle.js b/public/javascripts/bundle.js
index 43b6562..c2d67ee 100644
--- a/public/javascripts/bundle.js
+++ b/public/javascripts/bundle.js
@@ -1085,6 +1085,7 @@ var weekSelector = require('./weekSelector');
var favorite = require('./favorite');
var scrollSnap = require('./scrollSnap');
var analytics = require('./analytics');
+var url = require('./url');
var state = {};
@@ -1095,10 +1096,22 @@ frontpage.show();
weekSelector.updateCurrentWeek();
scrollSnap.startListening();
-if (favorite.get() != null) {
+if (url.hasSelectedItem()) {
+ state.selectedItem = url.getSelectedItem();
+
+ favorite.update(state.selectedItem);
+ url.update(state.selectedItem);
+ analytics.send.search(state.selectedItem);
+
+ schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem);
+} else if (favorite.get() != null) {
state.selectedItem = favorite.get();
+
favorite.update(state.selectedItem);
+ url.push(state.selectedItem, false);
+ url.update(state.selectedItem);
analytics.send.search(state.selectedItem, true);
+
schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem);
} else {
search.focus();
@@ -1106,8 +1119,21 @@ if (favorite.get() != null) {
search.on('search', function (selectedItem) {
state.selectedItem = selectedItem;
+
favorite.update(state.selectedItem);
+ url.push(state.selectedItem);
+ url.update(state.selectedItem);
analytics.send.search(state.selectedItem);
+
+ schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem);
+});
+
+url.on('update', function (selectedItem) {
+ state.selectedItem = selectedItem;
+
+ favorite.update(state.selectedItem);
+ url.update(state.selectedItem);
+
schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem);
});
@@ -1122,7 +1148,7 @@ favorite.on('click', function () {
document.body.style.opacity = 1;
-},{"./analytics":5,"./favorite":8,"./featureDetect":9,"./frontpage":10,"./schedule":12,"./scrollSnap":13,"./search":14,"./weekSelector":15}],12:[function(require,module,exports){
+},{"./analytics":5,"./favorite":8,"./featureDetect":9,"./frontpage":10,"./schedule":12,"./scrollSnap":13,"./search":14,"./url":15,"./weekSelector":16}],12:[function(require,module,exports){
'use strict';
var EventEmitter = require('events');
@@ -1181,17 +1207,22 @@ self._removeChilds = function () {
};
self.viewItem = function (week, selectedUser) {
- var url = self._getURLOfUsers(week, selectedUser.type, selectedUser.index);
+ if (selectedUser == null) {
+ self._removeChilds();
+ search.updateDom(selectedUser);
+ } else {
+ var url = self._getURLOfUsers(week, selectedUser.type, selectedUser.index);
- self._removeChilds();
+ self._removeChilds();
- var request = new window.XMLHttpRequest();
- request.addEventListener('load', self._handleLoad);
- request.addEventListener('error', self._handleError);
- request.open('GET', url, true);
- request.send();
+ var request = new window.XMLHttpRequest();
+ request.addEventListener('load', self._handleLoad);
+ request.addEventListener('error', self._handleError);
+ request.open('GET', url, true);
+ request.send();
- search.updateDom(selectedUser);
+ search.updateDom(selectedUser);
+ }
};
module.exports = self;
@@ -1284,10 +1315,17 @@ self.submit = function () {
};
self.updateDom = function (selectedItem) {
- self._nodes.input.value = selectedItem.value;
- autocomplete.removeAllItems();
- document.body.classList.remove('no-input');
- document.body.classList.add('searched');
+ if (selectedItem == null) {
+ self._nodes.input.value = '';
+ autocomplete.removeAllItems();
+ document.body.classList.add('no-input');
+ document.body.classList.remove('searched');
+ } else {
+ self._nodes.input.value = selectedItem.value;
+ autocomplete.removeAllItems();
+ document.body.classList.remove('no-input');
+ document.body.classList.add('searched');
+ }
};
self.focus = function () {
@@ -1350,6 +1388,69 @@ module.exports = self;
},{"./autocomplete":6,"./browserFixToolkit":7,"events":1,"fuzzy":2}],15:[function(require,module,exports){
'use strict';
+/* global USERS */
+
+var EventEmitter = require('events');
+
+var self = new EventEmitter();
+
+self._getPageTitle = function (selectedItem) {
+ if (selectedItem == null) {
+ return 'Metis Rooster';
+ } else {
+ return 'Metis Rooster - ' + selectedItem.value;
+ }
+};
+
+self._getPageURL = function (selectedItem) {
+ return '/' + selectedItem.type + '/' + selectedItem.value;
+};
+
+self.push = function (selectedItem, push) {
+ if (push == null) push = true;
+ var pageTitle = self._getPageTitle(selectedItem);
+ var pageURL = self._getPageURL(selectedItem);
+ if (push) {
+ window.history.pushState(selectedItem, pageTitle, pageURL);
+ } else {
+ window.history.replaceState(selectedItem, pageTitle, pageURL);
+ }
+};
+
+self.update = function (selectedItem) {
+ document.title = self._getPageTitle(selectedItem);
+};
+
+self.hasSelectedItem = function () {
+ var pageUrl = window.location.pathname;
+ return (/^\/s\/|^\/t\/|^\/r\/|^\/c\//.test(pageUrl)
+ );
+};
+
+self.getSelectedItem = function () {
+ var pageUrl = window.location.pathname;
+ var pageUrlData = pageUrl.split('/');
+ var type = pageUrlData[1];
+ var value = pageUrlData[2];
+
+ var user = USERS.filter(function (user) {
+ return user.type === type && user.value === value;
+ })[0];
+
+ return user;
+};
+
+self._handleUpdate = function (event) {
+ self.emit('update', event.state);
+};
+
+window.addEventListener('popstate', self._handleUpdate);
+
+module.exports = self;
+
+},{"events":1}],16:[function(require,module,exports){
+'use strict';
+
var EventEmitter = require('events');
var self = new EventEmitter();
@@ -1450,4 +1551,4 @@ self._nodes.nextButton.addEventListener('click', self._handleNextButtonClick);
module.exports = self;
},{"events":1}]},{},[11])
-//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93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ICAgICAvLyBmaXJzdCBhcmcgbm90IGFuIG9iamVjdC9udWxsXG4gICAgICAgIC8vIG9yIGJlaGF2aW9yIGlzIGF1dG8sIGluc3RhbnQgb3IgdW5kZWZpbmVkXG4gICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgfVxuXG4gICAgICBpZiAodHlwZW9mIHggPT09ICdvYmplY3QnXG4gICAgICAgICAgICAmJiB4LmJlaGF2aW9yID09PSAnc21vb3RoJykge1xuICAgICAgICAvLyBmaXJzdCBhcmd1bWVudCBpcyBhbiBvYmplY3QgYW5kIGJlaGF2aW9yIGlzIHNtb290aFxuICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICB9XG5cbiAgICAgIC8vIHRocm93IGVycm9yIHdoZW4gYmVoYXZpb3IgaXMgbm90IHN1cHBvcnRlZFxuICAgICAgdGhyb3cgbmV3IFR5cGVFcnJvcignYmVoYXZpb3Igbm90IHZhbGlkJyk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogZmluZHMgc2Nyb2xsYWJsZSBwYXJlbnQgb2YgYW4gZWxlbWVudFxuICAgICAqIEBtZXRob2QgZmluZFNjcm9sbGFibGVQYXJlbnRcbiAgICAgKiBAcGFyYW0ge05vZGV9IGVsXG4gICAgICogQHJldHVybnMge05vZGV9IGVsXG4gICAgICovXG4gICAgZnVuY3Rpb24gZmluZFNjcm9sbGFibGVQYXJlbnQoZWwpIHtcbiAgICAgIHZhciBpc0JvZHk7XG4gICAgICB2YXIgaGFzU2Nyb2xsYWJsZVNwYWNlO1xuICAgICAgdmFyIGhhc1Zpc2libGVPdmVyZmxvdztcblxuICAgICAgZG8ge1xuICAgICAgICBlbCA9IGVsLnBhcmVudE5vZGU7XG5cbiAgICAgICAgLy8gc2V0IGNvbmRpdGlvbiB2YXJpYWJsZXNcbiAgICAgICAgaXNCb2R5ID0gZWwgPT09IGQuYm9keTtcbiAgICAgICAgaGFzU2Nyb2xsYWJsZVNwYWNlID1cbiAgICAgICAgICBlbC5jbGll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ICAgICAgICByZXR1cm47XG4gICAgICB9XG5cbiAgICAgIC8vIExFVCBUSEUgU01PT1RITkVTUyBCRUdJTiFcbiAgICAgIHNtb290aFNjcm9sbC5jYWxsKFxuICAgICAgICB3LFxuICAgICAgICBkLmJvZHksXG4gICAgICAgIH5+YXJndW1lbnRzWzBdLmxlZnQgKyAody5zY3JvbGxYIHx8IHcucGFnZVhPZmZzZXQpLFxuICAgICAgICB+fmFyZ3VtZW50c1swXS50b3AgKyAody5zY3JvbGxZIHx8IHcucGFnZVlPZmZzZXQpXG4gICAgICApO1xuICAgIH07XG5cbiAgICAvLyBFbGVtZW50LnByb3RvdHlwZS5zY3JvbGxJbnRvVmlld1xuICAgIEVsZW1lbnQucHJvdG90eXBlLnNjcm9sbEludG9WaWV3ID0gZnVuY3Rpb24oKSB7XG4gICAgICAvLyBhdm9pZCBzbW9vdGggYmVoYXZpb3IgaWYgbm90IHJlcXVpcmVkXG4gICAgICBpZiAoc2hvdWxkQmFpbE91dChhcmd1bWVudHNbMF0pKSB7XG4gICAgICAgIG9yaWdpbmFsLnNjcm9sbEludG9WaWV3LmNhbGwodGhpcywgYXJndW1lbnRzWzBdIHx8IHRydWUpO1xuICAgICAgICByZXR1cm47XG4gICAgICB9XG5cbiAgICAgIC8vIExFVCBUSEUgU01PT1RITkVTUyBCRUdJTiFcbiAgICAgIHZhciBzY3JvbGxhYmxlUGFyZW50ID0gZmluZFNjcm9sbGFibGVQYXJlbnQodGhpcyk7XG4gICAgICB2YXIgcGFyZW50UmVjdHMgPSBzY3JvbGxhYmxlUGFyZW50LmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpO1xuICAgICAgdmFyIGNsaWVudFJlY3RzID0gdGhpcy5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKTtcblxuICAgICAgaWYgKHNjcm9sbGFibGVQYXJlbnQgIT09IGQuYm9keSkge1xuICAgICAgICAvLyByZXZlYWwgZWxlbWVudCBpbnNpZGUgcGFyZW50XG4gICAgICAgIHNt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2VsZi5fbm9kZXMubmV4dEJ1dHRvbi5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsIHNlbGYuX2hhbmRsZU5leHRCdXR0b25DbGljaylcblxubW9kdWxlLmV4cG9ydHMgPSBzZWxmXG4iXX0=
diff --git a/public/javascripts/main.js b/public/javascripts/main.js
index 6f99621..561316d 100644
--- a/public/javascripts/main.js
+++ b/public/javascripts/main.js
@@ -7,6 +7,7 @@ const weekSelector = require('./weekSelector')
const favorite = require('./favorite')
const scrollSnap = require('./scrollSnap')
const analytics = require('./analytics')
+const url = require('./url')
const state = {}
@@ -17,10 +18,22 @@ frontpage.show()
weekSelector.updateCurrentWeek()
scrollSnap.startListening()
-if (favorite.get() != null) {
+if (url.hasSelectedItem()) {
+ state.selectedItem = url.getSelectedItem()
+
+ favorite.update(state.selectedItem)
+ url.update(state.selectedItem)
+ analytics.send.search(state.selectedItem)
+
+ schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem)
+} else if (favorite.get() != null) {
state.selectedItem = favorite.get()
+
favorite.update(state.selectedItem)
+ url.push(state.selectedItem, false)
+ url.update(state.selectedItem)
analytics.send.search(state.selectedItem, true)
+
schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem)
} else {
search.focus()
@@ -28,8 +41,21 @@ if (favorite.get() != null) {
search.on('search', function (selectedItem) {
state.selectedItem = selectedItem
+
favorite.update(state.selectedItem)
+ url.push(state.selectedItem)
+ url.update(state.selectedItem)
analytics.send.search(state.selectedItem)
+
+ schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem)
+})
+
+url.on('update', function (selectedItem) {
+ state.selectedItem = selectedItem
+
+ favorite.update(state.selectedItem)
+ url.update(state.selectedItem)
+
schedule.viewItem(weekSelector.getSelectedWeek(), state.selectedItem)
})
diff --git a/public/javascripts/schedule.js b/public/javascripts/schedule.js
index a1ca647..a8e13c8 100644
--- a/public/javascripts/schedule.js
+++ b/public/javascripts/schedule.js
@@ -55,17 +55,22 @@ self._removeChilds = function () {
}
self.viewItem = function (week, selectedUser) {
- const url = self._getURLOfUsers(week, selectedUser.type, selectedUser.index)
+ if (selectedUser == null) {
+ self._removeChilds()
+ search.updateDom(selectedUser)
+ } else {
+ const url = self._getURLOfUsers(week, selectedUser.type, selectedUser.index)
- self._removeChilds()
+ self._removeChilds()
- const request = new window.XMLHttpRequest()
- request.addEventListener('load', self._handleLoad)
- request.addEventListener('error', self._handleError)
- request.open('GET', url, true)
- request.send()
+ const request = new window.XMLHttpRequest()
+ request.addEventListener('load', self._handleLoad)
+ request.addEventListener('error', self._handleError)
+ request.open('GET', url, true)
+ request.send()
- search.updateDom(selectedUser)
+ search.updateDom(selectedUser)
+ }
}
module.exports = self
diff --git a/public/javascripts/search.js b/public/javascripts/search.js
index a07d6dd..e6cf3a9 100644
--- a/public/javascripts/search.js
+++ b/public/javascripts/search.js
@@ -25,10 +25,17 @@ self.submit = function () {
}
self.updateDom = function (selectedItem) {
- self._nodes.input.value = selectedItem.value
- autocomplete.removeAllItems()
- document.body.classList.remove('no-input')
- document.body.classList.add('searched')
+ if (selectedItem == null) {
+ self._nodes.input.value = ''
+ autocomplete.removeAllItems()
+ document.body.classList.add('no-input')
+ document.body.classList.remove('searched')
+ } else {
+ self._nodes.input.value = selectedItem.value
+ autocomplete.removeAllItems()
+ document.body.classList.remove('no-input')
+ document.body.classList.add('searched')
+ }
}
self.focus = function () {
diff --git a/public/javascripts/url.js b/public/javascripts/url.js
new file mode 100644
index 0000000..b856285
--- /dev/null
+++ b/public/javascripts/url.js
@@ -0,0 +1,59 @@
+/* global USERS */
+
+const EventEmitter = require('events')
+
+const self = new EventEmitter()
+
+self._getPageTitle = function (selectedItem) {
+ if (selectedItem == null) {
+ return `Metis Rooster`
+ } else {
+ return `Metis Rooster - ${selectedItem.value}`
+ }
+}
+
+self._getPageURL = function (selectedItem) {
+ return `/${selectedItem.type}/${selectedItem.value}`
+}
+
+self.push = function (selectedItem, push) {
+ if (push == null) push = true
+ const pageTitle = self._getPageTitle(selectedItem)
+ const pageURL = self._getPageURL(selectedItem)
+ if (push) {
+ window.history.pushState(selectedItem, pageTitle, pageURL)
+ } else {
+ window.history.replaceState(selectedItem, pageTitle, pageURL)
+ }
+}
+
+self.update = function (selectedItem) {
+ document.title = self._getPageTitle(selectedItem)
+}
+
+self.hasSelectedItem = function () {
+ const pageUrl = window.location.pathname
+ return /^\/s\/|^\/t\/|^\/r\/|^\/c\//.test(pageUrl)
+}
+
+self.getSelectedItem = function () {
+ const pageUrl = window.location.pathname
+ const pageUrlData = pageUrl.split('/')
+ const type = pageUrlData[1]
+ const value = pageUrlData[2]
+
+ const user = USERS.filter(function (user) {
+ return user.type === type &&
+ user.value === value
+ })[0]
+
+ return user
+}
+
+self._handleUpdate = function (event) {
+ self.emit('update', event.state)
+}
+
+window.addEventListener('popstate', self._handleUpdate)
+
+module.exports = self
diff --git a/routes/index.js b/routes/index.js
index 1ab2ba3..d1f7765 100644
--- a/routes/index.js
+++ b/routes/index.js
@@ -5,7 +5,7 @@ const router = express.Router()
const users = require('../lib/getUserIndex')
/* GET home page. */
-router.get('/', function (req, res, next) {
+router.get(['/', '/s/*', '/t/*', '/r/*', '/c/*'], function (req, res, next) {
let flags = []
if (req.query.nfd != null) {
flags.push('NO_FEATURE_DETECT')