Josh Bruce Online

Eyesaver - 20-20-20 Rule Health Timer Documentation

Overview

“Eyesaver” is a health-focused web application that implements the 20-20-20 rule for eye strain prevention. This evidence-based technique helps users protect their vision during extended screen time by providing automated reminders to look at least 20 feet (6 meters) away for 20 seconds every 20 minutes. The application features a professional medical design with precise timing, audio alerts, and color-coded visual cues.

Technical Architecture

Core Technologies

File Structure

eyesaver/
├── index.html    # Complete 20-20-20 rule timer application
└── chime.mp3     # Audio notification file (referenced but not analyzed)

Medical Foundation and 20-20-20 Rule

Scientific Basis

The 20-20-20 rule is an evidence-based approach to reducing digital eye strain (Computer Vision Syndrome):

Health Benefits

  1. Reduced Eye Strain: Prevents accommodation fatigue
  2. Dry Eye Prevention: Encourages natural blinking
  3. Focus Flexibility: Exercises distance vision
  4. Headache Prevention: Reduces tension headaches
  5. Long-term Vision Health: Potentially prevents myopia progression

Timer System Architecture

Dual-Phase Timer Implementation

function startMainTimer() {
    let mainTimer = 20 * 60;                    // 20 minutes = 1200 seconds
    
    const mainInterval = setInterval(() => {
        let minutes = Math.floor(mainTimer / 60);
        let seconds = mainTimer % 60;
        
        // Display formatted time
        mainTimerElement.textContent = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
        
        if (mainTimer === 0) {
            clearInterval(mainInterval);
            
            // Transition to break phase
            mainTimerElement.classList.add('hidden');
            lookAwayTextElement.classList.remove('hidden');
            lookAwayTimerElement.classList.remove('hidden');
            playChimeSound();                   // Audio notification
            
            startLookAwayTimer();               // Begin 25-second break
        }
        
        mainTimer--;
    }, 1000);
}

Break Phase Timer with Extended Duration

let lookAwayTimer = 25;                         // 25 seconds (20 + 5 buffer)

const lookAwayInterval = setInterval(() => {
    // Color coding for break phases
    if (lookAwayTimer > 20) {
        lookAwayTimerElement.classList.add('red');     // Red: 25-20 seconds
    } else {
        lookAwayTimerElement.classList.remove('red');
        lookAwayTimerElement.classList.add('green');   // Green: 20-0 seconds
    }
    
    lookAwayTimerElement.textContent = `00:${lookAwayTimer.toString().padStart(2, '0')}`;
    
    if (lookAwayTimer === 0) {
        clearInterval(lookAwayInterval);
        // Return to main timer phase
        lookAwayTextElement.classList.add('hidden');
        lookAwayTimerElement.classList.add('hidden');
        startMainTimer();                       // Automatic restart
        mainTimerElement.classList.remove('hidden');
    }
    
    lookAwayTimer--;
}, 1000);

Visual Design System

Medical-Grade Color Scheme

body {
    background-color: #091C25;                  /* Dark teal - eye-friendly background */
}

.timer {
    color: #F9744D;                             /* Warm orange - default state */
}

/* Color transitions for break timer */
.timer.red {
    color: #DB4437;                             /* Google Red - preparation phase */
}

.timer.green {
    color: #0F9D58;                             /* Google Green - active break phase */
}

Typography and Readability

.timer {
    font-family: "Helvetica", sans-serif;      /* Clean, medical-standard font */
    font-weight: bold;
    font-size: 200px;                          /* Large, easily readable numbers */
    margin-bottom: 20px;
}

#look-away-text {
    font-family: "Helvetica", sans-serif;
    font-weight: bold;
    font-size: 72px;                           /* Prominent instruction text */
    color: #F9744D;
}

Centered Layout Design

body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

.container {
    text-align: center;                         /* Centered content alignment */
}

Audio Notification System

HTML5 Audio Integration

<audio id="chime-audio">
    <source src="chime.mp3" type="audio/mpeg">
    Your browser does not support the audio element.
