-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
1 lines (1 loc) · 2.17 KB
/
index.html
1
<!doctype html><link rel=icon href=data:,><meta charset=utf-8><title>Keyboard-Tutor</title><script>!function(){var e,t,n,a,i="QAZWSXEDCRFVTGB",o=0,c=!1,r=!1;const s=()=>{e=void 0,results_set=!1,o=0,f(t,""),f(n,text.charAt(0)),f(a,text.substring(1))},d=document,l=d.getElementById.bind(d),u=d.addEventListener.bind(d),k=e=>e.innerHTML,f=(e,t)=>{e.innerHTML=t};u("DOMContentLoaded",function(e){t=l("c"),n=l("d"),a=l("e"),l("h").addEventListener("click",function(e){var t=e.target;switch(k(t)){case"QWERTY":i="AOEUIQJKXYP",f(t,"Dvorak");break;case"Dvorak":i="QAZWRXFSCPTVGDB",f(t,"Colemak");break;default:i="QAZWSXEDCRFVTGB",f(t,"QWERTY")}}),text="REPLACEME",s()}),u("keyup",function(e){16===e.keyCode&&(c=1===!e.location,r=2===!e.location)}),u("keydown",function(d){var u="",v=d.keyCode;switch(v){case 32:d.preventDefault(),u=" ";break;case 191:case 222:d.preventDefault();break;case 16:return c=1===d.location,void(r=2===d.location);case 8:f(a,k(n)+k(a)),f(n,k(t).slice(-1)),f(t,k(t).slice(0,-1));break;default:v<91&&(u=String.fromCharCode(v),u=r&&c?"":r?i.includes(u)?u:"":c?i.includes(u)?"":u:u.toLowerCase())}if(u==k(n)?(e||(e=(new Date).getTime()),f(t,k(t)+u),f(n,k(a).charAt(0)),f(a,k(a).substr(1))):o++,0==k(a).length&&0==k(n).length){var C=50/(((new Date).getTime()-e)/6e4);f(l("f"),`WPM:${C.toFixed(2)};Words:50; Mistakes:${o}`),(async()=>{let e=await fetch(`${window.location.origin}/moretext`);text=await e.text(),s()})()}})}();</script><style>#a{width:75vw;padding:1vh;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-family:courier new,Courier,monospace}#b{font-size:0;display:inline;white-space:nowrap}#c,#d,#e{font-size:4vh;white-space:pre-wrap}#c{color:gray}#d{color:red;text-decoration:underline}#g{font-size:5vh}#h{color:green}#h:hover{cursor:pointer}</style><div id=a><div id=b><span id=c></span><span id=d></span><span id=e></span></div><h3 id=g><span id=f>WPM:TBD; Words:TBD; Mistakes:TBD;</span> Layout: <span id=h>QWERTY</span></h3><p><i>This keyboard tutor teaches you to use both the left and the right shift keys. Left hand letters can only be capitalized with the right shift and vice versa. Check out the source code on <a href=https://git.io/JYUvs>Github</a>.</i></div>