Kyle 2 months ago
parent
commit
3044adc74f
2 changed files with 42 additions and 1 deletions
  1. 36 0
      index.html
  2. 6 1
      main.js

+ 36 - 0
index.html

@@ -9,6 +9,42 @@
9 9
         <div style="margin: auto; display: flex; height: 500px; box-shadow: 0 0 10px #ddd;">
10 10
             <div id="editor" autofocus class="input" style="resize: none; min-width: 300px; box-sizing: border-box; -moz-box-sizing: border-box; margin: 0;"></div>
11 11
             <div class="results" style="overflow-y: auto; min-width: 300px; box-sizing: border-box; background-color: #f4f4f4; padding: 0 5px; white-space: pre; font-family: monospace;">
12
+            </div>
13
+            <div class="help" style="overflow-y: auto; width: 300px; box-sizing: border-box; background-color: #fff3ee; color: black; padding: 5px; white-space: pre; font-family: monospace; transition: width .4s ease, padding .4s ease; overflow: hidden;"><button class="hide-help"><<</button>
14
+
15
+# Cheatsheet
16
+
17
+## Write expressions and queries
18
+
19
+a = b * 2
20
+
21
+? b
22
+>> b = a / 2
23
+
24
+-----------
25
+
26
+a = b * 2
27
+a = 10
28
+
29
+? b
30
+>> b = 5
31
+
32
+## Syntax
33
+
34
+This is a basic prototype, so not
35
+everything is supported yet
36
+
37
+Only + - * / operations are supported
38
+
39
+Must use spaces between terms
40
+
41
+Parenthesis are not yet supported
42
+
43
+Expressions with multiple occurances
44
+of the same variable may not
45
+solve correctly
46
+
47
+
12 48
             </div>
13 49
         </div>
14 50
     </body>

+ 6 - 1
main.js

@@ -162,7 +162,6 @@ function tryOpSplit(pieces, op) {
162 162
 }
163 163
 
164 164
 window.onload = function () {
165
-  const input = document.querySelector('.input');
166 165
   const results = document.querySelector('.results');
167 166
 
168 167
   var editor = ace.edit("editor");
@@ -186,6 +185,12 @@ window.onload = function () {
186 185
     results.textContent = result.join('\n');
187 186
   }
188 187
 
188
+  document.querySelector('.hide-help').onclick = function () {
189
+    var help = document.querySelector('.help');
190
+    help.style.width = 0;
191
+    help.style.paddingRight = 0;
192
+    help.style.paddingLeft = 0;
193
+  }
189 194
   editor.on('change', onchange);
190 195
   onchange();
191 196
 };