Skip to content

Commit 00f4ed2

Browse files
author
Philip Guo
committed
more dubious hash cleanups
1 parent 1ae4855 commit 00f4ed2

1 file changed

Lines changed: 9 additions & 13 deletions

File tree

‎v3/js/opt-frontend.js‎

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,26 +84,22 @@ $(document).ready(function() {
8484
$(window).bind("hashchange", function(e) {
8585
appMode = $.bbq.getState('mode'); // assign this to the GLOBAL appMode
8686

87+
console.log('hashchange:', appMode);
88+
8789
preseededCode = $.bbq.getState('code'); // yuck, global!
8890
var preseededMode = $.bbq.getState('mode');
8991

9092

9193
// ugh, ugly tristate due to the possibility of being undefined :)
92-
if ($.bbq.getState('cumulative') == 'true') {
93-
$('#cumulativeModeSelector').val('true');
94-
}
95-
else if ($.bbq.getState('cumulative') == 'false') {
96-
$('#cumulativeModeSelector').val('false');
94+
var cumulativeState = $.bbq.getState('cumulative');
95+
if (cumulativeState !== undefined) {
96+
$('#cumulativeModeSelector').val(cumulativeState);
9797
}
98-
// else if it's undefined, don't do anything ...
9998

100-
if ($.bbq.getState('py') == '3') {
101-
$('#pythonVersionSelector').val('3');
102-
}
103-
else if ($.bbq.getState('py') == '2') {
104-
$('#pythonVersionSelector').val('2');
99+
var pyState = $.bbq.getState('py');
100+
if (pyState !== undefined) {
101+
$('#pythonVersionSelector').val(pyState);
105102
}
106-
// else if it's undefined, don't do anything ...
107103

108104

109105
// only bother with curInstr when we're visualizing ...
@@ -187,7 +183,7 @@ $(document).ready(function() {
187183

188184
$.get(backend_script,
189185
{user_script : pyInputCodeMirror.getValue(),
190-
cumulative_mode: ($('#cumulativeModeSelector').val() == 'true') /* ugh types! */},
186+
cumulative_mode: $('#cumulativeModeSelector').val()},
191187
function(dataFromBackend) {
192188
var trace = dataFromBackend.trace;
193189

0 commit comments

Comments
 (0)