Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#67) Fix URLSearchParams #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,21 @@ function FilterSelector() {
return root;
}
window.onload = function () {
feature_params = new URLSearchParams(document.location.search).has("feature-params");
if (URLSearchParams) {
feature_params = new URLSearchParams(document.location.search).has("feature-params");
}
else {
var query = document.location.toString().split('?')[1];
feature_params = false;
if (query) {
for (var _i = 0, _a = query.split('&'); _i < _a.length; _i++) {
var el = _a[_i];
if (el === "feature-params") {
feature_params = true;
}
}
}
}
var filterSelectorEntry = document.getElementById('filter-selector-entry');
if (filterSelectorEntry === null) {
throw new Error('Could not find "filter-selector-entry"');
Expand Down
16 changes: 15 additions & 1 deletion ts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,21 @@ function FilterSelector() {
}

window.onload = () => {
feature_params = new URLSearchParams(document.location.search).has("feature-params");
if (URLSearchParams) {
feature_params = new URLSearchParams(document.location.search).has("feature-params");
} else {
// IE support
const query = document.location.toString().split('?')[1];
feature_params = false;
if (query) {
// IE doesnt have Array.includes()
for (const el of query.split('&')) {
if (el === "feature-params") {
feature_params = true;
}
}
}
}

const filterSelectorEntry = document.getElementById('filter-selector-entry');
if (filterSelectorEntry === null) {
Expand Down