summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authors1n <[email protected]>2019-09-09 16:26:24 -0700
committers1n <[email protected]>2019-09-09 16:26:24 -0700
commitb153ca0e3c96a1b9ed43631a4727acde4bc9f56d (patch)
treebe48090ae24595fa0d34e45bb0bb780acef301c5 /js
parentformatting updates, components in humans.txt updat (diff)
downloads1n.pw-admin-b153ca0e3c96a1b9ed43631a4727acde4bc9f56d.tar.xz
s1n.pw-admin-b153ca0e3c96a1b9ed43631a4727acde4bc9f56d.zip
midi.txt > midi.mp3.txt, formatting, oops
Diffstat (limited to 'js')
-rw-r--r--js/oops.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/js/oops.js b/js/oops.js
new file mode 100644
index 0000000..1c5a3fc
--- /dev/null
+++ b/js/oops.js
@@ -0,0 +1,38 @@
+// A key map of allowed keys
+var allowedKeys = {
+ 8: 'backspace'
+};
+
+// The sequence
+var oopsCode = ['backspace'];
+
+// A variable to remember the 'position' the user has reached so far.
+var oopsCodePosition = 0;
+
+// Add keydown event listener
+document.addEventListener('keydown', function (e) {
+ // Get the value of the key code from the key map
+ var key = allowedKeys[e.keyCode];
+ // Get the value of the required key from the oops Code
+ var requiredKey = oopsCode[oopsCodePosition];
+
+ // Compare the key with the required key
+ if (key == requiredKey) {
+
+ // Move to the next key in the oops Code sequence
+ oopsCodePosition++;
+
+ // Ff the last key is reached, activate cheats
+ if (oopsCodePosition == oopsCode.length) {
+ activateCheats();
+ oopsCodePosition = 0;
+ }
+ } else {
+ oopsCodePosition = 0;
+ }
+});
+
+function activateCheats() {
+
+ window.location.href = "/oops.html";
+} \ No newline at end of file