Skip to content

Commit 55cc9a4

Browse files
committed
Remember state of top-level collapse toggle widget
1 parent 0e3c9bb commit 55cc9a4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/librustdoc/html/static/main.js

+6
Original file line numberDiff line numberDiff line change
@@ -1623,6 +1623,7 @@
16231623
function toggleAllDocs() {
16241624
var toggle = document.getElementById("toggle-all-docs");
16251625
if (hasClass(toggle, "will-expand")) {
1626+
updateLocalStorage("collapse", "false");
16261627
removeClass(toggle, "will-expand");
16271628
onEveryMatchingChild(toggle, "inner", function(e) {
16281629
e.innerHTML = labelForToggleButton(false);
@@ -1632,6 +1633,7 @@
16321633
collapseDocs(e, "show");
16331634
});
16341635
} else {
1636+
updateLocalStorage("collapse", "true");
16351637
addClass(toggle, "will-expand");
16361638
onEveryMatchingChild(toggle, "inner", function(e) {
16371639
e.innerHTML = labelForToggleButton(true);
@@ -1972,6 +1974,10 @@
19721974
window.onresize = function() {
19731975
hideSidebar();
19741976
};
1977+
1978+
if (getCurrentValue("collapse") === "true") {
1979+
toggleAllDocs();
1980+
}
19751981
}());
19761982

19771983
// Sets the focus on the search bar at the top of the page

0 commit comments

Comments
 (0)