MCPcopy Index your code
hub / github.com/ronreiter/interactive-tutorials / execute

Function execute

static/js/learnpython.js:119–173  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

117}
118
119function execute() {
120 maximizeDock();
121
122 if (window.domainData.language === "html") {
123 $("#html-output").show();
124 $("#text-output").hide();
125
126 var a = $("#expected-output").contents()[0];
127 a.write(tutorialData.output);
128 a.close();
129
130 var b = $("#html-output").contents()[0];
131 b.write(editor.getValue());
132 b.close();
133
134 // now, let's compare A and B
135 if (compareHTML(a.body, b.body)) {
136 correct();
137 }
138
139 // links should not redirect us out of here.
140 var links = b.querySelectorAll("a");
141 for (var i = 0; i < links.length; i++) {
142 if (links[i].href.indexOf("#") == -1) {
143 links[i].target = "_blank";
144 }
145 }
146
147 return;
148 }
149
150 //$('#output').css('color', '#bbbbbb');
151 //$('#output').css('background-color', '#eeeeee');
152 output.setValue("");
153 //$('#output').text('');
154
155 if (window.domainData.language === "javascript") {
156 executeJS();
157 } else {
158 //loading.show();
159 print("Executing, please wait...");
160 $.ajax({
161 type : "post",
162 data : JSON.stringify({
163 "code" : editor.getValue(),
164 "language" : window.domainData.language
165 }),
166 contentType : "application/json",
167 success : execDone,
168 error : handleError,
169 dataType: "json"
170 });
171 }
172
173}
174
175async function executeJS() {
176 try {

Callers 1

loadFunction · 0.85

Calls 8

maximizeDockFunction · 0.85
compareHTMLFunction · 0.85
correctFunction · 0.85
executeJSFunction · 0.85
printFunction · 0.85
contentsMethod · 0.80
getValueMethod · 0.80
setValueMethod · 0.80

Tested by

no test coverage detected