/*! * jQuery capslockstate plugin v1.2.1 * https://github.com/nosilleg/capslockstate-jquery-plugin/ * * Copyright 2012 Jason Ellison * Released under the MIT license * https://github.com/nosilleg/capslockstate-jquery-plugin/blob/master/MIT-LICENSE.txt * * Date: Sun Feb 3 2013 21:34:00 GMT */ (function(b){var c="unknown";var a={init:function(d){var e=b.extend({},d);var g=/MacPPC|MacIntel/.test(window.navigator.platform)===true;var f={isCapslockOn:function(i){var j=false;if(i.shiftKey){j=i.shiftKey}else{if(i.modifiers){j=!!(i.modifiers&4)}}var h=String.fromCharCode(i.which);if(h.toUpperCase()===h.toLowerCase()){}else{if(h.toUpperCase()===h){if(g===true&&j){}else{c=!j}}else{if(h.toLowerCase()===h){c=j}}}return c},isCapslockKey:function(h){var i=h.which;if(i===20){if(c!=="unknown"){c=!c}}return c},hasStateChange:function(h,i){if(h!==i){b("body").trigger("capsChanged");if(i===true){b("body").trigger("capsOn")}else{if(i===false){b("body").trigger("capsOff")}else{if(i==="unknown"){b("body").trigger("capsUnknown")}}}}}};b("body").bind("keypress.capslockstate",function(i){var h=c;c=f.isCapslockOn(i);f.hasStateChange(h,c)});b("body").bind("keydown.capslockstate",function(i){var h=c;c=f.isCapslockKey(i);f.hasStateChange(h,c)});b(window).bind("focus.capslockstate",function(){var h=c;c="unknown";f.hasStateChange(h,c)});f.hasStateChange(null,"unknown");return this.each(function(){})},state:function(){return c},destroy:function(){return this.each(function(){b("body").unbind(".capslockstate");b(window).unbind(".capslockstate")})}};jQuery.fn.capslockstate=function(d){if(a[d]){return a[d].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof d==="object"||!d){return a.init.apply(this,arguments)}else{b.error("Method "+d+" does not exist on jQuery.capslockstate")}}}})(jQuery);