Have utilStringQs advance past any leading '?' or '#' characters

This lets us remove a bunch of substring(1) and +1 from the code.
This commit is contained in:
Bryan Housel
2020-02-20 17:09:54 -05:00
parent 1f4fe57d8b
commit dc7fba4bf8
10 changed files with 61 additions and 38 deletions
+2 -2
View File
@@ -39,7 +39,7 @@ export function behaviorHash(context) {
var center = map.center();
var zoom = map.zoom();
var precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2));
var q = utilObjectOmit(utilStringQs(window.location.hash.substring(1)),
var q = utilObjectOmit(utilStringQs(window.location.hash),
['comment', 'source', 'hashtags', 'walkthrough']
);
var newParams = {};
@@ -91,7 +91,7 @@ export function behaviorHash(context) {
.on('hashchange.hash', hashchange);
if (window.location.hash) {
var q = utilStringQs(window.location.hash.substring(1));
var q = utilStringQs(window.location.hash);
if (q.id) {
context.zoomToEntity(q.id.split(',')[0], !q.map);