Skip to content

Commit e1a4994

Browse files
Tabs work
1 parent 0bac5ec commit e1a4994

File tree

3 files changed

+85
-16
lines changed

3 files changed

+85
-16
lines changed

build/editor.css

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,34 @@ body {
252252
position: relative;
253253
}
254254

255+
#editor-section div.tab-area.active {
256+
visibility: visible;
257+
}
258+
259+
#editor-section div.tab-area.inactive {
260+
visibility: hidden;
261+
}
262+
255263
#editor-holder {
256264
width: 100%;
257265
height: 90%;
258-
display: block;
266+
display: inline-block;
267+
position: absolute;
268+
}
269+
270+
#editor-assembly-holder {
271+
width: 100%;
272+
height: 90%;
273+
display: inline-block;
274+
position: absolute;
275+
}
259276

277+
#editor-options {
278+
position: absolute;
279+
display: inline-block;
280+
width: 100%;
281+
height: 90%;
282+
margin: 0;
260283
}
261284

262285
#stack-visualizer-section {
@@ -281,6 +304,16 @@ body {
281304
right: 0;
282305
}
283306

307+
#editor-assembly {
308+
height: 100%;
309+
margin: 0;
310+
top: 0;
311+
bottom: 0;
312+
left: 0;
313+
right: 0;
314+
visibility: inherit;
315+
}
316+
284317

285318
.test-box {
286319
background-color: #b0c4de;
@@ -355,4 +388,4 @@ button {
355388
li.active a {
356389
/*font-weight: bold;*/
357390
text-shadow: 1px 1px #BFBFBF;
358-
}
391+
}

build/editor.html

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,15 @@ <h2 id="ide-subtitle">Bitcoin Script for dummies.</h2>
117117
</li>
118118
</ul>
119119

120-
<div id="editor-holder">
120+
<div id="editor-holder" class="tab-area active">
121121
<div id="editor" class="script" style="position: relative;">1 2 OP_ADD</div>
122122
</div>
123+
<div id="editor-assembly-holder" class="tab-area inactive">
124+
<div id="editor-assembly" class="script" style="position: relative;">111</div>
125+
</div>
126+
<div id="editor-options" class="tab-area inactive">
127+
OPTIONS HERE
128+
</div>
123129
</div>
124130

125131
<div id="stack-visualizer-section" class="section">
@@ -183,8 +189,23 @@ <h3 id="assembler-subsection" class="subsection-title"> Assembler </h3>
183189
<!-- Set up the editor window -->
184190
<script>
185191
ace.require("ace/ext/language_tools");
192+
193+
var editorAssembly = ace.edit("editor-assembly");
194+
editorAssembly.setTheme("ace/theme/merbivore");
195+
editorAssembly.getSession().setMode("ace/mode/script");
196+
//Set options for auto-completion
197+
editorAssembly.setOptions({
198+
fontSize: 16,
199+
wrap: true,
200+
highlightActiveLine: true,
201+
fixedWidthGutter : false,
202+
dragEnabled : true,
203+
// enableBasicAutocompletion: true,
204+
// enableSnippets: true,
205+
// enableLiveAutocompletion: true //suggests words as you type
206+
});
207+
186208
var editor = ace.edit("editor");
187-
//editor.setTheme("ace/theme/twilight");
188209
editor.setTheme("ace/theme/merbivore");
189210
editor.getSession().setMode("ace/mode/script");
190211
//Set options for auto-completion

build/editor.js

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,36 @@ $( document ).ready(function() {
5050

5151
// Attach event listeners to the toggling between assembly and script
5252
$( "body" ).delegate( "#editor-tab-assembly", "click", function() {
53-
if(!$("#editor").hasClass("assembly")) {
54-
var script = editor.getSession().getValue();
55-
editor.setValue(assembleToHex(script), -1); //-1 for cursor at start, 1 for end
56-
$("#editor").addClass("assembly");
57-
$("#editor").removeClass("script");
58-
}
53+
// if(!$("#editor").hasClass("assembly")) {
54+
// var script = editor.getSession().getValue();
55+
// editor.setValue(assembleToHex(script), -1); //-1 for cursor at start, 1 for end
56+
// $("#editor").addClass("assembly");
57+
// $("#editor").removeClass("script");
58+
// }
59+
var script = editor.getSession().getValue();
60+
editorAssembly.setValue(assembleToHex(script), -1); //-1 for cursor at start, 1 for end
61+
62+
$("#editor-section div.tab-area").removeClass("active").addClass("inactive");
63+
$("#editor-assembly-holder.tab-area").removeClass("inactive").addClass("active");
5964
});
6065

6166
$( "body" ).delegate( "#editor-tab-script", "click", function() {
62-
if(!$("#editor").hasClass("script")) {
63-
var hex = editor.getSession().getValue();
64-
editor.setValue(disassembleFromHex(hex), -1); //-1 for cursor at start, 1 for end
65-
$("#editor").addClass("script");
66-
$("#editor").removeClass("assembly");
67-
}
67+
// if(!$("#editor").hasClass("script")) {
68+
// var hex = editor.getSession().getValue();
69+
// editor.setValue(disassembleFromHex(hex), -1); //-1 for cursor at start, 1 for end
70+
// $("#editor").addClass("script");
71+
// $("#editor").removeClass("assembly");
72+
// }
73+
var hex = editorAssembly.getSession().getValue();
74+
editor.setValue(disassembleFromHex(hex), -1); //-1 for cursor at start, 1 for end
75+
76+
$("#editor-section div.tab-area").removeClass("active").addClass("inactive");
77+
$("#editor-holder.tab-area").removeClass("inactive").addClass("active");
78+
});
79+
80+
$( "body" ).delegate( "#editor-tab-options", "click", function() {
81+
$("#editor-section div.tab-area").removeClass("active").addClass("inactive");
82+
$("#editor-options.tab-area").removeClass("inactive").addClass("active");
6883
});
6984

7085
$("#editor-section").on("mouseover", function() {

0 commit comments

Comments
 (0)