File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
src/librustdoc/html/static Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,9 @@ body {
121121
122122.content pre .line-numbers { float : left; border : none; }
123123.line-numbers span { color : # c67e2d ; }
124+ .line-numbers .line-highlighted {
125+ background-color : # fff871 ;
126+ }
124127
125128.content .highlighted {
126129 cursor : pointer;
Original file line number Diff line number Diff line change 3131 resizeShortBlocks ( ) ;
3232 $ ( window ) . on ( 'resize' , resizeShortBlocks ) ;
3333
34+ function highlightSourceLines ( ) {
35+ var i , from , to , match = window . location . hash . match ( / ^ # ? ( \d + ) (?: - ( \d + ) ) ? $ / ) ;
36+ if ( match ) {
37+ from = parseInt ( match [ 1 ] , 10 ) ;
38+ to = Math . min ( 50000 , parseInt ( match [ 2 ] || match [ 1 ] , 10 ) ) ;
39+ from = Math . min ( from , to ) ;
40+ if ( $ ( '#' + from ) . length === 0 ) {
41+ return ;
42+ }
43+ $ ( '#' + from ) [ 0 ] . scrollIntoView ( ) ;
44+ $ ( '.line-numbers span' ) . removeClass ( 'line-highlighted' ) ;
45+ for ( i = from ; i <= to ; i += 1 ) {
46+ $ ( '#' + i ) . addClass ( 'line-highlighted' ) ;
47+ }
48+ }
49+ }
50+ highlightSourceLines ( ) ;
51+ $ ( window ) . on ( 'hashchange' , highlightSourceLines ) ;
52+
3453 $ ( document ) . on ( 'keyup' , function ( e ) {
3554 if ( document . activeElement . tagName === 'INPUT' ) {
3655 return ;
You can’t perform that action at this time.
0 commit comments