1- // ProgressBar.js 0.7.4
1+ // ProgressBar.js 0.8.0
22// https://kimmobrunfeldt.github.io/progressbar.js
33// License: MIT
44
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 ) {
66/*! shifty - v1.2.2 - 2014-10-09 - http://jeremyckahn.github.io/shifty */
77; ( function ( root ) {
88
@@ -1493,19 +1493,27 @@ var Path = function Path(path, opts) {
14931493 step : function ( ) { }
14941494 } , opts ) ;
14951495
1496- this . _path = path ;
1496+ var element ;
1497+ if ( utils . isString ( path ) ) {
1498+ element = document . querySelector ( path ) ;
1499+ } else {
1500+ element = path ;
1501+ }
1502+
1503+ // Reveal .path as public attribute
1504+ this . path = element ;
14971505 this . _opts = opts ;
14981506 this . _tweenable = null ;
14991507
15001508 // Set up the starting positions
1501- var length = this . _path . getTotalLength ( ) ;
1502- this . _path . style . strokeDasharray = length + ' ' + length ;
1509+ var length = this . path . getTotalLength ( ) ;
1510+ this . path . style . strokeDasharray = length + ' ' + length ;
15031511 this . set ( 0 ) ;
15041512} ;
15051513
15061514Path . prototype . value = function value ( ) {
15071515 var offset = this . _getComputedDashOffset ( ) ;
1508- var length = this . _path . getTotalLength ( ) ;
1516+ var length = this . path . getTotalLength ( ) ;
15091517
15101518 var progress = 1 - offset / length ;
15111519 // Round number to prevent returning very small number like 1e-30, which
@@ -1516,19 +1524,19 @@ Path.prototype.value = function value() {
15161524Path . prototype . set = function set ( progress ) {
15171525 this . stop ( ) ;
15181526
1519- this . _path . style . strokeDashoffset = this . _progressToOffset ( progress ) ;
1527+ this . path . style . strokeDashoffset = this . _progressToOffset ( progress ) ;
15201528
15211529 var step = this . _opts . step ;
15221530 if ( utils . isFunction ( step ) ) {
15231531 var easing = this . _easing ( this . _opts . easing ) ;
15241532 var values = this . _calculateTo ( progress , easing ) ;
1525- step ( values , this . _opts . attachment || this ) ;
1533+ step ( values , this . _opts . shape || this , this . _opts . attachment ) ;
15261534 }
15271535} ;
15281536
15291537Path . prototype . stop = function stop ( ) {
15301538 this . _stopTween ( ) ;
1531- this . _path . style . strokeDashoffset = this . _getComputedDashOffset ( ) ;
1539+ this . path . style . strokeDashoffset = this . _getComputedDashOffset ( ) ;
15321540} ;
15331541
15341542// Method introduced here:
@@ -1554,7 +1562,7 @@ Path.prototype.animate = function animate(progress, opts, cb) {
15541562
15551563 // Trigger a layout so styles are calculated & the browser
15561564 // picks up the starting position before animating
1557- this . _path . getBoundingClientRect ( ) ;
1565+ this . path . getBoundingClientRect ( ) ;
15581566
15591567 var offset = this . _getComputedDashOffset ( ) ;
15601568 var newOffset = this . _progressToOffset ( progress ) ;
@@ -1567,8 +1575,8 @@ Path.prototype.animate = function animate(progress, opts, cb) {
15671575 duration : opts . duration ,
15681576 easing : shiftyEasing ,
15691577 step : function ( state ) {
1570- self . _path . style . strokeDashoffset = state . offset ;
1571- opts . step ( state , opts . attachment ) ;
1578+ self . path . style . strokeDashoffset = state . offset ;
1579+ opts . step ( state , opts . shape || self , opts . attachment ) ;
15721580 } ,
15731581 finish : function ( state ) {
15741582 if ( utils . isFunction ( cb ) ) {
@@ -1579,12 +1587,12 @@ Path.prototype.animate = function animate(progress, opts, cb) {
15791587} ;
15801588
15811589Path . prototype . _getComputedDashOffset = function _getComputedDashOffset ( ) {
1582- var computedStyle = window . getComputedStyle ( this . _path , null ) ;
1590+ var computedStyle = window . getComputedStyle ( this . path , null ) ;
15831591 return parseFloat ( computedStyle . getPropertyValue ( 'stroke-dashoffset' ) , 10 ) ;
15841592} ;
15851593
15861594Path . prototype . _progressToOffset = function _progressToOffset ( progress ) {
1587- var length = this . _path . getTotalLength ( ) ;
1595+ var length = this . path . getTotalLength ( ) ;
15881596 return length - progress * length ;
15891597} ;
15901598
@@ -1699,7 +1707,8 @@ var Shape = function Shape(container, opts) {
16991707 // this.text is also a public attribute
17001708
17011709 var newOpts = utils . extend ( {
1702- attachment : this
1710+ attachment : undefined ,
1711+ shape : this
17031712 } , this . _opts ) ;
17041713 this . _progressPath = new Path ( svgView . path , newOpts ) ;
17051714} ;
0 commit comments