diff options
| author | Kinrany <kinrany@yandex.com> | 2019-07-20 23:12:57 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-07-20 23:12:57 +0300 |
| commit | 112a3473d046c7f2e677de2b71259649b9e4b9fd (patch) | |
| tree | 7ab595a7e4fb706dad8d0523d9c91e929cc993e1 | |
| parent | 95b1fe560d2bd8472f250fb8cfd2168520a58405 (diff) | |
| download | rust-112a3473d046c7f2e677de2b71259649b9e4b9fd.tar.gz rust-112a3473d046c7f2e677de2b71259649b9e4b9fd.zip | |
Fix theme picker blur handler: always hide instead of switching
| -rw-r--r-- | src/librustdoc/html/render.rs | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 3cd520fd4b5..c5cc04b9af5 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -874,15 +874,23 @@ fn write_shared( r#"var themes = document.getElementById("theme-choices"); var themePicker = document.getElementById("theme-picker"); +function showThemeButtonState() {{ + themes.style.display = "none"; + themePicker.style.borderBottomRightRadius = "3px"; + themePicker.style.borderBottomLeftRadius = "3px"; +}} + +function hideThemeButtonState() {{ + themes.style.display = "block"; + themePicker.style.borderBottomRightRadius = "0"; + themePicker.style.borderBottomLeftRadius = "0"; +}} + function switchThemeButtonState() {{ if (themes.style.display === "block") {{ - themes.style.display = "none"; - themePicker.style.borderBottomRightRadius = "3px"; - themePicker.style.borderBottomLeftRadius = "3px"; + showThemeButtonState(); }} else {{ - themes.style.display = "block"; - themePicker.style.borderBottomRightRadius = "0"; - themePicker.style.borderBottomLeftRadius = "0"; + hideThemeButtonState(); }} }}; @@ -895,7 +903,7 @@ function handleThemeButtonsBlur(e) {{ (!related || (related.id !== "themePicker" && (!related.parentNode || related.parentNode.id !== "theme-choices")))) {{ - switchThemeButtonState(); + hideThemeButtonState(); }} }} |
