1
1
// From rust:
2
- /* global sourcesIndex */
2
+ /* global srcIndex */
3
3
4
4
// Local js definitions:
5
5
/* global addClass, getCurrentValue, onEachLazy, removeClass, browserSupportsHistoryApi */
@@ -101,9 +101,9 @@ function createSidebarToggle() {
101
101
return sidebarToggle ;
102
102
}
103
103
104
- // This function is called from "source -files.js", generated in `html/render/write_shared.rs`.
104
+ // This function is called from "src -files.js", generated in `html/render/write_shared.rs`.
105
105
// eslint-disable-next-line no-unused-vars
106
- function createSourceSidebar ( ) {
106
+ function createSrcSidebar ( ) {
107
107
const container = document . querySelector ( "nav.sidebar" ) ;
108
108
109
109
const sidebarToggle = createSidebarToggle ( ) ;
@@ -118,9 +118,9 @@ function createSourceSidebar() {
118
118
title . className = "title" ;
119
119
title . innerText = "Files" ;
120
120
sidebar . appendChild ( title ) ;
121
- Object . keys ( sourcesIndex ) . forEach ( key => {
122
- sourcesIndex [ key ] [ NAME_OFFSET ] = key ;
123
- hasFoundFile = createDirEntry ( sourcesIndex [ key ] , sidebar , "" , hasFoundFile ) ;
121
+ Object . keys ( srcIndex ) . forEach ( key => {
122
+ srcIndex [ key ] [ NAME_OFFSET ] = key ;
123
+ hasFoundFile = createDirEntry ( srcIndex [ key ] , sidebar , "" , hasFoundFile ) ;
124
124
} ) ;
125
125
126
126
container . appendChild ( sidebar ) ;
@@ -133,7 +133,7 @@ function createSourceSidebar() {
133
133
134
134
const lineNumbersRegex = / ^ # ? ( \d + ) (?: - ( \d + ) ) ? $ / ;
135
135
136
- function highlightSourceLines ( match ) {
136
+ function highlightSrcLines ( match ) {
137
137
if ( typeof match === "undefined" ) {
138
138
match = window . location . hash . match ( lineNumbersRegex ) ;
139
139
}
@@ -172,15 +172,15 @@ function highlightSourceLines(match) {
172
172
}
173
173
}
174
174
175
- const handleSourceHighlight = ( function ( ) {
175
+ const handleSrcHighlight = ( function ( ) {
176
176
let prev_line_id = 0 ;
177
177
178
178
const set_fragment = name => {
179
179
const x = window . scrollX ,
180
180
y = window . scrollY ;
181
181
if ( browserSupportsHistoryApi ( ) ) {
182
182
history . replaceState ( null , null , "#" + name ) ;
183
- highlightSourceLines ( ) ;
183
+ highlightSrcLines ( ) ;
184
184
} else {
185
185
location . replace ( "#" + name ) ;
186
186
}
@@ -221,15 +221,15 @@ const handleSourceHighlight = (function() {
221
221
window . addEventListener ( "hashchange" , ( ) => {
222
222
const match = window . location . hash . match ( lineNumbersRegex ) ;
223
223
if ( match ) {
224
- return highlightSourceLines ( match ) ;
224
+ return highlightSrcLines ( match ) ;
225
225
}
226
226
} ) ;
227
227
228
228
onEachLazy ( document . getElementsByClassName ( "src-line-numbers" ) , el => {
229
- el . addEventListener ( "click" , handleSourceHighlight ) ;
229
+ el . addEventListener ( "click" , handleSrcHighlight ) ;
230
230
} ) ;
231
231
232
- highlightSourceLines ( ) ;
232
+ highlightSrcLines ( ) ;
233
233
234
- window . createSourceSidebar = createSourceSidebar ;
234
+ window . createSrcSidebar = createSrcSidebar ;
235
235
} ) ( ) ;
0 commit comments