From 3f2c43aeb1f7ee6581db2327ae64c9e05d12d917 Mon Sep 17 00:00:00 2001 From: Frank Knoll Date: Sun, 14 Jul 2024 01:11:04 +0200 Subject: [PATCH] setting searchParams when selecting symptom or vaccine --- docs/SymptomsCausedByDrugs/index.html | 1 - docs/SymptomsCausedByDrugs/js/PageInitializer.js | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/SymptomsCausedByDrugs/index.html b/docs/SymptomsCausedByDrugs/index.html index e9465e25ac2..adbef9bff16 100644 --- a/docs/SymptomsCausedByDrugs/index.html +++ b/docs/SymptomsCausedByDrugs/index.html @@ -14324,7 +14324,6 @@ var a2a_config = a2a_config || {}; a2a_config.callbacks = a2a_config.callbacks || []; a2a_config.callbacks.push({ - // FK-TODO: use selected symptom and vaccine for url share: _ => ({ url: window.location.href }), }); diff --git a/docs/SymptomsCausedByDrugs/js/PageInitializer.js b/docs/SymptomsCausedByDrugs/js/PageInitializer.js index 63defaa2597..033e486ae19 100644 --- a/docs/SymptomsCausedByDrugs/js/PageInitializer.js +++ b/docs/SymptomsCausedByDrugs/js/PageInitializer.js @@ -11,7 +11,12 @@ class PageInitializer { { selectElement: symptomSelectElement, textOfOption2Select: selectSymptom, - onValueSelected: (id, text) => prrByVaccineTableView.displayPrrByVaccineTable4Symptom(id, text), + onValueSelected: (id, text) => { + prrByVaccineTableView.displayPrrByVaccineTable4Symptom(id, text); + const url = new URL(window.location.href); + url.searchParams.set('symptom', text); + window.history.replaceState(null, "", url); + }, minimumInputLength: 0 }); } @@ -22,7 +27,12 @@ class PageInitializer { { selectElement: vaccineSelectElement, textOfOption2Select: selectVaccine, - onValueSelected: (id, text) => prrBySymptomTableView.displayPrrBySymptomTable4Vaccine(id, text), + onValueSelected: (id, text) => { + prrBySymptomTableView.displayPrrBySymptomTable4Vaccine(id, text); + const url = new URL(window.location.href); + url.searchParams.set('vaccine', text); + window.history.replaceState(null, "", url); + }, minimumInputLength: 0 }); }