Skip to content

Commit

Permalink
Completed Range Input and P-tag id synchronisation
Browse files Browse the repository at this point in the history
  • Loading branch information
Kumar-laxmi committed Feb 28, 2024
1 parent 5a68aae commit b363329
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 77 deletions.
151 changes: 74 additions & 77 deletions app/templates/elements/Scripts/volumeRangeControl.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
});
});
});

</script>
Binary file modified db.sqlite3
Binary file not shown.

0 comments on commit b363329

Please sign in to comment.