WHY WONT IT PARSE THE LAST FUCKING BYTE AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
/* color pallette */
|
||||
* {
|
||||
--white: #f7f8fb;
|
||||
--lgray0: #f5fbfd;
|
||||
--lgray1: #daddd6;
|
||||
--lgray2: #d3d8d5;
|
||||
--mgray1: #687864;
|
||||
--dgreen1: #21341e;
|
||||
--lgreen1: #e5eef2;
|
||||
--black: #003d27;
|
||||
|
||||
--sans: Helvetica, Liberation Sans, FreeSans, Roboto, sans-serif;
|
||||
--mono: Liberation Mono, FreeMono, Roboto Mono, monospace;
|
||||
--fsdef: 12pt;
|
||||
}
|
||||
|
||||
/* body */
|
||||
body {
|
||||
background: var(--white);
|
||||
color: var(--dgray1);
|
||||
font-size: var(--fsdef);
|
||||
font-family: var(--sans);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
|
||||
.content {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
/*
|
||||
background: #ff0;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/* add some top padding to content */
|
||||
|
||||
.content-title {
|
||||
text-align: center;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.content-body {
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
/*
|
||||
background: #f00;
|
||||
*/
|
||||
|
||||
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* element-specific styling */
|
||||
|
||||
a {
|
||||
color: var(--mgray1);
|
||||
}
|
||||
|
||||
|
||||
#wfc-input {
|
||||
font-family: var(--mono);
|
||||
font-size: var(--fsdef);
|
||||
background: var(--lgreen1);
|
||||
|
||||
width: 100%;
|
||||
|
||||
box-sizing: border-box;
|
||||
|
||||
border-radius: 6px;
|
||||
border: 1px solid var(--lgray1);
|
||||
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#wfc-output {
|
||||
background: var(--lgray0);
|
||||
font-family: var(--mono);
|
||||
font-size: var(--fsdef);
|
||||
|
||||
width: 100%;
|
||||
resize: vertical;
|
||||
|
||||
box-sizing: border-box;
|
||||
|
||||
border-radius: 6px;
|
||||
border: 1px solid var(--lgray1);
|
||||
|
||||
padding: 5px;
|
||||
}
|
||||
+107
-5
@@ -1,12 +1,114 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>FEWD Hello!</title>
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
||||
<title>WF Compiler Demo</title>
|
||||
<link rel="stylesheet" href="./default.css">
|
||||
</head>
|
||||
<body>
|
||||
<h1 x-data = "{message: 'Hello, Alpine!'}"
|
||||
x-text = "message"></h1>
|
||||
<div class="content">
|
||||
<h1 class="content-title">WFC Demo</h1>
|
||||
|
||||
<div class="content-body">
|
||||
<textarea id="wfc-output"
|
||||
disabled
|
||||
></textarea>
|
||||
<input autofocus id="wfc-input"></textarea>
|
||||
|
||||
<h2>Settings</h2>
|
||||
<input type="checkbox" checked id="auto-resize-output">Auto-resize output</input> <br>
|
||||
<input type="checkbox" checked id="auto-scroll" >Auto-scroll output to bottom</input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let ielt = document.getElementById('wfc-input');
|
||||
let oelt = document.getElementById('wfc-output');
|
||||
let MAX_OELT_HEIGHT = 100;
|
||||
|
||||
function auto_resize_output() {
|
||||
// if the user has manually resized their output, we do nothing
|
||||
if (document.getElementById('auto-resize-output').checked) {
|
||||
// resize it automagically up to 500px
|
||||
if (oelt.scrollHeight < MAX_OELT_HEIGHT) {
|
||||
oelt.style.height = String(oelt.scrollHeight) + 'px';
|
||||
}
|
||||
else {
|
||||
oelt.style.height = String(MAX_OELT_HEIGHT) + 'px';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function auto_scroll_to_bottom() {
|
||||
if (document.getElementById('auto-scroll').checked) {
|
||||
// scroll to bottom
|
||||
oelt.scrollTop = oelt.scrollHeight;
|
||||
}
|
||||
}
|
||||
|
||||
function on_server_return(x) {
|
||||
console.log('on_server_return:', x);
|
||||
}
|
||||
|
||||
function on_some_bullshit(x) {
|
||||
console.log('on_some_bullshit:', x);
|
||||
}
|
||||
|
||||
function fetch_wfcin(user_line) {
|
||||
let req_body_obj = {wfcin: user_line};
|
||||
// let req_body_str = JSON.stringify(req_body_obj, undefined, 4);
|
||||
let req_body_str = JSON.stringify(req_body_obj);
|
||||
|
||||
let req_options = {method: 'POST',
|
||||
headers: {'content-type': 'application/json'},
|
||||
body: req_body_str};
|
||||
|
||||
let response_promise = fetch('/wfcin', req_options);
|
||||
|
||||
response_promise.then(on_server_return, on_some_bullshit);
|
||||
|
||||
// this is a promise for a response
|
||||
//console.log(response_promise);
|
||||
}
|
||||
|
||||
// when user hits any key
|
||||
function on_input_key(evt) {
|
||||
if (evt.key === 'Enter') {
|
||||
// don't do default thing
|
||||
evt.preventDefault();
|
||||
// grab contents
|
||||
let contents = ielt.value;
|
||||
// if contents are nonempty
|
||||
let nonempty_contents = contents.trim().length > 0;
|
||||
if (nonempty_contents) {
|
||||
// put in output
|
||||
// if it's nonempty add a newline
|
||||
if (oelt.value.length > 0) {
|
||||
oelt.value += '\n';
|
||||
}
|
||||
oelt.value += '> ' + contents;
|
||||
oelt.hidden = false;
|
||||
|
||||
// query backend for result
|
||||
fetch_wfcin(contents.trim());
|
||||
|
||||
// clear input
|
||||
ielt.value = '';
|
||||
|
||||
// auto-resize
|
||||
auto_resize_output();
|
||||
auto_scroll_to_bottom();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function main() {
|
||||
ielt.addEventListener('keydown', on_input_key);
|
||||
}
|
||||
|
||||
main();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/* header */
|
||||
div#header {
|
||||
background: var(--lgray2);
|
||||
height: 50px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
img#header-logo {
|
||||
height: 40px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 5px;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
|
||||
.main {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.content-diagram {
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
padding: 0 auto;
|
||||
}
|
||||
|
||||
|
||||
/* Pandoc makes some wacky choices with how it lays out code blocks
|
||||
*
|
||||
* this means all <code> blocks that do not have a <pre> block as an ancestor
|
||||
*
|
||||
* ie the `inline code`
|
||||
*/
|
||||
code:not(pre *) {
|
||||
border-radius: 6px;
|
||||
border: 1px solid var(--lgray1);
|
||||
padding-left: 3px;
|
||||
padding-right: 3px;
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
background: var(--lgreen1);
|
||||
}
|
||||
|
||||
/* this is specifically for ```fenced blocks``` */
|
||||
pre {
|
||||
border-radius: 6px;
|
||||
border: 1px solid var(--lgray1);
|
||||
padding: 5px;
|
||||
background: var(--lgreen1);
|
||||
overflow: scroll;
|
||||
}
|
||||
|
||||
/* All `unfenced` or ```fenced``` blocks */
|
||||
code {
|
||||
font-family: Liberation Mono, Roboto Mono, monospace;
|
||||
color: var(--dgreen1);
|
||||
}
|
||||
Reference in New Issue
Block a user