File tree Expand file tree Collapse file tree 2 files changed +74
-69
lines changed
Expand file tree Collapse file tree 2 files changed +74
-69
lines changed Original file line number Diff line number Diff line change @@ -99,11 +99,17 @@ document$.subscribe(() => {
9999 return ! isDescending ? ( B - A ) : ( A - B ) ;
100100 } ) ;
101101
102- const top3 = isDescending ? rows . slice ( 0 , 3 ) : rows . slice ( - 3 ) . reverse ( ) ;
103-
104- if ( top3 [ 0 ] !== undefined ) $ ( dt . row ( top3 [ 0 ] ) . node ( ) ) . addClass ( 'winner-gold' ) ;
105- if ( top3 [ 1 ] !== undefined ) $ ( dt . row ( top3 [ 1 ] ) . node ( ) ) . addClass ( 'winner-silver' ) ;
106- if ( top3 [ 2 ] !== undefined ) $ ( dt . row ( top3 [ 2 ] ) . node ( ) ) . addClass ( 'winner-bronze' ) ;
102+ const prepRows = isDescending ? rows : rows . reverse ( ) ;
103+ const colorClasses = [ 'winner-gold' , 'winner-silver' , 'winner-bronze' ] ;
104+ let currentId = 0 ;
105+ let topId = 0 ;
106+ while ( topId < 3 ) {
107+ $ ( dt . row ( prepRows [ currentId ] ) . node ( ) ) . addClass ( colorClasses [ topId ] ) ;
108+ if ( getRank ( prepRows [ currentId ] ) != getRank ( prepRows [ currentId + 1 ] ) ) {
109+ topId += 1 ;
110+ }
111+ currentId += 1 ;
112+ }
107113 } ;
108114
109115 paintWinners ( ) ;
You can’t perform that action at this time.
0 commit comments