Skip to content

Commit 98eb2a6

Browse files
committed
fixed up alternate visualizations as well
1 parent 39a6f63 commit 98eb2a6

5 files changed

Lines changed: 28 additions & 46 deletions

File tree

‎v3/js/composingprograms.js‎

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -229,21 +229,13 @@ $(document).ready(function() {
229229

230230

231231
var queryStrOptions = getQueryStringOptions();
232+
setToggleOptions(queryStrOptions);
232233

233234
if (queryStrOptions.preseededCode) {
234235
setCodeMirrorVal(queryStrOptions.preseededCode);
235236
}
236-
else {
237-
// select a canned example on start-up:
238-
$("#aliasExampleLink").trigger('click');
239-
}
240-
241-
// ugh, ugly tristate due to the possibility of each being undefined
242-
if (queryStrOptions.cumulativeState !== undefined) {
243-
$('#cumulativeModeSelector').val(queryStrOptions.cumulativeState);
244-
}
245237

246-
appMode = $.bbq.getState('mode'); // assign this to the GLOBAL appMode
238+
appMode = queryStrOptions.appMode; // assign this to the GLOBAL appMode
247239
if ((appMode == "display") && queryStrOptions.preseededCode /* jump to display only with pre-seeded code */) {
248240
preseededCurInstr = queryStrOptions.preseededCurInstr; // ugly global
249241
$("#executeBtn").trigger('click');

‎v3/js/csc108h.js‎

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -232,21 +232,11 @@ $(document).ready(function() {
232232

233233

234234
var queryStrOptions = getQueryStringOptions();
235-
236235
if (queryStrOptions.preseededCode) {
237236
setCodeMirrorVal(queryStrOptions.preseededCode);
238237
}
239-
else {
240-
// select a canned example on start-up:
241-
$("#aliasExampleLink").trigger('click');
242-
}
243-
244-
// ugh, ugly tristate due to the possibility of each being undefined
245-
if (queryStrOptions.cumulativeState !== undefined) {
246-
$('#cumulativeModeSelector').val(queryStrOptions.cumulativeState);
247-
}
248238

249-
appMode = $.bbq.getState('mode'); // assign this to the GLOBAL appMode
239+
appMode = queryStrOptions.appMode; // assign this to the GLOBAL appMode
250240
if ((appMode == "display") && queryStrOptions.preseededCode /* jump to display only with pre-seeded code */) {
251241
preseededCurInstr = queryStrOptions.preseededCurInstr; // ugly global
252242
$("#executeBtn").trigger('click');

‎v3/js/matrixtutor.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ $(document).ready(function() {
235235

236236
var queryStrOptions = getQueryStringOptions();
237237

238-
appMode = $.bbq.getState('mode'); // assign this to the GLOBAL appMode
238+
appMode = queryStrOptions.appMode; // assign this to the GLOBAL appMode
239239
if ((appMode == "display") && queryStrOptions.preseededCode /* jump to display only with pre-seeded code */) {
240240
preseededCurInstr = queryStrOptions.preseededCurInstr; // ugly global
241241
$("#executeBtn").trigger('click');

‎v3/js/opt-frontend-common.js‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ function getQueryStringOptions() {
6464
return {preseededCode: $.bbq.getState('code'),
6565
preseededCurInstr: Number($.bbq.getState('curInstr')),
6666
verticalStack: $.bbq.getState('verticalStack'),
67+
appMode: $.bbq.getState('mode'),
6768
py: $.bbq.getState('py'),
6869
cumulative: $.bbq.getState('cumulative'),
6970
heapPrimitives: $.bbq.getState('heapPrimitives'),
@@ -73,6 +74,28 @@ function getQueryStringOptions() {
7374
};
7475
}
7576

77+
function setToggleOptions(dat) {
78+
// ugh, ugly tristate due to the possibility of each being undefined
79+
if (dat.py !== undefined) {
80+
$('#pythonVersionSelector').val(dat.py);
81+
}
82+
if (dat.cumulative !== undefined) {
83+
$('#cumulativeModeSelector').val(dat.cumulative);
84+
}
85+
if (dat.heapPrimitives !== undefined) {
86+
$('#heapPrimitivesSelector').val(dat.heapPrimitives);
87+
}
88+
if (dat.drawParentPointers !== undefined) {
89+
$('#drawParentPointerSelector').val(dat.drawParentPointers);
90+
}
91+
if (dat.textReferences !== undefined) {
92+
$('#textualMemoryLabelsSelector').val(dat.textReferences);
93+
}
94+
if (dat.showOnlyOutputs !== undefined) {
95+
$('#showOnlyOutputsSelector').val(dat.showOnlyOutputs);
96+
}
97+
}
98+
7699

77100
function executePythonCode(pythonSourceCode,
78101
backendScript, backendOptionsObj,

‎v3/js/opt-frontend.js‎

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -73,28 +73,6 @@ function getAppState() {
7373
py: $('#pythonVersionSelector').val()};
7474
}
7575

76-
function setToggleOptions(dat) {
77-
// ugh, ugly tristate due to the possibility of each being undefined
78-
if (dat.py !== undefined) {
79-
$('#pythonVersionSelector').val(dat.py);
80-
}
81-
if (dat.cumulative !== undefined) {
82-
$('#cumulativeModeSelector').val(dat.cumulative);
83-
}
84-
if (dat.heapPrimitives !== undefined) {
85-
$('#heapPrimitivesSelector').val(dat.heapPrimitives);
86-
}
87-
if (dat.drawParentPointers !== undefined) {
88-
$('#drawParentPointerSelector').val(dat.drawParentPointers);
89-
}
90-
if (dat.textReferences !== undefined) {
91-
$('#textualMemoryLabelsSelector').val(dat.textReferences);
92-
}
93-
if (dat.showOnlyOutputs !== undefined) {
94-
$('#showOnlyOutputsSelector').val(dat.showOnlyOutputs);
95-
}
96-
}
97-
9876
$(document).ready(function() {
9977
setSurveyHTML();
10078

@@ -558,7 +536,7 @@ $(document).ready(function() {
558536
$("#aliasExampleLink").trigger('click');
559537
}
560538

561-
appMode = $.bbq.getState('mode'); // assign this to the GLOBAL appMode
539+
appMode = queryStrOptions.appMode; // assign this to the GLOBAL appMode
562540
if ((appMode == 'display' || appMode == 'visualize' /* 'visualize' is deprecated */) &&
563541
queryStrOptions.preseededCode /* jump to display only with pre-seeded code */) {
564542
preseededCurInstr = queryStrOptions.preseededCurInstr; // ugly global
@@ -640,4 +618,3 @@ $(document).ready(function() {
640618
}
641619
});
642620
});
643-

0 commit comments

Comments
 (0)