diff --git a/Gruntfile.js b/Gruntfile.js index b9f0e6b..c0f3d04 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -21,7 +21,7 @@ module.exports = function (grunt) { banner: '/*\n<%= pkg.name %> <%= pkg.version %> - <%= pkg.description %> \n(C) 2013 - <%= pkg.author %> \nLicense: <%= pkg.license %> \nSource: <%= pkg.url %> \nDate Compiled: <%= grunt.template.today("yyyy-mm-dd") %> \n*/\n' }, dist: { - src: ['src/provider.js', 'src/directive.js', 'src/module.js'], + src: ['module.before.txt', 'src/provider.js', 'src/directive.js', 'src/module.js', 'module.after.txt'], dest: 'build/<%= pkg.name %>.js' } }, diff --git a/build/ngprogress.js b/build/ngprogress.js index 1527a4b..177ab84 100644 --- a/build/ngprogress.js +++ b/build/ngprogress.js @@ -1,10 +1,24 @@ /* -ngprogress 1.1.2 - slim, site-wide progressbar for AngularJS +ngprogress 1.1.3 - slim, site-wide progressbar for AngularJS (C) 2013 - Victor Bjelkholm License: MIT Source: https://github.com/VictorBjelkholm/ngProgress -Date Compiled: 2015-07-27 +Date Compiled: 2016-04-07 */ +(function (root, factory) { + if (typeof module !== 'undefined' && module.exports) { + // CommonJS + module.exports = factory(require('angular')); + } else if (typeof define === 'function' && define.amd) { + // AMD + define(['angular'], factory); + } else { + // Global Variables + factory(root.angular); + } +}(this, function (angular, undefined) { + 'use strict'; + angular.module('ngProgress.provider', ['ngProgress.directive']) .service('ngProgress', function () { 'use strict'; @@ -217,4 +231,5 @@ angular.module('ngProgress.directive', []) return directiveObj; }]); -angular.module('ngProgress', ['ngProgress.directive', 'ngProgress.provider']); \ No newline at end of file +angular.module('ngProgress', ['ngProgress.directive', 'ngProgress.provider']); +})); \ No newline at end of file diff --git a/build/ngprogress.min.js b/build/ngprogress.min.js index 177e552..8d84fc8 100644 --- a/build/ngprogress.min.js +++ b/build/ngprogress.min.js @@ -1,8 +1,8 @@ /* -ngprogress 1.1.2 - slim, site-wide progressbar for AngularJS +ngprogress 1.1.3 - slim, site-wide progressbar for AngularJS (C) 2013 - Victor Bjelkholm License: MIT Source: https://github.com/VictorBjelkholm/ngProgress -Date Compiled: 2015-07-27 +Date Compiled: 2016-04-07 */ -angular.module("ngProgress.provider",["ngProgress.directive"]).service("ngProgress",function(){"use strict";return["$document","$window","$compile","$rootScope","$timeout",function(a,b,c,d,e){this.autoStyle=!0,this.count=0,this.height="2px",this.$scope=d.$new(),this.color="firebrick",this.parent=a.find("body")[0],this.count=0,this.progressbarEl=c("")(this.$scope),this.parent.appendChild(this.progressbarEl[0]),this.$scope.count=this.count,void 0!==this.height&&this.progressbarEl.eq(0).children().css("height",this.height),void 0!==this.color&&(this.progressbarEl.eq(0).children().css("background-color",this.color),this.progressbarEl.eq(0).children().css("color",this.color)),this.intervalCounterId=0,this.start=function(){this.show();var a=this;clearInterval(this.intervalCounterId),this.intervalCounterId=setInterval(function(){isNaN(a.count)?(clearInterval(a.intervalCounterId),a.count=0,a.hide()):(a.remaining=100-a.count,a.count=a.count+.15*Math.pow(1-Math.sqrt(a.remaining),2),a.updateCount(a.count))},200)},this.updateCount=function(a){this.$scope.count=a,this.$scope.$$phase||this.$scope.$apply()},this.setHeight=function(a){return void 0!==a&&(this.height=a,this.$scope.height=this.height,this.$scope.$$phase||this.$scope.$apply()),this.height},this.setColor=function(a){return void 0!==a&&(this.color=a,this.$scope.color=this.color,this.$scope.$$phase||this.$scope.$apply()),this.color},this.hide=function(){this.progressbarEl.children().css("opacity","0");var a=this;a.animate(function(){a.progressbarEl.children().css("width","0%"),a.animate(function(){a.show()},500)},500)},this.show=function(){var a=this;a.animate(function(){a.progressbarEl.children().css("opacity","1")},100)},this.animate=function(a,b){void 0!==this.animation&&e.cancel(this.animation),this.animation=e(a,b)},this.status=function(){return this.count},this.stop=function(){clearInterval(this.intervalCounterId)},this.set=function(a){return this.show(),this.updateCount(a),this.count=a,clearInterval(this.intervalCounterId),this.count},this.css=function(a){return this.progressbarEl.children().css(a)},this.reset=function(){return clearInterval(this.intervalCounterId),this.count=0,this.updateCount(this.count),0},this.complete=function(){this.count=100,this.updateCount(this.count);var a=this;return clearInterval(this.intervalCounterId),e(function(){a.hide(),e(function(){a.count=0,a.updateCount(a.count)},500)},1e3),this.count},this.setParent=function(a){if(null===a||void 0===a)throw new Error("Provide a valid parent of type HTMLElement");null!==this.parent&&void 0!==this.parent&&this.parent.removeChild(this.progressbarEl[0]),this.parent=a,this.parent.appendChild(this.progressbarEl[0])},this.getDomElement=function(){return this.progressbarEl},this.setAbsolute=function(){this.progressbarEl.css("position","absolute")}}]}).factory("ngProgressFactory",["$injector","ngProgress",function(a,b){var c={createInstance:function(){return a.instantiate(b)}};return c}]),angular.module("ngProgress.directive",[]).directive("ngProgress",["$window","$rootScope",function(a,b){var c={replace:!0,restrict:"E",link:function(a,b,c,d){a.$watch("count",function(c){(void 0!==c||null!==c)&&(a.counter=c,b.eq(0).children().css("width",c+"%"))}),a.$watch("color",function(c){(void 0!==c||null!==c)&&(a.color=c,b.eq(0).children().css("background-color",c),b.eq(0).children().css("color",c))}),a.$watch("height",function(c){(void 0!==c||null!==c)&&(a.height=c,b.eq(0).children().css("height",c))})},template:'
'};return c}]),angular.module("ngProgress",["ngProgress.directive","ngProgress.provider"]); \ No newline at end of file +!function(a,b){"undefined"!=typeof module&&module.exports?module.exports=b(require("angular")):"function"==typeof define&&define.amd?define(["angular"],b):b(a.angular)}(this,function(a,b){"use strict";a.module("ngProgress.provider",["ngProgress.directive"]).service("ngProgress",function(){return["$document","$window","$compile","$rootScope","$timeout",function(a,c,d,e,f){this.autoStyle=!0,this.count=0,this.height="2px",this.$scope=e.$new(),this.color="firebrick",this.parent=a.find("body")[0],this.count=0,this.progressbarEl=d("")(this.$scope),this.parent.appendChild(this.progressbarEl[0]),this.$scope.count=this.count,this.height!==b&&this.progressbarEl.eq(0).children().css("height",this.height),this.color!==b&&(this.progressbarEl.eq(0).children().css("background-color",this.color),this.progressbarEl.eq(0).children().css("color",this.color)),this.intervalCounterId=0,this.start=function(){this.show();var a=this;clearInterval(this.intervalCounterId),this.intervalCounterId=setInterval(function(){isNaN(a.count)?(clearInterval(a.intervalCounterId),a.count=0,a.hide()):(a.remaining=100-a.count,a.count=a.count+.15*Math.pow(1-Math.sqrt(a.remaining),2),a.updateCount(a.count))},200)},this.updateCount=function(a){this.$scope.count=a,this.$scope.$$phase||this.$scope.$apply()},this.setHeight=function(a){return a!==b&&(this.height=a,this.$scope.height=this.height,this.$scope.$$phase||this.$scope.$apply()),this.height},this.setColor=function(a){return a!==b&&(this.color=a,this.$scope.color=this.color,this.$scope.$$phase||this.$scope.$apply()),this.color},this.hide=function(){this.progressbarEl.children().css("opacity","0");var a=this;a.animate(function(){a.progressbarEl.children().css("width","0%"),a.animate(function(){a.show()},500)},500)},this.show=function(){var a=this;a.animate(function(){a.progressbarEl.children().css("opacity","1")},100)},this.animate=function(a,c){this.animation!==b&&f.cancel(this.animation),this.animation=f(a,c)},this.status=function(){return this.count},this.stop=function(){clearInterval(this.intervalCounterId)},this.set=function(a){return this.show(),this.updateCount(a),this.count=a,clearInterval(this.intervalCounterId),this.count},this.css=function(a){return this.progressbarEl.children().css(a)},this.reset=function(){return clearInterval(this.intervalCounterId),this.count=0,this.updateCount(this.count),0},this.complete=function(){this.count=100,this.updateCount(this.count);var a=this;return clearInterval(this.intervalCounterId),f(function(){a.hide(),f(function(){a.count=0,a.updateCount(a.count)},500)},1e3),this.count},this.setParent=function(a){if(null===a||a===b)throw new Error("Provide a valid parent of type HTMLElement");null!==this.parent&&this.parent!==b&&this.parent.removeChild(this.progressbarEl[0]),this.parent=a,this.parent.appendChild(this.progressbarEl[0])},this.getDomElement=function(){return this.progressbarEl},this.setAbsolute=function(){this.progressbarEl.css("position","absolute")}}]}).factory("ngProgressFactory",["$injector","ngProgress",function(a,b){var c={createInstance:function(){return a.instantiate(b)}};return c}]),a.module("ngProgress.directive",[]).directive("ngProgress",["$window","$rootScope",function(a,c){var d={replace:!0,restrict:"E",link:function(a,c,d,e){a.$watch("count",function(d){(d!==b||null!==d)&&(a.counter=d,c.eq(0).children().css("width",d+"%"))}),a.$watch("color",function(d){(d!==b||null!==d)&&(a.color=d,c.eq(0).children().css("background-color",d),c.eq(0).children().css("color",d))}),a.$watch("height",function(d){(d!==b||null!==d)&&(a.height=d,c.eq(0).children().css("height",d))})},template:'
'};return d}]),a.module("ngProgress",["ngProgress.directive","ngProgress.provider"])}); \ No newline at end of file diff --git a/module.after.txt b/module.after.txt new file mode 100644 index 0000000..57d3e48 --- /dev/null +++ b/module.after.txt @@ -0,0 +1 @@ +})); \ No newline at end of file diff --git a/module.before.txt b/module.before.txt new file mode 100644 index 0000000..2706934 --- /dev/null +++ b/module.before.txt @@ -0,0 +1,13 @@ +(function (root, factory) { + if (typeof module !== 'undefined' && module.exports) { + // CommonJS + module.exports = factory(require('angular')); + } else if (typeof define === 'function' && define.amd) { + // AMD + define(['angular'], factory); + } else { + // Global Variables + factory(root.angular); + } +}(this, function (angular, undefined) { + 'use strict'; diff --git a/package.json b/package.json index 0b8b855..4574001 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "ngprogress", - "version": "1.1.3", + "version": "1.1.3", "description": "slim, site-wide progressbar for AngularJS", - "main": "ngProgress.js", + "main": "build/ngprogress.js", "repository": { "type": "git", "url": "git://github.com/VictorBjelkholm/ngProgress.git" @@ -24,6 +24,7 @@ "url": "https://github.com/VictorBjelkholm/ngProgress/issues" }, "devDependencies": { + "grunt": "^0.4.0", "grunt-contrib-concat": "~0.3.0", "grunt-contrib-jshint": "~0.6.0", "grunt-contrib-uglify": "~0.2.2",