diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-04-01 01:51:18 -0700 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-04-01 01:51:18 -0700 |
commit | 4d880fc05bea10b46caff330d20c66db3d56aae0 (patch) | |
tree | f5af1da1475535fdf9d27d1d65dc23c81489ec38 /lib/parse/progress.js | |
parent | 7b0d50fc45784ebb3c8845931bf38554900db1d7 (diff) | |
download | gitbook-4d880fc05bea10b46caff330d20c66db3d56aae0.zip gitbook-4d880fc05bea10b46caff330d20c66db3d56aae0.tar.gz gitbook-4d880fc05bea10b46caff330d20c66db3d56aae0.tar.bz2 |
Improve animation and display of progress bar
Diffstat (limited to 'lib/parse/progress.js')
-rw-r--r-- | lib/parse/progress.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/parse/progress.js b/lib/parse/progress.js index 8088aa8..73fbbe0 100644 --- a/lib/parse/progress.js +++ b/lib/parse/progress.js @@ -2,7 +2,7 @@ var _ = require("lodash"); var calculProgress = function(navigation, current) { var n = _.size(navigation); - var percent = 0; + var percent = 0, prevPercent = 0; var done = true; var chapters = _.chain(navigation) @@ -22,6 +22,8 @@ var calculProgress = function(navigation, current) { if (nav.path == current) { percent = nav.percent; done = false; + } else if (done) { + prevPercent = nav.percent; } return nav; @@ -30,6 +32,7 @@ var calculProgress = function(navigation, current) { return { + prevPercent: prevPercent, percent: percent, chapters: chapters }; |