Skip to content

Commit a782cf0

Browse files
committed
bam
1 parent 6808376 commit a782cf0

3 files changed

Lines changed: 30 additions & 43 deletions

File tree

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

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var _labViewer = null; // for View mode
4343

4444

4545
function executeCode(forceStartingInstr, forceRawInputLst) {
46-
$('#loadingPane').html('Please wait ... executing Python code.').show();
46+
$('#loadingPane').html('Executing code ... takes up to 10 seconds.').show();
4747

4848
if (forceRawInputLst !== undefined) {
4949
rawInputLst = forceRawInputLst; // UGLY global across modules, FIXME
@@ -56,6 +56,16 @@ function executeCode(forceStartingInstr, forceRawInputLst) {
5656
else if ($('#pythonVersionSelector').val() == '3') {
5757
backend_script = python3_backend_script;
5858
}
59+
else if ($('#pythonVersionSelector').val() == 'js') {
60+
backend_script = js_backend_script;
61+
}
62+
else if ($('#pythonVersionSelector').val() == 'ts') {
63+
backend_script = ts_backend_script;
64+
}
65+
else if ($('#pythonVersionSelector').val() == 'java') {
66+
backend_script = java_backend_script;
67+
}
68+
assert(backend_script);
5969

6070
var backendOptionsObj = {cumulative_mode: ($('#cumulativeModeSelector').val() == 'true'),
6171
heap_primitives: ($('#heapPrimitivesSelector').val() == 'true'),
@@ -179,12 +189,7 @@ function officeMixEnterEditMode() {
179189

180190
// set configuration on every code edit and option toggle, to
181191
// set the 'dirty bit' on the enclosing PPT file
182-
if (useCodeMirror) {
183-
pyInputCodeMirror.on("change", saveCurrentConfiguration);
184-
}
185-
else {
186-
pyInputAceEditor.getSession().on("change", saveCurrentConfiguration);
187-
}
192+
pyInputAceEditor.getSession().on("change", saveCurrentConfiguration);
188193
$('select').change(saveCurrentConfiguration);
189194

190195
$("#toggleModebtn").html("Visualize code").show();
@@ -202,7 +207,13 @@ function saveCurrentConfiguration() {
202207

203208

204209
$(document).ready(function() {
205-
console.log("HALLO opt-office-mix.js!!!");
210+
// make sure that this file is included *after* opt-frontend-common.js so
211+
// that these definitions override those in opt-frontend-common.js
212+
//
213+
// use https endpoints since Mix requires https:
214+
JS_JSONP_ENDPOINT = 'https://cokapi.com:8001/exec_js_jsonp';
215+
TS_JSONP_ENDPOINT = 'https://cokapi.com:8001/exec_ts_jsonp';
216+
JAVA_JSONP_ENDPOINT = 'https://cokapi.com:8001/exec_java_jsonp';
206217

207218
// DON'T switch into office mix view mode ... this is just a "Preview"
208219
// that's only relevant in Edit mode
@@ -243,21 +254,7 @@ $(document).ready(function() {
243254
});
244255

245256

246-
if (useCodeMirror) {
247-
pyInputCodeMirror = CodeMirror(document.getElementById('codeInputPane'), {
248-
mode: 'python',
249-
lineNumbers: true,
250-
tabSize: 4,
251-
indentUnit: 4,
252-
// convert tab into four spaces:
253-
extraKeys: {Tab: function(cm) {cm.replaceSelection(" ", "end");}}
254-
});
255-
256-
pyInputCodeMirror.setSize(null, '300px');
257-
}
258-
else {
259-
initAceEditor(300);
260-
}
257+
initAceEditor(300);
261258

262259
// no frills footer
263260
$("#footer").css("margin-top", "0px")

‎v3/opt-office-mix.html‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
-->
3131

3232
<head>
33-
<title>Online Python Tutor - Visualize program execution</title>
33+
<title>Online Python Tutor - Visualize Python, Java, JavaScript, and TypeScript code execution</title>
3434

3535
<meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
3636

@@ -66,7 +66,7 @@
6666
<link rel="stylesheet" href="css/opt-frontend.css"/>
6767

6868

69-
<!-- for Labs.js -->
69+
<!-- for Office Mix Labs.js -->
7070

7171
<!-- let's see if jQuery 1.8.2 works instead of their recommended version of 1.9.1 -->
7272
<!-- <script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js"></script> -->
@@ -86,11 +86,15 @@
8686

8787
<div id="pyInputPane">
8888

89-
<div id="codeInputWarnings">Language:
89+
<div id="codeInputWarnings">Write code in
9090

9191
<select id="pythonVersionSelector">
9292
<option value="2">Python 2.7</option>
9393
<option value="3">Python 3.3</option>
94+
<!--<option value="2crazy">Py 2.crazy</option>-->
95+
<option value="java">Java</option>
96+
<option value="js">JavaScript</option>
97+
<option value="ts">TypeScript</option>
9498
</select>
9599

96100
</div>
@@ -112,12 +116,12 @@
112116

113117
<p>
114118
<a href="http://pythontutor.com/" target="_blank">Online Python Tutor</a> supports
115-
Python 2.7 and 3.3 with limited module imports and no file I/O.
119+
Python 2.7 and 3.3, Java 7, JavaScript ES5 strict, and TypeScript 1.4.1 with limited module imports and no file I/O.
120+
<a href="support-and-privacy.html" target="_blank">Privacy and Terms of Use</a>.
116121
</p>
117122

118123
<p style="margin-top: 8px;">
119124
Copyright &copy; <a href="http://www.pgbovine.net/" target="_blank">Philip Guo</a>. All rights reserved.
120-
Read <a href="support-and-privacy.html" target="_blank">Privacy and Terms of Use information</a>.
121125
</p>
122126

123127
</div>

‎v3/support-and-privacy.html‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,7 @@ <h1>Online Python Tutor &ndash; support and privacy document</h1>
4848

4949
<p>
5050
<a href="http://pythontutor.com/">Online Python Tutor</a> supports
51-
Python 2.7 and 3.3 with limited module
52-
imports and no file I/O.
53-
The following modules may be imported:
54-
bisect,
55-
collections,
56-
datetime,
57-
functools,
58-
heapq,
59-
itertools,
60-
json,
61-
math,
62-
operator,
63-
random,
64-
re,
65-
string
51+
Python 2.7 and 3.3, Java 7, JavaScript ES5 strict, and TypeScript 1.4.1 with limited module imports and no file I/O.
6652
</p>
6753

6854
<hr/>

0 commit comments

Comments
 (0)