angular-egg
Version:
An AngularJS Directive implementation of egg.js by Mike Flynn
11 lines (10 loc) • 1.46 kB
JavaScript
/**
* angular-egg - An AngularJS Directive implementation of egg.js by Mike Flynn
* @author Paul Massey, paul.massey@scriptwerx.io
* @version v0.0.6
* @build 25 - Tue Nov 10 2015 12:33:33 GMT+0000 (GMT)
* @link http://www.scriptwerx.io
* @license MIT
*/
!function(e){"use strict";function t(e){var t={up:38,down:40,left:37,right:39,enter:13,space:32,ctrl:7,alt:8,tab:9},n=Object.keys(t);e=e.split(",").map(function(e){return e.trim()});var i=e.map(function(e){return isNaN(parseInt(e,10))?n.indexOf(e)>-1?t[e]:e.charCodeAt(0):e});return i.join(",")}function n(e){function n(n,u,c,f){function l(e){var t,i=e.which,c=i>=65&&90>=i;if(!("keydown"!==e.type||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)){var l=e.target.tagName;if(("HTML"===l||"BODY"===l)&&c)return void e.preventDefault()}if("keyup"===e.type)if(c&&!e.shiftKey&&(i+=32),-1===r.indexOf(i)&&o.push(i),t=o.toString().indexOf(a)>=0)o=[],u.css("display","block"),n.$apply(function(){f.$setViewValue(!0)});else if(o.length>10){var s=o.toString(),d=a.split(",")[0];d&&-1!==s.indexOf(d)?(s=s.substr(s.indexOf(d)),s.length>a.length&&(o=[])):o=[]}}f.$setViewValue(!1),u.css("display","none"),a=t(c.keycode?c.keycode:i),e.on("keydown",l),e.on("keyup",l)}var a,o=[];return{restrict:"EA",require:"^ngModel",scope:!0,link:n}}var i="38,up,40,down,left,right,left,right,b,a",r=[16];n.$inject=["$document"],e.module("ngEgg",[]).directive("ngEgg",n)}(window.angular);
//# sourceMappingURL=angular-egg.min.js.map