From c5d6df37d2b6acf22bedd90bb0e101290f85cff6 Mon Sep 17 00:00:00 2001 From: Earl Duque <31702109+earlduque@users.noreply.github.com> Date: Tue, 30 Sep 2025 08:55:29 -0700 Subject: [PATCH 1/3] Update README.md --- .../Konami Code Easter Egg/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Modern Development/Service Portal Widgets/Konami Code Easter Egg/README.md b/Modern Development/Service Portal Widgets/Konami Code Easter Egg/README.md index 244cde1c18..3727ff6b04 100644 --- a/Modern Development/Service Portal Widgets/Konami Code Easter Egg/README.md +++ b/Modern Development/Service Portal Widgets/Konami Code Easter Egg/README.md @@ -1,3 +1,14 @@ # Konami Code Easter Egg Put this code in the client controller of a widget to listen for the Konami Code. By default it just opens a modal notifying the user that the konami code as activated. Modify to do whatever fun things you want. + +## Version 2 + +[KonamiCodeEasterEggV2.js]("Modern Development\Service Portal Widgets\Konami Code Easter Egg\KonamiCodeEasterEggV2.js") is the same code but improved with: + +1. Uses e.key instead of e.keyCode (which is deprecated) with modern arrow key names +2. Automatically tracks only the last N keypresses instead of manual position tracking +3. Resets the sequence if the user pauses too long (more forgiving UX) +4. Removes event listener when widget is destroyed to prevent memory leaks +5. Uses array join comparison instead of position tracking +6. Modern variable declarations for better scoping From d4d9fd83a323a310070676d37e2fe1876330c4a4 Mon Sep 17 00:00:00 2001 From: Earl Duque <31702109+earlduque@users.noreply.github.com> Date: Tue, 30 Sep 2025 08:55:53 -0700 Subject: [PATCH 2/3] Create KonamiCodeEasterEggV2.js --- .../KonamiCodeEasterEggV2.js | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Modern Development/Service Portal Widgets/Konami Code Easter Egg/KonamiCodeEasterEggV2.js diff --git a/Modern Development/Service Portal Widgets/Konami Code Easter Egg/KonamiCodeEasterEggV2.js b/Modern Development/Service Portal Widgets/Konami Code Easter Egg/KonamiCodeEasterEggV2.js new file mode 100644 index 0000000000..423bc492d6 --- /dev/null +++ b/Modern Development/Service Portal Widgets/Konami Code Easter Egg/KonamiCodeEasterEggV2.js @@ -0,0 +1,50 @@ +function(spModal) { + var c = this; + console.log('Lol what are you doing here?'); + + const KONAMI_CODE = ['ArrowUp', 'ArrowUp', 'ArrowDown', 'ArrowDown', + 'ArrowLeft', 'ArrowRight', 'ArrowLeft', 'ArrowRight', 'b', 'a']; + let inputSequence = []; + let timeoutId; + + const handleKeyPress = (e) => { + // Clear timeout to reset sequence if user pauses too long + clearTimeout(timeoutId); + + // Add key to sequence + inputSequence.push(e.key); + + // Keep only the last N keys (length of Konami code) + if (inputSequence.length > KONAMI_CODE.length) { + inputSequence.shift(); + } + + // Check if current sequence matches Konami code + if (inputSequence.join(',') === KONAMI_CODE.join(',')) { + activateCheats(); + inputSequence = []; // Reset after activation + } + + // Reset sequence after 2 seconds of inactivity + timeoutId = setTimeout(() => { + inputSequence = []; + }, 2000); + }; + + const activateCheats = () => { + spModal.open({ + size: 'sm', + title: 'Cheats activated', + message: 'Konami code entered', + buttons: [{ label: '${Close}', cancel: true }] + }); + }; + + document.addEventListener('keydown', handleKeyPress); + + // Cleanup listener when widget is destroyed + c.$onDestroy = function() { + document.removeEventListener('keydown', handleKeyPress); + clearTimeout(timeoutId); + }; +} From 1865d6a531e73031662c9068988505b219294998 Mon Sep 17 00:00:00 2001 From: Earl Duque <31702109+earlduque@users.noreply.github.com> Date: Tue, 30 Sep 2025 09:04:09 -0700 Subject: [PATCH 3/3] Added image --- .../Service Portal Widgets/Konami Code Easter Egg/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Modern Development/Service Portal Widgets/Konami Code Easter Egg/README.md b/Modern Development/Service Portal Widgets/Konami Code Easter Egg/README.md index 3727ff6b04..b7be3f1f38 100644 --- a/Modern Development/Service Portal Widgets/Konami Code Easter Egg/README.md +++ b/Modern Development/Service Portal Widgets/Konami Code Easter Egg/README.md @@ -12,3 +12,5 @@ Put this code in the client controller of a widget to listen for the Konami Code 4. Removes event listener when widget is destroyed to prevent memory leaks 5. Uses array join comparison instead of position tracking 6. Modern variable declarations for better scoping + +image