@@ -122,11 +122,11 @@ function handleResult(statusCode, message) {
122
122
}
123
123
}
124
124
125
- // Called on successful program run: display output and link to playground
125
+ // Called on successful program run: display output and playground icon
126
126
function handleSuccess ( message ) {
127
127
resultDiv . style . backgroundColor = successColor ;
128
128
var program = encodeURIComponent ( editor . getValue ( ) ) ;
129
- playLink . href = "http://play.rust-lang.org/?code=" + program + "&run=1"
129
+ // playLink.href = "http://play.rust-lang.org/?code=" + program + "&run=1"
130
130
// console.log(playLink.href);
131
131
resultDiv . innerHTML = '' ; // clear resultDiv, then add
132
132
resultDiv . appendChild ( playLink ) ; // playLink icon and message
@@ -171,7 +171,7 @@ function handleProblem(message, problem) {
171
171
172
172
// Setting message
173
173
var program = encodeURIComponent ( editor . getValue ( ) ) ;
174
- playLink . href = "http://play.rust-lang.org/?code=" + program + "&run=1"
174
+ // playLink.href = "http://play.rust-lang.org/?code=" + program + "&run=1"
175
175
// console.log(playLink.href);
176
176
resultDiv . innerHTML = '' ; // clear resultDiv, then add
177
177
resultDiv . appendChild ( playLink ) ; // playLink icon and error message
@@ -221,6 +221,14 @@ runButton.addEventListener("click", function(ev) {
221
221
runProgram ( program , handleResult ) ;
222
222
} ) ;
223
223
224
+ // When clicking on the playground icon, navigate to the playground itself
225
+ function goPlayground ( ) {
226
+ var program = "http://play.rust-lang.org/?code=" +
227
+ encodeURIComponent ( editor . getValue ( ) ) + "&run=1"
228
+ window . location = program
229
+ // console.log(program);
230
+ }
231
+
224
232
// Highlight active line when focused
225
233
editor . on ( 'focus' , function ( ) {
226
234
editor . setHighlightActiveLine ( true ) ;
0 commit comments