Skip to content

Commit bd5f353

Browse files
committed
SIMPLIFY!
1 parent 6da9212 commit bd5f353

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

‎v3/js/opt-office-mix.js‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,9 @@ function executeCode(forceStartingInstr, forceRawInputLst) {
103103

104104
function officeMixFinishSuccessfulExecution() {
105105
updateAppDisplayForMix('display'); // do this first
106-
$('#pyOutputPane #editCodeLinkDiv').hide(); // don't have explicit "Edit code" link
107106
$('#loadingPane').hide();
108107

109-
$("#toggleModebtn").html("Edit code");
108+
$("#vizBtn").hide();
110109

111110
if (_savedCurInstr !== undefined) {
112111
myVisualizer.renderStep(_savedCurInstr);
@@ -176,7 +175,7 @@ function getAppStateWithTraceCache() {
176175

177176
function enterOPTEditCodeMode() {
178177
updateAppDisplayForMix('edit');
179-
$("#toggleModebtn").html("Visualize code").show();
178+
$("#vizBtn").html("Visualize Execution").show();
180179

181180
// https://groups.google.com/forum/#!msg/ace-discuss/TQHqey_NkBg/q9x_tLrvsXoJ
182181
pyInputAceEditor.resize(); // weird hack that's necessary to refresh the editor's latest text values. #weird
@@ -225,6 +224,10 @@ function updateAppDisplayForMix(newAppMode) {
225224

226225
// customize edit button click functionality AFTER rendering (NB: awkward!)
227226
$('#pyOutputPane #editCodeLinkDiv').show();
227+
$('#pyOutputPane #editBtn').click(function() {
228+
enterOPTEditCodeMode();
229+
});
230+
228231
$.bbq.pushState({ mode: 'display' }, 2 /* completely override other hash strings to keep URL clean */);
229232
} else {
230233
assert(false);
@@ -373,12 +376,8 @@ $(document).ready(function() {
373376

374377
$('#pythonVersionSelector').change(setAceMode);
375378

376-
$("#toggleModebtn").click(function() {
377-
if (appMode == 'edit') {
378-
mixLazyExecuteCode();
379-
} else {
380-
enterOPTEditCodeMode();
381-
}
379+
$("#vizBtn").click(function() {
380+
mixLazyExecuteCode();
382381
});
383382

384383
// To run in https://labsjs.blob.core.windows.net/sdk/LabsJS-1.0.4/labshost.html

‎v3/opt-office-mix.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
<div id="footer">
112112

113113
<p>
114-
<button id="toggleModebtn" style="font-size: 14pt;">???</button>
114+
<button id="vizBtn" style="font-size: 14pt;">???</button>
115115
</p>
116116

117117
<p>

0 commit comments

Comments
 (0)