From e9bcb4eb89048a5f95c2355007e3b22a4ab38093 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 8 Feb 2018 23:47:49 +0100 Subject: [PATCH] Hide theme button under menu in mobile mode and fix top margin issue (in mobile too) --- src/librustdoc/html/static/main.js | 37 +++++--------------------- src/librustdoc/html/static/rustdoc.css | 2 +- 2 files changed, 7 insertions(+), 32 deletions(-) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index ba9bcb7af7ae0..f688be89beebc 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -123,25 +123,9 @@ sidebar.appendChild(div); } } - var themeChoices = document.getElementById("theme-choices"); - if (themeChoices) { - if (!themesWidth) { - var savedState = themeChoices.style.display; - themeChoices.style.display = 'block'; - themesWidth = themeChoices.offsetWidth + 'px'; - themeChoices.style.display = savedState; - } - themeChoices.style.position = "fixed"; - themeChoices.style.width = themesWidth; - themeChoices.style.top = '78px'; - themeChoices.style.left = '250px'; - } - document.getElementsByTagName("body")[0].style.marginTop = '45px'; - var themePicker = document.getElementById("theme-picker"); - if (themePicker) { - themePicker.style.position = "fixed"; - themePicker.style.top = "50px"; - themePicker.style.left = "250px"; + var themePicker = document.getElementsByClassName("theme-picker"); + if (themePicker && themePicker.length > 0) { + themePicker[0].style.display = "none"; } } @@ -157,18 +141,9 @@ filler.remove(); } document.getElementsByTagName("body")[0].style.marginTop = ''; - var themePicker = document.getElementById("theme-picker"); - if (themePicker) { - themePicker.style.position = "absolute"; - themePicker.style.top = null; - themePicker.style.left = null; - } - var themeChoices = document.getElementById("theme-choices"); - if (themeChoices) { - themeChoices.style.position = 'absolute'; - themeChoices.style.width = null; - themeChoices.style.top = null; - themeChoices.style.left = null; + var themePicker = document.getElementsByClassName("theme-picker"); + if (themePicker && themePicker.length > 0) { + themePicker[0].style.display = null; } } diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 53d57b672303e..cd4f2cfa678e6 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -899,7 +899,7 @@ span.since { } #main { - margin-top: 50px; + margin-top: 45px; padding: 0; }