Skip to content

Commit efacb6d

Browse files
authored
Merge pull request #559 from ivan/dashboard-query-args
2 parents 86e4009 + ecd91c0 commit efacb6d

1 file changed

Lines changed: 1 addition & 20 deletions

File tree

dashboard/assets/scripts/dashboard.js

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -122,25 +122,6 @@ function regExpEscape(s) {
122122
return escaped;
123123
}
124124

125-
/**
126-
* [[1, 2], [3, 4]] -> {1: 2, 3: 4}
127-
*/
128-
function intoObject(arr) {
129-
const obj = {};
130-
arr.forEach((e) => {
131-
obj[e[0]] = e[1];
132-
});
133-
return obj;
134-
}
135-
136-
function getQueryArgs() {
137-
const pairs = location.search.replace("?", "").split("&");
138-
if (pairs === "") {
139-
return {};
140-
}
141-
return intoObject(pairs.map((e) => split(e, "=", 1)));
142-
}
143-
144125
function addAnyChangeListener(elem, func) {
145126
// DOM0 handler for convenient use by Clear button
146127
elem.onchange = func;
@@ -1009,7 +990,7 @@ class Dashboard {
1009990
this.newItemsReceived = 0;
1010991
this.newBytesReceived = 0;
1011992

1012-
const args = getQueryArgs();
993+
const args = Object.fromEntries(new URLSearchParams(window.location.search));
1013994

1014995
const historyLines = args.historyLines ? Number(args.historyLines) : navigator.userAgent.match(/Mobi/) ? 250 : 500;
1015996
const batchTimeWhenVisible = args.batchTimeWhenVisible ? Number(args.batchTimeWhenVisible) : 125;

0 commit comments

Comments
 (0)