From b363329ab8c0b4186ba66a848f38c3691d1fc433 Mon Sep 17 00:00:00 2001 From: Kumar-laxmi Date: Wed, 28 Feb 2024 13:49:12 +0530 Subject: [PATCH] Completed Range Input and P-tag id synchronisation --- .../elements/Scripts/volumeRangeControl.html | 151 +++++++++--------- db.sqlite3 | Bin 262144 -> 262144 bytes 2 files changed, 74 insertions(+), 77 deletions(-) diff --git a/app/templates/elements/Scripts/volumeRangeControl.html b/app/templates/elements/Scripts/volumeRangeControl.html index c657a66c..5492d703 100644 --- a/app/templates/elements/Scripts/volumeRangeControl.html +++ b/app/templates/elements/Scripts/volumeRangeControl.html @@ -77,108 +77,105 @@ const erbRangeID = ["normal_heart_sound_erbs_point_range","split_first_heart_sound_erbs_point_range","split_second_heart_sound_erbs_point_range","third_heart_sound_erbs_point_range","fourth_heart_sound_erbs_point_range","functional_murmur_sound_erbs_point_range","diastolic_murmur_sound_erbs_point_range","opening_snap_sound_erbs_point_range","holosystolic_murmur_sound_erbs_point_range","early_systolic_murmur_sound_erbs_point_range","mid_systolic_murmur_sound_erbs_point_range","continuous_murmur_sound_erbs_point_range","austin_flint_murmur_sound_erbs_point_range","pericardial_rub_sound_erbs_point_range","graham_steell_murmur_sound_erbs_point_range","aortic_valve_regurgitation_sound_erbs_point_range","aortic_valve_stenosis_sound_erbs_point_range","aortic_valve_stenosis_regurgitation_sound_erbs_point_range","congenital_aortic_stenosis_sound_erbs_point_range","mitral_valve_regurgitation_sound_erbs_point_range","mitral_valve_stenosis_sound_erbs_point_range","mitral_valve_prelapse_sound_erbs_point_range","mitral_stenosis_regurgitation_sound_erbs_point_range","mitral_stenosis_tricuspid_regurgitation_sound_erbs_point_range","pulmonary_valve_stenosis_sound_erbs_point_range","pulmonary_valve_regurgitation_sound_erbs_point_range","tricuspid_valve_regurgitation_sound_erbs_point_range","coarctation_of_the_aorta_sound_erbs_point_range","hypertrophic_cardiomyopathy_sound_erbs_point_range","patent_ductus_arteriosus_sound_erbs_point_range","atrial_septal_defect_sound_erbs_point_range","ventricular_septal_defect_sound_erbs_point_range","acute_myocardial_infarction_sound_erbs_point_range","congestive_heart_failure_sound_erbs_point_range","systemic_hypertension_sound_erbs_point_range","acute_pericarditis_sound_erbs_point_range","dilated_cardiomyopathy_sound_erbs_point_range","pulmonary_hypertension_sound_erbs_point_range","tetralogy_of_fallot_sound_erbs_point_range","ventricular_aneurysm_sound_erbs_point_range","ebstein_anomaly_sound_erbs_point_range"]; // Javascript Ranges - const mitralRanges = mitralRangeID.map(id => document.getElementById(id)); - const aorticRanges = aorticRangeID.map(id => document.getElementById(id)); - const pulmonaryRanges = pulmonaryRangeID.map(id => document.getElementById(id)); - const tricuspidRanges = tricuspidRangeID.map(id => document.getElementById(id)); - const erbRanges = erbRangeID.map(id => document.getElementById(id)); - - // Range Input Synchronizer - Mitral Valve - mitralRanges.forEach(range => { - range.addEventListener('input', () => { - const value = range.value; - mitralRanges.forEach(otherRange => { - if (otherRange !== range) { - otherRange.value = value; + const mitralRangeID_value = mitralRangeID.map(id => id + '_value'); + const aorticRangeID_value = aorticRangeID.map(id => id + '_value'); + const pulmonaryRangeID_value = pulmonaryRangeID.map(id => id + '_value'); + const tricuspidRangeID_value = tricuspidRangeID.map(id => id + '_value'); + const erbRangeID_value = erbRangeID.map(id => id + '_value'); + + // Range input and p tag Synchronization - Mitral Valve + mitralRangeID.forEach((id,index) => { + const rangeInput = document.getElementById(id); + const valueParagraph = document.getElementById(mitralRangeID_value[index]); + + rangeInput.addEventListener('input', () => { + const value = rangeInput.value; + valueParagraph.textContent = value + '%'; + + // Sync values among range inputs + mitralRangeID.forEach((otherId,otherIndex) => { + if (otherIndex !== index) { + document.getElementById(mitralRangeID_value[otherIndex]).textContent = value + '%'; + document.getElementById(otherId).value = value; } }); }); }); - // Range Input Synchronizer - Aortic Valve - aorticRanges.forEach(range => { - range.addEventListener('input', () => { - const value = range.value; - aorticRanges.forEach(otherRange => { - if (otherRange !== range) { - otherRange.value = value; - } - }); - }); - }); + // Range input and p tag Synchronization - Aortic Valve + aorticRangeID.forEach((id,index) => { + const rangeInput = document.getElementById(id); + const valueParagraph = document.getElementById(aorticRangeID_value[index]); - // Range Input Synchronizer - Pulmonary Valve - pulmonaryRanges.forEach(range => { - range.addEventListener('input', () => { - const value = range.value; - pulmonaryRanges.forEach(otherRange => { - if (otherRange !== range) { - otherRange.value = value; - } - }); - }); - }); + rangeInput.addEventListener('input', () => { + const value = rangeInput.value; + valueParagraph.textContent = value + '%'; - // Range Input Synchronizer - Tricuspid Valve - tricuspidRanges.forEach(range => { - range.addEventListener('input', () => { - const value = range.value; - tricuspidRanges.forEach(otherRange => { - if (otherRange !== range) { - otherRange.value = value; + // Sync values among range inputs + aorticRangeID.forEach((otherId,otherIndex) => { + if (otherIndex !== index) { + document.getElementById(aorticRangeID_value[otherIndex]).textContent = value + '%'; + document.getElementById(otherId).value = value; } }); }); }); - - // Range Input Synchronizer - Erb Point - erbRanges.forEach(range => { - range.addEventListener('input', () => { - const value = range.value; - erbRanges.forEach(otherRange => { - if (otherRange !== range) { - otherRange.value = value; + + // Range input and p tag Synchronization - Pulmonary Valve + pulmonaryRangeID.forEach((id,index) => { + const rangeInput = document.getElementById(id); + const valueParagraph = document.getElementById(pulmonaryRangeID_value[index]); + + rangeInput.addEventListener('input', () => { + const value = rangeInput.value; + valueParagraph.textContent = value + '%'; + + // Sync values among range inputs + pulmonaryRangeID.forEach((otherId,otherIndex) => { + if (otherIndex !== index) { + document.getElementById(pulmonaryRangeID_value[otherIndex]).textContent = value + '%'; + document.getElementById(otherId).value = value; } }); }); }); - heartSounds.forEach(sound => { - Object.keys(valveNames).forEach(valve => { - const rangeInput = document.getElementById(sound + '_' + valve + '_range'); - const outputText = document.getElementById(sound + '_' + valve + '_range_value'); + // Range input and p tag Synchronization - Tricuspid Valve + tricuspidRangeID.forEach((id,index) => { + const rangeInput = document.getElementById(id); + const valueParagraph = document.getElementById(tricuspidRangeID_value[index]); - outputText.textContent = '0%'; + rangeInput.addEventListener('input', () => { + const value = rangeInput.value; + valueParagraph.textContent = value + '%'; - rangeInput.addEventListener('input', function() { - outputText.textContent = rangeInput.value + '%'; - }); - }); - }); - - lungFrontSounds.forEach(sound => { - Object.keys(lobeNamesFront).forEach(valve => { - const rangeInput = document.getElementById(sound + '_' + valve + '_range'); - const outputText = document.getElementById(sound + '_' + valve + '_range_value'); - - outputText.textContent = '0%'; - - rangeInput.addEventListener('input', function() { - outputText.textContent = rangeInput.value + '%'; + // Sync values among range inputs + tricuspidRangeID.forEach((otherId,otherIndex) => { + if (otherIndex !== index) { + document.getElementById(tricuspidRangeID_value[otherIndex]).textContent = value + '%'; + document.getElementById(otherId).value = value; + } }); }); }); - lungBackSounds.forEach(sound => { - Object.keys(lobeNamesBack).forEach(valve => { - const rangeInput = document.getElementById(sound + '_' + valve + '_range'); - const outputText = document.getElementById(sound + '_' + valve + '_range_value'); + // Range input and p tag Synchronization - Erb's Valve + erbRangeID.forEach((id,index) => { + const rangeInput = document.getElementById(id); + const valueParagraph = document.getElementById(erbRangeID_value[index]); - outputText.textContent = '0%'; + rangeInput.addEventListener('input', () => { + const value = rangeInput.value; + valueParagraph.textContent = value + '%'; - rangeInput.addEventListener('input', function() { - outputText.textContent = rangeInput.value + '%'; + // Sync values among range inputs + erbRangeID.forEach((otherId,otherIndex) => { + if (otherIndex !== index) { + document.getElementById(erbRangeID_value[otherIndex]).textContent = value + '%'; + document.getElementById(otherId).value = value; + } }); }); }); + \ No newline at end of file diff --git a/db.sqlite3 b/db.sqlite3 index 061822067aed9b9799cce411c3061b112fc14d05..1d6e91ee20b0d3e7fcafb2c8d5d4d0d547fb79f6 100644 GIT binary patch delta 122 zcmZo@5NK!+m>|s(|*EF|0j delta 122 zcmZo@5NK!+m>|u_Hc`fzk!@o__)04W+XcR