Skip to content

Commit 72c8fb4

Browse files
authored
Rollup merge of #75976 - GuillaumeGomez:help-popup, r=jyn514
Improve help popup Fixes #75623. The second commit is just a slight improvement: the help popup won't be created until someone presses "?" or ESC. Not a big improvement in itself but considering the low amount of code required, I think it was worth the shot. r? @jyn514
2 parents 33b9361 + 86e42c2 commit 72c8fb4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/librustdoc/html/static/main.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ function defocusSearchBar() {
344344
}
345345

346346
function getHelpElement() {
347+
buildHelperPopup();
347348
return document.getElementById("help");
348349
}
349350

@@ -2807,8 +2808,8 @@ function defocusSearchBar() {
28072808

28082809
var infos = [
28092810
"Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to \
2810-
restrict the search to a given type.",
2811-
"Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, \
2811+
restrict the search to a given item kind.",
2812+
"Accepted kinds are: <code>fn</code>, <code>mod</code>, <code>struct</code>, \
28122813
<code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, \
28132814
and <code>const</code>.",
28142815
"Search functions by type signature (e.g., <code>vec -&gt; usize</code> or \
@@ -2828,12 +2829,12 @@ function defocusSearchBar() {
28282829

28292830
popup.appendChild(container);
28302831
insertAfter(popup, getSearchElement());
2832+
// So that it's only built once and then it'll do nothing when called!
2833+
buildHelperPopup = function() {};
28312834
}
28322835

28332836
onHashChange(null);
28342837
window.onhashchange = onHashChange;
2835-
2836-
buildHelperPopup();
28372838
}());
28382839

28392840
// This is required in firefox. Explanations: when going back in the history, firefox doesn't re-run

0 commit comments

Comments
 (0)