Skip to content

Commit 8714a78

Browse files
committed
minor refactorings
1 parent c4f4435 commit 8714a78

3 files changed

Lines changed: 19 additions & 21 deletions

File tree

‎v4-cokapi/static/index.html‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@
9898
<select id="cumulativeModeSelector">
9999
<option value="false">hide exited function frames (default)</option>
100100
<option value="true">show exited function frames</option>
101-
<option value="holistic">holistic mode (experimental)</option>
102101
</select>
103102
<select id="heapPrimitivesSelector">
104103
<option value="false">inline primitives and nested objects (default)</option>

‎v4-cokapi/static/js/cokapi.js‎

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,17 @@ function executeCode(forceStartingInstr, forceRawInputLst) {
5353

5454
var backend_script = null;
5555
if ($('#pythonVersionSelector').val() == '2') {
56-
backend_script = python2_backend_script;
56+
backend_script = '/exec_py2';
5757
}
5858
else if ($('#pythonVersionSelector').val() == '3') {
59-
backend_script = python3_backend_script;
59+
backend_script = '/exec_py3'
6060
}
61-
// experimental KRAZY MODE!!!
62-
else if ($('#pythonVersionSelector').val() == '2crazy') {
63-
backend_script = python2crazy_backend_script;
61+
else if ($('#pythonVersionSelector').val() == 'js') {
62+
backend_script = '/exec_js';
63+
}
64+
else {
65+
alert("Invalid version selector");
66+
assert(false);
6467
}
6568

6669
var backendOptionsObj = {cumulative_mode: ($('#cumulativeModeSelector').val() == 'true'),
@@ -87,17 +90,13 @@ function executeCode(forceStartingInstr, forceRawInputLst) {
8790
// ExecutionVisualizer will be shown at a time
8891
visualizerIdOverride: '1',
8992
updateOutputCallback: function() {$('#urlOutput,#embedCodeOutput').val('');},
90-
91-
// undocumented experimental modes:
92-
pyCrazyMode: ($('#pythonVersionSelector').val() == '2crazy'),
93-
holisticMode: ($('#cumulativeModeSelector').val() == 'holistic')
9493
}
9594

96-
executePythonCode(pyInputGetValue(),
97-
backend_script, backendOptionsObj,
98-
frontendOptionsObj,
99-
'pyOutputPane',
100-
optFinishSuccessfulExecution, handleUncaughtExceptionFunc);
95+
executeUserCode(pyInputGetValue(),
96+
backend_script, backendOptionsObj,
97+
frontendOptionsObj,
98+
'pyOutputPane',
99+
optFinishSuccessfulExecution, handleUncaughtExceptionFunc);
101100
}
102101

103102

‎v4-cokapi/static/js/opt-frontend-common.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -612,11 +612,11 @@ function optFinishSuccessfulExecution() {
612612

613613

614614
// TODO: cut reliance on the nasty rawInputLst global
615-
function executePythonCode(pythonSourceCode,
616-
backendScript, backendOptionsObj,
617-
frontendOptionsObj,
618-
outputDiv,
619-
handleSuccessFunc, handleUncaughtExceptionFunc) {
615+
function executeUserCode(sourceCode,
616+
backendScript, backendOptionsObj,
617+
frontendOptionsObj,
618+
outputDiv,
619+
handleSuccessFunc, handleUncaughtExceptionFunc) {
620620
if (!backendScript) {
621621
setFronendError(["Server configuration error: No backend script",
622622
"Report a bug to philip@pgbovine.net by clicking on the 'Generate URL'",
@@ -640,7 +640,7 @@ function executePythonCode(pythonSourceCode,
640640
startExecutingCode();
641641

642642
$.get(backendScript,
643-
{user_script : pythonSourceCode,
643+
{user_script : sourceCode,
644644
raw_input_json: rawInputLst.length > 0 ? JSON.stringify(rawInputLst) : '',
645645
options_json: JSON.stringify(backendOptionsObj),
646646
// if we don't have any deltas, then don't bother sending deltaObj:

0 commit comments

Comments
 (0)