@@ -46,17 +46,6 @@ function setTheme(theme, store) {
4646 }
4747}
4848
49- // loading the theme after the initial load
50- const prefersDark = window . matchMedia ( "(prefers-color-scheme: dark)" ) ;
51- const theme = loadValue ( 'theme' ) ;
52- if ( prefersDark . matches && ! theme ) {
53- setTheme ( "coal" , false ) ;
54- } else {
55- setTheme ( theme , false ) ;
56- }
57- let disableShortcuts = loadValue ( 'disable-shortcuts' ) === "true" ;
58- document . getElementById ( "disable-shortcuts" ) . checked = disableShortcuts ;
59-
6049window . searchState = {
6150 timeout : null ,
6251 inputElem : document . getElementById ( "search-input" ) ,
@@ -161,9 +150,6 @@ function handleShortcut(ev) {
161150 }
162151}
163152
164- document . addEventListener ( "keypress" , handleShortcut ) ;
165- document . addEventListener ( "keydown" , handleShortcut ) ;
166-
167153function toggleElements ( filter , value ) {
168154 let needsUpdate = false ;
169155 let count = 0 ;
@@ -271,13 +257,13 @@ const GROUPS_FILTER_DEFAULT = {
271257 cargo : true ,
272258 complexity : true ,
273259 correctness : true ,
274- deprecated : false ,
275260 nursery : true ,
276261 pedantic : true ,
277262 perf : true ,
278263 restriction : true ,
279264 style : true ,
280265 suspicious : true ,
266+ deprecated : false ,
281267} ;
282268const LEVEL_FILTERS_DEFAULT = {
283269 allow : true ,
@@ -287,7 +273,6 @@ const LEVEL_FILTERS_DEFAULT = {
287273} ;
288274const APPLICABILITIES_FILTER_DEFAULT = {
289275 Unspecified : true ,
290- Unresolved : true ,
291276 MachineApplicable : true ,
292277 MaybeIncorrect : true ,
293278 HasPlaceholders : true ,
@@ -570,9 +555,6 @@ function generateSearch() {
570555 searchState . inputElem . addEventListener ( "paste" , handleInputChanged ) ;
571556}
572557
573- generateSettings ( ) ;
574- generateSearch ( ) ;
575-
576558function scrollToLint ( lintId ) {
577559 const target = document . getElementById ( lintId ) ;
578560 if ( ! target ) {
@@ -617,7 +599,28 @@ function parseURLFilters() {
617599 }
618600}
619601
620- parseURLFilters ( ) ;
621- scrollToLintByURL ( ) ;
622- filters . filterLints ( ) ;
623- onEachLazy ( document . querySelectorAll ( "pre > code.language-rust" ) , el => hljs . highlightElement ( el ) ) ;
602+ // loading the theme after the initial load
603+ const prefersDark = window . matchMedia ( "(prefers-color-scheme: dark)" ) ;
604+ const theme = loadValue ( 'theme' ) ;
605+ if ( prefersDark . matches && ! theme ) {
606+ setTheme ( "coal" , false ) ;
607+ } else {
608+ setTheme ( theme , false ) ;
609+ }
610+
611+ let disableShortcuts = loadValue ( 'disable-shortcuts' ) === "true" ;
612+ // To prevent having a "flash", we give back time to the web browser to finish rendering with
613+ // theme applied before finishing the rendering.
614+ setTimeout ( ( ) => {
615+ document . getElementById ( "disable-shortcuts" ) . checked = disableShortcuts ;
616+
617+ document . addEventListener ( "keypress" , handleShortcut ) ;
618+ document . addEventListener ( "keydown" , handleShortcut ) ;
619+
620+ generateSettings ( ) ;
621+ generateSearch ( ) ;
622+ parseURLFilters ( ) ;
623+ scrollToLintByURL ( ) ;
624+ filters . filterLints ( ) ;
625+ onEachLazy ( document . querySelectorAll ( "pre > code.language-rust" ) , el => hljs . highlightElement ( el ) ) ;
626+ } , 0 ) ;
0 commit comments