-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathmain.min.js
3 lines (3 loc) · 1.27 KB
/
main.min.js
1
2
3
d();b.innerHTML+="<style>body{width:600px;margin:0 auto;font-family:Courier}#o{font-size:40px;border:2px solid;width:21rem;display:inline-block}#i{overflow:auto;padding:20px;width:600px;height:350px;border:1px solid}v{color:red}</style><br><br><button onclick=p()>Play</button><br><br><c id=o>.</c><br><br><p contenteditable id=i>Welcome to <a contenteditable=false href=//zethos.Zolmeister.com>Zethos!</a> <br><br>This is a speed reading tool inspired by Spritz ($3.5mil). <br>It's free and open source on <a contenteditable=false href=//github.com/Zolmeister/Zethos>GitHub.</a><br>-<a contenteditable=false href=//Zolmeister.com>Zolmeister";
e=0;h=function(a,c){l=function(a,c){with(a)return 8>length?a:11>length?slice(0,length-3)+"- "+slice(length-3):slice(0,7)+"- "+l(slice(7))};return a.trim().replace(/([.?!])([A-Z-])/g,"$1 $2").split(/\s+/).reduce(function(a,c){with(c){for(j=k=(length-1)/2|0;0<=j;j--)if(/[aeiou]/.test(c[j])){k=j;break}t=120;6<length&&(t+=t/4);~indexOf(",")&&(t+=t/2);/[.?!]/.test(c)&&(t+=1.5*t);return 14<length||7<length-k?a.concat(h(l(c))):a.concat([[c,k,t]])}},[])};p=function(a,c){f=0;(e=!e)&&g()};
g=function(a,c){w=h(i.textContent)[f++]||p();o.innerHTML=Array(8-w[1]).join(" ")+w[0].slice(0,w[1])+"<v>"+w[0][w[1]]+"</v>"+w[0].slice(w[1]+1);e&&setTimeout(g,w[2])};p();