“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.
eyesaver/
├── index.html # Complete 20-20-20 rule timer application
└── chime.mp3 # Audio notification file (referenced but not analyzed)
The 20-20-20 rule is an evidence-based approach to reducing digital eye strain (Computer Vision Syndrome):
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);
}
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);
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 */
}
.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;
}
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.container {
text-align: center; /* Centered content alignment */
}
<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
}
// 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;
.hidden {
display: none; /* Complete element hiding */
}
.timer.red {
color: #DB4437; /* Conditional color application */
}
.timer.green {
color: #0F9D58; /* Progressive color states */
}
// 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')}`;
if (lookAwayTimer === 0) {
clearInterval(lookAwayInterval);
lookAwayTextElement.classList.add('hidden');
lookAwayTimerElement.classList.add('hidden');
startMainTimer(); // Automatic restart
mainTimerElement.classList.remove('hidden');
}
The application implements a 25-second break instead of the standard 20 seconds:
if (lookAwayTimer > 20) {
lookAwayTimerElement.classList.add('red'); // Preparation phase
} else {
lookAwayTimerElement.classList.remove('red');
lookAwayTimerElement.classList.add('green'); // Active break phase
}
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.