diff --git a/keypress-2.0.0.min.js b/keypress-2.0.0.min.js deleted file mode 100644 index 4c85113..0000000 --- a/keypress-2.0.0.min.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - Keypress version 2.0.0 (c) 2014 David Mauro. - Licensed under the Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0 -*/ -(function(){var s,u,v,w,o,t,B,C,D,E,p,q,k,x,r,y,F,z={}.hasOwnProperty,i=[].indexOf||function(a){for(var c=0,b=this.length;ci.call(a,"cmd")?!1:!0};f.prototype._prevent_default=function(a,c){if((c||this.should_suppress_event_defaults)&&!this.should_force_event_defaults)if(a.preventDefault?a.preventDefault():a.returnValue=!1,a.stopPropagation)return a.stopPropagation()};f.prototype._get_active_combos=function(a){var c,b,d=this;c=[]; -b=t(this._keys_down,function(b){return b!==a});b.push(a);this._match_combo_arrays(b,function(a){if(d._cmd_bug_check(a.keys))return c.push(a)});this._fuzzy_match_combo_arrays(b,function(a){if(!(0<=i.call(c,a))&&!a.is_solitary&&d._cmd_bug_check(a.keys))return c.push(a)});return c};f.prototype._get_potential_combos=function(a){var c,b,d,e,g;b=[];g=this._registered_combos;d=0;for(e=g.length;dl;e=0<=l?++h:--h)if((c=this._active_combos[e])&&c.is_exclusive&&a.is_exclusive){c=c.keys;if(!j){f=0;for(n=c.length;fi.call(a.keys,b)){j=!1;break}}if(g&&!j){m=a.keys;f=0;for(n=m.length;fi.call(c,b)){g=!0;break}}j&&(d?(c=this._active_combos.splice(e,1)[0],null!=c&&c.reset()): -(c=this._active_combos.splice(e,1,a)[0],null!=c&&c.reset(),d=!0),g=!1)}}g&&this._active_combos.unshift(a);return j||g};f.prototype._remove_from_active_combos=function(a){var c,b,d,e;b=d=0;for(e=this._active_combos.length;0<=e?de;b=0<=e?++d:--d)if(c=this._active_combos[b],c===a){a=this._active_combos.splice(b,1)[0];a.reset();break}};f.prototype._get_possible_sequences=function(){var a,c,b,d,e,g,j,h,f,n,l,m;d=[];n=this._registered_combos;g=0;for(f=n.length;g=l;c=1<=l?++j:--j)if(e=this._sequence.slice(-c),a.is_sequence){if(0>i.call(a.keys,"shift")&&(e=t(e,function(a){return"shift"!==a}),!e.length))continue;c=h=0;for(m=e.length;0<=m?hm;c=0<=m?++h:--h)if(a.keys[c]===e[c])b=!0;else{b=!1;break}b&&d.push(a)}}return d};f.prototype._add_key_to_sequence=function(a,c){var b,d,e,g;this._sequence.push(a);d=this._get_possible_sequences();if(d.length){e=0;for(g=d.length;e=m;b=1<=m?++h:--h)if(g=t(this._sequence,function(a){return 0<=i.call(c.keys,"shift")?!0:"shift"!==a}).slice(-b),c.keys.length===g.length){b= -f=0;for(k=g.length;0<=k?fk;b=0<=k?++f:--f)if(e=g[b],!(0>i.call(c.keys,"shift")&&"shift"===e)&&!("shift"===a&&0>i.call(c.keys,"shift")))if(c.keys[b]===e)d=!0;else{d=!1;break}}if(d)return c}return!1};f.prototype._receive_input=function(a,c){var b;if(this._prevent_capture)this._keys_down.length&&(this._keys_down=[]);else if(c||this._keys_down.length)if(b=v(a.keyCode))return c?this._key_down(b,a):this._key_up(b,a)};f.prototype._fire=function(a,c,b,d){"function"===typeof c["on_"+a]&&this._prevent_default(b, -!0!==c["on_"+a].call(c["this"],b,c.count,d));"release"===a&&(c.count=0);if("keyup"===a)return c.keyup_fired=!0};f.prototype._match_combo_arrays=function(a,c){var b,d,e,g;g=this._registered_combos;d=0;for(e=g.length;dg;b=0<=g?++d:--d)this._keys_down[b]=== -e&&this._keys_down.splice(b,1)}d=this._get_active_combos(a);e=this._get_potential_combos(a);g=0;for(j=d.length;gi.call(this._keys_down,a)&&this._keys_down.push(a)};f.prototype._handle_combo_down=function(a,c,b,d){var e,g,j,f,k;if(0>i.call(a.keys,b))return!1;this._prevent_default(d,a&&a.prevent_default);e=!1;if(0<=i.call(this._keys_down,b)&&(e=!0,!a.allows_key_repeat()))return!1; -j=this._add_to_active_combos(a,b);b=a.keyup_fired=!1;if(a.is_exclusive){f=0;for(k=c.length;fa.keys.length){b=!0;break}}if(!b&&(a.is_counting&&"function"===typeof a.on_keydown&&(a.count+=1),j))return this._fire("keydown",a,d,e)};f.prototype._key_up=function(a,c){var b,d,e,g,f,h;b=a;(e=w(a,c))&&(a=e);e=q[b];c.shiftKey?e&&0<=i.call(this._keys_down,e)||(a=b):b&&0<=i.call(this._keys_down,b)||(a=e);(g=this._get_sequence(a))&&this._fire("keyup",g,c);if(0>i.call(this._keys_down, -a))return!1;g=f=0;for(h=this._keys_down.length;0<=h?fh;g=0<=h?++f:--f)if((d=this._keys_down[g])===a||d===e||d===b){this._keys_down.splice(g,1);break}d=this._active_combos.length;e=[];h=this._active_combos;g=0;for(f=h.length;gd;b=0<=d?++c:--c)if(a===f._registered_combos[b]){f._registered_combos.splice(b,1);break}else e.push(void 0);return e};if(a.keys)return b(a);g=this._registered_combos;d=0;for(e=g.length;de;b=0<=e?++d:--d)if(a[b]!==c[b])return!1;return!0};B=function(a,c){var b,d,e;d=0;for(e=a.length;di.call(c,b))return!1;return!0};C=function(a,c){var b,d,e,g;e=d=0;for(g=a.length;e=d)d=b;else return!1; -return!0};k=function(){if(keypress.debug)return console.log.apply(console,arguments)};D=function(a){var c,b,d;c=!1;for(d in p)if(b=p[d],a===b){c=!0;break}if(!c)for(d in q)if(b=q[d],a===b){c=!0;break}return c};F=function(a){var c,b,d,e,g,f,h;g=!0;a.keys.length||k("You're trying to bind a combo with no keys:",a);b=f=0;for(h=a.keys.length;0<=h?fh;b=0<=h?++f:--f)d=a.keys[b],(c=E[d])&&(d=a.keys[b]=c),"meta"===d&&a.keys.splice(b,1,x),"cmd"===d&&k('Warning: use the "meta" key rather than "cmd" for Windows compatibility'); -h=a.keys;c=0;for(f=h.length;c",",":"<","'":'"',";":":","[":"{","]":"}","\\":"|","`":"~","=":"+","-":"_",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(","0":")"};p={"0":"\\",8:"backspace",9:"tab",12:"num",13:"enter",16:"shift", -17:"ctrl",18:"alt",19:"pause",20:"caps",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",44:"print",45:"insert",46:"delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",91:"cmd",92:"cmd",93:"cmd",96:"num_0",97:"num_1",98:"num_2",99:"num_3", -100:"num_4",101:"num_5",102:"num_6",103:"num_7",104:"num_8",105:"num_9",106:"num_multiply",107:"num_add",108:"num_enter",109:"num_subtract",110:"num_decimal",111:"num_divide",124:"print",144:"num",145:"scroll",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",223:"`",224:"cmd",225:"alt",57392:"ctrl",63289:"num"};-1!==navigator.userAgent.indexOf("Mac OS X")&&(x="cmd");-1!==navigator.userAgent.indexOf("Opera")&&(p["17"]="cmd")}).call(this);