@@ -874,15 +874,23 @@ fn write_shared(
874874r#"var themes = document.getElementById("theme-choices");
875875var themePicker = document.getElementById("theme-picker");
876876
877+ function showThemeButtonState() {{
878+ themes.style.display = "none";
879+ themePicker.style.borderBottomRightRadius = "3px";
880+ themePicker.style.borderBottomLeftRadius = "3px";
881+ }}
882+
883+ function hideThemeButtonState() {{
884+ themes.style.display = "block";
885+ themePicker.style.borderBottomRightRadius = "0";
886+ themePicker.style.borderBottomLeftRadius = "0";
887+ }}
888+
877889function switchThemeButtonState() {{
878890 if (themes.style.display === "block") {{
879- themes.style.display = "none";
880- themePicker.style.borderBottomRightRadius = "3px";
881- themePicker.style.borderBottomLeftRadius = "3px";
891+ showThemeButtonState();
882892 }} else {{
883- themes.style.display = "block";
884- themePicker.style.borderBottomRightRadius = "0";
885- themePicker.style.borderBottomLeftRadius = "0";
893+ hideThemeButtonState();
886894 }}
887895}};
888896
@@ -895,7 +903,7 @@ function handleThemeButtonsBlur(e) {{
895903 (!related ||
896904 (related.id !== "themePicker" &&
897905 (!related.parentNode || related.parentNode.id !== "theme-choices")))) {{
898- switchThemeButtonState ();
906+ hideThemeButtonState ();
899907 }}
900908}}
901909
0 commit comments