From 55cc9a43368aae6e6ed3a0c75ee8fd47ac4f3bcd Mon Sep 17 00:00:00 2001 From: Peter Lyons Date: Wed, 28 Feb 2018 20:51:40 -0700 Subject: [PATCH] Remember state of top-level collapse toggle widget --- src/librustdoc/html/static/main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 960f2f198d8..4f90b86a3f7 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -1623,6 +1623,7 @@ function toggleAllDocs() { var toggle = document.getElementById("toggle-all-docs"); if (hasClass(toggle, "will-expand")) { + updateLocalStorage("collapse", "false"); removeClass(toggle, "will-expand"); onEveryMatchingChild(toggle, "inner", function(e) { e.innerHTML = labelForToggleButton(false); @@ -1632,6 +1633,7 @@ collapseDocs(e, "show"); }); } else { + updateLocalStorage("collapse", "true"); addClass(toggle, "will-expand"); onEveryMatchingChild(toggle, "inner", function(e) { e.innerHTML = labelForToggleButton(true); @@ -1972,6 +1974,10 @@ window.onresize = function() { hideSidebar(); }; + + if (getCurrentValue("collapse") === "true") { + toggleAllDocs(); + } }()); // Sets the focus on the search bar at the top of the page