@@ -10,15 +10,17 @@ var width;
1010
1111function offset ( d , i ) {
1212 // increase the y offset if the document name changed in this revision
13- if ( i > 0 && data [ i - 1 ] . name !== d . name || d . rev . match ( "^rfc\d+$" ) )
13+ if ( i > 0 && data [ i - 1 ] . name !== d . name || d . rev . match ( "^rfc\d+$" ) ) {
1414 bar_y += bar_height ;
15+ }
1516 return "translate(" + x_scale ( d . published ) + ", " + bar_y + ")" ;
1617}
1718
1819
1920function bar_width ( d , i ) {
20- if ( i < data . length - 1 )
21+ if ( i < data . length - 1 ) {
2122 return x_scale ( data [ i + 1 ] . published ) - x_scale ( d . published ) ;
23+ }
2224}
2325
2426
@@ -62,8 +64,9 @@ function draw_timeline() {
6264 bar_height = parseFloat ( $ ( "body" ) . css ( "line-height" ) ) ;
6365
6466 var div = $ ( "#timeline" ) ;
65- if ( div . is ( ":empty" ) )
67+ if ( div . is ( ":empty" ) ) {
6668 div . append ( "<svg></svg>" ) ;
69+ }
6770 var chart = d3 . select ( "#timeline svg" ) . attr ( "width" , width ) ;
6871
6972 var gradient = chart . append ( "defs" )
@@ -120,7 +123,7 @@ function draw_timeline() {
120123 g . append ( "text" )
121124 . attr ( {
122125 x : 3 ,
123- y : bar_height / 2
126+ y : bar_height / 2
124127 } )
125128 . text ( function ( d ) { return d . rev ; } ) ;
126129
@@ -146,7 +149,7 @@ function draw_timeline() {
146149 chart . append ( "g" )
147150 . attr ( {
148151 class : "y axis" ,
149- transform : "translate(10, " + bar_height / 2 + ")"
152+ transform : "translate(10, " + bar_height / 2 + ")"
150153 } )
151154 . call ( y_axis )
152155 . selectAll ( "text" )
@@ -162,17 +165,17 @@ function draw_timeline() {
162165
163166
164167d3 . json ( "doc.json" , function ( error , json ) {
165- if ( error ) return ;
166- data = json [ " rev_history" ] ;
168+ if ( error ) { return ; }
169+ data = json . rev_history ;
167170
168171 if ( data . length ) {
169172 // make js dates out of publication dates
170173 data . forEach ( function ( d ) { d . published = new Date ( d . published ) ; } ) ;
171174
172175 // add pseudo entry 185 days after last rev (when the ID will expire)
173176 var pseudo = new Date ( data [ data . length - 1 ] . published . getTime ( ) +
174- 1000 * 60 * 60 * 24 * 185 ) ;
175- data . push ( { name : "" , rev : "" , published : pseudo } ) ;
177+ 1000 * 60 * 60 * 24 * 185 ) ;
178+ data . push ( { name : "" , rev : "" , published : pseudo } ) ;
176179 draw_timeline ( ) ;
177180 }
178181} ) ;
0 commit comments