diff options
Diffstat (limited to 'public/javascripts/cheat.js')
-rw-r--r-- | public/javascripts/cheat.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/public/javascripts/cheat.js b/public/javascripts/cheat.js new file mode 100644 index 0000000..863e53a --- /dev/null +++ b/public/javascripts/cheat.js | |||
@@ -0,0 +1,29 @@ | |||
1 | var konamiActivated = false; | ||
2 | |||
3 | new Konami(function () { | ||
4 | |||
5 | if (konamiActivated) return; | ||
6 | konamiActivated = true; | ||
7 | |||
8 | console.log('Cheat console activated. Have fun!'); | ||
9 | |||
10 | // play nice soundtrack | ||
11 | (new Audio('/assets/medias/sims2-university-theme.ogg')).play(); | ||
12 | |||
13 | // display cheat console | ||
14 | var form = document.createElement('form'); | ||
15 | form.classList.add('cheat-form'); | ||
16 | form.setAttribute('method', 'post'); | ||
17 | form.setAttribute('action', '/console'); | ||
18 | |||
19 | var field = document.createElement('input'); | ||
20 | field.setAttribute('type', 'text'); | ||
21 | field.setAttribute('name', 'command'); | ||
22 | field.setAttribute('autocomplete', 'off'); | ||
23 | |||
24 | form.appendChild(field); | ||
25 | document.getElementsByTagName('body')[0].appendChild(form); | ||
26 | |||
27 | field.focus(); | ||
28 | |||
29 | }); | ||