Skip to content

Commit

Permalink
Auto merge of #75976 - GuillaumeGomez:help-popup, r=jyn514
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Aug 27, 2020
2 parents 132f5fc + 86e42c2 commit 397b390
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ function defocusSearchBar() {
}

function getHelpElement() {
buildHelperPopup();
return document.getElementById("help");
}

Expand Down Expand Up @@ -2807,8 +2808,8 @@ function defocusSearchBar() {

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

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

onHashChange(null);
window.onhashchange = onHashChange;

buildHelperPopup();
}());

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

0 comments on commit 397b390

Please sign in to comment.