[!!!][TASK] Indexable urls

This commit is contained in:
Xaver Maierhofer 2018-07-22 15:30:09 +02:00
parent 02e02f9219
commit 81a26b5560
No known key found for this signature in database
GPG Key ID: 7FDCE23FD2EC9FE8

View File

@ -82,10 +82,10 @@ define(['Navigo'], function (Navigo) {
} }
} }
var router = new Navigo(null, true); var router = new Navigo(null, true, '#!');
router router
.on(/^\/?#?\/([\w]{2})?\/?(map|graph)?\/?([a-f\d]{12})?([a-f\d\-]{25})?\/?(?:(\d+)\/(-?[\d.]+)\/(-?[\d.]+))?$/, customRoute) .on(/^\/?#?!?\/([\w]{2})?\/?(map|graph)?\/?([a-f\d]{12})?([a-f\d\-]{25})?\/?(?:(\d+)\/(-?[\d.]+)\/(-?[\d.]+))?$/, customRoute)
.on({ .on({
'*': function () { '*': function () {
router.fullUrl(); router.fullUrl();
@ -93,7 +93,7 @@ define(['Navigo'], function (Navigo) {
}); });
router.generateLink = function generateLink(data, full, deep) { router.generateLink = function generateLink(data, full, deep) {
var result = '#'; var result = '#!';
if (full) { if (full) {
data = Object.assign({}, state, data); data = Object.assign({}, state, data);
@ -119,7 +119,7 @@ define(['Navigo'], function (Navigo) {
}; };
router.getLang = function getLang() { router.getLang = function getLang() {
var lang = location.hash.match(/^\/?#\/([\w]{2})\//); var lang = location.hash.match(/^\/?#!?\/([\w]{2})\//);
if (lang) { if (lang) {
state.lang = language.getLocale(lang[1]); state.lang = language.getLocale(lang[1]);
return lang[1]; return lang[1];