From e17518f65ea7b9af90e91f15784a485a3f4a6598 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 2 Dec 2018 18:00:50 +0100 Subject: [PATCH] Show everything when noscript is on --- src/librustdoc/html/layout.rs | 1 + src/librustdoc/html/render.rs | 3 +++ src/librustdoc/html/static/noscript.css | 19 +++++++++++++++++++ src/librustdoc/html/static_files.rs | 3 +++ 4 files changed, 26 insertions(+) create mode 100644 src/librustdoc/html/static/noscript.css diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs index fa5d015e5b7..3e69db3f899 100644 --- a/src/librustdoc/html/layout.rs +++ b/src/librustdoc/html/layout.rs @@ -54,6 +54,7 @@ pub fn render( \ \ + \ {css_extension}\ {favicon}\ {in_header}\ diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 0d2d6082174..2ffd4dd7e57 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -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. diff --git a/src/librustdoc/html/static/noscript.css b/src/librustdoc/html/static/noscript.css new file mode 100644 index 00000000000..f4de75f2140 --- /dev/null +++ b/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 or the MIT license + * , 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; +} diff --git a/src/librustdoc/html/static_files.rs b/src/librustdoc/html/static_files.rs index a485facfac2..f71b2a87284 100644 --- a/src/librustdoc/html/static_files.rs +++ b/src/librustdoc/html/static_files.rs @@ -23,6 +23,9 @@ /// 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");