-
Notifications
You must be signed in to change notification settings - Fork 0
/
HTMLPAGE.h
7 lines (4 loc) · 1.75 KB
/
HTMLPAGE.h
1
2
3
4
5
6
7
/*
NOTE: don't edit manually, this is generated by build.sh
*/
const char* HTMLPAGE="<!DOCTYPE html><html><head><meta charset=\"utf-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=1.0, minimum-scale=1.0, maximum-scale=1.0\"></head><body><div><p><b>ChatterBox</b></p></div><noscript><p>Sorry, you'll need javascript to submit a post... but here's what people have been saying:</p><iframe sandbox src=\"./posts\"></iframe></noscript><div id=\"l\"></div><div id=\"f\"><textarea type=\"text\" id=\"t\"></textarea><button id=\"s\">Post</button></div><script type=\"text/javascript\">var log=console.error;var $=i=>document.getElementById(i);var ready=true;g=()=>{/*get new messages*/if(!ready){return;}fetch('./posts').then(r=>r.text()).then((t)=>{$('l').innerHTML=t.split('\\u001e').map(s=>s.replace(/</g,'<')).map(s=>s.replace(/>/g,'>')).map(s=>s.replace(/\\n/g,'<br>')).map(s=>'<p>'+s+'</p>').join('');ready=true;}).catch((e)=>{log(e);ready=true;});};g();setInterval(g,1000);$('s').addEventListener('click',e=>{fetch('./post',{method:'POST',body:$('t').value}).then(r=>{$('t').value='';g();}).catch(e=>{log(e);g();})});</script><style type=\"text/css\">div{width:100%;display:block;}#f{display:flex;align-items:stretch;height:50px;}p{border-bottom:solid 1px rgba(0,0,0,0.1);padding:1em;margin:0;word-wrap:break-word;}textarea{flex:1 0 auto;padding:0;line-height:50px;}html,body{width:100%;min-height:100%;margin:0;padding:0;font-size:20px;font-family:-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";}body{display:flex;flex-direction:column;}textarea,button{font-size:20px;height:50px;}button{padding:0 1em;}</style></body></html>";