-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
89 lines (71 loc) · 2.55 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<html xml:lang="en" lang="en">
<head>
<title>Online ARM simulator</title>
<link rel="stylesheet" href="loadfile.css">
<link rel="stylesheet" href="browse.css">
</head>
<body>
<div id="header"></div><div id="container">
<h1>Armdroid</h1>
<table>
<tr>
<td><form action="" id="formsubmit" method = "post">
<textarea name = "formContent" id = "formContent" style="display:none;"></textarea>
<input type="submit" name="submit" value="Run" id = "submit" class="btn btn-primary" onClick = "getEditorContent()">
<input type="button" onclick="resetEditor()" id="Reset" class="btn btn-primary" name="Reset" value="Reset">
</tr>
<tr>
<td colspan="3">
<div id="inputTextToSave" value="savethistext" style="width:630px;height:450px"></div>
</td>
<td><div><textarea readonly name ="outputText" id ="outputText" style="width:630px;height:325px;border: 2px solid #428bca" placeholder = "Output here..."></textarea><br>
<textarea name="inputs" id="inputs" style="width:630px;height:100px;border: 2px solid #428bca" placeholder = "Input your values here..."></textarea></div>
</td></form>
</tr>
<tr>
<td><input type="file" class="custom-file-input" id="fileToLoad"></td>
<td><input type ="button" onclick="loadFileAsText()" class="btn btn-primary" name="Upload File" value="Upload File">
</td>
</tr>
</table>
<script src="ace.js" type="text/javascript" charset="utf-8"></script>
<script src="jquery.min.js"></script>
<script src="ajaxscript.js"></script>
<script>
var editor = ace.edit("inputTextToSave");
editor.setTheme("ace/theme/idle_fingers");
editor.getSession().setMode("ace/mode/arm");
</script>
<script type="text/javascript">function getEditorContent(){
document.getElementById("formContent").innerHTML = editor.getValue();}
</script>
<script type='text/javascript'>
function resetEditor()
{
var editor = ace.edit("inputTextToSave");
editor.getSession().setValue("");
document.getElementById("outputText").value = "";
document.getElementById("inputs").value = "";
}
function destroyClickedElement(event)
{
document.body.removeChild(event.target);
}
function loadFileAsText()
{
var fileToLoad = document.getElementById("fileToLoad").files[0];
var fileReader = new FileReader();
fileReader.onload = function(fileLoadedEvent)
{
inputTextToSave.getSelectedText = function() {
this.session.getTextRange(this.getSelectionRange())
}
var textFromFileLoaded = fileLoadedEvent.target.result;
editor.setValue(textFromFileLoaded);
};
fileReader.readAsText(fileToLoad, "UTF-8");
}
</script>
</body>
</html>