Skip to content

Commit

Permalink
Show everything when noscript is on
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Dec 6, 2018
1 parent a689887 commit e17518f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/librustdoc/html/layout.rs
Expand Up @@ -54,6 +54,7 @@ pub fn render<T: fmt::Display, S: fmt::Display>(
<link rel=\"stylesheet\" type=\"text/css\" href=\"{root_path}light{suffix}.css\" \
id=\"themeStyle\">\
<script src=\"{root_path}storage{suffix}.js\"></script>\
<noscript><link rel=\"stylesheet\" href=\"{root_path}noscript{suffix}.css\"></noscript>\
{css_extension}\
{favicon}\
{in_header}\
Expand Down
3 changes: 3 additions & 0 deletions src/librustdoc/html/render.rs
Expand Up @@ -772,6 +772,9 @@ fn write_shared(
write_minify(cx.dst.join(&format!("settings{}.css", cx.shared.resource_suffix)),
static_files::SETTINGS_CSS,
options.enable_minification)?;
write_minify(cx.dst.join(&format!("noscript{}.css", cx.shared.resource_suffix)),
static_files::NOSCRIPT_CSS,
options.enable_minification)?;

// To avoid "light.css" to be overwritten, we'll first run over the received themes and only
// then we'll run over the "official" styles.
Expand Down
19 changes: 19 additions & 0 deletions src/librustdoc/html/static/noscript.css
@@ -0,0 +1,19 @@
/**
* Copyright 2018 The Rust Project Developers. See the COPYRIGHT
* file at the top-level directory of this distribution and at
* http://rust-lang.org/COPYRIGHT.
*
* Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
* http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
* <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
* option. This file may not be copied, modified, or distributed
* except according to those terms.
*/

#main > h2 + div, #main > h2 + h3, #main > h3 + div {
display: block;
}

.loading-content {
display: none;
}
3 changes: 3 additions & 0 deletions src/librustdoc/html/static_files.rs
Expand Up @@ -23,6 +23,9 @@ pub static RUSTDOC_CSS: &'static str = include_str!("static/rustdoc.css");
/// The file contents of `settings.css`, responsible for the items on the settings page.
pub static SETTINGS_CSS: &'static str = include_str!("static/settings.css");

/// The file contents of the `noscript.css` file, used in case JS isn't supported or is disabled.
pub static NOSCRIPT_CSS: &'static str = include_str!("static/noscript.css");

/// The file contents of `normalize.css`, included to even out standard elements between browser
/// implementations.
pub static NORMALIZE_CSS: &'static str = include_str!("static/normalize.css");
Expand Down

0 comments on commit e17518f

Please sign in to comment.