made url not contain part id when part view closed

This commit is contained in:
2022-11-30 12:52:46 +01:00
parent b698ec446f
commit 51022e79bd
2 changed files with 15 additions and 5 deletions
+13 -3
View File
@@ -215,8 +215,19 @@ function show_part_info(partID) {
});
// update URL and history
update_url(partID);
}
function update_url(partID){
params = {}
var query = $('.search-bar').val();
window.history.pushState('searching', '', 'parts?q=' + query + '&p=' + partID)
if(len(query)>0){
params['q'] = query
}
if(partID != 0){
params['p'] = partID
}
window.history.pushState('searching', '', 'parts?' + jQuery.param(params));
}
function perform_query() {
@@ -250,8 +261,7 @@ function perform_query() {
console.log( "Query failed" );
});
// update URL and history
window.history.pushState('searching', '', 'parts?q=' + query)
update_url(0);
}
function container_onchange() {