This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +19
-7
lines changed
src/librustdoc/html/static/js Expand file tree Collapse file tree 3 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -1101,7 +1101,6 @@ function preLoadCss(cssUrl) {
11011101 } ) ;
11021102 } ( ) ) ;
11031103
1104- // @ts -expect-error
11051104 window . rustdoc_add_line_numbers_to_examples = ( ) => {
11061105 // @ts -expect-error
11071106 function generateLine ( nb ) {
@@ -1123,7 +1122,6 @@ function preLoadCss(cssUrl) {
11231122 } ) ;
11241123 } ;
11251124
1126- // @ts -expect-error
11271125 window . rustdoc_remove_line_numbers_from_examples = ( ) => {
11281126 onEachLazy (
11291127 document . querySelectorAll ( ".rustdoc:not(.src) :not(.scraped-example) > .example-wrap" ) ,
@@ -1132,7 +1130,6 @@ function preLoadCss(cssUrl) {
11321130 } ;
11331131
11341132 if ( getSettingValue ( "line-numbers" ) === "true" ) {
1135- // @ts -expect-error
11361133 window . rustdoc_add_line_numbers_to_examples ( ) ;
11371134 }
11381135
Original file line number Diff line number Diff line change @@ -78,6 +78,8 @@ declare global {
7878 pending_implementors ?: rustdoc . Implementors ,
7979 register_type_impls ?: function ( rustdoc . TypeImpls ) : void ,
8080 pending_type_impls ?: rustdoc . TypeImpls ,
81+ rustdoc_add_line_numbers_to_examples ?: function ( ) ,
82+ rustdoc_remove_line_numbers_from_examples ?: function ( ) ,
8183 }
8284 interface HTMLElement {
8385 /** Used by the popover tooltip code. */
Original file line number Diff line number Diff line change 44/* global MAIN_ID, getVar, getSettingsButton, getHelpButton */
55
66// Eventually fix this.
7- // @ts -nocheck
87
98"use strict" ;
109
1110( function ( ) {
1211 const isSettingsPage = window . location . pathname . endsWith ( "/settings.html" ) ;
1312
13+ /**
14+ * @overload {"theme"|"preferred-dark-theme"|"preferred-light-theme"}
15+ * @param {string } settingName
16+ * @param {string } value
17+ * @returns
18+ * @param {string } settingName
19+ * @param {string|boolean } value
20+ */
1421 function changeSetting ( settingName , value ) {
1522 if ( settingName === "theme" ) {
1623 const useSystem = value === "system preference" ? "true" : "false" ;
1724 updateLocalStorage ( "use-system-theme" , useSystem ) ;
1825 }
19- updateLocalStorage ( settingName , value ) ;
26+ updateLocalStorage ( settingName , "" + value ) ;
2027
2128 switch ( settingName ) {
2229 case "theme" :
2734 break ;
2835 case "line-numbers" :
2936 if ( value === true ) {
30- window . rustdoc_add_line_numbers_to_examples ( ) ;
37+ const f = window . rustdoc_add_line_numbers_to_examples ;
38+ if ( f !== undefined ) {
39+ f ( ) ;
40+ }
3141 } else {
32- window . rustdoc_remove_line_numbers_from_examples ( ) ;
42+ const f = window . rustdoc_remove_line_numbers_from_examples ;
43+ if ( f !== undefined ) {
44+ f ( ) ;
45+ }
3346 }
3447 break ;
3548 case "hide-sidebar" :
You can’t perform that action at this time.
0 commit comments