@@ -26,7 +26,7 @@ function matchExample(match, example) {
2626 var textBefore = text . slice ( 0 , start ) ;
2727 var textMatch = text . slice ( start , stop ) ;
2828 var textAfter = text . slice ( stop , text . length ) ;
29-
29+
3030 example . innerHTML = "" ;
3131 example . appendChild ( nomatchTextElement ( textBefore ) ) ;
3232 example . appendChild ( matchTextElement ( textMatch ) ) ;
@@ -105,7 +105,7 @@ function watchExpression(playfield, examples, regex, message) {
105105 }
106106 }
107107 regex . onkeyup = check ;
108-
108+
109109 var experiments = playfield . getElementsByClassName ( "experiment" ) ;
110110 if ( experiments . length == 1 ) {
111111 var experiment = experiments [ 0 ] ;
@@ -158,7 +158,7 @@ window.addEventListener("load", function(){
158158 var regex = getPlayfieldElement ( playfield , i , "regex" ) ;
159159 var examples = getPlayfieldElement ( playfield , i , "examples" ) ;
160160 var message = getPlayfieldElement ( playfield , i , "message" ) ;
161-
161+
162162 watchExpression ( playfield , examples , regex , message ) ;
163163 if ( i == 0 ) {
164164 regex . focus ( ) ;
@@ -167,4 +167,13 @@ window.addEventListener("load", function(){
167167 playfieldsLoaded = true ;
168168} ) ;
169169
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