/*! * angular-loading-bar v0.8.0 * https://chieffancypants.github.io/angular-loading-bar * Copyright (c) 2015 Wes Cruver * License: MIT */ !function () { "use strict"; angular.module("angular-loading-bar", ["cfp.loadingBarInterceptor"]), angular.module("chieffancypants.loadingBar", ["cfp.loadingBarInterceptor"]), angular.module("cfp.loadingBarInterceptor", ["cfp.loadingBar"]).config(["$httpProvider", function (a) { var b = ["$q", "$cacheFactory", "$timeout", "$rootScope", "$log", "cfpLoadingBar", function (b, c, d, e, f, g) { function h() { d.cancel(j), g.complete(), l = 0, k = 0 } function i(b) { var d, e = c.get("$http"), f = a.defaults; !b.cache && !f.cache || b.cache === !1 || "GET" !== b.method && "JSONP" !== b.method || (d = angular.isObject(b.cache) ? b.cache : angular.isObject(f.cache) ? f.cache : e); var g = void 0 !== d ? void 0 !== d.get(b.url) : !1; return void 0 !== b.cached && g !== b.cached ? b.cached : (b.cached = g, g) } var j, k = 0, l = 0, m = g.latencyThreshold; return { request: function (a) { return a.ignoreLoadingBar || i(a) || (e.$broadcast("cfpLoadingBar:loading", {url: a.url}), 0 === k && (j = d(function () { g.start() }, m)), k++, g.set(l / k)), a }, response: function (a) { return a && a.config ? (a.config.ignoreLoadingBar || i(a.config) || (l++, e.$broadcast("cfpLoadingBar:loaded", { url: a.config.url, result: a }), l >= k ? h() : g.set(l / k)), a) : (f.error("Broken interceptor detected: Config object not supplied in response:\n https://github.com/chieffancypants/angular-loading-bar/pull/50"), a) }, responseError: function (a) { return a && a.config ? (a.config.ignoreLoadingBar || i(a.config) || (l++, e.$broadcast("cfpLoadingBar:loaded", { url: a.config.url, result: a }), l >= k ? h() : g.set(l / k)), b.reject(a)) : (f.error("Broken interceptor detected: Config object not supplied in rejection:\n https://github.com/chieffancypants/angular-loading-bar/pull/50"), b.reject(a)) } } }]; a.interceptors.push(b) }]), angular.module("cfp.loadingBar", []).provider("cfpLoadingBar", function () { this.autoIncrement = !0, this.includeSpinner = !0, this.includeBar = !0, this.latencyThreshold = 100, this.startSize = .02, this.parentSelector = "body", this.spinnerTemplate = '
', this.loadingBarTemplate = '
', this.$get = ["$injector", "$document", "$timeout", "$rootScope", function (a, b, c, d) { function e() { k || (k = a.get("$animate")); var e = b.find(n).eq(0); c.cancel(m), r || (d.$broadcast("cfpLoadingBar:started"), r = !0, v && k.enter(o, e, angular.element(e[0].lastChild)), u && k.enter(q, e, angular.element(e[0].lastChild)), f(w)) } function f(a) { if (r) { var b = 100 * a + "%"; p.css("width", b), s = a, t && (c.cancel(l), l = c(function () { g() }, 250)) } } function g() { if (!(h() >= 1)) { var a = 0, b = h(); a = b >= 0 && .25 > b ? (3 * Math.random() + 3) / 100 : b >= .25 && .65 > b ? 3 * Math.random() / 100 : b >= .65 && .9 > b ? 2 * Math.random() / 100 : b >= .9 && .99 > b ? .005 : 0; var c = h() + a; f(c) } } function h() { return s } function i() { s = 0, r = !1 } function j() { k || (k = a.get("$animate")), d.$broadcast("cfpLoadingBar:completed"), f(1), c.cancel(m), m = c(function () { var a = k.leave(o, i); a && a.then && a.then(i), k.leave(q) }, 500) } var k, l, m, n = this.parentSelector, o = angular.element(this.loadingBarTemplate), p = o.find("div").eq(0), q = angular.element(this.spinnerTemplate), r = !1, s = 0, t = this.autoIncrement, u = this.includeSpinner, v = this.includeBar, w = this.startSize; return { start: e, set: f, status: h, inc: g, complete: j, autoIncrement: this.autoIncrement, includeSpinner: this.includeSpinner, latencyThreshold: this.latencyThreshold, parentSelector: this.parentSelector, startSize: this.startSize } }] }) }();