Skip to content

Commit 9c208e0

Browse files
committed
---
yaml --- r: 208126 b: refs/heads/snap-stage3 c: 92565b3 h: refs/heads/master v: v3
1 parent ef88b05 commit 9c208e0

File tree

4 files changed

+32
-17
lines changed

4 files changed

+32
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 38a97becdf3e6a6157f6f7ec2d98ade8d8edc193
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 6ce05ae6bb0e5762dee940d043feb728e5583564
4+
refs/heads/snap-stage3: 92565b3dfbacca4b2a851758e5e9a784fc5b156e
55
refs/heads/try: 7b4ef47b7805a402d756fb8157101f64880a522f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/librustdoc/html/render.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,8 +1460,9 @@ impl<'a> fmt::Display for Item<'a> {
14601460
try!(write!(fmt, "<span class='out-of-band'>"));
14611461
try!(write!(fmt,
14621462
r##"<span id='render-detail'>
1463-
<a id="toggle-all-docs" href="javascript:void(0)"
1464-
title="collapse all docs">[&#x2212;]</a>
1463+
<a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">
1464+
[<span class='inner'>&#x2212;</span>]
1465+
</a>
14651466
</span>"##));
14661467

14671468
// Write `src` tag

branches/snap-stage3/src/librustdoc/html/static/main.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ pre.rust { position: relative; }
581581

582582
.collapse-toggle > .inner {
583583
display: inline-block;
584-
width: 1ch;
584+
width: 1.2ch;
585585
text-align: center;
586586
}
587587

branches/snap-stage3/src/librustdoc/html/static/main.js

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -806,22 +806,35 @@
806806
window.location = $('.srclink').attr('href');
807807
}
808808

809+
function labelForToggleButton(sectionIsCollapsed) {
810+
if (sectionIsCollapsed) {
811+
// button will expand the section
812+
return "+";
813+
} else {
814+
// button will collapse the section
815+
// note that this text is also set in the HTML template in render.rs
816+
return "\u2212"; // "\u2212" is '−' minus sign
817+
}
818+
}
819+
809820
$("#toggle-all-docs").on("click", function() {
810821
var toggle = $("#toggle-all-docs");
811-
if (toggle.html() == "[\u2212]") {
812-
toggle.html("[+]");
813-
toggle.attr("title", "expand all docs");
814-
$(".docblock").hide();
815-
$(".toggle-label").show();
816-
$(".toggle-wrapper").addClass("collapsed");
817-
$(".collapse-toggle").children(".inner").html("+");
818-
} else {
819-
toggle.html("[\u2212]");
822+
if (toggle.hasClass("will-expand")) {
823+
toggle.removeClass("will-expand");
824+
toggle.children(".inner").text(labelForToggleButton(false));
820825
toggle.attr("title", "collapse all docs");
821826
$(".docblock").show();
822827
$(".toggle-label").hide();
823828
$(".toggle-wrapper").removeClass("collapsed");
824-
$(".collapse-toggle").children(".inner").html("\u2212");
829+
$(".collapse-toggle").children(".inner").text(labelForToggleButton(false));
830+
} else {
831+
toggle.addClass("will-expand");
832+
toggle.children(".inner").text(labelForToggleButton(true));
833+
toggle.attr("title", "expand all docs");
834+
$(".docblock").hide();
835+
$(".toggle-label").show();
836+
$(".toggle-wrapper").addClass("collapsed");
837+
$(".collapse-toggle").children(".inner").text(labelForToggleButton(true));
825838
}
826839
});
827840

@@ -835,20 +848,21 @@
835848
if (relatedDoc.is(":visible")) {
836849
relatedDoc.slideUp({duration:'fast', easing:'linear'});
837850
toggle.parent(".toggle-wrapper").addClass("collapsed");
838-
toggle.children(".inner").html("+");
851+
toggle.children(".inner").text(labelForToggleButton(true));
839852
toggle.children(".toggle-label").fadeIn();
840853
} else {
841854
relatedDoc.slideDown({duration:'fast', easing:'linear'});
842855
toggle.parent(".toggle-wrapper").removeClass("collapsed");
843-
toggle.children(".inner").html("\u2212");
856+
toggle.children(".inner").text(labelForToggleButton(false));
844857
toggle.children(".toggle-label").hide();
845858
}
846859
}
847860
});
848861

849862
$(function() {
850863
var toggle = $("<a/>", {'href': 'javascript:void(0)', 'class': 'collapse-toggle'})
851-
.html("[<span class='inner'>\u2212</span>]");
864+
.html("[<span class='inner'></span>]");
865+
toggle.children(".inner").text(labelForToggleButton(false));
852866

853867
$(".method").each(function() {
854868
if ($(this).next().is(".docblock") ||

0 commit comments

Comments
 (0)