-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathspectingular.min.js
2 lines (2 loc) · 4.77 KB
/
spectingular.min.js
1
2
/*! Built by Spectingular on 02-11-2015 20:50:26 */
angular.module("sp.utility",[]),angular.module("sp.i18n",["sp.utility"]),angular.module("sp.binding",[]),angular.module("sp.binding").directive("spBindOnce",["$timeout",function(a){return{scope:!0,link:function(b){a(function(){b.$destroy()},0)}}}]),angular.module("sp.binding").factory("spKeyBinder",["$rootScope","$document","spKeyBinderConfig",function(a,b,c){function d(a,b,d){b=angular.extend({},c.defaultOptions(),b);var e=angular.isString(b.target)?angular.element(document.querySelector("#"+b.target)):b.target;angular.isUndefined(a)&&(a="mousedown"),d(a,b,e)}function e(e,f,h){d(e,h,function(d,e,h){var i=e.target===b?"document":e.target,j=!1;angular.isUndefined(g[e.type])&&(g[e.type]={count:0},g[e.type].elements={}),angular.isUndefined(g[e.type].elements[i])&&(j=!0,g[e.type].elements[i]={count:0,keyCombinations:{}}),angular.isUndefined(g[e.type].elements[i].keyCombinations[d])?(g[e.type].count++,g[e.type].elements[i].count++,g[e.type].elements[i].keyCombinations[d]={},g[e.type].elements[i].keyCombinations[d].count=1):(g[e.type].count++,g[e.type].elements[i].count++,g[e.type].elements[i].keyCombinations[d].count++),g[e.type].elements[i].keyCombinations[d].callback=f,j&&h.on(e.type,function(b){var d=angular.isDefined(b.delegateTarget.id)?b.delegateTarget.id:"document",f=g[e.type].elements[d].keyCombinations;for(var h in f){var j=h.split("+"),k={shift:j.indexOf("shift")>-1,ctrl:j.indexOf("ctrl")>-1,alt:j.indexOf("alt")>-1};j.indexOf("shift")>-1&&j.splice(j.indexOf("shift"),1),j.indexOf("ctrl")>-1&&j.splice(j.indexOf("ctrl"),1),j.indexOf("alt")>-1&&j.splice(j.indexOf("alt"),1);var l=b.keyCode?b.keyCode:b.which?b.which:void 0,m=String.fromCharCode(l).toLowerCase(),n=c.specialKeys()[j];if(k.shift===(b.shiftKey?!0:!1)&&k.ctrl===(b.ctrlKey?!0:!1)&&k.alt===(b.altKey?!0:!1)&&(j.indexOf(m)>-1||angular.isDefined(n)&&n===l))if(angular.isDefined(g[e.type].elements[i].keyCombinations[h].callback))g[e.type].elements[i].keyCombinations[h].callback();else{var o=b.type;1!==l&&(o=o+"-"+h),a.$broadcast(o)}}})})}function f(a,c){d(a,c,function(a,c,d){var e=c.target===b?"document":c.target;angular.isDefined(g[c.type])&&angular.isDefined(g[c.type].elements[e])&&angular.isDefined(g[c.type].elements[e].keyCombinations[a].count)&&(g[c.type].elements[e].keyCombinations[a].count--,g[c.type].elements[e].count--,g[c.type].count--,0===g[c.type].elements[e].keyCombinations[a].count&&delete g[c.type].elements[e].keyCombinations[a],0===g[c.type].elements[e].count&&(delete g[c.type].elements[e],d.off(c.type)),0===g[c.type].count&&delete g[c.type])})}var g={};return{handlers:g,bind:e,unbind:f}}]),angular.module("sp.binding").provider("spKeyBinderConfig",function(){this.defaultOptions={type:"keydown"},this.specialKeys={mousedown:1,backspace:8,tab:9,enter:13,"break":19,capslock:20,escape:27,space:32,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,"delete":46,numlock:144,scroll:145,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123},this.setDefaultTarget=function(a){this.defaultOptions.target=a},this.setDefaultType=function(a){this.defaultOptions.type=a},this.$get=["$document",function(a){var b=this.defaultOptions,c=this.specialKeys;return angular.isUndefined(b.target)&&(b.target=a),{defaultOptions:function(){return b},specialKeys:function(){return c}}}]}),angular.module("sp.i18n").provider("spProperties",function(){this.propertyStore={},this.add=function(a,b,c){var d=this.propertyStore;angular.isUndefined(d[a])&&(d[a]={},d[a][c]={}),angular.isUndefined(d[a][c])&&(d[a][c]={}),angular.forEach(b,function(b,e){d[a][c][e]=b})},this.$get=["spUtils",function(a){var b=this.propertyStore;return{property:function(c,d,e){return a.traverse(b,[c,e,d])},properties:function(c,d){return a.traverse(b,[c,d])}}}]}),angular.module("sp.i18n").directive("spProperty",["spProperties","spPropertyConfig","$compile",function(a,b,c){return{restrict:"EA",scope:!1,link:function(d,e,f){var g=angular.isDefined(f.identifier)?f.identifier:b.defaultIdentifier,h=angular.isDefined(f.locale)?f.locale:b.defaultLocale;e.html(a.property(g,f.key,h)),c(e.contents())(d)}}}]),angular.module("sp.i18n").provider("spPropertyConfig",function(){this.defaultOptions={identifier:void 0},this.setDefaultIdentifier=function(a){this.defaultOptions.identifier=a},this.setDefaultLocale=function(a){this.defaultOptions.locale=a},this.$get=["$locale",function(a){var b=this.defaultOptions;return angular.isUndefined(b.locale)&&(b.locale=a.id),{defaultIdentifier:b.identifier,defaultLocale:b.locale}}]}),angular.module("sp.utility").service("spUtils",function(){function a(b,c){if(0===c.length)return b;var d=c.shift(),e=b[d];return angular.isDefined(e)?a(e,c):void 0}var b={};return b.traverse=a,b.traverseOrDefault=function(a,c,d){var e=b.traverse(a,c);return angular.isDefined(e)?e:d},b});