File tree Expand file tree Collapse file tree 1 file changed +22
-6
lines changed
Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Original file line number Diff line number Diff line change 1818
1919 var Settings = NProgress . settings = {
2020 minimum : 0.08 ,
21- easing : 'ease ' ,
21+ easing : 'linear ' ,
2222 positionUsing : '' ,
23- speed : 200 ,
23+ speed : 350 ,
2424 trickle : true ,
25- trickleRate : 0.02 ,
26- trickleSpeed : 800 ,
25+ trickleSpeed : 250 ,
2726 showSpinner : true ,
2827 barSelector : '[role="bar"]' ,
2928 spinnerSelector : '[role="spinner"]' ,
161160
162161 if ( ! n ) {
163162 return NProgress . start ( ) ;
163+ } else if ( n > 1 ) {
164+ return ;
164165 } else {
165166 if ( typeof amount !== 'number' ) {
166- amount = ( 1 - n ) * clamp ( Math . random ( ) * n , 0.1 , 0.95 ) ;
167+ if ( n >= 0 && n < 0.25 ) {
168+ // Start out between 3 - 6% increments
169+ amount = ( Math . random ( ) * ( 5 - 3 + 1 ) + 3 ) / 100 ;
170+ } else if ( n >= 0.25 && n < 0.65 ) {
171+ // increment between 0 - 3%
172+ amount = ( Math . random ( ) * 3 ) / 100 ;
173+ } else if ( n >= 0.65 && n < 0.9 ) {
174+ // increment between 0 - 2%
175+ amount = ( Math . random ( ) * 2 ) / 100 ;
176+ } else if ( n >= 0.9 && n < 0.99 ) {
177+ // finally, increment it .5 %
178+ amount = 0.005 ;
179+ } else {
180+ // after 99%, don't increment:
181+ amount = 0 ;
182+ }
167183 }
168184
169185 n = clamp ( n + amount , 0 , 0.994 ) ;
172188 } ;
173189
174190 NProgress . trickle = function ( ) {
175- return NProgress . inc ( Math . random ( ) * Settings . trickleRate ) ;
191+ return NProgress . inc ( ) ;
176192 } ;
177193
178194 /**
You can’t perform that action at this time.
0 commit comments