From 3754174c7d448be8e5985c9421a86a4d437cea8a Mon Sep 17 00:00:00 2001 From: Marek Baczynski Date: Mon, 28 Nov 2022 20:23:43 +0100 Subject: [PATCH] URL is now shareable --- parts/static/script.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/parts/static/script.js b/parts/static/script.js index b2141e7..d3a25be 100644 --- a/parts/static/script.js +++ b/parts/static/script.js @@ -213,6 +213,9 @@ function show_part_info(partID) { }).fail(function() { console.log( "Fetching part info failed" ); }); + // update URL and history + var query = $('.search-bar').val(); + window.history.pushState('searching', '', 'parts?q=' + query + '&p=' + partID) } function perform_query() { @@ -245,6 +248,9 @@ function perform_query() { $('#no-results').animate({opacity:1},2000); console.log( "Query failed" ); }); + + // update URL and history + window.history.pushState('searching', '', 'parts?q=' + query) } function container_onchange() {