about summary refs log tree commit diff
path: root/src/librustdoc/html/static
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-08-27 21:30:32 +0000
committerbors <bors@rust-lang.org>2020-08-27 21:30:32 +0000
commit397b390cc76ba1d98f80b2a24a371f708dcc9169 (patch)
treed9472435c9a978697ef2e7dc3e842a8646103cca /src/librustdoc/html/static
parent132f5fc2e5247cf5dab74e5a4408135056852c30 (diff)
parent86e42c2742423aacbf70ba49c499a83846f57712 (diff)
downloadrust-397b390cc76ba1d98f80b2a24a371f708dcc9169.tar.gz
rust-397b390cc76ba1d98f80b2a24a371f708dcc9169.zip
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
Diffstat (limited to 'src/librustdoc/html/static')
-rw-r--r--src/librustdoc/html/static/main.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 57c8d5bff76..881b27a5d61 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -344,6 +344,7 @@ function defocusSearchBar() {
     }
 
     function getHelpElement() {
+        buildHelperPopup();
         return document.getElementById("help");
     }
 
@@ -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 \
@@ -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