File tree 2 files changed +22
-0
lines changed
src/librustdoc/html/static
2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,9 @@ body {
121
121
122
122
.content pre .line-numbers { float : left; border : none; }
123
123
.line-numbers span { color : # c67e2d ; }
124
+ .line-numbers .line-highlighted {
125
+ background-color : # fff871 ;
126
+ }
124
127
125
128
.content .highlighted {
126
129
cursor : pointer;
Original file line number Diff line number Diff line change 31
31
resizeShortBlocks ( ) ;
32
32
$ ( window ) . on ( 'resize' , resizeShortBlocks ) ;
33
33
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
+
34
53
$ ( document ) . on ( 'keyup' , function ( e ) {
35
54
if ( document . activeElement . tagName === 'INPUT' ) {
36
55
return ;
You can’t perform that action at this time.
0 commit comments