-
Notifications
You must be signed in to change notification settings - Fork 0
/
ng-responsive.min.js
1 lines (1 loc) · 1.55 KB
/
ng-responsive.min.js
1
(function(){this.ResponsiveHandler=function(){function a(a){var d,e,f,g=this;this.config=a,this.action_queue=[],this.waiting_stack=[],f=function(a){return g[e]=function(d){var f,g,h,i;if(0===arguments.length)this.waiting_stack.push({name:e,breakpoint:a});else{for(this.waiting_stack.push({name:e,breakpoint:a}),i=this.waiting_stack,g=0,h=i.length;h>g;g++)f=i[g],this.action_queue.push({min_size:c(f.breakpoint),max_size:b(f.breakpoint),lambda:d});this.waiting_stack=[]}return this}};for(e in a)d=a[e],f(d)}var b,c,d;return d=function(a){return/^max/.test(a)?1/0:parseInt(a.slice(0,-2))},c=function(a){return d(a.match(/(.+)\-(.+)/)[1])},b=function(a){return d(a.match(/(.+)\-(.+)/)[2])},a.prototype.setInjector=function(a){return this.injector=a},a.prototype.invokeActionsForScreenSize=function(a){var b,c,d,e,f;for(e=this.action_queue,f=[],c=0,d=e.length;d>c;c++)b=e[c],b.min_size<a&&a<=b.max_size?this.injector?f.push(this.injector.invoke(b.lambda)):f.push(b.lambda.apply(document)):f.push(void 0);return f},a}()}).call(this),function(){angular.module("ngResponsive",[]).provider("$responsive",function(){this.setBreakpoints=function(a){return this.breakpoints=a},this.$get=["$injector","$rootScope","$window",function(a){var b;return b=new ResponsiveHandler(this.breakpoints),b.setInjector(a),b}]}).run(["$responsive","$rootScope","$window",function(a,b,c){return b.windowWidth=c.outerWidth,angular.element(c).bind("resize",function(){return b.windowWidth=c.outerWidth,b.$apply("windowWidth")}),b.$watch("windowWidth",function(b){return a.invokeActionsForScreenSize(b)})}])}.call(this);