1
- // ProgressBar.js 1.0.0
1
+ // ProgressBar.js 1.0.1
2
2
// https://kimmobrunfeldt.github.io/progressbar.js
3
3
// License: MIT
4
4
5
- ! function ( e ) { if ( "object" == typeof exports && "undefined" != typeof module ) module . exports = e ( ) ; else if ( "function" == typeof define && define . amd ) define ( [ ] , e ) ; else { var f ; "undefined" != typeof window ? f = window : "undefined" != typeof global ? f = global : "undefined" != typeof self && ( f = self ) , f . ProgressBar = e ( ) } } ( function ( ) { var define , module , exports ; return ( function e ( t , n , r ) { function s ( o , u ) { if ( ! n [ o ] ) { if ( ! t [ o ] ) { var a = typeof require == "function" && require ; if ( ! u && a ) return a ( o , ! 0 ) ; if ( i ) return i ( o , ! 0 ) ; var f = new Error ( "Cannot find module '" + o + "'" ) ; throw f . code = "MODULE_NOT_FOUND" , f } var l = n [ o ] = { exports :{ } } ; t [ o ] [ 0 ] . call ( l . exports , function ( e ) { var n = t [ o ] [ 1 ] [ e ] ; return s ( n ?n :e ) } , l , l . exports , e , t , n , r ) } return n [ o ] . exports } var i = typeof require == "function" && require ; for ( var o = 0 ; o < r . length ; o ++ ) s ( r [ o ] ) ; return s } ) ( { 1 :[ function ( require , module , exports ) {
5
+ ( function ( f ) { if ( typeof exports === "object" && typeof module !== "undefined" ) { module . exports = f ( ) } else if ( typeof define === "function" && define . amd ) { define ( [ ] , f ) } else { var g ; if ( typeof window !== "undefined" ) { g = window } else if ( typeof global !== "undefined" ) { g = global } else if ( typeof self !== "undefined" ) { g = self } else { g = this } g . ProgressBar = f ( ) } } ) ( function ( ) { var define , module , exports ; return ( function e ( t , n , r ) { function s ( o , u ) { if ( ! n [ o ] ) { if ( ! t [ o ] ) { var a = typeof require == "function" && require ; if ( ! u && a ) return a ( o , ! 0 ) ; if ( i ) return i ( o , ! 0 ) ; var f = new Error ( "Cannot find module '" + o + "'" ) ; throw f . code = "MODULE_NOT_FOUND" , f } var l = n [ o ] = { exports :{ } } ; t [ o ] [ 0 ] . call ( l . exports , function ( e ) { var n = t [ o ] [ 1 ] [ e ] ; return s ( n ?n :e ) } , l , l . exports , e , t , n , r ) } return n [ o ] . exports } var i = typeof require == "function" && require ; for ( var o = 0 ; o < r . length ; o ++ ) s ( r [ o ] ) ; return s } ) ( { 1 :[ function ( require , module , exports ) {
6
6
/* shifty - v1.5.2 - 2016-02-10 - http://jeremyckahn.github.io/shifty */
7
7
; ( function ( ) {
8
8
var root = this || Function ( 'return this' ) ( ) ;
@@ -1760,6 +1760,11 @@ var EASING_ALIASES = {
1760
1760
} ;
1761
1761
1762
1762
var Path = function Path ( path , opts ) {
1763
+ // Throw a better error if not initialized with `new` keyword
1764
+ if ( ! ( this instanceof Path ) ) {
1765
+ throw new Error ( 'Constructor was called without new keyword' ) ;
1766
+ }
1767
+
1763
1768
// Default parameters for animation
1764
1769
opts = utils . extend ( {
1765
1770
duration : 800 ,
@@ -2013,13 +2018,14 @@ var Shape = function Shape(container, opts) {
2013
2018
} ,
2014
2019
autoStyleContainer : true ,
2015
2020
alignToBottom : true ,
2016
- value : '' ,
2021
+ value : null ,
2017
2022
className : 'progressbar-text'
2018
2023
} ,
2019
2024
svgStyle : {
2020
2025
display : 'block' ,
2021
2026
width : '100%'
2022
- }
2027
+ } ,
2028
+ warnings : false
2023
2029
} , opts , true ) ; // Use recursive extend
2024
2030
2025
2031
// If user specifies e.g. svgStyle or text style, the whole object
@@ -2046,7 +2052,9 @@ var Shape = function Shape(container, opts) {
2046
2052
2047
2053
this . _container = element ;
2048
2054
this . _container . appendChild ( svgView . svg ) ;
2049
- this . _warnContainerAspectRatio ( this . _container ) ;
2055
+ if ( this . _opts . warnings ) {
2056
+ this . _warnContainerAspectRatio ( this . _container ) ;
2057
+ }
2050
2058
2051
2059
if ( this . _opts . svgStyle ) {
2052
2060
utils . setStyles ( svgView . svg , this . _opts . svgStyle ) ;
@@ -2064,7 +2072,7 @@ var Shape = function Shape(container, opts) {
2064
2072
} , this . _opts ) ;
2065
2073
this . _progressPath = new Path ( svgView . path , newOpts ) ;
2066
2074
2067
- if ( utils . isObject ( this . _opts . text ) && this . _opts . text . value ) {
2075
+ if ( utils . isObject ( this . _opts . text ) && this . _opts . text . value !== null ) {
2068
2076
this . setText ( this . _opts . text . value ) ;
2069
2077
}
2070
2078
} ;
@@ -2265,7 +2273,7 @@ Shape.prototype._warnContainerAspectRatio = function _warnContainerAspectRatio(c
2265
2273
if ( ! utils . floatEquals ( this . containerAspectRatio , width / height ) ) {
2266
2274
console . warn (
2267
2275
'Incorrect aspect ratio of container' ,
2268
- this . _container ,
2276
+ '#' + container . id ,
2269
2277
'detected:' ,
2270
2278
computedStyle . getPropertyValue ( 'width' ) + '(width)' ,
2271
2279
'/' ,
0 commit comments