</audio>
function playChimeSound() {
    const chimeAudio = document.getElementById('chime-audio');
    chimeAudio.play();                          // Immediate audio notification
}

Audio Features

User Interface State Management

Phase Transition System

// Hide/show elements based on timer phase
mainTimerElement.classList.add('hidden');              // Hide main timer
lookAwayTextElement.classList.remove('hidden');        // Show instruction
lookAwayTimerElement.classList.remove('hidden');       // Show break timer

// Color synchronization
lookAwayTextElement.style.color = mainTimerElement.style.color;

CSS State Classes

.hidden {
    display: none;                              /* Complete element hiding */
}

.timer.red {
    color: #DB4437;                             /* Conditional color application */
}

.timer.green {
    color: #0F9D58;                             /* Progressive color states */
}

Time Formatting and Display

Precise Time Display

// Main timer: MM:SS format
let minutes = Math.floor(mainTimer / 60);
let seconds = mainTimer % 60;
mainTimerElement.textContent = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;

// Break timer: 00:SS format
lookAwayTimerElement.textContent = `00:${lookAwayTimer.toString().padStart(2, '0')}`;

Formatting Features

Automatic Cycle Management

Continuous Operation Loop

if (lookAwayTimer === 0) {
    clearInterval(lookAwayInterval);
    lookAwayTextElement.classList.add('hidden');
    lookAwayTimerElement.classList.add('hidden');
    startMainTimer();                           // Automatic restart
    mainTimerElement.classList.remove('hidden');
}

Cycle Characteristics

Health and Ergonomics Integration

Eye Strain Prevention Features

  1. Precise Timing: Medically recommended intervals
  2. Clear Instructions: Explicit distance guidance (“<20 meters away”)
  3. Audio Alerts: Non-visual notification system
  4. Color Psychology: Red (alert) to green (action) progression
  5. High Contrast: Readable in various lighting conditions

Workplace Integration

Browser Compatibility and Performance

Cross-Browser Support

Performance Characteristics

Accessibility and Usability

Visual Accessibility

Functional Accessibility

Enhanced Break Timer Design

Extended 25-Second Break

The application implements a 25-second break instead of the standard 20 seconds:

Color Psychology Implementation

if (lookAwayTimer > 20) {
    lookAwayTimerElement.classList.add('red');     // Preparation phase
} else {
    lookAwayTimerElement.classList.remove('red');
    lookAwayTimerElement.classList.add('green');   // Active break phase
}

Future Enhancement Opportunities

Health Features

  1. Blink Reminders: Additional dry eye prevention
  2. Posture Alerts: Neck and shoulder stretch prompts
  3. Brightness Adjustment: Automatic screen dimming during breaks
  4. Usage Statistics: Track break compliance and patterns
  5. Customizable Intervals: Adjust timing based on individual needs

Technical Improvements

  1. Progressive Web App: Offline functionality and notifications
  2. Background Operation: Continue timing when tab inactive
  3. Multiple Timer Profiles: Different rules for different activities
  4. Integration APIs: Connect with productivity or health apps
  5. Analytics: Track usage patterns and effectiveness

User Experience Enhancements

  1. Theme Options: Multiple color schemes for different environments
  2. Sound Library: Various notification sounds and volumes
  3. Break Activities: Guided eye exercises or relaxation prompts
  4. Pause Functionality: Temporary timer suspension
  5. Settings Panel: Customizable timer intervals and preferences

Medical Evidence and Validation

Research Foundation

Implementation Accuracy

Code Quality Assessment

Strengths

Areas for Enhancement

Conclusion

Eyesaver represents an exemplary implementation of evidence-based health technology, successfully translating medical recommendations into an effective, user-friendly application. The precise timer system, professional visual design, and comprehensive notification features create an ideal tool for digital eye strain prevention.

Technical Rating: 8.7/10

The application successfully serves as both a practical health tool and a model for implementing medical guidelines in web technology, demonstrating how simple applications can have significant positive health impacts.