()
| 117 | } |
| 118 | |
| 119 | function 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 | |
| 175 | async function executeJS() { |
| 176 | try { |
no test coverage detected