Skip to content

Commit a34bc79

Browse files
Add help button
1 parent 8e73853 commit a34bc79

File tree

6 files changed

+27
-11
lines changed

6 files changed

+27
-11
lines changed

src/librustdoc/html/layout.rs

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ pub fn render<T: Print, S: Print>(
9595
placeholder=\"Click or press ‘S’ to search, ‘?’ for more options…\" \
9696
type=\"search\">\
9797
</div>\
98+
<span class=\"help-button\">?</span>
9899
<a id=\"settings-menu\" href=\"{root_path}settings.html\">\
99100
<img src=\"{static_root_path}wheel{suffix}.svg\" \
100101
width=\"18\" \

src/librustdoc/html/static/main.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,9 @@ function defocusSearchBar() {
473473
}());
474474

475475
document.addEventListener("click", function(ev) {
476-
if (hasClass(ev.target, "collapse-toggle")) {
476+
if (hasClass(ev.target, "help-button")) {
477+
displayHelp(true, ev);
478+
} else if (hasClass(ev.target, "collapse-toggle")) {
477479
collapseDocs(ev.target, "toggle");
478480
} else if (hasClass(ev.target.parentNode, "collapse-toggle")) {
479481
collapseDocs(ev.target.parentNode, "toggle");

src/librustdoc/html/static/rustdoc.css

+14-4
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ a {
674674
}
675675
.search-container > div {
676676
display: inline-flex;
677-
width: calc(100% - 34px);
677+
width: calc(100% - 63px);
678678
}
679679
#crate-search {
680680
margin-top: 5px;
@@ -1250,14 +1250,24 @@ h4 > .important-traits {
12501250
outline: none;
12511251
}
12521252

1253-
#settings-menu {
1253+
#settings-menu, .help-button {
12541254
position: absolute;
1255-
right: 0;
12561255
top: 10px;
1256+
}
1257+
1258+
#settings-menu {
1259+
right: 0;
12571260
outline: none;
12581261
}
12591262

1260-
#theme-picker, #settings-menu {
1263+
.help-button {
1264+
right: 30px;
1265+
font-family: "Fira Sans",sans-serif;
1266+
text-align: center;
1267+
font-size: 17px;
1268+
}
1269+
1270+
#theme-picker, #settings-menu, .help-button {
12611271
padding: 4px;
12621272
width: 27px;
12631273
height: 29px;

src/librustdoc/html/static/themes/ayu.css

+3-2
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ kbd {
489489
box-shadow-color: #c6cbd1;
490490
}
491491

492-
#theme-picker, #settings-menu {
492+
#theme-picker, #settings-menu, .help-button {
493493
border-color: #5c6773;
494494
background-color: #0f1419;
495495
}
@@ -499,7 +499,8 @@ kbd {
499499
}
500500

501501
#theme-picker:hover, #theme-picker:focus,
502-
#settings-menu:hover, #settings-menu:focus {
502+
#settings-menu:hover, #settings-menu:focus,
503+
.help-button:hover, .help-button:focus {
503504
border-color: #e0e0e0;
504505
}
505506

src/librustdoc/html/static/themes/dark.css

+3-2
Original file line numberDiff line numberDiff line change
@@ -383,13 +383,14 @@ kbd {
383383
box-shadow-color: #c6cbd1;
384384
}
385385

386-
#theme-picker, #settings-menu {
386+
#theme-picker, #settings-menu, .help-button {
387387
border-color: #e0e0e0;
388388
background: #f0f0f0;
389389
}
390390

391391
#theme-picker:hover, #theme-picker:focus,
392-
#settings-menu:hover, #settings-menu:focus {
392+
#settings-menu:hover, #settings-menu:focus,
393+
.help-button:hover, .help-button:focus {
393394
border-color: #ffb900;
394395
}
395396

src/librustdoc/html/static/themes/light.css

+3-2
Original file line numberDiff line numberDiff line change
@@ -377,13 +377,14 @@ kbd {
377377
box-shadow-color: #c6cbd1;
378378
}
379379

380-
#theme-picker, #settings-menu {
380+
#theme-picker, #settings-menu, .help-button {
381381
border-color: #e0e0e0;
382382
background-color: #fff;
383383
}
384384

385385
#theme-picker:hover, #theme-picker:focus,
386-
#settings-menu:hover, #settings-menu:focus {
386+
#settings-menu:hover, #settings-menu:focus,
387+
.help-button:hover, .help-button:focus {
387388
border-color: #717171;
388389
}
389390

0 commit comments

Comments
 (0)