summaryrefslogtreecommitdiff
path: root/smoke/astro.build-main/src/scripts/defer.ts
diff options
context:
space:
mode:
Diffstat (limited to 'smoke/astro.build-main/src/scripts/defer.ts')
-rw-r--r--smoke/astro.build-main/src/scripts/defer.ts73
1 files changed, 0 insertions, 73 deletions
diff --git a/smoke/astro.build-main/src/scripts/defer.ts b/smoke/astro.build-main/src/scripts/defer.ts
deleted file mode 100644
index 020ee6900..000000000
--- a/smoke/astro.build-main/src/scripts/defer.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-// Aha! These are not polyfills at all!
-if (window.matchMedia("(hover: hover)").matches) {
- class KonamiCode {
- enabled = false;
- keys = [
- "ArrowUp",
- "ArrowUp",
- "ArrowDown",
- "ArrowDown",
- "ArrowLeft",
- "ArrowRight",
- "ArrowLeft",
- "ArrowRight",
- "b",
- "a",
- ];
- accepted = [...new Set(this.keys)];
- inputs = [];
-
- constructor() {
- this.handleKey = this.handleKey.bind(this);
- document.addEventListener("keydown", this.handleKey);
- }
-
- handleKey({ key }) {
- if (this.enabled) {
- this.reset();
- return;
- }
- if (!this.accepted.includes(key)) return;
-
- if (this.keys[this.inputs.length] === key) {
- this.handleInput(key);
- } else {
- this.reset();
- }
- }
-
- handleInput(key) {
- this.inputs.push(key);
-
- if (this.inputs.length === 10) {
- this.handleMatch();
- }
- }
-
- handleMatch() {
- this.enabled = true;
- this.enable();
- this.inputs = [];
- }
-
- reset() {
- if (this.enabled) {
- this.enabled = false;
- this.disable();
- }
- if (this.inputs.length) {
- this.inputs = [];
- }
- }
-
- enable() {
- document.body.classList.add("🥚");
- }
-
- disable() {
- document.body.classList.remove("🥚");
- }
- }
-
- const konami = new KonamiCode();
-}