refactoring
This commit is contained in:
@@ -35,26 +35,29 @@
|
|||||||
<script src="./js/PrrByKeyTableView.js"></script>
|
<script src="./js/PrrByKeyTableView.js"></script>
|
||||||
<script src="./js/PrrByVaccineTableView.js"></script>
|
<script src="./js/PrrByVaccineTableView.js"></script>
|
||||||
<script src="./js/PrrBySymptomTableView.js"></script>
|
<script src="./js/PrrBySymptomTableView.js"></script>
|
||||||
|
<script src="./js/SearchParam.js"></script>
|
||||||
<script src="./js/Select2.js"></script>
|
<script src="./js/Select2.js"></script>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener(
|
document.addEventListener(
|
||||||
"DOMContentLoaded",
|
"DOMContentLoaded",
|
||||||
event => {
|
event => {
|
||||||
const name = 'Drug';
|
const name = 'Drug';
|
||||||
|
const symptomSearchParam = new SearchParam('symptom');
|
||||||
|
const vaccineSearchParam = new SearchParam('vaccine');
|
||||||
PageInitializer.initializePage(
|
PageInitializer.initializePage(
|
||||||
{
|
{
|
||||||
symptom: {
|
symptom: {
|
||||||
symptomSelectElement: $('#symptomSelect'),
|
symptomSelectElement: $('#symptomSelect'),
|
||||||
selectSymptom: UIUtils.getSearchParamOfCurrentUrl('symptom'),
|
selectSymptom: symptomSearchParam.get(),
|
||||||
onSymptomSelected: symptom => UIUtils.setSearchParamOfCurrentUrl('symptom', symptom),
|
onSymptomSelected: symptom => symptomSearchParam.set(symptom),
|
||||||
prrByVaccineTableElement: $('#prrByVaccineTable'),
|
prrByVaccineTableElement: $('#prrByVaccineTable'),
|
||||||
downloadPrrByVaccineTableButton: document.querySelector("#downloadPrrByVaccineTable"),
|
downloadPrrByVaccineTableButton: document.querySelector("#downloadPrrByVaccineTable"),
|
||||||
keyColumnName: name
|
keyColumnName: name
|
||||||
},
|
},
|
||||||
vaccine: {
|
vaccine: {
|
||||||
vaccineSelectElement: $('#vaccineSelect'),
|
vaccineSelectElement: $('#vaccineSelect'),
|
||||||
selectVaccine: UIUtils.getSearchParamOfCurrentUrl('vaccine'),
|
selectVaccine: vaccineSearchParam.get(),
|
||||||
onVaccineSelected: vaccine => UIUtils.setSearchParamOfCurrentUrl('vaccine', vaccine),
|
onVaccineSelected: vaccine => vaccineSearchParam.set(vaccine),
|
||||||
prrBySymptomTableElement: $('#prrBySymptomTable'),
|
prrBySymptomTableElement: $('#prrBySymptomTable'),
|
||||||
downloadPrrBySymptomTableButton: document.querySelector("#downloadPrrBySymptomTable"),
|
downloadPrrBySymptomTableButton: document.querySelector("#downloadPrrBySymptomTable"),
|
||||||
valueName: name
|
valueName: name
|
||||||
|
|||||||
16
docs/SymptomsCausedByDrugs/js/SearchParam.js
Normal file
16
docs/SymptomsCausedByDrugs/js/SearchParam.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
class SearchParam {
|
||||||
|
|
||||||
|
#name;
|
||||||
|
|
||||||
|
constructor(name) {
|
||||||
|
this.#name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
get() {
|
||||||
|
return UIUtils.getSearchParamOfCurrentUrl(this.#name);
|
||||||
|
}
|
||||||
|
|
||||||
|
set(value) {
|
||||||
|
UIUtils.setSearchParamOfCurrentUrl(this.#name, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user