diff options
| author | bors <bors@rust-lang.org> | 2021-03-23 02:01:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-03-23 02:01:14 +0000 |
| commit | 2bd94f4aa9683158c7df96b9661be193c39a55ed (patch) | |
| tree | ef88985b7237c4b6f77c27e17e9fbce5577d29f1 /src/librustdoc/html/static/storage.js | |
| parent | 5d04957a4b4714f71d38326fc96a0b0ef6dc5800 (diff) | |
| parent | 263c85875cb3aceced6cc712961234fc61d71cba (diff) | |
| download | rust-2bd94f4aa9683158c7df96b9661be193c39a55ed.tar.gz rust-2bd94f4aa9683158c7df96b9661be193c39a55ed.zip | |
Auto merge of #83398 - JohnTitor:rollup-om80krv, r=JohnTitor
Rollup of 7 pull requests Successful merges: - #80705 (Update Source Code Pro and include italics) - #81917 (Update RELEASES.md for 1.51.0) - #82732 (Remove theme.js file) - #83356 (rustdoc: Replace pair of `Option`s with an enum) - #83384 (rename :pat2018 -> :pat2015) - #83385 (:arrow_up: rust-analyzer) - #83389 (add rust-analyzer rustc_private option in librustdoc Cargo.toml) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src/librustdoc/html/static/storage.js')
| -rw-r--r-- | src/librustdoc/html/static/storage.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/librustdoc/html/static/storage.js b/src/librustdoc/html/static/storage.js index b8b6fcbaf3a..c68128516d2 100644 --- a/src/librustdoc/html/static/storage.js +++ b/src/librustdoc/html/static/storage.js @@ -2,8 +2,8 @@ /* global resourcesSuffix */ var darkThemes = ["dark", "ayu"]; -var currentTheme = document.getElementById("themeStyle"); -var mainTheme = document.getElementById("mainThemeStyle"); +window.currentTheme = document.getElementById("themeStyle"); +window.mainTheme = document.getElementById("mainThemeStyle"); var settingsDataset = (function () { var settingsElement = document.getElementById("default-settings"); @@ -137,7 +137,7 @@ function switchTheme(styleElem, mainStyleElem, newTheme, saveTheme) { } } -// This function is called from "theme.js", generated in `html/render/mod.rs`. +// This function is called from "main.js". // eslint-disable-next-line no-unused-vars function useSystemTheme(value) { if (value === undefined) { @@ -161,8 +161,8 @@ var updateSystemTheme = (function() { .getPropertyValue('content'); switchTheme( - currentTheme, - mainTheme, + window.currentTheme, + window.mainTheme, JSON.parse(cssTheme) || "light", true ); @@ -180,10 +180,10 @@ var updateSystemTheme = (function() { if (mql.matches) { // prefers a dark theme - switchTheme(currentTheme, mainTheme, darkTheme, true); + switchTheme(window.currentTheme, window.mainTheme, darkTheme, true); } else { // prefers a light theme, or has no preference - switchTheme(currentTheme, mainTheme, lightTheme, true); + switchTheme(window.currentTheme, window.mainTheme, lightTheme, true); } // note: we save the theme so that it doesn't suddenly change when @@ -212,8 +212,8 @@ if (getSettingValue("use-system-theme") !== "false" && window.matchMedia) { updateSystemTheme(); } else { switchTheme( - currentTheme, - mainTheme, + window.currentTheme, + window.mainTheme, getSettingValue("theme") || "light", false ); |
