Skip to content

Commit 4e81c38

Browse files
author
Philip Guo
committed
started cleaning up URL hashes
1 parent 6e943a3 commit 4e81c38

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

‎v3/js/opt-frontend.js‎

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3838
var python2_backend_script = 'exec';
3939
var python3_backend_script = null;
4040

41-
var appMode = 'edit'; // 'edit' or 'visualize'
41+
var appMode = 'edit'; // 'edit' or 'display'
4242

4343
var preseededCode = null; // if you passed in a 'code=<code string>' in the URL, then set this var
4444
var preseededCurInstr = null; // if you passed in a 'curInstr=<number>' in the URL, then set this var
@@ -89,25 +89,25 @@ $(document).ready(function() {
8989

9090

9191
// ugh, ugly tristate due to the possibility of being undefined :)
92-
if ($.bbq.getState('cumulative_mode') == 'true') {
92+
if ($.bbq.getState('cumulative') == 'true') {
9393
$('#cumulativeModeSelector').val('yes');
9494
}
95-
else if ($.bbq.getState('cumulative_mode') == 'false') {
95+
else if ($.bbq.getState('cumulative') == 'false') {
9696
$('#cumulativeModeSelector').val('no');
9797
}
9898
// else if it's undefined, don't do anything ...
9999

100-
if ($.bbq.getState('python_version') == '3') {
100+
if ($.bbq.getState('py') == '3') {
101101
$('#pythonVersionSelector').val('3');
102102
}
103-
else if ($.bbq.getState('python_version') == '2') {
103+
else if ($.bbq.getState('py') == '2') {
104104
$('#pythonVersionSelector').val('2');
105105
}
106106
// else if it's undefined, don't do anything ...
107107

108108

109109
// only bother with curInstr when we're visualizing ...
110-
if (!preseededCurInstr && preseededMode == 'visualize') { // TODO: kinda gross hack
110+
if (!preseededCurInstr && preseededMode == 'display') { // TODO: kinda gross hack
111111
preseededCurInstr = Number($.bbq.getState('curInstr'));
112112
}
113113

@@ -121,11 +121,11 @@ $(document).ready(function() {
121121
if (!myVisualizer) {
122122
appMode = 'edit';
123123

124-
if (preseededCode && preseededMode == 'visualize') {
124+
if (preseededCode && preseededMode == 'display') {
125125
// punt for now ...
126126
}
127127
else {
128-
$.bbq.pushState({ mode: 'edit' }, 2 /* completely override other hash strings to keep URL clean */);
128+
//$.bbq.pushState({ mode: 'edit' }, 2 /* completely override other hash strings to keep URL clean */);
129129
}
130130
}
131131

@@ -134,7 +134,7 @@ $(document).ready(function() {
134134
$("#pyInputPane").show();
135135
$("#pyOutputPane").hide();
136136
}
137-
else if (appMode == 'visualize') {
137+
else if (appMode == 'display') {
138138
$("#pyInputPane").hide();
139139
$("#pyOutputPane").show();
140140

@@ -261,7 +261,7 @@ $(document).ready(function() {
261261
// also scroll to top to make the UI more usable on smaller monitors
262262
$(document).scrollTop(0);
263263

264-
$.bbq.pushState({ mode: 'visualize' }, 2 /* completely override other hash strings to keep URL clean */);
264+
$.bbq.pushState({ mode: 'display' });
265265
}
266266
},
267267
"json");
@@ -510,20 +510,20 @@ $(document).ready(function() {
510510

511511
// redraw connector arrows on window resize
512512
$(window).resize(function() {
513-
if (appMode == 'visualize') {
513+
if (appMode == 'display') {
514514
myVisualizer.redrawConnectors();
515515
}
516516
});
517517

518518
$('#genUrlBtn').bind('click', function() {
519519
var urlStr = $.param.fragment(window.location.href,
520520
{code: pyInputCodeMirror.getValue(),
521-
curInstr: (appMode == 'visualize') ? myVisualizer.curInstr : 0,
521+
curInstr: (appMode == 'display') ? myVisualizer.curInstr : 0,
522522
mode: appMode,
523-
cumulative_mode: ($('#cumulativeModeSelector').val() == 'yes'),
524-
python_version: $('#pythonVersionSelector').val()
523+
cumulative: ($('#cumulativeModeSelector').val() == 'yes'),
524+
py: $('#pythonVersionSelector').val()
525525
},
526-
2);
526+
2 /* clobber all */);
527527
$('#urlOutput').val(urlStr);
528528
});
529529
});

0 commit comments

Comments
 (0)