1
Fork 0

Auto 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
This commit is contained in:
bors 2020-08-27 21:30:32 +00:00
commit 397b390cc7

View file

@ -344,6 +344,7 @@ function defocusSearchBar() {
} }
function getHelpElement() { function getHelpElement() {
buildHelperPopup();
return document.getElementById("help"); return document.getElementById("help");
} }
@ -2807,8 +2808,8 @@ function defocusSearchBar() {
var infos = [ var infos = [
"Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to \ "Prefix searches with a type followed by a colon (e.g., <code>fn:</code>) to \
restrict the search to a given type.", restrict the search to a given item kind.",
"Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, \ "Accepted kinds are: <code>fn</code>, <code>mod</code>, <code>struct</code>, \
<code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, \ <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, \
and <code>const</code>.", and <code>const</code>.",
"Search functions by type signature (e.g., <code>vec -&gt; usize</code> or \ "Search functions by type signature (e.g., <code>vec -&gt; usize</code> or \
@ -2828,12 +2829,12 @@ function defocusSearchBar() {
popup.appendChild(container); popup.appendChild(container);
insertAfter(popup, getSearchElement()); insertAfter(popup, getSearchElement());
// So that it's only built once and then it'll do nothing when called!
buildHelperPopup = function() {};
} }
onHashChange(null); onHashChange(null);
window.onhashchange = onHashChange; window.onhashchange = onHashChange;
buildHelperPopup();
}()); }());
// This is required in firefox. Explanations: when going back in the history, firefox doesn't re-run // This is required in firefox. Explanations: when going back in the history, firefox doesn't re-run