@@ 73,7 73,8 @@ form.addEventListener("submit", function(e) {
e.preventDefault();
var tagValue = form.elements.tag.value;
var excludeValue = form.elements.exclude.value;
- var qValue = form.elements.q.value
+ var qValue = form.elements.q.value;
+ var qURL = new URLSearchParams();
if (tagValue === "") {
form.elements.tag.disabled = true;
@@ 83,7 84,7 @@ form.addEventListener("submit", function(e) {
if (tagValue.endsWith(",")) {
tagValue = tagValue.slice(0, -1);
}
- form.elements.tag.value = tagValue;
+ qURL.set("tag", tagValue);
}
if (excludeValue === "") {
@@ 94,13 95,21 @@ form.addEventListener("submit", function(e) {
if (excludeValue.endsWith(",")) {
excludeValue = excludeValue.slice(0, -1);
}
- form.elements.exclude.value = excludeValue;
+ qURL.set("exclude", excludeValue);
}
if (qValue === "") {
form.elements.q.disabled = true;
+ } else {
+ qURL.set("q", qValue);
+ }
+
+ url = this.getAttribute("action");
+ params = qURL.toString();
+ if (params !== "") {
+ url += "?" + params;
}
- this.submit();
+ document.location = url;
})