File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed
Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < title > Key Detection</ title >
6+ < script type ="text/javascript " src ="http://www.cornify.com/js/cornify.js "> </ script >
7+ </ head >
8+ < body >
9+ < script >
10+ const pressed = [ ] ;
11+ const secretCode = 'wesbos' ;
12+
13+ window . addEventListener ( 'keyup' , ( e ) => {
14+ console . log ( e . key ) ;
15+ pressed . push ( e . key ) ;
16+ pressed . splice ( - secretCode . length - 1 , pressed . length - secretCode . length ) ;
17+ if ( pressed . join ( '' ) . includes ( secretCode ) ) {
18+ console . log ( 'DING DING!' ) ;
19+ cornify_add ( ) ;
20+ }
21+ console . log ( pressed ) ;
22+ } ) ;
23+ </ script >
24+ </ body >
25+ </ html >
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < title > Key Detection</ title >
6+ < script type ="text/javascript " src ="http://www.cornify.com/js/cornify.js "> </ script >
7+ </ head >
8+ < body >
9+ < script >
10+ const pressed = [ ] ;
11+ const secretCode = 'yoda' ;
12+
13+ window . addEventListener ( 'keyup' , ( e ) => {
14+ console . log ( e . key ) ;
15+ pressed . push ( e . key ) ;
16+ pressed . splice ( - secretCode . lenght - 1 , pressed . length - secretCode . length ) ;
17+ if ( pressed . join ( '' ) . includes ( secretCode ) ) {
18+ console . log ( 'The Force is strong in this one!' ) ;
19+ cornify_add ( ) ;
20+ }
21+ console . log ( pressed ) ;
22+ } )
23+ </ script >
24+ </ body >
25+ </ html >
You can’t perform that action at this time.
0 commit comments