Stop creating a shared global querystring variable

This commit is contained in:
Tom Hughes 2019-07-15 20:27:42 +01:00
parent cc5688a6de
commit 6dd451c7ee
12 changed files with 56 additions and 25 deletions

View file

@ -17,16 +17,15 @@
//= require richtext
//= require querystring
var qs = require("querystring-component");
/*
* Called as the user scrolls/zooms around to maniplate hrefs of the
* view tab and various other links
*/
window.updateLinks = function (loc, zoom, layers, object) {
$(".geolink").each(function (index, link) {
var href = link.href.split(/[?#]/)[0],
args = qs.parse(link.search.substring(1)),
var querystring = require("querystring-component"),
href = link.href.split(/[?#]/)[0],
args = querystring.parse(link.search.substring(1)),
editlink = $(link).hasClass("editlink");
delete args.node;
@ -38,7 +37,7 @@ window.updateLinks = function (loc, zoom, layers, object) {
args[object.type] = object.id;
}
var query = qs.stringify(args);
var query = querystring.stringify(args);
if (query) href += "?" + query;
args = {