Skip to content

Commit

Permalink
added watchFor - allows custom codes to be used
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebragger committed May 11, 2009
1 parent aa8e03d commit 7a13d16
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions konamicode.js
Expand Up @@ -9,6 +9,8 @@
$(document).ready(function(){
$('body').upUpDownDown({
watchFor: '38384040373937399897', // String of keyCode and charCodes to watch for
// 38384040373937399897 == up up down down left right left right B A
callback: function(){
// Do some fancy shit here.
}
Expand All @@ -19,11 +21,12 @@
(function(jQuery) {
jQuery.fn.upUpDownDown = function(o){
var options = jQuery.extend({
callback : function() { },
watchFor : '38384040373937399897',
callback : function() { }
}, o);

var key_accum = '';
var match = '38384040373937399897';
var match = options.watchFor || '38384040373937399897';

$(document).keypress(function(e){
key_accum = key_accum + (e.keyCode ? e.keyCode : e.charCode);
Expand Down

0 comments on commit 7a13d16

Please sign in to comment.