jQuery Detect if a User Smashes Their Keyboard

jquery-keyboard-smashed
jQuery plugin to detect if a user has smashed their keyboard. This is determined by the amount of keys that are depressed which triggers the event… nice!

Could be used to calm down those crazy people in the office!

Demo

(function($){
 $.fn.extend({
 
    onKeyboardSmashed : function(callbackFunction,options) {
        var defaults = {
            //change here for event trigger
            threshold: 3
        };
       
      var options = $.extend(defaults, options);
     
     
      return this.each(function() {

            var keys_pressed = 0 ;
            $(this).keydown(function(event) {
                keys_pressed++
           
                    if( keys_pressed >options.threshold){
                            if(typeof callbackFunction == 'function'){
                              callbackFunction.call(this);
                            }
                    }
            });
           
            $(this).keyup(function(event) {
                keys_pressed--;
            });
       
      });
     
    }
 });
})(jQuery);
//usage
$(document).onKeyboardSmashed(function(){
    $("#status").html('keyboard smashed');
    $("#msg").hide();
});