File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,7 +8,8 @@ addEventListener("load", function() {
88 lineNumbers : true
99 } ) ;
1010 function guessType ( code ) {
11- return / ^ [ \s \w ] * < / . test ( code ) ? "html" : "js" ;
11+ console . log ( "guess" , / ^ [ \s \w : \n ] * < / . test ( code ) ? "html" : "js" , "for " + code ) ;
12+ return / ^ [ \s \w \n : ] * < / . test ( code ) ? "html" : "js" ;
1213 }
1314 var reGuess ;
1415 editor . on ( "change" , function ( ) {
@@ -101,7 +102,9 @@ addEventListener("load", function() {
101102 clearSandbox ( ) ;
102103 var chapter = getChapter ( chapters . value ) , visible ;
103104 if ( value == "box" ) {
104- var code = "Run code here in the context of Chapter " + chapter . number ;
105+ var code = chapters . value < 20
106+ ? "Run code here in the context of Chapter " + chapter . number
107+ : "Code from Node.js chapters can't be run in the browser" ;
105108 var guessed = guessType ( chapter . start_code ) ;
106109 if ( guessed == "js" )
107110 code = "// " + code ;
You can’t perform that action at this time.
0 commit comments