Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/martinkr/jquery.easteregg
jQuery.easterEgg - feeling adventurous? Add a hidden treasure to your page!
https://github.com/martinkr/jquery.easteregg
Last synced: 2 months ago
JSON representation
jQuery.easterEgg - feeling adventurous? Add a hidden treasure to your page!
- Host: GitHub
- URL: https://github.com/martinkr/jquery.easteregg
- Owner: martinkr
- License: other
- Created: 2013-02-27T11:38:16.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-05-21T09:36:48.000Z (over 10 years ago)
- Last Synced: 2024-10-10T15:24:38.276Z (2 months ago)
- Language: JavaScript
- Size: 138 KB
- Stars: 9
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE.markdown
Awesome Lists containing this project
README
[jQuery.easterEgg](https://github.com/martinkr/jQuery.easterEgg)
=======# jQuery.easterEgg - feeling adventurous? Add a hidden treasure to your page!
Type the right key sequence right upon entering to unlock the hidden treasue.
The plugin will start watching upon the first keypress - don't hesitate ;)## Features
- Multiple easterEggs on one page: hide easter eggs on specific element
- Use your own key sequence: with the konami code as the default
- Listen to "jQuery.easterEgg" or override the complete callback with your own function
- Memory friendly: removes all events / data afterwards## Examples
### Basic example
Installing the easter egg on the document body: triggers in the key sequence is entered while the focus is on the body-element.
Uses the default key sequence - the konami code ("up up down down left right left right b a") and listens for the easter egg event "jQuery.easterEgg" to activate the hidden function.
$('body').easterEgg();
$('body').on('jQuery.esterEgg',function(){alert('konami code')});### Using a custom key sequence
Pass an object containing your sequence as an array of keycodes
$('body').easterEgg( { keys:[66,65] } );### overriding the complete function
Replace the complete callback with your own function.
$.fn.easterEgg.found = function () {
alert('custom')
} ;### Multiple easter eggs
// install the konami code on the first input element
$('input').easterEgg();
$('input').on('jQuery.esterEgg',function(event_){ event_.stopPropagation(); alert('input: konami code')});// and the custom key sequence on the body
$('body').easterEgg({keys:[66,65]});
$('body').on('jQuery.esterEgg',function(){alert('body: custom code')});## Requires
* jQuery JavaScript Library 1.7+ - http://jquery.com/; Copyright 2010, John Resig; Dual licensed under the MIT or GPL Version 2 licenses - http://jquery.org/license## License
Dual licensed under the MIT and GPL licenses.* MIT - http://www.opensource.org/licenses/mit-license.php
* GNU - http://www.gnu.org/licenses/gpl-3.0.htmlCopyright (c) 2011 Martin Krause (jquery.public.mkrause.info)