/* Keypress version 1.0.3 */ (function(){var v,w,j,O,P,Q,R,D,x,y,E,F,m,S,T,U,G,V,W,X,H,Y,n,q,g,I,r,J,s,t,K,z,u,L,A,k,M,p,B,N,C,Z,h=[].indexOf||function(a){for(var c=0,b=this.length;c=0))return false}d=0;for(e=c.length;d=0))return false}return true};u=function(a,c){if((c||keypress.suppress_event_defaults)&&!keypress.force_event_defaults){a.preventDefault?a.preventDefault():a.returnValue=false;if(a.stopPropagation)return a.stopPropagation()}};Q=function(a){if(a.prevent_repeat)return false;if(typeof a.on_keydown==="function")return true}; I=function(a){var c,b,d,e;e=a.keys;b=0;for(d=e.length;b=0){c=true;break}}return c};m=function(a,c,b){typeof c["on_"+a]==="function"&&u(b,c["on_"+a].call(c["this"],b,c.count)===false);if(a==="release")c.count=0;if(a==="keyup")return c.keyup_fired=true};J=function(a,c,b){var d,e,f,i;b==null&&(b=false);d=[];f=0;for(i=c.length;f=0&&h.call(a,"cmd")<0?false:true};S=function(a){var c,b,d,e,f,i,h;e=[];b=g.filter(function(b){return b!==a});b.push(a);d=J(b,k);d.length&&D(b)&&(e=d);c=false;i=0;for(h=e.length;ij;b=0<=j?++h:--h){i=a.slice();i.splice(b,1);if(i.length){d=J(i,k);g=0;for($=d.length;g<$;g++){b=d[g];(!c||!b.is_exclusive)&& e.push(b)}f(i)}}};f(b);return e};U=function(a){var c,b,d,e;b=[];d=0;for(e=k.length;d=0&&D(c.keys)&&b.push(c)}return b};P=function(a){var c,b,d,e,f,i,g,k,l;f=false;if(h.call(j,a)>=0)return false;if(j.length){d=i=0;for(l=j.length;0<=l?il;d=0<=l?++i:--i){c=j[d];if(c.is_exclusive&&a.is_exclusive){b=c.keys.slice();g=0;for(k=b.length;ge;b=0<=e?++d:--d){c=j[b];if(c===a){j.splice(b,1);break}}};O=function(a,c){var b,d,e,f;p.push(a);d=T();if(d.length){e=0;for(f=d.length;e-1&&(B=setTimeout(function(){return p=[]},keypress.sequence_delay))}else p=[]};T=function(){var a,c,b,d,e,f,i,g,j,l,o;d=[];f=0;for(j=k.length;f=l;c=1<=l?++i:--i){e=p.slice(-c);if(a.is_sequence){if(h.call(a.keys, "shift")<0){e=e.filter(function(a){return a!=="shift"});if(!e.length)continue}c=g=0;for(o=e.length;0<=o?go;c=0<=o?++g:--g)if(a.keys[c]===e[c])b=true;else{b=false;break}b&&d.push(a)}}}return d};G=function(a){var c,b,d,e,f,g,j,m,l,o,n;g=0;for(l=k.length;g=o;b=1<=o?++j:--j){f=p.filter(function(a){return h.call(c.keys,"shift")>=0?true:a!=="shift"}).slice(-b);if(c.keys.length===f.length){b=m=0;for(n=f.length;0<=n?mn;b=0<=n?++m: --m){e=f[b];if(!(h.call(c.keys,"shift")<0&&e==="shift")&&!(a==="shift"&&h.call(c.keys,"shift")<0))if(c.keys[b]===e)d=true;else{d=false;break}}}}if(d)return c}}return false};F=function(a,c){var b;if(!c.shiftKey)return false;b=q[a];return b!=null?b:false};V=function(a,c,b){if(h.call(a.keys,c)<0)return false;u(b,a&&a.prevent_default);if(h.call(g,c)>=0&&!Q(a))return false;P(a,c);a.keyup_fired=false;if(a.is_counting&&typeof a.on_keydown==="function")a.count=a.count+1;return m("keydown",a,b)};X=function(a, c){var b,d,e,f;(d=F(a,c))&&(a=d);O(a,c);(d=G(a))&&m("keydown",d,c);for(b in t){d=t[b];if(c[d]){b==="meta"&&(b=s);b===a||h.call(g,b)>=0||g.push(b)}}for(b in t){d=t[b];b==="meta"&&(b=s);if(b!==a&&h.call(g,b)>=0&&!c[d]){d=e=0;for(f=g.length;0<=f?ef;d=0<=f?++e:--e)g[d]===b&&g.splice(d,1)}}d=S(a);e=0;for(f=d.length;e=0||(a=d):d&&h.call(g,d)>=0||(a=e);(f=G(a))&&m("keyup",f,c);if(h.call(g,a)<0)return false;f=i=0;for(k=g.length;0<=k?ik;f=0<=k?++i:--i)if((b=g[f])===a||b===e||b===d){g.splice(f,1);break}d=j.length;e=[];f=0;for(i=j.length;f=0&&e.push(b)}f=0;for(i=e.length;f1){d=0;for(f=j.length;d=0||I(b)||M(b)}}};A=function(a,c){var b;if(z)g.length&&(g=[]);else if(c||g.length)if(b=E(a.keyCode))return c?X(b,a):H(b,a)};N=function(a){var c,b,d,e;e=[];c=b=0;for(d=k.length;0<=d?bd;c=0<=d?++b:--b)if(a===k[c]){k.splice(c,1);break}else e.push(void 0);return e};Z=function(a){var c,b,d,e,f;a.keys.length||r("You're trying to bind a combo with no keys."); b=e=0;for(f=a.keys.length;0<=f?ef;b=0<=f?++e:--e){d=a.keys[b];(c=Y[d])&&(d=a.keys[b]=c);d==="meta"&&a.keys.splice(b,1,s);d==="cmd"&&r('Warning: use the "meta" key rather than "cmd" for Windows compatibility')}f=a.keys;c=0;for(e=f.length;c=0||h.call(a.keys,"cmd")>=0){c=a.keys.slice();e=0;for(f=K.length;e-1&&c.splice(b,1)}c.length>1&&r("META and CMD key combos cannot have more than 1 non-modifier keys", a,c)}return true};R=function(a){var c;if(h.call(g,"cmd")>=0&&(c=E(a.keyCode))!=="cmd"&&c!=="shift"&&c!=="alt"&&c!=="caps"&&c!=="tab")return A(a,false)};window.keypress={};keypress.force_event_defaults=!1;keypress.suppress_event_defaults=!1;keypress.sequence_delay=800;keypress.reset=function(){k=[]};keypress.combo=function(a,c,b){b==null&&(b=false);return keypress.register_combo({keys:a,on_keydown:c,prevent_default:b})};keypress.counting_combo=function(a,c,b){b==null&&(b=false);return keypress.register_combo({keys:a, is_counting:true,is_ordered:true,on_keydown:c,prevent_default:b})};keypress.sequence_combo=function(a,c,b){b==null&&(b=false);return keypress.register_combo({keys:a,on_keydown:c,is_sequence:true,prevent_default:b})};keypress.register_combo=function(a){var c,b;if(typeof a.keys==="string")a.keys=a.keys.split(" ");for(c in x)if(aa.call(x,c)){b=x[c];a[c]==null&&(a[c]=b)}if(Z(a)){k.push(a);return true}};keypress.register_many=function(a){var c,b,d,e;e=[];b=0;for(d=a.length;b",",":"<","'":'"',";":":","[":"{","]":"}","\\":"|","`":"~","=":"+","-":"_",1:"!",2:"@",3:"#",4:"$",5:"%",6:"^",7:"&",8:"*",9:"(","0":")"};n={"0":"\\",8:"backspace",9:"tab",12:"num",13:"enter",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"caps",27:"escape",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:"'",224:"cmd",57392:"ctrl",63289:"num"};for(w in n)v=n[w],C.push(v);for(w in q)v=q[w],C.push(v);-1!==navigator.userAgent.indexOf("Mac OS X")&&(s="cmd");-1!==navigator.userAgent.indexOf("Opera")&&(n["17"]="cmd");L=function(a){return/loading/.test(document.readyState)?setTimeout(function(){return L(a)},9):a()};L(function(){document.body.onkeydown= function(a){a=a||window.event;A(a,true);return R(a)};document.body.onkeyup=function(a){a=a||window.event;return A(a,false)};return window.onblur=function(){var a,c,b;c=0;for(b=g.length;c