Skip to content

Commit 434865d

Browse files
committed
Rollup merge of #48080 - GuillaumeGomez:mobile-docs-fixes, r=QuietMisdreavus Hide theme button under menu in mobile mode and fix top margin issue … Fixes #48060.
2 parents f85ae2d + e9bcb4e commit 434865d

File tree

2 files changed

+7
-32
lines changed

2 files changed

+7
-32
lines changed

src/librustdoc/html/static/main.js

+6-31
Original file line numberDiff line numberDiff line change
@@ -123,25 +123,9 @@
123123
sidebar.appendChild(div);
124124
}
125125
}
126-
var themeChoices = document.getElementById("theme-choices");
127-
if (themeChoices) {
128-
if (!themesWidth) {
129-
var savedState = themeChoices.style.display;
130-
themeChoices.style.display = 'block';
131-
themesWidth = themeChoices.offsetWidth + 'px';
132-
themeChoices.style.display = savedState;
133-
}
134-
themeChoices.style.position = "fixed";
135-
themeChoices.style.width = themesWidth;
136-
themeChoices.style.top = '78px';
137-
themeChoices.style.left = '250px';
138-
}
139-
document.getElementsByTagName("body")[0].style.marginTop = '45px';
140-
var themePicker = document.getElementById("theme-picker");
141-
if (themePicker) {
142-
themePicker.style.position = "fixed";
143-
themePicker.style.top = "50px";
144-
themePicker.style.left = "250px";
126+
var themePicker = document.getElementsByClassName("theme-picker");
127+
if (themePicker && themePicker.length > 0) {
128+
themePicker[0].style.display = "none";
145129
}
146130
}
147131

@@ -157,18 +141,9 @@
157141
filler.remove();
158142
}
159143
document.getElementsByTagName("body")[0].style.marginTop = '';
160-
var themePicker = document.getElementById("theme-picker");
161-
if (themePicker) {
162-
themePicker.style.position = "absolute";
163-
themePicker.style.top = null;
164-
themePicker.style.left = null;
165-
}
166-
var themeChoices = document.getElementById("theme-choices");
167-
if (themeChoices) {
168-
themeChoices.style.position = 'absolute';
169-
themeChoices.style.width = null;
170-
themeChoices.style.top = null;
171-
themeChoices.style.left = null;
144+
var themePicker = document.getElementsByClassName("theme-picker");
145+
if (themePicker && themePicker.length > 0) {
146+
themePicker[0].style.display = null;
172147
}
173148
}
174149

src/librustdoc/html/static/rustdoc.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ span.since {
899899
}
900900

901901
#main {
902-
margin-top: 50px;
902+
margin-top: 45px;
903903
padding: 0;
904904
}
905905

0 commit comments

Comments
 (0)