@@ -296,6 +296,22 @@ <h2 data-aos="fade" data-aos-duration="700" data-aos-delay="250">The Blood Pact
296
296
}
297
297
298
298
function correctCorrectableUnits ( ) {
299
+ // Albumin
300
+ const albuminValue = parseFloat ( document . getElementById ( 'albumin' ) . value ) ;
301
+ const albuminUnit = parseFloat ( document . getElementById ( 'albuminUnit' ) . value ) ;
302
+ if ( albuminUnit != 15.0466 && albuminValue > 300 ) {
303
+ console . log ( "Albumin is too high. Correcting the unit." ) ;
304
+ document . getElementById ( 'albuminUnit' ) . value = 15.0466 ;
305
+ }
306
+ else if ( albuminUnit != 0.1 && albuminValue < 6 ) {
307
+ console . log ( "Albumin is too low. Correcting the unit." ) ;
308
+ document . getElementById ( 'albuminUnit' ) . value = 0.1 ;
309
+ }
310
+ else if ( albuminUnit != 1 && albuminValue < 60 ) {
311
+ console . log ( "Albumin is too low. Correcting the unit." ) ;
312
+ document . getElementById ( 'albuminUnit' ) . value = 1 ;
313
+ }
314
+
299
315
// White Blood Cell Count (WBC)
300
316
const wbcValue = parseFloat ( document . getElementById ( 'wbc' ) . value ) ;
301
317
const wbcUnit = parseFloat ( document . getElementById ( 'wbcUnit' ) . value ) ;
@@ -411,10 +427,10 @@ <h2 data-aos="fade" data-aos-duration="700" data-aos-delay="250">The Blood Pact
411
427
// Setting up the animated counter effect
412
428
let displayAge = 0 ;
413
429
resultElement . innerHTML = `
414
- <div style="font-size: 1rem; color: #2c3e50; text-align: center;">Your biological age is:</div>
415
- <div style="font-size: 2.5rem; color: #4CAF50; font-weight: bold; text-align: center;"><span id="animatedAge">0</span></div>
416
- <div id="yearsText" style="font-size: 1rem; color: #2c3e50; text-align: center;">years</div>
417
- ` ;
430
+ <div style="font-size: 1rem; color: #2c3e50; text-align: center;">Your biological age is:</div>
431
+ <div style="font-size: 2.5rem; color: #4CAF50; font-weight: bold; text-align: center;"><span id="animatedAge">0</span></div>
432
+ <div id="yearsText" style="font-size: 1rem; color: #2c3e50; text-align: center;">years</div>
433
+ ` ;
418
434
419
435
if ( isFirstTimeAnimation ) {
420
436
// Set the flag to false after the first run
0 commit comments