New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cheatz

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cheatz

a small js library to hide easter eggs on your website.

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
Maintainers
1
Weekly downloads
 
Created
Source

cheatz

a small and dependecy free js library to hide easter eggs on your website. You can use it to hide secret cheatcodes and it also includes a small utility to echo keys.

Example Website

How to

npm install cheatz

then either use the dist/ files as cjs or the src files in type="module" like so:

<script type="module">
        import Cheatz from './Cheatz.js';
        import Keyecho from './Keyecho.js';

        let keyEcho = null;
        addEventListener("DOMContentLoaded", () => {
            keyEcho = new Keyecho("body");

            new Cheatz("body", "i d d q d", function () {

alternatively you can use the statically hosted lib on surge including it like so:

<script src="https://cheatz.surge.sh/cheatz.js"></script>
<script src="https://cheatz.surge.sh/keyecho.js"></script>

Then you can set the Cheat Codes like so: Cheatz

addEventListener("DOMContentLoaded", () => {
    // Konami code
new Cheatz("body", "UP UP DOWN DOWN LEFT RIGHT LEFT RIGHT A B", function () { /* DO SOMETHING */});
});

You can customise also other key codes passing it as 4th parameter of new Cheatz().

constructor(mountPoint, sequence, callback, additionalMap = {})

the default ones are those, I am using the event.key value, defined in here.

const keyMaps = {
    "UP": "ArrowUp",
    "DOWN": "ArrowDown",
    "LEFT": "ArrowLeft",
    "RIGHT": "ArrowRight",
    "ENTER": "Enter",
    "TAB": "Tab",
    "CTRL": "Control",
    "ALT": "Alt",
    "SUPER": "Meta"
};

Keyecho

        let keyEcho = null;
        addEventListener("DOMContentLoaded", () => {
            keyEcho = new Keyecho("body");
        });

This will listen to every key press and echo them at the bottom right of the page.

Keywords

FAQs

Package last updated on 07 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc