Skip to content

Commit f9001fa

Browse files
committed
Remove explicit stylesheet import; Fix JS match null error
1 parent a0dbbe3 commit f9001fa

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

views/search-content.html

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
</nav>
1616
</div>
1717

18-
<link rel="stylesheet" type="text/css" href="/static/stylesheets/search-pages.css">
19-
2018
<div class="home-group-orgs-container container mx-auto p-gutter search-buttons-container">
2119
<div class="mt-gutter" id="datavejviser-container" style="margin-top: 0px !important;">
2220
<a href="/search">
@@ -49,32 +47,35 @@
4947

5048
let params = new URLSearchParams(location.search);
5149
let regExp = /(?:[^\s"]+|"[^"]*")+/g;
52-
let qAll = params.get('q').match(regExp);
5350

54-
for (qPart of qAll) {
55-
qTerm = (qTerm + " " + qPart).trim();
56-
};
57-
58-
$("#search-content-input").val(qTerm);
51+
if (params.get('q')) {
52+
let qAll = params.get('q').match(regExp);
53+
54+
for (qPart of qAll) {
55+
qTerm = (qTerm + " " + qPart).trim();
56+
};
5957

60-
// capture search term changes
61-
$("#search-content-input").on('input', function (event) {
62-
qTerm = $(this).val();
63-
});
58+
$("#search-content-input").val(qTerm);
6459

65-
// click on button event
66-
var searchBtn = document.getElementById("search-button");
60+
// capture search term changes
61+
$("#search-content-input").on('input', function (event) {
62+
qTerm = $(this).val();
63+
});
6764

68-
searchBtn.onclick = function(event) {
69-
window.location.href = window.location.origin + "/search/content?q=" + qTerm;
70-
};
65+
// click on button event
66+
var searchBtn = document.getElementById("search-button");
7167

72-
// press on Enter event
73-
$("#search-content-input").on('keyup', function (event) {
74-
if (event.originalEvent.code === "Enter") {
68+
searchBtn.onclick = function(event) {
7569
window.location.href = window.location.origin + "/search/content?q=" + qTerm;
76-
}
77-
});
70+
};
71+
72+
// press on Enter event
73+
$("#search-content-input").on('keyup', function (event) {
74+
if (event.originalEvent.code === "Enter") {
75+
window.location.href = window.location.origin + "/search/content?q=" + qTerm;
76+
}
77+
});
78+
}
7879

7980
</script>
8081
{% endblock %}

0 commit comments

Comments
 (0)