Click on the text above to start typing
@@ -92,46 +98,62 @@ function render(pos){
html+=`
${text[i]}`;
} else if(i===pos){
html+=`
${text[i]}`;
} else {
html+=`
${text[i]}`;
}
}
document.getElementById('passage').innerHTML=html;
}
function focusInput(){
document.getElementById('type-input').focus();
if(!started&&!finished){document.getElementById('click-prompt').textContent='';}
}
document.getElementById('type-input').addEventListener('input',function(){
if(finished)return;
if(!started){
started=true; startTime=Date.now();
timer=setInterval(tick,1000);
}
const val=this.value;
typed=val.length;
let errs=0;
for(let i=0;i
0?Math.round((typed/5)/elapsed):0;
const acc=typed>0?Math.round(((typed-errors)/typed)*100):100;
const wpmRaw=elapsed>0?Math.round((typed/5)/elapsed):0;
const accRaw=typed>0?Math.round(((typed-errors)/typed)*100):100;
const wpm=Math.max(0,wpmRaw);
const acc=Math.max(0,Math.min(100,accRaw));
document.getElementById('s-wpm').textContent=wpm;
document.getElementById('s-acc').textContent=acc+'%';
document.getElementById('s-chars').textContent=typed;
render(typed);
if(typed>=text.length) endTest();
});
function tick(){
timeLeft--;
document.getElementById('s-time').textContent=timeLeft+'s';
if(timeLeft<=0) endTest();
}
function endTest(){
clearInterval(timer); finished=true;
document.getElementById('type-input').blur();
document.getElementById('click-prompt').textContent='Test complete! Click "New test" to try again.';
}
reset();
Typing test tips
- Focus on accuracy first, then increase speed.
- Keep wrists neutral and avoid looking at the keyboard.
- Use New test to practice different difficulty levels.