mirror of
https://github.com/urbanguacamole/torrent-paradise.git
synced 2022-02-03 00:44:15 +03:00
feat: set q parameter when searching
This makes refershes work.
This commit is contained in:
committed by
urbanguacamole
parent
81bb90c141
commit
dc63bd5e64
@@ -1,7 +1,15 @@
|
||||
function setQueryParam(s) {
|
||||
let params = URLSearchParams(window.location.search)
|
||||
params.set("q", s);
|
||||
var newRelativePathQuery = window.location.pathname + '?' + params.toString();
|
||||
history.pushState(null, '', newRelativePathQuery);
|
||||
}
|
||||
|
||||
function searchTriggered() {
|
||||
let searchbox = document.getElementById("searchbox");
|
||||
let query = searchbox.value
|
||||
searchFor(query);
|
||||
searchFor(query)
|
||||
setQueryParam(query)
|
||||
passQueryToResultpage(query)
|
||||
}
|
||||
|
||||
@@ -31,4 +39,4 @@ function passQueryToResultpage(query) {
|
||||
type: "query",
|
||||
query: query
|
||||
}, '*');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,9 +186,17 @@ async function checkIfIpfsGateway(gatewayURL) {
|
||||
}
|
||||
}
|
||||
|
||||
function setQueryParam(s) {
|
||||
let params = URLSearchParams(window.location.search)
|
||||
params.set("q", s);
|
||||
var newRelativePathQuery = window.location.pathname + '?' + params.toString();
|
||||
history.pushState(null, '', newRelativePathQuery);
|
||||
}
|
||||
|
||||
function searchTriggered() {
|
||||
let searchbox = document.getElementById("searchbox");
|
||||
let querytokens = searchbox.value.split(" ");
|
||||
passQueryToResultpage(searchbox.value)
|
||||
querytokens = querytokens.map(querytoken => {
|
||||
return stemmer(querytoken);
|
||||
});
|
||||
@@ -610,4 +618,4 @@ async function getDocumentForId(docid) {
|
||||
let doc = inxFetcher.combinedIndex.get(docid);
|
||||
doc["id"] = docid;
|
||||
return inxFetcher.combinedIndex.get(docid);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user