@@ -26,7 +26,7 @@ function matchExample(match, example) {
26
26
var textBefore = text . slice ( 0 , start ) ;
27
27
var textMatch = text . slice ( start , stop ) ;
28
28
var textAfter = text . slice ( stop , text . length ) ;
29
-
29
+
30
30
example . innerHTML = "" ;
31
31
example . appendChild ( nomatchTextElement ( textBefore ) ) ;
32
32
example . appendChild ( matchTextElement ( textMatch ) ) ;
@@ -105,7 +105,7 @@ function watchExpression(playfield, examples, regex, message) {
105
105
}
106
106
}
107
107
regex . onkeyup = check ;
108
-
108
+
109
109
var experiments = playfield . getElementsByClassName ( "experiment" ) ;
110
110
if ( experiments . length == 1 ) {
111
111
var experiment = experiments [ 0 ] ;
@@ -158,7 +158,7 @@ window.addEventListener("load", function(){
158
158
var regex = getPlayfieldElement ( playfield , i , "regex" ) ;
159
159
var examples = getPlayfieldElement ( playfield , i , "examples" ) ;
160
160
var message = getPlayfieldElement ( playfield , i , "message" ) ;
161
-
161
+
162
162
watchExpression ( playfield , examples , regex , message ) ;
163
163
if ( i == 0 ) {
164
164
regex . focus ( ) ;
@@ -167,4 +167,13 @@ window.addEventListener("load", function(){
167
167
playfieldsLoaded = true ;
168
168
} ) ;
169
169
170
-
170
+ window . addEventListener ( "keypress" , function ( event ) {
171
+ if ( event . which === 13 || event . keyCode === 13 ) {
172
+ var next = document . getElementsByClassName ( "next-page" ) [ 0 ] . href ;
173
+ if ( ! ( undefined === next || ! next || next . length === 0 ) ) {
174
+ window . location . href = next ;
175
+ }
176
+ return false ;
177
+ }
178
+ return true ;
179
+ } ) ;
0 commit comments