-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
67 lines (65 loc) · 2.99 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!doctype html>
<html>
<head>
<meta charset = "utf-8">
<title>Text 2 Code</title>
<link rel = "stylesheet" href = "styles.css">
<script src="blockly/blockly_compressed.js"></script>
<script src="blockly/blocks_compressed.js"></script>
<script src="blockly/javascript_compressed.js"></script>
<script src="blockly/python_compressed.js"></script>
<script src="blockly/msg/js/en.js"></script>
</head>
<body>
<header>
<h1><span id = "textHeader">Text</span> <span id = "twoHeader">2</span> <span id = "codeTextHeader">Code</span></h1>
</header>
<form>
<div class = "tableContainer">
<div class = "tableRow">
<div class = "tableCell" id = "pseudocodeCell">
<h2><label for = "pseudocode">Text</label>:</h2>
<textarea id = "pseudocode">Set perfectNumStr to "The perfect numbers from 2 to 100 are as follows: ". For each integer from 2 to 100, {set sum to 1; go through every number from 2 to the square root of integer, {if number is a factor of integer and number does not equal square root of integer then increase sum by number plus integer divided by number; otherwise if integer is divisible by number, increase sum by number}; if sum equals integer, set perfectNumStr to perfectNumStr joined with integer plus ","}. Output perfectNumStr.</textarea>
</div>
<div class = "tableCell" id = "convertCell">
<button id = "convertBtn" type = "button">Convert ⇒</button>
</div>
<div class = "tableCell" id = "codeCell">
<h2><label for = "startBlocks">Blockly Code</label>:</h2>
<div id = "blocklyDiv">
<xml id = "toolbox" style = "display: none">
</xml>
<xml id="startBlocks" style="display: none">
</xml>
</div>
</div>
</div>
<div class = "tableRow">
<div class = "tableCell">
<h2><label for = "pythonCode">Python Code</label>:</h2>
<textarea id = "pythonCode"></textarea>
</div>
<div class = "tableCell"></div>
<div class = "tableCell">
<h2><label for = "jsCode">JavaScript Code</label>:</h2>
<textarea id = "jsCode"></textarea>
</div>
</div>
</div>
<footer>
<h3><em>If you can describe the solution, you can code it. (At least that's the goal.)</em></h3>
</footer>
<script src = "modules.js"></script>
<script src = "parser.js"></script>
<script src = "block_generators.js"></script>
<script src = "controller.js"></script>
<script>
"use strict";
var controller = require("controller");
document.getElementById("convertBtn").addEventListener('click', controller.processText);
Blockly.inject(document.getElementById('blocklyDiv'),{toolbox: undefined,scrollbars:true});
Blockly.Xml.domToWorkspace(Blockly.mainWorkspace, document.getElementById('startBlocks'));
</script>
</form>
</body>
</html>